@univerjs/docs-drawing 0.16.1 → 0.17.0

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var U=Object.defineProperty;var p=(i,e,t)=>e in i?U(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var _=(i,e,t)=>p(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),h=require("@univerjs/drawing");class d extends h.UnitDrawingService{}const v=o.createIdentifier("univer.doc.plugin.doc-drawing.service");var f=Object.getOwnPropertyDescriptor,I=(i,e,t,r)=>{for(var n=r>1?void 0:r?f(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=s(n)||n);return n},g=(i,e)=>(t,r)=>e(t,r,i);const l="DOC_DRAWING_PLUGIN";exports.DocDrawingController=class extends o.Disposable{constructor(e,t,r,n){super(),this._docDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const e=r=>{const n=this._univerInstanceService.getUnit(r,o.UniverInstanceType.UNIVER_DOC);if(n){const a=n.getSnapshot().drawings,s=n.getSnapshot().drawingsOrder,c={data:a!=null?a:{},order:s!=null?s:[]};return JSON.stringify(c)}return""},t=r=>{if(!r)return{data:{},order:[]};try{return JSON.parse(r)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:l,businesses:[o.UniverInstanceType.UNIVER_DOC],toJson:r=>e(r),parseJson:r=>t(r),onUnLoad:r=>{this._setDrawingDataForUnit(r,{data:{},order:[]})},onLoad:(r,n)=>{var a,s;this._setDrawingDataForUnit(r,{data:(a=n.data)!=null?a:{},order:(s=n.order)!=null?s:[]})}}))}_setDrawingDataForUnit(e,t){const r=this._univerInstanceService.getUnit(e);r!=null&&(r.resetDrawing(t.data,t.order),this.loadDrawingDataForUnit(e))}loadDrawingDataForUnit(e){const t=this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_DOC);if(!t)return!1;const r=e,n=t.getDrawings(),a=t.getDrawingsOrder();if(!n||!a)return!1;Object.keys(n).forEach(c=>{const S=n[c];n[c]={...S}});const s={[r]:{unitId:e,subUnitId:r,data:n,order:a}};return this._docDrawingService.registerDrawingData(e,s),this._drawingManagerService.registerDrawingData(e,s),!0}};exports.DocDrawingController=I([g(0,v),g(1,h.IDrawingManagerService),g(2,o.IResourceManagerService),g(3,o.IUniverInstanceService)],exports.DocDrawingController);const C="docs-drawing.config",u={};var O=Object.getOwnPropertyDescriptor,P=(i,e,t,r)=>{for(var n=r>1?void 0:r?O(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=s(n)||n);return n},w=(i,e)=>(t,r)=>e(t,r,i),D;exports.UniverDocsDrawingPlugin=(D=class extends o.Plugin{constructor(e=u,t,r){super(),this._config=e,this._injector=t,this._configService=r;const{...n}=o.merge({},u,this._config);this._configService.setConfig(C,n)}onStarting(){[[exports.DocDrawingController],[d],[v,{useClass:d}]].forEach(e=>this._injector.add(e)),o.touchDependencies(this._injector,[[exports.DocDrawingController]])}},_(D,"pluginName",l),_(D,"type",o.UniverInstanceType.UNIVER_DOC),D);exports.UniverDocsDrawingPlugin=P([w(1,o.Inject(o.Injector)),w(2,o.IConfigService)],exports.UniverDocsDrawingPlugin);exports.DOCS_DRAWING_PLUGIN=l;exports.DocDrawingService=d;exports.IDocDrawingService=v;
1
+ "use strict";var U=Object.defineProperty;var f=(i,e,t)=>e in i?U(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var g=(i,e,t)=>f(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),S=require("@univerjs/drawing");class d extends S.UnitDrawingService{}const _=o.createIdentifier("univer.doc.plugin.doc-drawing.service");var I=Object.getOwnPropertyDescriptor,C=(i,e,t,r)=>{for(var n=r>1?void 0:r?I(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=s(n)||n);return n},v=(i,e)=>(t,r)=>e(t,r,i);const l="DOC_DRAWING_PLUGIN";exports.DocDrawingController=class extends o.Disposable{constructor(e,t,r,n){super(),this._docDrawingService=e,this._drawingManagerService=t,this._resourceManagerService=r,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const e=r=>{const n=this._univerInstanceService.getUnit(r,o.UniverInstanceType.UNIVER_DOC);if(n){const a=n.getSnapshot().drawings,s=n.getSnapshot().drawingsOrder,D={data:a!=null?a:{},order:s!=null?s:[]};return JSON.stringify(D)}return""},t=r=>{if(!r)return{data:{},order:[]};try{return JSON.parse(r)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:l,businesses:[o.UniverInstanceType.UNIVER_DOC],toJson:r=>e(r),parseJson:r=>t(r),onUnLoad:r=>{this._setDrawingDataForUnit(r,{data:{},order:[]})},onLoad:(r,n)=>{var a,s;this._setDrawingDataForUnit(r,{data:(a=n.data)!=null?a:{},order:(s=n.order)!=null?s:[]})}}))}_setDrawingDataForUnit(e,t){const r=this._univerInstanceService.getUnit(e);r!=null&&(r.resetDrawing(t.data,t.order),this.loadDrawingDataForUnit(e))}loadDrawingDataForUnit(e){const t=this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_DOC);if(!t)return!1;const r=e,n=t.getDrawings(),a=t.getDrawingsOrder();if(!n||!a)return!1;Object.keys(n).forEach(D=>{const p=n[D];n[D]={...p}});const s={[r]:{unitId:e,subUnitId:r,data:n,order:a}};return this._docDrawingService.registerDrawingData(e,s),this._drawingManagerService.registerDrawingData(e,s),!0}};exports.DocDrawingController=C([v(0,_),v(1,S.IDrawingManagerService),v(2,o.IResourceManagerService),v(3,o.IUniverInstanceService)],exports.DocDrawingController);const O="@univerjs/docs-drawing",N="0.17.0",u={name:O,version:N},P="docs-drawing.config",w={};var y=Object.getOwnPropertyDescriptor,M=(i,e,t,r)=>{for(var n=r>1?void 0:r?y(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=s(n)||n);return n},h=(i,e)=>(t,r)=>e(t,r,i),c;exports.UniverDocsDrawingPlugin=(c=class extends o.Plugin{constructor(e=w,t,r){super(),this._config=e,this._injector=t,this._configService=r;const{...n}=o.merge({},w,this._config);this._configService.setConfig(P,n)}onStarting(){[[exports.DocDrawingController],[d],[_,{useClass:d}]].forEach(e=>this._injector.add(e)),o.touchDependencies(this._injector,[[exports.DocDrawingController]])}},g(c,"pluginName",l),g(c,"packageName",u.name),g(c,"version",u.version),g(c,"type",o.UniverInstanceType.UNIVER_DOC),c);exports.UniverDocsDrawingPlugin=M([h(1,o.Inject(o.Injector)),h(2,o.IConfigService)],exports.UniverDocsDrawingPlugin);exports.DOCS_DRAWING_PLUGIN=l;exports.DocDrawingService=d;exports.IDocDrawingService=_;
package/lib/es/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  var f = Object.defineProperty;
2
- var p = (r, t, e) => t in r ? f(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var _ = (r, t, e) => p(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { createIdentifier as U, Disposable as I, UniverInstanceType as g, IResourceManagerService as O, IUniverInstanceService as C, Plugin as N, merge as P, touchDependencies as M, Inject as m, Injector as R, IConfigService as b } from "@univerjs/core";
5
- import { UnitDrawingService as j, IDrawingManagerService as y } from "@univerjs/drawing";
6
- class d extends j {
2
+ var U = (r, t, e) => t in r ? f(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var c = (r, t, e) => U(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { createIdentifier as I, Disposable as O, UniverInstanceType as D, IResourceManagerService as N, IUniverInstanceService as C, Plugin as P, merge as m, touchDependencies as M, Inject as R, Injector as j, IConfigService as b } from "@univerjs/core";
5
+ import { UnitDrawingService as y, IDrawingManagerService as E } from "@univerjs/drawing";
6
+ class d extends y {
7
7
  }
8
- const l = U("univer.doc.plugin.doc-drawing.service");
9
- var E = Object.getOwnPropertyDescriptor, G = (r, t, e, n) => {
10
- for (var i = n > 1 ? void 0 : n ? E(t, e) : t, a = r.length - 1, s; a >= 0; a--)
8
+ const w = I("univer.doc.plugin.doc-drawing.service");
9
+ var G = Object.getOwnPropertyDescriptor, F = (r, t, e, n) => {
10
+ for (var i = n > 1 ? void 0 : n ? G(t, e) : t, a = r.length - 1, s; a >= 0; a--)
11
11
  (s = r[a]) && (i = s(i) || i);
12
12
  return i;
13
- }, o = (r, t) => (e, n) => t(e, n, r);
14
- const w = "DOC_DRAWING_PLUGIN";
15
- let D = class extends I {
13
+ }, g = (r, t) => (e, n) => t(e, n, r);
14
+ const S = "DOC_DRAWING_PLUGIN";
15
+ let _ = class extends O {
16
16
  constructor(r, t, e, n) {
17
17
  super(), this._docDrawingService = r, this._drawingManagerService = t, this._resourceManagerService = e, this._univerInstanceService = n, this._init();
18
18
  }
@@ -21,7 +21,7 @@ let D = class extends I {
21
21
  }
22
22
  _initSnapshot() {
23
23
  const r = (e) => {
24
- const n = this._univerInstanceService.getUnit(e, g.UNIVER_DOC);
24
+ const n = this._univerInstanceService.getUnit(e, D.UNIVER_DOC);
25
25
  if (n) {
26
26
  const i = n.getSnapshot().drawings, a = n.getSnapshot().drawingsOrder, s = {
27
27
  data: i != null ? i : {},
@@ -41,8 +41,8 @@ let D = class extends I {
41
41
  };
42
42
  this.disposeWithMe(
43
43
  this._resourceManagerService.registerPluginResource({
44
- pluginName: w,
45
- businesses: [g.UNIVER_DOC],
44
+ pluginName: S,
45
+ businesses: [D.UNIVER_DOC],
46
46
  toJson: (e) => r(e),
47
47
  parseJson: (e) => t(e),
48
48
  onUnLoad: (e) => {
@@ -60,15 +60,15 @@ let D = class extends I {
60
60
  e != null && (e.resetDrawing(t.data, t.order), this.loadDrawingDataForUnit(r));
61
61
  }
62
62
  loadDrawingDataForUnit(r) {
63
- const t = this._univerInstanceService.getUnit(r, g.UNIVER_DOC);
63
+ const t = this._univerInstanceService.getUnit(r, D.UNIVER_DOC);
64
64
  if (!t)
65
65
  return !1;
66
66
  const e = r, n = t.getDrawings(), i = t.getDrawingsOrder();
67
67
  if (!n || !i)
68
68
  return !1;
69
69
  Object.keys(n).forEach((s) => {
70
- const S = n[s];
71
- n[s] = { ...S };
70
+ const p = n[s];
71
+ n[s] = { ...p };
72
72
  });
73
73
  const a = {
74
74
  [e]: {
@@ -81,46 +81,49 @@ let D = class extends I {
81
81
  return this._docDrawingService.registerDrawingData(r, a), this._drawingManagerService.registerDrawingData(r, a), !0;
82
82
  }
83
83
  };
84
- D = G([
85
- o(0, l),
86
- o(1, y),
87
- o(2, O),
88
- o(3, C)
89
- ], D);
90
- const F = "docs-drawing.config", v = {};
91
- var J = Object.getOwnPropertyDescriptor, L = (r, t, e, n) => {
92
- for (var i = n > 1 ? void 0 : n ? J(t, e) : t, a = r.length - 1, s; a >= 0; a--)
84
+ _ = F([
85
+ g(0, w),
86
+ g(1, E),
87
+ g(2, N),
88
+ g(3, C)
89
+ ], _);
90
+ const J = "@univerjs/docs-drawing", L = "0.17.0", v = {
91
+ name: J,
92
+ version: L
93
+ }, x = "docs-drawing.config", u = {};
94
+ var V = Object.getOwnPropertyDescriptor, W = (r, t, e, n) => {
95
+ for (var i = n > 1 ? void 0 : n ? V(t, e) : t, a = r.length - 1, s; a >= 0; a--)
93
96
  (s = r[a]) && (i = s(i) || i);
94
97
  return i;
95
- }, u = (r, t) => (e, n) => t(e, n, r), c;
96
- let h = (c = class extends N {
97
- constructor(r = v, t, e) {
98
+ }, h = (r, t) => (e, n) => t(e, n, r), o;
99
+ let l = (o = class extends P {
100
+ constructor(r = u, t, e) {
98
101
  super(), this._config = r, this._injector = t, this._configService = e;
99
- const { ...n } = P(
102
+ const { ...n } = m(
100
103
  {},
101
- v,
104
+ u,
102
105
  this._config
103
106
  );
104
- this._configService.setConfig(F, n);
107
+ this._configService.setConfig(x, n);
105
108
  }
106
109
  onStarting() {
107
110
  [
108
- [D],
111
+ [_],
109
112
  [d],
110
- [l, { useClass: d }]
113
+ [w, { useClass: d }]
111
114
  ].forEach((r) => this._injector.add(r)), M(this._injector, [
112
- [D]
115
+ [_]
113
116
  ]);
114
117
  }
115
- }, _(c, "pluginName", w), _(c, "type", g.UNIVER_DOC), c);
116
- h = L([
117
- u(1, m(R)),
118
- u(2, b)
119
- ], h);
118
+ }, c(o, "pluginName", S), c(o, "packageName", v.name), c(o, "version", v.version), c(o, "type", D.UNIVER_DOC), o);
119
+ l = W([
120
+ h(1, R(j)),
121
+ h(2, b)
122
+ ], l);
120
123
  export {
121
- w as DOCS_DRAWING_PLUGIN,
122
- D as DocDrawingController,
124
+ S as DOCS_DRAWING_PLUGIN,
125
+ _ as DocDrawingController,
123
126
  d as DocDrawingService,
124
- l as IDocDrawingService,
125
- h as UniverDocsDrawingPlugin
127
+ w as IDocDrawingService,
128
+ l as UniverDocsDrawingPlugin
126
129
  };
package/lib/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  var f = Object.defineProperty;
2
- var p = (r, t, e) => t in r ? f(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var _ = (r, t, e) => p(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { createIdentifier as U, Disposable as I, UniverInstanceType as g, IResourceManagerService as O, IUniverInstanceService as C, Plugin as N, merge as P, touchDependencies as M, Inject as m, Injector as R, IConfigService as b } from "@univerjs/core";
5
- import { UnitDrawingService as j, IDrawingManagerService as y } from "@univerjs/drawing";
6
- class d extends j {
2
+ var U = (r, t, e) => t in r ? f(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var c = (r, t, e) => U(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { createIdentifier as I, Disposable as O, UniverInstanceType as D, IResourceManagerService as N, IUniverInstanceService as C, Plugin as P, merge as m, touchDependencies as M, Inject as R, Injector as j, IConfigService as b } from "@univerjs/core";
5
+ import { UnitDrawingService as y, IDrawingManagerService as E } from "@univerjs/drawing";
6
+ class d extends y {
7
7
  }
8
- const l = U("univer.doc.plugin.doc-drawing.service");
9
- var E = Object.getOwnPropertyDescriptor, G = (r, t, e, n) => {
10
- for (var i = n > 1 ? void 0 : n ? E(t, e) : t, a = r.length - 1, s; a >= 0; a--)
8
+ const w = I("univer.doc.plugin.doc-drawing.service");
9
+ var G = Object.getOwnPropertyDescriptor, F = (r, t, e, n) => {
10
+ for (var i = n > 1 ? void 0 : n ? G(t, e) : t, a = r.length - 1, s; a >= 0; a--)
11
11
  (s = r[a]) && (i = s(i) || i);
12
12
  return i;
13
- }, o = (r, t) => (e, n) => t(e, n, r);
14
- const w = "DOC_DRAWING_PLUGIN";
15
- let D = class extends I {
13
+ }, g = (r, t) => (e, n) => t(e, n, r);
14
+ const S = "DOC_DRAWING_PLUGIN";
15
+ let _ = class extends O {
16
16
  constructor(r, t, e, n) {
17
17
  super(), this._docDrawingService = r, this._drawingManagerService = t, this._resourceManagerService = e, this._univerInstanceService = n, this._init();
18
18
  }
@@ -21,7 +21,7 @@ let D = class extends I {
21
21
  }
22
22
  _initSnapshot() {
23
23
  const r = (e) => {
24
- const n = this._univerInstanceService.getUnit(e, g.UNIVER_DOC);
24
+ const n = this._univerInstanceService.getUnit(e, D.UNIVER_DOC);
25
25
  if (n) {
26
26
  const i = n.getSnapshot().drawings, a = n.getSnapshot().drawingsOrder, s = {
27
27
  data: i != null ? i : {},
@@ -41,8 +41,8 @@ let D = class extends I {
41
41
  };
42
42
  this.disposeWithMe(
43
43
  this._resourceManagerService.registerPluginResource({
44
- pluginName: w,
45
- businesses: [g.UNIVER_DOC],
44
+ pluginName: S,
45
+ businesses: [D.UNIVER_DOC],
46
46
  toJson: (e) => r(e),
47
47
  parseJson: (e) => t(e),
48
48
  onUnLoad: (e) => {
@@ -60,15 +60,15 @@ let D = class extends I {
60
60
  e != null && (e.resetDrawing(t.data, t.order), this.loadDrawingDataForUnit(r));
61
61
  }
62
62
  loadDrawingDataForUnit(r) {
63
- const t = this._univerInstanceService.getUnit(r, g.UNIVER_DOC);
63
+ const t = this._univerInstanceService.getUnit(r, D.UNIVER_DOC);
64
64
  if (!t)
65
65
  return !1;
66
66
  const e = r, n = t.getDrawings(), i = t.getDrawingsOrder();
67
67
  if (!n || !i)
68
68
  return !1;
69
69
  Object.keys(n).forEach((s) => {
70
- const S = n[s];
71
- n[s] = { ...S };
70
+ const p = n[s];
71
+ n[s] = { ...p };
72
72
  });
73
73
  const a = {
74
74
  [e]: {
@@ -81,46 +81,49 @@ let D = class extends I {
81
81
  return this._docDrawingService.registerDrawingData(r, a), this._drawingManagerService.registerDrawingData(r, a), !0;
82
82
  }
83
83
  };
84
- D = G([
85
- o(0, l),
86
- o(1, y),
87
- o(2, O),
88
- o(3, C)
89
- ], D);
90
- const F = "docs-drawing.config", v = {};
91
- var J = Object.getOwnPropertyDescriptor, L = (r, t, e, n) => {
92
- for (var i = n > 1 ? void 0 : n ? J(t, e) : t, a = r.length - 1, s; a >= 0; a--)
84
+ _ = F([
85
+ g(0, w),
86
+ g(1, E),
87
+ g(2, N),
88
+ g(3, C)
89
+ ], _);
90
+ const J = "@univerjs/docs-drawing", L = "0.17.0", v = {
91
+ name: J,
92
+ version: L
93
+ }, x = "docs-drawing.config", u = {};
94
+ var V = Object.getOwnPropertyDescriptor, W = (r, t, e, n) => {
95
+ for (var i = n > 1 ? void 0 : n ? V(t, e) : t, a = r.length - 1, s; a >= 0; a--)
93
96
  (s = r[a]) && (i = s(i) || i);
94
97
  return i;
95
- }, u = (r, t) => (e, n) => t(e, n, r), c;
96
- let h = (c = class extends N {
97
- constructor(r = v, t, e) {
98
+ }, h = (r, t) => (e, n) => t(e, n, r), o;
99
+ let l = (o = class extends P {
100
+ constructor(r = u, t, e) {
98
101
  super(), this._config = r, this._injector = t, this._configService = e;
99
- const { ...n } = P(
102
+ const { ...n } = m(
100
103
  {},
101
- v,
104
+ u,
102
105
  this._config
103
106
  );
104
- this._configService.setConfig(F, n);
107
+ this._configService.setConfig(x, n);
105
108
  }
106
109
  onStarting() {
107
110
  [
108
- [D],
111
+ [_],
109
112
  [d],
110
- [l, { useClass: d }]
113
+ [w, { useClass: d }]
111
114
  ].forEach((r) => this._injector.add(r)), M(this._injector, [
112
- [D]
115
+ [_]
113
116
  ]);
114
117
  }
115
- }, _(c, "pluginName", w), _(c, "type", g.UNIVER_DOC), c);
116
- h = L([
117
- u(1, m(R)),
118
- u(2, b)
119
- ], h);
118
+ }, c(o, "pluginName", S), c(o, "packageName", v.name), c(o, "version", v.version), c(o, "type", D.UNIVER_DOC), o);
119
+ l = W([
120
+ h(1, R(j)),
121
+ h(2, b)
122
+ ], l);
120
123
  export {
121
- w as DOCS_DRAWING_PLUGIN,
122
- D as DocDrawingController,
124
+ S as DOCS_DRAWING_PLUGIN,
125
+ _ as DocDrawingController,
123
126
  d as DocDrawingService,
124
- l as IDocDrawingService,
125
- h as UniverDocsDrawingPlugin
127
+ w as IDocDrawingService,
128
+ l as UniverDocsDrawingPlugin
126
129
  };
@@ -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
- export type { IUniverDocsDrawingConfig } from './controllers/config.schema';
16
+ export type { IUniverDocsDrawingConfig } from './config/config';
17
17
  export { DOCS_DRAWING_PLUGIN, type IDocDrawingModel } from './controllers/doc-drawing.controller';
18
18
  export { DocDrawingController } from './controllers/doc-drawing.controller';
19
19
  export { UniverDocsDrawingPlugin } from './plugin';
@@ -1,10 +1,12 @@
1
- import { IUniverDocsDrawingConfig } from './controllers/config.schema';
1
+ import { IUniverDocsDrawingConfig } from './config/config';
2
2
  import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
3
  export declare class UniverDocsDrawingPlugin extends Plugin {
4
4
  private readonly _config;
5
5
  _injector: Injector;
6
6
  private readonly _configService;
7
7
  static pluginName: string;
8
+ static packageName: string;
9
+ static version: string;
8
10
  static type: UniverInstanceType;
9
11
  constructor(_config: Partial<IUniverDocsDrawingConfig> | undefined, _injector: Injector, _configService: IConfigService);
10
12
  onStarting(): void;
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t.UniverDocsDrawing={},t.UniverCore,t.UniverDrawing))})(this,(function(t,r,g){"use strict";var P=Object.defineProperty;var N=(t,r,g)=>r in t?P(t,r,{enumerable:!0,configurable:!0,writable:!0,value:g}):t[r]=g;var w=(t,r,g)=>N(t,typeof r!="symbol"?r+"":r,g);var d;class u extends g.UnitDrawingService{}const _=r.createIdentifier("univer.doc.plugin.doc-drawing.service");var S=Object.getOwnPropertyDescriptor,U=(c,i,a,e)=>{for(var n=e>1?void 0:e?S(i,a):i,s=c.length-1,o;s>=0;s--)(o=c[s])&&(n=o(n)||n);return n},D=(c,i)=>(a,e)=>i(a,e,c);const l="DOC_DRAWING_PLUGIN";t.DocDrawingController=class extends r.Disposable{constructor(i,a,e,n){super(),this._docDrawingService=i,this._drawingManagerService=a,this._resourceManagerService=e,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const i=e=>{const n=this._univerInstanceService.getUnit(e,r.UniverInstanceType.UNIVER_DOC);if(n){const s=n.getSnapshot().drawings,o=n.getSnapshot().drawingsOrder,v={data:s!=null?s:{},order:o!=null?o:[]};return JSON.stringify(v)}return""},a=e=>{if(!e)return{data:{},order:[]};try{return JSON.parse(e)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:l,businesses:[r.UniverInstanceType.UNIVER_DOC],toJson:e=>i(e),parseJson:e=>a(e),onUnLoad:e=>{this._setDrawingDataForUnit(e,{data:{},order:[]})},onLoad:(e,n)=>{var s,o;this._setDrawingDataForUnit(e,{data:(s=n.data)!=null?s:{},order:(o=n.order)!=null?o:[]})}}))}_setDrawingDataForUnit(i,a){const e=this._univerInstanceService.getUnit(i);e!=null&&(e.resetDrawing(a.data,a.order),this.loadDrawingDataForUnit(i))}loadDrawingDataForUnit(i){const a=this._univerInstanceService.getUnit(i,r.UniverInstanceType.UNIVER_DOC);if(!a)return!1;const e=i,n=a.getDrawings(),s=a.getDrawingsOrder();if(!n||!s)return!1;Object.keys(n).forEach(v=>{const O=n[v];n[v]={...O}});const o={[e]:{unitId:i,subUnitId:e,data:n,order:s}};return this._docDrawingService.registerDrawingData(i,o),this._drawingManagerService.registerDrawingData(i,o),!0}},t.DocDrawingController=U([D(0,_),D(1,g.IDrawingManagerService),D(2,r.IResourceManagerService),D(3,r.IUniverInstanceService)],t.DocDrawingController);const I="docs-drawing.config",h={};var p=Object.getOwnPropertyDescriptor,C=(c,i,a,e)=>{for(var n=e>1?void 0:e?p(i,a):i,s=c.length-1,o;s>=0;s--)(o=c[s])&&(n=o(n)||n);return n},f=(c,i)=>(a,e)=>i(a,e,c);t.UniverDocsDrawingPlugin=(d=class extends r.Plugin{constructor(i=h,a,e){super(),this._config=i,this._injector=a,this._configService=e;const{...n}=r.merge({},h,this._config);this._configService.setConfig(I,n)}onStarting(){[[t.DocDrawingController],[u],[_,{useClass:u}]].forEach(i=>this._injector.add(i)),r.touchDependencies(this._injector,[[t.DocDrawingController]])}},w(d,"pluginName",l),w(d,"type",r.UniverInstanceType.UNIVER_DOC),d),t.UniverDocsDrawingPlugin=C([f(1,r.Inject(r.Injector)),f(2,r.IConfigService)],t.UniverDocsDrawingPlugin),t.DOCS_DRAWING_PLUGIN=l,t.DocDrawingService=u,t.IDocDrawingService=_,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/drawing"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t.UniverDocsDrawing={},t.UniverCore,t.UniverDrawing))})(this,(function(t,r,g){"use strict";var P=Object.defineProperty;var j=(t,r,g)=>r in t?P(t,r,{enumerable:!0,configurable:!0,writable:!0,value:g}):t[r]=g;var v=(t,r,g)=>j(t,typeof r!="symbol"?r+"":r,g);var D;class _ extends g.UnitDrawingService{}const l=r.createIdentifier("univer.doc.plugin.doc-drawing.service");var U=Object.getOwnPropertyDescriptor,I=(c,i,a,e)=>{for(var n=e>1?void 0:e?U(i,a):i,s=c.length-1,o;s>=0;s--)(o=c[s])&&(n=o(n)||n);return n},d=(c,i)=>(a,e)=>i(a,e,c);const w="DOC_DRAWING_PLUGIN";t.DocDrawingController=class extends r.Disposable{constructor(i,a,e,n){super(),this._docDrawingService=i,this._drawingManagerService=a,this._resourceManagerService=e,this._univerInstanceService=n,this._init()}_init(){this._initSnapshot()}_initSnapshot(){const i=e=>{const n=this._univerInstanceService.getUnit(e,r.UniverInstanceType.UNIVER_DOC);if(n){const s=n.getSnapshot().drawings,o=n.getSnapshot().drawingsOrder,u={data:s!=null?s:{},order:o!=null?o:[]};return JSON.stringify(u)}return""},a=e=>{if(!e)return{data:{},order:[]};try{return JSON.parse(e)}catch{return{data:{},order:[]}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[r.UniverInstanceType.UNIVER_DOC],toJson:e=>i(e),parseJson:e=>a(e),onUnLoad:e=>{this._setDrawingDataForUnit(e,{data:{},order:[]})},onLoad:(e,n)=>{var s,o;this._setDrawingDataForUnit(e,{data:(s=n.data)!=null?s:{},order:(o=n.order)!=null?o:[]})}}))}_setDrawingDataForUnit(i,a){const e=this._univerInstanceService.getUnit(i);e!=null&&(e.resetDrawing(a.data,a.order),this.loadDrawingDataForUnit(i))}loadDrawingDataForUnit(i){const a=this._univerInstanceService.getUnit(i,r.UniverInstanceType.UNIVER_DOC);if(!a)return!1;const e=i,n=a.getDrawings(),s=a.getDrawingsOrder();if(!n||!s)return!1;Object.keys(n).forEach(u=>{const N=n[u];n[u]={...N}});const o={[e]:{unitId:i,subUnitId:e,data:n,order:s}};return this._docDrawingService.registerDrawingData(i,o),this._drawingManagerService.registerDrawingData(i,o),!0}},t.DocDrawingController=I([d(0,l),d(1,g.IDrawingManagerService),d(2,r.IResourceManagerService),d(3,r.IUniverInstanceService)],t.DocDrawingController);const h={name:"@univerjs/docs-drawing",version:"0.17.0"},p="docs-drawing.config",f={};var C=Object.getOwnPropertyDescriptor,O=(c,i,a,e)=>{for(var n=e>1?void 0:e?C(i,a):i,s=c.length-1,o;s>=0;s--)(o=c[s])&&(n=o(n)||n);return n},S=(c,i)=>(a,e)=>i(a,e,c);t.UniverDocsDrawingPlugin=(D=class extends r.Plugin{constructor(i=f,a,e){super(),this._config=i,this._injector=a,this._configService=e;const{...n}=r.merge({},f,this._config);this._configService.setConfig(p,n)}onStarting(){[[t.DocDrawingController],[_],[l,{useClass:_}]].forEach(i=>this._injector.add(i)),r.touchDependencies(this._injector,[[t.DocDrawingController]])}},v(D,"pluginName",w),v(D,"packageName",h.name),v(D,"version",h.version),v(D,"type",r.UniverInstanceType.UNIVER_DOC),D),t.UniverDocsDrawingPlugin=O([S(1,r.Inject(r.Injector)),S(2,r.IConfigService)],t.UniverDocsDrawingPlugin),t.DOCS_DRAWING_PLUGIN=w,t.DocDrawingService=_,t.IDocDrawingService=l,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-drawing",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -43,14 +43,14 @@
43
43
  "lib"
44
44
  ],
45
45
  "dependencies": {
46
- "@univerjs/core": "0.16.1",
47
- "@univerjs/drawing": "0.16.1"
46
+ "@univerjs/core": "0.17.0",
47
+ "@univerjs/drawing": "0.17.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "^5.9.3",
51
51
  "vite": "^7.3.1",
52
52
  "vitest": "^4.0.18",
53
- "@univerjs-infra/shared": "0.16.1"
53
+ "@univerjs-infra/shared": "0.17.0"
54
54
  },
55
55
  "scripts": {
56
56
  "test": "vitest run",