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.

fix(thread-comment): thread-comment build types (#3802)

zhangw417fdee72933
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index 90dc03b558..596c27d1f0 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -16,7 +16,7 @@
import type { Nullable } from '@univerjs/core';
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
-import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment';
+import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
diff --git a/examples/src/uni/main.ts b/examples/src/uni/main.ts
index afa9601ed3..ead32bcc42 100644
--- a/examples/src/uni/main.ts
+++ b/examples/src/uni/main.ts
@@ -16,7 +16,7 @@
import type { Nullable } from '@univerjs/core';
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
-import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment';
+import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
import { Injector, LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
@@ -40,8 +40,7 @@ import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment
import { SheetUIController, UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSlidesPlugin } from '@univerjs/slides';
import { SlidesUIController, UniverSlidesUIPlugin } from '@univerjs/slides-ui';
-import { IThreadCommentMentionDataService } from '@univerjs/thread-comment';
-import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
+import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
import { UniDocsUIController } from '@univerjs/uni-docs-ui';
import { UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';
import { UniSheetsUIController } from '@univerjs/uni-sheets-ui';
diff --git a/package.json b/package.json
index 130ca4c500..8407cb6670 100644
--- a/package.json
+++ b/package.json
@@ -62,7 +62,7 @@
"eslint-plugin-no-barrel-import": "^0.0.2",
"eslint-plugin-no-penetrating-import": "^0.0.1",
"eslint-plugin-react": "^7.37.1",
- "eslint-plugin-react-hooks": "5.1.0-rc-107a2f8c3e-20240617",
+ "eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-react-refresh": "^0.4.12",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
diff --git a/packages/sheets-formula/package.json b/packages/sheets-formula/package.json
index ee4ab874c7..5393e87f51 100644
--- a/packages/sheets-formula/package.json
+++ b/packages/sheets-formula/package.json
@@ -62,10 +62,8 @@
},
"dependencies": {
"@univerjs/core": "workspace:*",
- "@univerjs/design": "workspace:*",
"@univerjs/docs": "workspace:*",
"@univerjs/engine-formula": "workspace:*",
- "@univerjs/icons": "^0.1.79",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-numfmt": "workspace:*"
diff --git a/packages/sheets-thread-comment/src/index.ts b/packages/sheets-thread-comment/src/index.ts
index d4ace84e50..9754967a1b 100644
--- a/packages/sheets-thread-comment/src/index.ts
+++ b/packages/sheets-thread-comment/src/index.ts
@@ -39,6 +39,6 @@ export type {
IUpdateCommentCommandParams,
} from '@univerjs/thread-comment';
export { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
-export { IThreadCommentMentionDataService } from '@univerjs/thread-comment';
+export { IThreadCommentMentionDataService } from '@univerjs/thread-comment-ui';
// #endregion
diff --git a/packages/thread-comment-ui/src/index.ts b/packages/thread-comment-ui/src/index.ts
index 500ebeb2de..074246225a 100644
--- a/packages/thread-comment-ui/src/index.ts
+++ b/packages/thread-comment-ui/src/index.ts
@@ -22,6 +22,7 @@ export type { IThreadCommentPanelProps } from './views/thread-comment-panel';
export { ThreadCommentTree } from './views/thread-comment-tree';
export type { IThreadCommentTreeProps } from './views/thread-comment-tree';
export { THREAD_COMMENT_PANEL } from './types/const';
+export { IThreadCommentMentionDataService, type IThreadCommentMentionDataSource } from './services/thread-comment-mention-data.service';
// #region - all commands
diff --git a/packages/thread-comment-ui/src/plugin.ts b/packages/thread-comment-ui/src/plugin.ts
index ff51a491bb..73aff900f3 100644
--- a/packages/thread-comment-ui/src/plugin.ts
+++ b/packages/thread-comment-ui/src/plugin.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';
import type { Dependency } from '@univerjs/core';
+import type { IUniverThreadCommentUIConfig } from './controllers/config.schema';
import { DependentOn, ICommandService, IConfigService, Inject, Injector, mergeOverrideWithDependencies, Plugin, UniverInstanceType } from '@univerjs/core';
-import { PLUGIN_NAME } from './types/const';
-import { ThreadCommentPanelService } from './services/thread-comment-panel.service';
+import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';
import { SetActiveCommentOperation, ToggleSheetCommentPanelOperation } from './commands/operations/comment.operations';
-import type { IUniverThreadCommentUIConfig } from './controllers/config.schema';
import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
+import { IThreadCommentMentionDataService, ThreadCommentMentionDataService } from './services/thread-comment-mention-data.service';
+import { ThreadCommentPanelService } from './services/thread-comment-panel.service';
+import { PLUGIN_NAME } from './types/const';
@DependentOn(UniverThreadCommentPlugin)
export class UniverThreadCommentUIPlugin extends Plugin {
@@ -47,6 +48,7 @@ export class UniverThreadCommentUIPlugin extends Plugin {
override onStarting(): void {
(mergeOverrideWithDependencies([
[ThreadCommentPanelService],
+ [IThreadCommentMentionDataService, { useClass: ThreadCommentMentionDataService }],
], this._config?.overrides) as Dependency[]).forEach((dep) => {
this._injector.add(dep);
});
diff --git a/packages/thread-comment/src/services/thread-comment-mention-data.service.ts b/packages/thread-comment-ui/src/services/thread-comment-mention-data.service.ts
similarity index 100%
rename from packages/thread-comment/src/services/thread-comment-mention-data.service.ts
rename to packages/thread-comment-ui/src/services/thread-comment-mention-data.service.ts
diff --git a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
index 42d2f64ccd..3636cce33e 100644
--- a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
+++ b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
@@ -14,17 +14,17 @@
* limitations under the License.
*/
+import type { IDocumentBody } from '@univerjs/core';
+import type { MentionProps } from '@univerjs/design';
+import type { IThreadComment } from '@univerjs/thread-comment';
import { ICommandService, LocaleService, UniverInstanceType, useDependency } from '@univerjs/core';
import { Button, Mention, Mentions } from '@univerjs/design';
import { DocSelectionManagerService } from '@univerjs/docs';
import { DocSelectionRenderService } from '@univerjs/docs-ui';
import { IRenderManagerService } from '@univerjs/engine-render';
+import { IThreadCommentMentionDataService } from '@univerjs/thread-comment-ui';
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
-import type { IDocumentBody } from '@univerjs/core';
-import type { MentionProps } from '@univerjs/design';
-import type { IThreadComment } from '@univerjs/thread-comment';
import { SetActiveCommentOperation } from '../../commands/operations/comment.operations';
-import { IThreadCommentMentionDataService } from '@univerjs/thread-comment';
import styles from './index.module.less';
import { parseMentions, transformDocument2TextNodes, transformMention, transformTextNode2Text, transformTextNodes2Document } from './util';
diff --git a/packages/thread-comment/src/index.ts b/packages/thread-comment/src/index.ts
index e328002d4c..21ed1da294 100644
--- a/packages/thread-comment/src/index.ts
+++ b/packages/thread-comment/src/index.ts
@@ -26,11 +26,6 @@ export {
ThreadCommentDataSourceService,
type ThreadCommentJSON,
} from './services/tc-datasource.service';
-export {
- type IThreadCommentMentionDataSource,
- IThreadCommentMentionDataService,
- ThreadCommentMentionDataService,
-} from './services/thread-comment-mention-data.service';
// #region - all commands
export {
diff --git a/packages/thread-comment/src/plugin.ts b/packages/thread-comment/src/plugin.ts
index 484bfad4d9..8952d65522 100644
--- a/packages/thread-comment/src/plugin.ts
+++ b/packages/thread-comment/src/plugin.ts
@@ -24,7 +24,6 @@ import { ThreadCommentResourceController } from './controllers/tc-resource.contr
import { ThreadCommentModel } from './models/thread-comment.model';
import { IThreadCommentDataSourceService, ThreadCommentDataSourceService } from './services/tc-datasource.service';
import { TC_PLUGIN_NAME } from './types/const';
-import { IThreadCommentMentionDataService, ThreadCommentMentionDataService } from './services/thread-comment-mention-data.service';
export class UniverThreadCommentPlugin extends Plugin {
static override pluginName = TC_PLUGIN_NAME;
@@ -46,7 +45,6 @@ export class UniverThreadCommentPlugin extends Plugin {
override onStarting(): void {
(mergeOverrideWithDependencies([
[IThreadCommentDataSourceService, { useClass: ThreadCommentDataSourceService }],
- [IThreadCommentMentionDataService, { useClass: ThreadCommentMentionDataService }],
[ThreadCommentModel],
[ThreadCommentResourceController],
], this._config?.overrides) as Dependency[]).forEach(
diff --git a/packages/thread-comment/vite.config.ts b/packages/thread-comment/vite.config.ts
index 04e4e3b060..62c3c4fab3 100644
--- a/packages/thread-comment/vite.config.ts
+++ b/packages/thread-comment/vite.config.ts
@@ -4,9 +4,4 @@ import pkg from './package.json';
export default ({ mode }) => createViteConfig({}, {
mode,
pkg,
- features: {
- react: false,
- css: true,
- dom: true,
- },
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3f6127028f..6d448d6cd3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -10,7 +10,7 @@ importers:
devDependencies:
'@antfu/eslint-config':
specifier: 3.7.3
'@commitlint/cli':
specifier: ^19.5.0
version: 19.5.0(@types/[email protected])([email protected])
@@ -66,8 +66,8 @@ importers:
specifier: ^7.37.1
eslint-plugin-react-hooks:
- specifier: 5.1.0-rc-107a2f8c3e-20240617
- version: 5.1.0-rc-107a2f8c3e-20240617([email protected]([email protected]))
+ specifier: 5.0.0
eslint-plugin-react-refresh:
specifier: ^0.4.12
@@ -2337,18 +2337,12 @@ importers:
'@univerjs/core':
specifier: workspace:*
version: link:../core
- '@univerjs/design':
- specifier: workspace:*
- version: link:../design
'@univerjs/docs':
specifier: workspace:*
version: link:../docs
'@univerjs/engine-formula':
specifier: workspace:*
version: link:../engine-formula
- '@univerjs/icons':
- specifier: ^0.1.79
'@univerjs/rpc':
specifier: workspace:*
version: link:../rpc
@@ -6828,8 +6822,8 @@ packages:
typescript:
optional: true
- resolution: {integrity: sha512-FqbGPZg0U97cOqiZuGm8yplPYtTNTa2YhEDFyL/8qtxQjwQX7KVbCWA1DiAdiNOUi37KrAqZ0TiqrnbQ4QOSTQ==}
+ resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==}
engines: {node: '>=10'}
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
@@ -10497,7 +10491,7 @@ snapshots:
dependencies:
'@babel/runtime': 7.25.0
dependencies:
'@antfu/install-pkg': 0.4.1
'@clack/prompts': 0.7.0
@@ -10538,7 +10532,7 @@ snapshots:
optionalDependencies:
'@eslint-react/eslint-plugin': 1.14.3([email protected]([email protected]))([email protected])
eslint-plugin-format: 0.1.2([email protected]([email protected]))
- eslint-plugin-react-hooks: 5.1.0-rc-107a2f8c3e-20240617([email protected]([email protected]))
+ eslint-plugin-react-hooks: 5.0.0([email protected]([email protected]))
eslint-plugin-react-refresh: 0.4.12([email protected]([email protected]))
transitivePeerDependencies:
- '@typescript-eslint/utils'
@@ -14277,7 +14271,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
eslint: 9.12.0([email protected])