markmap-toolbar
Advanced tools
Comparing version 0.2.0 to 0.13.0-alpha.0
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.2.0 | MIT License */ | ||
/*! markmap-toolbar v0.13.0-alpha.0 | MIT License */ | ||
import { mountDom } from '@gera2ld/jsx-dom'; | ||
@@ -122,3 +122,3 @@ import { jsx, jsxs } from '@gera2ld/jsx-dom/jsx-runtime'; | ||
handle = safeCaller(handle); | ||
return e => { | ||
return () => { | ||
if (this.markmap) handle(this.markmap); | ||
@@ -125,0 +125,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/*! markmap-toolbar v0.2.0 | MIT License */ | ||
/*! markmap-toolbar v0.13.0-alpha.0 | MIT License */ | ||
(function (global, factory) { | ||
@@ -357,3 +357,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
handle = safeCaller(handle); | ||
return e => { | ||
return () => { | ||
if (this.markmap) handle(this.markmap); | ||
@@ -360,0 +360,0 @@ }; |
@@ -1,3 +0,3 @@ | ||
/*! markmap-toolbar v0.2.0 | MIT License */ | ||
/*! markmap-toolbar v0.13.0-alpha.0 | 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}}},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 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//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaFQAAAAAAAAAAAAAAAAAHAAARBQIdGAIYEwI/OgJYUQUfHQI+OgJDPgJJRAR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IyiFYB5WdfaElUF8TmTQ6GwH39J2bvypMHcpg4MAKKkUGo5s6KWRfyGRh4WJClGEGBCgS8DLobliy/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})); | ||
/*! @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//wAAAABVVQCqqgBAQACAQACAgABmZgBtbQAAAABgQABgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaFQAAAAAAAAAAAAAAAAAHAAARBQIdGAIYEwI/OgJYUQUfHQI+OgJDPgJJRARBPQRJQgRRSwRRTQRIQQRUTgRUUARZUgRSTQRPSQRjWgZORQRfWQZsZAhTTQRNRwRWUAZkXAZOSARUTgZPRwRRSQRoYwZWUQZWTgRbUwZmXQZoXghmXwdqYwdsYwdfVwVmXQdqYgdiWgVpYAl3bgl6cgl4cAqLggw8OAOWjA2Uig1OSAR2bQihlg55cAh5cAh6cQmMgwyOhAyUjA2QhQ2U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oCFIAULe6E8YFCf8QAqEC86evniZTA4tfLsuRXHr0E4ly9ePF0uC3KnpH1MZBQQxPoVgxyZ5RMdBQaRMc6yIEcihWbQGaA3k9G8CfQoN0pAtSoxCMACihk9qGtBQZ2LHtRIkRUMiqwd2TJADiswsrjQlAGju/o+MLrPNkWo8mFN1ewMWmvBCebQ0rKMJG87QzF0FRwMRuvugpLcrXu3rp7Zs61UCtMZ2nVHbk+fMX/+jMmTp3Sf9MLiULG45q237txaPG3yxPYrYQzYMo60RWbD3E27Ll68Uq+AK+uJqOlZBiSEKGLNnMA0iDfzwrI/NKgBOivk9piPdtUAAAAASUVORK5CYII="}),n("a",{href:"https://markmap.js.org/",children:"markmap"})]}),A.map(d)]}))}}A.Toolbar=p})); |
{ | ||
"name": "markmap-toolbar", | ||
"version": "0.2.0", | ||
"version": "0.13.0-alpha.0", | ||
"description": "Extensible toolbar for markmap", | ||
@@ -26,2 +26,5 @@ "author": "Gerald <gera2ld@live.com>", | ||
"typings": "types/index.d.ts", | ||
"devDependencies": { | ||
"markmap-view": "^0.13.0-alpha.0" | ||
}, | ||
"dependencies": { | ||
@@ -31,3 +34,3 @@ "@babel/runtime": "^7.16.3", | ||
}, | ||
"gitHead": "fbec667e1706813f9f60bea6a971f3820858ca40" | ||
"gitHead": "969aa149f36580954e77b7ba434e5c48b409cfc2" | ||
} |
@@ -0,1 +1,3 @@ | ||
import { VChildren } from '@gera2ld/jsx-dom'; | ||
import type { Markmap } from 'markmap-view'; | ||
import './style.css'; | ||
@@ -5,3 +7,3 @@ interface IToolbarItem { | ||
title?: string; | ||
content: string; | ||
content: VChildren; | ||
onClick?: (e: Event) => void; | ||
@@ -14,3 +16,3 @@ } | ||
private items; | ||
static create(mm: any): Node; | ||
static create(mm: Markmap): Node; | ||
static icon(path: string, attrs?: {}): any; | ||
@@ -22,7 +24,7 @@ constructor(); | ||
}): void; | ||
getHandler(handle: (mm: any) => void): (e: any) => void; | ||
getHandler(handle: (mm: Markmap) => Promise<void>): () => void; | ||
setItems(items: (string | IToolbarItem)[]): void; | ||
attach(mm: any): void; | ||
attach(mm: Markmap): void; | ||
render(): Node; | ||
} | ||
export {}; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25933
524
0
1