markmap-autoloader 0.14.4-alpha.1 → 0.14.4
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 +8 -2
- package/dist/index.js +2 -3
- package/dist/index.min.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -28,10 +28,16 @@ HTML:
|
|
|
28
28
|
|
|
29
29
|
Note that `<script type="text/template">` is optional, for the content inside to be invisible before the markmap is rendered.
|
|
30
30
|
|
|
31
|
-
Autoload all elements matching `.markmap
|
|
31
|
+
Autoload all elements matching `.markmap`, using latest autoloader version:
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader"></script>
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
To use specific version (here: `0.14.3`) of `mark-autoloader`:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@0.14.3"></script>
|
|
35
41
|
```
|
|
36
42
|
|
|
37
43
|
Load manually:
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-autoloader v0.14.4
|
|
1
|
+
/*! markmap-autoloader v0.14.4 | MIT License */
|
|
2
2
|
this.markmap = this.markmap || {};
|
|
3
3
|
(function (exports) {
|
|
4
4
|
'use strict';
|
|
@@ -24,7 +24,6 @@ function _extends() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
Math.random().toString(36).slice(2, 8);
|
|
27
|
-
|
|
28
27
|
function memoize(fn) {
|
|
29
28
|
const cache = {};
|
|
30
29
|
return function memoized(...args) {
|
|
@@ -124,7 +123,7 @@ const ready = loadJS(((_window$markmap = window.markmap) == null ? void 0 : (_wi
|
|
|
124
123
|
}, {
|
|
125
124
|
type: 'script',
|
|
126
125
|
data: {
|
|
127
|
-
src: `https://cdn.jsdelivr.net/combine/npm/markmap-lib@${"0.14.4
|
|
126
|
+
src: `https://cdn.jsdelivr.net/combine/npm/markmap-lib@${"0.14.4"},npm/markmap-view@${"0.14.4"}`
|
|
128
127
|
}
|
|
129
128
|
}]).then(() => {
|
|
130
129
|
var _markmap$autoLoader;
|
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! markmap-autoloader v0.14.4
|
|
1
|
+
/*! markmap-autoloader v0.14.4 | MIT License */
|
|
2
2
|
this.markmap=this.markmap||{},function(t){"use strict";
|
|
3
|
-
/*! markmap-common v0.14.2 | MIT License */function
|
|
3
|
+
/*! markmap-common v0.14.2 | MIT License */function n(){return n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},n.apply(this,arguments)}function e(t,n,e){const a=document.createElement(t);return n&&Object.entries(n).forEach((([t,n])=>{a[t]=n})),e&&Object.entries(e).forEach((([t,n])=>{a.setAttribute(t,n)})),a}Math.random().toString(36).slice(2,8);const a=function(t){const n={};return function(...e){const a=`${e[0]}`;let r=n[a];return r||(r={value:t(...e)},n[a]=r),r.value}}((t=>{document.head.append(e("link",{rel:"preload",as:"script",href:t}))}));async function r(t,a){if(!t.loaded&&("script"===t.type&&(t.loaded=new Promise(((a,r)=>{var o;document.head.append(e("script",n({},t.data,{onload:a,onerror:r}))),null!=(o=t.data)&&o.src||a(void 0)})).then((()=>{t.loaded=!0}))),"iife"===t.type)){const{fn:n,getParams:e}=t.data;n(...(null==e?void 0:e(a))||[]),t.loaded=!0}await t.loaded}var o,s,d,c;const i={},l=async function(t,e){const o=t.filter((t=>{var n;return"script"===t.type&&(null==(n=t.data)?void 0:n.src)}));o.length>1&&o.forEach((t=>a(t.data.src))),e=n({getMarkmap:()=>window.markmap},e);for(const n of t)await r(n,e)}((null==(o=window.markmap)||null==(s=o.autoLoader)?void 0:s.baseJs)||[{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/d3@6.7.0"}},{type:"script",data:{src:"https://cdn.jsdelivr.net/combine/npm/markmap-lib@0.14.4,npm/markmap-view@0.14.4"}}]).then((()=>{var t;const{markmap:n}=window,e=document.createElement("style");e.textContent=n.globalCSS,document.body.prepend(e),null==(t=n.autoLoader)||null==t.onReady||t.onReady()}));function m(t){const{Transformer:n,Markmap:e,autoLoader:a,deriveOptions:r}=window.markmap,o=t.textContent.split("\n");let s=1/0;o.forEach((t=>{const n=t.match(/^\s*/)[0].length;n<t.length&&(s=Math.min(s,n))}));const d=o.map((t=>t.slice(s))).join("\n").trim(),c=new n(null==a?void 0:a.transformPlugins);t.innerHTML="<svg></svg>";const l=t.firstChild,m=e.create(l,{embedGlobalCSS:!1}),u=()=>{const{root:t,frontmatter:n}=function(t,n){const e=t.transform(n),a=Object.keys(e.features).filter((t=>!i[t]));a.forEach((t=>{i[t]=!0}));const{styles:r,scripts:o}=t.getAssets(a),{markmap:s}=window;return r&&s.loadCSS(r),o&&s.loadJS(o),e}(c,d),e=null==n?void 0:n.markmap,a=r(e);m.setData(t,a),m.fit()};c.hooks.retransform.tap(u),u()}async function u(t){await l,t.querySelectorAll(".markmap").forEach(m)}function p(){return u(document)}null!=(d=window.markmap)&&null!=(c=d.autoLoader)&&c.manual||("loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{p()})):p()),t.ready=l,t.render=m,t.renderAll=p,t.renderAllUnder=u}(this.markmap.autoLoader=this.markmap.autoLoader||{});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-autoloader",
|
|
3
|
-
"version": "0.14.4
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Load markmaps automatically in HTML",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"markmap-common": "^0.14.2",
|
|
45
|
-
"markmap-lib": "^0.14.4
|
|
46
|
-
"markmap-view": "^0.14.4
|
|
45
|
+
"markmap-lib": "^0.14.4",
|
|
46
|
+
"markmap-view": "^0.14.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "8eb2fa223ab85d1a7699d2c9660fdb5fac24acd1"
|
|
49
49
|
}
|