markmap-toolbar
Advanced tools
Comparing version 0.13.4-alpha.1 to 0.13.4
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.13.4-alpha.1+51f8ed9 | MIT License */ | ||
/*! markmap-toolbar v0.13.4 | MIT License */ | ||
import { mountDom } from '@gera2ld/jsx-dom'; | ||
@@ -23,10 +23,29 @@ import { jsx, jsxs } from '@gera2ld/jsx-dom/jsx-runtime'; | ||
/*! markmap-common v0.13.4 | MIT License */ | ||
Math.random().toString(36).slice(2, 8); | ||
function walkTree(tree, callback, key = 'children') { | ||
const walk = (item, parent) => callback(item, () => { | ||
var _item$key; | ||
(_item$key = item[key]) == null ? void 0 : _item$key.forEach(child => { | ||
walk(child, item); | ||
}); | ||
}, parent); | ||
walk(tree); | ||
} | ||
const clsToolbarItem = 'mm-toolbar-item'; | ||
const clsActive = 'active'; | ||
function renderBrand() { | ||
return jsxs("div", { | ||
return jsxs("a", { | ||
className: "mm-toolbar-brand", | ||
href: "https://markmap.js.org/", | ||
children: [jsx("img", { | ||
alt: "markmap", | ||
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACoFBMVEUAAAAAAAD//wAAAACAgAD//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaFQAAAAAAAAAAAAAAAAAHAAARBQIdGAIYEwI/OgJYUQUfHQI+OgJDPgJJRARBPQRJQgRRSwRRTQRIQQRUTgRUUARZUgRSTQRPSQRjWgZORQRfWQZsZAhTTQRNRwRWUAZkXAZOSARUTgZPRwRRSQRoYwZWUQZWTgRbUwZmXQZoXghmXwdqYwdsYwdfVwVmXQdqYgdiWgVpYAl3bgl6cgl4cAqLggw8OAOWjA2Uig1OSAR2bQihlg55cAh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IWHX27NkLi6bAwOSuow5ABeY7OydOhoCFIAULe6E8YFCf8QAqEC86evniZTA4tfLsuRXHr0E4ly9ePF0uC3KnpH1MZBQQxPoVgxyZ5RMdBQaRMc6yIEcihWbQGaA3k9G8CfQoN0pAtSoxCMACihk9qGtBQZ2LHtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII=" | ||
}), jsx("a", { | ||
href: "https://markmap.js.org/", | ||
}), jsx("span", { | ||
children: "markmap" | ||
@@ -43,3 +62,3 @@ })] | ||
return jsx("div", { | ||
className: "mm-toolbar-item", | ||
className: clsToolbarItem, | ||
title: title, | ||
@@ -93,3 +112,2 @@ onClick: onClick, | ||
this.markmap = null; | ||
this.items = ['zoomIn', 'zoomOut', 'fit']; | ||
this.register({ | ||
@@ -113,2 +131,16 @@ id: 'zoomIn', | ||
}); | ||
this.register({ | ||
id: 'recurse', | ||
title: 'Recursively toggle the next node', | ||
content: Toolbar.icon('M16 4h-12v12h12v-8h-8v4h2v-2h4v4h-8v-8h10z'), | ||
onClick: e => { | ||
const button = e.target.closest(`.${clsToolbarItem}`); | ||
const toggle = () => button.classList.toggle(clsActive); | ||
const active = toggle(); | ||
this.handleRecurse(active, toggle); | ||
} | ||
}); | ||
this.setItems(Toolbar.defaultItems); | ||
} | ||
@@ -139,2 +171,38 @@ | ||
handleRecurse(active, reset) { | ||
const mm = this.markmap; | ||
if (!active) { | ||
var _mm$handleClick, _mm$handleClick$__res; | ||
(_mm$handleClick = mm.handleClick) == null ? void 0 : (_mm$handleClick$__res = _mm$handleClick['__reset']) == null ? void 0 : _mm$handleClick$__res.call(_mm$handleClick); | ||
return; | ||
} | ||
const originalClick = mm.handleClick; | ||
if (!originalClick) return; | ||
const handleClick = (_, d) => { | ||
var _d$data$payload; | ||
const fold = (_d$data$payload = d.data.payload) != null && _d$data$payload.fold ? 0 : 1; | ||
walkTree(d.data, (item, next) => { | ||
item.payload = _extends({}, item.payload, { | ||
fold | ||
}); | ||
next(); | ||
}); | ||
mm.renderData(d.data); | ||
reset(); | ||
handleClick.__reset(); | ||
}; | ||
handleClick.__reset = () => { | ||
mm.handleClick = originalClick; | ||
}; | ||
mm.handleClick = handleClick; | ||
} | ||
render() { | ||
@@ -157,3 +225,4 @@ const items = this.items.map(item => { | ||
} | ||
Toolbar.defaultItems = ['zoomIn', 'zoomOut', 'fit', 'recurse']; | ||
export { Toolbar }; |
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.13.4-alpha.1+51f8ed9 | MIT License */ | ||
/*! markmap-toolbar v0.13.4 | MIT License */ | ||
(function (global, factory) { | ||
@@ -258,10 +258,29 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
/*! markmap-common v0.13.4 | MIT License */ | ||
Math.random().toString(36).slice(2, 8); | ||
function walkTree(tree, callback, key = 'children') { | ||
const walk = (item, parent) => callback(item, () => { | ||
var _item$key; | ||
(_item$key = item[key]) == null ? void 0 : _item$key.forEach(child => { | ||
walk(child, item); | ||
}); | ||
}, parent); | ||
walk(tree); | ||
} | ||
const clsToolbarItem = 'mm-toolbar-item'; | ||
const clsActive = 'active'; | ||
function renderBrand() { | ||
return jsxs("div", { | ||
return jsxs("a", { | ||
className: "mm-toolbar-brand", | ||
href: "https://markmap.js.org/", | ||
children: [jsx("img", { | ||
alt: "markmap", | ||
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACoFBMVEUAAAAAAAD//wAAAACAgAD//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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zYpDmAhKCKjoGtp40MFhVsDAwSxmmVEzZu2XvqSLkchjw3g0h445Ybd24vmTN1Usd5X3R5DgaNqgN35sycP2/GxMkTMRVwMOivvtO3YsWUm3duX790EcMKdgbNNXdnnJh1+9T6ipzU+FB0RzIyiFYB5WdfaElUF8TmTQ6GwH39J2bvypMHcpg4MAKKkUGo5s6KWRfyGRh4WJClGEGBCgS8DLobliy/3abMwM8NBYwQjXDgf3ryxOspyKYyg+RFTFwdnYDAzbrw+oLFm9Ot3J3AwNHFTBykQrhg++GDh48cOXzk4P6VZy8s230MyAGCwwcP7iyRBJpiur1n8hQIWHX27NkLi6bAwOSuow5ABeY7OydOhoCFIAULe6E8YFCf8QAqEC86evniZTA4tfLsuRXHr0E4ly9ePF0uC3KnpH1MZBQQxPoVgxyZ5RMdBQaRMc6yIEcihWbQGaA3k9G8CfQoN0pAtSoxCMACihk9qGtBQZ2LHtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII=" | ||
}), jsx("a", { | ||
href: "https://markmap.js.org/", | ||
}), jsx("span", { | ||
children: "markmap" | ||
@@ -278,3 +297,3 @@ })] | ||
return jsx("div", { | ||
className: "mm-toolbar-item", | ||
className: clsToolbarItem, | ||
title: title, | ||
@@ -328,3 +347,2 @@ onClick: onClick, | ||
this.markmap = null; | ||
this.items = ['zoomIn', 'zoomOut', 'fit']; | ||
this.register({ | ||
@@ -348,2 +366,16 @@ id: 'zoomIn', | ||
}); | ||
this.register({ | ||
id: 'recurse', | ||
title: 'Recursively toggle the next node', | ||
content: Toolbar.icon('M16 4h-12v12h12v-8h-8v4h2v-2h4v4h-8v-8h10z'), | ||
onClick: e => { | ||
const button = e.target.closest(`.${clsToolbarItem}`); | ||
const toggle = () => button.classList.toggle(clsActive); | ||
const active = toggle(); | ||
this.handleRecurse(active, toggle); | ||
} | ||
}); | ||
this.setItems(Toolbar.defaultItems); | ||
} | ||
@@ -374,2 +406,38 @@ | ||
handleRecurse(active, reset) { | ||
const mm = this.markmap; | ||
if (!active) { | ||
var _mm$handleClick, _mm$handleClick$__res; | ||
(_mm$handleClick = mm.handleClick) == null ? void 0 : (_mm$handleClick$__res = _mm$handleClick['__reset']) == null ? void 0 : _mm$handleClick$__res.call(_mm$handleClick); | ||
return; | ||
} | ||
const originalClick = mm.handleClick; | ||
if (!originalClick) return; | ||
const handleClick = (_, d) => { | ||
var _d$data$payload; | ||
const fold = (_d$data$payload = d.data.payload) != null && _d$data$payload.fold ? 0 : 1; | ||
walkTree(d.data, (item, next) => { | ||
item.payload = _extends({}, item.payload, { | ||
fold | ||
}); | ||
next(); | ||
}); | ||
mm.renderData(d.data); | ||
reset(); | ||
handleClick.__reset(); | ||
}; | ||
handleClick.__reset = () => { | ||
mm.handleClick = originalClick; | ||
}; | ||
mm.handleClick = handleClick; | ||
} | ||
render() { | ||
@@ -392,2 +460,3 @@ const items = this.items.map(item => { | ||
} | ||
Toolbar.defaultItems = ['zoomIn', 'zoomOut', 'fit', 'recurse']; | ||
@@ -394,0 +463,0 @@ exports.Toolbar = Toolbar; |
@@ -1,3 +0,4 @@ | ||
/*! markmap-toolbar v0.13.4-alpha.1+51f8ed9 | MIT License */ | ||
!function(A,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((A="undefined"!=typeof globalThis?globalThis:A||self).markmap=A.markmap||{})}(this,(function(A){"use strict";function t(){return t=Object.assign||function(A){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(A[r]=e[r])}return A},t.apply(this,arguments)} | ||
/*! @gera2ld/jsx-dom v2.1.1 | ISC License */var e="http://www.w3.org/1999/xlink",r={show:e,actuate:e,href:e};function n(A,t){var e;if("string"==typeof A)e=1;else{if("function"!=typeof A)throw new Error("Invalid VNode type");e=2}return{vtype:e,type:A,props:t}}var i=n;function o(A){return A.children}var s={isSvg:!1};function a(A,t){if(1===t.type)null!=t.node&&A.append(t.node);else{if(4!==t.type)throw new Error("Unkown ref type "+JSON.stringify(t));t.children.forEach((function(t){a(A,t)}))}}var h={className:"class",labelFor:"for"};function l(A,t,e,n){if(t=h[t]||t,!0===e)A.setAttribute(t,"");else if(!1===e)A.removeAttribute(t);else{var i=n?r[t]:void 0;void 0!==i?A.setAttributeNS(i,t,e):A.setAttribute(t,e)}}function c(A,t){if(void 0===t&&(t=s),null==A||"boolean"==typeof A)return{type:1,node:null};if(A instanceof Node)return{type:1,node:A};if(2===(null==(h=A)?void 0:h.vtype)){var e=A,r=e.type,n=e.props;if(r===o){var i=document.createDocumentFragment();if(n.children)a(i,c(n.children,t));return{type:1,node:i}}return c(r(n),t)}var h;if(function(A){return"string"==typeof A||"number"==typeof A}(A))return{type:1,node:document.createTextNode(""+A)};if(function(A){return 1===(null==A?void 0:A.vtype)}(A)){var v,u,f=A,d=f.type,g=f.props;if(t.isSvg||"svg"!==d||(t=Object.assign({},t,{isSvg:!0})),function(A,t,e){for(var r in t)"key"!==r&&"children"!==r&&"ref"!==r&&("dangerouslySetInnerHTML"===r?A.innerHTML=t[r].__html:"innerHTML"===r||"textContent"===r||"innerText"===r?A[r]=t[r]:r.startsWith("on")?A[r.toLowerCase()]=t[r]:l(A,r,t[r],e.isSvg))}(v=t.isSvg?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d),g,t),g.children){var p=t;t.isSvg&&"foreignObject"===d&&(p=Object.assign({},p,{isSvg:!1})),u=c(g.children,p)}null!=u&&a(v,u);var m=g.ref;return"function"==typeof m&&m(v),{type:1,node:v}}if(Array.isArray(A))return{type:4,children:A.map((function(A){return c(A,t)}))};throw new Error("mount: Invalid Vnode!")}function v(A){for(var t=[],e=0;e<A.length;e+=1){var r=A[e];Array.isArray(r)?t=t.concat(v(r)):null!=r&&t.push(r)}return t}function u(A){return 1===A.type?A.node:A.children.map(u)}function f(A){return Array.isArray(A)?v(A.map(f)):u(c(A))}function d({title:A,content:t,onClick:e}){return n("div",{className:"mm-toolbar-item",title:A,onClick:e,children:t})}let g;class p{static create(A){const t=new p;return t.attach(A),t.render()}static icon(A,e={}){return e=t({stroke:"none",fill:"currentColor","fill-rule":"evenodd"},e),n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",children:n("path",t({},e,{d:A}))})}constructor(){this.showBrand=!0,this.registry={},this.markmap=null,this.items=["zoomIn","zoomOut","fit"],this.register({id:"zoomIn",title:"Zoom in",content:p.icon("M9 5v4h-4v2h4v4h2v-4h4v-2h-4v-4z"),onClick:this.getHandler((A=>A.rescale(1.25)))}),this.register({id:"zoomOut",title:"Zoom out",content:p.icon("M5 9h10v2h-10z"),onClick:this.getHandler((A=>A.rescale(.8)))}),this.register({id:"fit",title:"Fit window size",content:p.icon("M4 7h2v-2h2v4h-4zM4 13h2v2h2v-4h-4zM16 7h-2v-2h-2v4h4zM16 13h-2v2h-2v-4h4z"),onClick:this.getHandler((A=>A.fit()))})}setBrand(A){this.showBrand=A}register(A){this.registry[A.id]=A}getHandler(A){var t;return t=A,A=async(...A)=>{if(!g){g=t(...A);try{await g}finally{g=null}}},()=>{this.markmap&&A(this.markmap)}}setItems(A){this.items=[...A]}attach(A){this.markmap=A}render(){const A=this.items.map((A=>{if("string"==typeof A){const t=this.registry[A];return t||console.warn(`[markmap-toolbar] ${A} not found`),t}return A})).filter(Boolean);return f(i("div",{className:"mm-toolbar",children:[this.showBrand&&i("div",{className:"mm-toolbar-brand",children:[n("img",{alt:"markmap",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACoFBMVEUAAAAAAAD//wAAAACAgAD//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQAB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f3+/v7+/v7K6J1dAAACHklEQVQ4y2NgwAoYWdi5uLm5GXHIcrLCmMzYpDmAhKCKjoGtp40MFhVsDAwSxmmVEzZu2XvqSLkchjw3g0h445Ybd24vmTN1Usd5X3R5DgaNqgN35sycP2/GxMkTMRVwMOivvtO3YsWUm3duX790EcMKdgbNNXdnnJh1+9T6ipzU+FB0RzIyiFYB5WdfaElUF8TmTQ6GwH39J2bvypMHcpg4MAKKkUGo5s6KWRfyGRh4WJClGEGBCgS8DLobliy/3abMwM8NBYwQjXDgf3ryxOspyKYyg+RFTFwdnYDAzbrw+oLFm9Ot3J3AwNHFTBykQrhg++GDh48cOXzk4P6VZy8s230MyAGCwwcP7iyRBJpiur1n8hQIWHX27NkLi6bAwOSuow5ABeY7OydOhoCFIAULe6E8YFCf8QAqEC86evniZTA4tfLsuRXHr0E4ly9ePF0uC3KnpH1MZBQQxPoVgxyZ5RMdBQaRMc6yIEcihWbQGaA3k9G8CfQoN0pAtSoxCMACihk9qGtBQZ2LHtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII="}),n("a",{href:"https://markmap.js.org/",children:"markmap"})]}),A.map(d)]}))}}A.Toolbar=p})); | ||
/*! markmap-toolbar v0.13.4 | MIT License */ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).markmap=t.markmap||{})}(this,(function(t){"use strict";function e(){return e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var A in r)Object.prototype.hasOwnProperty.call(r,A)&&(t[A]=r[A])}return t},e.apply(this,arguments)} | ||
/*! @gera2ld/jsx-dom v2.1.1 | ISC License */var r="http://www.w3.org/1999/xlink",A={show:r,actuate:r,href:r};function n(t,e){var r;if("string"==typeof t)r=1;else{if("function"!=typeof t)throw new Error("Invalid VNode type");r=2}return{vtype:r,type:t,props:e}}var i=n;function o(t){return t.children}var a={isSvg:!1};function s(t,e){if(1===e.type)null!=e.node&&t.append(e.node);else{if(4!==e.type)throw new Error("Unkown ref type "+JSON.stringify(e));e.children.forEach((function(e){s(t,e)}))}}var l={className:"class",labelFor:"for"};function h(t,e,r,n){if(e=l[e]||e,!0===r)t.setAttribute(e,"");else if(!1===r)t.removeAttribute(e);else{var i=n?A[e]:void 0;void 0!==i?t.setAttributeNS(i,e,r):t.setAttribute(e,r)}}function c(t,e){if(void 0===e&&(e=a),null==t||"boolean"==typeof t)return{type:1,node:null};if(t instanceof Node)return{type:1,node:t};if(2===(null==(l=t)?void 0:l.vtype)){var r=t,A=r.type,n=r.props;if(A===o){var i=document.createDocumentFragment();if(n.children)s(i,c(n.children,e));return{type:1,node:i}}return c(A(n),e)}var l;if(function(t){return"string"==typeof t||"number"==typeof t}(t))return{type:1,node:document.createTextNode(""+t)};if(function(t){return 1===(null==t?void 0:t.vtype)}(t)){var d,u,v=t,f=v.type,g=v.props;if(e.isSvg||"svg"!==f||(e=Object.assign({},e,{isSvg:!0})),function(t,e,r){for(var A in e)"key"!==A&&"children"!==A&&"ref"!==A&&("dangerouslySetInnerHTML"===A?t.innerHTML=e[A].__html:"innerHTML"===A||"textContent"===A||"innerText"===A?t[A]=e[A]:A.startsWith("on")?t[A.toLowerCase()]=e[A]:h(t,A,e[A],r.isSvg))}(d=e.isSvg?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f),g,e),g.children){var p=e;e.isSvg&&"foreignObject"===f&&(p=Object.assign({},p,{isSvg:!1})),u=c(g.children,p)}null!=u&&s(d,u);var m=g.ref;return"function"==typeof m&&m(d),{type:1,node:d}}if(Array.isArray(t))return{type:4,children:t.map((function(t){return c(t,e)}))};throw new Error("mount: Invalid Vnode!")}function d(t){for(var e=[],r=0;r<t.length;r+=1){var A=t[r];Array.isArray(A)?e=e.concat(d(A)):null!=A&&e.push(A)}return e}function u(t){return 1===t.type?t.node:t.children.map(u)}function v(t){return Array.isArray(t)?d(t.map(v)):u(c(t))} | ||
/*! markmap-common v0.13.4 | MIT License */Math.random().toString(36).slice(2,8);const f="mm-toolbar-item";function g({title:t,content:e,onClick:r}){return n("div",{className:f,title:t,onClick:r,children:e})}let p;class m{static create(t){const e=new m;return e.attach(t),e.render()}static icon(t,r={}){return r=e({stroke:"none",fill:"currentColor","fill-rule":"evenodd"},r),n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",children:n("path",e({},r,{d:t}))})}constructor(){this.showBrand=!0,this.registry={},this.markmap=null,this.register({id:"zoomIn",title:"Zoom in",content:m.icon("M9 5v4h-4v2h4v4h2v-4h4v-2h-4v-4z"),onClick:this.getHandler((t=>t.rescale(1.25)))}),this.register({id:"zoomOut",title:"Zoom out",content:m.icon("M5 9h10v2h-10z"),onClick:this.getHandler((t=>t.rescale(.8)))}),this.register({id:"fit",title:"Fit window size",content:m.icon("M4 7h2v-2h2v4h-4zM4 13h2v2h2v-4h-4zM16 7h-2v-2h-2v4h4zM16 13h-2v2h-2v-4h4z"),onClick:this.getHandler((t=>t.fit()))}),this.register({id:"recurse",title:"Recursively toggle the next node",content:m.icon("M16 4h-12v12h12v-8h-8v4h2v-2h4v4h-8v-8h10z"),onClick:t=>{const e=t.target.closest(".mm-toolbar-item"),r=()=>e.classList.toggle("active"),A=r();this.handleRecurse(A,r)}}),this.setItems(m.defaultItems)}setBrand(t){this.showBrand=t}register(t){this.registry[t.id]=t}getHandler(t){var e;return e=t,t=async(...t)=>{if(!p){p=e(...t);try{await p}finally{p=null}}},()=>{this.markmap&&t(this.markmap)}}setItems(t){this.items=[...t]}attach(t){this.markmap=t}handleRecurse(t,r){const A=this.markmap;var n,i;if(!t)return void(null==(n=A.handleClick)||null==(i=n.__reset)||i.call(n));const o=A.handleClick;if(!o)return;const a=(t,n)=>{var i;const o=null!=(i=n.data.payload)&&i.fold?0:1;!function(t,e,r="children"){const A=(t,n)=>e(t,(()=>{var e;null==(e=t[r])||e.forEach((e=>{A(e,t)}))}),n);A(t)}(n.data,((t,r)=>{t.payload=e({},t.payload,{fold:o}),r()})),A.renderData(n.data),r(),a.__reset()};a.__reset=()=>{A.handleClick=o},A.handleClick=a}render(){const t=this.items.map((t=>{if("string"==typeof t){const e=this.registry[t];return e||console.warn(`[markmap-toolbar] ${t} not found`),e}return t})).filter(Boolean);return v(i("div",{className:"mm-toolbar",children:[this.showBrand&&i("a",{className:"mm-toolbar-brand",href:"https://markmap.js.org/",children:[n("img",{alt:"markmap",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACoFBMVEUAAAAAAAD//wAAAACAgAD//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaFQAAAAAAAAAAAAAAAAAHAAARBQIdGAIYEwI/OgJYUQUfHQI+OgJDPgJJRARBPQRJQgRRSwRRTQRIQQRUTgRUUARZUgRSTQRPSQRjWgZORQRfWQZsZAhTTQRNRwRWUAZkXAZOSARUTgZPRwRRSQRoYwZWUQZWTgRbUwZmXQZoXghmXwdqYwdsYwdfVwVmXQdqYgdiWgVpYAl3bgl6cgl4cAqLggw8OAOWjA2Uig1OSAR2bQihlg55cAh5cAh6cQmMgwyOhAyUjA2QhQ2Uiw2Viw2soBCflA+voxGwpRGhlg+hlg+snxGroBGjmBCpnBC0pxKyphKxpRG2qhK0qBK5rBK5rBP/7h3/8B7/8R3/8h3/8R7/8h786x397B3+7R3EtxT66Rz66hz76hz86xz96xz97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HtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII="}),n("span",{children:"markmap"})]}),t.map(g)]}))}}m.defaultItems=["zoomIn","zoomOut","fit","recurse"],t.Toolbar=m})); |
{ | ||
"name": "markmap-toolbar", | ||
"version": "0.13.4-alpha.1+51f8ed9", | ||
"version": "0.13.4", | ||
"description": "Extensible toolbar for markmap", | ||
@@ -27,3 +27,3 @@ "author": "Gerald <gera2ld@live.com>", | ||
"devDependencies": { | ||
"markmap-view": "^0.13.4-alpha.1+51f8ed9" | ||
"markmap-view": "^0.13.4" | ||
}, | ||
@@ -34,3 +34,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "51f8ed9512078ad6bd49932bd46c7c5646dbc7d8" | ||
"gitHead": "e79b7c21735205fa02b96d48a564561c9c2ba09f" | ||
} |
@@ -14,5 +14,6 @@ import { VChildren } from '@gera2ld/jsx-dom'; | ||
private markmap; | ||
private items; | ||
static defaultItems: (string | IToolbarItem)[]; | ||
items: (string | IToolbarItem)[]; | ||
static create(mm: Markmap): Node; | ||
static icon(path: string, attrs?: {}): any; | ||
static icon(path: string, attrs?: {}): import("@gera2ld/jsx-dom").VNode; | ||
constructor(); | ||
@@ -26,4 +27,5 @@ setBrand(show: boolean): void; | ||
attach(mm: Markmap): void; | ||
handleRecurse(active: boolean, reset: () => void): void; | ||
render(): Node; | ||
} | ||
export {}; |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
30934
634
0