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.

feat(presets): merge univer-presets into univer (#6703)

白熱03e587f4dfe7
diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml
index 146e1649b1..5258e8d9d3 100644
--- a/.github/workflows/semgrep.yml
+++ b/.github/workflows/semgrep.yml
@@ -51,8 +51,7 @@ jobs:
semgrep scan \
--config auto \
--sarif \
- --output reports/semgrep.sarif \
- --error
+ --output reports/semgrep.sarif
exit_code=$?
set -e
else
@@ -152,7 +151,7 @@ jobs:
summary.write(f"- Code scanning upload: {sarif_upload_outcome}\n")
PY
- - name: Fail on Semgrep execution errors
+ - name: Fail on Semgrep error findings or execution errors
if: ${{ always() }}
shell: bash
env:
@@ -163,14 +162,30 @@ jobs:
exit 2
fi
- if [ "$SEMGREP_EXIT_CODE" -eq 1 ]; then
- echo "Semgrep reported findings."
- echo "The SARIF report has been uploaded and the job will continue."
- exit 0
- fi
-
if [ "$SEMGREP_EXIT_CODE" -ne 0 ]; then
echo "Semgrep execution failed."
echo "See the uploaded SARIF artifact for details."
exit "$SEMGREP_EXIT_CODE"
fi
+
+ python - <<'PY'
+ import json
+ import sys
+ from pathlib import Path
+
+ report_path = Path("reports/semgrep.sarif")
+ with report_path.open() as file:
+ sarif = json.load(file)
+
+ error_results = [
+ result
+ for run in sarif.get("runs", [])
+ for result in run.get("results", [])
+ if result.get("level") == "error"
+ ]
+
+ if error_results:
+ print(f"Semgrep reported {len(error_results)} error-level finding(s).")
+ print("See the uploaded SARIF artifact for details.")
+ sys.exit(1)
+ PY
diff --git a/.gitignore b/.gitignore
index 3b256e0ee9..c7568e7bad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,3 +121,7 @@ typedoc.json
**/tsx-0
.pnpm-store
+
+# Generated preset locales
+/presets/src/locales/
+/presets/packages/*/src/locales/
diff --git a/common/shared/bin/index.ts b/common/shared/bin/index.ts
index 8aee5c7a51..49acb25373 100755
--- a/common/shared/bin/index.ts
+++ b/common/shared/bin/index.ts
@@ -3,8 +3,17 @@
import type { IBuildOptions } from '../tsdown/types';
import process from 'node:process';
+import { buildPresetPackage, preparePresetPackage } from '../preset-build/index';
import { build } from '../tsdown/index';
+interface IPresetCliBuildOptions {
+ cleanup?: boolean;
+ skipUMD?: boolean;
+ tsdownConfigPath?: string;
+ umdAdditionalFiles?: string[];
+ umdDeps?: string[];
+}
+
const argvs = process.argv.slice(2);
const [command, ...args] = argvs;
@@ -28,6 +37,46 @@ function collectOptionValues(argv: string[], optionName: string) {
return [...new Set(values)];
}
+if (command === 'preset') {
+ const [presetCommand, ...presetArgs] = args;
+ if (!presetCommand) {
+ throw new Error('Missing preset subcommand. Expected "prepare" or "build".');
+ }
+
+ if (presetCommand === 'prepare') {
+ preparePresetPackage();
+ } else if (presetCommand === 'build') {
+ const options: IPresetCliBuildOptions = {};
+
+ if (presetArgs.includes('--skipUMD')) {
+ options.skipUMD = true;
+ }
+ if (presetArgs.includes('--cleanup')) {
+ options.cleanup = true;
+ }
+
+ const umdDeps = collectOptionValues(presetArgs, '--umdDeps');
+ if (umdDeps.length > 0) {
+ options.umdDeps = umdDeps;
+ }
+
+ const umdAdditionalFiles = collectOptionValues(presetArgs, '--umdAdditionalFiles');
+ if (umdAdditionalFiles.length > 0) {
+ options.umdAdditionalFiles = umdAdditionalFiles;
+ }
+
+ const configIdx = presetArgs.indexOf('--config');
+ if (configIdx !== -1 && presetArgs[configIdx + 1]) {
+ options.tsdownConfigPath = presetArgs[configIdx + 1];
+ }
+
+ // eslint-disable-next-line antfu/no-top-level-await
+ await buildPresetPackage(options);
+ } else {
+ throw new Error(`Unknown preset subcommand "${presetCommand}". Expected "prepare" or "build".`);
+ }
+}
+
if (command === 'build') {
const options: IBuildOptions = {};
diff --git a/common/shared/package.json b/common/shared/package.json
index 00cf6b1792..0e70cbfa4a 100644
--- a/common/shared/package.json
+++ b/common/shared/package.json
@@ -19,7 +19,8 @@
"./esbuild": "./esbuild/index.ts",
"./tailwind": "./tailwind/tailwind.config.ts",
"./postcss": "./postcss/postcss.config.mjs",
- "./tsdown": "./tsdown/index.ts"
+ "./tsdown": "./tsdown/index.ts",
+ "./preset-build": "./preset-build/index.ts"
},
"main": "bin/index.ts",
"bin": {
diff --git a/common/shared/preset-build/__tests__/config.spec.ts b/common/shared/preset-build/__tests__/config.spec.ts
new file mode 100644
index 0000000000..983f19175c
--- /dev/null
+++ b/common/shared/preset-build/__tests__/config.spec.ts
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { describe, expect, it } from 'vitest';
+import { resolvePresetBuildOptions } from '../index';
+
+describe('resolvePresetBuildOptions', () => {
+ it('reads UMD prepend inputs from preset config and keeps CLI options as appenders', () => {
+ expect(resolvePresetBuildOptions({
+ umdAdditionalFiles: ['./polyfill.js'],
+ umdDeps: ['@univerjs/core', '@univerjs/ui'],
+ }, {
+ cleanup: true,
+ umdAdditionalFiles: ['./polyfill.js', './extra.js'],
+ umdDeps: ['@univerjs/ui', '@univerjs/docs'],
+ })).toEqual({
+ cleanup: true,
+ umdAdditionalFiles: ['./polyfill.js', './extra.js'],
+ umdDeps: ['@univerjs/core', '@univerjs/ui', '@univerjs/docs'],
+ });
+ });
+});
diff --git a/common/shared/preset-build/__tests__/locale.spec.ts b/common/shared/preset-build/__tests__/locale.spec.ts
new file mode 100644
index 0000000000..002bc68876
--- /dev/null
+++ b/common/shared/preset-build/__tests__/locale.spec.ts
@@ -0,0 +1,76 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { afterEach, describe, expect, it } from 'vitest';
+import { generatePresetLocales } from '../locale';
+
+const roots: string[] = [];
+
+function makeRoot() {
+ const root = mkdtempSync(path.join(os.tmpdir(), 'univer-preset-locale-'));
+ roots.push(root);
+ return root;
+}
+
+function writeJson(filePath: string, value: unknown) {
+ mkdirSync(path.dirname(filePath), { recursive: true });
+ writeFileSync(filePath, `${JSON.stringify(value, null, 4)}\n`);
+}
+
+afterEach(() => {
+ for (const root of roots.splice(0)) {
+ rmSync(root, { force: true, recursive: true });
+ }
+});
+
+describe('generatePresetLocales', () => {
+ it('generates locale files from available dependency locales and skips missing locales', () => {
+ const packageDir = makeRoot();
+
+ writeJson(path.join(packageDir, 'package.json'), {
+ name: '@univerjs/preset-demo',
+ dependencies: {
+ '@univerjs/alpha': 'workspace:*',
+ '@univerjs/beta': 'workspace:*',
+ '@univerjs/preset-gamma': 'workspace:*',
+ },
+ });
+
+ mkdirSync(path.join(packageDir, 'node_modules'), { recursive: true });
+ writeFileSync(path.join(packageDir, 'node_modules/.keep'), '');
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/es/locale'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/beta/lib/es/locale'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/preset-gamma/src/locales'), { recursive: true });
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/es/locale/en-US.js'), 'export default {};');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/beta/lib/es/locale/en-US.js'), 'export default {};');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/preset-gamma/src/locales/en-US.ts'), 'export default {};');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/es/locale/zh-CN.js'), 'export default {};');
+
+ generatePresetLocales({ packageDir });
+
+ const enUS = readFileSync(path.join(packageDir, 'src/locales/en-US.ts'), 'utf8');
+ expect(enUS).toContain("import univerjsalpha from '@univerjs/alpha/locale/en-US';");
+ expect(enUS).toContain("import univerjsbeta from '@univerjs/beta/locale/en-US';");
+ expect(enUS).toContain("import univerjspresetgamma from '@univerjs/preset-gamma/locales/en-US';");
+
+ const zhCN = readFileSync(path.join(packageDir, 'src/locales/zh-CN.ts'), 'utf8');
+ expect(zhCN).toContain("import univerjsalpha from '@univerjs/alpha/locale/zh-CN';");
+ expect(zhCN).not.toContain('@univerjs/beta/locale/zh-CN');
+ });
+});
diff --git a/common/shared/preset-build/__tests__/umd.spec.ts b/common/shared/preset-build/__tests__/umd.spec.ts
new file mode 100644
index 0000000000..5ab15b0a72
--- /dev/null
+++ b/common/shared/preset-build/__tests__/umd.spec.ts
@@ -0,0 +1,148 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { afterEach, describe, expect, it } from 'vitest';
+import { createUmdConfig } from '../../tsdown/configs/umd';
+import { prependPresetUmd } from '../umd';
+
+const roots: string[] = [];
+
+function makeRoot() {
+ const root = mkdtempSync(path.join(os.tmpdir(), 'univer-preset-umd-'));
+ roots.push(root);
+ return root;
+}
+
+afterEach(() => {
+ for (const root of roots.splice(0)) {
+ rmSync(root, { force: true, recursive: true });
+ }
+});
+
+describe('prependPresetUmd', () => {
+ it('does not externalize CSS imports as UMD globals', () => {
+ const config = createUmdConfig({
+ baseConfig: {},
+ enableObfuscation: false,
+ entry: {
+ key: 'index',
+ path: '/tmp/index.ts',
+ type: 'index',
+ },
+ outDir: 'lib/umd',
+ packageDir: '/tmp/pkg',
+ packageName: '@univerjs/preset-alpha',
+ plugins: [],
+ });
+
+ const neverBundle = config.deps!.neverBundle as (source: string) => boolean;
+ const globals = config.outputOptions!.globals as (source: string) => string | undefined;
+
+ expect(neverBundle('@univerjs/design/index.css')).toBe(false);
+ expect(globals('@univerjs/design/index.css')).toBe('UniverCssNoop');
+ });
+
+ it('maps locale dependency imports to dependency UMD locale globals', () => {
+ const config = createUmdConfig({
+ baseConfig: {},
+ enableObfuscation: false,
+ entry: {
+ key: 'locales/en-US',
+ path: '/tmp/locales/en-US.ts',
+ type: 'locale',
+ },
+ outDir: 'lib/umd',
+ packageDir: '/tmp/pkg',
+ packageName: '@univerjs/preset-alpha',
+ plugins: [],
+ });
+
+ const neverBundle = config.deps!.neverBundle as (source: string) => boolean;
+ const globals = config.outputOptions!.globals as (source: string) => string | undefined;
+
+ expect(neverBundle('@univerjs/design/locale/en-US')).toBe(true);
+ expect(globals('@univerjs/design/locale/en-US')).toBe('UniverDesignEnUS');
+ expect(globals('@univerjs/sheets/locales/zh-CN')).toBe('UniverSheetsZhCN');
+ expect(globals('@univerjs-pro/exchange-client/locales/en-US')).toBe('UniverProExchangeClientEnUS');
+ });
+
+ it('prepends additional files and dependency UMD outputs before the preset UMD', () => {
+ const packageDir = makeRoot();
+ const extraFile = path.join(packageDir, 'extra.js');
+ writeFileSync(extraFile, '/* extra */');
+
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/beta/lib/umd'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'lib/umd'), { recursive: true });
+
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd/index.js'), '/* alpha */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd/facade.js'), '/* alpha facade */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/beta/lib/umd/index.js'), '/* beta */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/beta/lib/umd/facade.js'), '/* beta facade */');
+ writeFileSync(path.join(packageDir, 'lib/umd/index.js'), '/* preset */');
+
+ prependPresetUmd({
+ packageDir,
+ umdAdditionalFiles: [extraFile],
+ umdDeps: ['@univerjs/alpha', '@univerjs/beta'],
+ });
+
+ const output = readFileSync(path.join(packageDir, 'lib/umd/index.js'), 'utf8');
+ expect(output.indexOf('/* extra */')).toBeLessThan(output.indexOf('/* alpha */'));
+ expect(output.indexOf('/* alpha */')).toBeLessThan(output.indexOf('/* beta */'));
+ expect(output.indexOf('/* beta */')).toBeLessThan(output.indexOf('/* alpha facade */'));
+ expect(output.indexOf('/* alpha facade */')).toBeLessThan(output.indexOf('/* beta facade */'));
+ expect(output.indexOf('/* beta facade */')).toBeLessThan(output.indexOf('/* preset */'));
+ });
+
+ it('fails when a declared UMD dependency has not been built', () => {
+ const packageDir = makeRoot();
+ mkdirSync(path.join(packageDir, 'lib/umd'), { recursive: true });
+ writeFileSync(path.join(packageDir, 'lib/umd/index.js'), '/* preset */');
+
+ expect(() => prependPresetUmd({
+ packageDir,
+ umdDeps: ['@univerjs/missing'],
+ })).toThrow('Missing UMD dependency @univerjs/missing');
+ });
+
+ it('prepends dependency UMD locale outputs from both locale and locales directories', () => {
+ const packageDir = makeRoot();
+
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd/locale'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'node_modules/@univerjs/preset-beta/lib/umd/locales'), { recursive: true });
+ mkdirSync(path.join(packageDir, 'lib/umd/locales'), { recursive: true });
+
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd/index.js'), '/* alpha */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/alpha/lib/umd/locale/en-US.js'), '/* alpha locale */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/preset-beta/lib/umd/index.js'), '/* beta */');
+ writeFileSync(path.join(packageDir, 'node_modules/@univerjs/preset-beta/lib/umd/locales/en-US.js'), '/* beta locales */');
+ writeFileSync(path.join(packageDir, 'lib/umd/index.js'), '/* preset */');
+ writeFileSync(path.join(packageDir, 'lib/umd/locales/en-US.js'), '/* preset locale */');
+
+ prependPresetUmd({
+ packageDir,
+ umdDeps: ['@univerjs/alpha', '@univerjs/preset-beta'],
+ });
+
+ const output = readFileSync(path.join(packageDir, 'lib/umd/locales/en-US.js'), 'utf8');
+ expect(output.indexOf('/* alpha locale */')).toBeLessThan(output.indexOf('/* beta locales */'));
+ expect(output.indexOf('/* beta locales */')).toBeLessThan(output.indexOf('/* preset locale */'));
+ });
+});
diff --git a/common/shared/preset-build/constants.ts b/common/shared/preset-build/constants.ts
new file mode 100644
index 0000000000..0878529263
--- /dev/null
+++ b/common/shared/preset-build/constants.ts
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export const PRESET_LOCALES = [
+ 'ar-SA',
+ 'ca-ES',
+ 'de-DE',
+ 'en-US',
+ 'es-ES',
+ 'fa-IR',
+ 'fr-FR',
+ 'id-ID',
+ 'it-IT',
+ 'ja-JP',
+ 'ko-KR',
+ 'pl-PL',
+ 'pt-BR',
+ 'ru-RU',
+ 'sk-SK',
+ 'vi-VN',
+ 'zh-CN',
+ 'zh-HK',
+ 'zh-TW',
+] as const;
+
+export const PRESET_LOCALE_SOURCE_DIR = 'src/locales';
+export const PRESET_UMD_OUTPUT_DIR = 'lib/umd';
diff --git a/common/shared/preset-build/entries.ts b/common/shared/preset-build/entries.ts
new file mode 100644
index 0000000000..7c4a651548
--- /dev/null
+++ b/common/shared/preset-build/entries.ts
@@ -0,0 +1,80 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IEntryConfig } from '../tsdown/types';
+import { existsSync, readdirSync, statSync } from 'node:fs';
+import path from 'node:path';
+import { PRESET_LOCALE_SOURCE_DIR } from './constants';
+
+function getPresetLocaleEntries(packageDir: string): IEntryConfig[] {
+ const localeDir = path.join(packageDir, PRESET_LOCALE_SOURCE_DIR);
+
+ if (!existsSync(localeDir)) {
+ return [];
+ }
+
+ const entries: IEntryConfig[] = [];
+
+ for (const fileName of readdirSync(localeDir).sort((left, right) => left.localeCompare(right))) {
+ const fullPath = path.join(localeDir, fileName);
+
+ if (statSync(fullPath).isDirectory() || !fileName.endsWith('.ts') || !fileName.includes('-')) {
+ continue;
+ }
+
+ entries.push({
+ key: `locales/${fileName.replace(/\.ts$/, '')}`,
+ path: fullPath,
+ type: 'locale',
+ });
+ }
+
+ return entries;
+}
+
+export function getPresetModuleEntries(packageDir: string): IEntryConfig[] {
+ const entries: IEntryConfig[] = [{
+ key: 'index',
+ path: path.join(packageDir, 'src/index.ts'),
+ type: 'index',
+ }];
+
+ const workerEntry = path.join(packageDir, 'src/worker.ts');
+ if (existsSync(workerEntry)) {
+ entries.push({
+ key: 'worker',
+ path: workerEntry,
+ type: 'worker',
+ });
+ }
+
+ return [...entries, ...getPresetLocaleEntries(packageDir)];
+}
+
+export function getPresetUmdEntries(packageDir: string): IEntryConfig[] {
+ const entries: IEntryConfig[] = [];
+ const umdEntry = path.join(packageDir, 'src/umd.ts');
+
+ if (existsSync(umdEntry)) {
+ entries.push({
+ key: 'index',
+ path: umdEntry,
+ type: 'index',
+ });
+ }
+
+ return [...entries, ...getPresetLocaleEntries(packageDir)];
+}
diff --git a/common/shared/preset-build/index.ts b/common/shared/preset-build/index.ts
new file mode 100644
index 0000000000..b84100d82d
--- /dev/null
+++ b/common/shared/preset-build/index.ts
@@ -0,0 +1,214 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { TModuleFormat } from '../tsdown/configs/module';
+import type { IPackageJson } from '../tsdown/types';
+import type { IPresetBuildConfig, IPresetBuildOptions, IPresetPackageJson } from './types';
+import { existsSync, readFileSync, rmSync } from 'node:fs';
+import path from 'node:path';
+import process from 'node:process';
+import { mergeConfig, build as tsdownBuild } from 'tsdown';
+import { createModuleConfig } from '../tsdown/configs/module';
+import { createUmdConfig } from '../tsdown/configs/umd';
+import { BUILD_OUTPUT_DIRECTORIES, CLEANUP_DIRECTORIES } from '../tsdown/constants';
+import { createBaseConfig, createInputPlugins } from '../tsdown/utils/base-config';
+import { getPresetModuleEntries, getPresetUmdEntries } from './entries';
+import { generatePresetLocales } from './locale';
+import { buildPresetStyles } from './style';
+import { prependPresetUmd } from './umd';
+
+export { generatePresetLocales } from './locale';
+export type { IPresetBuildConfig, IPresetBuildOptions } from './types';
+export { prependPresetUmd } from './umd';
+
+const PRESET_BUILD_CONFIG_FILENAMES = [
+ 'univer-preset.config.mjs',
+ 'univer-preset.config.ts',
+ 'univer-preset.config.js',
+] as const;
+
+function readPackageJson(packageDir: string): IPresetPackageJson {
+ return JSON.parse(readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as IPresetPackageJson;
+}
+
+function getExternalPackages(packageJson: IPresetPackageJson) {
+ return [...new Set([
+ ...Object.keys(packageJson.dependencies ?? {}),
+ ...Object.keys(packageJson.peerDependencies ?? {}),
+ 'react',
+ 'react-dom',
+ 'rxjs',
+ ])]
+ .sort((left, right) => left.localeCompare(right))
+ .flatMap((packageName) => [packageName, `${packageName}/*`]);
+}
+
+async function loadUserConfig(options: IPresetBuildOptions, packageDir: string) {
+ if (!options.tsdownConfigPath) {
+ return null;
+ }
+
+ const configPath = path.resolve(packageDir, options.tsdownConfigPath);
+ let userConfig = (await import(configPath)).default;
+
+ if (typeof userConfig === 'function') {
+ userConfig = await userConfig();
+ }
+
+ return userConfig;
+}
+
+function mergeUserConfig(configs: any[], userConfig: any) {
+ if (!userConfig) {
+ return configs;
+ }
+
+ return configs.map((config) => mergeConfig(config, userConfig));
+}
+
+async function loadPresetBuildConfig(packageDir: string): Promise<IPresetBuildConfig> {
+ for (const filename of PRESET_BUILD_CONFIG_FILENAMES) {
+ const configPath = path.resolve(packageDir, filename);
+ if (!existsSync(configPath)) {
+ continue;
+ }
+
+ let presetBuildConfig = (await import(configPath)).default;
+ if (typeof presetBuildConfig === 'function') {
+ presetBuildConfig = await presetBuildConfig();
+ }
+
+ return presetBuildConfig ?? {};
+ }
+
+ return {};
+}
+
+function mergeArrayOption(configValues?: string[], optionValues?: string[]) {
+ return [...new Set([
+ ...(configValues ?? []),
+ ...(optionValues ?? []),
+ ])];
+}
+
+export function resolvePresetBuildOptions(presetBuildConfig: IPresetBuildConfig = {}, options: IPresetBuildOptions = {}): IPresetBuildOptions {
+ const resolvedOptions: IPresetBuildOptions = {
+ ...options,
+ };
+ const umdDeps = mergeArrayOption(presetBuildConfig?.umdDeps, options.umdDeps);
+ const umdAdditionalFiles = mergeArrayOption(presetBuildConfig?.umdAdditionalFiles, options.umdAdditionalFiles);
+
+ if (umdDeps.length > 0) {
+ resolvedOptions.umdDeps = umdDeps;
+ }
+ if (umdAdditionalFiles.length > 0) {
+ resolvedOptions.umdAdditionalFiles = umdAdditionalFiles;
+ }
+
+ return resolvedOptions;
+}
+
+export function removePresetOutputs(packageDir = process.cwd()) {
+ for (const dir of CLEANUP_DIRECTORIES) {
+ const targetDir = path.resolve(packageDir, dir);
+
+ if (existsSync(targetDir)) {
+ rmSync(targetDir, { force: true, recursive: true });
+ }
+ }
+}
+
+export function preparePresetPackage(packageDir = process.cwd()) {
+ const packageJson = readPackageJson(packageDir);
+
+ if (packageJson.name === '@univerjs/presets') {
+ return [];
+ }
+
+ return generatePresetLocales({ packageDir });
+}
+
+export async function buildPresetPackage(options: IPresetBuildOptions = {}) {
+ const packageDir = process.cwd();
+ const packageJson = readPackageJson(packageDir);
+ const presetBuildConfig = await loadPresetBuildConfig(packageDir);
+ const resolvedOptions = resolvePresetBuildOptions(presetBuildConfig, options);
+
+ if (resolvedOptions.cleanup) {
+ removePresetOutputs(packageDir);
+ }
+
+ const externalPackages = getExternalPackages(packageJson);
+ const baseConfig = createBaseConfig({
+ entries: [],
+ externalPackages,
+ facadeExternalPackages: externalPackages,
+ packageDir,
+ packageJson: packageJson as IPackageJson,
+ plugins: [],
+ });
+ const plugins = createInputPlugins(packageDir);
+ const userConfig = await loadUserConfig(resolvedOptions, packageDir);
+ const moduleFormats: TModuleFormat[] = ['esm', 'cjs'];
+ const moduleConfigs = moduleFormats.flatMap((format) => {
+ return getPresetModuleEntries(packageDir).map((entry) => createModuleConfig({
+ baseConfig,
+ enableObfuscation: false,
+ entry,
+ externalPackages,
+ facadeExternalPackages: externalPackages,
+ format,
+ outDir: BUILD_OUTPUT_DIRECTORIES[format],
+ packageDir,
+ plugins,
+ }));
+ });
+
+ for (const config of mergeUserConfig(moduleConfigs, userConfig)) {
+ await tsdownBuild(config);
+ }
+
+ await buildPresetStyles({
+ baseConfig,
+ packageDir,
+ packageJson,
+ plugins,
+ });
+
+ if (resolvedOptions.skipUMD) {
+ return;
+ }
+
+ const umdConfigs = getPresetUmdEntries(packageDir).map((entry) => createUmdConfig({
+ baseConfig,
+ enableObfuscation: false,
+ entry,
+ outDir: BUILD_OUTPUT_DIRECTORIES.umd,
+ packageDir,
+ packageName: packageJson.name,
+ plugins,
+ }));
+
+ for (const config of mergeUserConfig(umdConfigs, userConfig)) {
+ await tsdownBuild(config);
+ }
+
+ prependPresetUmd({
+ packageDir,
+ umdAdditionalFiles: resolvedOptions.umdAdditionalFiles,
+ umdDeps: resolvedOptions.umdDeps,
+ });
+}
diff --git a/common/shared/preset-build/locale.ts b/common/shared/preset-build/locale.ts
new file mode 100644
index 0000000000..062e62d803
--- /dev/null
+++ b/common/shared/preset-build/locale.ts
@@ -0,0 +1,112 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IGeneratePresetLocalesOptions, IPresetPackageJson } from './types';
+import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { PRESET_LOCALE_SOURCE_DIR, PRESET_LOCALES } from './constants';
+
+function readPackageJson(packageDir: string): IPresetPackageJson {
+ return JSON.parse(readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as IPresetPackageJson;
+}
+
+function convertImportNameFromPackageName(name: string) {
+ return name
+ .replace(/^@univerjs(?:-[^/]+)?\//, 'univerjs')
+ .replace(/[^a-zA-Z0-9_$]/g, '');
+}
+
+function compareStrings(left: string, right: string) {
+ if (left < right) {
+ return -1;
+ }
+
+ if (left > right) {
+ return 1;
+ }
+
+ return 0;
+}
+
+function getDependencyNames(pkg: IPresetPackageJson) {
+ return Object.keys(pkg.dependencies ?? {})
+ .filter((name) => name.startsWith('@univerjs'))
+ .sort(compareStrings);
+}
+
+function getDependencyLocaleSubpath(packageDir: string, dependencyName: string, locale: string) {
+ const dependencyDir = path.join(packageDir, 'node_modules', dependencyName);
+
+ if (
+ existsSync(path.join(dependencyDir, 'lib/es/locale', `${locale}.js`))
+ || existsSync(path.join(dependencyDir, 'src/locale', `${locale}.ts`))
+ ) {
+ return 'locale';
+ }
+
+ if (
+ existsSync(path.join(dependencyDir, 'lib/es/locales', `${locale}.js`))
+ || existsSync(path.join(dependencyDir, 'src/locales', `${locale}.ts`))
+ ) {
+ return 'locales';
+ }
+
+ return null;
+}
+
+export function generatePresetLocales(options: IGeneratePresetLocalesOptions): string[] {
+ const { packageDir } = options;
+ const pkg = readPackageJson(packageDir);
+ const dependencyNames = getDependencyNames(pkg);
+ const localeDir = path.join(packageDir, PRESET_LOCALE_SOURCE_DIR);
+
+ rmSync(localeDir, { force: true, recursive: true });
+ mkdirSync(localeDir, { recursive: true });
+
+ const generated: string[] = [];
+
+ for (const locale of PRESET_LOCALES) {
+ const dependenciesWithLocale = dependencyNames
+ .map((dependencyName) => ({
+ dependencyName,
+ localeSubpath: getDependencyLocaleSubpath(packageDir, dependencyName, locale),
+ }))
+ .filter((dependency): dependency is { dependencyName: string; localeSubpath: 'locale' | 'locales' } => dependency.localeSubpath !== null);
+
+ if (dependenciesWithLocale.length === 0) {
+ continue;
+ }
+
+ let content = 'import { mergeLocales } from \'@univerjs/core\';\n\n';
+
+ for (const { dependencyName, localeSubpath } of dependenciesWithLocale) {
+ content += `import ${convertImportNameFromPackageName(dependencyName)} from '${dependencyName}/${localeSubpath}/${locale}';\n`;
+ }
+
+ content += '\nexport default mergeLocales(\n';
+
+ for (const { dependencyName } of dependenciesWithLocale) {
+ content += ` ${convertImportNameFromPackageName(dependencyName)},\n`;
+ }
+
+ content += ');\n';
+
+ writeFileSync(path.join(localeDir, `${locale}.ts`), content);
+ generated.push(locale);
+ }
+
+ return generated;
+}
diff --git a/common/shared/preset-build/style.ts b/common/shared/preset-build/style.ts
new file mode 100644
index 0000000000..098da67274
--- /dev/null
+++ b/common/shared/preset-build/style.ts
@@ -0,0 +1,109 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { UserConfig } from 'tsdown';
+import type { IPresetPackageJson } from './types';
+import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { defineConfig, build as tsdownBuild } from 'tsdown';
+import { createOutputAliasPlugin } from '../tsdown/plugins/output-alias';
+
+const PRESET_STYLE_TEMP_DIR = '.preset-build';
+const PRESET_STYLE_OUTPUT_DIR = 'lib/.preset-style';
+
+function getDependencyDir(packageDir: string, dependencyName: string) {
+ return path.join(packageDir, 'node_modules', dependencyName);
+}
+
+function getStyleDependencyNames(packageDir: string, packageJson: IPresetPackageJson) {
+ return Object.keys(packageJson.dependencies ?? {})
+ .filter((dependencyName) => {
+ if (!dependencyName.startsWith('@univerjs')) {
+ return false;
+ }
+
+ return existsSync(path.join(getDependencyDir(packageDir, dependencyName), 'src/global.css'));
+ })
+ .sort((left, right) => left.localeCompare(right));
+}
+
+function normalizePath(filePath: string) {
+ return filePath.split(path.sep).join('/');
+}
+
+function writeStyleEntry(packageDir: string, dependencyNames: string[]) {
+ const tempDir = path.join(packageDir, PRESET_STYLE_TEMP_DIR);
+ const entryFile = path.join(tempDir, 'style.ts');
+
+ mkdirSync(tempDir, { recursive: true });
+
+ const content = dependencyNames
+ .map((dependencyName) => {
+ const dependencyCss = normalizePath(path.join(getDependencyDir(packageDir, dependencyName), 'src/global.css'));
+ return `import ${JSON.stringify(dependencyCss)};`;
+ })
+ .join('\n');
+
+ writeFileSync(entryFile, `${content}\n`);
+
+ return entryFile;
+}
+
+function cleanup(packageDir: string) {
+ rmSync(path.join(packageDir, PRESET_STYLE_TEMP_DIR), { force: true, recursive: true });
+ rmSync(path.join(packageDir, PRESET_STYLE_OUTPUT_DIR), { force: true, recursive: true });
+}
+
+export async function buildPresetStyles(options: {
+ baseConfig: Partial<UserConfig>;
+ packageDir: string;
+ packageJson: IPresetPackageJson;
+ plugins: any[];
+}) {
+ const { baseConfig, packageDir, packageJson, plugins } = options;
+ const dependencyNames = getStyleDependencyNames(packageDir, packageJson);
+
+ if (dependencyNames.length === 0) {
+ rmSync(path.join(packageDir, 'lib/index.css'), { force: true });
+ return;
+ }
+
+ const entryFile = writeStyleEntry(packageDir, dependencyNames);
+
+ try {
+ await tsdownBuild(defineConfig({
+ ...baseConfig,
+ dts: false,
+ entry: { index: entryFile },
+ format: 'esm',
+ outDir: PRESET_STYLE_OUTPUT_DIR,
+ outputOptions: {
+ entryFileNames: '[name].js',
+ minify: true,
+ },
+ plugins: [
+ ...plugins,
+ createOutputAliasPlugin({
+ copyToRoot: false,
+ keepRootIndexCss: true,
+ packageDir,
+ }),
+ ],
+ }));
+ } finally {
+ cleanup(packageDir);
+ }
+}
diff --git a/common/shared/preset-build/types.ts b/common/shared/preset-build/types.ts
new file mode 100644
index 0000000000..bb4f254d0d
--- /dev/null
+++ b/common/shared/preset-build/types.ts
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export interface IPresetBuildOptions {
+ cleanup?: boolean;
+ skipUMD?: boolean;
+ tsdownConfigPath?: string;
+ umdAdditionalFiles?: string[];
+ umdDeps?: string[];
+}
+
+export type IPresetBuildConfig = Pick<IPresetBuildOptions, 'umdAdditionalFiles' | 'umdDeps'>;
+
+export interface IPresetPackageJson {
+ dependencies?: Record<string, string>;
+ devDependencies?: Record<string, string>;
+ name: string;
+ peerDependencies?: Record<string, string>;
+}
+
+export interface IGeneratePresetLocalesOptions {
+ packageDir: string;
+}
+
+export interface IPrependPresetUmdOptions {
+ packageDir: string;
+ umdAdditionalFiles?: string[];
+ umdDeps?: string[];
+}
diff --git a/common/shared/preset-build/umd.ts b/common/shared/preset-build/umd.ts
new file mode 100644
index 0000000000..adcdb8b65e
--- /dev/null
+++ b/common/shared/preset-build/umd.ts
@@ -0,0 +1,124 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPrependPresetUmdOptions } from './types';
+import { existsSync, readFileSync, writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { PRESET_LOCALES, PRESET_UMD_OUTPUT_DIR } from './constants';
+
+function readRequiredFile(filePath: string, label: string) {
+ if (!existsSync(filePath)) {
+ throw new Error(`Missing ${label}: ${filePath}`);
+ }
+
+ return readFileSync(filePath, 'utf8');
+}
+
+function getDependencyDir(packageDir: string, dependencyName: string) {
+ return path.join(packageDir, 'node_modules', dependencyName);
+}
+
+function getDependencyLocaleUmdFile(packageDir: string, dependencyName: string, locale: string) {
+ const dependencyDir = getDependencyDir(packageDir, dependencyName);
+ const localeFile = path.join(dependencyDir, 'lib/umd/locale', `${locale}.js`);
+
+ if (existsSync(localeFile)) {
+ return {
+ filePath: localeFile,
+ label: `${dependencyName}/locale/${locale}`,
+ };
+ }
+
+ const localesFile = path.join(dependencyDir, 'lib/umd/locales', `${locale}.js`);
+
+ if (existsSync(localesFile)) {
+ return {
+ filePath: localesFile,
+ label: `${dependencyName}/locales/${locale}`,
+ };
+ }
+
+ return null;
+}
+
+function prependFile(outputFile: string, chunks: Array<[string, string]>) {
+ if (!existsSync(outputFile)) {
+ return;
+ }
+
+ const ownContent = readFileSync(outputFile, 'utf8');
+ const content = [
+ ...chunks.map(([label, value]) => `// ${label}\n${value}`),
+ `// index\n${ownContent}`,
+ ].join('\n\n');
+
+ writeFileSync(outputFile, content);
+}
+
+export function prependPresetUmd(options: IPrependPresetUmdOptions): void {
+ const { packageDir, umdAdditionalFiles = [], umdDeps = [] } = options;
+ const outputDir = path.join(packageDir, PRESET_UMD_OUTPUT_DIR);
+ const rootOutput = path.join(outputDir, 'index.js');
+ const rootChunks: Array<[string, string]> = [];
+ const rootFacadeChunks: Array<[string, string]> = [];
+
+ for (const file of umdAdditionalFiles) {
+ rootChunks.push([file, readRequiredFile(file, `additional UMD file ${file}`)]);
+ }
+
+ for (const dependencyName of umdDeps) {
+ const dependencyDir = getDependencyDir(packageDir, dependencyName);
+ const dependencyUmd = path.join(dependencyDir, 'lib/umd/index.js');
+ const dependencyFacade = path.join(dependencyDir, 'lib/umd/facade.js');
+
+ rootChunks.push([
+ `${dependencyName}/index`,
+ readRequiredFile(dependencyUmd, `UMD dependency ${dependencyName}`),
+ ]);
+
+ if (existsSync(dependencyFacade)) {
+ rootFacadeChunks.push([
+ `${dependencyName}/facade`,
+ readFileSync(dependencyFacade, 'utf8'),
+ ]);
+ }
+ }
+
+ prependFile(rootOutput, [...rootChunks, ...rootFacadeChunks]);
+
+ for (const locale of PRESET_LOCALES) {
+ const localeOutput = path.join(outputDir, 'locales', `${locale}.js`);
+
+ if (!existsSync(localeOutput)) {
+ continue;
+ }
+
+ const localeChunks: Array<[string, string]> = [];
+
+ for (const dependencyName of umdDeps) {
+ const dependencyLocaleFile = getDependencyLocaleUmdFile(packageDir, dependencyName, locale);
+
+ if (dependencyLocaleFile !== null) {
+ localeChunks.push([
+ dependencyLocaleFile.label,
+ readFileSync(dependencyLocaleFile.filePath, 'utf8'),
+ ]);
+ }
+ }
+
+ prependFile(localeOutput, localeChunks);
+ }
+}
diff --git a/common/shared/react-polyfill/react-polyfill.js b/common/shared/react-polyfill/react-polyfill.js
new file mode 100644
index 0000000000..0ec9ddd73a
--- /dev/null
+++ b/common/shared/react-polyfill/react-polyfill.js
@@ -0,0 +1,90 @@
+/* eslint-disable */
+/**
+ * Starting from Univer 0.6.0, with the support for React 19[^1], UMD users may need additional adaptation.
+ * It is recommended to migrate to module script[^2] and a more modern build system.
+ *
+ * [^1]: [Module Script] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html
+ * [^2]: [support for React 19] https://github.com/dream-num/univer/pull/4247
+ */
+
+/**
+ * Fix `Uncaught TypeError: client.createRoot is not a function`
+ * If using UMD React < 18, you might need the following code.
+ */
+(function (global) {
+ 'use strict';
+ if (!global.ReactDOM) {
+ throw new Error('ReactDOM must be loaded before ReactCreateRoot.');
+ }
+ const ReactDOM = global.ReactDOM;
+ if (!ReactDOM.createRoot) {
+ ReactDOM.createRoot = function (container) {
+ return {
+ render: (element) => {
+ ReactDOM.render(element, container);
+ },
+ };
+ };
+ }
+})(this);
+
+/**
+ * Fix `Uncaught TypeError: jsxRuntime.jsx is not a function`
+ * If using UMD React, you might need the following code.
+ * Reference: https://unpkg.com/[email protected]/cjs/react-jsx-runtime.production.min.js
+ */
+(function (global) {
+ 'use strict';
+ if (!global.React) {
+ throw new Error('React must be loaded before ReactJSXRuntime.');
+ }
+ const React = global.React;
+ if (!React.jsx || !React.jsxs) {
+ const REACT_ELEMENT_TYPE = Symbol.for('react.element');
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
+ const RESERVED_PROPS = {
+ key: true,
+ ref: true,
+ __self: true,
+ __source: true,
+ };
+ const ReactCurrentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
+ function createReactElement(type, config, maybeKey) {
+ const props = {};
+ let key = null;
+ let ref = null;
+ if (maybeKey !== undefined) {
+ key = `${maybeKey}`;
+ }
+ if (config.key !== undefined) {
+ key = `${config.key}`;
+ }
+ if (config.ref !== undefined) {
+ ref = config.ref;
+ }
+ for (var propName in config) {
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
+ props[propName] = config[propName];
+ }
+ }
+ if (type && type.defaultProps) {
+ const defaultProps = type.defaultProps;
+ for (var propName in defaultProps) {
+ if (props[propName] === undefined) {
+ props[propName] = defaultProps[propName];
+ }
+ }
+ }
+ return {
+ $$typeof: REACT_ELEMENT_TYPE,
+ type,
+ key,
+ ref,
+ props,
+ _owner: ReactCurrentOwner.current,
+ };
+ }
+ React.jsx = createReactElement;
+ React.jsxs = createReactElement;
+ }
+})(this);
diff --git a/common/shared/tailwind/__tests__/content.spec.ts b/common/shared/tailwind/__tests__/content.spec.ts
new file mode 100644
index 0000000000..04abf98d8f
--- /dev/null
+++ b/common/shared/tailwind/__tests__/content.spec.ts
@@ -0,0 +1,90 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { afterEach, describe, expect, it } from 'vitest';
+import { createTailwindContent } from '../tailwind.config';
+
+const roots: string[] = [];
+
+function makePackageRoot() {
+ const root = mkdtempSync(path.join(os.tmpdir(), 'univer-tailwind-content-'));
+ roots.push(root);
+ writeFileSync(path.join(root, 'tailwind.config.ts'), '');
+ return root;
+}
+
+function writeJson(filePath: string, value: unknown) {
+ mkdirSync(path.dirname(filePath), { recursive: true });
+ writeFileSync(filePath, `${JSON.stringify(value, null, 4)}\n`);
+}
+
+function writeGlobalCss(packageRoot: string, dependencyName: string) {
+ const cssPath = path.join(packageRoot, 'node_modules', dependencyName, 'src/global.css');
+ mkdirSync(path.dirname(cssPath), { recursive: true });
+ writeFileSync(cssPath, '');
+}
+
+afterEach(() => {
+ for (const root of roots.splice(0)) {
+ rmSync(root, { force: true, recursive: true });
+ }
+});
+
+describe('createTailwindContent', () => {
+ it('returns current package source content by default', () => {
+ const packageRoot = makePackageRoot();
+ writeJson(path.join(packageRoot, 'package.json'), {
+ name: '@univerjs/preset-demo',
+ dependencies: {
+ '@univerjs/design': 'workspace:*',
+ },
+ });
+ writeGlobalCss(packageRoot, '@univerjs/design');
+
+ expect(createTailwindContent(path.join(packageRoot, 'tailwind.config.ts'))).toEqual([
+ './src/**/*.{js,ts,jsx,tsx}',
+ ]);
+ });
+
+ it('includes Univer dependencies with global styles when requested', () => {
+ const packageRoot = makePackageRoot();
+ writeJson(path.join(packageRoot, 'package.json'), {
+ name: '@univerjs/preset-demo',
+ dependencies: {
+ '@univerjs/sheets-ui': 'workspace:*',
+ '@univerjs/design': 'workspace:*',
+ '@univerjs/core': 'workspace:*',
+ '@univerjs-pro/sheets-chart-ui': 'workspace:*',
+ react: '^18.3.1',
+ },
+ });
+ writeGlobalCss(packageRoot, '@univerjs/sheets-ui');
+ writeGlobalCss(packageRoot, '@univerjs/design');
+ writeGlobalCss(packageRoot, '@univerjs-pro/sheets-chart-ui');
+
+ expect(createTailwindContent(path.join(packageRoot, 'tailwind.config.ts'), {
+ includeStyleDependencies: true,
+ })).toEqual([
+ './src/**/*.{js,ts,jsx,tsx}',
+ './node_modules/@univerjs/design/src/**/*.{js,ts,jsx,tsx}',
+ './node_modules/@univerjs/sheets-ui/src/**/*.{js,ts,jsx,tsx}',
+ './node_modules/@univerjs-pro/sheets-chart-ui/src/**/*.{js,ts,jsx,tsx}',
+ ]);
+ });
+});
diff --git a/common/shared/tailwind/tailwind.config.ts b/common/shared/tailwind/tailwind.config.ts
index 810452981f..e709a14154 100644
--- a/common/shared/tailwind/tailwind.config.ts
+++ b/common/shared/tailwind/tailwind.config.ts
@@ -15,8 +15,80 @@
*/
import type { Config } from 'tailwindcss';
+import { existsSync, readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
import scrollbar from 'tailwind-scrollbar';
+const SOURCE_CONTENT = './src/**/*.{js,ts,jsx,tsx}';
+const DEPENDENCY_SOURCE_CONTENT = './node_modules/{name}/src/**/*.{js,ts,jsx,tsx}';
+
+interface ITailwindContentOptions {
+ includeStyleDependencies?: boolean;
+}
+
+interface IPackageJson {
+ dependencies?: Record<string, string>;
+}
+
+function getPackageDir(configUrl: string) {
+ const configPath = configUrl.startsWith('file:')
+ ? fileURLToPath(configUrl)
+ : configUrl;
+
+ return path.dirname(configPath);
+}
+
+function getPackageJson(packageDir: string): IPackageJson {
+ const packageJsonPath = path.join(packageDir, 'package.json');
+
+ if (!existsSync(packageJsonPath)) {
+ return {};
+ }
+
+ return JSON.parse(readFileSync(packageJsonPath, 'utf8')) as IPackageJson;
+}
+
+function getDependencyDir(packageDir: string, dependencyName: string) {
+ return path.join(packageDir, 'node_modules', dependencyName);
+}
+
+function compareDependencyName(left: string, right: string) {
+ const leftScope = left.startsWith('@univerjs-pro/') ? 1 : 0;
+ const rightScope = right.startsWith('@univerjs-pro/') ? 1 : 0;
+
+ if (leftScope !== rightScope) {
+ return leftScope - rightScope;
+ }
+
+ return left.localeCompare(right);
+}
+
+export function createTailwindContent(configUrl: string, options: ITailwindContentOptions = {}) {
+ const content = [SOURCE_CONTENT];
+
+ if (!options.includeStyleDependencies) {
+ return content;
+ }
+
+ const packageDir = getPackageDir(configUrl);
+ const packageJson = getPackageJson(packageDir);
+ const dependencyNames = Object.keys(packageJson.dependencies ?? {})
+ .filter((dependencyName) => {
+ if (!dependencyName.startsWith('@univerjs')) {
+ return false;
+ }
+
+ return existsSync(path.join(getDependencyDir(packageDir, dependencyName), 'src/global.css'));
+ })
+ .sort(compareDependencyName);
+
+ return [
+ ...content,
+ ...dependencyNames.map((dependencyName) => DEPENDENCY_SOURCE_CONTENT.replace('{name}', dependencyName)),
+ ];
+}
+
const config: Omit<Config, 'content'> = {
prefix: 'univer-',
darkMode: 'selector',
diff --git a/common/shared/tsdown/configs/umd.ts b/common/shared/tsdown/configs/umd.ts
index a1be5925c9..f678762785 100644
--- a/common/shared/tsdown/configs/umd.ts
+++ b/common/shared/tsdown/configs/umd.ts
@@ -35,6 +35,7 @@ export interface ICreateUmdConfigOptions {
const UMD_GLOBALS: Record<string, string> = Object.fromEntries(
Object.entries(peerDepsMap).map(([source, value]) => [source, value.global])
);
+const CSS_UMD_GLOBAL = 'UniverCssNoop';
function convertLibNameFromPackageName(name: string) {
return name
@@ -51,6 +52,10 @@ function convertLibNameFromPackageName(name: string) {
* Maps externals to their browser globals in UMD builds.
*/
function resolveUmdGlobal(source: string) {
+ if (source.endsWith('.css')) {
+ return null;
+ }
+
if (source in UMD_GLOBALS) {
return UMD_GLOBALS[source];
}
@@ -60,12 +65,32 @@ function resolveUmdGlobal(source: string) {
return null;
}
+ const localeMatch = source.match(/^(@univerjs(?:-pro)?\/[^/]+)\/(?:locale|locales)\/([^/]+)$/);
+
+ if (localeMatch) {
+ return `${convertLibNameFromPackageName(localeMatch[1])}${convertLibNameFromPackageName(localeMatch[2])}`;
+ }
+
return convertLibNameFromPackageName(source);
}
return null;
}
+function resolveOutputGlobal(source: string) {
+ const global = resolveUmdGlobal(source);
+
+ if (global !== null) {
+ return global;
+ }
+
+ if (source.endsWith('.css')) {
+ return CSS_UMD_GLOBAL;
+ }
+
+ return convertLibNameFromPackageName(source);
+}
+
/**
* Produces a stable UMD global name for primary, facade and locale entries.
*/
@@ -76,7 +101,7 @@ function getGlobalName(packageName: string, entryKey: string) {
return `${name}Facade`;
}
- if (entryKey.startsWith('locale/')) {
+ if (entryKey.startsWith('locale/') || entryKey.startsWith('locales/')) {
const localeKey = entryKey.split('/')[1];
return `${name}${convertLibNameFromPackageName(localeKey)}`;
}
@@ -104,7 +129,7 @@ export function createUmdConfig(options: ICreateUmdConfigOptions): UserConfig {
outDir,
outputOptions: {
entryFileNames: '[name].js',
- globals: (source: string) => resolveUmdGlobal(source) ?? convertLibNameFromPackageName(source),
+ globals: (source: string) => resolveOutputGlobal(source),
minify: true,
},
platform: 'browser',
diff --git a/common/shared/tsdown/types.ts b/common/shared/tsdown/types.ts
index 63a2fbf5d8..d7a4f48656 100644
--- a/common/shared/tsdown/types.ts
+++ b/common/shared/tsdown/types.ts
@@ -25,7 +25,7 @@ export interface IBuildOptions {
obfuscatorIgnorePatterns?: RegExp[];
}
-export type TEntryType = 'facade' | 'index' | 'locale';
+export type TEntryType = 'facade' | 'index' | 'locale' | 'worker';
export interface IEntryConfig {
key: string;
diff --git a/eslint.config.ts b/eslint.config.ts
index 06dea18c1b..bb579e3082 100644
--- a/eslint.config.ts
+++ b/eslint.config.ts
@@ -46,7 +46,10 @@ export default antfu(
typescriptPreset(),
univerSourcePreset({
noFacadeImportsOutsideFacade: {
- ignore: ['packages/uniscript/src/services/script-execution.service.ts'],
+ ignore: [
+ 'packages/uniscript/src/services/script-execution.service.ts',
+ 'presets/packages/preset-',
+ ],
},
}),
facadePreset(),
diff --git a/examples/package.json b/examples/package.json
index 3296fce95e..eb1116303d 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -38,6 +38,9 @@
"@univerjs/icons": "1.4.0",
"@univerjs/mockdata": "workspace:*",
"@univerjs/network": "workspace:*",
+ "@univerjs/preset-docs-core": "workspace:*",
+ "@univerjs/preset-sheets-core": "workspace:*",
+ "@univerjs/presets": "workspace:*",
"@univerjs/rpc": "workspace:*",
"@univerjs/rpc-node": "workspace:*",
"@univerjs/sheets": "workspace:*",
diff --git a/examples/src/preset-docs-core/main.ts b/examples/src/preset-docs-core/main.ts
new file mode 100644
index 0000000000..e29484dc96
--- /dev/null
+++ b/examples/src/preset-docs-core/main.ts
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { UniverInstanceType } from '@univerjs/core';
+import { DEFAULT_DOCUMENT_DATA_SIMPLE } from '@univerjs/mockdata';
+import { UniverDocsCorePreset } from '@univerjs/preset-docs-core';
+import UniverPresetDocsCoreZhCN from '@univerjs/preset-docs-core/locales/zh-CN';
+import { createUniver, LocaleType, LogLevel, mergeLocales } from '@univerjs/presets';
+
+import '../global.css';
+
+const { univer, univerAPI } = createUniver({
+ locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: mergeLocales(UniverPresetDocsCoreZhCN),
+ },
+ logLevel: LogLevel.VERBOSE,
+ presets: [
+ UniverDocsCorePreset({
+ container: 'app',
+ }),
+ ],
+});
+
+univer.createUnit(UniverInstanceType.UNIVER_DOC, DEFAULT_DOCUMENT_DATA_SIMPLE);
+
+declare global {
+ // eslint-disable-next-line ts/naming-convention
+ interface Window {
+ univer?: typeof univer;
+ univerAPI?: typeof univerAPI;
+ }
+}
+
+window.univer = univer;
+window.univerAPI = univerAPI;
diff --git a/examples/src/preset-sheets-core/main.ts b/examples/src/preset-sheets-core/main.ts
new file mode 100644
index 0000000000..3e9dc6bd63
--- /dev/null
+++ b/examples/src/preset-sheets-core/main.ts
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';
+import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core';
+import UniverPresetSheetsCoreZhCN from '@univerjs/preset-sheets-core/locales/zh-CN';
+import { createUniver, LocaleType, LogLevel, mergeLocales } from '@univerjs/presets';
+
+import '../global.css';
+
+const { univer, univerAPI } = createUniver({
+ locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: mergeLocales(UniverPresetSheetsCoreZhCN),
+ },
+ logLevel: LogLevel.VERBOSE,
+ presets: [
+ UniverSheetsCorePreset({
+ container: 'app',
+ workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),
+ }),
+ ],
+});
+
+univerAPI.createWorkbook(DEFAULT_WORKBOOK_DATA_DEMO);
+
+declare global {
+ // eslint-disable-next-line ts/naming-convention
+ interface Window {
+ univer?: typeof univer;
+ univerAPI?: typeof univerAPI;
+ }
+}
+
+window.univer = univer;
+window.univerAPI = univerAPI;
diff --git a/examples/src/preset-sheets-core/worker.ts b/examples/src/preset-sheets-core/worker.ts
new file mode 100644
index 0000000000..183470fe5a
--- /dev/null
+++ b/examples/src/preset-sheets-core/worker.ts
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { UniverSheetsCoreWorkerPreset } from '@univerjs/preset-sheets-core/worker';
+import { createUniver } from '@univerjs/presets';
+
+createUniver({
+ presets: [
+ UniverSheetsCoreWorkerPreset(),
+ ],
+});
diff --git a/examples/umd/docs.html b/examples/umd/docs.html
index 40bd11292b..e64655ee11 100644
--- a/examples/umd/docs.html
+++ b/examples/umd/docs.html
@@ -1,6 +1,14 @@
<head>
- <script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
- <script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react.production.min.js"
+ integrity="sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"
+ integrity="sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1"
+ crossorigin="anonymous"
+ ></script>
<script>
/**
* Starting from Univer 0.6.0, with the support for React 19[^1], UMD users may need additional adaptation.
@@ -92,13 +100,29 @@
}
})(this);
</script>
- <script src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"></script>
- <script src="https://unpkg.com/[email protected]/dist/echarts.min.js"></script>
- <script src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/index.js"></script>
- <script src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/react-bindings/index.js"></script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"
+ integrity="sha384-Opyi337NBU4M11Xx1aRUN4dZejlRWsq277uHWHyysNm4frJzmqu7KvgkHu4YWTqk"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/echarts.min.js"
+ integrity="sha384-pPi0zxBAoDu6+JXW/C68UZLvBUUtU+7zonhif43rqj7pxsGyqyqzcian2Rj37Rss"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/index.js"
+ integrity="sha384-F4WZII63zjCUVMrITB+Vu6vQFNeE93iOJ8Qovkx5rdYxskyLdx0JnJZY4QLLCjk3"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/react-bindings/index.js"
+ integrity="sha384-jJdF43Ttfx58SshGsOzzjyBHEuP03xjyRVMmHmrwARzwOnVrnVvFJARk6O8tW/OF"
+ crossorigin="anonymous"
+ ></script>
<script src="/packages/themes/lib/umd/index.js"></script>
- <script src="https://unpkg.com/@univerjs/protocol/lib/umd/index.js"></script>
+ <script src="/packages/protocol/lib/umd/index.js"></script>
<script src="/packages/core/lib/umd/index.js"></script>
<script src="/packages/network/lib/umd/index.js"></script>
<script src="/packages/telemetry/lib/umd/index.js"></script>
diff --git a/examples/umd/presets-docs.html b/examples/umd/presets-docs.html
new file mode 100644
index 0000000000..b825e9d247
--- /dev/null
+++ b/examples/umd/presets-docs.html
@@ -0,0 +1,150 @@
+<head>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react.production.min.js"
+ integrity="sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"
+ integrity="sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1"
+ crossorigin="anonymous"
+ ></script>
+ <script>
+ /**
+ * Starting from Univer 0.6.0, with the support for React 19[^1], UMD users may need additional adaptation.
+ * It is recommended to migrate to module script[^2] and a more modern build system.
+ *
+ * [^1]: [Module Script] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html
+ * [^2]: [support for React 19] https://github.com/dream-num/univer/pull/4247
+ */
+
+ /**
+ * Fix `Uncaught TypeError: client.createRoot is not a function`
+ * If using UMD React < 18, you might need the following code.
+ */
+ (function (global) {
+ 'use strict';
+ if (!global.ReactDOM) {
+ throw new Error('ReactDOM must be loaded before ReactCreateRoot.');
+ }
+ const ReactDOM = global.ReactDOM;
+ if (!ReactDOM.createRoot) {
+ ReactDOM.createRoot = function (container) {
+ return {
+ render: (element) => {
+ ReactDOM.render(element, container);
+ },
+ };
+ };
+ }
+ })(this);
+
+ /**
+ * Fix `Uncaught TypeError: jsxRuntime.jsx is not a function`
+ * If using UMD React, you might need the following code.
+ * Reference: https://unpkg.com/[email protected]/cjs/react-jsx-runtime.production.min.js
+ */
+ (function (global) {
+ 'use strict';
+ if (!global.React) {
+ throw new Error('React must be loaded before ReactJSXRuntime.');
+ }
+ const React = global.React;
+ if (!React.jsx || !React.jsxs) {
+ const REACT_ELEMENT_TYPE = Symbol.for('react.element');
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
+ const RESERVED_PROPS = {
+ key: true,
+ ref: true,
+ __self: true,
+ __source: true,
+ };
+ const ReactCurrentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
+ function createReactElement(type, config, maybeKey) {
+ const props = {};
+ let key = null;
+ let ref = null;
+ if (maybeKey !== undefined) {
+ key = `${maybeKey}`;
+ }
+ if (config.key !== undefined) {
+ key = `${config.key}`;
+ }
+ if (config.ref !== undefined) {
+ ref = config.ref;
+ }
+ for (var propName in config) {
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
+ props[propName] = config[propName];
+ }
+ }
+ if (type && type.defaultProps) {
+ const defaultProps = type.defaultProps;
+ for (var propName in defaultProps) {
+ if (props[propName] === undefined) {
+ props[propName] = defaultProps[propName];
+ }
+ }
+ }
+ return {
+ $$typeof: REACT_ELEMENT_TYPE,
+ type,
+ key,
+ ref,
+ props,
+ _owner: ReactCurrentOwner.current,
+ };
+ }
+ React.jsx = createReactElement;
+ React.jsxs = createReactElement;
+ }
+ })(this);
+ </script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"
+ integrity="sha384-Opyi337NBU4M11Xx1aRUN4dZejlRWsq277uHWHyysNm4frJzmqu7KvgkHu4YWTqk"
+ crossorigin="anonymous"
+ ></script>
+ <script src="/presets/lib/umd/index.js"></script>
+ <script src="/presets/packages/preset-docs-core/lib/umd/index.js"></script>
+ <script src="/presets/packages/preset-docs-core/lib/umd/locales/en-US.js"></script>
+
+ <link rel="stylesheet" href="/presets/packages/preset-docs-core/lib/index.css" />
+
+ <style>
+ html,
+ body,
+ #root,
+ #app {
+ padding: 0;
+ margin: 0;
+ height: 100%;
+ }
+ </style>
+</head>
+<body>
+ <div id="app"></div>
+
+ <script>
+ const { LocaleType, mergeLocales, UniverInstanceType } = UniverCore;
+ const { createUniver } = UniverPresets;
+ const { UniverDocsCorePreset } = UniverPresetDocsCore;
+
+ const { univer, univerAPI } = createUniver({
+ locale: LocaleType.EN_US,
+ locales: {
+ [LocaleType.EN_US]: mergeLocales(UniverPresetDocsCoreEnUS),
+ },
+ presets: [
+ UniverDocsCorePreset({
+ container: 'app',
+ }),
+ ],
+ });
+
+ univer.createUnit(UniverInstanceType.UNIVER_DOC, {});
+
+ window.univer = univer;
+ window.univerAPI = univerAPI;
+ </script>
+</body>
diff --git a/examples/umd/presets-sheets.html b/examples/umd/presets-sheets.html
new file mode 100644
index 0000000000..fcb6d93ef9
--- /dev/null
+++ b/examples/umd/presets-sheets.html
@@ -0,0 +1,150 @@
+<head>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react.production.min.js"
+ integrity="sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"
+ integrity="sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1"
+ crossorigin="anonymous"
+ ></script>
+ <script>
+ /**
+ * Starting from Univer 0.6.0, with the support for React 19[^1], UMD users may need additional adaptation.
+ * It is recommended to migrate to module script[^2] and a more modern build system.
+ *
+ * [^1]: [Module Script] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html
+ * [^2]: [support for React 19] https://github.com/dream-num/univer/pull/4247
+ */
+
+ /**
+ * Fix `Uncaught TypeError: client.createRoot is not a function`
+ * If using UMD React < 18, you might need the following code.
+ */
+ (function (global) {
+ 'use strict';
+ if (!global.ReactDOM) {
+ throw new Error('ReactDOM must be loaded before ReactCreateRoot.');
+ }
+ const ReactDOM = global.ReactDOM;
+ if (!ReactDOM.createRoot) {
+ ReactDOM.createRoot = function (container) {
+ return {
+ render: (element) => {
+ ReactDOM.render(element, container);
+ },
+ };
+ };
+ }
+ })(this);
+
+ /**
+ * Fix `Uncaught TypeError: jsxRuntime.jsx is not a function`
+ * If using UMD React, you might need the following code.
+ * Reference: https://unpkg.com/[email protected]/cjs/react-jsx-runtime.production.min.js
+ */
+ (function (global) {
+ 'use strict';
+ if (!global.React) {
+ throw new Error('React must be loaded before ReactJSXRuntime.');
+ }
+ const React = global.React;
+ if (!React.jsx || !React.jsxs) {
+ const REACT_ELEMENT_TYPE = Symbol.for('react.element');
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
+ const RESERVED_PROPS = {
+ key: true,
+ ref: true,
+ __self: true,
+ __source: true,
+ };
+ const ReactCurrentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
+ function createReactElement(type, config, maybeKey) {
+ const props = {};
+ let key = null;
+ let ref = null;
+ if (maybeKey !== undefined) {
+ key = `${maybeKey}`;
+ }
+ if (config.key !== undefined) {
+ key = `${config.key}`;
+ }
+ if (config.ref !== undefined) {
+ ref = config.ref;
+ }
+ for (var propName in config) {
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
+ props[propName] = config[propName];
+ }
+ }
+ if (type && type.defaultProps) {
+ const defaultProps = type.defaultProps;
+ for (var propName in defaultProps) {
+ if (props[propName] === undefined) {
+ props[propName] = defaultProps[propName];
+ }
+ }
+ }
+ return {
+ $$typeof: REACT_ELEMENT_TYPE,
+ type,
+ key,
+ ref,
+ props,
+ _owner: ReactCurrentOwner.current,
+ };
+ }
+ React.jsx = createReactElement;
+ React.jsxs = createReactElement;
+ }
+ })(this);
+ </script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"
+ integrity="sha384-Opyi337NBU4M11Xx1aRUN4dZejlRWsq277uHWHyysNm4frJzmqu7KvgkHu4YWTqk"
+ crossorigin="anonymous"
+ ></script>
+ <script src="/presets/lib/umd/index.js"></script>
+ <script src="/presets/packages/preset-sheets-core/lib/umd/index.js"></script>
+ <script src="/presets/packages/preset-sheets-core/lib/umd/locales/en-US.js"></script>
+
+ <link rel="stylesheet" href="/presets/packages/preset-sheets-core/lib/index.css" />
+
+ <style>
+ html,
+ body,
+ #root,
+ #app {
+ padding: 0;
+ margin: 0;
+ height: 100%;
+ }
+ </style>
+</head>
+<body>
+ <div id="app"></div>
+
+ <script>
+ const { LocaleType, mergeLocales } = UniverCore;
+ const { createUniver } = UniverPresets;
+ const { UniverSheetsCorePreset } = UniverPresetSheetsCore;
+
+ const { univer, univerAPI } = createUniver({
+ locale: LocaleType.EN_US,
+ locales: {
+ [LocaleType.EN_US]: mergeLocales(UniverPresetSheetsCoreEnUS),
+ },
+ presets: [
+ UniverSheetsCorePreset({
+ container: 'app',
+ }),
+ ],
+ });
+
+ univerAPI.createWorkbook({});
+
+ window.univer = univer;
+ window.univerAPI = univerAPI;
+ </script>
+</body>
diff --git a/examples/umd/sheets.html b/examples/umd/sheets.html
index 18e4f79e77..8cb69d9a1f 100644
--- a/examples/umd/sheets.html
+++ b/examples/umd/sheets.html
@@ -1,6 +1,14 @@
<head>
- <script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
- <script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react.production.min.js"
+ integrity="sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"
+ integrity="sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1"
+ crossorigin="anonymous"
+ ></script>
<script>
/**
* Starting from Univer 0.6.0, with the support for React 19[^1], UMD users may need additional adaptation.
@@ -92,13 +100,29 @@
}
})(this);
</script>
- <script src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"></script>
- <script src="https://unpkg.com/[email protected]/dist/echarts.min.js"></script>
- <script src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/index.js"></script>
- <script src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/react-bindings/index.js"></script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/bundles/rxjs.umd.min.js"
+ integrity="sha384-Opyi337NBU4M11Xx1aRUN4dZejlRWsq277uHWHyysNm4frJzmqu7KvgkHu4YWTqk"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/[email protected]/dist/echarts.min.js"
+ integrity="sha384-pPi0zxBAoDu6+JXW/C68UZLvBUUtU+7zonhif43rqj7pxsGyqyqzcian2Rj37Rss"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/index.js"
+ integrity="sha384-F4WZII63zjCUVMrITB+Vu6vQFNeE93iOJ8Qovkx5rdYxskyLdx0JnJZY4QLLCjk3"
+ crossorigin="anonymous"
+ ></script>
+ <script
+ src="https://unpkg.com/@wendellhu/[email protected]/dist/umd/react-bindings/index.js"
+ integrity="sha384-jJdF43Ttfx58SshGsOzzjyBHEuP03xjyRVMmHmrwARzwOnVrnVvFJARk6O8tW/OF"
+ crossorigin="anonymous"
+ ></script>
<script src="/packages/themes/lib/umd/index.js"></script>
- <script src="https://unpkg.com/@univerjs/protocol/lib/umd/index.js"></script>
+ <script src="/packages/protocol/lib/umd/index.js"></script>
<script src="/packages/core/lib/umd/index.js"></script>
<script src="/packages/network/lib/umd/index.js"></script>
<script src="/packages/telemetry/lib/umd/index.js"></script>
diff --git a/package.json b/package.json
index e3aa9c902f..e0d55da9c9 100644
--- a/package.json
+++ b/package.json
@@ -43,8 +43,10 @@
"test": "turbo test -- --passWithNoTests",
"coverage": "turbo coverage -- --passWithNoTests",
"analyze:build": "tsx ./scripts/build-analysis.ts",
- "build": "turbo build --filter=!./common/*",
- "build:ci": "turbo build --filter=!./common/*",
+ "build": "pnpm run build:plugins && pnpm run build:presets",
+ "build:ci": "pnpm run build",
+ "build:plugins": "turbo build --filter '!./common/*' --filter '!./presets/**'",
+ "build:presets": "turbo build --filter './presets/**...' --filter '!./presets/**' && turbo build --filter './presets/**'",
"build:demo": "pnpm --filter univer-examples build:demo",
"build:e2e": "pnpm --filter univer-examples build:e2e",
"serve:e2e": "serve ./examples/local",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e8aa67171a..76fe53e3de 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -110,7 +110,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
common/debugger:
dependencies:
@@ -547,6 +547,15 @@ importers:
'@univerjs/network':
specifier: workspace:*
version: link:../packages/network
+ '@univerjs/preset-docs-core':
+ specifier: workspace:*
+ version: link:../presets/packages/preset-docs-core
+ '@univerjs/preset-sheets-core':
+ specifier: workspace:*
+ version: link:../presets/packages/preset-sheets-core
+ '@univerjs/presets':
+ specifier: workspace:*
+ version: link:../presets
'@univerjs/rpc':
specifier: workspace:*
version: link:../packages/rpc
@@ -776,7 +785,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/core:
dependencies:
@@ -834,7 +843,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/data-validation:
dependencies:
@@ -859,7 +868,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/design:
dependencies:
@@ -957,7 +966,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/docs-drawing:
dependencies:
@@ -976,7 +985,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/docs-drawing-ui:
dependencies:
@@ -1044,7 +1053,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/docs-hyper-link-ui:
dependencies:
@@ -1320,7 +1329,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/drawing-ui:
dependencies:
@@ -1391,7 +1400,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/engine-render:
dependencies:
@@ -1496,7 +1505,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/protocol:
dependencies:
@@ -1515,7 +1524,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/rpc:
dependencies:
@@ -1534,7 +1543,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/rpc-node:
dependencies:
@@ -1556,7 +1565,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets:
dependencies:
@@ -1590,7 +1599,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-conditional-formatting:
dependencies:
@@ -1624,7 +1633,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-conditional-formatting-ui:
dependencies:
@@ -1762,7 +1771,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-data-validation-ui:
dependencies:
@@ -1848,7 +1857,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-drawing-ui:
dependencies:
@@ -1937,7 +1946,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-filter-ui:
dependencies:
@@ -2023,7 +2032,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-formula:
dependencies:
@@ -2057,7 +2066,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-formula-ui:
dependencies:
@@ -2137,7 +2146,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-hyper-link:
dependencies:
@@ -2165,7 +2174,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-hyper-link-ui:
dependencies:
@@ -2260,7 +2269,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-note-ui:
dependencies:
@@ -2334,7 +2343,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-numfmt-ui:
dependencies:
@@ -2408,7 +2417,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-sort-ui:
dependencies:
@@ -2491,7 +2500,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-table-ui:
dependencies:
@@ -2577,7 +2586,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/sheets-thread-comment-ui:
dependencies:
@@ -2767,7 +2776,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/slides-ui:
dependencies:
@@ -2835,7 +2844,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/themes:
devDependencies:
@@ -2860,7 +2869,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages/thread-comment-ui:
dependencies:
@@ -2881,60 +2890,629 @@ importers:
version: link:../thread-comment
'@univerjs/ui':
specifier: workspace:*
- version: link:../ui
+ version: link:../ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ postcss:
+ specifier: ^8.5.15
+ version: 8.5.15
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ tailwindcss:
+ specifier: 3.4.18
+ version: 3.4.18
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+
+ packages/ui:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/design':
+ specifier: workspace:*
+ version: link:../design
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../engine-render
+ '@univerjs/icons':
+ specifier: 1.4.0
+ '@wendellhu/redi':
+ specifier: 1.1.1
+ version: 1.1.1([email protected])
+ devDependencies:
+ '@testing-library/react':
+ specifier: ^16.3.2
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ '@univerjs/themes':
+ specifier: workspace:*
+ version: link:../themes
+ postcss:
+ specifier: ^8.5.15
+ version: 8.5.15
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ tailwindcss:
+ specifier: 3.4.18
+ version: 3.4.18
+ tailwindcss-animate:
+ specifier: ^1.0.7
+ version: 1.0.7([email protected])
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+
+ packages/ui-adapter-vue3:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+ vue:
+ specifier: ^3.5.34
+ version: 3.5.34([email protected])
+
+ packages/ui-adapter-web-component:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+
+ packages/uniscript:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/design':
+ specifier: workspace:*
+ version: link:../design
+ '@univerjs/sheets':
+ specifier: workspace:*
+ version: link:../sheets
+ '@univerjs/sheets-ui':
+ specifier: workspace:*
+ version: link:../sheets-ui
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../ui
+ monaco-editor:
+ specifier: 0.55.1
+ version: 0.55.1
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ postcss:
+ specifier: ^8.5.15
+ version: 8.5.15
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ tailwindcss:
+ specifier: 3.4.18
+ version: 3.4.18
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+
+ packages/watermark:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../core
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../engine-render
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../common/shared
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+ vitest:
+ specifier: ^4.1.7
+
+ presets:
+ dependencies:
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../packages/core
+ '@univerjs/drawing':
+ specifier: workspace:*
+ version: link:../packages/drawing
+ '@univerjs/engine-formula':
+ specifier: workspace:*
+ version: link:../packages/engine-formula
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../packages/engine-render
+ '@univerjs/network':
+ specifier: workspace:*
+ version: link:../packages/network
+ '@univerjs/protocol':
+ specifier: workspace:*
+ version: link:../packages/protocol
+ '@univerjs/rpc':
+ specifier: workspace:*
+ version: link:../packages/rpc
+ '@univerjs/telemetry':
+ specifier: workspace:*
+ version: link:../packages/telemetry
+ '@univerjs/themes':
+ specifier: workspace:*
+ version: link:../packages/themes
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../common/shared
+ '@wendellhu/redi':
+ specifier: 1.1.1
+ version: 1.1.1([email protected])
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-docs-core:
+ dependencies:
+ '@univerjs/design':
+ specifier: workspace:*
+ version: link:../../../packages/design
+ '@univerjs/docs':
+ specifier: workspace:*
+ version: link:../../../packages/docs
+ '@univerjs/docs-ui':
+ specifier: workspace:*
+ version: link:../../../packages/docs-ui
+ '@univerjs/engine-formula':
+ specifier: workspace:*
+ version: link:../../../packages/engine-formula
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../../../packages/engine-render
+ '@univerjs/network':
+ specifier: workspace:*
+ version: link:../../../packages/network
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../../../packages/ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-docs-drawing:
+ dependencies:
+ '@univerjs/docs-drawing':
+ specifier: workspace:*
+ version: link:../../../packages/docs-drawing
+ '@univerjs/docs-drawing-ui':
+ specifier: workspace:*
+ version: link:../../../packages/docs-drawing-ui
+ '@univerjs/drawing':
+ specifier: workspace:*
+ version: link:../../../packages/drawing
+ '@univerjs/drawing-ui':
+ specifier: workspace:*
+ version: link:../../../packages/drawing-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-docs-hyper-link:
+ dependencies:
+ '@univerjs/docs-hyper-link':
+ specifier: workspace:*
+ version: link:../../../packages/docs-hyper-link
+ '@univerjs/docs-hyper-link-ui':
+ specifier: workspace:*
+ version: link:../../../packages/docs-hyper-link-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-docs-node-core:
+ dependencies:
+ '@univerjs/docs':
+ specifier: workspace:*
+ version: link:../../../packages/docs
+ '@univerjs/docs-drawing':
+ specifier: workspace:*
+ version: link:../../../packages/docs-drawing
+ '@univerjs/docs-hyper-link':
+ specifier: workspace:*
+ version: link:../../../packages/docs-hyper-link
+ '@univerjs/engine-formula':
+ specifier: workspace:*
+ version: link:../../../packages/engine-formula
+ '@univerjs/rpc-node':
+ specifier: workspace:*
+ version: link:../../../packages/rpc-node
+ '@univerjs/thread-comment':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-docs-thread-comment:
+ dependencies:
+ '@univerjs/docs-thread-comment-ui':
+ specifier: workspace:*
+ version: link:../../../packages/docs-thread-comment-ui
+ '@univerjs/thread-comment':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment
+ '@univerjs/thread-comment-ui':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-conditional-formatting:
+ dependencies:
+ '@univerjs/sheets-conditional-formatting':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-conditional-formatting
+ '@univerjs/sheets-conditional-formatting-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-conditional-formatting-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-core:
+ dependencies:
+ '@univerjs/design':
+ specifier: workspace:*
+ version: link:../../../packages/design
+ '@univerjs/docs':
+ specifier: workspace:*
+ version: link:../../../packages/docs
+ '@univerjs/docs-ui':
+ specifier: workspace:*
+ version: link:../../../packages/docs-ui
+ '@univerjs/engine-formula':
+ specifier: workspace:*
+ version: link:../../../packages/engine-formula
+ '@univerjs/engine-render':
+ specifier: workspace:*
+ version: link:../../../packages/engine-render
+ '@univerjs/network':
+ specifier: workspace:*
+ version: link:../../../packages/network
+ '@univerjs/rpc':
+ specifier: workspace:*
+ version: link:../../../packages/rpc
+ '@univerjs/sheets':
+ specifier: workspace:*
+ version: link:../../../packages/sheets
+ '@univerjs/sheets-formula':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-formula
+ '@univerjs/sheets-formula-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-formula-ui
+ '@univerjs/sheets-numfmt':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-numfmt
+ '@univerjs/sheets-numfmt-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-numfmt-ui
+ '@univerjs/sheets-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-ui
+ '@univerjs/ui':
+ specifier: workspace:*
+ version: link:../../../packages/ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-data-validation:
+ dependencies:
+ '@univerjs/data-validation':
+ specifier: workspace:*
+ version: link:../../../packages/data-validation
+ '@univerjs/sheets-data-validation':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-data-validation
+ '@univerjs/sheets-data-validation-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-data-validation-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-drawing:
+ dependencies:
+ '@univerjs/docs-drawing':
+ specifier: workspace:*
+ version: link:../../../packages/docs-drawing
+ '@univerjs/drawing':
+ specifier: workspace:*
+ version: link:../../../packages/drawing
+ '@univerjs/drawing-ui':
+ specifier: workspace:*
+ version: link:../../../packages/drawing-ui
+ '@univerjs/sheets-drawing':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-drawing
+ '@univerjs/sheets-drawing-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-drawing-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-filter:
+ dependencies:
+ '@univerjs/sheets-filter':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-filter
+ '@univerjs/sheets-filter-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-filter-ui
+ devDependencies:
+ '@univerjs-infra/shared':
+ specifier: workspace:*
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-find-replace:
+ dependencies:
+ '@univerjs/find-replace':
+ specifier: workspace:*
+ version: link:../../../packages/find-replace
+ '@univerjs/sheets-find-replace':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-find-replace
devDependencies:
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
- postcss:
- specifier: ^8.5.15
- version: 8.5.15
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
react:
specifier: 19.2.6
version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
rxjs:
specifier: ^7.8.2
version: 7.8.2
- tailwindcss:
- specifier: 3.4.18
- version: 3.4.18
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
- packages/ui:
+ presets/packages/preset-sheets-hyper-link:
dependencies:
- '@univerjs/core':
- specifier: workspace:*
- version: link:../core
- '@univerjs/design':
+ '@univerjs/sheets-hyper-link':
specifier: workspace:*
- version: link:../design
- '@univerjs/engine-render':
+ version: link:../../../packages/sheets-hyper-link
+ '@univerjs/sheets-hyper-link-ui':
specifier: workspace:*
- version: link:../engine-render
- '@univerjs/icons':
- specifier: 1.4.0
- '@wendellhu/redi':
- specifier: 1.1.1
- version: 1.1.1([email protected])
+ version: link:../../../packages/sheets-hyper-link-ui
devDependencies:
- '@testing-library/react':
- specifier: ^16.3.2
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
- '@univerjs/themes':
+ version: link:../../../common/shared
+ '@univerjs/core':
specifier: workspace:*
- version: link:../themes
- postcss:
- specifier: ^8.5.15
- version: 8.5.15
+ version: link:../../../packages/core
react:
specifier: 19.2.6
version: 19.2.6
@@ -2944,124 +3522,182 @@ importers:
rxjs:
specifier: ^7.8.2
version: 7.8.2
- tailwindcss:
- specifier: 3.4.18
- version: 3.4.18
- tailwindcss-animate:
- specifier: ^1.0.7
- version: 1.0.7([email protected])
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
- packages/ui-adapter-vue3:
+ presets/packages/preset-sheets-node-core:
dependencies:
- '@univerjs/core':
+ '@univerjs/docs':
specifier: workspace:*
- version: link:../core
- '@univerjs/ui':
+ version: link:../../../packages/docs
+ '@univerjs/engine-formula':
specifier: workspace:*
- version: link:../ui
+ version: link:../../../packages/engine-formula
+ '@univerjs/rpc-node':
+ specifier: workspace:*
+ version: link:../../../packages/rpc-node
+ '@univerjs/sheets':
+ specifier: workspace:*
+ version: link:../../../packages/sheets
+ '@univerjs/sheets-data-validation':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-data-validation
+ '@univerjs/sheets-drawing':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-drawing
+ '@univerjs/sheets-filter':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-filter
+ '@univerjs/sheets-formula':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-formula
+ '@univerjs/sheets-hyper-link':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-hyper-link
+ '@univerjs/sheets-numfmt':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-numfmt
+ '@univerjs/sheets-sort':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-sort
+ '@univerjs/sheets-thread-comment':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-thread-comment
+ '@univerjs/thread-comment':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment
devDependencies:
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
- vue:
- specifier: ^3.5.34
- version: 3.5.34([email protected])
- packages/ui-adapter-web-component:
+ presets/packages/preset-sheets-note:
dependencies:
- '@univerjs/core':
+ '@univerjs/sheets-note':
specifier: workspace:*
- version: link:../core
- '@univerjs/ui':
+ version: link:../../../packages/sheets-note
+ '@univerjs/sheets-note-ui':
specifier: workspace:*
- version: link:../ui
+ version: link:../../../packages/sheets-note-ui
devDependencies:
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
- packages/uniscript:
+ presets/packages/preset-sheets-sort:
dependencies:
- '@univerjs/core':
+ '@univerjs/sheets-sort':
specifier: workspace:*
- version: link:../core
- '@univerjs/design':
+ version: link:../../../packages/sheets-sort
+ '@univerjs/sheets-sort-ui':
specifier: workspace:*
- version: link:../design
- '@univerjs/sheets':
+ version: link:../../../packages/sheets-sort-ui
+ devDependencies:
+ '@univerjs-infra/shared':
specifier: workspace:*
- version: link:../sheets
- '@univerjs/sheets-ui':
+ version: link:../../../common/shared
+ '@univerjs/core':
specifier: workspace:*
- version: link:../sheets-ui
- '@univerjs/ui':
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
+ rxjs:
+ specifier: ^7.8.2
+ version: 7.8.2
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+ presets/packages/preset-sheets-table:
+ dependencies:
+ '@univerjs/sheets-table':
specifier: workspace:*
- version: link:../ui
- monaco-editor:
- specifier: 0.55.1
- version: 0.55.1
+ version: link:../../../packages/sheets-table
+ '@univerjs/sheets-table-ui':
+ specifier: workspace:*
+ version: link:../../../packages/sheets-table-ui
devDependencies:
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
- postcss:
- specifier: ^8.5.15
- version: 8.5.15
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
react:
specifier: 19.2.6
version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
rxjs:
specifier: ^7.8.2
version: 7.8.2
- tailwindcss:
- specifier: 3.4.18
- version: 3.4.18
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
- packages/watermark:
+ presets/packages/preset-sheets-thread-comment:
dependencies:
- '@univerjs/core':
+ '@univerjs/sheets-thread-comment':
specifier: workspace:*
- version: link:../core
- '@univerjs/engine-render':
+ version: link:../../../packages/sheets-thread-comment
+ '@univerjs/sheets-thread-comment-ui':
specifier: workspace:*
- version: link:../engine-render
+ version: link:../../../packages/sheets-thread-comment-ui
+ '@univerjs/thread-comment':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment
+ '@univerjs/thread-comment-ui':
+ specifier: workspace:*
+ version: link:../../../packages/thread-comment-ui
devDependencies:
'@univerjs-infra/shared':
specifier: workspace:*
- version: link:../../common/shared
+ version: link:../../../common/shared
+ '@univerjs/core':
+ specifier: workspace:*
+ version: link:../../../packages/core
+ react:
+ specifier: 19.2.6
+ version: 19.2.6
+ react-dom:
+ specifier: 19.2.6
+ version: 19.2.6([email protected])
rxjs:
specifier: ^7.8.2
version: 7.8.2
typescript:
specifier: ^6.0.3
version: 6.0.3
- vitest:
- specifier: ^4.1.7
tests/formula-integration:
dependencies:
@@ -3113,7 +3749,7 @@ importers:
version: 6.0.3
vitest:
specifier: ^4.1.7
packages:
@@ -12053,6 +12689,11 @@ snapshots:
dependencies:
'@csstools/css-tokenizer': 4.0.0
+ dependencies:
+ postcss: 8.5.14
+ optional: true
+
dependencies:
postcss: 8.5.15
@@ -14639,7 +15280,7 @@ snapshots:
magicast: 0.5.3
obug: 2.1.1
tinyrainbow: 3.1.0
transitivePeerDependencies:
- supports-color
@@ -14651,7 +15292,7 @@ snapshots:
optionalDependencies:
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
@@ -15614,6 +16255,15 @@ snapshots:
+ dependencies:
+ '@asamuzakjp/css-color': 4.0.5
+ '@csstools/css-syntax-patches-for-csstree': 1.0.14([email protected])
+ css-tree: 3.1.0
+ transitivePeerDependencies:
+ - postcss
+ optional: true
+
dependencies:
'@asamuzakjp/css-color': 4.0.5
@@ -17412,6 +18062,35 @@ snapshots:
+ dependencies:
+ '@asamuzakjp/dom-selector': 6.7.3
+ cssstyle: 5.3.1([email protected])
+ data-urls: 6.0.0
+ decimal.js: 10.6.0
+ html-encoding-sniffer: 4.0.0
+ http-proxy-agent: 7.0.2
+ https-proxy-agent: 7.0.6
+ is-potential-custom-element-name: 1.0.1
+ parse5: 8.0.0
+ rrweb-cssom: 0.8.0
+ saxes: 6.0.0
+ symbol-tree: 3.2.4
+ tough-cookie: 6.0.0
+ w3c-xmlserializer: 5.0.0
+ webidl-conversions: 8.0.0
+ whatwg-encoding: 3.1.1
+ whatwg-mimetype: 4.0.0
+ whatwg-url: 15.1.0
+ ws: 8.18.3
+ xml-name-validator: 5.0.0
+ transitivePeerDependencies:
+ - bufferutil
+ - postcss
+ - supports-color
+ - utf-8-validate
+ optional: true
+
dependencies:
'@asamuzakjp/dom-selector': 6.7.3
@@ -20296,6 +20975,36 @@ snapshots:
tsx: 4.22.3
yaml: 2.9.0
+ dependencies:
+ '@vitest/expect': 4.1.7
+ '@vitest/pretty-format': 4.1.7
+ '@vitest/runner': 4.1.7
+ '@vitest/snapshot': 4.1.7
+ '@vitest/spy': 4.1.7
+ '@vitest/utils': 4.1.7
+ es-module-lexer: 2.1.0
+ expect-type: 1.3.0
+ magic-string: 0.30.21
+ obug: 2.1.1
+ pathe: 2.0.3
+ picomatch: 4.0.4
+ std-env: 4.1.0
+ tinybench: 2.9.0
+ tinyexec: 1.2.3
+ tinyglobby: 0.2.16
+ tinyrainbow: 3.1.0
+ why-is-node-running: 2.3.0
+ optionalDependencies:
+ '@types/node': 25.9.1
+ '@vitest/coverage-istanbul': 4.1.7([email protected])
+ happy-dom: 20.9.0
+ jsdom: 27.0.1([email protected])
+ transitivePeerDependencies:
+ - msw
+
dependencies:
'@vitest/expect': 4.1.7
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 77eadfb976..882268c6bd 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -2,6 +2,8 @@ packages:
- common/*
- examples
- mockdata
+ - presets
+ - presets/packages/*
- packages/*
- tests/*
publicHoistPattern:
diff --git a/presets/package.json b/presets/package.json
new file mode 100644
index 0000000000..820753a009
--- /dev/null
+++ b/presets/package.json
@@ -0,0 +1,75 @@
+{
+ "name": "@univerjs/presets",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Build Univer apps faster and easier with pre-configured plugin collections.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "presets"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./lib/*": "./lib/*"
+ },
+ "main": "./src/index.ts",
+ "types": "./lib/types/index.d.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "typecheck": "tsc --noEmit",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types"
+ },
+ "dependencies": {
+ "@univerjs/core": "workspace:*",
+ "@univerjs/drawing": "workspace:*",
+ "@univerjs/engine-formula": "workspace:*",
+ "@univerjs/engine-render": "workspace:*",
+ "@univerjs/network": "workspace:*",
+ "@univerjs/protocol": "workspace:*",
+ "@univerjs/rpc": "workspace:*",
+ "@univerjs/telemetry": "workspace:*",
+ "@univerjs/themes": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@wendellhu/redi": "1.1.1",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-core/README.md b/presets/packages/preset-docs-core/README.md
new file mode 100644
index 0000000000..918ce6181e
--- /dev/null
+++ b/presets/packages/preset-docs-core/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-docs-core
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-docs-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-core)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-docs-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-core)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-docs-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-core)
+
+`@univerjs/preset-docs-core` provides a preset for core Univer Docs editing and UI features.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ---------------------------- | ---------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-docs-core` | `UniverDocsCorePreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-docs-core
+# or
+npm install @univerjs/preset-docs-core
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverDocsCorePreset } from '@univerjs/preset-docs-core';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverDocsCorePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-docs-core)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-docs-core/package.json b/presets/packages/preset-docs-core/package.json
new file mode 100644
index 0000000000..dfbdc977e9
--- /dev/null
+++ b/presets/packages/preset-docs-core/package.json
@@ -0,0 +1,89 @@
+{
+ "name": "@univerjs/preset-docs-core",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for core Univer Docs editing and UI features.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "docs",
+ "core"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "main": "./src/index.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/design": "workspace:*",
+ "@univerjs/docs": "workspace:*",
+ "@univerjs/docs-ui": "workspace:*",
+ "@univerjs/engine-formula": "workspace:*",
+ "@univerjs/engine-render": "workspace:*",
+ "@univerjs/network": "workspace:*",
+ "@univerjs/ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-core/postcss.config.mjs b/presets/packages/preset-docs-core/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-docs-core/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-docs-core/src/index.ts b/presets/packages/preset-docs-core/src/index.ts
new file mode 100644
index 0000000000..a3869265cd
--- /dev/null
+++ b/presets/packages/preset-docs-core/src/index.ts
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/design';
+export * from '@univerjs/docs';
+export * from '@univerjs/docs-ui';
+export * from '@univerjs/engine-formula';
+export * from '@univerjs/engine-render';
+export * from '@univerjs/network';
+export * from '@univerjs/ui';
diff --git a/presets/packages/preset-docs-core/src/types.ts b/presets/packages/preset-docs-core/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-docs-core/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-docs-core/src/umd.ts b/presets/packages/preset-docs-core/src/umd.ts
new file mode 100644
index 0000000000..7f538e771b
--- /dev/null
+++ b/presets/packages/preset-docs-core/src/umd.ts
@@ -0,0 +1,68 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverUIConfig } from '@univerjs/ui';
+import type { IPreset } from './types';
+import { UniverDocsPlugin } from '@univerjs/docs';
+import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
+import { UniverNetworkPlugin } from '@univerjs/network';
+import { UniverUIPlugin } from '@univerjs/ui';
+
+import '@univerjs/network/facade';
+import '@univerjs/docs-ui/facade';
+
+export type * from '@univerjs/docs-ui/facade';
+export type * from '@univerjs/network/facade';
+
+export interface IUniverDocsCorePresetConfig extends
+ Pick<IUniverUIConfig, 'container' | 'header' | 'footer' | 'toolbar' | 'ribbonType' | 'menu' | 'contextMenu' | 'disableAutoFocus'> {
+ collaboration?: true;
+}
+
+export function UniverDocsCorePreset(config: Partial<IUniverDocsCorePresetConfig> = {}): IPreset {
+ const {
+ container = 'app',
+ header,
+ footer,
+ toolbar,
+ ribbonType,
+ menu,
+ contextMenu,
+ disableAutoFocus,
+ } = config;
+
+ return {
+ plugins: [
+ UniverNetworkPlugin,
+ UniverDocsPlugin,
+ UniverRenderEnginePlugin as any,
+ [UniverUIPlugin, {
+ container,
+ header,
+ footer,
+ toolbar,
+ ribbonType,
+ menu,
+ contextMenu,
+ disableAutoFocus,
+ }],
+ UniverDocsUIPlugin,
+ UniverFormulaEnginePlugin,
+ ],
+ };
+}
diff --git a/presets/packages/preset-docs-core/tailwind.config.ts b/presets/packages/preset-docs-core/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-docs-core/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-core/tsconfig.json b/presets/packages/preset-docs-core/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-docs-core/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-docs-core/tsconfig.node.json b/presets/packages/preset-docs-core/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-docs-core/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-docs-core/univer-preset.config.mjs b/presets/packages/preset-docs-core/univer-preset.config.mjs
new file mode 100644
index 0000000000..344c9608ae
--- /dev/null
+++ b/presets/packages/preset-docs-core/univer-preset.config.mjs
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/design',
+ '@univerjs/ui',
+ '@univerjs/docs',
+ '@univerjs/docs-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-drawing/README.md b/presets/packages/preset-docs-drawing/README.md
new file mode 100644
index 0000000000..a0fa91af56
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-docs-drawing
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-docs-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-drawing)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-docs-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-drawing)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-docs-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-drawing)
+
+`@univerjs/preset-docs-drawing` provides a preset for drawing capabilities in Univer Docs.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------- | ------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-docs-drawing` | `UniverDocsDrawingPreset` | Yes | Yes | No |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-docs-drawing
+# or
+npm install @univerjs/preset-docs-drawing
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverDocsDrawingPreset } from '@univerjs/preset-docs-drawing';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverDocsDrawingPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-docs-drawing)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-docs-drawing/package.json b/presets/packages/preset-docs-drawing/package.json
new file mode 100644
index 0000000000..7aab9019f4
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "@univerjs/preset-docs-drawing",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for drawing capabilities in Univer Docs.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "docs",
+ "drawing"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs-drawing": "workspace:*",
+ "@univerjs/docs-drawing-ui": "workspace:*",
+ "@univerjs/drawing": "workspace:*",
+ "@univerjs/drawing-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-drawing/postcss.config.mjs b/presets/packages/preset-docs-drawing/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-docs-drawing/src/index.ts b/presets/packages/preset-docs-drawing/src/index.ts
new file mode 100644
index 0000000000..7c876ce2a1
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/src/index.ts
@@ -0,0 +1,22 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs-drawing';
+export * from '@univerjs/docs-drawing-ui';
+export * from '@univerjs/drawing';
+export * from '@univerjs/drawing-ui';
diff --git a/presets/packages/preset-docs-drawing/src/types.ts b/presets/packages/preset-docs-drawing/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-docs-drawing/src/umd.ts b/presets/packages/preset-docs-drawing/src/umd.ts
new file mode 100644
index 0000000000..6386ad1ad2
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/src/umd.ts
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { IImageIoService } from '@univerjs/core';
+import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing';
+import { UniverDocsDrawingUIPlugin } from '@univerjs/docs-drawing-ui';
+import { UniverDrawingPlugin } from '@univerjs/drawing';
+import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui';
+
+export interface IUniverDocsDrawingPresetConfig {
+ collaboration?: boolean;
+}
+
+export function UniverDocsDrawingPreset(config: Partial<IUniverDocsDrawingPresetConfig> = {}): IPreset {
+ const { collaboration = false } = config;
+
+ return {
+ plugins: [
+ [UniverDrawingPlugin, { override: collaboration ? [[IImageIoService, null]] : [] }],
+ UniverDrawingUIPlugin,
+ UniverDocsDrawingPlugin,
+ UniverDocsDrawingUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-docs-drawing/tailwind.config.ts b/presets/packages/preset-docs-drawing/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-drawing/tsconfig.json b/presets/packages/preset-docs-drawing/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-docs-drawing/tsconfig.node.json b/presets/packages/preset-docs-drawing/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-docs-drawing/univer-preset.config.mjs b/presets/packages/preset-docs-drawing/univer-preset.config.mjs
new file mode 100644
index 0000000000..aae9b26fec
--- /dev/null
+++ b/presets/packages/preset-docs-drawing/univer-preset.config.mjs
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/drawing-ui',
+ '@univerjs/docs-drawing',
+ '@univerjs/docs-drawing-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-hyper-link/README.md b/presets/packages/preset-docs-hyper-link/README.md
new file mode 100644
index 0000000000..6634fa4778
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-docs-hyper-link
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-docs-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-hyper-link)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-docs-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-hyper-link)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-docs-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-hyper-link)
+
+`@univerjs/preset-docs-hyper-link` provides a preset for hyperlink support in Univer Docs.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ---------------------------------- | --------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-docs-hyper-link` | `UniverDocsHyperLinkPreset` | Yes | Yes | No |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-docs-hyper-link
+# or
+npm install @univerjs/preset-docs-hyper-link
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverDocsHyperLinkPreset } from '@univerjs/preset-docs-hyper-link';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverDocsHyperLinkPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-docs-hyper-link)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-docs-hyper-link/package.json b/presets/packages/preset-docs-hyper-link/package.json
new file mode 100644
index 0000000000..784fe81911
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-docs-hyper-link",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for hyperlink support in Univer Docs.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "docs",
+ "hyperlink"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs-hyper-link": "workspace:*",
+ "@univerjs/docs-hyper-link-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-hyper-link/postcss.config.mjs b/presets/packages/preset-docs-hyper-link/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-docs-hyper-link/src/index.ts b/presets/packages/preset-docs-hyper-link/src/index.ts
new file mode 100644
index 0000000000..42a2377746
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs-hyper-link';
+export * from '@univerjs/docs-hyper-link-ui';
diff --git a/presets/packages/preset-docs-hyper-link/src/types.ts b/presets/packages/preset-docs-hyper-link/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-docs-hyper-link/src/umd.ts b/presets/packages/preset-docs-hyper-link/src/umd.ts
new file mode 100644
index 0000000000..a697a79905
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/src/umd.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { UniverDocsHyperLinkPlugin } from '@univerjs/docs-hyper-link';
+import { UniverDocsHyperLinkUIPlugin } from '@univerjs/docs-hyper-link-ui';
+
+export function UniverDocsHyperLinkPreset(): IPreset {
+ return {
+ plugins: [
+ UniverDocsHyperLinkPlugin,
+ UniverDocsHyperLinkUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-docs-hyper-link/tailwind.config.ts b/presets/packages/preset-docs-hyper-link/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-hyper-link/tsconfig.json b/presets/packages/preset-docs-hyper-link/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-docs-hyper-link/tsconfig.node.json b/presets/packages/preset-docs-hyper-link/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-docs-hyper-link/univer-preset.config.mjs b/presets/packages/preset-docs-hyper-link/univer-preset.config.mjs
new file mode 100644
index 0000000000..8e982a22f8
--- /dev/null
+++ b/presets/packages/preset-docs-hyper-link/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/docs-hyper-link',
+ '@univerjs/docs-hyper-link-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-node-core/README.md b/presets/packages/preset-docs-node-core/README.md
new file mode 100644
index 0000000000..7f15d561ab
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-docs-node-core
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-docs-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-node-core)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-docs-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-node-core)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-docs-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-node-core)
+
+`@univerjs/preset-docs-node-core` provides a preset for running Univer Docs on Node.js with core features.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| --------------------------------- | -------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-docs-node-core` | `UniverDocsNodeCorePreset` | No | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-docs-node-core
+# or
+npm install @univerjs/preset-docs-node-core
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverDocsNodeCorePreset } from '@univerjs/preset-docs-node-core';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverDocsNodeCorePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-docs-node-core)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-docs-node-core/package.json b/presets/packages/preset-docs-node-core/package.json
new file mode 100644
index 0000000000..e993efbb41
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/package.json
@@ -0,0 +1,85 @@
+{
+ "name": "@univerjs/preset-docs-node-core",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for running Univer Docs on Node.js with core features.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "docs",
+ "node",
+ "core"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs": "workspace:*",
+ "@univerjs/docs-drawing": "workspace:*",
+ "@univerjs/docs-hyper-link": "workspace:*",
+ "@univerjs/engine-formula": "workspace:*",
+ "@univerjs/rpc-node": "workspace:*",
+ "@univerjs/thread-comment": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-node-core/postcss.config.mjs b/presets/packages/preset-docs-node-core/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-docs-node-core/src/index.ts b/presets/packages/preset-docs-node-core/src/index.ts
new file mode 100644
index 0000000000..6fb58e9fbd
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/src/index.ts
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs';
+export * from '@univerjs/docs-drawing';
+export * from '@univerjs/docs-hyper-link';
+export * from '@univerjs/engine-formula';
+export * from '@univerjs/rpc-node';
+export * from '@univerjs/thread-comment';
diff --git a/presets/packages/preset-docs-node-core/src/types.ts b/presets/packages/preset-docs-node-core/src/types.ts
new file mode 100644
index 0000000000..4cc75182fd
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/src/types.ts
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+import type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
+
+export interface IUniverFormulaConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'> {
+}
+
+export interface IUniverFormulaWorkerConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'> {
+}
diff --git a/presets/packages/preset-docs-node-core/src/umd.ts b/presets/packages/preset-docs-node-core/src/umd.ts
new file mode 100644
index 0000000000..8d597af3fd
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/src/umd.ts
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset, IUniverFormulaConfig } from './types';
+import { UniverDocsPlugin } from '@univerjs/docs';
+import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing';
+import { UniverDocsHyperLinkPlugin } from '@univerjs/docs-hyper-link';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+// import { UniverRPCNodeMainPlugin } from '@univerjs/rpc-node';
+import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';
+
+import '@univerjs/engine-formula/facade';
+
+export type * from '@univerjs/engine-formula/facade';
+
+export interface IUniverDocsNodeCorePresetConfig {
+ /**
+ * The formula configuration.
+ */
+ formula?: IUniverFormulaConfig;
+}
+
+export function UniverDocsNodeCorePreset(config: Partial<IUniverDocsNodeCorePresetConfig> = {}): IPreset {
+ const { formula } = config;
+
+ return {
+ plugins: [
+ // useWorker
+ // ? [UniverRPCNodeMainPlugin, { workerSrc }]
+ // : null,
+ [UniverFormulaEnginePlugin, {
+ // notExecuteFormula: useWorker,
+ function: formula?.function,
+ }],
+
+ UniverThreadCommentPlugin,
+ UniverDocsPlugin,
+
+ UniverDocsHyperLinkPlugin,
+ UniverDocsDrawingPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+}
diff --git a/presets/packages/preset-docs-node-core/tailwind.config.ts b/presets/packages/preset-docs-node-core/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-node-core/tsconfig.json b/presets/packages/preset-docs-node-core/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-docs-node-core/tsconfig.node.json b/presets/packages/preset-docs-node-core/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-docs-node-core/univer-preset.config.mjs b/presets/packages/preset-docs-node-core/univer-preset.config.mjs
new file mode 100644
index 0000000000..9f117a86c3
--- /dev/null
+++ b/presets/packages/preset-docs-node-core/univer-preset.config.mjs
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/docs',
+ '@univerjs/rpc-node',
+ '@univerjs/docs-hyper-link',
+ '@univerjs/thread-comment',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-thread-comment/README.md b/presets/packages/preset-docs-thread-comment/README.md
new file mode 100644
index 0000000000..ce8f80aa06
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-docs-thread-comment
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-docs-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-thread-comment)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-docs-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-thread-comment)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-docs-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-docs-thread-comment)
+
+`@univerjs/preset-docs-thread-comment` provides a preset for thread comments in Univer Docs.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| -------------------------------------- | ------------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-docs-thread-comment` | `UniverDocsThreadCommentPreset` | Yes | Yes | No |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-docs-thread-comment
+# or
+npm install @univerjs/preset-docs-thread-comment
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverDocsThreadCommentPreset } from '@univerjs/preset-docs-thread-comment';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverDocsThreadCommentPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-docs-thread-comment)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-docs-thread-comment/package.json b/presets/packages/preset-docs-thread-comment/package.json
new file mode 100644
index 0000000000..287564a5a8
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/package.json
@@ -0,0 +1,85 @@
+{
+ "name": "@univerjs/preset-docs-thread-comment",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for thread comments in Univer Docs.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "docs",
+ "thread-comment"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs-thread-comment-ui": "workspace:*",
+ "@univerjs/thread-comment": "workspace:*",
+ "@univerjs/thread-comment-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-docs-thread-comment/postcss.config.mjs b/presets/packages/preset-docs-thread-comment/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-docs-thread-comment/src/index.ts b/presets/packages/preset-docs-thread-comment/src/index.ts
new file mode 100644
index 0000000000..6f272b5431
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs-thread-comment-ui';
+export * from '@univerjs/thread-comment-ui';
diff --git a/presets/packages/preset-docs-thread-comment/src/types.ts b/presets/packages/preset-docs-thread-comment/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-docs-thread-comment/src/umd.ts b/presets/packages/preset-docs-thread-comment/src/umd.ts
new file mode 100644
index 0000000000..cf140583d9
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/src/umd.ts
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+import { UniverDocsThreadCommentUIPlugin } from '@univerjs/docs-thread-comment-ui';
+import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
+
+export interface IUniverDocsThreadCommentPresetConfig {
+}
+
+/**
+ * This preset add thread comment features into your application.
+ *
+ * @param {Partial<IUniverDocsThreadCommentPresetConfig>} config - The configuration object.
+ */
+export function UniverDocsThreadCommentPreset(_config: Partial<IUniverDocsThreadCommentPresetConfig> = {}): IPreset {
+ const plugins: IPreset['plugins'] = [
+ UniverThreadCommentUIPlugin,
+ UniverDocsThreadCommentUIPlugin,
+ ];
+
+ return { plugins };
+}
diff --git a/presets/packages/preset-docs-thread-comment/tailwind.config.ts b/presets/packages/preset-docs-thread-comment/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-docs-thread-comment/tsconfig.json b/presets/packages/preset-docs-thread-comment/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-docs-thread-comment/tsconfig.node.json b/presets/packages/preset-docs-thread-comment/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-docs-thread-comment/univer-preset.config.mjs b/presets/packages/preset-docs-thread-comment/univer-preset.config.mjs
new file mode 100644
index 0000000000..090705b97d
--- /dev/null
+++ b/presets/packages/preset-docs-thread-comment/univer-preset.config.mjs
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/thread-comment',
+ '@univerjs/thread-comment-ui',
+ '@univerjs/docs-thread-comment-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-conditional-formatting/README.md b/presets/packages/preset-sheets-conditional-formatting/README.md
new file mode 100644
index 0000000000..97a36b0a16
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-conditional-formatting
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-conditional-formatting?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-conditional-formatting)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-conditional-formatting?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-conditional-formatting)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-conditional-formatting?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-conditional-formatting)
+
+`@univerjs/preset-sheets-conditional-formatting` provides a preset for conditional formatting in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------------------------ | ----------------------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-conditional-formatting` | `UniverSheetsConditionalFormattingPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-conditional-formatting
+# or
+npm install @univerjs/preset-sheets-conditional-formatting
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsConditionalFormattingPreset } from '@univerjs/preset-sheets-conditional-formatting';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsConditionalFormattingPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-conditional-formatting)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-conditional-formatting/package.json b/presets/packages/preset-sheets-conditional-formatting/package.json
new file mode 100644
index 0000000000..0d3a955ce6
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-conditional-formatting",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for conditional formatting in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "conditional-formatting"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-conditional-formatting": "workspace:*",
+ "@univerjs/sheets-conditional-formatting-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-conditional-formatting/postcss.config.mjs b/presets/packages/preset-sheets-conditional-formatting/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-conditional-formatting/src/index.ts b/presets/packages/preset-sheets-conditional-formatting/src/index.ts
new file mode 100644
index 0000000000..5f2f0313e5
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-conditional-formatting';
+export * from '@univerjs/sheets-conditional-formatting-ui';
diff --git a/presets/packages/preset-sheets-conditional-formatting/src/types.ts b/presets/packages/preset-sheets-conditional-formatting/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-conditional-formatting/src/umd.ts b/presets/packages/preset-sheets-conditional-formatting/src/umd.ts
new file mode 100644
index 0000000000..883cdc26d4
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/src/umd.ts
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
+import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
+
+import '@univerjs/sheets-conditional-formatting/facade';
+
+export type * from '@univerjs/sheets-conditional-formatting/facade';
+
+export function UniverSheetsConditionalFormattingPreset(): IPreset {
+ return {
+ plugins: [
+ UniverSheetsConditionalFormattingPlugin,
+ UniverSheetsConditionalFormattingUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-conditional-formatting/tailwind.config.ts b/presets/packages/preset-sheets-conditional-formatting/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-conditional-formatting/tsconfig.json b/presets/packages/preset-sheets-conditional-formatting/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-conditional-formatting/tsconfig.node.json b/presets/packages/preset-sheets-conditional-formatting/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-conditional-formatting/univer-preset.config.mjs b/presets/packages/preset-sheets-conditional-formatting/univer-preset.config.mjs
new file mode 100644
index 0000000000..6c74c983fd
--- /dev/null
+++ b/presets/packages/preset-sheets-conditional-formatting/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-conditional-formatting',
+ '@univerjs/sheets-conditional-formatting-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-core/README.md b/presets/packages/preset-sheets-core/README.md
new file mode 100644
index 0000000000..0e441b92f1
--- /dev/null
+++ b/presets/packages/preset-sheets-core/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-core
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-core)
+
+`@univerjs/preset-sheets-core` provides a preset for core Univer Sheets spreadsheet features.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------ | ------------------------ | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-core` | `UniverSheetsCorePreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-core
+# or
+npm install @univerjs/preset-sheets-core
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsCorePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-core)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-core/package.json b/presets/packages/preset-sheets-core/package.json
new file mode 100644
index 0000000000..8359a0cc8c
--- /dev/null
+++ b/presets/packages/preset-sheets-core/package.json
@@ -0,0 +1,102 @@
+{
+ "name": "@univerjs/preset-sheets-core",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for core Univer Sheets spreadsheet features.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "core"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./worker": "./src/worker.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./worker": {
+ "import": "./lib/es/worker.js",
+ "require": "./lib/cjs/worker.js",
+ "types": "./lib/types/worker.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/design": "workspace:*",
+ "@univerjs/docs": "workspace:*",
+ "@univerjs/docs-ui": "workspace:*",
+ "@univerjs/engine-formula": "workspace:*",
+ "@univerjs/engine-render": "workspace:*",
+ "@univerjs/network": "workspace:*",
+ "@univerjs/rpc": "workspace:*",
+ "@univerjs/sheets": "workspace:*",
+ "@univerjs/sheets-formula": "workspace:*",
+ "@univerjs/sheets-formula-ui": "workspace:*",
+ "@univerjs/sheets-numfmt": "workspace:*",
+ "@univerjs/sheets-numfmt-ui": "workspace:*",
+ "@univerjs/sheets-ui": "workspace:*",
+ "@univerjs/ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-core/postcss.config.mjs b/presets/packages/preset-sheets-core/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-core/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-core/src/index.ts b/presets/packages/preset-sheets-core/src/index.ts
new file mode 100644
index 0000000000..5830683522
--- /dev/null
+++ b/presets/packages/preset-sheets-core/src/index.ts
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/design';
+export * from '@univerjs/docs';
+export * from '@univerjs/docs-ui';
+export * from '@univerjs/engine-formula';
+export * from '@univerjs/engine-render';
+export * from '@univerjs/network';
+export * from '@univerjs/rpc';
+export * from '@univerjs/sheets';
+export * from '@univerjs/sheets-formula';
+export * from '@univerjs/sheets-formula-ui';
+export * from '@univerjs/sheets-numfmt';
+export * from '@univerjs/sheets-numfmt-ui';
+export * from '@univerjs/sheets-ui';
+export * from '@univerjs/ui';
diff --git a/presets/packages/preset-sheets-core/src/types.ts b/presets/packages/preset-sheets-core/src/types.ts
new file mode 100644
index 0000000000..1ce72d4c0d
--- /dev/null
+++ b/presets/packages/preset-sheets-core/src/types.ts
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+import type { IUniverDocsConfig } from '@univerjs/docs';
+import type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
+import type { IUniverSheetsConfig } from '@univerjs/sheets';
+import type { IUniverSheetsFormulaBaseConfig } from '@univerjs/sheets-formula';
+import type { IUniverSheetsFormulaUIConfig } from '@univerjs/sheets-formula-ui';
+import type { IUniverSheetsUIConfig } from '@univerjs/sheets-ui';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
+
+export interface IUniverFormulaConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'>,
+ Pick<IUniverSheetsFormulaBaseConfig, 'description' | 'initialFormulaComputing'>,
+ Pick<IUniverSheetsFormulaUIConfig, 'functionScreenTips'> {
+}
+
+export interface IUniverFormulaWorkerConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'> {
+}
+
+export interface IUniverDocsPresetConfig extends
+ IUniverDocsConfig {
+}
+
+export interface IUniverSheetsPresetConfig extends
+ Pick<IUniverSheetsConfig, 'isRowStylePrecedeColumnStyle' | 'autoHeightForMergedCells' | 'freezeSync'>,
+ Pick<IUniverSheetsUIConfig, 'maxAutoHeightCount' | 'clipboardConfig' | 'scrollConfig' | 'protectedRangeShadow' | 'protectedRangeUserSelector' | 'disableForceStringAlert' | 'disableForceStringMark'> {
+}
diff --git a/presets/packages/preset-sheets-core/src/umd.ts b/presets/packages/preset-sheets-core/src/umd.ts
new file mode 100644
index 0000000000..a64de87627
--- /dev/null
+++ b/presets/packages/preset-sheets-core/src/umd.ts
@@ -0,0 +1,166 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
+import type { IUniverSheetsNumfmtConfig } from '@univerjs/sheets-numfmt';
+import type { IUniverSheetsUIConfig } from '@univerjs/sheets-ui';
+import type { IUniverUIConfig } from '@univerjs/ui';
+import type { IPreset, IUniverDocsPresetConfig, IUniverFormulaConfig, IUniverSheetsPresetConfig } from './types';
+import { UniverDocsPlugin } from '@univerjs/docs';
+import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
+import { UniverNetworkPlugin } from '@univerjs/network';
+import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
+import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
+import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';
+import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
+import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';
+import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
+import { UniverUIPlugin } from '@univerjs/ui';
+
+// NOTE: here we copy code from everything.ts. That file (along with the package itself) would be removed in the future.
+import '@univerjs/network/facade';
+import '@univerjs/sheets/facade';
+import '@univerjs/ui/facade';
+import '@univerjs/docs-ui/facade';
+import '@univerjs/sheets-ui/facade';
+import '@univerjs/engine-formula/facade';
+import '@univerjs/sheets-formula/facade';
+import '@univerjs/sheets-numfmt/facade';
+import '@univerjs/sheets-formula-ui/facade';
+
+export type * from '@univerjs/docs-ui/facade';
+export type * from '@univerjs/engine-formula/facade';
+export type * from '@univerjs/network/facade';
+export type * from '@univerjs/sheets-formula-ui/facade';
+export type * from '@univerjs/sheets-formula/facade';
+export type * from '@univerjs/sheets-numfmt/facade';
+export type * from '@univerjs/sheets-ui/facade';
+export type * from '@univerjs/sheets/facade';
+export type * from '@univerjs/ui/facade';
+
+export interface IUniverSheetsCorePresetConfig extends
+ Pick<IUniverUIConfig, 'container' | 'header' | 'toolbar' | 'ribbonType' | 'menu' | 'contextMenu' | 'disableAutoFocus' | 'customFontFamily'>,
+ Pick<IUniverSheetsUIConfig, 'formulaBar' | 'statusBarStatistic' | 'footer'>,
+ IUniverSheetsNumfmtConfig {
+
+ /**
+ * The docs related configuration.
+ */
+ docs?: IUniverDocsPresetConfig;
+
+ /**
+ * The sheets related configuration.
+ */
+ sheets?: IUniverSheetsPresetConfig;
+
+ /**
+ * The formula related configuration.
+ */
+ formula?: IUniverFormulaConfig;
+
+ /**
+ * The URL of the worker script.
+ */
+ workerURL: IUniverRPCMainThreadConfig['workerURL'];
+}
+
+/**
+ * This presets helps you to create a Univer sheet with open sourced features.
+ */
+export function UniverSheetsCorePreset(config: Partial<IUniverSheetsCorePresetConfig> = {}): IPreset {
+ const {
+ container = 'app',
+ workerURL: workerSrc,
+ header,
+ footer,
+ toolbar,
+ ribbonType,
+ formulaBar,
+ menu,
+ contextMenu,
+ disableAutoFocus,
+ customFontFamily,
+ docs,
+ sheets,
+ formula,
+ disableTextFormatAlert,
+ disableTextFormatMark,
+ } = config;
+
+ const useWorker = !!workerSrc;
+
+ return {
+ plugins: [
+ UniverNetworkPlugin,
+ [UniverDocsPlugin, {
+ hasScroll: docs?.hasScroll,
+ }],
+ UniverRenderEnginePlugin,
+ [UniverUIPlugin, {
+ container,
+ header,
+ toolbar,
+ ribbonType,
+ menu,
+ contextMenu,
+ disableAutoFocus,
+ customFontFamily,
+ }],
+ UniverDocsUIPlugin,
+ useWorker
+ ? [UniverRPCMainThreadPlugin, { workerURL: workerSrc }]
+ : null,
+ [UniverFormulaEnginePlugin, {
+ notExecuteFormula: useWorker,
+ function: formula?.function,
+ }],
+ [UniverSheetsPlugin, {
+ notExecuteFormula: useWorker,
+ onlyRegisterFormulaRelatedMutations: false,
+ isRowStylePrecedeColumnStyle: sheets?.isRowStylePrecedeColumnStyle,
+ autoHeightForMergedCells: sheets?.autoHeightForMergedCells,
+ freezeSync: sheets?.freezeSync,
+ }],
+ [UniverSheetsUIPlugin, {
+ formulaBar,
+ footer,
+ maxAutoHeightCount: sheets?.maxAutoHeightCount,
+ clipboardConfig: sheets?.clipboardConfig,
+ scrollConfig: sheets?.scrollConfig,
+ protectedRangeShadow: sheets?.protectedRangeShadow ?? true,
+ protectedRangeUserSelector: sheets?.protectedRangeUserSelector,
+ disableForceStringAlert: sheets?.disableForceStringAlert,
+ disableForceStringMark: sheets?.disableForceStringMark,
+ }],
+ [UniverSheetsNumfmtPlugin, {
+ disableTextFormatAlert,
+ disableTextFormatMark,
+ }],
+ UniverSheetsNumfmtUIPlugin,
+ [UniverSheetsFormulaPlugin, {
+ notExecuteFormula: useWorker,
+ description: formula?.description,
+ initialFormulaComputing: formula?.initialFormulaComputing,
+ }],
+ [UniverSheetsFormulaUIPlugin, {
+ functionScreenTips: formula?.functionScreenTips,
+ }],
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-core/src/worker.ts b/presets/packages/preset-sheets-core/src/worker.ts
new file mode 100644
index 0000000000..1e05815433
--- /dev/null
+++ b/presets/packages/preset-sheets-core/src/worker.ts
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset, IUniverFormulaWorkerConfig } from './types';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc';
+import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { UniverRemoteSheetsFormulaPlugin } from '@univerjs/sheets-formula';
+
+export interface IUniverSheetsCoreWorkerPresetConfig {
+ /**
+ * The formula worker config.
+ */
+ formula?: IUniverFormulaWorkerConfig;
+}
+
+export function UniverSheetsCoreWorkerPreset(config: Partial<IUniverSheetsCoreWorkerPresetConfig> = {}): IPreset {
+ const {
+ formula,
+ } = config;
+ return {
+ plugins: [
+ [UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true }],
+ [UniverFormulaEnginePlugin, { function: formula?.function }],
+ UniverRPCWorkerThreadPlugin,
+ UniverRemoteSheetsFormulaPlugin,
+ ],
+ };
+}
diff --git a/presets/packages/preset-sheets-core/tailwind.config.ts b/presets/packages/preset-sheets-core/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-core/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-core/tsconfig.json b/presets/packages/preset-sheets-core/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-core/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-core/tsconfig.node.json b/presets/packages/preset-sheets-core/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-core/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-core/univer-preset.config.mjs b/presets/packages/preset-sheets-core/univer-preset.config.mjs
new file mode 100644
index 0000000000..3b46622cd2
--- /dev/null
+++ b/presets/packages/preset-sheets-core/univer-preset.config.mjs
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/design',
+ '@univerjs/ui',
+ '@univerjs/docs',
+ '@univerjs/docs-ui',
+ '@univerjs/sheets',
+ '@univerjs/sheets-ui',
+ '@univerjs/sheets-formula',
+ '@univerjs/sheets-formula-ui',
+ '@univerjs/sheets-numfmt',
+ '@univerjs/sheets-numfmt-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-data-validation/README.md b/presets/packages/preset-sheets-data-validation/README.md
new file mode 100644
index 0000000000..f8dd8fccb8
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-data-validation
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-data-validation)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-data-validation)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-data-validation?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-data-validation)
+
+`@univerjs/preset-sheets-data-validation` provides a preset for data validation in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ----------------------------------------- | ---------------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-data-validation` | `UniverSheetsDataValidationPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-data-validation
+# or
+npm install @univerjs/preset-sheets-data-validation
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsDataValidationPreset } from '@univerjs/preset-sheets-data-validation';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsDataValidationPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-data-validation)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-data-validation/package.json b/presets/packages/preset-sheets-data-validation/package.json
new file mode 100644
index 0000000000..bdda86213c
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/package.json
@@ -0,0 +1,85 @@
+{
+ "name": "@univerjs/preset-sheets-data-validation",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for data validation in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "data-validation"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/data-validation": "workspace:*",
+ "@univerjs/sheets-data-validation": "workspace:*",
+ "@univerjs/sheets-data-validation-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-data-validation/postcss.config.mjs b/presets/packages/preset-sheets-data-validation/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-data-validation/src/index.ts b/presets/packages/preset-sheets-data-validation/src/index.ts
new file mode 100644
index 0000000000..d80cf2641b
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/src/index.ts
@@ -0,0 +1,21 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/data-validation';
+export * from '@univerjs/sheets-data-validation';
+export * from '@univerjs/sheets-data-validation-ui';
diff --git a/presets/packages/preset-sheets-data-validation/src/types.ts b/presets/packages/preset-sheets-data-validation/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-data-validation/src/umd.ts b/presets/packages/preset-sheets-data-validation/src/umd.ts
new file mode 100644
index 0000000000..46c9aa845b
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/src/umd.ts
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverSheetsDataValidationUIConfig } from '@univerjs/sheets-data-validation-ui';
+import type { IPreset } from './types';
+import { UniverDataValidationPlugin } from '@univerjs/data-validation';
+import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
+import { UniverSheetsDataValidationUIPlugin } from '@univerjs/sheets-data-validation-ui';
+
+import '@univerjs/sheets-data-validation/facade';
+
+export type * from '@univerjs/sheets-data-validation/facade';
+
+export interface IUniverSheetsDataValidationPresetConfig extends
+ Pick<IUniverSheetsDataValidationUIConfig, 'showEditOnDropdown' | 'showSearchOnDropdown'> {
+}
+
+export function UniverSheetsDataValidationPreset(config: Partial<IUniverSheetsDataValidationPresetConfig> = {}): IPreset {
+ const { showEditOnDropdown, showSearchOnDropdown } = config;
+
+ return {
+ plugins: [
+ UniverDataValidationPlugin,
+ UniverSheetsDataValidationPlugin,
+ [UniverSheetsDataValidationUIPlugin, {
+ showEditOnDropdown,
+ showSearchOnDropdown,
+ }],
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-data-validation/tailwind.config.ts b/presets/packages/preset-sheets-data-validation/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-data-validation/tsconfig.json b/presets/packages/preset-sheets-data-validation/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-data-validation/tsconfig.node.json b/presets/packages/preset-sheets-data-validation/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-data-validation/univer-preset.config.mjs b/presets/packages/preset-sheets-data-validation/univer-preset.config.mjs
new file mode 100644
index 0000000000..57b799d903
--- /dev/null
+++ b/presets/packages/preset-sheets-data-validation/univer-preset.config.mjs
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/data-validation',
+ '@univerjs/sheets-data-validation',
+ '@univerjs/sheets-data-validation-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-drawing/README.md b/presets/packages/preset-sheets-drawing/README.md
new file mode 100644
index 0000000000..e12fed9cdf
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-drawing
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-drawing)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-drawing)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-drawing?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-drawing)
+
+`@univerjs/preset-sheets-drawing` provides a preset for drawing capabilities in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| --------------------------------- | --------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-drawing` | `UniverSheetsDrawingPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-drawing
+# or
+npm install @univerjs/preset-sheets-drawing
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsDrawingPreset } from '@univerjs/preset-sheets-drawing';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsDrawingPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-drawing)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-drawing/package.json b/presets/packages/preset-sheets-drawing/package.json
new file mode 100644
index 0000000000..187a79b5c8
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/package.json
@@ -0,0 +1,87 @@
+{
+ "name": "@univerjs/preset-sheets-drawing",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for drawing capabilities in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "drawing"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs-drawing": "workspace:*",
+ "@univerjs/drawing": "workspace:*",
+ "@univerjs/drawing-ui": "workspace:*",
+ "@univerjs/sheets-drawing": "workspace:*",
+ "@univerjs/sheets-drawing-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-drawing/postcss.config.mjs b/presets/packages/preset-sheets-drawing/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-drawing/src/index.ts b/presets/packages/preset-sheets-drawing/src/index.ts
new file mode 100644
index 0000000000..a5749811cd
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/src/index.ts
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs-drawing';
+export * from '@univerjs/drawing';
+export * from '@univerjs/drawing-ui';
+export * from '@univerjs/sheets-drawing';
+export * from '@univerjs/sheets-drawing-ui';
diff --git a/presets/packages/preset-sheets-drawing/src/types.ts b/presets/packages/preset-sheets-drawing/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-drawing/src/umd.ts b/presets/packages/preset-sheets-drawing/src/umd.ts
new file mode 100644
index 0000000000..f93a00e25a
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/src/umd.ts
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverDrawingConfig } from '@univerjs/drawing';
+import type { IPreset } from './types';
+import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing';
+import { IImageIoService, UniverDrawingPlugin } from '@univerjs/drawing';
+import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui';
+import { UniverSheetsDrawingPlugin } from '@univerjs/sheets-drawing';
+import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
+
+import '@univerjs/sheets-drawing/facade';
+import '@univerjs/sheets-drawing-ui/facade';
+
+export type * from '@univerjs/sheets-drawing-ui/facade';
+export type * from '@univerjs/sheets-drawing/facade';
+
+export interface IUniverSheetsDrawingPresetConfig extends Pick<IUniverDrawingConfig, 'allowImageSize'> {
+ collaboration?: boolean;
+}
+
+export function UniverSheetsDrawingPreset(config: Partial<IUniverSheetsDrawingPresetConfig> = {}): IPreset {
+ const { collaboration = false, allowImageSize } = config;
+
+ return {
+ plugins: [
+ [UniverDrawingPlugin, {
+ override: collaboration ? [[IImageIoService, null]] : [],
+ allowImageSize,
+ }],
+ UniverDocsDrawingPlugin,
+ UniverDrawingUIPlugin,
+ UniverSheetsDrawingPlugin,
+ UniverSheetsDrawingUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-drawing/tailwind.config.ts b/presets/packages/preset-sheets-drawing/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-drawing/tsconfig.json b/presets/packages/preset-sheets-drawing/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-drawing/tsconfig.node.json b/presets/packages/preset-sheets-drawing/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-drawing/univer-preset.config.mjs b/presets/packages/preset-sheets-drawing/univer-preset.config.mjs
new file mode 100644
index 0000000000..9fc21ad637
--- /dev/null
+++ b/presets/packages/preset-sheets-drawing/univer-preset.config.mjs
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/docs-drawing',
+ '@univerjs/drawing-ui',
+ '@univerjs/sheets-drawing',
+ '@univerjs/sheets-drawing-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-filter/README.md b/presets/packages/preset-sheets-filter/README.md
new file mode 100644
index 0000000000..76ab233e5a
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-filter
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-filter?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-filter)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-filter?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-filter)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-filter?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-filter)
+
+`@univerjs/preset-sheets-filter` provides a preset for filter functionality in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| -------------------------------- | -------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-filter` | `UniverSheetsFilterPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-filter
+# or
+npm install @univerjs/preset-sheets-filter
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsFilterPreset } from '@univerjs/preset-sheets-filter';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsFilterPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-filter)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-filter/package.json b/presets/packages/preset-sheets-filter/package.json
new file mode 100644
index 0000000000..5beda21224
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/package.json
@@ -0,0 +1,90 @@
+{
+ "name": "@univerjs/preset-sheets-filter",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for filter functionality in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "filter"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./worker": "./src/worker.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "main": "./src/index.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./worker": {
+ "import": "./lib/es/worker.js",
+ "require": "./lib/cjs/worker.js",
+ "types": "./lib/types/worker.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-filter": "workspace:*",
+ "@univerjs/sheets-filter-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-filter/postcss.config.mjs b/presets/packages/preset-sheets-filter/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-filter/src/index.ts b/presets/packages/preset-sheets-filter/src/index.ts
new file mode 100644
index 0000000000..5c960eb96a
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-filter';
+export * from '@univerjs/sheets-filter-ui';
diff --git a/presets/packages/preset-sheets-filter/src/types.ts b/presets/packages/preset-sheets-filter/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-filter/src/umd.ts b/presets/packages/preset-sheets-filter/src/umd.ts
new file mode 100644
index 0000000000..33b0918a6c
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/src/umd.ts
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverSheetsFilterConfig } from '@univerjs/sheets-filter';
+import type { IPreset } from './types';
+import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
+import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
+
+import '@univerjs/sheets-filter/facade';
+
+export type * from '@univerjs/sheets-filter/facade';
+
+export interface IUniverSheetsFilterPresetConfig extends IUniverSheetsFilterConfig {
+
+}
+
+export function UniverSheetsFilterPreset(config: Partial<IUniverSheetsFilterPresetConfig> = {}): IPreset {
+ const { enableSyncSwitch } = config;
+
+ return {
+ plugins: [
+ [UniverSheetsFilterPlugin, { enableSyncSwitch }],
+ UniverSheetsFilterUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-filter/src/worker.ts b/presets/packages/preset-sheets-filter/src/worker.ts
new file mode 100644
index 0000000000..5c87750db5
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/src/worker.ts
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
+
+export function UniverSheetsFilterWorkerPreset(): IPreset {
+ return {
+ plugins: [
+ UniverSheetsFilterPlugin,
+ ],
+ };
+};
diff --git a/presets/packages/preset-sheets-filter/tailwind.config.ts b/presets/packages/preset-sheets-filter/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-filter/tsconfig.json b/presets/packages/preset-sheets-filter/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-filter/tsconfig.node.json b/presets/packages/preset-sheets-filter/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-filter/univer-preset.config.mjs b/presets/packages/preset-sheets-filter/univer-preset.config.mjs
new file mode 100644
index 0000000000..f6759c3722
--- /dev/null
+++ b/presets/packages/preset-sheets-filter/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-filter',
+ '@univerjs/sheets-filter-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-find-replace/README.md b/presets/packages/preset-sheets-find-replace/README.md
new file mode 100644
index 0000000000..d84ed3425a
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-find-replace
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-find-replace)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-find-replace)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-find-replace)
+
+`@univerjs/preset-sheets-find-replace` provides a preset for find and replace capabilities in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| -------------------------------------- | ------------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-find-replace` | `UniverSheetsFindReplacePreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-find-replace
+# or
+npm install @univerjs/preset-sheets-find-replace
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsFindReplacePreset } from '@univerjs/preset-sheets-find-replace';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsFindReplacePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-find-replace)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-find-replace/package.json b/presets/packages/preset-sheets-find-replace/package.json
new file mode 100644
index 0000000000..e4c2064070
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-find-replace",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for find and replace capabilities in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "find-replace"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/find-replace": "workspace:*",
+ "@univerjs/sheets-find-replace": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-find-replace/postcss.config.mjs b/presets/packages/preset-sheets-find-replace/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-find-replace/src/index.ts b/presets/packages/preset-sheets-find-replace/src/index.ts
new file mode 100644
index 0000000000..ea60b81f00
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/find-replace';
+export * from '@univerjs/sheets-find-replace';
diff --git a/presets/packages/preset-sheets-find-replace/src/types.ts b/presets/packages/preset-sheets-find-replace/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-find-replace/src/umd.ts b/presets/packages/preset-sheets-find-replace/src/umd.ts
new file mode 100644
index 0000000000..f63e21954c
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/src/umd.ts
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+import { UniverFindReplacePlugin } from '@univerjs/find-replace';
+import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
+
+import '@univerjs/sheets-find-replace/facade';
+
+export type * from '@univerjs/sheets-find-replace/facade';
+
+export interface IUniverSheetsFindReplacePresetConfig {}
+
+export function UniverSheetsFindReplacePreset(_config: Partial<IUniverSheetsFindReplacePresetConfig> = {}): IPreset {
+ return {
+ plugins: [
+ [UniverFindReplacePlugin],
+ [UniverSheetsFindReplacePlugin],
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+}
diff --git a/presets/packages/preset-sheets-find-replace/tailwind.config.ts b/presets/packages/preset-sheets-find-replace/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-find-replace/tsconfig.json b/presets/packages/preset-sheets-find-replace/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-find-replace/tsconfig.node.json b/presets/packages/preset-sheets-find-replace/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-find-replace/univer-preset.config.mjs b/presets/packages/preset-sheets-find-replace/univer-preset.config.mjs
new file mode 100644
index 0000000000..ebb34ee2b6
--- /dev/null
+++ b/presets/packages/preset-sheets-find-replace/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/find-replace',
+ '@univerjs/sheets-find-replace',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-hyper-link/README.md b/presets/packages/preset-sheets-hyper-link/README.md
new file mode 100644
index 0000000000..3aa65e9926
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-hyper-link
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-hyper-link)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-hyper-link)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-hyper-link?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-hyper-link)
+
+`@univerjs/preset-sheets-hyper-link` provides a preset for hyperlink support in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------------ | ----------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-hyper-link` | `UniverSheetsHyperLinkPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-hyper-link
+# or
+npm install @univerjs/preset-sheets-hyper-link
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsHyperLinkPreset } from '@univerjs/preset-sheets-hyper-link';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsHyperLinkPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-hyper-link)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-hyper-link/package.json b/presets/packages/preset-sheets-hyper-link/package.json
new file mode 100644
index 0000000000..7cec6f98b7
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-hyper-link",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for hyperlink support in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "hyperlink"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-hyper-link": "workspace:*",
+ "@univerjs/sheets-hyper-link-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-hyper-link/postcss.config.mjs b/presets/packages/preset-sheets-hyper-link/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-hyper-link/src/index.ts b/presets/packages/preset-sheets-hyper-link/src/index.ts
new file mode 100644
index 0000000000..0e8e313d06
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-hyper-link';
+export * from '@univerjs/sheets-hyper-link-ui';
diff --git a/presets/packages/preset-sheets-hyper-link/src/types.ts b/presets/packages/preset-sheets-hyper-link/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-hyper-link/src/umd.ts b/presets/packages/preset-sheets-hyper-link/src/umd.ts
new file mode 100644
index 0000000000..60c6321c92
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/src/umd.ts
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverSheetsHyperLinkUIConfig } from '@univerjs/sheets-hyper-link-ui';
+import type { IPreset } from './types';
+import { UniverSheetsHyperLinkPlugin } from '@univerjs/sheets-hyper-link';
+import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
+
+import '@univerjs/sheets-hyper-link/facade';
+import '@univerjs/sheets-hyper-link-ui/facade';
+
+export type * from '@univerjs/sheets-hyper-link-ui/facade';
+export type * from '@univerjs/sheets-hyper-link/facade';
+
+export interface IUniverSheetsHyperLinkPresetConfig extends
+ Pick<IUniverSheetsHyperLinkUIConfig, 'urlHandler'> {
+}
+
+export function UniverSheetsHyperLinkPreset(config: Partial<IUniverSheetsHyperLinkPresetConfig> = {}): IPreset {
+ const { urlHandler } = config;
+
+ return {
+ plugins: [
+ UniverSheetsHyperLinkPlugin,
+ [UniverSheetsHyperLinkUIPlugin, {
+ urlHandler,
+ }],
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-hyper-link/tailwind.config.ts b/presets/packages/preset-sheets-hyper-link/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-hyper-link/tsconfig.json b/presets/packages/preset-sheets-hyper-link/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-hyper-link/tsconfig.node.json b/presets/packages/preset-sheets-hyper-link/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-hyper-link/univer-preset.config.mjs b/presets/packages/preset-sheets-hyper-link/univer-preset.config.mjs
new file mode 100644
index 0000000000..8b98134b24
--- /dev/null
+++ b/presets/packages/preset-sheets-hyper-link/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-hyper-link',
+ '@univerjs/sheets-hyper-link-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-node-core/README.md b/presets/packages/preset-sheets-node-core/README.md
new file mode 100644
index 0000000000..7a6c63b284
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-node-core
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-node-core)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-node-core)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-node-core?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-node-core)
+
+`@univerjs/preset-sheets-node-core` provides a preset for running Univer Sheets on Node.js with core features.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ----------------------------------- | ---------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-node-core` | `UniverSheetsNodeCorePreset` | No | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-node-core
+# or
+npm install @univerjs/preset-sheets-node-core
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsNodeCorePreset } from '@univerjs/preset-sheets-node-core';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsNodeCorePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-node-core)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-node-core/package.json b/presets/packages/preset-sheets-node-core/package.json
new file mode 100644
index 0000000000..cc21d3ded4
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/package.json
@@ -0,0 +1,98 @@
+{
+ "name": "@univerjs/preset-sheets-node-core",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for running Univer Sheets on Node.js with core features.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "node",
+ "core"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./worker": "./src/worker.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./worker": {
+ "import": "./lib/es/worker.js",
+ "require": "./lib/cjs/worker.js",
+ "types": "./lib/types/worker.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/docs": "workspace:*",
+ "@univerjs/engine-formula": "workspace:*",
+ "@univerjs/rpc-node": "workspace:*",
+ "@univerjs/sheets": "workspace:*",
+ "@univerjs/sheets-data-validation": "workspace:*",
+ "@univerjs/sheets-drawing": "workspace:*",
+ "@univerjs/sheets-filter": "workspace:*",
+ "@univerjs/sheets-formula": "workspace:*",
+ "@univerjs/sheets-hyper-link": "workspace:*",
+ "@univerjs/sheets-numfmt": "workspace:*",
+ "@univerjs/sheets-sort": "workspace:*",
+ "@univerjs/sheets-thread-comment": "workspace:*",
+ "@univerjs/thread-comment": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-node-core/postcss.config.mjs b/presets/packages/preset-sheets-node-core/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-node-core/src/index.ts b/presets/packages/preset-sheets-node-core/src/index.ts
new file mode 100644
index 0000000000..be1db957fd
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/src/index.ts
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/docs';
+export * from '@univerjs/engine-formula';
+export * from '@univerjs/rpc-node';
+export * from '@univerjs/sheets';
+export * from '@univerjs/sheets-data-validation';
+export * from '@univerjs/sheets-drawing';
+export * from '@univerjs/sheets-filter';
+export * from '@univerjs/sheets-formula';
+export * from '@univerjs/sheets-hyper-link';
+export * from '@univerjs/sheets-sort';
+export * from '@univerjs/sheets-thread-comment';
+export * from '@univerjs/thread-comment';
diff --git a/presets/packages/preset-sheets-node-core/src/types.ts b/presets/packages/preset-sheets-node-core/src/types.ts
new file mode 100644
index 0000000000..0205bd683d
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/src/types.ts
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+import type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
+import type { IUniverSheetsFormulaBaseConfig } from '@univerjs/sheets-formula';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
+
+export interface IUniverFormulaConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'>,
+ Pick<IUniverSheetsFormulaBaseConfig, 'description' | 'initialFormulaComputing'> {
+}
+
+export interface IUniverFormulaWorkerConfig extends
+ Pick<IUniverEngineFormulaConfig, 'function'> {
+}
diff --git a/presets/packages/preset-sheets-node-core/src/umd.ts b/presets/packages/preset-sheets-node-core/src/umd.ts
new file mode 100644
index 0000000000..75ea2b1d44
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/src/umd.ts
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset, IUniverFormulaConfig } from './types';
+import { UniverDocsPlugin } from '@univerjs/docs';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRPCNodeMainPlugin } from '@univerjs/rpc-node';
+import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
+import { UniverSheetsDrawingPlugin } from '@univerjs/sheets-drawing';
+import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
+import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
+import { UniverSheetsHyperLinkPlugin } from '@univerjs/sheets-hyper-link';
+import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';
+import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
+import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';
+
+import '@univerjs/sheets/facade';
+import '@univerjs/sheets-formula/facade';
+import '@univerjs/sheets-data-validation/facade';
+import '@univerjs/engine-formula/facade';
+import '@univerjs/sheets-filter/facade';
+import '@univerjs/sheets-hyper-link/facade';
+import '@univerjs/sheets-numfmt/facade';
+import '@univerjs/sheets-sort/facade';
+import '@univerjs/sheets-thread-comment/facade';
+
+export type * from '@univerjs/engine-formula/facade';
+export type * from '@univerjs/sheets-data-validation/facade';
+export type * from '@univerjs/sheets-filter/facade';
+export type * from '@univerjs/sheets-formula/facade';
+export type * from '@univerjs/sheets-hyper-link/facade';
+export type * from '@univerjs/sheets-numfmt/facade';
+export type * from '@univerjs/sheets-sort/facade';
+export type * from '@univerjs/sheets-thread-comment/facade';
+export type * from '@univerjs/sheets/facade';
+
+export interface IUniverSheetsNodeCorePresetConfig {
+ /**
+ * The formula configuration.
+ */
+ formula?: IUniverFormulaConfig;
+
+ /**
+ * The URL of the worker script.
+ */
+ workerSrc?: string;
+}
+
+export function UniverSheetsNodeCorePreset(config: Partial<IUniverSheetsNodeCorePresetConfig> = {}): IPreset {
+ const { workerSrc, formula } = config;
+
+ const useWorker = !!workerSrc;
+
+ return {
+ plugins: [
+ useWorker
+ ? [UniverRPCNodeMainPlugin, { workerSrc }]
+ : null,
+ [UniverFormulaEnginePlugin, {
+ notExecuteFormula: useWorker,
+ function: formula?.function,
+ }],
+
+ UniverThreadCommentPlugin,
+ UniverDocsPlugin,
+
+ UniverSheetsPlugin,
+ [UniverSheetsFormulaPlugin, {
+ notExecuteFormula: useWorker,
+ description: formula?.description,
+ initialFormulaComputing: formula?.initialFormulaComputing,
+ }],
+ UniverSheetsDataValidationPlugin,
+ UniverSheetsFilterPlugin,
+ UniverSheetsHyperLinkPlugin,
+ UniverSheetsDrawingPlugin,
+ UniverSheetsSortPlugin,
+ UniverSheetsThreadCommentPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+}
diff --git a/presets/packages/preset-sheets-node-core/src/worker.ts b/presets/packages/preset-sheets-node-core/src/worker.ts
new file mode 100644
index 0000000000..fa3c624479
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/src/worker.ts
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset, IUniverFormulaWorkerConfig } from './types';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRPCNodeWorkerPlugin } from '@univerjs/rpc-node';
+import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { UniverRemoteSheetsFormulaPlugin } from '@univerjs/sheets-formula';
+
+export * from '@univerjs/engine-formula';
+export * from '@univerjs/rpc-node';
+export * from '@univerjs/sheets';
+export * from '@univerjs/sheets-formula';
+
+export interface IUniverSheetsNodeCoreWorkerPresetConfig {
+ /**
+ * The formula worker config.
+ */
+ formula?: IUniverFormulaWorkerConfig;
+}
+
+export function UniverSheetsNodeCoreWorkerPreset(config: Partial<IUniverSheetsNodeCoreWorkerPresetConfig> = {}): IPreset {
+ const {
+ formula,
+ } = config;
+
+ return {
+ plugins: [
+ [UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true }],
+ [UniverFormulaEnginePlugin, { function: formula?.function }],
+ UniverRPCNodeWorkerPlugin,
+ UniverRemoteSheetsFormulaPlugin,
+ ],
+ };
+}
diff --git a/presets/packages/preset-sheets-node-core/tailwind.config.ts b/presets/packages/preset-sheets-node-core/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-node-core/tsconfig.json b/presets/packages/preset-sheets-node-core/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-node-core/tsconfig.node.json b/presets/packages/preset-sheets-node-core/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-node-core/univer-preset.config.mjs b/presets/packages/preset-sheets-node-core/univer-preset.config.mjs
new file mode 100644
index 0000000000..d115a9e7be
--- /dev/null
+++ b/presets/packages/preset-sheets-node-core/univer-preset.config.mjs
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/docs',
+ '@univerjs/rpc-node',
+ '@univerjs/sheets',
+ '@univerjs/sheets-numfmt',
+ '@univerjs/sheets-data-validation',
+ '@univerjs/sheets-drawing',
+ '@univerjs/sheets-filter',
+ '@univerjs/sheets-formula',
+ '@univerjs/sheets-hyper-link',
+ '@univerjs/sheets-sort',
+ '@univerjs/thread-comment',
+ '@univerjs/sheets-thread-comment',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-note/README.md b/presets/packages/preset-sheets-note/README.md
new file mode 100644
index 0000000000..1f802a7712
--- /dev/null
+++ b/presets/packages/preset-sheets-note/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-note
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-note?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-note)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-note?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-note)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-note?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-note)
+
+`@univerjs/preset-sheets-note` provides a preset for notes in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------ | ------------------------ | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-note` | `UniverSheetsNotePreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-note
+# or
+npm install @univerjs/preset-sheets-note
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsNotePreset } from '@univerjs/preset-sheets-note';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsNotePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-note)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-note/package.json b/presets/packages/preset-sheets-note/package.json
new file mode 100644
index 0000000000..abd956cd3f
--- /dev/null
+++ b/presets/packages/preset-sheets-note/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-note",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for notes in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "note"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-note": "workspace:*",
+ "@univerjs/sheets-note-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-note/postcss.config.mjs b/presets/packages/preset-sheets-note/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-note/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-note/src/index.ts b/presets/packages/preset-sheets-note/src/index.ts
new file mode 100644
index 0000000000..fd647e257b
--- /dev/null
+++ b/presets/packages/preset-sheets-note/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-note';
+export * from '@univerjs/sheets-note-ui';
diff --git a/presets/packages/preset-sheets-note/src/types.ts b/presets/packages/preset-sheets-note/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-note/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-note/src/umd.ts b/presets/packages/preset-sheets-note/src/umd.ts
new file mode 100644
index 0000000000..efffe455ce
--- /dev/null
+++ b/presets/packages/preset-sheets-note/src/umd.ts
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { UniverSheetsNotePlugin } from '@univerjs/sheets-note';
+import { UniverSheetsNoteUIPlugin } from '@univerjs/sheets-note-ui';
+
+import '@univerjs/sheets-note/facade';
+
+export type * from '@univerjs/sheets-note/facade';
+
+export function UniverSheetsNotePreset(): IPreset {
+ return {
+ plugins: [
+ UniverSheetsNotePlugin,
+ UniverSheetsNoteUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-note/tailwind.config.ts b/presets/packages/preset-sheets-note/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-note/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-note/tsconfig.json b/presets/packages/preset-sheets-note/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-note/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-note/tsconfig.node.json b/presets/packages/preset-sheets-note/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-note/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-note/univer-preset.config.mjs b/presets/packages/preset-sheets-note/univer-preset.config.mjs
new file mode 100644
index 0000000000..f59dd2a563
--- /dev/null
+++ b/presets/packages/preset-sheets-note/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-note',
+ '@univerjs/sheets-note-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-sort/README.md b/presets/packages/preset-sheets-sort/README.md
new file mode 100644
index 0000000000..1074bb2058
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-sort
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-sort?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-sort)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-sort?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-sort)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-sort?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-sort)
+
+`@univerjs/preset-sheets-sort` provides a preset for sort functionality in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------ | ------------------------ | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-sort` | `UniverSheetsSortPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-sort
+# or
+npm install @univerjs/preset-sheets-sort
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsSortPreset } from '@univerjs/preset-sheets-sort';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsSortPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-sort)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-sort/package.json b/presets/packages/preset-sheets-sort/package.json
new file mode 100644
index 0000000000..12bcabf012
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-sort",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for sort functionality in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "sort"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "main": "./src/index.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-sort": "workspace:*",
+ "@univerjs/sheets-sort-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-sort/postcss.config.mjs b/presets/packages/preset-sheets-sort/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-sort/src/index.ts b/presets/packages/preset-sheets-sort/src/index.ts
new file mode 100644
index 0000000000..8099a78ad7
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-sort';
+export * from '@univerjs/sheets-sort-ui';
diff --git a/presets/packages/preset-sheets-sort/src/types.ts b/presets/packages/preset-sheets-sort/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-sort/src/umd.ts b/presets/packages/preset-sheets-sort/src/umd.ts
new file mode 100644
index 0000000000..843fb85f22
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/src/umd.ts
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';
+import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
+
+import '@univerjs/sheets-sort/facade';
+
+export type * from '@univerjs/sheets-sort/facade';
+
+export function UniverSheetsSortPreset(): IPreset {
+ return {
+ plugins: [
+ UniverSheetsSortPlugin,
+ UniverSheetsSortUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-sort/tailwind.config.ts b/presets/packages/preset-sheets-sort/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-sort/tsconfig.json b/presets/packages/preset-sheets-sort/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-sort/tsconfig.node.json b/presets/packages/preset-sheets-sort/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-sort/univer-preset.config.mjs b/presets/packages/preset-sheets-sort/univer-preset.config.mjs
new file mode 100644
index 0000000000..d4cc25d458
--- /dev/null
+++ b/presets/packages/preset-sheets-sort/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-sort',
+ '@univerjs/sheets-sort-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-table/README.md b/presets/packages/preset-sheets-table/README.md
new file mode 100644
index 0000000000..a186b8a3f1
--- /dev/null
+++ b/presets/packages/preset-sheets-table/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-table
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-table?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-table)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-table?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-table)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-table?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-table)
+
+`@univerjs/preset-sheets-table` provides a preset for table features in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ------------------------------- | ------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-table` | `UniverSheetsTablePreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-table
+# or
+npm install @univerjs/preset-sheets-table
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsTablePreset } from '@univerjs/preset-sheets-table';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsTablePreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-table)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-table/package.json b/presets/packages/preset-sheets-table/package.json
new file mode 100644
index 0000000000..c1543106bd
--- /dev/null
+++ b/presets/packages/preset-sheets-table/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@univerjs/preset-sheets-table",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for table features in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "table"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "main": "./src/index.ts",
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-table": "workspace:*",
+ "@univerjs/sheets-table-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-table/postcss.config.mjs b/presets/packages/preset-sheets-table/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-table/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-table/src/index.ts b/presets/packages/preset-sheets-table/src/index.ts
new file mode 100644
index 0000000000..efe7bfb49f
--- /dev/null
+++ b/presets/packages/preset-sheets-table/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-table';
+export * from '@univerjs/sheets-table-ui';
diff --git a/presets/packages/preset-sheets-table/src/types.ts b/presets/packages/preset-sheets-table/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-table/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-table/src/umd.ts b/presets/packages/preset-sheets-table/src/umd.ts
new file mode 100644
index 0000000000..c51eb8ea3c
--- /dev/null
+++ b/presets/packages/preset-sheets-table/src/umd.ts
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+
+import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';
+import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui';
+
+import '@univerjs/sheets-table/facade';
+
+export type * from '@univerjs/sheets-table/facade';
+
+export function UniverSheetsTablePreset(): IPreset {
+ return {
+ plugins: [
+ UniverSheetsTablePlugin,
+ UniverSheetsTableUIPlugin,
+ ].filter((v) => !!v) as IPreset['plugins'],
+ };
+};
diff --git a/presets/packages/preset-sheets-table/tailwind.config.ts b/presets/packages/preset-sheets-table/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-table/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-table/tsconfig.json b/presets/packages/preset-sheets-table/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-table/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-table/tsconfig.node.json b/presets/packages/preset-sheets-table/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-table/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-table/univer-preset.config.mjs b/presets/packages/preset-sheets-table/univer-preset.config.mjs
new file mode 100644
index 0000000000..7484c71ff4
--- /dev/null
+++ b/presets/packages/preset-sheets-table/univer-preset.config.mjs
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/sheets-table',
+ '@univerjs/sheets-table-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-thread-comment/README.md b/presets/packages/preset-sheets-thread-comment/README.md
new file mode 100644
index 0000000000..53f035ebf5
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/README.md
@@ -0,0 +1,38 @@
+# @univerjs/preset-sheets-thread-comment
+
+[![npm version](https://img.shields.io/npm/v/@univerjs/preset-sheets-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-thread-comment)
+[![license](https://img.shields.io/npm/l/@univerjs/preset-sheets-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-thread-comment)
+[![downloads](https://img.shields.io/npm/dm/@univerjs/preset-sheets-thread-comment?style=flat-square)](https://npmjs.com/package/@univerjs/preset-sheets-thread-comment)
+
+`@univerjs/preset-sheets-thread-comment` provides a preset for thread comments in Univer Sheets.
+
+## Package Overview
+
+| Package | UMD global | CSS | Locales | Facade entry |
+| ---------------------------------------- | --------------------------------- | :-: | :-----: | :----------: |
+| `@univerjs/preset-sheets-thread-comment` | `UniverSheetsThreadCommentPreset` | Yes | Yes | Yes |
+
+## Installation
+
+```sh
+pnpm add @univerjs/preset-sheets-thread-comment
+# or
+npm install @univerjs/preset-sheets-thread-comment
+```
+
+Keep all `@univerjs/*` packages on the same version.
+
+## Usage
+
+```ts
+import { UniverSheetsThreadCommentPreset } from '@univerjs/preset-sheets-thread-comment';
+
+// Use with createUniver:
+// createUniver({ presets: [UniverSheetsThreadCommentPreset()] });
+```
+
+## Resources
+
+- [Documentation](https://docs.univer.ai)
+- [NPM package](https://npmjs.com/package/@univerjs/preset-sheets-thread-comment)
+- [GitHub repository](https://github.com/dream-num/univer)
diff --git a/presets/packages/preset-sheets-thread-comment/package.json b/presets/packages/preset-sheets-thread-comment/package.json
new file mode 100644
index 0000000000..3af74f760c
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "@univerjs/preset-sheets-thread-comment",
+ "version": "0.25.0",
+ "private": false,
+ "description": "Preset for thread comments in Univer Sheets.",
+ "author": "DreamNum Co., Ltd. <[email protected]>",
+ "license": "Apache-2.0",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/univer"
+ },
+ "homepage": "https://univer.ai",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dream-num/univer"
+ },
+ "bugs": {
+ "url": "https://github.com/dream-num/univer/issues"
+ },
+ "keywords": [
+ "univer",
+ "univer-preset",
+ "sheets",
+ "thread-comment"
+ ],
+ "sideEffects": [
+ "*.css"
+ ],
+ "exports": {
+ ".": "./src/index.ts",
+ "./locales/*": "./src/locales/*.ts",
+ "./lib/*": "./lib/*"
+ },
+ "main": "./src/index.ts",
+ "publishConfig": {
+ "access": "public",
+ "main": "./lib/es/index.js",
+ "module": "./lib/es/index.js",
+ "exports": {
+ ".": {
+ "import": "./lib/es/index.js",
+ "require": "./lib/cjs/index.js",
+ "types": "./lib/types/index.d.ts"
+ },
+ "./locales/*": {
+ "import": "./lib/es/locales/*.js",
+ "require": "./lib/cjs/locales/*.js",
+ "types": "./lib/types/locales/*.d.ts"
+ },
+ "./lib/*": "./lib/*"
+ }
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "types": "./lib/types/index.d.ts",
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "prepare": "univer-cli preset prepare",
+ "build:bundle": "univer-cli preset build --cleanup",
+ "build:types": "tsc -p tsconfig.node.json",
+ "build": "pnpm run build:bundle && pnpm run build:types",
+ "typecheck": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "rxjs": ">=7.0.0"
+ },
+ "dependencies": {
+ "@univerjs/sheets-thread-comment": "workspace:*",
+ "@univerjs/sheets-thread-comment-ui": "workspace:*",
+ "@univerjs/thread-comment": "workspace:*",
+ "@univerjs/thread-comment-ui": "workspace:*"
+ },
+ "devDependencies": {
+ "@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
+ "react": "18.3.1",
+ "react-dom": "18.3.1",
+ "rxjs": "^7.8.2",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/presets/packages/preset-sheets-thread-comment/postcss.config.mjs b/presets/packages/preset-sheets-thread-comment/postcss.config.mjs
new file mode 100644
index 0000000000..3dcb559a83
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/postcss.config.mjs
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export { default } from '@univerjs-infra/shared/postcss';
diff --git a/presets/packages/preset-sheets-thread-comment/src/index.ts b/presets/packages/preset-sheets-thread-comment/src/index.ts
new file mode 100644
index 0000000000..d67f066e56
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/src/index.ts
@@ -0,0 +1,21 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/sheets-thread-comment';
+export * from '@univerjs/sheets-thread-comment-ui';
+export * from '@univerjs/thread-comment-ui';
diff --git a/presets/packages/preset-sheets-thread-comment/src/types.ts b/presets/packages/preset-sheets-thread-comment/src/types.ts
new file mode 100644
index 0000000000..4d13fb9621
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/src/types.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+export interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ locales?: IUniverConfig['locales'];
+}
+
+export interface IPresetOptions {
+ lazy?: boolean;
+}
diff --git a/presets/packages/preset-sheets-thread-comment/src/umd.ts b/presets/packages/preset-sheets-thread-comment/src/umd.ts
new file mode 100644
index 0000000000..ecad38c067
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/src/umd.ts
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { IPreset } from './types';
+import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
+import { UniverSheetsThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment-ui';
+import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
+
+import '@univerjs/sheets-thread-comment/facade';
+
+export type * from '@univerjs/sheets-thread-comment/facade';
+
+export interface IUniverSheetsThreadCommentPresetConfig {
+}
+
+/**
+ * This preset add thread comment features into your application.
+ *
+ * @param {Partial<IUniverSheetsThreadCommentPresetConfig>} config - The configuration object.
+ */
+export function UniverSheetsThreadCommentPreset(_config: Partial<IUniverSheetsThreadCommentPresetConfig> = {}): IPreset {
+ const plugins: IPreset['plugins'] = [
+ UniverThreadCommentUIPlugin,
+ UniverSheetsThreadCommentPlugin,
+ UniverSheetsThreadCommentUIPlugin,
+ ];
+
+ return { plugins };
+}
diff --git a/presets/packages/preset-sheets-thread-comment/tailwind.config.ts b/presets/packages/preset-sheets-thread-comment/tailwind.config.ts
new file mode 100644
index 0000000000..64fef05703
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/tailwind.config.ts
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { Config } from 'tailwindcss';
+import preset, { createTailwindContent } from '@univerjs-infra/shared/tailwind';
+
+const config: Config = {
+ presets: [preset],
+ content: createTailwindContent(import.meta.url, {
+ includeStyleDependencies: true,
+ }),
+};
+
+export default config;
diff --git a/presets/packages/preset-sheets-thread-comment/tsconfig.json b/presets/packages/preset-sheets-thread-comment/tsconfig.json
new file mode 100644
index 0000000000..7ade7bf9fd
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src", "../../common/shared/types/global.d.ts"]
+}
diff --git a/presets/packages/preset-sheets-thread-comment/tsconfig.node.json b/presets/packages/preset-sheets-thread-comment/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/packages/preset-sheets-thread-comment/univer-preset.config.mjs b/presets/packages/preset-sheets-thread-comment/univer-preset.config.mjs
new file mode 100644
index 0000000000..6b053572fb
--- /dev/null
+++ b/presets/packages/preset-sheets-thread-comment/univer-preset.config.mjs
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/thread-comment',
+ '@univerjs/sheets-thread-comment',
+ '@univerjs/thread-comment-ui',
+ '@univerjs/sheets-thread-comment-ui',
+ ],
+};
+
+export default config;
diff --git a/presets/src/index.ts b/presets/src/index.ts
new file mode 100644
index 0000000000..d9db91b84a
--- /dev/null
+++ b/presets/src/index.ts
@@ -0,0 +1,20 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+export * from './umd';
+
+export * from '@univerjs/core';
+export * from '@univerjs/themes';
diff --git a/presets/src/umd.ts b/presets/src/umd.ts
new file mode 100644
index 0000000000..1062d641db
--- /dev/null
+++ b/presets/src/umd.ts
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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 { DependencyOverride, IUniverConfig, Plugin, PluginCtor } from '@univerjs/core';
+import { IAuthzIoService, IMentionIOService, IUndoRedoService, LogLevel, Univer } from '@univerjs/core';
+import { FUniver } from '@univerjs/core/facade';
+
+export * from '@univerjs/core/facade';
+
+/**
+ * A collection of plugins and their default configs.
+ */
+interface IPreset {
+ plugins: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+}
+
+interface IPresetOptions {
+ lazy?: boolean;
+}
+
+type CreateUniverOptions = Partial<IUniverConfig> & {
+ presets: Array<IPreset | [IPreset, IPresetOptions]>;
+ plugins?: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;
+ /**
+ * Overrides the dependencies defined in the plugin. Only dependencies that are identified by `IdentifierDecorator` can be overridden.
+ * If you override a dependency with `null`, the original dependency will be removed.
+ */
+ override?: DependencyOverride;
+ collaboration?: true;
+};
+
+export function createUniver(options: CreateUniverOptions) {
+ const { presets, plugins, collaboration, override = [], ...univerOptions } = options;
+
+ if (collaboration) {
+ override.push([IUndoRedoService, null]);
+ override.push([IAuthzIoService, null]);
+ override.push([IMentionIOService, null]);
+ }
+
+ const univer = new Univer({
+ logLevel: LogLevel.WARN,
+ ...univerOptions,
+ override,
+ });
+
+ const pluginsMap = new Map<string, {
+ plugin: PluginCtor<Plugin>;
+ options: any;
+ }>();
+
+ presets?.forEach((preset) => {
+ const realPreset = Array.isArray(preset) ? preset[0] : preset;
+
+ const { plugins } = realPreset;
+
+ plugins.forEach((p) => {
+ const [realPlugin, pluginConfig] = Array.isArray(p) ? [p[0], p[1]] : [p];
+
+ if (pluginsMap.has(realPlugin.pluginName)) {
+ pluginsMap.delete(realPlugin.pluginName);
+ }
+
+ pluginsMap.set(realPlugin.pluginName, { plugin: realPlugin, options: pluginConfig });
+ });
+ });
+
+ plugins?.forEach((plugin) => {
+ const [realPlugin, pluginConfig] = Array.isArray(plugin) ? [plugin[0], plugin[1]] : [plugin];
+
+ if (pluginsMap.has(realPlugin.pluginName)) {
+ throw new Error(`Plugin ${realPlugin.pluginName} already registered by presets or other ways! Repeated registration may cause potential problems, please check your code.`);
+ }
+
+ pluginsMap.set(realPlugin.pluginName, { plugin: realPlugin, options: pluginConfig });
+ });
+
+ pluginsMap.forEach(({ plugin, options }) => {
+ univer.registerPlugin(plugin, options);
+ });
+
+ // Finally we wrap all plugins into a Facade API to make it for convenient usage.
+ const univerAPI = FUniver.newAPI(univer);
+ return {
+ univer,
+ univerAPI,
+ };
+}
diff --git a/presets/tsconfig.json b/presets/tsconfig.json
new file mode 100644
index 0000000000..d4f9172636
--- /dev/null
+++ b/presets/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/base",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types"
+ },
+ "include": ["src"]
+}
diff --git a/presets/tsconfig.node.json b/presets/tsconfig.node.json
new file mode 100644
index 0000000000..2abfa07367
--- /dev/null
+++ b/presets/tsconfig.node.json
@@ -0,0 +1,18 @@
+{
+ "extends": "@univerjs-infra/shared/tsconfigs/node",
+ "compilerOptions": {
+ "rootDir": "src",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "noEmit": false,
+ "outDir": "lib/types"
+ },
+ "include": [
+ "src"
+ ],
+ "exclude": [
+ "src/**/__tests__/**",
+ "src/**/*.spec.ts",
+ "src/**/*.test.ts"
+ ]
+}
diff --git a/presets/univer-preset.config.mjs b/presets/univer-preset.config.mjs
new file mode 100644
index 0000000000..12d02348da
--- /dev/null
+++ b/presets/univer-preset.config.mjs
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2023-present DreamNum Co., Ltd.
+ *
+ * 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.
+ */
+
+const config = {
+ umdDeps: [
+ '@univerjs/themes',
+ '@univerjs/protocol',
+ '@univerjs/core',
+ '@univerjs/network',
+ '@univerjs/telemetry',
+ '@univerjs/rpc',
+ '@univerjs/engine-render',
+ '@univerjs/engine-formula',
+ '@univerjs/drawing',
+ ],
+ umdAdditionalFiles: [
+ './node_modules/@univerjs-infra/shared/react-polyfill/react-polyfill.js',
+ './node_modules/@wendellhu/redi/dist/umd/index.js',
+ './node_modules/@wendellhu/redi/dist/umd/react-bindings/index.js',
+ ],
+};
+
+export default config;
diff --git a/turbo.json b/turbo.json
index ab4ab083a7..443b4b4057 100644
--- a/turbo.json
+++ b/turbo.json
@@ -9,6 +9,7 @@
},
"build": {
+ "outputs": ["lib/**"]
},
"build:e2e": {},