@univerjs/docs-ui 0.1.0-beta.1 → 0.1.0-beta.3
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.
- package/{LICENSE.txt → LICENSE} +0 -2
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +389 -137
- package/lib/types/components/color-picker/index.d.ts +17 -0
- package/lib/types/components/color-picker/interface.d.ts +16 -0
- package/lib/types/components/const.d.ts +16 -0
- package/lib/types/components/font-family/index.d.ts +18 -0
- package/lib/types/components/font-family/interface.d.ts +17 -0
- package/lib/types/components/font-size/index.d.ts +17 -0
- package/lib/types/components/font-size/interface.d.ts +16 -0
- package/lib/types/controllers/doc-ui.controller.d.ts +2 -0
- package/lib/types/controllers/menu/menu.d.ts +4 -1
- package/lib/types/locale/en-US.d.ts +20 -1
- package/lib/types/locale/zh-CN.d.ts +21 -1
- package/lib/types/views/doc-container/DocContainer.d.ts +1 -3
- package/lib/umd/index.js +1 -1
- package/package.json +40 -37
package/{LICENSE.txt → LICENSE}
RENAMED
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var D=(e,t,n)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var d=(e,t,n)=>(D(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),a=require("@wendellhu/redi"),r=require("@univerjs/ui"),l=require("@univerjs/docs"),v={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},C={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},M={layout:{docContainerConfig:C,toolbarConfig:v}},S="DocUI";var b=Object.defineProperty,R=Object.getOwnPropertyDescriptor,y=(e,t,n,o)=>{for(var i=o>1?void 0:o?R(t,n):t,s=e.length-1,u;s>=0;s--)(u=e[s])&&(i=(o?u(t,n,i):u(i))||i);return o&&i&&b(t,n,i),i},f=(e,t)=>(n,o)=>t(n,o,e);let T=class{constructor(e,t,n){d(this,"_docContainer");d(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});d(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=t,this._injector=n}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};T=y([f(1,a.Inject(c.LocaleService)),f(2,a.Inject(a.Injector))],T);var A=Object.defineProperty,L=Object.getOwnPropertyDescriptor,P=(e,t,n,o)=>{for(var i=o>1?void 0:o?L(t,n):t,s=e.length-1,u;s>=0;s--)(u=e[s])&&(i=(o?u(t,n,i):u(i))||i);return o&&i&&A(t,n,i),i},I=(e,t)=>(n,o)=>t(n,o,e);let _=class{constructor(e,t,n){d(this,"_docContainerController");d(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=t,this._injector=n,this._docContainerController=this._injector.createInstance(T,e)}getDocContainerController(){return this._docContainerController}};_=P([I(1,a.Inject(c.LocaleService)),I(2,a.Inject(a.Injector))],_);function j(e){return{id:l.SetInlineFormatBoldCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function B(e){return{id:l.SetInlineFormatItalicCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function F(e){return{id:l.SetInlineFormatUnderlineCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function $(e){return{id:l.SetInlineFormatStrikethroughCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function N(e){return{id:l.SetInlineFormatSubscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function w(e){return{id:l.SetInlineFormatSuperscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function H(e){return{id:l.OrderListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.superscript",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function G(e){return{id:l.BulletListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.superscript",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}var E=Object.defineProperty,z=Object.getOwnPropertyDescriptor,x=(e,t,n,o)=>{for(var i=o>1?void 0:o?z(t,n):t,s=e.length-1,u;s>=0;s--)(u=e[s])&&(i=(o?u(t,n,i):u(i))||i);return o&&i&&E(t,n,i),i},p=(e,t)=>(n,o)=>t(n,o,e);let O=class extends c.Disposable{constructor(e,t,n,o,i,s){super(),this._injector=e,this._componentManager=t,this._commandService=n,this._shortcutService=o,this._menuService=i,this._uiController=s,this._init()}_init(){[j,B,F,$,N,w,H,G].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}};O=x([c.OnLifecycle(c.LifecycleStages.Rendered,O),p(0,a.Inject(a.Injector)),p(1,a.Inject(r.ComponentManager)),p(2,c.ICommandService),p(3,r.IShortcutService),p(4,r.IMenuService),p(5,r.IUIController)],O);const q={},m={};var Y=Object.defineProperty,K=Object.getOwnPropertyDescriptor,W=(e,t,n,o)=>{for(var i=o>1?void 0:o?K(t,n):t,s=e.length-1,u;s>=0;s--)(u=e[s])&&(i=(o?u(t,n,i):u(i))||i);return o&&i&&Y(t,n,i),i},g=(e,t)=>(n,o)=>t(n,o,e),h;exports.UniverDocsUIPlugin=(h=class extends c.Plugin{constructor(t,n,o,i){super(S),this._config=t,this._injector=n,this._localeService=o,this._logService=i,this._localeService.load({zhCN:m}),this._config=c.Tools.deepMerge({},M,this._config),this._initDependencies(n)}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initDependencies(t){[[O],[_,{useFactory:()=>this._injector.createInstance(_,this._config)}]].forEach(o=>{t.add(o)})}_markDocAsFocused(){const t=this._injector.get(c.IUniverInstanceService);try{const n=t.getCurrentUniverDocInstance(),o=n.getUnitId();o!==c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&o!==c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&t.focusUniverInstance(n.getUnitId())}catch(n){this._logService.warn(n)}}_initModules(){this._injector.get(_)}},d(h,"type",c.PluginType.Doc),h);exports.UniverDocsUIPlugin=W([g(1,a.Inject(a.Injector)),g(2,a.Inject(c.LocaleService)),g(3,c.ILogService)],exports.UniverDocsUIPlugin);exports.DOC_UI_PLUGIN_NAME=S;exports.DefaultDocContainerConfig=C;exports.DefaultDocUiConfig=M;exports.DefaultToolbarConfig=v;exports.enUS=q;exports.zhCN=m;
|
|
1
|
+
"use strict";var N=Object.defineProperty;var B=(e,n,t)=>n in e?N(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var T=(e,n,t)=>(B(e,typeof n!="symbol"?n+"":n,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),m=require("@wendellhu/redi"),r=require("@univerjs/ui"),l=require("@univerjs/docs"),p=require("rxjs"),$=require("@univerjs/design"),b={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},F={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},U={layout:{docContainerConfig:F,toolbarConfig:b}},L="DocUI";var j=Object.defineProperty,w=Object.getOwnPropertyDescriptor,z=(e,n,t,o)=>{for(var i=o>1?void 0:o?w(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&j(n,t,i),i},M=(e,n)=>(t,o)=>n(t,o,e);let h=class{constructor(e,n,t){T(this,"_docContainer");T(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});T(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=n,this._injector=t}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};h=z([M(1,m.Inject(a.LocaleService)),M(2,m.Inject(m.Injector))],h);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,Y=(e,n,t,o)=>{for(var i=o>1?void 0:o?H(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&G(n,t,i),i},R=(e,n)=>(t,o)=>n(t,o,e);let C=class{constructor(e,n,t){T(this,"_docContainerController");T(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=n,this._injector=t,this._docContainerController=this._injector.createInstance(h,e)}getDocContainerController(){return this._docContainerController}};C=Y([R(1,m.Inject(a.LocaleService)),R(2,m.Inject(m.Injector))],C);const v="UI_PLUGIN_DOCS",x=`${v}_COLOR_PICKER_COMPONENT`,A=`${v}_FONT_FAMILY_COMPONENT`,y=`${v}_FONT_FAMILY_ITEM_COMPONENT`,D=`${v}_FONT_SIZE_COMPONENT`;function q(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatBoldCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.bl;t.next(d===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function W(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatItalicCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.it;t.next(d===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Z(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatUnderlineCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.ul;t.next((d==null?void 0:d.s)===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function K(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatStrikethroughCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.st;t.next((d==null?void 0:d.s)===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function V(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatSubscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.va;t.next(d===a.BaselineOffset.SUBSCRIPT)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function X(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatSuperscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[r.MenuPosition.TOOLBAR_START],activated$:new p.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=O(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.va;t.next(d===a.BaselineOffset.SUPERSCRIPT)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function J(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.SELECTOR,label:A,positions:[r.MenuPosition.TOOLBAR_START],selections:r.FONT_FAMILY_LIST.map(t=>({label:{name:y,hoverable:!0},value:t.value})),value$:new p.Observable(t=>{const o=r.FONT_FAMILY_LIST[0].value,i=n.onCommandExecuted(c=>{var u;const s=c.id;if(s===l.SetTextSelectionsOperation.id||s===l.SetInlineFormatFontFamilyCommand.id){const d=O(e);if(d==null)return;const S=(u=d.ts)==null?void 0:u.ff;t.next(S??o)}});return t.next(o),i.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Q(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatFontSizeCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:D,props:{min:1,max:400}},positions:[r.MenuPosition.TOOLBAR_START],selections:r.FONT_SIZE_LIST,value$:new p.Observable(t=>{const i=n.onCommandExecuted(c=>{var u;const s=c.id;if(s===l.SetTextSelectionsOperation.id||s===l.SetInlineFormatFontSizeCommand.id){const d=O(e);if(d==null)return;const S=(u=d.ts)==null?void 0:u.fs;t.next(S??14)}});return t.next(14),i.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function k(e){const n=e.get(a.ICommandService),t=e.get(a.ThemeService);return{id:l.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON_SELECTOR,positions:[r.MenuPosition.TOOLBAR_START],selections:[{label:{name:x,hoverable:!1}}],value$:new p.Observable(o=>{const i=t.getCurrentTheme().textColor,c=n.onCommandExecuted(s=>{if(s.id===l.SetInlineFormatTextColorCommand.id){const u=s.params.value;o.next(u??i)}});return o.next(i),c.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function ee(e){return{id:l.OrderListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function te(e){return{id:l.BulletListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function O(e){var d;const n=e.get(a.IUniverInstanceService),t=e.get(l.TextSelectionManagerService),o=n.getCurrentUniverDocInstance(),i=t.getActiveRange();if(o==null||i==null)return;const c=(d=o.getBody())==null?void 0:d.textRuns;if(c==null)return;const{startOffset:s}=i;return c.find(({st:S,ed:E})=>s>=S&&s<E)}var ne=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,ie=(e,n,t,o)=>{for(var i=o>1?void 0:o?oe(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&ne(n,t,i),i},_=(e,n)=>(t,o)=>n(t,o,e);let I=class extends a.Disposable{constructor(e,n,t,o,i,c){super(),this._injector=e,this._componentManager=n,this._commandService=t,this._shortcutService=o,this._menuService=i,this._uiController=c,this._init()}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register(x,$.ColorPicker)),this.disposeWithMe(e.register(A,r.FontFamily)),this.disposeWithMe(e.register(y,r.FontFamilyItem)),this.disposeWithMe(e.register(D,r.FontSize))}_initMenus(){[q,W,Z,K,V,X,Q,J,k,ee,te].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}_init(){this._initCustomComponents(),this._initMenus()}};I=ie([a.OnLifecycle(a.LifecycleStages.Rendered,I),_(0,m.Inject(m.Injector)),_(1,m.Inject(r.ComponentManager)),_(2,a.ICommandService),_(3,r.IShortcutService),_(4,r.IMenuService),_(5,r.IUIController)],I);const re={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",textColor:{main:"Text color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list"}},P={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表"}};var se=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,ae=(e,n,t,o)=>{for(var i=o>1?void 0:o?ce(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&se(n,t,i),i},f=(e,n)=>(t,o)=>n(t,o,e),g;exports.UniverDocsUIPlugin=(g=class extends a.Plugin{constructor(n,t,o,i){super(L),this._config=n,this._injector=t,this._localeService=o,this._logService=i,this._localeService.load({zhCN:P}),this._config=a.Tools.deepMerge({},U,this._config),this._initDependencies(t)}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initDependencies(n){[[I],[C,{useFactory:()=>this._injector.createInstance(C,this._config)}]].forEach(o=>{n.add(o)})}_markDocAsFocused(){const n=this._injector.get(a.IUniverInstanceService);try{const t=n.getCurrentUniverDocInstance(),o=t.getUnitId();o!==a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&o!==a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&n.focusUniverInstance(t.getUnitId())}catch(t){this._logService.warn(t)}}_initModules(){this._injector.get(C)}},T(g,"type",a.PluginType.Doc),g);exports.UniverDocsUIPlugin=ae([f(1,m.Inject(m.Injector)),f(2,m.Inject(a.LocaleService)),f(3,a.ILogService)],exports.UniverDocsUIPlugin);exports.DOC_UI_PLUGIN_NAME=L;exports.DefaultDocContainerConfig=F;exports.DefaultDocUiConfig=U;exports.DefaultToolbarConfig=b;exports.enUS=re;exports.zhCN=P;
|
package/lib/es/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { LocaleService as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { MenuGroup as
|
|
7
|
-
import { SetInlineFormatBoldCommand as
|
|
8
|
-
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var G = (e, n, t) => n in e ? K(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var S = (e, n, t) => (G(e, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import { LocaleService as U, ICommandService as O, BooleanNumber as M, UniverInstanceType as a, BaselineOffset as j, ThemeService as V, IUniverInstanceService as w, Disposable as X, OnLifecycle as q, LifecycleStages as J, Plugin as Q, Tools as k, PluginType as ee, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as te, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ne, ILogService as oe } from "@univerjs/core";
|
|
5
|
+
import { Inject as f, Injector as F } from "@wendellhu/redi";
|
|
6
|
+
import { MenuGroup as d, MenuItemType as u, MenuPosition as _, getMenuHiddenObservable as p, FONT_FAMILY_LIST as E, FONT_SIZE_LIST as ie, FontFamily as re, FontFamilyItem as se, FontSize as ce, ComponentManager as le, IShortcutService as ae, IMenuService as de, IUIController as ue } from "@univerjs/ui";
|
|
7
|
+
import { SetInlineFormatBoldCommand as _e, SetTextSelectionsOperation as T, SetInlineFormatCommand as g, SetInlineFormatItalicCommand as pe, SetInlineFormatUnderlineCommand as Oe, SetInlineFormatStrikethroughCommand as me, SetInlineFormatSubscriptCommand as fe, SetInlineFormatSuperscriptCommand as Te, SetInlineFormatFontFamilyCommand as B, SetInlineFormatFontSizeCommand as N, SetInlineFormatTextColorCommand as P, OrderListCommand as Ce, BulletListCommand as Se, TextSelectionManagerService as he } from "@univerjs/docs";
|
|
8
|
+
import { Observable as m } from "rxjs";
|
|
9
|
+
import { ColorPicker as ge } from "@univerjs/design";
|
|
10
|
+
const ve = {
|
|
9
11
|
undo: !0,
|
|
10
12
|
redo: !0,
|
|
11
13
|
// Undo redo
|
|
@@ -33,7 +35,7 @@ const V = {
|
|
|
33
35
|
// 'Wrap mode'
|
|
34
36
|
textRotateMode: !0
|
|
35
37
|
// 'Text Rotation Mode'
|
|
36
|
-
},
|
|
38
|
+
}, Re = {
|
|
37
39
|
outerLeft: !1,
|
|
38
40
|
outerRight: !1,
|
|
39
41
|
header: !0,
|
|
@@ -46,22 +48,22 @@ const V = {
|
|
|
46
48
|
frozenContent: !1,
|
|
47
49
|
infoBar: !0,
|
|
48
50
|
toolbar: !0
|
|
49
|
-
},
|
|
51
|
+
}, Ie = {
|
|
50
52
|
layout: {
|
|
51
|
-
docContainerConfig:
|
|
52
|
-
toolbarConfig:
|
|
53
|
+
docContainerConfig: Re,
|
|
54
|
+
toolbarConfig: ve
|
|
53
55
|
}
|
|
54
|
-
},
|
|
55
|
-
var
|
|
56
|
-
for (var
|
|
57
|
-
(
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
let
|
|
61
|
-
constructor(e,
|
|
62
|
-
|
|
56
|
+
}, Me = "DocUI";
|
|
57
|
+
var Fe = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, Le = (e, n, t, i) => {
|
|
58
|
+
for (var o = i > 1 ? void 0 : i ? Ae(n, t) : n, s = e.length - 1, r; s >= 0; s--)
|
|
59
|
+
(r = e[s]) && (o = (i ? r(n, t, o) : r(o)) || o);
|
|
60
|
+
return i && o && Fe(n, t, o), o;
|
|
61
|
+
}, b = (e, n) => (t, i) => n(t, i, e);
|
|
62
|
+
let D = class {
|
|
63
|
+
constructor(e, n, t) {
|
|
64
|
+
S(this, "_docContainer");
|
|
63
65
|
// 获取SheetContainer组件
|
|
64
|
-
|
|
66
|
+
S(this, "getComponent", (e) => {
|
|
65
67
|
if (this._docContainer = e, !e.getContentRef().current)
|
|
66
68
|
throw new Error("container is not ready");
|
|
67
69
|
});
|
|
@@ -72,10 +74,10 @@ let S = class {
|
|
|
72
74
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
73
75
|
*
|
|
74
76
|
*/
|
|
75
|
-
|
|
77
|
+
S(this, "changeLocale", (e) => {
|
|
76
78
|
this._localeService.setLocale(e);
|
|
77
79
|
});
|
|
78
|
-
this._config = e, this._localeService =
|
|
80
|
+
this._config = e, this._localeService = n, this._injector = t;
|
|
79
81
|
}
|
|
80
82
|
getUIConfig() {
|
|
81
83
|
return {
|
|
@@ -96,18 +98,18 @@ let S = class {
|
|
|
96
98
|
return this._docContainer;
|
|
97
99
|
}
|
|
98
100
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
var
|
|
104
|
-
for (var
|
|
105
|
-
(
|
|
106
|
-
return
|
|
107
|
-
},
|
|
108
|
-
let
|
|
109
|
-
constructor(e,
|
|
110
|
-
|
|
101
|
+
D = Le([
|
|
102
|
+
b(1, f(U)),
|
|
103
|
+
b(2, f(F))
|
|
104
|
+
], D);
|
|
105
|
+
var xe = Object.defineProperty, De = Object.getOwnPropertyDescriptor, Ue = (e, n, t, i) => {
|
|
106
|
+
for (var o = i > 1 ? void 0 : i ? De(n, t) : n, s = e.length - 1, r; s >= 0; s--)
|
|
107
|
+
(r = e[s]) && (o = (i ? r(n, t, o) : r(o)) || o);
|
|
108
|
+
return i && o && xe(n, t, o), o;
|
|
109
|
+
}, y = (e, n) => (t, i) => n(t, i, e);
|
|
110
|
+
let R = class {
|
|
111
|
+
constructor(e, n, t) {
|
|
112
|
+
S(this, "_docContainerController");
|
|
111
113
|
/**
|
|
112
114
|
* Change language
|
|
113
115
|
* @param {String} locale new language
|
|
@@ -115,155 +117,405 @@ let O = class {
|
|
|
115
117
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
116
118
|
*
|
|
117
119
|
*/
|
|
118
|
-
|
|
120
|
+
S(this, "changeLocale", (e) => {
|
|
119
121
|
this._localeService.setLocale(e);
|
|
120
122
|
});
|
|
121
|
-
this._localeService =
|
|
123
|
+
this._localeService = n, this._injector = t, this._docContainerController = this._injector.createInstance(D, e);
|
|
122
124
|
}
|
|
123
125
|
getDocContainerController() {
|
|
124
126
|
return this._docContainerController;
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
],
|
|
131
|
-
|
|
129
|
+
R = Ue([
|
|
130
|
+
y(1, f(U)),
|
|
131
|
+
y(2, f(F))
|
|
132
|
+
], R);
|
|
133
|
+
const A = "UI_PLUGIN_DOCS", z = `${A}_COLOR_PICKER_COMPONENT`, Y = `${A}_FONT_FAMILY_COMPONENT`, W = `${A}_FONT_FAMILY_ITEM_COMPONENT`, Z = `${A}_FONT_SIZE_COMPONENT`;
|
|
134
|
+
function Ee(e) {
|
|
135
|
+
const n = e.get(O);
|
|
132
136
|
return {
|
|
133
|
-
id:
|
|
134
|
-
group:
|
|
137
|
+
id: _e.id,
|
|
138
|
+
group: d.TOOLBAR_FORMAT,
|
|
135
139
|
type: u.BUTTON,
|
|
136
140
|
icon: "BoldSingle",
|
|
137
141
|
title: "Set bold",
|
|
138
142
|
tooltip: "toolbar.bold",
|
|
139
143
|
positions: [_.TOOLBAR_START],
|
|
140
|
-
|
|
144
|
+
activated$: new m((t) => {
|
|
145
|
+
const i = n.onCommandExecuted((o) => {
|
|
146
|
+
var r;
|
|
147
|
+
const s = o.id;
|
|
148
|
+
if (s === T.id || s === g.id) {
|
|
149
|
+
const c = C(e);
|
|
150
|
+
if (c == null)
|
|
151
|
+
return;
|
|
152
|
+
const l = (r = c.ts) == null ? void 0 : r.bl;
|
|
153
|
+
t.next(l === M.TRUE);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return t.next(!1), i.dispose;
|
|
157
|
+
}),
|
|
158
|
+
hidden$: p(e, a.DOC)
|
|
141
159
|
};
|
|
142
160
|
}
|
|
143
|
-
function
|
|
161
|
+
function Be(e) {
|
|
162
|
+
const n = e.get(O);
|
|
144
163
|
return {
|
|
145
|
-
id:
|
|
146
|
-
group:
|
|
164
|
+
id: pe.id,
|
|
165
|
+
group: d.TOOLBAR_FORMAT,
|
|
147
166
|
type: u.BUTTON,
|
|
148
167
|
icon: "ItalicSingle",
|
|
149
168
|
title: "Set italic",
|
|
150
169
|
tooltip: "toolbar.italic",
|
|
151
170
|
positions: [_.TOOLBAR_START],
|
|
152
|
-
|
|
171
|
+
activated$: new m((t) => {
|
|
172
|
+
const i = n.onCommandExecuted((o) => {
|
|
173
|
+
var r;
|
|
174
|
+
const s = o.id;
|
|
175
|
+
if (s === T.id || s === g.id) {
|
|
176
|
+
const c = C(e);
|
|
177
|
+
if (c == null)
|
|
178
|
+
return;
|
|
179
|
+
const l = (r = c.ts) == null ? void 0 : r.it;
|
|
180
|
+
t.next(l === M.TRUE);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return t.next(!1), i.dispose;
|
|
184
|
+
}),
|
|
185
|
+
hidden$: p(e, a.DOC)
|
|
153
186
|
};
|
|
154
187
|
}
|
|
155
|
-
function
|
|
188
|
+
function Ne(e) {
|
|
189
|
+
const n = e.get(O);
|
|
156
190
|
return {
|
|
157
|
-
id:
|
|
158
|
-
group:
|
|
191
|
+
id: Oe.id,
|
|
192
|
+
group: d.TOOLBAR_FORMAT,
|
|
159
193
|
type: u.BUTTON,
|
|
160
194
|
icon: "UnderlineSingle",
|
|
161
195
|
title: "Set underline",
|
|
162
196
|
tooltip: "toolbar.underline",
|
|
163
197
|
positions: [_.TOOLBAR_START],
|
|
164
|
-
|
|
198
|
+
activated$: new m((t) => {
|
|
199
|
+
const i = n.onCommandExecuted((o) => {
|
|
200
|
+
var r;
|
|
201
|
+
const s = o.id;
|
|
202
|
+
if (s === T.id || s === g.id) {
|
|
203
|
+
const c = C(e);
|
|
204
|
+
if (c == null)
|
|
205
|
+
return;
|
|
206
|
+
const l = (r = c.ts) == null ? void 0 : r.ul;
|
|
207
|
+
t.next((l == null ? void 0 : l.s) === M.TRUE);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
return t.next(!1), i.dispose;
|
|
211
|
+
}),
|
|
212
|
+
hidden$: p(e, a.DOC)
|
|
165
213
|
};
|
|
166
214
|
}
|
|
167
|
-
function
|
|
215
|
+
function Pe(e) {
|
|
216
|
+
const n = e.get(O);
|
|
168
217
|
return {
|
|
169
|
-
id:
|
|
170
|
-
group:
|
|
218
|
+
id: me.id,
|
|
219
|
+
group: d.TOOLBAR_FORMAT,
|
|
171
220
|
type: u.BUTTON,
|
|
172
221
|
icon: "StrikethroughSingle",
|
|
173
222
|
title: "Set strike through",
|
|
174
223
|
tooltip: "toolbar.strikethrough",
|
|
175
224
|
positions: [_.TOOLBAR_START],
|
|
176
|
-
|
|
225
|
+
activated$: new m((t) => {
|
|
226
|
+
const i = n.onCommandExecuted((o) => {
|
|
227
|
+
var r;
|
|
228
|
+
const s = o.id;
|
|
229
|
+
if (s === T.id || s === g.id) {
|
|
230
|
+
const c = C(e);
|
|
231
|
+
if (c == null)
|
|
232
|
+
return;
|
|
233
|
+
const l = (r = c.ts) == null ? void 0 : r.st;
|
|
234
|
+
t.next((l == null ? void 0 : l.s) === M.TRUE);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return t.next(!1), i.dispose;
|
|
238
|
+
}),
|
|
239
|
+
hidden$: p(e, a.DOC)
|
|
177
240
|
};
|
|
178
241
|
}
|
|
179
|
-
function
|
|
242
|
+
function be(e) {
|
|
243
|
+
const n = e.get(O);
|
|
180
244
|
return {
|
|
181
|
-
id:
|
|
182
|
-
group:
|
|
245
|
+
id: fe.id,
|
|
246
|
+
group: d.TOOLBAR_FORMAT,
|
|
183
247
|
type: u.BUTTON,
|
|
184
248
|
icon: "SubscriptSingle",
|
|
185
249
|
tooltip: "toolbar.subscript",
|
|
186
250
|
positions: [_.TOOLBAR_START],
|
|
187
|
-
|
|
251
|
+
activated$: new m((t) => {
|
|
252
|
+
const i = n.onCommandExecuted((o) => {
|
|
253
|
+
var r;
|
|
254
|
+
const s = o.id;
|
|
255
|
+
if (s === T.id || s === g.id) {
|
|
256
|
+
const c = C(e);
|
|
257
|
+
if (c == null)
|
|
258
|
+
return;
|
|
259
|
+
const l = (r = c.ts) == null ? void 0 : r.va;
|
|
260
|
+
t.next(l === j.SUBSCRIPT);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return t.next(!1), i.dispose;
|
|
264
|
+
}),
|
|
265
|
+
hidden$: p(e, a.DOC)
|
|
188
266
|
};
|
|
189
267
|
}
|
|
190
|
-
function
|
|
268
|
+
function ye(e) {
|
|
269
|
+
const n = e.get(O);
|
|
191
270
|
return {
|
|
192
|
-
id:
|
|
193
|
-
group:
|
|
271
|
+
id: Te.id,
|
|
272
|
+
group: d.TOOLBAR_FORMAT,
|
|
194
273
|
type: u.BUTTON,
|
|
195
274
|
icon: "SuperscriptSingle",
|
|
196
275
|
tooltip: "toolbar.superscript",
|
|
197
276
|
positions: [_.TOOLBAR_START],
|
|
198
|
-
|
|
277
|
+
activated$: new m((t) => {
|
|
278
|
+
const i = n.onCommandExecuted((o) => {
|
|
279
|
+
var r;
|
|
280
|
+
const s = o.id;
|
|
281
|
+
if (s === T.id || s === g.id) {
|
|
282
|
+
const c = C(e);
|
|
283
|
+
if (c == null)
|
|
284
|
+
return;
|
|
285
|
+
const l = (r = c.ts) == null ? void 0 : r.va;
|
|
286
|
+
t.next(l === j.SUPERSCRIPT);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return t.next(!1), i.dispose;
|
|
290
|
+
}),
|
|
291
|
+
hidden$: p(e, a.DOC)
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function $e(e) {
|
|
295
|
+
const n = e.get(O);
|
|
296
|
+
return {
|
|
297
|
+
id: B.id,
|
|
298
|
+
tooltip: "toolbar.font",
|
|
299
|
+
group: d.TOOLBAR_FORMAT,
|
|
300
|
+
type: u.SELECTOR,
|
|
301
|
+
label: Y,
|
|
302
|
+
positions: [_.TOOLBAR_START],
|
|
303
|
+
selections: E.map((t) => ({
|
|
304
|
+
label: {
|
|
305
|
+
name: W,
|
|
306
|
+
hoverable: !0
|
|
307
|
+
},
|
|
308
|
+
value: t.value
|
|
309
|
+
})),
|
|
310
|
+
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
311
|
+
value$: new m((t) => {
|
|
312
|
+
const i = E[0].value, o = n.onCommandExecuted((s) => {
|
|
313
|
+
var c;
|
|
314
|
+
const r = s.id;
|
|
315
|
+
if (r === T.id || r === B.id) {
|
|
316
|
+
const l = C(e);
|
|
317
|
+
if (l == null)
|
|
318
|
+
return;
|
|
319
|
+
const v = (c = l.ts) == null ? void 0 : c.ff;
|
|
320
|
+
t.next(v ?? i);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
return t.next(i), o.dispose;
|
|
324
|
+
}),
|
|
325
|
+
hidden$: p(e, a.DOC)
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function je(e) {
|
|
329
|
+
const n = e.get(O);
|
|
330
|
+
return {
|
|
331
|
+
id: N.id,
|
|
332
|
+
group: d.TOOLBAR_FORMAT,
|
|
333
|
+
type: u.SELECTOR,
|
|
334
|
+
tooltip: "toolbar.fontSize",
|
|
335
|
+
label: {
|
|
336
|
+
name: Z,
|
|
337
|
+
props: {
|
|
338
|
+
min: 1,
|
|
339
|
+
max: 400
|
|
340
|
+
// disabled$,
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
positions: [_.TOOLBAR_START],
|
|
344
|
+
selections: ie,
|
|
345
|
+
// disabled$,
|
|
346
|
+
value$: new m((t) => {
|
|
347
|
+
const o = n.onCommandExecuted((s) => {
|
|
348
|
+
var c;
|
|
349
|
+
const r = s.id;
|
|
350
|
+
if (r === T.id || r === N.id) {
|
|
351
|
+
const l = C(e);
|
|
352
|
+
if (l == null)
|
|
353
|
+
return;
|
|
354
|
+
const v = (c = l.ts) == null ? void 0 : c.fs;
|
|
355
|
+
t.next(v ?? 14);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return t.next(14), o.dispose;
|
|
359
|
+
}),
|
|
360
|
+
hidden$: p(e, a.DOC)
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function we(e) {
|
|
364
|
+
const n = e.get(O), t = e.get(V);
|
|
365
|
+
return {
|
|
366
|
+
id: P.id,
|
|
367
|
+
icon: "FontColor",
|
|
368
|
+
tooltip: "toolbar.textColor.main",
|
|
369
|
+
group: d.TOOLBAR_FORMAT,
|
|
370
|
+
type: u.BUTTON_SELECTOR,
|
|
371
|
+
positions: [_.TOOLBAR_START],
|
|
372
|
+
selections: [
|
|
373
|
+
{
|
|
374
|
+
label: {
|
|
375
|
+
name: z,
|
|
376
|
+
hoverable: !1
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
value$: new m((i) => {
|
|
381
|
+
const o = t.getCurrentTheme().textColor, s = n.onCommandExecuted((r) => {
|
|
382
|
+
if (r.id === P.id) {
|
|
383
|
+
const c = r.params.value;
|
|
384
|
+
i.next(c ?? o);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
return i.next(o), s.dispose;
|
|
388
|
+
}),
|
|
389
|
+
hidden$: p(e, a.DOC)
|
|
390
|
+
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
199
391
|
};
|
|
200
392
|
}
|
|
201
|
-
function
|
|
393
|
+
function ze(e) {
|
|
202
394
|
return {
|
|
203
|
-
id:
|
|
204
|
-
group:
|
|
395
|
+
id: Ce.id,
|
|
396
|
+
group: d.TOOLBAR_LAYOUT,
|
|
205
397
|
type: u.BUTTON,
|
|
206
398
|
icon: "OrderSingle",
|
|
207
|
-
tooltip: "toolbar.
|
|
399
|
+
tooltip: "toolbar.order",
|
|
208
400
|
positions: [_.TOOLBAR_START],
|
|
209
|
-
hidden$:
|
|
401
|
+
hidden$: p(e, a.DOC)
|
|
210
402
|
};
|
|
211
403
|
}
|
|
212
|
-
function
|
|
404
|
+
function Ye(e) {
|
|
213
405
|
return {
|
|
214
|
-
id:
|
|
215
|
-
group:
|
|
406
|
+
id: Se.id,
|
|
407
|
+
group: d.TOOLBAR_LAYOUT,
|
|
216
408
|
type: u.BUTTON,
|
|
217
409
|
icon: "UnorderSingle",
|
|
218
|
-
tooltip: "toolbar.
|
|
410
|
+
tooltip: "toolbar.unorder",
|
|
219
411
|
positions: [_.TOOLBAR_START],
|
|
220
|
-
hidden$:
|
|
412
|
+
hidden$: p(e, a.DOC)
|
|
221
413
|
};
|
|
222
414
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
415
|
+
function C(e) {
|
|
416
|
+
var l;
|
|
417
|
+
const n = e.get(w), t = e.get(he), i = n.getCurrentUniverDocInstance(), o = t.getActiveRange();
|
|
418
|
+
if (i == null || o == null)
|
|
419
|
+
return;
|
|
420
|
+
const s = (l = i.getBody()) == null ? void 0 : l.textRuns;
|
|
421
|
+
if (s == null)
|
|
422
|
+
return;
|
|
423
|
+
const { startOffset: r } = o;
|
|
424
|
+
return s.find(({ st: v, ed: H }) => r >= v && r < H);
|
|
425
|
+
}
|
|
426
|
+
var We = Object.defineProperty, Ze = Object.getOwnPropertyDescriptor, He = (e, n, t, i) => {
|
|
427
|
+
for (var o = i > 1 ? void 0 : i ? Ze(n, t) : n, s = e.length - 1, r; s >= 0; s--)
|
|
428
|
+
(r = e[s]) && (o = (i ? r(n, t, o) : r(o)) || o);
|
|
429
|
+
return i && o && We(n, t, o), o;
|
|
430
|
+
}, h = (e, n) => (t, i) => n(t, i, e);
|
|
431
|
+
let I = class extends X {
|
|
432
|
+
constructor(e, n, t, i, o, s) {
|
|
433
|
+
super(), this._injector = e, this._componentManager = n, this._commandService = t, this._shortcutService = i, this._menuService = o, this._uiController = s, this._init();
|
|
231
434
|
}
|
|
232
|
-
|
|
435
|
+
_initCustomComponents() {
|
|
436
|
+
const e = this._componentManager;
|
|
437
|
+
this.disposeWithMe(e.register(z, ge)), this.disposeWithMe(e.register(Y, re)), this.disposeWithMe(e.register(W, se)), this.disposeWithMe(e.register(Z, ce));
|
|
438
|
+
}
|
|
439
|
+
_initMenus() {
|
|
233
440
|
[
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
441
|
+
Ee,
|
|
442
|
+
Be,
|
|
443
|
+
Ne,
|
|
444
|
+
Pe,
|
|
445
|
+
be,
|
|
446
|
+
ye,
|
|
447
|
+
je,
|
|
448
|
+
$e,
|
|
449
|
+
we,
|
|
450
|
+
ze,
|
|
451
|
+
Ye
|
|
242
452
|
].forEach((e) => {
|
|
243
453
|
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)));
|
|
244
454
|
});
|
|
245
455
|
}
|
|
456
|
+
_init() {
|
|
457
|
+
this._initCustomComponents(), this._initMenus();
|
|
458
|
+
}
|
|
246
459
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
h(0,
|
|
250
|
-
h(1,
|
|
251
|
-
h(2,
|
|
252
|
-
h(3,
|
|
253
|
-
h(4,
|
|
254
|
-
h(5,
|
|
255
|
-
],
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
460
|
+
I = He([
|
|
461
|
+
q(J.Rendered, I),
|
|
462
|
+
h(0, f(F)),
|
|
463
|
+
h(1, f(le)),
|
|
464
|
+
h(2, O),
|
|
465
|
+
h(3, ae),
|
|
466
|
+
h(4, de),
|
|
467
|
+
h(5, ue)
|
|
468
|
+
], I);
|
|
469
|
+
const ot = {
|
|
470
|
+
toolbar: {
|
|
471
|
+
undo: "Undo",
|
|
472
|
+
redo: "Redo",
|
|
473
|
+
font: "Font",
|
|
474
|
+
fontSize: "Font size",
|
|
475
|
+
bold: "Bold",
|
|
476
|
+
italic: "Italic",
|
|
477
|
+
strikethrough: "Strikethrough",
|
|
478
|
+
subscript: "Subscript",
|
|
479
|
+
superscript: "Superscript",
|
|
480
|
+
textColor: {
|
|
481
|
+
main: "Text color",
|
|
482
|
+
right: "Choose color"
|
|
483
|
+
},
|
|
484
|
+
resetColor: "Reset",
|
|
485
|
+
order: "Ordered list",
|
|
486
|
+
unorder: "Unordered list"
|
|
487
|
+
}
|
|
488
|
+
}, Ke = {
|
|
489
|
+
toolbar: {
|
|
490
|
+
undo: "撤销",
|
|
491
|
+
redo: "重做",
|
|
492
|
+
font: "字体",
|
|
493
|
+
fontSize: "字号",
|
|
494
|
+
bold: "粗体",
|
|
495
|
+
italic: "斜体",
|
|
496
|
+
strikethrough: "删除线",
|
|
497
|
+
subscript: "下标",
|
|
498
|
+
superscript: "上标",
|
|
499
|
+
underline: "下划线",
|
|
500
|
+
textColor: {
|
|
501
|
+
main: "文本颜色",
|
|
502
|
+
right: "颜色选择"
|
|
503
|
+
},
|
|
504
|
+
resetColor: "重置颜色",
|
|
505
|
+
order: "有序列表",
|
|
506
|
+
unorder: "无序列表"
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
var Ge = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Xe = (e, n, t, i) => {
|
|
510
|
+
for (var o = i > 1 ? void 0 : i ? Ve(n, t) : n, s = e.length - 1, r; s >= 0; s--)
|
|
511
|
+
(r = e[s]) && (o = (i ? r(n, t, o) : r(o)) || o);
|
|
512
|
+
return i && o && Ge(n, t, o), o;
|
|
513
|
+
}, L = (e, n) => (t, i) => n(t, i, e), x;
|
|
514
|
+
let $ = (x = class extends Q {
|
|
515
|
+
constructor(e, n, t, i) {
|
|
516
|
+
super(Me), this._config = e, this._injector = n, this._localeService = t, this._logService = i, this._localeService.load({
|
|
517
|
+
zhCN: Ke
|
|
518
|
+
}), this._config = k.deepMerge({}, Ie, this._config), this._initDependencies(n);
|
|
267
519
|
}
|
|
268
520
|
onRendered() {
|
|
269
521
|
this._initModules(), this._markDocAsFocused();
|
|
@@ -272,42 +524,42 @@ let R = (C = class extends b {
|
|
|
272
524
|
}
|
|
273
525
|
_initDependencies(e) {
|
|
274
526
|
[
|
|
275
|
-
[
|
|
527
|
+
[I],
|
|
276
528
|
[
|
|
277
529
|
// controllers
|
|
278
|
-
|
|
530
|
+
R,
|
|
279
531
|
{
|
|
280
|
-
useFactory: () => this._injector.createInstance(
|
|
532
|
+
useFactory: () => this._injector.createInstance(R, this._config)
|
|
281
533
|
}
|
|
282
534
|
]
|
|
283
|
-
].forEach((
|
|
284
|
-
e.add(
|
|
535
|
+
].forEach((t) => {
|
|
536
|
+
e.add(t);
|
|
285
537
|
});
|
|
286
538
|
}
|
|
287
539
|
_markDocAsFocused() {
|
|
288
|
-
const e = this._injector.get(
|
|
540
|
+
const e = this._injector.get(w);
|
|
289
541
|
try {
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
} catch (
|
|
293
|
-
this._logService.warn(
|
|
542
|
+
const n = e.getCurrentUniverDocInstance(), t = n.getUnitId();
|
|
543
|
+
t !== te && t !== ne && e.focusUniverInstance(n.getUnitId());
|
|
544
|
+
} catch (n) {
|
|
545
|
+
this._logService.warn(n);
|
|
294
546
|
}
|
|
295
547
|
}
|
|
296
548
|
_initModules() {
|
|
297
|
-
this._injector.get(
|
|
549
|
+
this._injector.get(R);
|
|
298
550
|
}
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
],
|
|
551
|
+
}, S(x, "type", ee.Doc), x);
|
|
552
|
+
$ = Xe([
|
|
553
|
+
L(1, f(F)),
|
|
554
|
+
L(2, f(U)),
|
|
555
|
+
L(3, oe)
|
|
556
|
+
], $);
|
|
305
557
|
export {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
558
|
+
Me as DOC_UI_PLUGIN_NAME,
|
|
559
|
+
Re as DefaultDocContainerConfig,
|
|
560
|
+
Ie as DefaultDocUiConfig,
|
|
561
|
+
ve as DefaultToolbarConfig,
|
|
562
|
+
$ as UniverDocsUIPlugin,
|
|
563
|
+
ot as enUS,
|
|
564
|
+
Ke as zhCN
|
|
313
565
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { COLOR_PICKER_COMPONENT } from './interface';
|
|
17
|
+
export { ColorPicker } from '@univerjs/design';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COLOR_PICKER_COMPONENT = "UI_PLUGIN_DOCS_COLOR_PICKER_COMPONENT";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COMPONENT_PREFIX = "UI_PLUGIN_DOCS";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './interface';
|
|
17
|
+
export { FontFamily } from '@univerjs/ui';
|
|
18
|
+
export { FontFamilyItem } from '@univerjs/ui';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const FONT_FAMILY_COMPONENT = "UI_PLUGIN_DOCS_FONT_FAMILY_COMPONENT";
|
|
17
|
+
export declare const FONT_FAMILY_ITEM_COMPONENT = "UI_PLUGIN_DOCS_FONT_FAMILY_ITEM_COMPONENT";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { FONT_SIZE_COMPONENT } from './interface';
|
|
17
|
+
export { FontSize } from '@univerjs/ui';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const FONT_SIZE_COMPONENT = "UI_PLUGIN_DOCS_FONT_SIZE_COMPONENT";
|
|
@@ -25,5 +25,7 @@ export declare class DocUIController extends Disposable {
|
|
|
25
25
|
private readonly _menuService;
|
|
26
26
|
private readonly _uiController;
|
|
27
27
|
constructor(_injector: Injector, _componentManager: ComponentManager, _commandService: ICommandService, _shortcutService: IShortcutService, _menuService: IMenuService, _uiController: IDesktopUIController);
|
|
28
|
+
private _initCustomComponents;
|
|
29
|
+
private _initMenus;
|
|
28
30
|
private _init;
|
|
29
31
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IMenuButtonItem } from '@univerjs/ui';
|
|
16
|
+
import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
|
17
17
|
import type { IAccessor } from '@wendellhu/redi';
|
|
18
18
|
export declare function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
19
19
|
export declare function ItalicMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
@@ -21,5 +21,8 @@ export declare function UnderlineMenuItemFactory(accessor: IAccessor): IMenuButt
|
|
|
21
21
|
export declare function StrikeThroughMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
22
22
|
export declare function SubscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
23
23
|
export declare function SuperscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
24
|
+
export declare function FontFamilySelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string>;
|
|
25
|
+
export declare function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<number>;
|
|
26
|
+
export declare function TextColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string>;
|
|
24
27
|
export declare function OrderListMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
25
28
|
export declare function BulletListMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
@@ -13,5 +13,24 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
declare const _default: {
|
|
16
|
+
declare const _default: {
|
|
17
|
+
toolbar: {
|
|
18
|
+
undo: string;
|
|
19
|
+
redo: string;
|
|
20
|
+
font: string;
|
|
21
|
+
fontSize: string;
|
|
22
|
+
bold: string;
|
|
23
|
+
italic: string;
|
|
24
|
+
strikethrough: string;
|
|
25
|
+
subscript: string;
|
|
26
|
+
superscript: string;
|
|
27
|
+
textColor: {
|
|
28
|
+
main: string;
|
|
29
|
+
right: string;
|
|
30
|
+
};
|
|
31
|
+
resetColor: string;
|
|
32
|
+
order: string;
|
|
33
|
+
unorder: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
17
36
|
export default _default;
|
|
@@ -13,5 +13,25 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
declare const _default: {
|
|
16
|
+
declare const _default: {
|
|
17
|
+
toolbar: {
|
|
18
|
+
undo: string;
|
|
19
|
+
redo: string;
|
|
20
|
+
font: string;
|
|
21
|
+
fontSize: string;
|
|
22
|
+
bold: string;
|
|
23
|
+
italic: string;
|
|
24
|
+
strikethrough: string;
|
|
25
|
+
subscript: string;
|
|
26
|
+
superscript: string;
|
|
27
|
+
underline: string;
|
|
28
|
+
textColor: {
|
|
29
|
+
main: string;
|
|
30
|
+
right: string;
|
|
31
|
+
};
|
|
32
|
+
resetColor: string;
|
|
33
|
+
order: string;
|
|
34
|
+
unorder: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
17
37
|
export default _default;
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { BaseComponentProps } from '@univerjs/ui';
|
|
17
16
|
import React, { Component } from 'react';
|
|
18
17
|
import type { IUniverDocsUIConfig } from '../../basics';
|
|
19
|
-
interface IBaseDocContainerProps
|
|
18
|
+
interface IBaseDocContainerProps {
|
|
20
19
|
config: IUniverDocsUIConfig;
|
|
21
20
|
changeLocale: (locale: string) => void;
|
|
22
21
|
methods?: any;
|
|
@@ -32,7 +31,6 @@ export declare class DocContainer extends Component<IBaseDocContainerProps> {
|
|
|
32
31
|
splitLeftRef: React.RefObject<HTMLDivElement>;
|
|
33
32
|
contentRef: React.RefObject<HTMLDivElement>;
|
|
34
33
|
constructor(props: IBaseDocContainerProps);
|
|
35
|
-
componentDidMount(): void;
|
|
36
34
|
/**
|
|
37
35
|
* split mouse down
|
|
38
36
|
* @param e
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","@univerjs/docs"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverDocsUi={},s.UniverCore,s["@wendellhu/redi"],s.UniverUi,s.UniverDocs))})(this,function(s,c,l,o,d){"use strict";var J=Object.defineProperty;var Q=(s,c,l)=>c in s?J(s,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[c]=l;var _=(s,c,l)=>(Q(s,typeof c!="symbol"?c+"":c,l),l);var v;const g={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},I={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},C={layout:{docContainerConfig:I,toolbarConfig:g}},M="DocUI";var D=Object.defineProperty,y=Object.getOwnPropertyDescriptor,R=(e,t,n,r)=>{for(var i=r>1?void 0:r?y(t,n):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&D(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e);let h=class{constructor(e,t,n){_(this,"_docContainer");_(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=t,this._injector=n}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};h=R([S(1,l.Inject(c.LocaleService)),S(2,l.Inject(l.Injector))],h);var b=Object.defineProperty,A=Object.getOwnPropertyDescriptor,L=(e,t,n,r)=>{for(var i=r>1?void 0:r?A(t,n):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&b(t,n,i),i},m=(e,t)=>(n,r)=>t(n,r,e);let f=class{constructor(e,t,n){_(this,"_docContainerController");_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=t,this._injector=n,this._docContainerController=this._injector.createInstance(h,e)}getDocContainerController(){return this._docContainerController}};f=L([m(1,l.Inject(c.LocaleService)),m(2,l.Inject(l.Injector))],f);function j(e){return{id:d.SetInlineFormatBoldCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function P(e){return{id:d.SetInlineFormatItalicCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function B(e){return{id:d.SetInlineFormatUnderlineCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function F(e){return{id:d.SetInlineFormatStrikethroughCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function $(e){return{id:d.SetInlineFormatSubscriptCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function N(e){return{id:d.SetInlineFormatSuperscriptCommand.id,group:o.MenuGroup.TOOLBAR_FORMAT,type:o.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function w(e){return{id:d.OrderListCommand.id,group:o.MenuGroup.TOOLBAR_LAYOUT,type:o.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.superscript",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}function H(e){return{id:d.BulletListCommand.id,group:o.MenuGroup.TOOLBAR_LAYOUT,type:o.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.superscript",positions:[o.MenuPosition.TOOLBAR_START],hidden$:o.getMenuHiddenObservable(e,c.UniverInstanceType.DOC)}}var G=Object.defineProperty,E=Object.getOwnPropertyDescriptor,z=(e,t,n,r)=>{for(var i=r>1?void 0:r?E(t,n):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&G(t,n,i),i},p=(e,t)=>(n,r)=>t(n,r,e);let O=class extends c.Disposable{constructor(e,t,n,r,i,a){super(),this._injector=e,this._componentManager=t,this._commandService=n,this._shortcutService=r,this._menuService=i,this._uiController=a,this._init()}_init(){[j,P,B,F,$,N,w,H].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}};O=z([c.OnLifecycle(c.LifecycleStages.Rendered,O),p(0,l.Inject(l.Injector)),p(1,l.Inject(o.ComponentManager)),p(2,c.ICommandService),p(3,o.IShortcutService),p(4,o.IMenuService),p(5,o.IUIController)],O);const q={},U={};var Y=Object.defineProperty,K=Object.getOwnPropertyDescriptor,W=(e,t,n,r)=>{for(var i=r>1?void 0:r?K(t,n):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Y(t,n,i),i},T=(e,t)=>(n,r)=>t(n,r,e);s.UniverDocsUIPlugin=(v=class extends c.Plugin{constructor(t,n,r,i){super(M),this._config=t,this._injector=n,this._localeService=r,this._logService=i,this._localeService.load({zhCN:U}),this._config=c.Tools.deepMerge({},C,this._config),this._initDependencies(n)}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initDependencies(t){[[O],[f,{useFactory:()=>this._injector.createInstance(f,this._config)}]].forEach(r=>{t.add(r)})}_markDocAsFocused(){const t=this._injector.get(c.IUniverInstanceService);try{const n=t.getCurrentUniverDocInstance(),r=n.getUnitId();r!==c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&r!==c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&t.focusUniverInstance(n.getUnitId())}catch(n){this._logService.warn(n)}}_initModules(){this._injector.get(f)}},_(v,"type",c.PluginType.Doc),v),s.UniverDocsUIPlugin=W([T(1,l.Inject(l.Injector)),T(2,l.Inject(c.LocaleService)),T(3,c.ILogService)],s.UniverDocsUIPlugin),s.DOC_UI_PLUGIN_NAME=M,s.DefaultDocContainerConfig=I,s.DefaultDocUiConfig=C,s.DefaultToolbarConfig=g,s.enUS=q,s.zhCN=U,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(d,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("@univerjs/docs"),require("rxjs"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","@univerjs/docs","rxjs","@univerjs/design"],r):(d=typeof globalThis<"u"?globalThis:d||self,r(d.UniverDocsUi={},d.UniverCore,d["@wendellhu/redi"],d.UniverUi,d.UniverDocs,d.rxjs,d.UniverDesign))})(this,function(d,r,p,s,c,O,N){"use strict";var le=Object.defineProperty;var ce=(d,r,p)=>r in d?le(d,r,{enumerable:!0,configurable:!0,writable:!0,value:p}):d[r]=p;var _=(d,r,p)=>(ce(d,typeof r!="symbol"?r+"":r,p),p);var M;const R={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},U={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},F={layout:{docContainerConfig:U,toolbarConfig:R}},b="DocUI";var B=Object.defineProperty,$=Object.getOwnPropertyDescriptor,j=(e,n,t,o)=>{for(var i=o>1?void 0:o?$(n,t):n,l=e.length-1,a;l>=0;l--)(a=e[l])&&(i=(o?a(n,t,i):a(i))||i);return o&&i&&B(n,t,i),i},L=(e,n)=>(t,o)=>n(t,o,e);let g=class{constructor(e,n,t){_(this,"_docContainer");_(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=n,this._injector=t}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};g=j([L(1,p.Inject(r.LocaleService)),L(2,p.Inject(p.Injector))],g);var w=Object.defineProperty,z=Object.getOwnPropertyDescriptor,G=(e,n,t,o)=>{for(var i=o>1?void 0:o?z(n,t):n,l=e.length-1,a;l>=0;l--)(a=e[l])&&(i=(o?a(n,t,i):a(i))||i);return o&&i&&w(n,t,i),i},A=(e,n)=>(t,o)=>n(t,o,e);let v=class{constructor(e,n,t){_(this,"_docContainerController");_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=n,this._injector=t,this._docContainerController=this._injector.createInstance(g,e)}getDocContainerController(){return this._docContainerController}};v=G([A(1,p.Inject(r.LocaleService)),A(2,p.Inject(p.Injector))],v);const C="UI_PLUGIN_DOCS",y=`${C}_COLOR_PICKER_COMPONENT`,D=`${C}_FONT_FAMILY_COMPONENT`,P=`${C}_FONT_FAMILY_ITEM_COMPONENT`,x=`${C}_FONT_SIZE_COMPONENT`;function H(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatBoldCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.bl;t.next(m===r.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function Y(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatItalicCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.it;t.next(m===r.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function q(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatUnderlineCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.ul;t.next((m==null?void 0:m.s)===r.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function W(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatStrikethroughCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.st;t.next((m==null?void 0:m.s)===r.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function Z(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatSubscriptCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.va;t.next(m===r.BaselineOffset.SUBSCRIPT)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function K(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatSuperscriptCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[s.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var a;const l=i.id;if(l===c.SetTextSelectionsOperation.id||l===c.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const m=(a=u.ts)==null?void 0:a.va;t.next(m===r.BaselineOffset.SUPERSCRIPT)}});return t.next(!1),o.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function V(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.SELECTOR,label:D,positions:[s.MenuPosition.TOOLBAR_START],selections:s.FONT_FAMILY_LIST.map(t=>({label:{name:P,hoverable:!0},value:t.value})),value$:new O.Observable(t=>{const o=s.FONT_FAMILY_LIST[0].value,i=n.onCommandExecuted(l=>{var u;const a=l.id;if(a===c.SetTextSelectionsOperation.id||a===c.SetInlineFormatFontFamilyCommand.id){const m=T(e);if(m==null)return;const f=(u=m.ts)==null?void 0:u.ff;t.next(f??o)}});return t.next(o),i.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function X(e){const n=e.get(r.ICommandService);return{id:c.SetInlineFormatFontSizeCommand.id,group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:x,props:{min:1,max:400}},positions:[s.MenuPosition.TOOLBAR_START],selections:s.FONT_SIZE_LIST,value$:new O.Observable(t=>{const i=n.onCommandExecuted(l=>{var u;const a=l.id;if(a===c.SetTextSelectionsOperation.id||a===c.SetInlineFormatFontSizeCommand.id){const m=T(e);if(m==null)return;const f=(u=m.ts)==null?void 0:u.fs;t.next(f??14)}});return t.next(14),i.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function J(e){const n=e.get(r.ICommandService),t=e.get(r.ThemeService);return{id:c.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:s.MenuGroup.TOOLBAR_FORMAT,type:s.MenuItemType.BUTTON_SELECTOR,positions:[s.MenuPosition.TOOLBAR_START],selections:[{label:{name:y,hoverable:!1}}],value$:new O.Observable(o=>{const i=t.getCurrentTheme().textColor,l=n.onCommandExecuted(a=>{if(a.id===c.SetInlineFormatTextColorCommand.id){const u=a.params.value;o.next(u??i)}});return o.next(i),l.dispose}),hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function Q(e){return{id:c.OrderListCommand.id,group:s.MenuGroup.TOOLBAR_LAYOUT,type:s.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[s.MenuPosition.TOOLBAR_START],hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function k(e){return{id:c.BulletListCommand.id,group:s.MenuGroup.TOOLBAR_LAYOUT,type:s.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[s.MenuPosition.TOOLBAR_START],hidden$:s.getMenuHiddenObservable(e,r.UniverInstanceType.DOC)}}function T(e){var m;const n=e.get(r.IUniverInstanceService),t=e.get(c.TextSelectionManagerService),o=n.getCurrentUniverDocInstance(),i=t.getActiveRange();if(o==null||i==null)return;const l=(m=o.getBody())==null?void 0:m.textRuns;if(l==null)return;const{startOffset:a}=i;return l.find(({st:f,ed:ae})=>a>=f&&a<ae)}var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ne=(e,n,t,o)=>{for(var i=o>1?void 0:o?te(n,t):n,l=e.length-1,a;l>=0;l--)(a=e[l])&&(i=(o?a(n,t,i):a(i))||i);return o&&i&&ee(n,t,i),i},S=(e,n)=>(t,o)=>n(t,o,e);let I=class extends r.Disposable{constructor(e,n,t,o,i,l){super(),this._injector=e,this._componentManager=n,this._commandService=t,this._shortcutService=o,this._menuService=i,this._uiController=l,this._init()}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register(y,N.ColorPicker)),this.disposeWithMe(e.register(D,s.FontFamily)),this.disposeWithMe(e.register(P,s.FontFamilyItem)),this.disposeWithMe(e.register(x,s.FontSize))}_initMenus(){[H,Y,q,W,Z,K,X,V,J,Q,k].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}_init(){this._initCustomComponents(),this._initMenus()}};I=ne([r.OnLifecycle(r.LifecycleStages.Rendered,I),S(0,p.Inject(p.Injector)),S(1,p.Inject(s.ComponentManager)),S(2,r.ICommandService),S(3,s.IShortcutService),S(4,s.IMenuService),S(5,s.IUIController)],I);const oe={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",textColor:{main:"Text color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list"}},E={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表"}};var ie=Object.defineProperty,re=Object.getOwnPropertyDescriptor,se=(e,n,t,o)=>{for(var i=o>1?void 0:o?re(n,t):n,l=e.length-1,a;l>=0;l--)(a=e[l])&&(i=(o?a(n,t,i):a(i))||i);return o&&i&&ie(n,t,i),i},h=(e,n)=>(t,o)=>n(t,o,e);d.UniverDocsUIPlugin=(M=class extends r.Plugin{constructor(n,t,o,i){super(b),this._config=n,this._injector=t,this._localeService=o,this._logService=i,this._localeService.load({zhCN:E}),this._config=r.Tools.deepMerge({},F,this._config),this._initDependencies(t)}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initDependencies(n){[[I],[v,{useFactory:()=>this._injector.createInstance(v,this._config)}]].forEach(o=>{n.add(o)})}_markDocAsFocused(){const n=this._injector.get(r.IUniverInstanceService);try{const t=n.getCurrentUniverDocInstance(),o=t.getUnitId();o!==r.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&o!==r.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&n.focusUniverInstance(t.getUnitId())}catch(t){this._logService.warn(t)}}_initModules(){this._injector.get(v)}},_(M,"type",r.PluginType.Doc),M),d.UniverDocsUIPlugin=se([h(1,p.Inject(p.Injector)),h(2,p.Inject(r.LocaleService)),h(3,r.ILogService)],d.UniverDocsUIPlugin),d.DOC_UI_PLUGIN_NAME=b,d.DefaultDocContainerConfig=U,d.DefaultDocUiConfig=F,d.DefaultToolbarConfig=R,d.enUS=oe,d.zhCN=E,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-ui",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
|
+
"private": false,
|
|
4
5
|
"description": "Univer normal ui-plugin-docs",
|
|
5
|
-
"keywords": [],
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"access": "public"
|
|
13
|
-
},
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"**/*.css"
|
|
11
|
+
],
|
|
14
12
|
"exports": {
|
|
15
13
|
".": {
|
|
16
14
|
"import": "./lib/es/index.js",
|
|
@@ -24,48 +22,53 @@
|
|
|
24
22
|
},
|
|
25
23
|
"./lib/*": "./lib/*"
|
|
26
24
|
},
|
|
25
|
+
"main": "./lib/cjs/index.js",
|
|
26
|
+
"module": "./lib/es/index.js",
|
|
27
|
+
"types": "./lib/types/index.d.ts",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
27
31
|
"directories": {
|
|
28
32
|
"lib": "lib"
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
31
35
|
"lib"
|
|
32
36
|
],
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"private": false,
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@wendellhu/redi": "^0.12.12",
|
|
39
|
-
"react": "^18.2.0",
|
|
40
|
-
"@univerjs/docs": "0.1.0-beta.1",
|
|
41
|
-
"@univerjs/core": "0.1.0-beta.1",
|
|
42
|
-
"@univerjs/design": "0.1.0-beta.1",
|
|
43
|
-
"@univerjs/ui": "0.1.0-beta.1",
|
|
44
|
-
"@univerjs/engine-render": "0.1.0-beta.1"
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16.0.0",
|
|
39
|
+
"npm": ">=8.0.0"
|
|
45
40
|
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@wendellhu/redi": ">=0.12.13",
|
|
43
|
+
"react": ">=16.9.0",
|
|
44
|
+
"@univerjs/design": "0.1.0-beta.3",
|
|
45
|
+
"@univerjs/docs": "0.1.0-beta.3",
|
|
46
|
+
"@univerjs/core": "0.1.0-beta.3",
|
|
47
|
+
"@univerjs/engine-render": "0.1.0-beta.3",
|
|
48
|
+
"@univerjs/ui": "0.1.0-beta.3"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {},
|
|
46
51
|
"devDependencies": {
|
|
47
|
-
"@types/react": "^18.2.
|
|
48
|
-
"@
|
|
49
|
-
"@vitest/coverage-istanbul": "^1.1.0",
|
|
50
|
-
"happy-dom": "^12.10.3",
|
|
52
|
+
"@types/react": "^18.2.48",
|
|
53
|
+
"@wendellhu/redi": "^0.12.13",
|
|
51
54
|
"less": "^4.2.0",
|
|
55
|
+
"react": "^18.2.0",
|
|
56
|
+
"rxjs": "^7.8.1",
|
|
52
57
|
"typescript": "^5.3.3",
|
|
53
|
-
"vite": "^5.0.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"@univerjs/core": "0.1.0-beta.1",
|
|
62
|
-
"@univerjs/design": "0.1.0-beta.1",
|
|
63
|
-
"@univerjs/engine-render": "0.1.0-beta.1",
|
|
64
|
-
"@univerjs/docs": "0.1.0-beta.1",
|
|
65
|
-
"@univerjs/ui": "0.1.0-beta.1"
|
|
58
|
+
"vite": "^5.0.12",
|
|
59
|
+
"vitest": "^1.2.1",
|
|
60
|
+
"@univerjs/core": "0.1.0-beta.3",
|
|
61
|
+
"@univerjs/design": "0.1.0-beta.3",
|
|
62
|
+
"@univerjs/docs": "0.1.0-beta.3",
|
|
63
|
+
"@univerjs/shared": "0.1.0-beta.3",
|
|
64
|
+
"@univerjs/engine-render": "0.1.0-beta.3",
|
|
65
|
+
"@univerjs/ui": "0.1.0-beta.3"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"test": "vitest run",
|
|
69
|
+
"test:watch": "vitest",
|
|
70
|
+
"coverage": "vitest run --coverage",
|
|
71
|
+
"lint:types": "tsc --noEmit",
|
|
69
72
|
"build": "tsc && vite build"
|
|
70
73
|
}
|
|
71
74
|
}
|