@univerjs/docs-ui 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/lib/cjs/index.js +514 -0
  4. package/lib/cjs/locale/en-US.js +26 -0
  5. package/lib/cjs/locale/zh-CN.js +26 -0
  6. package/lib/esm/index.js +500 -0
  7. package/lib/esm/locale/en-US.js +5 -0
  8. package/lib/esm/locale/zh-CN.js +5 -0
  9. package/lib/types/basics/const/default-univer-doc-config.d.ts +65 -0
  10. package/lib/types/basics/const/default-univer-doc-config.d.ts.map +1 -0
  11. package/lib/types/basics/const/index.d.ts +3 -0
  12. package/lib/types/basics/const/index.d.ts.map +1 -0
  13. package/lib/types/basics/const/plugin-name.d.ts +2 -0
  14. package/lib/types/basics/const/plugin-name.d.ts.map +1 -0
  15. package/lib/types/basics/index.d.ts +3 -0
  16. package/lib/types/basics/index.d.ts.map +1 -0
  17. package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts +48 -0
  18. package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts.map +1 -0
  19. package/lib/types/basics/interfaces/component-config/index.d.ts +2 -0
  20. package/lib/types/basics/interfaces/component-config/index.d.ts.map +1 -0
  21. package/lib/types/basics/interfaces/index.d.ts +2 -0
  22. package/lib/types/basics/interfaces/index.d.ts.map +1 -0
  23. package/lib/types/controllers/app-ui-controller.d.ts +20 -0
  24. package/lib/types/controllers/app-ui-controller.d.ts.map +1 -0
  25. package/lib/types/controllers/doc-container-ui-controller.d.ts +31 -0
  26. package/lib/types/controllers/doc-container-ui-controller.d.ts.map +1 -0
  27. package/lib/types/controllers/doc-ui.controller.d.ts +15 -0
  28. package/lib/types/controllers/doc-ui.controller.d.ts.map +1 -0
  29. package/lib/types/controllers/index.d.ts +3 -0
  30. package/lib/types/controllers/index.d.ts.map +1 -0
  31. package/lib/types/controllers/menu/menu.d.ts +7 -0
  32. package/lib/types/controllers/menu/menu.d.ts.map +1 -0
  33. package/lib/types/docs-ui-plugin.d.ts +16 -0
  34. package/lib/types/docs-ui-plugin.d.ts.map +1 -0
  35. package/lib/types/index.d.ts +3 -0
  36. package/lib/types/index.d.ts.map +1 -0
  37. package/lib/types/locale/en-US.d.ts +3 -0
  38. package/lib/types/locale/en-US.d.ts.map +1 -0
  39. package/lib/types/locale/index.d.ts +3 -0
  40. package/lib/types/locale/index.d.ts.map +1 -0
  41. package/lib/types/locale/zh-CN.d.ts +3 -0
  42. package/lib/types/locale/zh-CN.d.ts.map +1 -0
  43. package/lib/types/views/doc-container/DocContainer.d.ts +49 -0
  44. package/lib/types/views/doc-container/DocContainer.d.ts.map +1 -0
  45. package/lib/types/views/doc-container/index.d.ts +2 -0
  46. package/lib/types/views/doc-container/index.d.ts.map +1 -0
  47. package/package.json +64 -0
