@umbraci/jsmind 0.10.18 → 1.0.1-beta
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/README.md +7 -7
- package/dist/jsmind.draggable-node.js +7 -472
- package/dist/jsmind.draggable-node.js.map +1 -1
- package/dist/jsmind.history.js +7 -980
- package/dist/jsmind.history.js.map +1 -1
- package/dist/jsmind.js +7 -2624
- package/dist/jsmind.js.map +1 -1
- package/dist/jsmind.multi-select.js +7 -671
- package/dist/jsmind.multi-select.js.map +1 -1
- package/dist/jsmind.multiline-text.js +7 -156
- package/dist/jsmind.multiline-text.js.map +1 -1
- package/dist/jsmind.screenshot.js +7 -156
- package/dist/jsmind.screenshot.js.map +1 -1
- package/es/jsmind.draggable-node.js +7 -443
- package/es/jsmind.draggable-node.js.map +1 -1
- package/es/jsmind.history.js +7 -944
- package/es/jsmind.history.js.map +1 -1
- package/es/jsmind.js +7 -2570
- package/es/jsmind.js.map +1 -1
- package/es/jsmind.multi-select.js +7 -621
- package/es/jsmind.multi-select.js.map +1 -1
- package/es/jsmind.multiline-text.js +7 -136
- package/es/jsmind.multiline-text.js.map +1 -1
- package/es/jsmind.screenshot.js +7 -136
- package/es/jsmind.screenshot.js.map +1 -1
- package/lib/jsmind.draggable-node.js +7 -450
- package/lib/jsmind.draggable-node.js.map +1 -1
- package/lib/jsmind.history.js +7 -946
- package/lib/jsmind.history.js.map +1 -1
- package/lib/jsmind.js +7 -2571
- package/lib/jsmind.js.map +1 -1
- package/lib/jsmind.multi-select.js +7 -623
- package/lib/jsmind.multi-select.js.map +1 -1
- package/lib/jsmind.multiline-text.js +7 -141
- package/lib/jsmind.multiline-text.js.map +1 -1
- package/lib/jsmind.screenshot.js +7 -145
- package/lib/jsmind.screenshot.js.map +1 -1
- package/package.json +26 -25
- package/types/generated/jsmind.d.ts +21 -24
- package/types/generated/jsmind.mind.d.ts +7 -0
- package/types/generated/{jsmind.enhanced-plugin.d.ts → jsmind.plugin-system.d.ts} +10 -10
- package/types/generated/jsmind.plugin.d.ts +93 -13
- package/types/generated/jsmind.view_provider.d.ts +1 -1
- package/types/generated/plugins/history/history-diff.d.ts +10 -0
- package/types/generated/plugins/history/jsmind.history.d.ts +2 -2
- package/types/generated/plugins/jsmind.draggable-node.d.ts +13 -3
- package/types/generated/plugins/jsmind.multi-select.d.ts +3 -3
- package/types/generated/plugins/jsmind.multiline-text.d.ts +67 -21
- package/types/generated/plugins/jsmind.screenshot.d.ts +12 -3
- package/types/generated/plugins/multi-select/jsmind.multi-select.d.ts +109 -0
- package/types/tsconfig.declaration.json +6 -1
- package/dist/jsmind.copy-paste.js +0 -283
- package/dist/jsmind.copy-paste.js.map +0 -1
- package/es/jsmind.copy-paste.js +0 -260
- package/es/jsmind.copy-paste.js.map +0 -1
- package/types/generated/plugins/jsmind.multiline-text-v2.d.ts +0 -58
package/lib/jsmind.screenshot.js
CHANGED
|
@@ -1,147 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, '__esModule', { value: !0 });
|
|
10
|
-
var e = require('@umbraci/jsmind'),
|
|
11
|
-
t = require('dom-to-image');
|
|
12
|
-
function i(e) {
|
|
13
|
-
return e && 'object' == typeof e && 'default' in e ? e : { default: e };
|
|
14
|
-
}
|
|
15
|
-
var n = i(e),
|
|
16
|
-
r = i(t);
|
|
17
|
-
if (!n.default) throw new Error('jsMind is not defined');
|
|
18
|
-
if (!r.default) throw new Error('dom-to-image is required');
|
|
19
|
-
const o = n.default.$,
|
|
20
|
-
s = {
|
|
21
|
-
filename: null,
|
|
22
|
-
watermark: { left: o.w.location, right: 'https://github.com/UmbraCi/jsmind' },
|
|
23
|
-
background: 'transparent',
|
|
24
|
-
};
|
|
25
|
-
class a {
|
|
26
|
-
constructor(e, t) {
|
|
27
|
-
var i = {};
|
|
28
|
-
n.default.util.json.merge(i, s),
|
|
29
|
-
n.default.util.json.merge(i, t),
|
|
30
|
-
(this.version = '0.2.0'),
|
|
31
|
-
(this.jm = e),
|
|
32
|
-
(this.options = i),
|
|
33
|
-
(this.dpr = e.view.device_pixel_ratio);
|
|
34
|
-
}
|
|
35
|
-
shoot() {
|
|
36
|
-
let e = this.create_canvas(),
|
|
37
|
-
t = e.getContext('2d');
|
|
38
|
-
t.scale(this.dpr, this.dpr),
|
|
39
|
-
Promise.resolve(t)
|
|
40
|
-
.then(() => this.draw_background(t))
|
|
41
|
-
.then(() => this.draw_lines(t))
|
|
42
|
-
.then(() => this.draw_nodes(t))
|
|
43
|
-
.then(() => this.draw_watermark(e, t))
|
|
44
|
-
.then(() => this.download(e))
|
|
45
|
-
.then(() => this.clear(e));
|
|
46
|
-
}
|
|
47
|
-
create_canvas() {
|
|
48
|
-
let e = o.c('canvas');
|
|
49
|
-
const t = this.jm.view.size.w,
|
|
50
|
-
i = this.jm.view.size.h;
|
|
51
|
-
return (
|
|
52
|
-
(e.width = t * this.dpr),
|
|
53
|
-
(e.height = i * this.dpr),
|
|
54
|
-
(e.style.width = t + 'px'),
|
|
55
|
-
(e.style.height = i + 'px'),
|
|
56
|
-
(e.style.visibility = 'hidden'),
|
|
57
|
-
this.jm.view.e_panel.appendChild(e),
|
|
58
|
-
e
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
clear(e) {
|
|
62
|
-
e.parentNode.removeChild(e);
|
|
63
|
-
}
|
|
64
|
-
draw_background(e) {
|
|
65
|
-
return new Promise(
|
|
66
|
-
function (t, i) {
|
|
67
|
-
const n = this.options.background;
|
|
68
|
-
n &&
|
|
69
|
-
'transparent' !== n &&
|
|
70
|
-
((e.fillStyle = this.options.background),
|
|
71
|
-
e.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)),
|
|
72
|
-
t(e);
|
|
73
|
-
}.bind(this)
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
draw_lines(e) {
|
|
77
|
-
return new Promise(
|
|
78
|
-
function (t, i) {
|
|
79
|
-
this.jm.view.graph.copy_to(e, function () {
|
|
80
|
-
t(e);
|
|
81
|
-
});
|
|
82
|
-
}.bind(this)
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
draw_nodes(e) {
|
|
86
|
-
return r.default
|
|
87
|
-
.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } })
|
|
88
|
-
.then(this.load_image)
|
|
89
|
-
.then(function (t) {
|
|
90
|
-
return e.drawImage(t, 0, 0), e;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
draw_watermark(e, t) {
|
|
94
|
-
return (
|
|
95
|
-
(t.textBaseline = 'bottom'),
|
|
96
|
-
(t.fillStyle = '#000'),
|
|
97
|
-
(t.font = '11px Verdana,Arial,Helvetica,sans-serif'),
|
|
98
|
-
this.options.watermark.left &&
|
|
99
|
-
((t.textAlign = 'left'),
|
|
100
|
-
t.fillText(this.options.watermark.left, 5.5, e.height - 2.5)),
|
|
101
|
-
this.options.watermark.right &&
|
|
102
|
-
((t.textAlign = 'right'),
|
|
103
|
-
t.fillText(this.options.watermark.right, e.width - 5.5, e.height - 2.5)),
|
|
104
|
-
t
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
load_image(e) {
|
|
108
|
-
return new Promise(function (t, i) {
|
|
109
|
-
let n = new Image();
|
|
110
|
-
(n.onload = function () {
|
|
111
|
-
t(n);
|
|
112
|
-
}),
|
|
113
|
-
(n.onerror = i),
|
|
114
|
-
(n.src = e);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
download(e) {
|
|
118
|
-
var t = (this.options.filename || this.jm.mind.name) + '.png';
|
|
119
|
-
if (navigator.msSaveBlob && e.msToBlob) {
|
|
120
|
-
var i = e.msToBlob();
|
|
121
|
-
navigator.msSaveBlob(i, t);
|
|
122
|
-
} else {
|
|
123
|
-
var n = e.toDataURL(),
|
|
124
|
-
r = o.c('a');
|
|
125
|
-
if ('download' in r) {
|
|
126
|
-
(r.style.visibility = 'hidden'),
|
|
127
|
-
(r.href = n),
|
|
128
|
-
(r.download = t),
|
|
129
|
-
o.d.body.appendChild(r);
|
|
130
|
-
var s = o.d.createEvent('MouseEvents');
|
|
131
|
-
s.initEvent('click', !0, !0), r.dispatchEvent(s), o.d.body.removeChild(r);
|
|
132
|
-
} else location.href = n;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const l = new n.default.plugin('screenshot', function (e, t) {
|
|
137
|
-
var i = new a(e, t);
|
|
138
|
-
(e.screenshot = i),
|
|
139
|
-
(e.shoot = function () {
|
|
140
|
-
i.shoot();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
n.default.register_plugin(l),
|
|
144
|
-
(exports.JmScreenshot = a),
|
|
145
|
-
(exports.default = a),
|
|
146
|
-
(exports.screenshot_plugin = l);
|
|
2
|
+
* @license BSD-3-Clause
|
|
3
|
+
* @copyright 2014-2025 hizzgdev@163.com
|
|
4
|
+
*
|
|
5
|
+
* Project Home:
|
|
6
|
+
* https://github.com/hizzgdev/jsmind/
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@umbraci/jsmind"),e=require("dom-to-image");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=i(t),n=i(e);"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(t){return this.slice(0,t.length)===t});class r{static instanceName="";static preload=!1;constructor({jm:t,pluginOpt:e}){this.jm=t,this.options=e||{}}beforePluginRemove(){}beforePluginDestroy(){this.beforePluginRemove()}}if(!s.default)throw new Error("jsMind is not defined");if(!n.default)throw new Error("dom-to-image is required");const o=s.default.$,a={filename:null,watermark:{left:o.w.location,right:"https://github.com/UmbraCi/jsmind"},background:"transparent"};class h{constructor(t,e){var i={};s.default.util.json.merge(i,a),s.default.util.json.merge(i,e),this.version="0.2.0",this.jm=t,this.options=i,this.dpr=t.view.device_pixel_ratio}shoot(){let t=this.create_canvas(),e=t.getContext("2d");e.scale(this.dpr,this.dpr),Promise.resolve(e).then(()=>this.draw_background(e)).then(()=>this.draw_lines(e)).then(()=>this.draw_nodes(e)).then(()=>this.draw_watermark(t,e)).then(()=>this.download(t)).then(()=>this.clear(t))}create_canvas(){let t=o.c("canvas");const e=this.jm.view.size.w,i=this.jm.view.size.h;return t.width=e*this.dpr,t.height=i*this.dpr,t.style.width=e+"px",t.style.height=i+"px",t.style.visibility="hidden",this.jm.view.e_panel.appendChild(t),t}clear(t){t.parentNode.removeChild(t)}draw_background(t){return new Promise(function(e,i){const s=this.options.background;s&&"transparent"!==s&&(t.fillStyle=this.options.background,t.fillRect(0,0,this.jm.view.size.w,this.jm.view.size.h)),e(t)}.bind(this))}draw_lines(t){return new Promise(function(e,i){this.jm.view.graph.copy_to(t,function(){e(t)})}.bind(this))}draw_nodes(t){return n.default.toSvg(this.jm.view.e_nodes,{style:{zoom:1}}).then(this.load_image).then(function(e){return t.drawImage(e,0,0),t})}draw_watermark(t,e){return e.textBaseline="bottom",e.fillStyle="#000",e.font="11px Verdana,Arial,Helvetica,sans-serif",this.options.watermark.left&&(e.textAlign="left",e.fillText(this.options.watermark.left,5.5,t.height-2.5)),this.options.watermark.right&&(e.textAlign="right",e.fillText(this.options.watermark.right,t.width-5.5,t.height-2.5)),e}load_image(t){return new Promise(function(e,i){let s=new Image;s.onload=function(){e(s)},s.onerror=i,s.src=t})}download(t){var e=(this.options.filename||this.jm.mind.name)+".png";if(navigator.msSaveBlob&&t.msToBlob){var i=t.msToBlob();navigator.msSaveBlob(i,e)}else{var s=t.toDataURL(),n=o.c("a");if("download"in n){n.style.visibility="hidden",n.href=s,n.download=e,o.d.body.appendChild(n);var r=o.d.createEvent("MouseEvents");r.initEvent("click",!0,!0),n.dispatchEvent(r),o.d.body.removeChild(n)}else location.href=s}}}class l extends r{static instanceName="screenshot";static preload=!1;constructor({jm:t,pluginOpt:e}){super({jm:t,pluginOpt:e}),this.screenshot=new h(t,e),t.screenshot=this.screenshot,t.shoot=()=>{this.screenshot.shoot()}}beforePluginRemove(){delete this.jm.shoot,delete this.jm.screenshot}}s.default.usePlugin(l),exports.JmScreenshot=h,exports.ScreenshotPlugin=l,exports.default=h;
|
|
147
9
|
//# sourceMappingURL=jsmind.screenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsmind.screenshot.js","sources":["../src/plugins/jsmind.screenshot.js"],"sourcesContent":["/**\n * @license BSD\n * @copyright 2014-2025 UmbraCi\n *\n * Project Home:\n * https://github.com/UmbraCi/jsmind/\n */\n\nimport jsMind from '@umbraci/jsmind';\nimport domtoimage from 'dom-to-image';\n\nif (!jsMind) {\n throw new Error('jsMind is not defined');\n}\n\nif (!domtoimage) {\n throw new Error('dom-to-image is required');\n}\n\nconst $ = jsMind.$;\n\n/**\n * Default options for screenshot plugin.\n * @typedef {Object} ScreenshotOptions\n * @property {string|null} [filename]\n * @property {{left?:string|Location,right?:string}} [watermark]\n * @property {string} [background]\n */\nconst DEFAULT_OPTIONS = {\n filename: null,\n watermark: {\n left: $.w.location,\n right: 'https://github.com/UmbraCi/jsmind',\n },\n background: 'transparent',\n};\n\n/**\n * Screenshot plugin for jsMind.\n */\nexport class JmScreenshot {\n /**\n * Create screenshot plugin instance.\n * @param {import('../jsmind.js').default} jm - jsMind instance\n * @param {Partial<ScreenshotOptions>} options - Plugin options\n */\n constructor(jm, options) {\n var opts = {};\n jsMind.util.json.merge(opts, DEFAULT_OPTIONS);\n jsMind.util.json.merge(opts, options);\n\n this.version = '0.2.0';\n /** @type {import('../jsmind.js').default} */\n this.jm = jm;\n /** @type {ScreenshotOptions} */\n this.options = opts;\n /** @type {number} */\n this.dpr = jm.view.device_pixel_ratio;\n }\n\n /** Take a screenshot of the mind map. */\n shoot() {\n let c = this.create_canvas();\n let ctx = c.getContext('2d');\n ctx.scale(this.dpr, this.dpr);\n Promise.resolve(ctx)\n .then(() => this.draw_background(ctx))\n .then(() => this.draw_lines(ctx))\n .then(() => this.draw_nodes(ctx))\n .then(() => this.draw_watermark(c, ctx))\n .then(() => this.download(c))\n .then(() => this.clear(c));\n }\n\n /**\n * Create canvas for screenshot.\n * @returns {HTMLCanvasElement} Canvas element\n */\n create_canvas() {\n let c = $.c('canvas');\n const w = this.jm.view.size.w;\n const h = this.jm.view.size.h;\n c.width = w * this.dpr;\n c.height = h * this.dpr;\n c.style.width = w + 'px';\n c.style.height = h + 'px';\n\n c.style.visibility = 'hidden';\n this.jm.view.e_panel.appendChild(c);\n return c;\n }\n\n /**\n * Clean up canvas element.\n * @param {HTMLCanvasElement} c - Canvas to remove\n */\n clear(c) {\n c.parentNode.removeChild(c);\n }\n\n /**\n * Draw background on canvas.\n * @param {CanvasRenderingContext2D} ctx - Canvas context\n * @returns {Promise<CanvasRenderingContext2D>} Promise resolving to context\n */\n draw_background(ctx) {\n return new Promise(\n function (resolve, _) {\n const bg = this.options.background;\n if (!!bg && bg !== 'transparent') {\n ctx.fillStyle = this.options.background;\n ctx.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h);\n }\n resolve(ctx);\n }.bind(this)\n );\n }\n\n /**\n * Draw connection lines on canvas by copying from view graph.\n * @param {CanvasRenderingContext2D} ctx\n * @returns {Promise<CanvasRenderingContext2D>}\n */\n draw_lines(ctx) {\n return new Promise(\n function (resolve, _) {\n this.jm.view.graph.copy_to(ctx, function () {\n resolve(ctx);\n });\n }.bind(this)\n );\n }\n\n /**\n * Draw node DOM into canvas via SVG snapshot.\n * @param {CanvasRenderingContext2D} ctx\n * @returns {Promise<CanvasRenderingContext2D>}\n */\n draw_nodes(ctx) {\n return domtoimage\n .toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } })\n .then(this.load_image)\n .then(function (img) {\n ctx.drawImage(img, 0, 0);\n return ctx;\n });\n }\n\n /**\n * Draw watermark text on canvas.\n * @param {HTMLCanvasElement} c\n * @param {CanvasRenderingContext2D} ctx\n * @returns {CanvasRenderingContext2D}\n */\n draw_watermark(c, ctx) {\n ctx.textBaseline = 'bottom';\n ctx.fillStyle = '#000';\n ctx.font = '11px Verdana,Arial,Helvetica,sans-serif';\n if (!!this.options.watermark.left) {\n ctx.textAlign = 'left';\n ctx.fillText(this.options.watermark.left, 5.5, c.height - 2.5);\n }\n if (!!this.options.watermark.right) {\n ctx.textAlign = 'right';\n ctx.fillText(this.options.watermark.right, c.width - 5.5, c.height - 2.5);\n }\n return ctx;\n }\n\n /**\n * Load image from URL and resolve img element.\n * @param {string} url\n * @returns {Promise<HTMLImageElement>}\n */\n load_image(url) {\n return new Promise(function (resolve, reject) {\n let img = new Image();\n img.onload = function () {\n resolve(img);\n };\n img.onerror = reject;\n img.src = url;\n });\n }\n\n /**\n * Trigger download of canvas content as PNG.\n * @param {HTMLCanvasElement} c\n */\n download(c) {\n var name = (this.options.filename || this.jm.mind.name) + '.png';\n\n if (navigator.msSaveBlob && !!c.msToBlob) {\n var blob = c.msToBlob();\n navigator.msSaveBlob(blob, name);\n } else {\n var blob_url = c.toDataURL();\n var anchor = $.c('a');\n if ('download' in anchor) {\n anchor.style.visibility = 'hidden';\n anchor.href = blob_url;\n anchor.download = name;\n $.d.body.appendChild(anchor);\n var evt = $.d.createEvent('MouseEvents');\n evt.initEvent('click', true, true);\n anchor.dispatchEvent(evt);\n $.d.body.removeChild(anchor);\n } else {\n location.href = blob_url;\n }\n }\n }\n}\n\n/**\n * Screenshot plugin registration.\n * @type {import('../jsmind.plugin.js').Plugin<Partial<ScreenshotOptions>>}\n */\nexport const screenshot_plugin = new jsMind.plugin('screenshot', function (jm, options) {\n var jmss = new JmScreenshot(jm, options);\n jm.screenshot = jmss;\n jm.shoot = function () {\n jmss.shoot();\n };\n});\n\njsMind.register_plugin(screenshot_plugin);\n\nexport default JmScreenshot;\n"],"names":["jsMind","Error","domtoimage","$","DEFAULT_OPTIONS","filename","watermark","left","w","location","right","background","JmScreenshot","constructor","jm","options","opts","util","json","merge","this","version","dpr","view","device_pixel_ratio","shoot","c","create_canvas","ctx","getContext","scale","Promise","resolve","then","draw_background","draw_lines","draw_nodes","draw_watermark","download","clear","size","h","width","height","style","visibility","e_panel","appendChild","parentNode","removeChild","_","bg","fillStyle","fillRect","bind","graph","copy_to","toSvg","e_nodes","zoom","load_image","img","drawImage","textBaseline","font","textAlign","fillText","url","reject","Image","onload","onerror","src","name","mind","navigator","msSaveBlob","msToBlob","blob","blob_url","toDataURL","anchor","href","d","body","evt","createEvent","initEvent","dispatchEvent","screenshot_plugin","plugin","jmss","screenshot","register_plugin"],"mappings":";;;;;;;yNAWA,IAAKA,UACD,MAAM,IAAIC,MAAM,yBAGpB,IAAKC,UACD,MAAM,IAAID,MAAM,4BAGpB,MAAME,EAAIH,EAAM,QAACG,EASXC,EAAkB,CACpBC,SAAU,KACVC,UAAW,CACPC,KAAMJ,EAAEK,EAAEC,SACVC,MAAO,qCAEXC,WAAY,eAMT,MAAMC,EAMT,WAAAC,CAAYC,EAAIC,GACZ,IAAIC,EAAO,CAAA,EACXhB,EAAM,QAACiB,KAAKC,KAAKC,MAAMH,EAAMZ,GAC7BJ,EAAM,QAACiB,KAAKC,KAAKC,MAAMH,EAAMD,GAE7BK,KAAKC,QAAU,QAEfD,KAAKN,GAAKA,EAEVM,KAAKL,QAAUC,EAEfI,KAAKE,IAAMR,EAAGS,KAAKC,kBACtB,CAGD,KAAAC,GACI,IAAIC,EAAIN,KAAKO,gBACTC,EAAMF,EAAEG,WAAW,MACvBD,EAAIE,MAAMV,KAAKE,IAAKF,KAAKE,KACzBS,QAAQC,QAAQJ,GACXK,KAAK,IAAMb,KAAKc,gBAAgBN,IAChCK,KAAK,IAAMb,KAAKe,WAAWP,IAC3BK,KAAK,IAAMb,KAAKgB,WAAWR,IAC3BK,KAAK,IAAMb,KAAKiB,eAAeX,EAAGE,IAClCK,KAAK,IAAMb,KAAKkB,SAASZ,IACzBO,KAAK,IAAMb,KAAKmB,MAAMb,GAC9B,CAMD,aAAAC,GACI,IAAID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ACb,CACA,GAEAzB,EAAAA,QAAO6F,gBAAgBJ"}
|
|
1
|
+
{"version":3,"file":"jsmind.screenshot.js","sources":["../src/jsmind.common.js","../src/jsmind.plugin.js","../src/plugins/jsmind.screenshot.js"],"sourcesContent":["/**\n * @license BSD\n * @copyright 2014-2025 UmbraCi\n *\n * Project Home:\n * https://github.com/UmbraCi/jsmind/\n */\n\n/**\n * Library version string.\n * @type {string}\n */\nexport const __version__ = '0.9.1';\n/**\n * Library author.\n * @type {string}\n */\nexport const __author__ = 'UmbraCi';\n\nif (typeof String.prototype.startsWith != 'function') {\n String.prototype.startsWith = function (p) {\n return this.slice(0, p.length) === p;\n };\n}\n\n/**\n * Direction constants and parser.\n * @typedef {{left:number,center:number,right:number,of:(dir:(string|number))=>number|undefined}} DirectionType\n */\n/** @type {DirectionType} */\nexport const Direction = {\n left: -1,\n center: 0,\n right: 1,\n of: function (dir) {\n if (!dir || dir === -1 || dir === 0 || dir === 1) {\n return dir;\n }\n if (dir === '-1' || dir === '0' || dir === '1') {\n return parseInt(dir);\n }\n if (dir.toLowerCase() === 'left') {\n return this.left;\n }\n if (dir.toLowerCase() === 'right') {\n return this.right;\n }\n if (dir.toLowerCase() === 'center') {\n return this.center;\n }\n },\n};\n/** @enum {number} */\nexport const EventType = { show: 1, resize: 2, edit: 3, select: 4, reset: 5, history_change: 6 };\n/** @enum {number} */\nexport const Key = { meta: 1 << 13, ctrl: 1 << 12, alt: 1 << 11, shift: 1 << 10 };\n/** @enum {number} */\nexport const LogLevel = { debug: 1, info: 2, warn: 3, error: 4, disable: 9 };\n\n// an noop function define\nvar _noop = function () {};\n/**\n * Logger facade with dynamic level.\n * @type {{level:(lvl:number)=>void,log:Function,debug:Function,info:Function,warn:Function,error:Function}}\n */\nexport let logger =\n typeof console === 'undefined'\n ? {\n level: _noop,\n log: _noop,\n debug: _noop,\n info: _noop,\n warn: _noop,\n error: _noop,\n }\n : {\n level: setup_logger_level,\n log: console.log,\n debug: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n/**\n * Set logger level.\n * @param {number} log_level\n */\nfunction setup_logger_level(log_level) {\n if (log_level > LogLevel.debug) {\n logger.debug = _noop;\n } else {\n logger.debug = console.debug;\n }\n if (log_level > LogLevel.info) {\n logger.info = _noop;\n } else {\n logger.info = console.info;\n }\n if (log_level > LogLevel.warn) {\n logger.warn = _noop;\n } else {\n logger.warn = console.warn;\n }\n if (log_level > LogLevel.error) {\n logger.error = _noop;\n } else {\n logger.error = console.error;\n }\n}\n","/**\n * @license BSD\n * @copyright 2014-2025 UmbraCi\n *\n * Project Home:\n * https://github.com/UmbraCi/jsmind/\n */\n\nimport { logger } from './jsmind.common.js';\n\n/**\n * Plugin Manager\n * Manages plugin lifecycle with synchronous initialization,\n * preload support, and lifecycle hooks.\n */\nexport class PluginManager {\n /**\n * @param {import('./jsmind.js').default} jm - jsMind instance\n */\n constructor(jm) {\n this.jm = jm;\n /** @type {Map<string, Plugin>} */\n this.plugins = new Map();\n }\n\n /**\n * Initialize preload plugins (before core modules)\n */\n initPreloadPlugins() {\n const preloadPlugins = this.jm.constructor.pluginList.filter(d => d.preload);\n logger.info('Initializing ' + preloadPlugins.length + ' preload plugins');\n preloadPlugins.forEach(descriptor => {\n this._initPlugin(descriptor);\n });\n }\n\n /**\n * Initialize normal plugins (after core modules)\n */\n initNormalPlugins() {\n const normalPlugins = this.jm.constructor.pluginList.filter(d => !d.preload);\n logger.info('Initializing ' + normalPlugins.length + ' normal plugins');\n normalPlugins.forEach(descriptor => {\n this._initPlugin(descriptor);\n });\n }\n\n /**\n * Internal method: Initialize a single plugin\n * @param {PluginDescriptor} descriptor\n * @private\n */\n _initPlugin(descriptor) {\n try {\n const { PluginClass, pluginOpt } = descriptor;\n\n if (!PluginClass.instanceName) {\n throw new Error('Plugin ' + PluginClass.name + ' must define static instanceName');\n }\n if (this.plugins.has(PluginClass.instanceName)) {\n logger.warn(\n 'Plugin ' + PluginClass.instanceName + ' already exists, will be replaced'\n );\n }\n\n const instance = new PluginClass({\n jm: this.jm,\n pluginOpt: pluginOpt || {},\n });\n\n this.plugins.set(PluginClass.instanceName, instance);\n this.jm[PluginClass.instanceName] = instance;\n descriptor.instance = instance;\n\n logger.info('Plugin ' + PluginClass.instanceName + ' initialized');\n } catch (error) {\n logger.error('Failed to initialize plugin ' + descriptor.PluginClass.name + ':', error);\n }\n }\n\n /**\n * Remove a plugin\n * @param {typeof Plugin} PluginClass\n */\n removePlugin(PluginClass) {\n const instanceName = PluginClass.instanceName;\n if (!instanceName) {\n return;\n }\n\n const instance = this.plugins.get(instanceName);\n if (!instance) {\n return;\n }\n\n try {\n if (typeof instance.beforePluginRemove === 'function') {\n instance.beforePluginRemove();\n }\n\n this.plugins.delete(instanceName);\n delete this.jm[instanceName];\n\n const list = this.jm.constructor.pluginList;\n const index = list.findIndex(d => d.PluginClass === PluginClass);\n if (index !== -1) {\n list.splice(index, 1);\n }\n\n logger.info('Plugin ' + instanceName + ' removed');\n } catch (error) {\n logger.error('Failed to remove plugin ' + instanceName + ':', error);\n }\n }\n\n /**\n * Destroy all plugins\n */\n destroyAllPlugins() {\n this.plugins.forEach((instance, instanceName) => {\n try {\n if (typeof instance.beforePluginDestroy === 'function') {\n instance.beforePluginDestroy();\n }\n } catch (error) {\n logger.error('Failed to destroy plugin ' + instanceName + ':', error);\n }\n });\n\n this.plugins.clear();\n }\n\n /**\n * Get plugin instance by name\n * @param {string} instanceName\n * @returns {Plugin | undefined}\n */\n getPlugin(instanceName) {\n return this.plugins.get(instanceName);\n }\n}\n\n/**\n * Plugin Base Class\n * Provides standard plugin interface.\n */\nexport class Plugin {\n /**\n * Plugin instance name (must be defined by subclass)\n * @type {string}\n */\n static instanceName = '';\n\n /**\n * Whether to initialize before core modules\n * @type {boolean}\n */\n static preload = false;\n\n /**\n * @param {{ jm: import('./jsmind.js').default, pluginOpt: object }} params\n */\n constructor({ jm, pluginOpt }) {\n this.jm = jm;\n this.options = pluginOpt || {};\n }\n\n /**\n * Called before plugin is removed\n */\n beforePluginRemove() {}\n\n /**\n * Called before jsMind instance is destroyed\n */\n beforePluginDestroy() {\n this.beforePluginRemove();\n }\n}\n\n/**\n * Plugin descriptor\n * @typedef {object} PluginDescriptor\n * @property {typeof Plugin} PluginClass - Plugin class\n * @property {string} instanceName - Plugin instance name\n * @property {boolean} preload - Whether to preload\n * @property {object} pluginOpt - Plugin options\n * @property {Plugin | null} instance - Plugin instance (after initialization)\n */\n","/**\n * @license BSD\n * @copyright 2014-2025 UmbraCi\n *\n * Project Home:\n * https://github.com/UmbraCi/jsmind/\n */\n\nimport jsMind from '@umbraci/jsmind';\nimport domtoimage from 'dom-to-image';\nimport { Plugin } from '../jsmind.plugin.js';\n\nif (!jsMind) {\n throw new Error('jsMind is not defined');\n}\n\nif (!domtoimage) {\n throw new Error('dom-to-image is required');\n}\n\nconst $ = jsMind.$;\n\n/**\n * Default options for screenshot plugin.\n * @typedef {Object} ScreenshotOptions\n * @property {string|null} [filename]\n * @property {{left?:string|Location,right?:string}} [watermark]\n * @property {string} [background]\n */\nconst DEFAULT_OPTIONS = {\n filename: null,\n watermark: {\n left: $.w.location,\n right: 'https://github.com/UmbraCi/jsmind',\n },\n background: 'transparent',\n};\n\n/**\n * Screenshot plugin for jsMind.\n */\nexport class JmScreenshot {\n /**\n * Create screenshot plugin instance.\n * @param {import('../jsmind.js').default} jm - jsMind instance\n * @param {Partial<ScreenshotOptions>} options - Plugin options\n */\n constructor(jm, options) {\n var opts = {};\n jsMind.util.json.merge(opts, DEFAULT_OPTIONS);\n jsMind.util.json.merge(opts, options);\n\n this.version = '0.2.0';\n /** @type {import('../jsmind.js').default} */\n this.jm = jm;\n /** @type {ScreenshotOptions} */\n this.options = opts;\n /** @type {number} */\n this.dpr = jm.view.device_pixel_ratio;\n }\n\n /** Take a screenshot of the mind map. */\n shoot() {\n let c = this.create_canvas();\n let ctx = c.getContext('2d');\n ctx.scale(this.dpr, this.dpr);\n Promise.resolve(ctx)\n .then(() => this.draw_background(ctx))\n .then(() => this.draw_lines(ctx))\n .then(() => this.draw_nodes(ctx))\n .then(() => this.draw_watermark(c, ctx))\n .then(() => this.download(c))\n .then(() => this.clear(c));\n }\n\n /**\n * Create canvas for screenshot.\n * @returns {HTMLCanvasElement} Canvas element\n */\n create_canvas() {\n let c = $.c('canvas');\n const w = this.jm.view.size.w;\n const h = this.jm.view.size.h;\n c.width = w * this.dpr;\n c.height = h * this.dpr;\n c.style.width = w + 'px';\n c.style.height = h + 'px';\n\n c.style.visibility = 'hidden';\n this.jm.view.e_panel.appendChild(c);\n return c;\n }\n\n /**\n * Clean up canvas element.\n * @param {HTMLCanvasElement} c - Canvas to remove\n */\n clear(c) {\n c.parentNode.removeChild(c);\n }\n\n /**\n * Draw background on canvas.\n * @param {CanvasRenderingContext2D} ctx - Canvas context\n * @returns {Promise<CanvasRenderingContext2D>} Promise resolving to context\n */\n draw_background(ctx) {\n return new Promise(\n function (resolve, _) {\n const bg = this.options.background;\n if (!!bg && bg !== 'transparent') {\n ctx.fillStyle = this.options.background;\n ctx.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h);\n }\n resolve(ctx);\n }.bind(this)\n );\n }\n\n /**\n * Draw connection lines on canvas by copying from view graph.\n * @param {CanvasRenderingContext2D} ctx\n * @returns {Promise<CanvasRenderingContext2D>}\n */\n draw_lines(ctx) {\n return new Promise(\n function (resolve, _) {\n this.jm.view.graph.copy_to(ctx, function () {\n resolve(ctx);\n });\n }.bind(this)\n );\n }\n\n /**\n * Draw node DOM into canvas via SVG snapshot.\n * @param {CanvasRenderingContext2D} ctx\n * @returns {Promise<CanvasRenderingContext2D>}\n */\n draw_nodes(ctx) {\n return domtoimage\n .toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } })\n .then(this.load_image)\n .then(function (img) {\n ctx.drawImage(img, 0, 0);\n return ctx;\n });\n }\n\n /**\n * Draw watermark text on canvas.\n * @param {HTMLCanvasElement} c\n * @param {CanvasRenderingContext2D} ctx\n * @returns {CanvasRenderingContext2D}\n */\n draw_watermark(c, ctx) {\n ctx.textBaseline = 'bottom';\n ctx.fillStyle = '#000';\n ctx.font = '11px Verdana,Arial,Helvetica,sans-serif';\n if (!!this.options.watermark.left) {\n ctx.textAlign = 'left';\n ctx.fillText(this.options.watermark.left, 5.5, c.height - 2.5);\n }\n if (!!this.options.watermark.right) {\n ctx.textAlign = 'right';\n ctx.fillText(this.options.watermark.right, c.width - 5.5, c.height - 2.5);\n }\n return ctx;\n }\n\n /**\n * Load image from URL and resolve img element.\n * @param {string} url\n * @returns {Promise<HTMLImageElement>}\n */\n load_image(url) {\n return new Promise(function (resolve, reject) {\n let img = new Image();\n img.onload = function () {\n resolve(img);\n };\n img.onerror = reject;\n img.src = url;\n });\n }\n\n /**\n * Trigger download of canvas content as PNG.\n * @param {HTMLCanvasElement} c\n */\n download(c) {\n var name = (this.options.filename || this.jm.mind.name) + '.png';\n\n if (navigator.msSaveBlob && !!c.msToBlob) {\n var blob = c.msToBlob();\n navigator.msSaveBlob(blob, name);\n } else {\n var blob_url = c.toDataURL();\n var anchor = $.c('a');\n if ('download' in anchor) {\n anchor.style.visibility = 'hidden';\n anchor.href = blob_url;\n anchor.download = name;\n $.d.body.appendChild(anchor);\n var evt = $.d.createEvent('MouseEvents');\n evt.initEvent('click', true, true);\n anchor.dispatchEvent(evt);\n $.d.body.removeChild(anchor);\n } else {\n location.href = blob_url;\n }\n }\n }\n}\n\n/**\n * Screenshot plugin for unified plugin system.\n */\nexport class ScreenshotPlugin extends Plugin {\n static instanceName = 'screenshot';\n static preload = false;\n\n /**\n * @param {{ jm: import('../jsmind.js').default, pluginOpt: Partial<ScreenshotOptions> }} params\n */\n constructor({ jm, pluginOpt }) {\n super({ jm, pluginOpt });\n this.screenshot = new JmScreenshot(jm, pluginOpt);\n jm.screenshot = this.screenshot;\n jm.shoot = () => {\n this.screenshot.shoot();\n };\n }\n\n beforePluginRemove() {\n delete this.jm.shoot;\n delete this.jm.screenshot;\n }\n}\n\njsMind.usePlugin(ScreenshotPlugin);\n\nexport default JmScreenshot;\n"],"names":["String","prototype","startsWith","p","this","slice","length","Plugin","static","constructor","jm","pluginOpt","options","beforePluginRemove","beforePluginDestroy","jsMind","Error","domtoimage","$","DEFAULT_OPTIONS","filename","watermark","left","w","location","right","background","JmScreenshot","opts","util","json","merge","version","dpr","view","device_pixel_ratio","shoot","c","create_canvas","ctx","getContext","scale","Promise","resolve","then","draw_background","draw_lines","draw_nodes","draw_watermark","download","clear","size","h","width","height","style","visibility","e_panel","appendChild","parentNode","removeChild","_","bg","fillStyle","fillRect","bind","graph","copy_to","toSvg","e_nodes","zoom","load_image","img","drawImage","textBaseline","font","textAlign","fillText","url","reject","Image","onload","onerror","src","name","mind","navigator","msSaveBlob","msToBlob","blob","blob_url","toDataURL","anchor","href","d","body","evt","createEvent","initEvent","dispatchEvent","ScreenshotPlugin","super","screenshot","usePlugin"],"mappings":";;;;;;;yNAmB0C,mBAA/BA,OAAOC,UAAUC,aACxBF,OAAOC,UAAUC,WAAa,SAAUC,GACpC,OAAOC,KAAKC,MAAM,EAAGF,EAAEG,UAAYH,CAC3C,GC4HO,MAAMI,EAKTC,oBAAsB,GAMtBA,gBAAiB,EAKjB,WAAAC,EAAYC,GAAEA,EAAEC,UAAEA,IACdP,KAAKM,GAAKA,EACVN,KAAKQ,QAAUD,GAAa,EAC/B,CAKD,kBAAAE,GAAuB,CAKvB,mBAAAC,GACIV,KAAKS,oBACR,ECrKL,IAAKE,UACD,MAAM,IAAIC,MAAM,yBAGpB,IAAKC,UACD,MAAM,IAAID,MAAM,4BAGpB,MAAME,EAAIH,EAAM,QAACG,EASXC,EAAkB,CACpBC,SAAU,KACVC,UAAW,CACPC,KAAMJ,EAAEK,EAAEC,SACVC,MAAO,qCAEXC,WAAY,eAMT,MAAMC,EAMT,WAAAlB,CAAYC,EAAIE,GACZ,IAAIgB,EAAO,CAAA,EACXb,EAAM,QAACc,KAAKC,KAAKC,MAAMH,EAAMT,GAC7BJ,EAA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AML,EACvC,KAAe,CACH,IAAIM,EAAWrD,EAAEsD,YACbC,EAAS1E,EAAEmB,EAAE,KACjB,GAAI,aAAcuD,EAAQ,CACtBA,EAAOrC,MAAMC,WAAa,SAC1BoC,EAAOC,KAAOH,EACdE,EAAO3C,SAAWmC,EAClBlE,EAAE4E,EAAEC,KAAKrC,YAAYkC,GACrB,IAAII,EAAM9E,EAAE4E,EAAEG,YAAY,eAC1BD,EAAIE,UAAU,SAAS,GAAM,GAC7BN,EAAOO,cAAcH,GACrB9E,EAAE4E,EAAEC,KAAKnC,YAAYgC,EACrC,MACgBpE,SAASqE,KAAOH,CAEvB,CACJ,EAME,MAAMU,UAAyB7F,EAClCC,oBAAsB,aACtBA,gBAAiB,EAKjB,WAAAC,EAAYC,GAAEA,EAAEC,UAAEA,IACd0F,MAAM,CAAE3F,KAAIC,cACZP,KAAKkG,WAAa,IAAI3E,EAAajB,EAAIC,GACvCD,EAAG4F,WAAalG,KAAKkG,WACrB5F,EAAG0B,MAAQ,KACPhC,KAAKkG,WAAWlE,QAEvB,CAED,kBAAAvB,UACWT,KAAKM,GAAG0B,aACRhC,KAAKM,GAAG4F,UAClB,EAGLvF,EAAAA,QAAOwF,UAAUH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraci/jsmind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1-beta",
|
|
4
4
|
"description": "jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD license, you can embed it in any project, if only you observe the license.",
|
|
5
5
|
"main": "lib/jsmind.js",
|
|
6
6
|
"module": "es/jsmind.js",
|
|
@@ -13,29 +13,9 @@
|
|
|
13
13
|
"require": "./lib/jsmind.js",
|
|
14
14
|
"types": "./types/generated/index.d.ts"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
"import": "./es/jsmind
|
|
18
|
-
"require": "./lib/jsmind
|
|
19
|
-
"types": "./types/generated/plugins/jsmind.draggable-node.d.ts"
|
|
20
|
-
},
|
|
21
|
-
"./screenshot": {
|
|
22
|
-
"import": "./es/jsmind.screenshot.js",
|
|
23
|
-
"require": "./lib/jsmind.screenshot.js",
|
|
24
|
-
"types": "./types/generated/plugins/jsmind.screenshot.d.ts"
|
|
25
|
-
},
|
|
26
|
-
"./multiline-text": {
|
|
27
|
-
"import": "./es/jsmind.multiline-text.js",
|
|
28
|
-
"require": "./lib/jsmind.multiline-text.js",
|
|
29
|
-
"types": "./types/generated/plugins/jsmind.multiline-text.d.ts"
|
|
30
|
-
},
|
|
31
|
-
"./history": {
|
|
32
|
-
"import": "./es/jsmind.history.js",
|
|
33
|
-
"require": "./lib/jsmind.history.js",
|
|
34
|
-
"types": "./types/generated/plugins/history/jsmind.history.d.ts"
|
|
35
|
-
},
|
|
36
|
-
"./multi-select": {
|
|
37
|
-
"import": "./es/jsmind.multi-select.js",
|
|
38
|
-
"require": "./lib/jsmind.multi-select.js"
|
|
16
|
+
"./*": {
|
|
17
|
+
"import": "./es/jsmind.*.js",
|
|
18
|
+
"require": "./lib/jsmind.*.js"
|
|
39
19
|
},
|
|
40
20
|
"./style/jsmind.css": "./style/jsmind.css"
|
|
41
21
|
},
|
|
@@ -54,8 +34,10 @@
|
|
|
54
34
|
],
|
|
55
35
|
"scripts": {
|
|
56
36
|
"server": "http-server",
|
|
37
|
+
"sync-plugins": "node scripts/sync-plugins.mjs",
|
|
38
|
+
"prebuild": "npm run sync-plugins",
|
|
57
39
|
"build": "rollup -c .config/rollup.config.js",
|
|
58
|
-
"build-types": "npx -p typescript tsc -p types/tsconfig.declaration.json",
|
|
40
|
+
"build-types": "npm run sync-plugins && npx -p typescript tsc -p types/tsconfig.declaration.json",
|
|
59
41
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest tests/unit",
|
|
60
42
|
"test-es6": "NODE_OPTIONS=--experimental-vm-modules jest tests/unit",
|
|
61
43
|
"test-types": "NODE_OPTIONS=--experimental-vm-modules jest tests/types",
|
|
@@ -111,5 +93,24 @@
|
|
|
111
93
|
],
|
|
112
94
|
"dependencies": {
|
|
113
95
|
"fast-equals": "^5.3.2"
|
|
96
|
+
},
|
|
97
|
+
"typesVersions": {
|
|
98
|
+
"*": {
|
|
99
|
+
"draggable-node": [
|
|
100
|
+
"types/generated/plugins/jsmind.draggable-node.d.ts"
|
|
101
|
+
],
|
|
102
|
+
"history": [
|
|
103
|
+
"types/generated/plugins/history/jsmind.history.d.ts"
|
|
104
|
+
],
|
|
105
|
+
"multi-select": [
|
|
106
|
+
"types/generated/plugins/jsmind.multi-select.d.ts"
|
|
107
|
+
],
|
|
108
|
+
"multiline-text": [
|
|
109
|
+
"types/generated/plugins/jsmind.multiline-text.d.ts"
|
|
110
|
+
],
|
|
111
|
+
"screenshot": [
|
|
112
|
+
"types/generated/plugins/jsmind.screenshot.d.ts"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
114
115
|
}
|
|
115
116
|
}
|
|
@@ -28,7 +28,6 @@ declare class jsMind {
|
|
|
28
28
|
on: (t: HTMLElement, e: string, h: (ev: Event) => void) => void;
|
|
29
29
|
};
|
|
30
30
|
static plugin: typeof Plugin;
|
|
31
|
-
static register_plugin: typeof _register_plugin;
|
|
32
31
|
static util: {
|
|
33
32
|
file: {
|
|
34
33
|
read: (file: File, cb: (result: string, name: string) => void) => void;
|
|
@@ -46,22 +45,22 @@ declare class jsMind {
|
|
|
46
45
|
is_empty: (s?: string) => boolean;
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
|
-
static
|
|
50
|
-
/** @type {Array<import('./jsmind.
|
|
51
|
-
static
|
|
48
|
+
static plugin_base: typeof Plugin;
|
|
49
|
+
/** @type {Array<import('./jsmind.plugin.js').PluginDescriptor>} */
|
|
50
|
+
static pluginList: Array<import("./jsmind.plugin.js").PluginDescriptor>;
|
|
52
51
|
/**
|
|
53
|
-
* Register
|
|
54
|
-
* @param {typeof
|
|
52
|
+
* Register a plugin
|
|
53
|
+
* @param {typeof Plugin} PluginClass - Plugin class
|
|
55
54
|
* @param {object} [options={}] - Plugin options
|
|
56
55
|
* @returns {typeof jsMind}
|
|
57
56
|
*/
|
|
58
|
-
static usePlugin(PluginClass: typeof
|
|
57
|
+
static usePlugin(PluginClass: typeof Plugin, options?: object): typeof jsMind;
|
|
59
58
|
/**
|
|
60
|
-
* Check if
|
|
61
|
-
* @param {typeof
|
|
59
|
+
* Check if a plugin is registered
|
|
60
|
+
* @param {typeof Plugin} PluginClass - Plugin class
|
|
62
61
|
* @returns {boolean}
|
|
63
62
|
*/
|
|
64
|
-
static
|
|
63
|
+
static hasPlugin(PluginClass: typeof Plugin): boolean;
|
|
65
64
|
/**
|
|
66
65
|
* Deprecated: static show constructor helper.
|
|
67
66
|
* @param {import('./jsmind.option.js').JsMindRuntimeOptions} options
|
|
@@ -82,7 +81,7 @@ declare class jsMind {
|
|
|
82
81
|
event_handles: Array<(type: number, data: EventData) => void>;
|
|
83
82
|
/** Initialize sub-systems and plugins. */
|
|
84
83
|
init(): void;
|
|
85
|
-
|
|
84
|
+
pluginManager: PluginManager;
|
|
86
85
|
data: DataProvider;
|
|
87
86
|
layout: LayoutProvider;
|
|
88
87
|
view: ViewProvider;
|
|
@@ -305,7 +304,7 @@ declare class jsMind {
|
|
|
305
304
|
*/
|
|
306
305
|
remove_node(node: string | import("./jsmind.node.js").Node): boolean;
|
|
307
306
|
/**
|
|
308
|
-
* Update
|
|
307
|
+
* Update the topic (text content) of a node, or update multiple node properties.
|
|
309
308
|
* @param {string} node_id - The ID of the node to update
|
|
310
309
|
* @param {string|Partial<Pick<import('./jsmind.node.js').Node, 'topic' | 'data' | 'id' | 'index' | 'expanded' | 'direction'>>} topic_or_updates - Topic string for backward compatibility, or partial Node object for comprehensive updates
|
|
311
310
|
*/
|
|
@@ -398,18 +397,18 @@ declare class jsMind {
|
|
|
398
397
|
/** @param {number} type @param {EventData} data */
|
|
399
398
|
_invoke_event_handle(type: number, data: EventData): void;
|
|
400
399
|
/**
|
|
401
|
-
* Remove
|
|
402
|
-
* @param {typeof
|
|
400
|
+
* Remove a plugin
|
|
401
|
+
* @param {typeof Plugin} PluginClass - Plugin class
|
|
403
402
|
*/
|
|
404
|
-
removePlugin(PluginClass: typeof
|
|
405
|
-
removePlugin(PluginClass: typeof
|
|
403
|
+
removePlugin(PluginClass: typeof Plugin): void;
|
|
404
|
+
removePlugin(PluginClass: typeof Plugin): void;
|
|
406
405
|
/**
|
|
407
|
-
* Get
|
|
406
|
+
* Get a plugin instance
|
|
408
407
|
* @param {string} instanceName - Plugin instance name
|
|
409
|
-
* @returns {
|
|
408
|
+
* @returns {Plugin | undefined}
|
|
410
409
|
*/
|
|
411
|
-
getPlugin(instanceName: string):
|
|
412
|
-
getPlugin(instanceName: string):
|
|
410
|
+
getPlugin(instanceName: string): Plugin | undefined;
|
|
411
|
+
getPlugin(instanceName: string): Plugin | undefined;
|
|
413
412
|
/**
|
|
414
413
|
* Destroy the jsMind instance and clean up resources
|
|
415
414
|
*/
|
|
@@ -427,12 +426,10 @@ export type EventData = {
|
|
|
427
426
|
};
|
|
428
427
|
export namespace jsMind { }
|
|
429
428
|
import { Mind } from './jsmind.mind.js';
|
|
430
|
-
import {
|
|
429
|
+
import { PluginManager } from './jsmind.plugin.js';
|
|
431
430
|
import { DataProvider } from './jsmind.data_provider.js';
|
|
432
431
|
import { LayoutProvider } from './jsmind.layout_provider.js';
|
|
433
432
|
import { ViewProvider } from './jsmind.view_provider.js';
|
|
434
433
|
import { ShortcutProvider } from './jsmind.shortcut_provider.js';
|
|
435
|
-
import { EnhancedPlugin } from './jsmind.enhanced-plugin.js';
|
|
436
|
-
import { Node } from './jsmind.node.js';
|
|
437
434
|
import { Plugin } from './jsmind.plugin.js';
|
|
438
|
-
import {
|
|
435
|
+
import { Node } from './jsmind.node.js';
|
|
@@ -106,6 +106,13 @@ export class Mind {
|
|
|
106
106
|
* @returns {boolean}
|
|
107
107
|
*/
|
|
108
108
|
remove_node(node: Node): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Change a node id while preserving object references.
|
|
111
|
+
* @param {string} old_id
|
|
112
|
+
* @param {string} new_id
|
|
113
|
+
* @returns {boolean}
|
|
114
|
+
*/
|
|
115
|
+
change_node_id(old_id: string, new_id: string): boolean;
|
|
109
116
|
/**
|
|
110
117
|
* Put node into the map if id is not taken.
|
|
111
118
|
* @param {Node} node
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Manages the lifecycle of enhanced plugins with synchronous initialization,
|
|
4
4
|
* preload support, and lifecycle hooks.
|
|
5
5
|
*/
|
|
6
|
-
export class
|
|
6
|
+
export class PluginManager {
|
|
7
7
|
/**
|
|
8
8
|
* @param {import('./jsmind.js').default} jm - jsMind instance
|
|
9
9
|
*/
|
|
10
10
|
constructor(jm: import("./jsmind.js").default);
|
|
11
11
|
jm: import("./jsmind.js").default;
|
|
12
|
-
/** @type {Map<string,
|
|
13
|
-
plugins: Map<string,
|
|
12
|
+
/** @type {Map<string, Plugin>} */
|
|
13
|
+
plugins: Map<string, Plugin>;
|
|
14
14
|
/**
|
|
15
15
|
* Initialize preload plugins (before core modules)
|
|
16
16
|
*/
|
|
@@ -27,9 +27,9 @@ export class EnhancedPluginManager {
|
|
|
27
27
|
private _initPlugin;
|
|
28
28
|
/**
|
|
29
29
|
* Remove a plugin
|
|
30
|
-
* @param {typeof
|
|
30
|
+
* @param {typeof Plugin} PluginClass
|
|
31
31
|
*/
|
|
32
|
-
removePlugin(PluginClass: typeof
|
|
32
|
+
removePlugin(PluginClass: typeof Plugin): void;
|
|
33
33
|
/**
|
|
34
34
|
* Destroy all plugins
|
|
35
35
|
*/
|
|
@@ -37,15 +37,15 @@ export class EnhancedPluginManager {
|
|
|
37
37
|
/**
|
|
38
38
|
* Get plugin instance by name
|
|
39
39
|
* @param {string} instanceName
|
|
40
|
-
* @returns {
|
|
40
|
+
* @returns {Plugin | undefined}
|
|
41
41
|
*/
|
|
42
|
-
getPlugin(instanceName: string):
|
|
42
|
+
getPlugin(instanceName: string): Plugin | undefined;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Enhanced Plugin Base Class
|
|
46
46
|
* Provides standard interface for enhanced plugins
|
|
47
47
|
*/
|
|
48
|
-
export class
|
|
48
|
+
export class Plugin {
|
|
49
49
|
/**
|
|
50
50
|
* Plugin instance name (must be defined by subclass)
|
|
51
51
|
* @type {string}
|
|
@@ -83,7 +83,7 @@ export type PluginDescriptor = {
|
|
|
83
83
|
/**
|
|
84
84
|
* - Plugin class
|
|
85
85
|
*/
|
|
86
|
-
PluginClass: typeof
|
|
86
|
+
PluginClass: typeof Plugin;
|
|
87
87
|
/**
|
|
88
88
|
* - Plugin instance name
|
|
89
89
|
*/
|
|
@@ -99,5 +99,5 @@ export type PluginDescriptor = {
|
|
|
99
99
|
/**
|
|
100
100
|
* - Plugin instance (after initialization)
|
|
101
101
|
*/
|
|
102
|
-
instance:
|
|
102
|
+
instance: Plugin | null;
|
|
103
103
|
};
|
|
@@ -1,21 +1,101 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Plugin Manager
|
|
3
|
+
* Manages plugin lifecycle with synchronous initialization,
|
|
4
|
+
* preload support, and lifecycle hooks.
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
+
export class PluginManager {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('./jsmind.js').default} jm - jsMind instance
|
|
9
|
+
*/
|
|
10
|
+
constructor(jm: import("./jsmind.js").default);
|
|
11
|
+
jm: import("./jsmind.js").default;
|
|
12
|
+
/** @type {Map<string, Plugin>} */
|
|
13
|
+
plugins: Map<string, Plugin>;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize preload plugins (before core modules)
|
|
16
|
+
*/
|
|
17
|
+
initPreloadPlugins(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Initialize normal plugins (after core modules)
|
|
20
|
+
*/
|
|
21
|
+
initNormalPlugins(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Internal method: Initialize a single plugin
|
|
24
|
+
* @param {PluginDescriptor} descriptor
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private _initPlugin;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a plugin
|
|
30
|
+
* @param {typeof Plugin} PluginClass
|
|
31
|
+
*/
|
|
32
|
+
removePlugin(PluginClass: typeof Plugin): void;
|
|
33
|
+
/**
|
|
34
|
+
* Destroy all plugins
|
|
35
|
+
*/
|
|
36
|
+
destroyAllPlugins(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get plugin instance by name
|
|
39
|
+
* @param {string} instanceName
|
|
40
|
+
* @returns {Plugin | undefined}
|
|
41
|
+
*/
|
|
42
|
+
getPlugin(instanceName: string): Plugin | undefined;
|
|
43
|
+
}
|
|
6
44
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param {Record<string, object>} options
|
|
45
|
+
* Plugin Base Class
|
|
46
|
+
* Provides standard plugin interface.
|
|
10
47
|
*/
|
|
11
|
-
export function apply(jm: import("./jsmind.js").default, options: Record<string, object>): void;
|
|
12
48
|
export class Plugin {
|
|
13
49
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
16
|
-
|
|
50
|
+
* Plugin instance name (must be defined by subclass)
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
static instanceName: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to initialize before core modules
|
|
56
|
+
* @type {boolean}
|
|
17
57
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
58
|
+
static preload: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @param {{ jm: import('./jsmind.js').default, pluginOpt: object }} params
|
|
61
|
+
*/
|
|
62
|
+
constructor({ jm, pluginOpt }: {
|
|
63
|
+
jm: import("./jsmind.js").default;
|
|
64
|
+
pluginOpt: object;
|
|
65
|
+
});
|
|
66
|
+
jm: import("./jsmind.js").default;
|
|
67
|
+
options: any;
|
|
68
|
+
/**
|
|
69
|
+
* Called before plugin is removed
|
|
70
|
+
*/
|
|
71
|
+
beforePluginRemove(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Called before jsMind instance is destroyed
|
|
74
|
+
*/
|
|
75
|
+
beforePluginDestroy(): void;
|
|
21
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Plugin descriptor
|
|
79
|
+
*/
|
|
80
|
+
export type PluginDescriptor = {
|
|
81
|
+
/**
|
|
82
|
+
* - Plugin class
|
|
83
|
+
*/
|
|
84
|
+
PluginClass: typeof Plugin;
|
|
85
|
+
/**
|
|
86
|
+
* - Plugin instance name
|
|
87
|
+
*/
|
|
88
|
+
instanceName: string;
|
|
89
|
+
/**
|
|
90
|
+
* - Whether to preload
|
|
91
|
+
*/
|
|
92
|
+
preload: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* - Plugin options
|
|
95
|
+
*/
|
|
96
|
+
pluginOpt: object;
|
|
97
|
+
/**
|
|
98
|
+
* - Plugin instance (after initialization)
|
|
99
|
+
*/
|
|
100
|
+
instance: Plugin | null;
|
|
101
|
+
};
|
|
@@ -316,7 +316,7 @@ export class ViewProvider {
|
|
|
316
316
|
y: number;
|
|
317
317
|
}): void;
|
|
318
318
|
/** @param {import('./jsmind.node.js').Node} node */
|
|
319
|
-
_get_expander_text(node: import("./jsmind.node.js").Node): number | "..." | "
|
|
319
|
+
_get_expander_text(node: import("./jsmind.node.js").Node): number | "..." | "−" | "+";
|
|
320
320
|
/** @param {HTMLElement} ele @param {import('./jsmind.node.js').Node} node */
|
|
321
321
|
_default_node_render(ele: HTMLElement, node: import("./jsmind.node.js").Node): void;
|
|
322
322
|
/** @param {HTMLElement} ele @param {import('./jsmind.node.js').Node} node */
|
|
@@ -255,6 +255,11 @@ export type FlattenOptions = {
|
|
|
255
255
|
* ['name', 'data', 'key'] to match the actual field names in the data.
|
|
256
256
|
*/
|
|
257
257
|
fields?: string[];
|
|
258
|
+
/**
|
|
259
|
+
* - Array of field names to exclude from diff comparison. These fields will be ignored
|
|
260
|
+
* even if they exist in the node data. Useful for filtering out temporary or UI-only fields.
|
|
261
|
+
*/
|
|
262
|
+
excludeFields?: string[];
|
|
258
263
|
/**
|
|
259
264
|
* - The field name to use as the node ID. Defaults to 'id'.
|
|
260
265
|
* When using custom fieldNames (e.g., { id: 'key' }), this should be 'key'.
|
|
@@ -276,6 +281,11 @@ export type DiffOptions = {
|
|
|
276
281
|
* Note: When using jm.history.diff(), this is automatically handled.
|
|
277
282
|
*/
|
|
278
283
|
fields?: string[];
|
|
284
|
+
/**
|
|
285
|
+
* - Array of field names to exclude from diff comparison. These fields will be ignored
|
|
286
|
+
* even if they exist in the node data. Useful for filtering out temporary or UI-only fields.
|
|
287
|
+
*/
|
|
288
|
+
excludeFields?: string[];
|
|
279
289
|
/**
|
|
280
290
|
* - The field name to use as the node ID. Defaults to 'id'.
|
|
281
291
|
* Note: When using jm.history.diff(), this is automatically handled.
|