Skip to content

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

chore: improve eslint performance on file save (#646)

白熱cc35b361e0d6
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 078d66f738..63e781724a 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -143,7 +143,6 @@ module.exports = {
'error',
{
component: true,
- html: true,
},
],
},
diff --git a/.storybook/main.ts b/.storybook/main.ts
index 687119f0d2..0221a39611 100644
--- a/.storybook/main.ts
+++ b/.storybook/main.ts
@@ -17,12 +17,12 @@ const config: StorybookConfig = {
titlePrefix: 'Design'
},
{
- directory: '../packages/base-ui/src/**',
+ directory: '../packages/ui/src/**',
files: '*.stories.@(js|jsx|mjs|ts|tsx)',
titlePrefix: 'Base UI'
},
{
- directory: '../packages/sheets-plugin-numfmt/src/**',
+ directory: '../packages/sheets-numfmt/src/**',
files: '*.stories.@(js|jsx|mjs|ts|tsx)',
titlePrefix: 'Numfmt'
},
diff --git a/apps/docs/src/css/custom.css b/apps/docs/src/css/custom.css
index 7f2053cb0d..8fc6f888ee 100644
--- a/apps/docs/src/css/custom.css
+++ b/apps/docs/src/css/custom.css
@@ -6,7 +6,7 @@
/* You can override the default Infima variables here. */
:root {
- /* --ifm-color-primary: #2e8555;
+ /* --ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
@@ -15,11 +15,13 @@
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgb(0 0 0 / 10%); */
+
+ --ifm-code-padding-horizontal: 0.3rem;
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
- /* --ifm-color-primary: #25c2a0;
+ /* --ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
@@ -28,3 +30,11 @@
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgb(0 0 0 / 30%); */
}
+
+code {
+ color: var(--ifm-color-primary);
+}
+
+body {
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "noto sans", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
diff --git a/packages/ui/src/services/sidebar/desktop-sidebar.service.ts b/packages/ui/src/services/sidebar/desktop-sidebar.service.ts
index f376ece87a..a912a48dfa 100644
--- a/packages/ui/src/services/sidebar/desktop-sidebar.service.ts
+++ b/packages/ui/src/services/sidebar/desktop-sidebar.service.ts
@@ -6,32 +6,37 @@ import { type ISidebarMethodOptions } from '../../views/components/sidebar/inter
import type { ISidebarService } from './sidebar.service';
export class DesktopSidebarService implements ISidebarService {
- private sidebarOptions: ISidebarMethodOptions = {};
- private readonly sidebarOptions$ = new Subject<ISidebarMethodOptions>();
+ private _sidebarOptions: ISidebarMethodOptions = {};
+ readonly sidebarOptions$ = new Subject<ISidebarMethodOptions>();
- open(option: ISidebarMethodOptions): IDisposable {
- this.sidebarOptions = {
- ...option,
+ open(params: ISidebarMethodOptions): IDisposable {
+ this._sidebarOptions = {
+ ...params,
visible: true,
};
- this.sidebarOptions$.next(this.sidebarOptions);
+ this.sidebarOptions$.next(this._sidebarOptions);
return toDisposable(() => {
- this.sidebarOptions$.next({});
+ this.sidebarOptions$.complete();
});
}
+ set(params: ISidebarMethodOptions): void {
+ this._sidebarOptions = {
+ ...params,
+ };
+
+ this.sidebarOptions$.next(this._sidebarOptions);
+ }
+
close() {
- this.sidebarOptions = {
- ...this.sidebarOptions,
+ this._sidebarOptions = {
+ ...this._sidebarOptions,
visible: false,
};
- this.sidebarOptions$.next(this.sidebarOptions);
- this.sidebarOptions.onClose && this.sidebarOptions.onClose();
- }
- getObservableSidebar() {
- return this.sidebarOptions$;
+ this.sidebarOptions$.next(this._sidebarOptions);
+ this._sidebarOptions.onClose && this._sidebarOptions.onClose();
}
}
diff --git a/packages/ui/src/services/sidebar/sidebar.service.ts b/packages/ui/src/services/sidebar/sidebar.service.ts
index 805aac86d8..e2968cca2d 100644
--- a/packages/ui/src/services/sidebar/sidebar.service.ts
+++ b/packages/ui/src/services/sidebar/sidebar.service.ts
@@ -1,15 +1,17 @@
import type { IDisposable } from '@wendellhu/redi';
import { createIdentifier } from '@wendellhu/redi';
-import { type Subject } from 'rxjs';
+import type { Subject } from 'rxjs';
import { type ISidebarMethodOptions } from '../../views/components/sidebar/interface';
export const ISidebarService = createIdentifier<ISidebarService>('univer.sidebar-service');
export interface ISidebarService {
+ readonly sidebarOptions$: Subject<ISidebarMethodOptions>;
+
open(params: ISidebarMethodOptions): IDisposable;
- close(): void;
+ set(params: ISidebarMethodOptions): void;
- getObservableSidebar(): Subject<ISidebarMethodOptions>;
+ close(): void;
}
diff --git a/packages/ui/src/views/components/sidebar/Sidebar.tsx b/packages/ui/src/views/components/sidebar/Sidebar.tsx
index e1587189fe..a685785366 100644
--- a/packages/ui/src/views/components/sidebar/Sidebar.tsx
+++ b/packages/ui/src/views/components/sidebar/Sidebar.tsx
@@ -14,8 +14,7 @@ export function Sidebar() {
const [sidebarOptions, setSidebarOptions] = useState<ISidebarMethodOptions>({});
useEffect(() => {
- const sidebar$ = sidebarService.getObservableSidebar();
- const subscribtion = sidebar$.subscribe((options: ISidebarMethodOptions) => {
+ const subscribtion = sidebarService.sidebarOptions$.subscribe((options: ISidebarMethodOptions) => {
setSidebarOptions(options);
});
@@ -62,8 +61,7 @@ export function Sidebar() {
};
setSidebarOptions(options);
- const sidebar$ = sidebarService.getObservableSidebar();
- sidebar$.next(options);
+ sidebarService.sidebarOptions$.next(options);
options?.onClose?.();
}