@@ -0,0 +1,20 @@
1
+ import { LocaleService } from '@univerjs/core';
2
+ import { Injector } from '@wendellhu/redi';
3
+ import type { IDocsUIPluginConfig } from '../basics';
4
+ import { DocContainerUIController } from './doc-container-ui-controller';
5
+ export declare class AppUIController {
6
+ private readonly _localeService;
7
+ private readonly _injector;
8
+ private _docContainerController;
9
+ constructor(_config: IDocsUIPluginConfig, _localeService: LocaleService, _injector: Injector);
10
+ /**
11
+ * Change language
12
+ * @param {String} locale new language
13
+ *
14
+ * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
15
+ *
16
+ */
17
+ changeLocale: (locale: string) => void;
18
+ getDocContainerController(): DocContainerUIController;
19
+ }
20
+ //# sourceMappingURL=app-ui-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-ui-controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/app-ui-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,qBAAa,eAAe;IAKG,OAAO,CAAC,QAAQ,CAAC,cAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IALhD,OAAO,CAAC,uBAAuB,CAA2B;gBAGtD,OAAO,EAAE,mBAAmB,EACY,cAAc,EAAE,aAAa,EAClC,SAAS,EAAE,QAAQ;IAK1D;;;;;;OAMG;IACH,YAAY,WAAY,MAAM,UAE5B;IAEF,yBAAyB;CAG5B"}
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import { LocaleService } from '@univerjs/core';
3
+ import { Injector } from '@wendellhu/redi';
4
+ import type { IDocsUIPluginConfig } from '../basics';
5
+ import type { DocContainer } from '../views/doc-container/DocContainer';
6
+ export declare class DocContainerUIController {
7
+ private readonly _config;
8
+ private readonly _localeService;
9
+ private readonly _injector;
10
+ private _docContainer?;
11
+ constructor(_config: IDocsUIPluginConfig, _localeService: LocaleService, _injector: Injector);
12
+ getUIConfig(): {
13
+ injector: Injector;
14
+ config: IDocsUIPluginConfig;
15
+ changeLocale: (locale: string) => void;
16
+ getComponent: (ref: DocContainer) => void;
17
+ };
18
+ getComponent: (ref: DocContainer) => void;
19
+ /**
20
+ * Change language
21
+ * @param {String} lang new language
22
+ *
23
+ * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
24
+ *
25
+ */
26
+ changeLocale: (locale: string) => void;
27
+ getContentRef(): import("react").RefObject<HTMLDivElement>;
28
+ UIDidMount(cb: Function): any;
29
+ getDocContainer(): DocContainer | undefined;
30
+ }
31
+ //# sourceMappingURL=doc-container-ui-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc-container-ui-controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/doc-container-ui-controller.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,qBAAa,wBAAwB;IAI7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACD,OAAO,CAAC,QAAQ,CAAC,cAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IALhD,OAAO,CAAC,aAAa,CAAC,CAAe;gBAGhB,OAAO,EAAE,mBAAmB,EACL,cAAc,EAAE,aAAa,EAClC,SAAS,EAAE,QAAQ;IAG1D,WAAW;;;;;;IAWX,YAAY,QAAS,YAAY,UAQ/B;IAEF;;;;;;OAMG;IACH,YAAY,WAAY,MAAM,UAE5B;IAEF,aAAa;IAIb,UAAU,CAAC,EAAE,EAAE,QAAQ;IAMvB,eAAe;CAGlB"}
@@ -0,0 +1,15 @@
1
+ import { Disposable, ICommandService } from '@univerjs/core';
2
+ import type { IDesktopUIController } from '@univerjs/ui';
3
+ import { ComponentManager, IMenuService, IShortcutService } from '@univerjs/ui';
4
+ import { Injector } from '@wendellhu/redi';
5
+ export declare class DocUIController extends Disposable {
6
+ private readonly _injector;
7
+ private readonly _componentManager;
8
+ private readonly _commandService;
9
+ private readonly _shortcutService;
10
+ private readonly _menuService;
11
+ private readonly _uiController;
12
+ constructor(_injector: Injector, _componentManager: ComponentManager, _commandService: ICommandService, _shortcutService: IShortcutService, _menuService: IMenuService, _uiController: IDesktopUIController);
13
+ private _init;
14
+ }
15
+ //# sourceMappingURL=doc-ui.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc-ui.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/doc-ui.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAgC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAiB,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAUnD,qBACa,eAAgB,SAAQ,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,eAAe;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa;gBALV,SAAS,EAAE,QAAQ,EACX,iBAAiB,EAAE,gBAAgB,EAC5C,eAAe,EAAE,eAAe,EAC/B,gBAAgB,EAAE,gBAAgB,EACtC,YAAY,EAAE,YAAY,EACzB,aAAa,EAAE,oBAAoB;IAOvE,OAAO,CAAC,KAAK;CAahB"}
@@ -0,0 +1,3 @@
1
+ export * from './app-ui-controller';
2
+ export * from './doc-container-ui-controller';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IMenuButtonItem } from '@univerjs/ui';
2
+ import type { IAccessor } from '@wendellhu/redi';
3
+ export declare function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
4
+ export declare function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
5
+ export declare function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
6
+ export declare function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
7
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/controllers/menu/menu.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,GAAG,eAAe,CASxE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,GAAG,eAAe,CAS1E;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,GAAG,eAAe,CAS7E;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,SAAS,GAAG,eAAe,CASjF"}
@@ -0,0 +1,16 @@
1
+ import { LocaleService, Plugin, PluginType } from '@univerjs/core';
2
+ import { Injector } from '@wendellhu/redi';
3
+ import type { IDocsUIPluginConfig } from './basics';
4
+ export declare class DocsUIPlugin extends Plugin {
5
+ private readonly _config;
6
+ _injector: Injector;
7
+ private readonly _localeService;
8
+ static type: PluginType;
9
+ constructor(_config: IDocsUIPluginConfig, _injector: Injector, _localeService: LocaleService);
10
+ onRendered(): void;
11
+ onDestroy(): void;
12
+ private _initDependencies;
13
+ private _markDocAsFocused;
14
+ private _initModules;
15
+ }
16
+ //# sourceMappingURL=docs-ui-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-ui-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-ui-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,aAAa,EACb,MAAM,EACN,UAAU,EAEb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAOpD,qBAAa,YAAa,SAAQ,MAAM;IAIhC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACG,SAAS,EAAE,QAAQ;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAL1D,OAAgB,IAAI,aAAkB;gBAGjB,OAAO,EAAE,mBAAmB,EAClB,SAAS,EAAE,QAAQ,EACN,cAAc,EAAE,aAAa;IAYhE,UAAU,IAAI,IAAI;IAKlB,SAAS,IAAI,IAAI;IAE1B,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,YAAY;CAGvB"}
@@ -0,0 +1,3 @@
1
+ export * from './basics';
2
+ export * from './docs-ui-plugin';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ //# sourceMappingURL=en-US.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../../src/locale/en-US.ts"],"names":[],"mappings":";AAAA,wBAAkB"}
@@ -0,0 +1,3 @@
1
+ export { default as enUS } from './en-US';
2
+ export { default as zhCN } from './zh-CN';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ //# sourceMappingURL=zh-CN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zh-CN.d.ts","sourceRoot":"","sources":["../../../src/locale/zh-CN.ts"],"names":[],"mappings":";AAAA,wBAAkB"}
@@ -0,0 +1,49 @@
1
+ import type { BaseComponentProps } from '@univerjs/ui';
2
+ import React, { Component } from 'react';
3
+ import type { IDocsUIPluginConfig } from '../../basics';
4
+ export interface BaseDocContainerProps extends BaseComponentProps {
5
+ config: IDocsUIPluginConfig;
6
+ changeLocale: (locale: string) => void;
7
+ methods?: any;
8
+ }
9
+ /**
10
+ * One univerdoc instance DOM container
11
+ */
12
+ export declare class DocContainer extends Component<BaseDocContainerProps> {
13
+ leftContentLeft: number;
14
+ leftContentTop: number;
15
+ rightBorderX: number;
16
+ rightBorderY: number;
17
+ splitLeftRef: React.RefObject<HTMLDivElement>;
18
+ contentRef: React.RefObject<HTMLDivElement>;
19
+ constructor(props: BaseDocContainerProps);
20
+ componentDidMount(): void;
21
+ /**
22
+ * split mouse down
23
+ * @param e
24
+ */
25
+ handleSplitBarMouseDown: (e: React.MouseEvent) => void;
26
+ /**
27
+ * split mouse move
28
+ * @param e
29
+ */
30
+ handleSplitBarMouseMove: (e: MouseEvent) => void;
31
+ /**
32
+ * split mouse up
33
+ * @param e
34
+ */
35
+ handleSplitBarMouseUp: (e: MouseEvent) => void;
36
+ getContentRef(): React.RefObject<HTMLDivElement>;
37
+ getSplitLeftRef(): React.RefObject<HTMLDivElement>;
38
+ /**
39
+ * Modify Dom Skin
40
+ */
41
+ changeSkin(container: HTMLElement | string, skin: string): void;
42
+ /**
43
+ * Render the component's HTML
44
+ *
45
+ * @returns {void}
46
+ */
47
+ render(): React.JSX.Element;
48
+ }
49
+ //# sourceMappingURL=DocContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocContainer.d.ts","sourceRoot":"","sources":["../../../../src/views/doc-container/DocContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC7D,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,GAAG,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS,CAAC,qBAAqB,CAAC;IAC9D,eAAe,EAAE,MAAM,CAAK;IAE5B,cAAc,EAAE,MAAM,CAAK;IAE3B,YAAY,EAAE,MAAM,CAAK;IAEzB,YAAY,EAAE,MAAM,CAAK;IAEzB,YAAY,kCAA+B;IAE3C,UAAU,kCAA+B;gBAE7B,KAAK,EAAE,qBAAqB;IAK/B,iBAAiB;IAI1B;;;OAGG;IACH,uBAAuB,MAAO,gBAAgB,UAU5C;IAEF;;;OAGG;IACH,uBAAuB,MAAO,UAAU,UActC;IAEF;;;OAGG;IACH,qBAAqB,MAAO,UAAU,UAGpC;IAEF,aAAa;IAIb,eAAe;IAIf;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM;IAiDxD;;;;OAIG;IACM,MAAM;CA+DlB"}
@@ -0,0 +1,2 @@
1
+ export * from './DocContainer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/doc-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@univerjs/docs-ui",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "Univer normal ui-plugin-docs",
5
+ "keywords": [],
6
+ "author": "DreamNum <developer@univer.ai>",
7
+ "license": "MIT",
8
+ "main": "./lib/cjs/index.js",
9
+ "module": "./lib/esm/index.js",
10
+ "types": "./lib/types/index.d.ts",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./lib/esm/index.js",
17
+ "require": "./lib/cjs/index.js",
18
+ "types": "./lib/types/index.d.ts"
19
+ },
20
+ "./*": {
21
+ "import": "./lib/esm/*",
22
+ "require": "./lib/cjs/*",
23
+ "types": "./lib/types/index.d.ts"
24
+ },
25
+ "./locale/*": {
26
+ "import": "./lib/esm/locale/*.js",
27
+ "require": "./lib/cjs/locale/*.js",
28
+ "types": "./lib/types/index.d.ts"
29
+ }
30
+ },
31
+ "directories": {
32
+ "lib": "lib"
33
+ },
34
+ "files": [
35
+ "lib"
36
+ ],
37
+ "private": false,
38
+ "dependencies": {
39
+ "@wendellhu/redi": "^0.12.11",
40
+ "@univerjs/docs": "0.1.0-alpha.1",
41
+ "@univerjs/ui": "0.1.0-alpha.1",
42
+ "@univerjs/design": "0.1.0-alpha.1",
43
+ "@univerjs/core": "0.1.0-alpha.1",
44
+ "@univerjs/engine-render": "0.1.0-alpha.1"
45
+ },
46
+ "devDependencies": {
47
+ "@types/react": "^18.2.41",
48
+ "@vitest/coverage-istanbul": "^0.34.6",
49
+ "esbuild": "^0.19.8",
50
+ "happy-dom": "^12.10.3",
51
+ "less": "^4.2.0",
52
+ "react": "^18.2.0",
53
+ "ts-node": "^10.9.1",
54
+ "typescript": "^5.3.2",
55
+ "vitest": "^0.34.6"
56
+ },
57
+ "peerDependencies": {
58
+ "react": ">=16.9.0"
59
+ },
60
+ "scripts": {
61
+ "test": "vitest run",
62
+ "esbuild": "node ./esbuild.config.mjs && tsc -p tsconfig.esbuild.json"
63
+ }
64
+ }