markmap-toolbar
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.1.5 | MIT License */ | ||
/*! markmap-toolbar v0.1.6 | MIT License */ | ||
import * as React from '@gera2ld/jsx-dom'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.1.5 | MIT License */ | ||
/*! markmap-toolbar v0.1.6 | MIT License */ | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,3 +0,3 @@ | ||
/*! markmap-toolbar v0.1.5 | MIT License */ | ||
/*! markmap-toolbar v0.1.6 | 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"; | ||
/*! @gera2ld/jsx-dom v1.2.1 | ISC License */var t=["innerHTML","innerText","textContent",{key:"value",tag:"textarea"}],e={name:"Fragment"};function r(A,t){var a,s;if(A===e)a=document.createDocumentFragment();else{if("string"!=typeof A)throw new Error("Invalid element type: "+A);var h=r.createElement(A);a=h,t&&Object.keys(t).forEach((function(e){var r=t[e];null!=r&&(e.startsWith("on")?h.addEventListener(e.slice(2).toLowerCase(),r):"children"===e?i(h,r):"style"===e&&"object"==typeof r?o(h,r):"dangerouslySetInnerHTML"===e&&r?h.innerHTML=r.__html||"":"ref"===e&&"function"==typeof r?s=r:"boolean"==typeof r?r?h.setAttribute(e,e):h.removeAttribute(e):n(A,e)?h[e]=r:("className"===e?e="class":"labelFor"===e&&(e="for"),h.setAttribute(e,""+r)))}))}for(var l=arguments.length,c=new Array(l>2?l-2:0),m=2;m<l;m++)c[m-2]=arguments[m];return i(a,c),s&&s(a),a}function n(A,e){var r={tag:A,key:e};return t.some((function(A){return"string"==typeof A?e===A:Object.keys(A).every((function(t){return A[t]===r[t]}))}))}function i(A,t){t.forEach((function(t){null!=t&&!1!==t&&(Array.isArray(t)?i(A,t):"object"!=typeof t?A.appendChild(document.createTextNode(""+t)):A.appendChild(t))}))}function o(A,t){Object.keys(t).forEach((function(e){var r=t[e];A.style[e]="number"==typeof r?r+"px":r}))}function a({title:A,content:t,onClick:e}){return r("div",{className:"mm-toolbar-item",title:A,innerHTML:t,onClick:e})}let s;r.createElement=function(A){return document.createElement(A)};class h{static create(A){const t=new h;return t.attach(A),t.render()}static icon(A){return`<svg width="20" height="20" viewBox="0 0 20 20" on:click={onZoomIn}><path fill="none" stroke-width="2" stroke="currentColor" d="${A}"/></svg>`}constructor(){this.showBrand=!0,this.registry={},this.markmap=null,this.items=["zoomIn","zoomOut","fit"],this.register({id:"zoomIn",title:"Zoom in",content:h.icon("M10 6 v8 M6 10 h8"),onClick:this.getHandler((A=>A.rescale(1.25)))}),this.register({id:"zoomOut",title:"Zoom out",content:h.icon("M6 10 h8"),onClick:this.getHandler((A=>A.rescale(.8)))}),this.register({id:"fit",title:"Fit window size",content:h.icon("M4 8 h3 v-3 M4 12 h3 v3 M16 8 h-3 v-3 M16 12 h-3 v3"),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(!s){s=t(...A);try{await s}finally{s=null}}},t=>{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 r("div",{className:"mm-toolbar"},this.showBrand&&r("div",{className:"mm-toolbar-brand"},r("img",{alt:"markmap",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACoFBMVEUAAAAAAAD//wAAAACAgAD//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAA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AACHklEQVQ4y2NgwAoYWdi5uLm5GXHIcrLCmMzYpDmAhKCKjoGtp40MFhVsDAwSxmmVEzZu2XvqSLkchjw3g0h445Ybd24vmTN1Usd5X3R5DgaNqgN35sycP2/GxMkTMRVwMOivvtO3YsWUm3duX790EcMKdgbNNXdnnJh1+9T6ipzU+FB0RzIyiFYB5WdfaElUF8TmTQ6GwH39J2bvypMHcpg4MAKKkUGo5s6KWRfyGRh4WJClGEGBCgS8DLobliy/3abMwM8NBYwQjXDgf3ryxOspyKYyg+RFTFwdnYDAzbrw+oLFm9Ot3J3AwNHFTBykQrhg++GDh48cOXzk4P6VZy8s230MyAGCwwcP7iyRBJpiur1n8hQIWHX27NkLi6bAwOSuow5ABeY7OydOhoCFIAULe6E8YFCf8QAqEC86evniZTA4tfLsuRXHr0E4ly9ePF0uC3KnpH1MZBQQxPoVgxyZ5RMdBQaRMc6yIEcihWbQGaA3k9G8CfQoN0pAtSoxCMACihk9qGtBQZ2LHtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII="}),r("a",{href:"https://markmap.js.org/"},"markmap")),A.map(a))}}A.Toolbar=h})); |
{ | ||
"name": "markmap-toolbar", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Extensible toolbar for markmap", | ||
@@ -10,9 +10,5 @@ "author": "Gerald <gera2ld@live.com>", | ||
"clean": "del-cli dist types", | ||
"prebuild": "run-s ci clean", | ||
"prepublishOnly": "run-s build", | ||
"ci": "run-s lint", | ||
"lint": "eslint --ext .ts,.tsx .", | ||
"build:types": "tsc", | ||
"build:js": "rollup -c rollup.conf.js", | ||
"build": "run-s build:types build:js" | ||
"build:js": "rollup -c rollup.conf.js" | ||
}, | ||
@@ -36,3 +32,3 @@ "main": "dist/index.umd.js", | ||
}, | ||
"gitHead": "efdba06cf8ff88739cafc02e2b324aee91340abc" | ||
"gitHead": "cbb56b8ede93b15000a31013a0474891b774a977" | ||
} |
22775