@univerjs/docs 0.4.2-nightly.202411061606 → 0.4.2-nightly.202411081606
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/lib/cjs/index.js +1 -0
- package/lib/es/index.js +426 -434
- package/package.json +9 -5
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var G=Object.defineProperty;var k=(o,i,e)=>i in o?G(o,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[i]=e;var d=(o,i,e)=>k(o,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),T=require("@univerjs/engine-render"),p=require("rxjs"),x=require("@univerjs/docs"),b={id:"doc.operation.set-selections",type:c.CommandType.OPERATION,handler:()=>!0};var W=Object.defineProperty,J=Object.getOwnPropertyDescriptor,Y=(o,i,e,t)=>{for(var n=t>1?void 0:t?J(i,e):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(t?r(i,e,n):r(n))||n);return t&&n&&W(i,e,n),n},j=(o,i)=>(e,t)=>i(e,t,o);exports.DocSelectionManagerService=class extends c.RxDisposable{constructor(e,t){super();d(this,"_currentSelection",null);d(this,"_textSelectionInfo",new Map);d(this,"_textSelection$",new p.Subject);d(this,"textSelection$",this._textSelection$.asObservable());d(this,"_refreshSelection$",new p.BehaviorSubject(null));d(this,"refreshSelection$",this._refreshSelection$.asObservable());this._commandService=e,this._univerInstanceService=t,this._listenCurrentUnit()}_listenCurrentUnit(){this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_DOC).pipe(p.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;const t=e.getUnitId();this._setCurrentSelectionNotRefresh({unitId:t,subUnitId:t})})}__getCurrentSelection(){return this._currentSelection}getSelectionInfo(e=this._currentSelection){return this._getTextRanges(e)}refreshSelection(e=this._currentSelection){e!=null&&this._refresh(e)}__TEST_ONLY_setCurrentSelection(e){this._currentSelection=e,this._refresh(e)}getTextRanges(e=this._currentSelection){var t;return(t=this._getTextRanges(e))==null?void 0:t.textRanges}getRectRanges(e=this._currentSelection){var t;return(t=this._getTextRanges(e))==null?void 0:t.rectRanges}getDocRanges(e=this._currentSelection){var r,a;const t=(r=this.getTextRanges(e))!=null?r:[],n=(a=this.getRectRanges(e))!=null?a:[];return[...t,...n].filter(l=>l.startOffset!=null&&l.endOffset!=null).sort((l,u)=>l.startOffset>u.startOffset?1:l.startOffset<u.startOffset?-1:0)}getActiveTextRange(){const e=this._getTextRanges(this._currentSelection);if(e==null)return;const{textRanges:t}=e;return t.find(n=>n.isActive)}getActiveRectRange(){const e=this._getTextRanges(this._currentSelection);if(e==null)return;const{rectRanges:t}=e;return t.find(n=>n.isActive)}__TEST_ONLY_add(e,t=!0){this._currentSelection!=null&&this._addByParam({...this._currentSelection,textRanges:e,rectRanges:[],segmentId:"",segmentPage:-1,isEditing:t,style:T.NORMAL_TEXT_SELECTION_PLUGIN_STYLE})}replaceTextRanges(e,t=!0,n){return this.replaceDocRanges(e,this._currentSelection,t,n)}replaceDocRanges(e,t=this._currentSelection,n=!0,s){if(t==null)return;const{unitId:r,subUnitId:a}=t;this._refreshSelection$.next({unitId:r,subUnitId:a,docRanges:e,isEditing:n,options:s})}__replaceTextRangesWithNoRefresh(e,t){if(this._currentSelection==null)return;const n={...e,...t};this._replaceByParam(n),this._textSelection$.next(n);const{unitId:s,subUnitId:r,segmentId:a,style:l,textRanges:u,rectRanges:g,isEditing:S}=n,f=[...u,...g].filter(_=>_.startOffset!=null&&_.endOffset!=null).sort((_,I)=>_.startOffset>I.startOffset?1:_.startOffset<I.startOffset?-1:0);this._commandService.executeCommand(b.id,{unitId:s,subUnitId:r,segmentId:a,style:l,isEditing:S,ranges:f})}dispose(){this._textSelection$.complete()}_setCurrentSelectionNotRefresh(e){this._currentSelection=e}_getTextRanges(e){var s;if(e==null)return;const{unitId:t,subUnitId:n=""}=e;return(s=this._textSelectionInfo.get(t))==null?void 0:s.get(n)}_refresh(e){const t=this._getTextRanges(e);if(t==null)return;const{textRanges:n,rectRanges:s}=t,r=[...n,...s],{unitId:a,subUnitId:l}=e;this._refreshSelection$.next({unitId:a,subUnitId:l,docRanges:r,isEditing:!1})}_replaceByParam(e){const{unitId:t,subUnitId:n,...s}=e;this._textSelectionInfo.has(t)||this._textSelectionInfo.set(t,new Map),this._textSelectionInfo.get(t).set(n,{...s})}_addByParam(e){const{unitId:t,subUnitId:n,...s}=e;this._textSelectionInfo.has(t)||this._textSelectionInfo.set(t,new Map);const r=this._textSelectionInfo.get(t);r.has(n)?r.get(n).textRanges.push(...e.textRanges):r.set(n,{...s})}};exports.DocSelectionManagerService=Y([j(0,c.ICommandService),j(1,c.IUniverInstanceService)],exports.DocSelectionManagerService);var q=Object.defineProperty,K=Object.getOwnPropertyDescriptor,H=(o,i,e,t)=>{for(var n=t>1?void 0:t?K(i,e):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(t?r(i,e,n):r(n))||n);return t&&n&&q(i,e,n),n},V=(o,i)=>(e,t)=>i(e,t,o);exports.DocSkeletonManagerService=class extends c.RxDisposable{constructor(e,t,n){super();d(this,"_skeleton");d(this,"_docViewModel");d(this,"_currentSkeleton$",new p.BehaviorSubject(null));d(this,"currentSkeleton$",this._currentSkeleton$.asObservable());d(this,"_currentSkeletonBefore$",new p.BehaviorSubject(null));d(this,"currentSkeletonBefore$",this._currentSkeletonBefore$.asObservable());d(this,"_currentViewModel$",new p.BehaviorSubject(null));d(this,"currentViewModel$",this._currentViewModel$.asObservable());this._context=e,this._localeService=t,this._univerInstanceService=n,this._init(),this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_DOC).pipe(p.takeUntil(this.dispose$)).subscribe(s=>{s&&s.getUnitId()===this._context.unitId&&this._update(s)})}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getSkeleton(){return this._skeleton}getViewModel(){return this._docViewModel}_init(){const e=this._context.unit;this._update(e)}_update(e){const t=this._context.unitId;if(e.getBody()==null)return;this._docViewModel&&c.isInternalEditorID(t)?(this._docViewModel.reset(e),this._context.unit=e):this._docViewModel||(this._docViewModel=this._buildDocViewModel(e)),this._skeleton||(this._skeleton=this._buildSkeleton(this._docViewModel));const n=this._skeleton;n.calculate(),this._currentSkeletonBefore$.next(n),this._currentSkeleton$.next(n),this._currentViewModel$.next(this._docViewModel)}_buildSkeleton(e){return T.DocumentSkeleton.create(e,this._localeService)}_buildDocViewModel(e){return new T.DocumentViewModel(e)}};exports.DocSkeletonManagerService=H([V(1,c.Inject(c.LocaleService)),V(2,c.IUniverInstanceService)],exports.DocSkeletonManagerService);class P extends c.RxDisposable{constructor(){super();d(this,"_docStateChangeParams$",new p.BehaviorSubject(null));d(this,"docStateChangeParams$",this._docStateChangeParams$.asObservable())}emitStateChangeInfo(e){this._docStateChangeParams$.next(e)}dispose(){super.dispose(),this._docStateChangeParams$.complete()}}const A="doc.mutation.rich-text-editing",F={id:A,type:c.CommandType.MUTATION,handler:(o,i)=>{var $,B;const{unitId:e,segmentId:t="",actions:n,textRanges:s,prevTextRanges:r,trigger:a,noHistory:l,isCompositionEnd:u,noNeedSetTextRange:g,debounce:S,isEditing:f=!0,isSync:_,syncer:I}=i,m=o.get(c.IUniverInstanceService),v=o.get(T.IRenderManagerService),R=o.get(P),h=m.getUniverDocInstance(e),O=($=v.getRenderById(e))==null?void 0:$.with(exports.DocSkeletonManagerService).getViewModel();if(h==null||O==null)throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${e}`);const D=o.get(exports.DocSelectionManagerService),y=(B=D.getDocRanges())!=null?B:[],L=!!h.getSnapshot().disabled;if(c.JSONX.isNoop(n)||n&&n.length===0||L)return{unitId:e,actions:[],textRanges:y};const N=c.JSONX.invertWithDoc(n,h.getSnapshot());h.apply(n),O.reset(h),!g&&s&&a!=null&&queueMicrotask(()=>{D.replaceDocRanges(s,{unitId:e,subUnitId:e},f,i.options)});const z={commandId:A,unitId:e,segmentId:t,trigger:a,noHistory:l,debounce:S,redoState:{actions:n,textRanges:s},undoState:{actions:N,textRanges:r!=null?r:y},isCompositionEnd:u,isSync:_,syncer:I};return R.emitStateChangeInfo(z),{unitId:e,actions:N,textRanges:y}}},Q={id:"doc.mutation.rename-doc",type:c.CommandType.MUTATION,handler:(o,i)=>{const t=o.get(c.IUniverInstanceService).getUnit(i.unitId,c.UniverInstanceType.UNIVER_DOC);return t?(t.setName(i.name),!0):!1}},Z="docs.config",ee={};var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(o,i,e,t)=>{for(var n=t>1?void 0:t?ne(i,e):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(t?r(i,e,n):r(n))||n);return t&&n&&te(i,e,n),n},w=(o,i)=>(e,t)=>i(e,t,o);let C=class extends c.Disposable{constructor(o,i,e){super(),this._commandService=o,this._textSelectionManagerService=i,this._univerInstanceService=e,this._initSelectionChange()}_transformCustomRange(o,i){var r;const{startOffset:e,endOffset:t,collapsed:n}=i,s=(r=o.getCustomRanges())==null?void 0:r.filter(a=>!a.wholeEntity||e<=a.startIndex&&t>a.endIndex?!1:n?a.startIndex<e&&a.endIndex>=t:c.BuildTextUtils.range.isIntersects(e,t-1,a.startIndex,a.endIndex));if(s!=null&&s.length){let a=e,l=t;return s.forEach(u=>{a=Math.min(u.startIndex,a),l=Math.max(u.endIndex+1,l)}),{...i,startOffset:a,endOffset:l,collapsed:a===l}}return i}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(o.id===b.id){const i=o.params,{unitId:e,ranges:t,isEditing:n}=i,s=this._univerInstanceService.getUnit(e);if(!s)return;const r=t.map(a=>this._transformCustomRange(s,a));r.some((a,l)=>t[l]!==a)&&this._textSelectionManagerService.replaceTextRanges(r,n)}}))}};C=ie([w(0,c.ICommandService),w(1,c.Inject(exports.DocSelectionManagerService)),w(2,c.IUniverInstanceService)],C);var se=Object.defineProperty,re=Object.getOwnPropertyDescriptor,oe=(o,i,e,t)=>{for(var n=t>1?void 0:t?re(i,e):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(t?r(i,e,n):r(n))||n);return t&&n&&se(i,e,n),n},X=(o,i)=>(e,t)=>i(e,t,o);const ce="DOCS_PLUGIN";var E;exports.UniverDocsPlugin=(E=class extends c.Plugin{constructor(i=ee,e,t){super(),this._config=i,this._injector=e,this._configService=t;const{...n}=this._config;this._configService.setConfig(Z,n)}onStarting(){this._initializeDependencies(),this._initializeCommands()}_initializeCommands(){[F,Q,b].forEach(i=>{this._injector.get(c.ICommandService).registerCommand(i)})}_initializeDependencies(){[[exports.DocSelectionManagerService],[P],[C]].forEach(i=>this._injector.add(i))}onReady(){this._injector.get(C)}},d(E,"pluginName",ce),E);exports.UniverDocsPlugin=oe([X(1,c.Inject(c.Injector)),X(2,c.IConfigService)],exports.UniverDocsPlugin);const ae=c.createInterceptorKey("CUSTOM_RANGE"),le=c.createInterceptorKey("CUSTOM_DECORATION"),M={CUSTOM_RANGE:ae,CUSTOM_DECORATION:le};var ue=Object.defineProperty,de=Object.getOwnPropertyDescriptor,ge=(o,i,e,t)=>{for(var n=t>1?void 0:t?de(i,e):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(t?r(i,e,n):r(n))||n);return t&&n&&ue(i,e,n),n},_e=(o,i)=>(e,t)=>i(e,t,o);exports.DocInterceptorService=class extends c.Disposable{constructor(e,t){super();d(this,"_interceptorsByName",new Map);this._context=e,this._docSkeletonManagerService=t;const n=this._docSkeletonManagerService.getViewModel(),s=n.getDataModel().getUnitId();if(s===c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY||s===c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)return;this.disposeWithMe(this.interceptDocumentViewModel(n)),this.disposeWithMe(this.intercept(M.CUSTOM_RANGE,{priority:-1,handler:(a,l,u)=>u(a)}));let r=new c.DisposableCollection;n.segmentViewModels$.subscribe(a=>{r.dispose(),r=new c.DisposableCollection,a.forEach(l=>{r.add(this.interceptDocumentViewModel(l))})}),this.disposeWithMe(r)}intercept(e,t){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const s=this._interceptorsByName.get(n);return s.push(t),this._interceptorsByName.set(n,s.sort((r,a)=>{var l,u;return((l=a.priority)!=null?l:0)-((u=r.priority)!=null?u:0)})),this.disposeWithMe(c.toDisposable(()=>c.remove(this._interceptorsByName.get(n),t)))}fetchThroughInterceptors(e){const t=e,n=this._interceptorsByName.get(t);return c.composeInterceptors(n||[])}interceptDocumentViewModel(e){const t=new c.DisposableCollection;return t.add(e.registerCustomRangeInterceptor({getCustomRange:n=>{var s;return this.fetchThroughInterceptors(M.CUSTOM_RANGE)(e.getCustomRangeRaw(n),{index:n,unitId:e.getDataModel().getUnitId(),customRanges:(s=e.getDataModel().getCustomRanges())!=null?s:[]})},getCustomDecoration:n=>{var s;return this.fetchThroughInterceptors(M.CUSTOM_DECORATION)(e.getCustomDecorationRaw(n),{index:n,unitId:e.getDataModel().getUnitId(),customDecorations:(s=e.getDataModel().getCustomDecorations())!=null?s:[]})}})),t}};exports.DocInterceptorService=ge([_e(1,c.Inject(exports.DocSkeletonManagerService))],exports.DocInterceptorService);function U(o,i=""){if(!i)return["body"];const{headers:e,footers:t}=o.getSnapshot();if(e==null&&t==null)throw new Error("Document data model must have headers or footers when update by segment id");if((e==null?void 0:e[i])!=null)return["headers",i,"body"];if((t==null?void 0:t[i])!=null)return["footers",i,"body"];throw new Error("Segment id not found in headers or footers")}function he(o,i,e){const{unitId:t,segmentId:n}=i,r=o.get(c.IUniverInstanceService).getUnit(t);if(!r)return!1;const a={id:x.RichTextEditingMutation.id,params:{unitId:i.unitId,actions:[],textRanges:void 0}},l=c.JSONX.getInstance(),u=c.BuildTextUtils.customRange.add({...i,body:e});if(!u)return!1;const g=U(r,n);return a.params.actions=l.editOp(u.serialize(),g),a}function Se(o,i){var D;const{rangeId:e,rangeType:t,wholeEntity:n,properties:s,unitId:r,selection:a}=i,l=o.get(x.DocSelectionManagerService),u=o.get(c.IUniverInstanceService),g=a!=null?a:(D=l.getTextRanges({unitId:r,subUnitId:r}))==null?void 0:D[0],S=g==null?void 0:g.segmentId;if(!g)return!1;const f=u.getUnit(r,c.UniverInstanceType.UNIVER_DOC);if(!f)return!1;const _=f.getSelfOrHeaderFooterModel(g.segmentId).getBody();if(!_)return!1;const{startOffset:I,endOffset:m}=c.BuildTextUtils.selection.normalizeSelection(g),v=c.BuildTextUtils.customRange.add({range:{startOffset:I,endOffset:m,collapsed:I===m},rangeId:e,rangeType:t,segmentId:S,wholeEntity:n,properties:s,body:_});if(!v)return!1;const R=c.JSONX.getInstance(),h={id:x.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:v.selections},textX:v},O=U(f,S);return h.params.actions=R.editOp(v.serialize(),O),h}function fe(o,i){const{unitId:e,segmentId:t,insert:n}=i,r=o.get(c.IUniverInstanceService).getUnit(e);if(!r)return!1;const a={id:x.RichTextEditingMutation.id,params:{unitId:i.unitId,actions:[],textRanges:void 0,segmentId:t}},l=c.JSONX.getInstance(),u=c.BuildTextUtils.customRange.delete(o,{documentDataModel:r,rangeId:i.rangeId,insert:n,segmentId:t});if(!u)return!1;const g=U(r,t);return a.params.actions=l.editOp(u.serialize(),g),a.params.textRanges=u.selections,a}function Ie(o,i){var m,v,R,h;const{unitId:e,body:t,doc:n}=i;let s=n;if(s||(s=o.get(c.IUniverInstanceService).getUnit(e)),!s)return!1;const r=(m=i.selection)==null?void 0:m.segmentId,a=(v=s.getSelfOrHeaderFooterModel(r))==null?void 0:v.getBody();if(!a)return!1;const l=o.get(x.DocSelectionManagerService),u=(R=i.selection)!=null?R:l.getActiveTextRange();if(!u||!a)return!1;const g=(h=i.textRanges)!=null?h:[{startOffset:u.startOffset+t.dataStream.length,endOffset:u.startOffset+t.dataStream.length,collapsed:!0,segmentId:r}],S=c.BuildTextUtils.selection.replace({selection:u,body:t,doc:s});if(!S)return!1;const f={id:x.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:g,debounce:!0,segmentId:r},textX:S},_=c.JSONX.getInstance(),I=U(s,r);return f.params.actions=_.editOp(S.serialize(),I),f}exports.DOC_INTERCEPTOR_POINT=M;exports.DocStateEmitService=P;exports.RichTextEditingMutation=F;exports.SetTextSelectionsOperation=b;exports.addCustomRangeBySelectionFactory=Se;exports.addCustomRangeFactory=he;exports.deleteCustomRangeFactory=fe;exports.replaceSelectionFactory=Ie;
|
package/lib/es/index.js
CHANGED
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const SetTextSelectionsOperation = {
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var re = (i, e, t) => e in i ? ie(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var u = (i, e, t) => re(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CommandType as j, RxDisposable as A, UniverInstanceType as w, ICommandService as L, IUniverInstanceService as p, Inject as $, LocaleService as oe, isInternalEditorID as ce, JSONX as R, Disposable as J, BuildTextUtils as O, Injector as ae, Plugin as le, IConfigService as ue, createInterceptorKey as Q, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as de, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ge, DisposableCollection as P, toDisposable as _e, remove as he, composeInterceptors as fe } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Se, DocumentSkeleton as pe, DocumentViewModel as Ie, IRenderManagerService as me } from "@univerjs/engine-render";
|
|
6
|
+
import { Subject as ve, BehaviorSubject as C, takeUntil as Z } from "rxjs";
|
|
7
|
+
import { RichTextEditingMutation as y, DocSelectionManagerService as ee } from "@univerjs/docs";
|
|
8
|
+
const X = {
|
|
10
9
|
id: "doc.operation.set-selections",
|
|
11
|
-
type:
|
|
12
|
-
handler:
|
|
10
|
+
type: j.OPERATION,
|
|
11
|
+
handler: () => !0
|
|
13
12
|
};
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
(
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
constructor(
|
|
13
|
+
var Re = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, xe = (i, e, t, n) => {
|
|
14
|
+
for (var s = n > 1 ? void 0 : n ? Oe(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
15
|
+
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
16
|
+
return n && s && Re(e, t, s), s;
|
|
17
|
+
}, W = (i, e) => (t, n) => e(t, n, i);
|
|
18
|
+
let D = class extends A {
|
|
19
|
+
constructor(e, t) {
|
|
21
20
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this._commandService =
|
|
21
|
+
u(this, "_currentSelection", null);
|
|
22
|
+
u(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
|
|
23
|
+
u(this, "_textSelection$", new ve());
|
|
24
|
+
u(this, "textSelection$", this._textSelection$.asObservable());
|
|
25
|
+
u(this, "_refreshSelection$", new C(null));
|
|
26
|
+
u(this, "refreshSelection$", this._refreshSelection$.asObservable());
|
|
27
|
+
this._commandService = e, this._univerInstanceService = t, this._listenCurrentUnit();
|
|
29
28
|
}
|
|
30
29
|
_listenCurrentUnit() {
|
|
31
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
32
|
-
if (
|
|
30
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(w.UNIVER_DOC).pipe(Z(this.dispose$)).subscribe((e) => {
|
|
31
|
+
if (e == null)
|
|
33
32
|
return;
|
|
34
|
-
const
|
|
33
|
+
const t = e.getUnitId();
|
|
35
34
|
this._setCurrentSelectionNotRefresh({
|
|
36
|
-
unitId,
|
|
37
|
-
subUnitId:
|
|
35
|
+
unitId: t,
|
|
36
|
+
subUnitId: t
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
40
|
__getCurrentSelection() {
|
|
42
41
|
return this._currentSelection;
|
|
43
42
|
}
|
|
44
|
-
getSelectionInfo(
|
|
45
|
-
return this._getTextRanges(
|
|
43
|
+
getSelectionInfo(e = this._currentSelection) {
|
|
44
|
+
return this._getTextRanges(e);
|
|
46
45
|
}
|
|
47
|
-
refreshSelection(
|
|
48
|
-
|
|
46
|
+
refreshSelection(e = this._currentSelection) {
|
|
47
|
+
e != null && this._refresh(e);
|
|
49
48
|
}
|
|
50
49
|
// **Only used in test case** because this does not go through the render layer.
|
|
51
|
-
__TEST_ONLY_setCurrentSelection(
|
|
52
|
-
this._currentSelection =
|
|
50
|
+
__TEST_ONLY_setCurrentSelection(e) {
|
|
51
|
+
this._currentSelection = e, this._refresh(e);
|
|
53
52
|
}
|
|
54
|
-
getTextRanges(
|
|
55
|
-
var
|
|
56
|
-
return (
|
|
53
|
+
getTextRanges(e = this._currentSelection) {
|
|
54
|
+
var t;
|
|
55
|
+
return (t = this._getTextRanges(e)) == null ? void 0 : t.textRanges;
|
|
57
56
|
}
|
|
58
|
-
getRectRanges(
|
|
59
|
-
var
|
|
60
|
-
return (
|
|
57
|
+
getRectRanges(e = this._currentSelection) {
|
|
58
|
+
var t;
|
|
59
|
+
return (t = this._getTextRanges(e)) == null ? void 0 : t.rectRanges;
|
|
61
60
|
}
|
|
62
|
-
getDocRanges(
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
return [...
|
|
61
|
+
getDocRanges(e = this._currentSelection) {
|
|
62
|
+
var r, o;
|
|
63
|
+
const t = (r = this.getTextRanges(e)) != null ? r : [], n = (o = this.getRectRanges(e)) != null ? o : [];
|
|
64
|
+
return [...t, ...n].filter((c) => c.startOffset != null && c.endOffset != null).sort((c, a) => c.startOffset > a.startOffset ? 1 : c.startOffset < a.startOffset ? -1 : 0);
|
|
66
65
|
}
|
|
67
66
|
getActiveTextRange() {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
67
|
+
const e = this._getTextRanges(this._currentSelection);
|
|
68
|
+
if (e == null)
|
|
70
69
|
return;
|
|
71
|
-
const { textRanges } =
|
|
72
|
-
return
|
|
70
|
+
const { textRanges: t } = e;
|
|
71
|
+
return t.find((n) => n.isActive);
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
*
|
|
76
75
|
* @deprecated
|
|
77
76
|
*/
|
|
78
77
|
getActiveRectRange() {
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
78
|
+
const e = this._getTextRanges(this._currentSelection);
|
|
79
|
+
if (e == null)
|
|
81
80
|
return;
|
|
82
|
-
const { rectRanges } =
|
|
83
|
-
return
|
|
81
|
+
const { rectRanges: t } = e;
|
|
82
|
+
return t.find((n) => n.isActive);
|
|
84
83
|
}
|
|
85
84
|
// **Only used in test case** because this does not go through the render layer.
|
|
86
|
-
__TEST_ONLY_add(
|
|
85
|
+
__TEST_ONLY_add(e, t = !0) {
|
|
87
86
|
this._currentSelection != null && this._addByParam({
|
|
88
87
|
...this._currentSelection,
|
|
89
|
-
textRanges,
|
|
88
|
+
textRanges: e,
|
|
90
89
|
rectRanges: [],
|
|
91
90
|
segmentId: "",
|
|
92
91
|
segmentPage: -1,
|
|
93
|
-
isEditing,
|
|
94
|
-
style:
|
|
92
|
+
isEditing: t,
|
|
93
|
+
style: Se
|
|
95
94
|
// mock style.
|
|
96
95
|
});
|
|
97
96
|
}
|
|
@@ -99,104 +98,104 @@ let DocSelectionManagerService = (_a = class extends RxDisposable {
|
|
|
99
98
|
/**
|
|
100
99
|
* @deprecated pls use replaceDocRanges.
|
|
101
100
|
*/
|
|
102
|
-
replaceTextRanges(
|
|
101
|
+
replaceTextRanges(e, t = !0, n) {
|
|
103
102
|
return this.replaceDocRanges(
|
|
104
|
-
|
|
103
|
+
e,
|
|
105
104
|
this._currentSelection,
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
t,
|
|
106
|
+
n
|
|
108
107
|
);
|
|
109
108
|
}
|
|
110
|
-
replaceDocRanges(
|
|
111
|
-
if (
|
|
109
|
+
replaceDocRanges(e, t = this._currentSelection, n = !0, s) {
|
|
110
|
+
if (t == null)
|
|
112
111
|
return;
|
|
113
|
-
const { unitId, subUnitId } =
|
|
112
|
+
const { unitId: r, subUnitId: o } = t;
|
|
114
113
|
this._refreshSelection$.next({
|
|
115
|
-
unitId,
|
|
116
|
-
subUnitId,
|
|
117
|
-
docRanges,
|
|
118
|
-
isEditing,
|
|
119
|
-
options
|
|
114
|
+
unitId: r,
|
|
115
|
+
subUnitId: o,
|
|
116
|
+
docRanges: e,
|
|
117
|
+
isEditing: n,
|
|
118
|
+
options: s
|
|
120
119
|
});
|
|
121
120
|
}
|
|
122
121
|
// Only use in doc-selection-render.controller.ts
|
|
123
|
-
__replaceTextRangesWithNoRefresh(
|
|
122
|
+
__replaceTextRangesWithNoRefresh(e, t) {
|
|
124
123
|
if (this._currentSelection == null)
|
|
125
124
|
return;
|
|
126
|
-
const
|
|
127
|
-
...
|
|
128
|
-
...
|
|
125
|
+
const n = {
|
|
126
|
+
...e,
|
|
127
|
+
...t
|
|
129
128
|
};
|
|
130
|
-
this._replaceByParam(
|
|
131
|
-
const { unitId, subUnitId, segmentId, style, textRanges, rectRanges, isEditing } =
|
|
132
|
-
this._commandService.executeCommand(
|
|
133
|
-
unitId,
|
|
134
|
-
subUnitId,
|
|
135
|
-
segmentId,
|
|
136
|
-
style,
|
|
137
|
-
isEditing,
|
|
138
|
-
ranges
|
|
129
|
+
this._replaceByParam(n), this._textSelection$.next(n);
|
|
130
|
+
const { unitId: s, subUnitId: r, segmentId: o, style: c, textRanges: a, rectRanges: l, isEditing: d } = n, h = [...a, ...l].filter((g) => g.startOffset != null && g.endOffset != null).sort((g, f) => g.startOffset > f.startOffset ? 1 : g.startOffset < f.startOffset ? -1 : 0);
|
|
131
|
+
this._commandService.executeCommand(X.id, {
|
|
132
|
+
unitId: s,
|
|
133
|
+
subUnitId: r,
|
|
134
|
+
segmentId: o,
|
|
135
|
+
style: c,
|
|
136
|
+
isEditing: d,
|
|
137
|
+
ranges: h
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
140
|
dispose() {
|
|
142
141
|
this._textSelection$.complete();
|
|
143
142
|
}
|
|
144
|
-
_setCurrentSelectionNotRefresh(
|
|
145
|
-
this._currentSelection =
|
|
143
|
+
_setCurrentSelectionNotRefresh(e) {
|
|
144
|
+
this._currentSelection = e;
|
|
146
145
|
}
|
|
147
|
-
_getTextRanges(
|
|
148
|
-
var
|
|
149
|
-
if (
|
|
146
|
+
_getTextRanges(e) {
|
|
147
|
+
var s;
|
|
148
|
+
if (e == null)
|
|
150
149
|
return;
|
|
151
|
-
const { unitId, subUnitId = "" } =
|
|
152
|
-
return (
|
|
150
|
+
const { unitId: t, subUnitId: n = "" } = e;
|
|
151
|
+
return (s = this._textSelectionInfo.get(t)) == null ? void 0 : s.get(n);
|
|
153
152
|
}
|
|
154
|
-
_refresh(
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
153
|
+
_refresh(e) {
|
|
154
|
+
const t = this._getTextRanges(e);
|
|
155
|
+
if (t == null)
|
|
157
156
|
return;
|
|
158
|
-
const { textRanges, rectRanges } =
|
|
157
|
+
const { textRanges: n, rectRanges: s } = t, r = [...n, ...s], { unitId: o, subUnitId: c } = e;
|
|
159
158
|
this._refreshSelection$.next({
|
|
160
|
-
unitId,
|
|
161
|
-
subUnitId,
|
|
162
|
-
docRanges,
|
|
159
|
+
unitId: o,
|
|
160
|
+
subUnitId: c,
|
|
161
|
+
docRanges: r,
|
|
163
162
|
isEditing: !1
|
|
164
163
|
});
|
|
165
164
|
}
|
|
166
|
-
_replaceByParam(
|
|
167
|
-
const { unitId, subUnitId, ...
|
|
168
|
-
this._textSelectionInfo.has(
|
|
169
|
-
}
|
|
170
|
-
_addByParam(
|
|
171
|
-
const { unitId, subUnitId, ...
|
|
172
|
-
this._textSelectionInfo.has(
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
var
|
|
182
|
-
for (var
|
|
183
|
-
(
|
|
184
|
-
return
|
|
185
|
-
},
|
|
186
|
-
let
|
|
187
|
-
constructor(
|
|
165
|
+
_replaceByParam(e) {
|
|
166
|
+
const { unitId: t, subUnitId: n, ...s } = e;
|
|
167
|
+
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { ...s });
|
|
168
|
+
}
|
|
169
|
+
_addByParam(e) {
|
|
170
|
+
const { unitId: t, subUnitId: n, ...s } = e;
|
|
171
|
+
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
|
|
172
|
+
const r = this._textSelectionInfo.get(t);
|
|
173
|
+
r.has(n) ? r.get(n).textRanges.push(...e.textRanges) : r.set(n, { ...s });
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
D = xe([
|
|
177
|
+
W(0, L),
|
|
178
|
+
W(1, p)
|
|
179
|
+
], D);
|
|
180
|
+
var Me = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, De = (i, e, t, n) => {
|
|
181
|
+
for (var s = n > 1 ? void 0 : n ? Ce(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
182
|
+
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
183
|
+
return n && s && Me(e, t, s), s;
|
|
184
|
+
}, Y = (i, e) => (t, n) => e(t, n, i);
|
|
185
|
+
let T = class extends A {
|
|
186
|
+
constructor(e, t, n) {
|
|
188
187
|
super();
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
u(this, "_skeleton");
|
|
189
|
+
u(this, "_docViewModel");
|
|
190
|
+
u(this, "_currentSkeleton$", new C(null));
|
|
191
|
+
u(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
|
|
193
192
|
// CurrentSkeletonBefore for pre-triggered logic during registration
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this._context =
|
|
199
|
-
|
|
193
|
+
u(this, "_currentSkeletonBefore$", new C(null));
|
|
194
|
+
u(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
195
|
+
u(this, "_currentViewModel$", new C(null));
|
|
196
|
+
u(this, "currentViewModel$", this._currentViewModel$.asObservable());
|
|
197
|
+
this._context = e, this._localeService = t, this._univerInstanceService = n, this._init(), this._univerInstanceService.getCurrentTypeOfUnit$(w.UNIVER_DOC).pipe(Z(this.dispose$)).subscribe((s) => {
|
|
198
|
+
s && s.getUnitId() === this._context.unitId && this._update(s);
|
|
200
199
|
});
|
|
201
200
|
}
|
|
202
201
|
dispose() {
|
|
@@ -209,405 +208,398 @@ let DocSkeletonManagerService = (_a2 = class extends RxDisposable {
|
|
|
209
208
|
return this._docViewModel;
|
|
210
209
|
}
|
|
211
210
|
_init() {
|
|
212
|
-
const
|
|
213
|
-
this._update(
|
|
211
|
+
const e = this._context.unit;
|
|
212
|
+
this._update(e);
|
|
214
213
|
}
|
|
215
|
-
_update(
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
214
|
+
_update(e) {
|
|
215
|
+
const t = this._context.unitId;
|
|
216
|
+
if (e.getBody() == null)
|
|
218
217
|
return;
|
|
219
|
-
this._docViewModel &&
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
_buildSkeleton(
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
_buildDocViewModel(
|
|
227
|
-
return new
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
],
|
|
234
|
-
|
|
218
|
+
this._docViewModel && ce(t) ? (this._docViewModel.reset(e), this._context.unit = e) : this._docViewModel || (this._docViewModel = this._buildDocViewModel(e)), this._skeleton || (this._skeleton = this._buildSkeleton(this._docViewModel));
|
|
219
|
+
const n = this._skeleton;
|
|
220
|
+
n.calculate(), this._currentSkeletonBefore$.next(n), this._currentSkeleton$.next(n), this._currentViewModel$.next(this._docViewModel);
|
|
221
|
+
}
|
|
222
|
+
_buildSkeleton(e) {
|
|
223
|
+
return pe.create(e, this._localeService);
|
|
224
|
+
}
|
|
225
|
+
_buildDocViewModel(e) {
|
|
226
|
+
return new Ie(e);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
T = De([
|
|
230
|
+
Y(1, $(oe)),
|
|
231
|
+
Y(2, p)
|
|
232
|
+
], T);
|
|
233
|
+
class te extends A {
|
|
235
234
|
constructor() {
|
|
236
235
|
super();
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
u(this, "_docStateChangeParams$", new C(null));
|
|
237
|
+
u(this, "docStateChangeParams$", this._docStateChangeParams$.asObservable());
|
|
239
238
|
}
|
|
240
|
-
emitStateChangeInfo(
|
|
241
|
-
this._docStateChangeParams$.next(
|
|
239
|
+
emitStateChangeInfo(t) {
|
|
240
|
+
this._docStateChangeParams$.next(t);
|
|
242
241
|
}
|
|
243
242
|
dispose() {
|
|
244
243
|
super.dispose(), this._docStateChangeParams$.complete();
|
|
245
244
|
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
id: RichTextEditingMutationId,
|
|
251
|
-
type: CommandType.MUTATION,
|
|
245
|
+
}
|
|
246
|
+
const K = "doc.mutation.rich-text-editing", Te = {
|
|
247
|
+
id: K,
|
|
248
|
+
type: j.MUTATION,
|
|
252
249
|
// eslint-disable-next-line max-lines-per-function
|
|
253
|
-
handler:
|
|
254
|
-
var
|
|
250
|
+
handler: (i, e) => {
|
|
251
|
+
var G, F;
|
|
255
252
|
const {
|
|
256
|
-
unitId,
|
|
257
|
-
segmentId = "",
|
|
258
|
-
actions,
|
|
259
|
-
textRanges,
|
|
260
|
-
prevTextRanges,
|
|
261
|
-
trigger,
|
|
262
|
-
noHistory,
|
|
263
|
-
isCompositionEnd,
|
|
264
|
-
noNeedSetTextRange,
|
|
265
|
-
debounce,
|
|
266
|
-
isEditing = !0,
|
|
267
|
-
isSync,
|
|
268
|
-
syncer
|
|
269
|
-
} =
|
|
270
|
-
if (
|
|
271
|
-
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
253
|
+
unitId: t,
|
|
254
|
+
segmentId: n = "",
|
|
255
|
+
actions: s,
|
|
256
|
+
textRanges: r,
|
|
257
|
+
prevTextRanges: o,
|
|
258
|
+
trigger: c,
|
|
259
|
+
noHistory: a,
|
|
260
|
+
isCompositionEnd: l,
|
|
261
|
+
noNeedSetTextRange: d,
|
|
262
|
+
debounce: h,
|
|
263
|
+
isEditing: g = !0,
|
|
264
|
+
isSync: f,
|
|
265
|
+
syncer: m
|
|
266
|
+
} = e, I = i.get(p), S = i.get(me), v = i.get(te), _ = I.getUniverDocInstance(t), x = (G = S.getRenderById(t)) == null ? void 0 : G.with(T).getViewModel();
|
|
267
|
+
if (_ == null || x == null)
|
|
268
|
+
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
|
|
269
|
+
const M = i.get(D), E = (F = M.getDocRanges()) != null ? F : [], ne = !!_.getSnapshot().disabled;
|
|
270
|
+
if (R.isNoop(s) || s && s.length === 0 || ne)
|
|
274
271
|
return {
|
|
275
|
-
unitId,
|
|
272
|
+
unitId: t,
|
|
276
273
|
actions: [],
|
|
277
|
-
textRanges:
|
|
274
|
+
textRanges: E
|
|
278
275
|
};
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
const z = R.invertWithDoc(s, _.getSnapshot());
|
|
277
|
+
_.apply(s), x.reset(_), !d && r && c != null && queueMicrotask(() => {
|
|
278
|
+
M.replaceDocRanges(r, { unitId: t, subUnitId: t }, g, e.options);
|
|
282
279
|
});
|
|
283
|
-
const
|
|
284
|
-
commandId:
|
|
285
|
-
unitId,
|
|
286
|
-
segmentId,
|
|
287
|
-
trigger,
|
|
288
|
-
noHistory,
|
|
289
|
-
debounce,
|
|
280
|
+
const se = {
|
|
281
|
+
commandId: K,
|
|
282
|
+
unitId: t,
|
|
283
|
+
segmentId: n,
|
|
284
|
+
trigger: c,
|
|
285
|
+
noHistory: a,
|
|
286
|
+
debounce: h,
|
|
290
287
|
redoState: {
|
|
291
|
-
actions,
|
|
292
|
-
textRanges
|
|
288
|
+
actions: s,
|
|
289
|
+
textRanges: r
|
|
293
290
|
},
|
|
294
291
|
undoState: {
|
|
295
|
-
actions:
|
|
296
|
-
textRanges:
|
|
292
|
+
actions: z,
|
|
293
|
+
textRanges: o != null ? o : E
|
|
297
294
|
},
|
|
298
|
-
isCompositionEnd,
|
|
299
|
-
isSync,
|
|
300
|
-
syncer
|
|
295
|
+
isCompositionEnd: l,
|
|
296
|
+
isSync: f,
|
|
297
|
+
syncer: m
|
|
301
298
|
};
|
|
302
|
-
return
|
|
303
|
-
unitId,
|
|
304
|
-
actions:
|
|
305
|
-
textRanges:
|
|
299
|
+
return v.emitStateChangeInfo(se), {
|
|
300
|
+
unitId: t,
|
|
301
|
+
actions: z,
|
|
302
|
+
textRanges: E
|
|
306
303
|
};
|
|
307
|
-
}
|
|
308
|
-
},
|
|
304
|
+
}
|
|
305
|
+
}, be = {
|
|
309
306
|
id: "doc.mutation.rename-doc",
|
|
310
|
-
type:
|
|
311
|
-
handler:
|
|
312
|
-
const
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
var
|
|
317
|
-
for (var
|
|
318
|
-
(
|
|
319
|
-
return
|
|
320
|
-
},
|
|
321
|
-
let
|
|
322
|
-
constructor(
|
|
323
|
-
super(), this._commandService =
|
|
324
|
-
}
|
|
325
|
-
_transformCustomRange(
|
|
326
|
-
var
|
|
327
|
-
const { startOffset, endOffset, collapsed } =
|
|
328
|
-
if (
|
|
329
|
-
let
|
|
330
|
-
return
|
|
331
|
-
|
|
307
|
+
type: j.MUTATION,
|
|
308
|
+
handler: (i, e) => {
|
|
309
|
+
const n = i.get(p).getUnit(e.unitId, w.UNIVER_DOC);
|
|
310
|
+
return n ? (n.setName(e.name), !0) : !1;
|
|
311
|
+
}
|
|
312
|
+
}, we = "docs.config", $e = {};
|
|
313
|
+
var ye = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, Ee = (i, e, t, n) => {
|
|
314
|
+
for (var s = n > 1 ? void 0 : n ? Ue(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
315
|
+
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
316
|
+
return n && s && ye(e, t, s), s;
|
|
317
|
+
}, N = (i, e) => (t, n) => e(t, n, i);
|
|
318
|
+
let b = class extends J {
|
|
319
|
+
constructor(i, e, t) {
|
|
320
|
+
super(), this._commandService = i, this._textSelectionManagerService = e, this._univerInstanceService = t, this._initSelectionChange();
|
|
321
|
+
}
|
|
322
|
+
_transformCustomRange(i, e) {
|
|
323
|
+
var o;
|
|
324
|
+
const { startOffset: t, endOffset: n, collapsed: s } = e, r = (o = i.getCustomRanges()) == null ? void 0 : o.filter((c) => !c.wholeEntity || t <= c.startIndex && n > c.endIndex ? !1 : s ? c.startIndex < t && c.endIndex >= n : O.range.isIntersects(t, n - 1, c.startIndex, c.endIndex));
|
|
325
|
+
if (r != null && r.length) {
|
|
326
|
+
let c = t, a = n;
|
|
327
|
+
return r.forEach((l) => {
|
|
328
|
+
c = Math.min(l.startIndex, c), a = Math.max(l.endIndex + 1, a);
|
|
332
329
|
}), {
|
|
333
|
-
...
|
|
334
|
-
startOffset:
|
|
335
|
-
endOffset:
|
|
336
|
-
collapsed:
|
|
330
|
+
...e,
|
|
331
|
+
startOffset: c,
|
|
332
|
+
endOffset: a,
|
|
333
|
+
collapsed: c === a
|
|
337
334
|
};
|
|
338
335
|
}
|
|
339
|
-
return
|
|
336
|
+
return e;
|
|
340
337
|
}
|
|
341
338
|
_initSelectionChange() {
|
|
342
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
343
|
-
if (
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
339
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
|
|
340
|
+
if (i.id === X.id) {
|
|
341
|
+
const e = i.params, { unitId: t, ranges: n, isEditing: s } = e, r = this._univerInstanceService.getUnit(t);
|
|
342
|
+
if (!r)
|
|
346
343
|
return;
|
|
347
|
-
const
|
|
348
|
-
|
|
344
|
+
const o = n.map((c) => this._transformCustomRange(r, c));
|
|
345
|
+
o.some((c, a) => n[a] !== c) && this._textSelectionManagerService.replaceTextRanges(o, s);
|
|
349
346
|
}
|
|
350
347
|
}));
|
|
351
348
|
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
],
|
|
358
|
-
var
|
|
359
|
-
for (var
|
|
360
|
-
(
|
|
361
|
-
return
|
|
362
|
-
},
|
|
363
|
-
const
|
|
364
|
-
var
|
|
365
|
-
let
|
|
349
|
+
};
|
|
350
|
+
b = Ee([
|
|
351
|
+
N(0, L),
|
|
352
|
+
N(1, $(D)),
|
|
353
|
+
N(2, p)
|
|
354
|
+
], b);
|
|
355
|
+
var Pe = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, Ve = (i, e, t, n) => {
|
|
356
|
+
for (var s = n > 1 ? void 0 : n ? Ne(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
357
|
+
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
358
|
+
return n && s && Pe(e, t, s), s;
|
|
359
|
+
}, H = (i, e) => (t, n) => e(t, n, i);
|
|
360
|
+
const Be = "DOCS_PLUGIN";
|
|
361
|
+
var B;
|
|
362
|
+
let k = (B = class extends le {
|
|
366
363
|
// static override type = UniverInstanceType.UNIVER_DOC;
|
|
367
|
-
constructor(
|
|
368
|
-
super(), this._config =
|
|
369
|
-
const { ...
|
|
370
|
-
this._configService.setConfig(
|
|
364
|
+
constructor(i = $e, e, t) {
|
|
365
|
+
super(), this._config = i, this._injector = e, this._configService = t;
|
|
366
|
+
const { ...n } = this._config;
|
|
367
|
+
this._configService.setConfig(we, n);
|
|
371
368
|
}
|
|
372
369
|
onStarting() {
|
|
373
370
|
this._initializeDependencies(), this._initializeCommands();
|
|
374
371
|
}
|
|
375
372
|
_initializeCommands() {
|
|
376
373
|
[
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
].forEach((
|
|
381
|
-
this._injector.get(
|
|
374
|
+
Te,
|
|
375
|
+
be,
|
|
376
|
+
X
|
|
377
|
+
].forEach((i) => {
|
|
378
|
+
this._injector.get(L).registerCommand(i);
|
|
382
379
|
});
|
|
383
380
|
}
|
|
384
381
|
_initializeDependencies() {
|
|
385
382
|
[
|
|
386
|
-
[
|
|
387
|
-
[
|
|
388
|
-
[
|
|
389
|
-
].forEach((
|
|
383
|
+
[D],
|
|
384
|
+
[te],
|
|
385
|
+
[b]
|
|
386
|
+
].forEach((i) => this._injector.add(i));
|
|
390
387
|
}
|
|
391
388
|
onReady() {
|
|
392
|
-
this._injector.get(
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
],
|
|
399
|
-
const
|
|
400
|
-
CUSTOM_RANGE,
|
|
401
|
-
CUSTOM_DECORATION
|
|
389
|
+
this._injector.get(b);
|
|
390
|
+
}
|
|
391
|
+
}, u(B, "pluginName", Be), B);
|
|
392
|
+
k = Ve([
|
|
393
|
+
H(1, $(ae)),
|
|
394
|
+
H(2, ue)
|
|
395
|
+
], k);
|
|
396
|
+
const je = Q("CUSTOM_RANGE"), Ae = Q("CUSTOM_DECORATION"), V = {
|
|
397
|
+
CUSTOM_RANGE: je,
|
|
398
|
+
CUSTOM_DECORATION: Ae
|
|
402
399
|
};
|
|
403
|
-
var
|
|
404
|
-
for (var
|
|
405
|
-
(
|
|
406
|
-
return
|
|
407
|
-
},
|
|
408
|
-
let
|
|
409
|
-
constructor(
|
|
400
|
+
var Le = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, ze = (i, e, t, n) => {
|
|
401
|
+
for (var s = n > 1 ? void 0 : n ? Xe(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
402
|
+
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
403
|
+
return n && s && Le(e, t, s), s;
|
|
404
|
+
}, Ge = (i, e) => (t, n) => e(t, n, i);
|
|
405
|
+
let q = class extends J {
|
|
406
|
+
constructor(e, t) {
|
|
410
407
|
super();
|
|
411
|
-
|
|
412
|
-
this._context =
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
408
|
+
u(this, "_interceptorsByName", /* @__PURE__ */ new Map());
|
|
409
|
+
this._context = e, this._docSkeletonManagerService = t;
|
|
410
|
+
const n = this._docSkeletonManagerService.getViewModel(), s = n.getDataModel().getUnitId();
|
|
411
|
+
if (s === de || s === ge)
|
|
415
412
|
return;
|
|
416
|
-
this.disposeWithMe(this.interceptDocumentViewModel(
|
|
413
|
+
this.disposeWithMe(this.interceptDocumentViewModel(n)), this.disposeWithMe(this.intercept(V.CUSTOM_RANGE, {
|
|
417
414
|
priority: -1,
|
|
418
|
-
handler:
|
|
415
|
+
handler: (o, c, a) => a(o)
|
|
419
416
|
}));
|
|
420
|
-
let
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
417
|
+
let r = new P();
|
|
418
|
+
n.segmentViewModels$.subscribe((o) => {
|
|
419
|
+
r.dispose(), r = new P(), o.forEach((c) => {
|
|
420
|
+
r.add(this.interceptDocumentViewModel(c));
|
|
424
421
|
});
|
|
425
|
-
}), this.disposeWithMe(
|
|
426
|
-
}
|
|
427
|
-
intercept(
|
|
428
|
-
const
|
|
429
|
-
this._interceptorsByName.has(
|
|
430
|
-
const
|
|
431
|
-
return
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
var
|
|
435
|
-
return ((
|
|
422
|
+
}), this.disposeWithMe(r);
|
|
423
|
+
}
|
|
424
|
+
intercept(e, t) {
|
|
425
|
+
const n = e;
|
|
426
|
+
this._interceptorsByName.has(n) || this._interceptorsByName.set(n, []);
|
|
427
|
+
const s = this._interceptorsByName.get(n);
|
|
428
|
+
return s.push(t), this._interceptorsByName.set(
|
|
429
|
+
n,
|
|
430
|
+
s.sort((r, o) => {
|
|
431
|
+
var c, a;
|
|
432
|
+
return ((c = o.priority) != null ? c : 0) - ((a = r.priority) != null ? a : 0);
|
|
436
433
|
})
|
|
437
|
-
), this.disposeWithMe(
|
|
438
|
-
}
|
|
439
|
-
fetchThroughInterceptors(
|
|
440
|
-
const
|
|
441
|
-
return
|
|
442
|
-
}
|
|
443
|
-
interceptDocumentViewModel(
|
|
444
|
-
const
|
|
445
|
-
return
|
|
446
|
-
getCustomRange:
|
|
447
|
-
var
|
|
448
|
-
return this.fetchThroughInterceptors(
|
|
449
|
-
|
|
434
|
+
), this.disposeWithMe(_e(() => he(this._interceptorsByName.get(n), t)));
|
|
435
|
+
}
|
|
436
|
+
fetchThroughInterceptors(e) {
|
|
437
|
+
const t = e, n = this._interceptorsByName.get(t);
|
|
438
|
+
return fe(n || []);
|
|
439
|
+
}
|
|
440
|
+
interceptDocumentViewModel(e) {
|
|
441
|
+
const t = new P();
|
|
442
|
+
return t.add(e.registerCustomRangeInterceptor({
|
|
443
|
+
getCustomRange: (n) => {
|
|
444
|
+
var s;
|
|
445
|
+
return this.fetchThroughInterceptors(V.CUSTOM_RANGE)(
|
|
446
|
+
e.getCustomRangeRaw(n),
|
|
450
447
|
{
|
|
451
|
-
index,
|
|
452
|
-
unitId:
|
|
453
|
-
customRanges: (
|
|
448
|
+
index: n,
|
|
449
|
+
unitId: e.getDataModel().getUnitId(),
|
|
450
|
+
customRanges: (s = e.getDataModel().getCustomRanges()) != null ? s : []
|
|
454
451
|
}
|
|
455
452
|
);
|
|
456
|
-
},
|
|
457
|
-
getCustomDecoration:
|
|
458
|
-
var
|
|
459
|
-
return this.fetchThroughInterceptors(
|
|
460
|
-
|
|
453
|
+
},
|
|
454
|
+
getCustomDecoration: (n) => {
|
|
455
|
+
var s;
|
|
456
|
+
return this.fetchThroughInterceptors(V.CUSTOM_DECORATION)(
|
|
457
|
+
e.getCustomDecorationRaw(n),
|
|
461
458
|
{
|
|
462
|
-
index,
|
|
463
|
-
unitId:
|
|
464
|
-
customDecorations: (
|
|
459
|
+
index: n,
|
|
460
|
+
unitId: e.getDataModel().getUnitId(),
|
|
461
|
+
customDecorations: (s = e.getDataModel().getCustomDecorations()) != null ? s : []
|
|
465
462
|
}
|
|
466
463
|
);
|
|
467
|
-
}
|
|
468
|
-
})),
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
],
|
|
474
|
-
function
|
|
475
|
-
if (!
|
|
464
|
+
}
|
|
465
|
+
})), t;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
q = ze([
|
|
469
|
+
Ge(1, $(T))
|
|
470
|
+
], q);
|
|
471
|
+
function U(i, e = "") {
|
|
472
|
+
if (!e)
|
|
476
473
|
return ["body"];
|
|
477
|
-
const { headers, footers } =
|
|
478
|
-
if (
|
|
474
|
+
const { headers: t, footers: n } = i.getSnapshot();
|
|
475
|
+
if (t == null && n == null)
|
|
479
476
|
throw new Error("Document data model must have headers or footers when update by segment id");
|
|
480
|
-
if ((
|
|
481
|
-
return ["headers",
|
|
482
|
-
if ((
|
|
483
|
-
return ["footers",
|
|
477
|
+
if ((t == null ? void 0 : t[e]) != null)
|
|
478
|
+
return ["headers", e, "body"];
|
|
479
|
+
if ((n == null ? void 0 : n[e]) != null)
|
|
480
|
+
return ["footers", e, "body"];
|
|
484
481
|
throw new Error("Segment id not found in headers or footers");
|
|
485
482
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if (!documentDataModel)
|
|
483
|
+
function ke(i, e, t) {
|
|
484
|
+
const { unitId: n, segmentId: s } = e, o = i.get(p).getUnit(n);
|
|
485
|
+
if (!o)
|
|
490
486
|
return !1;
|
|
491
|
-
const
|
|
492
|
-
id:
|
|
487
|
+
const c = {
|
|
488
|
+
id: y.id,
|
|
493
489
|
params: {
|
|
494
|
-
unitId:
|
|
490
|
+
unitId: e.unitId,
|
|
495
491
|
actions: [],
|
|
496
492
|
textRanges: void 0
|
|
497
493
|
}
|
|
498
|
-
},
|
|
499
|
-
if (!
|
|
494
|
+
}, a = R.getInstance(), l = O.customRange.add({ ...e, body: t });
|
|
495
|
+
if (!l)
|
|
500
496
|
return !1;
|
|
501
|
-
const
|
|
502
|
-
return
|
|
497
|
+
const d = U(o, s);
|
|
498
|
+
return c.params.actions = a.editOp(l.serialize(), d), c;
|
|
503
499
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
if (!selection)
|
|
500
|
+
function qe(i, e) {
|
|
501
|
+
var M;
|
|
502
|
+
const { rangeId: t, rangeType: n, wholeEntity: s, properties: r, unitId: o, selection: c } = e, a = i.get(ee), l = i.get(p), d = c != null ? c : (M = a.getTextRanges({ unitId: o, subUnitId: o })) == null ? void 0 : M[0], h = d == null ? void 0 : d.segmentId;
|
|
503
|
+
if (!d)
|
|
509
504
|
return !1;
|
|
510
|
-
const
|
|
511
|
-
if (!
|
|
505
|
+
const g = l.getUnit(o, w.UNIVER_DOC);
|
|
506
|
+
if (!g)
|
|
512
507
|
return !1;
|
|
513
|
-
const
|
|
514
|
-
if (!
|
|
508
|
+
const f = g.getSelfOrHeaderFooterModel(d.segmentId).getBody();
|
|
509
|
+
if (!f)
|
|
515
510
|
return !1;
|
|
516
|
-
const { startOffset, endOffset } =
|
|
517
|
-
range: { startOffset, endOffset, collapsed:
|
|
518
|
-
rangeId,
|
|
519
|
-
rangeType,
|
|
520
|
-
segmentId,
|
|
521
|
-
wholeEntity,
|
|
522
|
-
properties,
|
|
523
|
-
body
|
|
511
|
+
const { startOffset: m, endOffset: I } = O.selection.normalizeSelection(d), S = O.customRange.add({
|
|
512
|
+
range: { startOffset: m, endOffset: I, collapsed: m === I },
|
|
513
|
+
rangeId: t,
|
|
514
|
+
rangeType: n,
|
|
515
|
+
segmentId: h,
|
|
516
|
+
wholeEntity: s,
|
|
517
|
+
properties: r,
|
|
518
|
+
body: f
|
|
524
519
|
});
|
|
525
|
-
if (!
|
|
520
|
+
if (!S)
|
|
526
521
|
return !1;
|
|
527
|
-
const
|
|
528
|
-
id:
|
|
522
|
+
const v = R.getInstance(), _ = {
|
|
523
|
+
id: y.id,
|
|
529
524
|
params: {
|
|
530
|
-
unitId,
|
|
525
|
+
unitId: o,
|
|
531
526
|
actions: [],
|
|
532
|
-
textRanges:
|
|
527
|
+
textRanges: S.selections
|
|
533
528
|
},
|
|
534
|
-
textX
|
|
535
|
-
},
|
|
536
|
-
return
|
|
529
|
+
textX: S
|
|
530
|
+
}, x = U(g, h);
|
|
531
|
+
return _.params.actions = v.editOp(S.serialize(), x), _;
|
|
537
532
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (!documentDataModel)
|
|
533
|
+
function Je(i, e) {
|
|
534
|
+
const { unitId: t, segmentId: n, insert: s } = e, o = i.get(p).getUnit(t);
|
|
535
|
+
if (!o)
|
|
542
536
|
return !1;
|
|
543
|
-
const
|
|
544
|
-
id:
|
|
537
|
+
const c = {
|
|
538
|
+
id: y.id,
|
|
545
539
|
params: {
|
|
546
|
-
unitId:
|
|
540
|
+
unitId: e.unitId,
|
|
547
541
|
actions: [],
|
|
548
542
|
textRanges: void 0,
|
|
549
|
-
segmentId
|
|
543
|
+
segmentId: n
|
|
550
544
|
}
|
|
551
|
-
},
|
|
552
|
-
documentDataModel,
|
|
553
|
-
rangeId:
|
|
554
|
-
insert,
|
|
555
|
-
segmentId
|
|
545
|
+
}, a = R.getInstance(), l = O.customRange.delete(i, {
|
|
546
|
+
documentDataModel: o,
|
|
547
|
+
rangeId: e.rangeId,
|
|
548
|
+
insert: s,
|
|
549
|
+
segmentId: n
|
|
556
550
|
});
|
|
557
|
-
if (!
|
|
551
|
+
if (!l)
|
|
558
552
|
return !1;
|
|
559
|
-
const
|
|
560
|
-
return
|
|
553
|
+
const d = U(o, n);
|
|
554
|
+
return c.params.actions = a.editOp(l.serialize(), d), c.params.textRanges = l.selections, c;
|
|
561
555
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (docDataModel || (docDataModel = accessor.get(IUniverInstanceService).getUnit(unitId)), !docDataModel)
|
|
556
|
+
function Qe(i, e) {
|
|
557
|
+
var I, S, v, _;
|
|
558
|
+
const { unitId: t, body: n, doc: s } = e;
|
|
559
|
+
let r = s;
|
|
560
|
+
if (r || (r = i.get(p).getUnit(t)), !r)
|
|
568
561
|
return !1;
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
571
|
-
const
|
|
572
|
-
if (!
|
|
562
|
+
const o = (I = e.selection) == null ? void 0 : I.segmentId, c = (S = r.getSelfOrHeaderFooterModel(o)) == null ? void 0 : S.getBody();
|
|
563
|
+
if (!c) return !1;
|
|
564
|
+
const a = i.get(ee), l = (v = e.selection) != null ? v : a.getActiveTextRange();
|
|
565
|
+
if (!l || !c)
|
|
573
566
|
return !1;
|
|
574
|
-
const
|
|
575
|
-
startOffset:
|
|
576
|
-
endOffset:
|
|
567
|
+
const d = (_ = e.textRanges) != null ? _ : [{
|
|
568
|
+
startOffset: l.startOffset + n.dataStream.length,
|
|
569
|
+
endOffset: l.startOffset + n.dataStream.length,
|
|
577
570
|
collapsed: !0,
|
|
578
|
-
segmentId
|
|
579
|
-
}],
|
|
580
|
-
selection,
|
|
581
|
-
body:
|
|
582
|
-
doc:
|
|
571
|
+
segmentId: o
|
|
572
|
+
}], h = O.selection.replace({
|
|
573
|
+
selection: l,
|
|
574
|
+
body: n,
|
|
575
|
+
doc: r
|
|
583
576
|
});
|
|
584
|
-
if (!
|
|
577
|
+
if (!h)
|
|
585
578
|
return !1;
|
|
586
|
-
const
|
|
587
|
-
id:
|
|
579
|
+
const g = {
|
|
580
|
+
id: y.id,
|
|
588
581
|
params: {
|
|
589
|
-
unitId,
|
|
582
|
+
unitId: t,
|
|
590
583
|
actions: [],
|
|
591
|
-
textRanges,
|
|
584
|
+
textRanges: d,
|
|
592
585
|
debounce: !0,
|
|
593
|
-
segmentId
|
|
586
|
+
segmentId: o
|
|
594
587
|
},
|
|
595
|
-
textX
|
|
596
|
-
},
|
|
597
|
-
return
|
|
588
|
+
textX: h
|
|
589
|
+
}, f = R.getInstance(), m = U(r, o);
|
|
590
|
+
return g.params.actions = f.editOp(h.serialize(), m), g;
|
|
598
591
|
}
|
|
599
|
-
__name(replaceSelectionFactory, "replaceSelectionFactory");
|
|
600
592
|
export {
|
|
601
|
-
DOC_INTERCEPTOR_POINT,
|
|
602
|
-
DocInterceptorService,
|
|
603
|
-
DocSelectionManagerService,
|
|
604
|
-
DocSkeletonManagerService,
|
|
605
|
-
DocStateEmitService,
|
|
606
|
-
RichTextEditingMutation,
|
|
607
|
-
SetTextSelectionsOperation,
|
|
608
|
-
UniverDocsPlugin,
|
|
609
|
-
addCustomRangeBySelectionFactory,
|
|
610
|
-
addCustomRangeFactory,
|
|
611
|
-
deleteCustomRangeFactory,
|
|
612
|
-
replaceSelectionFactory
|
|
593
|
+
V as DOC_INTERCEPTOR_POINT,
|
|
594
|
+
q as DocInterceptorService,
|
|
595
|
+
D as DocSelectionManagerService,
|
|
596
|
+
T as DocSkeletonManagerService,
|
|
597
|
+
te as DocStateEmitService,
|
|
598
|
+
Te as RichTextEditingMutation,
|
|
599
|
+
X as SetTextSelectionsOperation,
|
|
600
|
+
k as UniverDocsPlugin,
|
|
601
|
+
qe as addCustomRangeBySelectionFactory,
|
|
602
|
+
ke as addCustomRangeFactory,
|
|
603
|
+
Je as deleteCustomRangeFactory,
|
|
604
|
+
Qe as replaceSelectionFactory
|
|
613
605
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs",
|
|
3
|
-
"version": "0.4.2-nightly.
|
|
3
|
+
"version": "0.4.2-nightly.202411081606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet normal base-docs",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"import": "./lib/es/index.js",
|
|
26
|
+
"require": "./lib/cjs/index.js",
|
|
26
27
|
"types": "./lib/types/index.d.ts"
|
|
27
28
|
},
|
|
28
29
|
"./*": {
|
|
29
30
|
"import": "./lib/es/*",
|
|
31
|
+
"require": "./lib/cjs/*",
|
|
30
32
|
"types": "./lib/types/index.d.ts"
|
|
31
33
|
},
|
|
32
34
|
"./lib/*": "./lib/*"
|
|
@@ -47,8 +49,8 @@
|
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
51
|
"@vitejs/plugin-react": "4.3.3",
|
|
50
|
-
"@univerjs/core": "0.4.2-nightly.
|
|
51
|
-
"@univerjs/engine-render": "0.4.2-nightly.
|
|
52
|
+
"@univerjs/core": "0.4.2-nightly.202411081606",
|
|
53
|
+
"@univerjs/engine-render": "0.4.2-nightly.202411081606"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
56
|
"rxjs": "^7.8.1",
|
|
@@ -57,13 +59,15 @@
|
|
|
57
59
|
"vitest": "^2.1.4",
|
|
58
60
|
"@univerjs-infra/shared": "0.4.2"
|
|
59
61
|
},
|
|
60
|
-
"
|
|
62
|
+
"space": {
|
|
61
63
|
".": {
|
|
62
64
|
"import": "./lib/es/index.js",
|
|
65
|
+
"require": "./lib/cjs/index.js",
|
|
63
66
|
"types": "./lib/types/index.d.ts"
|
|
64
67
|
},
|
|
65
68
|
"./*": {
|
|
66
69
|
"import": "./lib/es/*",
|
|
70
|
+
"require": "./lib/cjs/*",
|
|
67
71
|
"types": "./lib/types/index.d.ts"
|
|
68
72
|
},
|
|
69
73
|
"./lib/*": "./lib/*"
|
|
@@ -73,7 +77,7 @@
|
|
|
73
77
|
"test:watch": "vitest",
|
|
74
78
|
"coverage": "vitest run --coverage",
|
|
75
79
|
"lint:types": "tsc --noEmit",
|
|
76
|
-
"build": "
|
|
80
|
+
"build": "tsx build.ts"
|
|
77
81
|
},
|
|
78
82
|
"module": "./lib/es/index.js"
|
|
79
83
|
}
|