markmap-lib 0.13.3-alpha.1 → 0.13.3-alpha.2
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/dist/browser/index.js +94 -58
- package/dist/browser/index.min.js +3 -3
- package/dist/index.esm.js +68 -42
- package/dist/index.js +68 -42
- package/package.json +5 -4
- package/types/plugins/katex.browser.d.ts +2 -0
- package/types/plugins/katex.options.d.ts +7 -0
- package/types/plugins/prism.browser.d.ts +2 -0
- package/types/plugins/prism.options.d.ts +6 -0
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-lib v0.13.3-alpha.
|
|
1
|
+
/*! markmap-lib v0.13.3-alpha.2+a5a159b | MIT License */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('katex')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'katex'], factory) :
|
|
@@ -27,7 +27,7 @@ function _extends$1() {
|
|
|
27
27
|
return _extends$1.apply(this, arguments);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/*! markmap-common v0.13.3-alpha.
|
|
30
|
+
/*! markmap-common v0.13.3-alpha.2+a5a159b | MIT License */
|
|
31
31
|
class Hook {
|
|
32
32
|
constructor() {
|
|
33
33
|
this.listeners = [];
|
|
@@ -73,6 +73,23 @@ function _extends() {
|
|
|
73
73
|
return _extends.apply(this, arguments);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
77
|
+
if (source == null) return {};
|
|
78
|
+
var target = {};
|
|
79
|
+
var sourceKeys = Object.keys(source);
|
|
80
|
+
var key, i;
|
|
81
|
+
|
|
82
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
83
|
+
key = sourceKeys[i];
|
|
84
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
85
|
+
target[key] = source[key];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return target;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const _excluded = ["textContent"];
|
|
92
|
+
|
|
76
93
|
function escapeHtml$1(html) {
|
|
77
94
|
return html.replace(/[&<"]/g, m => ({
|
|
78
95
|
'&': '&',
|
|
@@ -114,7 +131,15 @@ function buildCode(fn, args) {
|
|
|
114
131
|
|
|
115
132
|
function persistJS(items, context) {
|
|
116
133
|
return items.map(item => {
|
|
117
|
-
if (item.type === 'script')
|
|
134
|
+
if (item.type === 'script') {
|
|
135
|
+
const _item$data = item.data,
|
|
136
|
+
{
|
|
137
|
+
textContent
|
|
138
|
+
} = _item$data,
|
|
139
|
+
rest = _objectWithoutPropertiesLoose(_item$data, _excluded);
|
|
140
|
+
|
|
141
|
+
return wrapHtml('script', textContent, rest);
|
|
142
|
+
}
|
|
118
143
|
|
|
119
144
|
if (item.type === 'iife') {
|
|
120
145
|
const {
|
|
@@ -253,7 +278,7 @@ async function loadJS(items, context) {
|
|
|
253
278
|
}
|
|
254
279
|
|
|
255
280
|
const template = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n<title>Markmap</title>\n<style>\n* {\n margin: 0;\n padding: 0;\n}\n#mindmap {\n display: block;\n width: 100vw;\n height: 100vh;\n}\n</style>\n<!--CSS-->\n</head>\n<body>\n<svg id=\"mindmap\"></svg>\n<!--JS-->\n</body>\n</html>\n";
|
|
256
|
-
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.3-alpha.
|
|
281
|
+
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.3-alpha.2+a5a159b"}`].map(src => ({
|
|
257
282
|
type: 'script',
|
|
258
283
|
data: {
|
|
259
284
|
src
|
|
@@ -8585,18 +8610,55 @@ const rkatex = (md, options) => {
|
|
|
8585
8610
|
|
|
8586
8611
|
var remarkableKatex = rkatex;
|
|
8587
8612
|
|
|
8588
|
-
|
|
8613
|
+
var options$1 = {
|
|
8614
|
+
preloadScripts: [{
|
|
8615
|
+
type: 'script',
|
|
8616
|
+
data: {
|
|
8617
|
+
src: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.js`
|
|
8618
|
+
}
|
|
8619
|
+
}],
|
|
8620
|
+
scripts: [{
|
|
8621
|
+
type: 'iife',
|
|
8622
|
+
data: {
|
|
8623
|
+
fn: getMarkmap => {
|
|
8624
|
+
window.WebFontConfig = {
|
|
8625
|
+
custom: {
|
|
8626
|
+
families: ['KaTeX_AMS', 'KaTeX_Caligraphic:n4,n7', 'KaTeX_Fraktur:n4,n7', 'KaTeX_Main:n4,n7,i4,i7', 'KaTeX_Math:i4,i7', 'KaTeX_Script', 'KaTeX_SansSerif:n4,n7,i4', 'KaTeX_Size1', 'KaTeX_Size2', 'KaTeX_Size3', 'KaTeX_Size4', 'KaTeX_Typewriter']
|
|
8627
|
+
},
|
|
8628
|
+
active: () => {
|
|
8629
|
+
getMarkmap().refreshHook.call();
|
|
8630
|
+
}
|
|
8631
|
+
};
|
|
8632
|
+
},
|
|
8589
8633
|
|
|
8590
|
-
|
|
8591
|
-
|
|
8634
|
+
getParams({
|
|
8635
|
+
getMarkmap
|
|
8636
|
+
}) {
|
|
8637
|
+
return [getMarkmap];
|
|
8638
|
+
}
|
|
8639
|
+
|
|
8640
|
+
}
|
|
8641
|
+
}, {
|
|
8592
8642
|
type: 'script',
|
|
8593
8643
|
data: {
|
|
8594
|
-
src:
|
|
8644
|
+
src: `https://cdn.jsdelivr.net/npm/webfontloader@${"1.6.28"}/webfontloader.js`,
|
|
8645
|
+
defer: true
|
|
8595
8646
|
}
|
|
8596
|
-
}]
|
|
8597
|
-
|
|
8647
|
+
}],
|
|
8648
|
+
styles: [{
|
|
8649
|
+
type: 'stylesheet',
|
|
8650
|
+
data: {
|
|
8651
|
+
href: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.css`
|
|
8652
|
+
}
|
|
8653
|
+
}]
|
|
8598
8654
|
};
|
|
8599
8655
|
|
|
8656
|
+
let loading$1;
|
|
8657
|
+
|
|
8658
|
+
const autoload$1 = () => {
|
|
8659
|
+
loading$1 || (loading$1 = loadJS(options$1.preloadScripts));
|
|
8660
|
+
return loading$1;
|
|
8661
|
+
};
|
|
8600
8662
|
const name$2 = 'katex';
|
|
8601
8663
|
function transform$2(transformHooks) {
|
|
8602
8664
|
const renderKatex = (source, displayMode) => {
|
|
@@ -8634,63 +8696,42 @@ function transform$2(transformHooks) {
|
|
|
8634
8696
|
};
|
|
8635
8697
|
});
|
|
8636
8698
|
return {
|
|
8637
|
-
styles:
|
|
8638
|
-
|
|
8639
|
-
data: {
|
|
8640
|
-
href: 'https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css'
|
|
8641
|
-
}
|
|
8642
|
-
}],
|
|
8643
|
-
scripts: [{
|
|
8644
|
-
type: 'iife',
|
|
8645
|
-
data: {
|
|
8646
|
-
fn: getMarkmap => {
|
|
8647
|
-
window.WebFontConfig = {
|
|
8648
|
-
custom: {
|
|
8649
|
-
families: ['KaTeX_AMS', 'KaTeX_Caligraphic:n4,n7', 'KaTeX_Fraktur:n4,n7', 'KaTeX_Main:n4,n7,i4,i7', 'KaTeX_Math:i4,i7', 'KaTeX_Script', 'KaTeX_SansSerif:n4,n7,i4', 'KaTeX_Size1', 'KaTeX_Size2', 'KaTeX_Size3', 'KaTeX_Size4', 'KaTeX_Typewriter']
|
|
8650
|
-
},
|
|
8651
|
-
active: () => {
|
|
8652
|
-
getMarkmap().refreshHook.call();
|
|
8653
|
-
}
|
|
8654
|
-
};
|
|
8655
|
-
},
|
|
8656
|
-
|
|
8657
|
-
getParams({
|
|
8658
|
-
getMarkmap
|
|
8659
|
-
}) {
|
|
8660
|
-
return [getMarkmap];
|
|
8661
|
-
}
|
|
8662
|
-
|
|
8663
|
-
}
|
|
8664
|
-
}, {
|
|
8665
|
-
type: 'script',
|
|
8666
|
-
data: {
|
|
8667
|
-
src: 'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.js',
|
|
8668
|
-
defer: true
|
|
8669
|
-
}
|
|
8670
|
-
}]
|
|
8699
|
+
styles: options$1.styles,
|
|
8700
|
+
scripts: options$1.scripts
|
|
8671
8701
|
};
|
|
8672
8702
|
}
|
|
8673
8703
|
|
|
8674
8704
|
var katex = /*#__PURE__*/Object.freeze({
|
|
8675
8705
|
__proto__: null,
|
|
8706
|
+
options: options$1,
|
|
8676
8707
|
name: name$2,
|
|
8677
8708
|
transform: transform$2
|
|
8678
8709
|
});
|
|
8679
8710
|
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
const autoload = () => {
|
|
8683
|
-
loading || (loading = loadJS([{
|
|
8711
|
+
var options = {
|
|
8712
|
+
preloadScripts: [{
|
|
8684
8713
|
type: 'script',
|
|
8685
8714
|
data: {
|
|
8686
|
-
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.
|
|
8715
|
+
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/components/prism-core.min.js`
|
|
8687
8716
|
}
|
|
8688
8717
|
}, {
|
|
8689
8718
|
type: 'script',
|
|
8690
8719
|
data: {
|
|
8691
|
-
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.
|
|
8720
|
+
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/plugins/autoloader/prism-autoloader.min.js`
|
|
8692
8721
|
}
|
|
8693
|
-
}]
|
|
8722
|
+
}],
|
|
8723
|
+
styles: [{
|
|
8724
|
+
type: 'stylesheet',
|
|
8725
|
+
data: {
|
|
8726
|
+
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/themes/prism.css`
|
|
8727
|
+
}
|
|
8728
|
+
}]
|
|
8729
|
+
};
|
|
8730
|
+
|
|
8731
|
+
let loading;
|
|
8732
|
+
|
|
8733
|
+
const autoload = () => {
|
|
8734
|
+
loading || (loading = loadJS(options.preloadScripts));
|
|
8694
8735
|
return loading;
|
|
8695
8736
|
};
|
|
8696
8737
|
|
|
@@ -8701,7 +8742,6 @@ function loadLanguageAndRefresh(lang, transformHooks) {
|
|
|
8701
8742
|
});
|
|
8702
8743
|
});
|
|
8703
8744
|
}
|
|
8704
|
-
|
|
8705
8745
|
const name$1 = 'prism';
|
|
8706
8746
|
function transform$1(transformHooks) {
|
|
8707
8747
|
let enableFeature = () => {};
|
|
@@ -8732,17 +8772,13 @@ function transform$1(transformHooks) {
|
|
|
8732
8772
|
};
|
|
8733
8773
|
});
|
|
8734
8774
|
return {
|
|
8735
|
-
styles:
|
|
8736
|
-
type: 'stylesheet',
|
|
8737
|
-
data: {
|
|
8738
|
-
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.25.0"}/themes/prism.css`
|
|
8739
|
-
}
|
|
8740
|
-
}]
|
|
8775
|
+
styles: options.styles
|
|
8741
8776
|
};
|
|
8742
8777
|
}
|
|
8743
8778
|
|
|
8744
8779
|
var prism = /*#__PURE__*/Object.freeze({
|
|
8745
8780
|
__proto__: null,
|
|
8781
|
+
options: options,
|
|
8746
8782
|
name: name$1,
|
|
8747
8783
|
transform: transform$1
|
|
8748
8784
|
});
|