diff --git a/README.md b/README.md index f6c9810..b8b8673 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ You can add your taxonomy chart in your website or blog by using this code in yo #### `taxonomy:groups` - `taxonomy:title`: This is the title that will be displayed on the top of your taxonomy. -- `taxonomy:groups`: This a array of object in your style `metadata`. `Required` +- `taxonomy:groups`: This an array of objects in your style `metadata`. `Required` - `id`: This is the identifier for your taxonomy group. This will be use for your layer grouping. `Required`. - `type`: This is the type of your style object. This is use for the taxonomy rendering. One of `line`, `polygon`, `symbol` and `annotation`. `Required`. - `title`: This is the title that will be displayed for your taxonomy group. @@ -108,7 +108,10 @@ You can add your taxonomy chart in your website or blog by using this code in yo "metadata": { "taxonomy:group": "taxonomy-groups-id", "taxonomy:casing": "layer-for-casing", - "taxonomy:example": "Example for symbols" + "taxonomy:example": "Example for symbols", + "taxonomy:matches": [ + { "name": "meta-layer-name", "get:class": "value-from-tile", "example": "Example for symbols" } + ] } } ``` @@ -117,6 +120,11 @@ You can add your taxonomy chart in your website or blog by using this code in yo `Required`. - `taxonomy:casing`: This will refer to another layer id. That's mean the current layer is the casing of the layer pointed by `taxonomy:casing`. This layer must be a line type. This will render an outline for `taxonomy:casing` (We can also use `ref` id from your layer). - `taxonomy:example`: This is a text example for symbols groups. Default text is layer id. +- `taxonomy:matches`: This is an array of objects that will process a `match` or `case` expression. + - `name`: The name or title to display for this example. + - `example`: The text to display if it's a symbol. + - `[expression]:[key]`: The value to return when this expression is found, this should be a value that can be found in your tile. You can add many expressions. + - Example `{"name": "Green Grass", "get:class": "grass"}` will display Green Grass and replace occurences of `["get", "class"]` by `grass`. ### Concrete example diff --git a/dist/taxonomy-bundle+riot.js b/dist/taxonomy-bundle+riot.js index 584bb94..0750bd9 100644 --- a/dist/taxonomy-bundle+riot.js +++ b/dist/taxonomy-bundle+riot.js @@ -1,2 +1,24 @@ -!function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nv-h)for(var T=r(e[c],0);h'.concat(t,""),"application/xml").documentElement,!0)}(e,t):function(t,e){var n=w(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}function Tt(t,e){switch(!0){case T(t):d(e,t);break;case w(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}var wt=Object.freeze({createDOM:function(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?bt(t,e):e)}(t,this.html),this},mount:function(t,e,n,r){var i=this;if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);var o=r,a=o.fragment,s=o.children,u=o.avoidDOMInjection,l=(s?s[0]:t).parentNode,c=w(t),h=c?Math.max(Array.from(l.childNodes).indexOf(t),0):null;return this.isTemplateTag=c,this.createDOM(t),this.dom&&(this.fragment=a||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?l:t,this.children=this.isTemplateTag?s||Array.from(this.fragment.childNodes):null,!u&&this.fragment&&Tt(t,this.fragment),this.bindings=this.bindingsData.map((function(t){return function(t,e,n){var r=e.selector,i=e.type,o=e.redundantAttribute,a=e.expressions,s=r?t.querySelector(r):t;o&&s.removeAttribute(o);var u=a||[];return(vt[i]||vt[2])(s,Object.assign({},e,{expressions:n&&!r?xt(u,n):u}))}(i.el,t,h)})),this.bindings.forEach((function(t){return t.mount(e,n)})),this},update:function(t,e){return this.bindings.forEach((function(n){return n.update(t,e)})),this},unmount:function(t,e,n){if(this.el){switch(this.bindings.forEach((function(r){return r.unmount(t,e,n)})),!0){case this.children&&null!==n:m(this.children);break;case!0===n:y(this.el);break;case null!==n:m(this.el.childNodes)}this.el=null}return this},clone:function(){return Object.assign({},this,{el:null})}});function At(t,e){return void 0===e&&(e=[]),Object.assign({},wt,{html:t,bindingsData:e})}function Et(){return this}function Nt(t){return A(t)?t.prototype&&t.prototype.constructor?new t:t():t}function Ot(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function St(t,e,n){return Object.entries(e).forEach((function(e){var r=o(e,2),i=r[0],a=r[1];Ot(t,i,a,n)})),t}function jt(t,e){return Object.entries(e).forEach((function(e){var n=o(e,2),r=n[0],i=n[1];t[r]||(t[r]=i)})),t}function Mt(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function kt(t,e){return Mt("string"==typeof t?(e||document).querySelectorAll(t):t)}var It=function(t){return 1===t.length?t[0]:t};function _t(e,n,r){var o="object"===t(n)?n:i({},n,r),a=Object.keys(o);return Mt(e).forEach((function(t){a.forEach((function(e){return t.setAttribute(e,o[e])}))})),e}function Ct(t,e){return function(t,e,n){var r="string"==typeof e?[e]:e;return It(Mt(t).map((function(t){return It(r.map((function(e){return t[n](e)})))})))}(t,e,"getAttribute")}var zt,Ut=new Map,Bt=function(){return zt||(_t(zt=kt("style[riot]")[0]||document.createElement("style"),"type","text/css"),zt.parentNode||document.head.appendChild(zt),zt)},Rt={CSS_BY_NAME:Ut,add:function(t,e){return Ut.has(t)||(Ut.set(t,e),this.inject()),this},inject:function(){return Bt().innerHTML=a(Ut.values()).join("\n"),this},remove:function(t){return Ut.has(t)&&(Ut.delete(t),this.inject()),this}};function Ft(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r=e.f?o():t.fonts.load(function(t){return w(t)+" "+t.f+"00 300px "+b(t.c)}(e.a),e.h).then((function(t){1<=t.length?r():setTimeout(a,25)}),(function(){o()}))}()})),o=null,a=new Promise((function(t,n){o=setTimeout(n,e.f)}));Promise.race([a,r]).then((function(){o&&(clearTimeout(o),o=null),e.g(e.a)}),(function(){e.j(e.a)}))};var C={D:"serif",C:"sans-serif"},z=null;function U(){if(null===z){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);z=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))}return z}function B(t,e,n){for(var r in C)if(C.hasOwnProperty(r)&&e===t.f[C[r]]&&n===t.f[C[r]])return!0;return!1}function R(t){var e,n=t.g.a.offsetWidth,o=t.h.a.offsetWidth;(e=n===t.f.serif&&o===t.f["sans-serif"])||(e=U()&&B(t,n,o)),e?i()-t.A>=t.w?U()&&B(t,n,o)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?F(t,t.v):F(t,t.B):function(t){setTimeout(r((function(){R(this)}),t),50)}(t):F(t,t.v)}function F(t,e){setTimeout(r((function(){l(this.g.a),l(this.h.a),l(this.j.a),l(this.m.a),e(this.a)}),t),0)}function P(t,e,n){this.c=t,this.a=e,this.f=0,this.m=this.j=!1,this.s=n}_.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=i(),R(this)};var L=null;function D(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&c(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),O(t,"active")):N(t.a))}function H(t){this.j=t,this.a=new S,this.h=0,this.f=this.g=!0}function K(t,e,n,i,o){var a=0==--t.h;(t.f||t.g)&&setTimeout((function(){var t=o||null,s=i||{};if(0===n.length&&a)N(e.a);else{e.f+=n.length,a&&(e.j=a);var u,l=[];for(u=0;u>8)+16*(t>>8),((240&t)>>4)+16*((240&t)>>4),(15&t)+16*(15&t)]:t&&null!=t.match(/^0x([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/i)?[t>>16,(65280&t)>>8,255&t]:void 0},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],1]:null},hsl:function(t){var n=this.rgb(t);return n?e.rgb.hsl(n):null},hsla:function(t){var e=this.hsl(t);return!e||[e[0],e[1],e[2],1]},fromString:function(t){if(t)return(t=t.replace(/^#*/,"0x"))<=16777215&&(5==t.length||8==t.length)?t:void 0},toString:function(t){if(t)return t.replace(/^(0x)?/i,"#")},isValid:function(t){return null!=this.fromString(t)}},e.rgb={hex:function(t){if(t){var e=Number(t[0]).toString(16),n=Number(t[1]).toString(16),r=Number(t[2]).toString(16);return(1===e.length?"0":"")+e+(1===n.length?"0":"")+n+(1===r.length?"0":"")+r}},rgba:function(t){return t?[t[0],t[1],t[2],1]:null},hsl:function(t){if(t&&Array.isArray(t)&&!(t.length<3)){var e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.max(e,n,r),o=Math.min(e,n,r),a=i-o,s=0;switch(i){case o:s=0;break;case e:s=(n-r)/a+(n=4)return"rgba("+Math.round(t[0])+","+Math.round(t[1])+","+Math.round(t[2])+","+t[3]+")"},isValid:function(t){return null!=this.fromString(t)}},e.hsl={hex:function(t){var n=e.hsl.rgb(t);return n?e.rgb.hex(n):null},rgb:function(t){if(t){var e,n=t[0],r=t[1],i=t[2],o=(1-Math.abs(2*i-1))*r,a=o*(1-Math.abs(n/60%2-1)),s=i-o/2;return n<60?e=[o+s,a+s,s]:n<120?e=[a+s,o+s,s]:n<180?e=[s,o+s,a+s]:n<240?e=[s,a+s,o+s]:n<300?e=[a+s,s,o+s]:n<360&&(e=[o+s,s,a+s]),e?[Math.round(255*e[0]),Math.round(255*e[1]),Math.round(255*e[2])]:void 0}},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],1]:null},hsla:function(t){return t?[t[0],t[1],t[2],1]:null},fromString:function(t){var e;if(t&&(null!=(e=(t=t.replace(/ /g,"")).match(/^hsl\(([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?)\)$/i))||null!=(e=t.match(/^\[?([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?)\]?$/)))){var n=[parseFloat(e[1]),"%"==e[3]?e[2]/100:parseFloat(e[2]),"%"==e[5]?e[4]/100:parseFloat(e[4])];if(n[0]<360&&n[1]<=1&&n[2]<=1)return n}},toString:function(t){if(t&&Array.isArray(t)&&3==t.length)return"hsl("+(1*t[0]).toFixed(2)+", "+(100*t[1]).toFixed(2)+"%, "+(100*t[2]).toFixed(2)+"%)"},isValid:function(t){return null!=this.fromString(t)}},e.hsla={hex:function(t){return e.hsl.hex(t)},rgb:function(t){return e.hsl.rgb(t)},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],t[3]]:null},hsl:function(t){return t?[t[0],t[1],t[2]]:null},fromString:function(t){var e;if(t&&((null!=(e=(t=t.replace(/ /g,"")).match(/^hsla\(([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?),([0-9.]+)\)$/i))||null!=(e=t.match(/^\[?([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?),([0-9.]+)\]?$/)))&&(t=[parseFloat(e[1]),"%"==e[3]?e[2]/100:parseFloat(e[2]),"%"==e[5]?e[4]/100:parseFloat(e[4]),parseFloat(e[6])])[0]<360&&t[1]<=1&&t[2]<=1))return t},toString:function(t){if(t&&Array.isArray(t)&&4==t.length)return"hsla("+(1*t[0]).toFixed(2)+", "+(100*t[1]).toFixed(2)+"%, "+(100*t[2]).toFixed(2)+"%,"+t[3]+")"},isValid:function(t){return null!=this.fromString(t)}},e.isValid=function(t){return e.hex.isValid(t)||e.rgb.isValid(t)||e.rgba.isValid(t)||e.hsl.isValid(t)||e.hsla.isValid(t)},e.getStringTypeAndValue=function(t){var n=e.hex.fromString(t),r=e.rgb.fromString(t),i=e.rgba.fromString(t),o=e.hsl.fromString(t),a=e.hsla.fromString(t);return n?{value:n,type:"hex"}:r?{value:r,type:"rgb"}:i?{value:i,type:"rgba"}:o?{value:o,type:"hsl"}:a?{value:a,type:"hsla"}:void 0},t.exports=e,"undefined"!=typeof window&&(window.colorConverter=e)})),ee=function(){function t(){e(this,t)}return r(t,[{key:"findStopLessThanOrEqualTo",value:function(t,e){for(var n,r,i=0,o=t.length-1,a=0;i<=o;){if(n=t[a=Math.floor((i+o)/2)][0],r=t[a+1][0],e===n||e>n&&ee&&(o=a-1)}return Math.max(a-1,0)}},{key:"interpolationFactor",value:function(t,e,n,r){var i=r-n,o=t-n;return 0===i?0:1===e||void 0===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}},{key:"number",value:function(t,e,n){return t*(1-n)+e*n}},{key:"array",value:function(t,e,n){return t.map((function(t,r){return this.number(t,e[r],n)}))}},{key:"asExpression",value:function(t){if(Array.isArray(t))return t;if(!t.stops)throw new Error("".concat(JSON.stringify(t)," is not a correct expression"));return 1===t.base||void 0===t.base?["interpolate",["linear"],["zoom"]].concat(t.stops.reduce((function(t,e){return t.concat(e)}),[])):["interpolate",["exponential",t.base],["zoom"]].concat(t.stops.reduce((function(t,e){return t.concat(e)}),[]))}},{key:"parseInterpolate",value:function(t,e){if(!t||"interpolate"!==t[0]||t.length<4)return null;var n="exponential"===t[1][0]?t[1][1]:1,r=t.slice(3).reduce((function(t,e,n){return n%2==0?t.push([e]):t[t.length-1].push(e),t}),[]);if(1===r.length||r[0][0]>=e)return{value:r[0][1]};if(r[r.length-1][0]<=e)return{value:r[r.length-1][1]};var i=this.findStopLessThanOrEqualTo(r,e);return{lower:r[i][1],upper:r[i+1][1],t:this.interpolationFactor(e,n,r[i][0],r[i+1][0])}}},{key:"renderMatch",value:function(t,e){var n=this;return Array.isArray(t)?this.decision(t.map((function(t){return n.renderMatch(t,e)})),e):t}},{key:"lookup",value:function(t,e){if(!Array.isArray(t))return t;switch(t[0]){case"at":return this.lookup(t[2],e)[t[1]];case"get":case"has":case"!has":return e["".concat(t[0],":").concat(t[1])];case"in":return this.lookup(t[2],e).indexOf(t[1])>=0;case"!in":return this.lookup(t[2],e).indexOf(t[1])<0;case"index-of":return this.lookup(t[2],e).indexOf(t[1]);case"length":return this.lookup(t[1],e).length;case"slice":return this.lookup(t[1],e).slice(t[2],t[3])}return t}},{key:"decision",value:function(t,e){var n=this;if(!Array.isArray(t))return t;switch(t[0]){case"!":return!this.lookup(t[1],e);case"==":return this.lookup(t[1],e)==t[2];case"!=":return this.lookup(t[1],e)!=t[2];case">":return this.lookup(t[1],e)>t[2];case"<":return this.lookup(t[1],e)=":return this.lookup(t[1],e)>=t[2];case"<=":return this.lookup(t[1],e)<=t[2];case"all":return t.slice(1).every((function(t){return!0===n.lookup(t,e)}));case"some":return t.slice(1).any((function(t){return!0===n.lookup(t,e)}));case"match":for(var r=2;r=o)return t[s+1];return a;case"coalesce":return t.slice(1).find((function(t){return null!=t}))}return this.lookup(t,e)}}]),t}(),ne=function(){function t(){e(this,t),this._families={}}return r(t,[{key:"getWeight",value:function(t){return/extra(- )?light/i.test(t)?200:/light/i.test(t)?300:/semi(- )?bold/i.test(t)?600:/bold/i.test(t)?700:/black/i.test(t)?900:400}},{key:"getStyle",value:function(t){return/italic$/i.test(t)?"italic":"normal"}},{key:"getFamily",value:function(t){var e=t.split(/( black| bold| light| regular| semi[- ]?bold| extra[- ]?light| italic)/i);return e&&e[0]?e[0]:""}},{key:"getProps",value:function(t){return{family:this.getFamily(t),style:this.getStyle(t),weight:this.getWeight(t)}}},{key:"add",value:function(t){this._families[t.family]=this._families[t.family]||[];var e=t.weight+("italic"==t.style?"i":"");-1==this._families[t.family].indexOf(e)&&this._families[t.family].push(e)}},{key:"download",value:function(){var t=[];for(var e in this._families)t.push(e+":"+this._families[e].join(","));t.length>0&&Qt.load({google:{families:t}})}}]),t}(),re=new(function(){function n(){e(this,n),this.zooms=this.generateArray(1,20),this.expressions=new ee,this.fonts=new ne}return r(n,[{key:"generateArray",value:function(t,e){for(var n=[],r=t;rs.maxWidth&&(s.maxWidth=a),s[e]={width:isNaN(a)?0:a,color:n.parseColor(t,r,e),opacity:n.parseNumber(t,o,e)}})),s}},{key:"borderStyleFromCasing",value:function(t,e,n){if(!(t&&e&&t[n]&&e[n]))return"";var r=Math.max((t[n].width-e[n].width)/2,0);return"border-top-width:"+r+"px;border-bottom-width:"+r+"px;border-top-color:"+t[n].color+";border-bottom-color:"+t[n].color+";border-top-style:solid;border-bottom-style:solid;"}},{key:"searchMatches",value:function(t,e,n){var r=this;if("match"===t[0]){for(var o=Array.isArray(t[1])?t[1].join(":"):t[1],a=function(n){var r=Array.isArray(t[n+1])?t[n+1][0]:t[n+1];e.find((function(t){return t.name===r}))||e.push(i({name:r},o,r))},s=1;s0&&(t.metadata["taxonomy:matches"]=n),n}}}]),n}()),ie=(Jt={css:'taxonomy { margin: auto; font-family: "Roboto", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1em; } taxonomy h1 { margin: 0; } taxonomy h1, taxonomy h2 { line-height: 1.5; text-align: center; } taxonomy a { color: inherit; text-decoration: none; } taxonomy>.container { min-height: 100%; min-width: 500px; padding: 0 30px; margin: auto; } taxonomy .taxonomy-item { padding: 20px 0; border-bottom: 1px solid #eaecef; } taxonomy .render-container { display: flex; flex-wrap: wrap; justify-content: center; } taxonomy .render-column, taxonomy .render-item { padding: 0px; display: flex; flex-direction: column; text-align: left; } taxonomy span.render-header { font-weight: bold; text-align: center; } taxonomy line-render .render-item>canvas,[is="taxonomy"] line-render .render-item>canvas,taxonomy polygon-render .render-item>*,[is="taxonomy"] polygon-render .render-item>*{ margin: auto; } taxonomy polygon-render .render-item,[is="taxonomy"] polygon-render .render-item{ padding: 10px; } taxonomy line-render .render-item,[is="taxonomy"] line-render .render-item{ padding: 0px 4px; } taxonomy line-render .render-item,[is="taxonomy"] line-render .render-item,taxonomy symbol-render .render-item,[is="taxonomy"] symbol-render .render-item{ display: flex; align-items: center; flex-direction: row; padding: 0px 15px; } @media print { taxonomy .taxonomy-item { page-break-inside: avoid; break-inside: avoid; } taxonomy .render-item>* { page-break-inside: avoid; break-inside: avoid; } }',exports:{components:{Annotation:Zt,LineRender:{css:null,exports:{state:{casing:{},lines:[],minHeight:0},onMounted(){this.state.casing={},this.state.lines=this.props.layers.filter((t=>{if(t.metadata&&t.metadata["taxonomy:group"]===this.props.group&&("line"==t.type||t.ref)){if(!t.metadata["taxonomy:casing"]&&!t.ref)return!0;this.state.casing[t.metadata["taxonomy:casing"]||t.ref]=t}return!1})).reduce(((t,e)=>(re.autoGenerateMatches(e),!e.metadata["taxonomy:matches"]||e.metadata["taxonomy:matches"].length<1?(t.push(e),t):t.concat(re.renderMatches(e,e.metadata["taxonomy:matches"])))),[]).map((t=>{this.state.casing[t.id]&&(this.state.casing[t.id]=re.renderLine(this.state.casing[t.id],this.props.zooms));const e=re.renderLine(t,this.props.zooms);return e.id=t.name||t.id,e})),this.state.minHeight=this.state.lines.reduce(((t,e)=>Math.max(t,this.getMinHeight(e))),0),this.update()},getMinHeight(t){const e=12+t.maxWidth+(this.state.casing[t.id]?this.state.casing[t.id].maxWidth:0);return e>25?e:25},taxonomy:re},template:function(t,e,n,r){return t('

id
',[{redundantAttribute:"expr8",selector:"[expr8]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.props.title}},{type:e.ATTRIBUTE,name:"id",evaluate:function(t){return t.props.group}}]},{type:n.EACH,getKey:null,condition:null,template:t('
',[{redundantAttribute:"expr10",selector:"[expr10]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.zoom}}]},{type:n.EACH,getKey:null,condition:function(t){return t.state.lines},template:t('',[{expressions:[{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["min-height: ",t.state.minHeight,"px;"].join("")}}]},{redundantAttribute:"expr12",selector:"[expr12]",expressions:[{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["width: 55px; height: ",t.line[t.zoom].width,"px; background-color: ",t.line[t.zoom].color,"; ",t.taxonomy.borderStyleFromCasing(t.state.casing[t.line.id],t.line,t.zoom)," opacity: ",t.line[t.zoom].opacity,";"].join("")}}]}]),redundantAttribute:"expr11",selector:"[expr11]",itemName:"line",indexName:null,evaluate:function(t){return t.state.lines}}]),redundantAttribute:"expr9",selector:"[expr9]",itemName:"zoom",indexName:null,evaluate:function(t){return t.props.zooms}},{type:n.EACH,getKey:null,condition:function(t){return t.state.lines},template:t(" ",[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return[t.line.id].join("")}},{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["min-height: ",t.state.minHeight,"px;"].join("")}}]}]),redundantAttribute:"expr13",selector:"[expr13]",itemName:"line",indexName:null,evaluate:function(t){return t.state.lines}}])},name:"line-render"},PolygonRender:{css:null,exports:{state:{casing:{},polygons:[]},onMounted(){this.state.polygons=this.props.layers.filter((t=>{if(t.metadata&&t.metadata["taxonomy:group"]===this.props.group){if("fill"==t.type&&!t.metadata["taxonomy:casing"])return!0;"line"==t.type&&t.metadata["taxonomy:casing"]&&(this.state.casing[t.metadata["taxonomy:casing"]]=t)}return!1})).reduce(((t,e)=>(re.autoGenerateMatches(e),!e.metadata["taxonomy:matches"]||e.metadata["taxonomy:matches"].length<1?(t.push(e),t):t.concat(re.renderMatches(e,e.metadata["taxonomy:matches"])))),[]).map((t=>(this.state.casing[t.id]?this.state.casing[t.id]={color:re.parseColor(t,this.state.casing[t.id].paint["line-color"],this.props.zooms[0]),width:re.parseNumber(t,this.state.casing[t.id].paint["line-width"],this.props.zooms[0]),id:this.state.casing[t.id].id}:t.paint["fill-outline-color"]&&(this.state.casing[t.id]={color:re.parseColor(t,t.paint["fill-outline-color"],this.props.zooms[0]),width:1,id:t.id}),{color:re.parseColor(t,t.paint["fill-color"],this.props.zooms[0]),id:t.name||t.id,opacity:re.parseNumber(t,t.paint["fill-opacity"],this.props.zooms[0])}))),this.update()}},template:function(t,e,n,r){return t('

',[{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.props.title}},{type:e.ATTRIBUTE,name:"id",evaluate:function(t){return t.props.group}}]},{type:n.EACH,getKey:null,condition:function(t){return t.state.polygons},template:t(' ',[{redundantAttribute:"expr16",selector:"[expr16]",expressions:[{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["width: 100px; height: 100px; background-color: ",t.polygon.color,"; ",t.state.casing[t.polygon.id]?"border: "+t.state.casing[t.polygon.id].width+"px solid "+t.state.casing[t.polygon.id].color+";":""," opacity: ",t.polygon.opacity,";"].join("")}}]},{redundantAttribute:"expr17",selector:"[expr17]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.polygon.id}}]}]),redundantAttribute:"expr15",selector:"[expr15]",itemName:"polygon",indexName:null,evaluate:function(t){return t.state.polygons}}])},name:"polygon-render"},SymbolRender:{css:null,exports:{state:{casing:{},symbols:[]},onMounted(){this.state.symbols=this.props.layers.filter((t=>t.metadata&&t.metadata["taxonomy:group"]===this.props.group&&"symbol"==t.type)).reduce(((t,e)=>(re.autoGenerateMatches(e),!e.metadata["taxonomy:matches"]||e.metadata["taxonomy:matches"].length<1?(t.push(e),t):t.concat(re.renderMatches(e,e.metadata["taxonomy:matches"])))),[]).map((t=>{t.paint["text-halo-color"]&&(this.state.casing[t.id]=re.widthAndColorByZooms(t,{width:t.paint["text-halo-width"],color:t.paint["text-halo-color"],zooms:this.props.zooms}));const e=re.widthAndColorByZooms(t,{width:t.layout["text-size"],color:t.paint["text-color"],zooms:this.props.zooms});e.id=t.name||t.id,e["text-transform"]=t.layout["text-transform"]||"none",e.example=t.metadata["taxonomy:example"];const n=re.fonts.getProps(t.layout["text-font"][0]);return e.fontStyle=this.fontPropsToStyle(n),re.fonts.add(n),e})),this.update()},fontPropsToStyle:t=>"font-style: "+t.style+"; font-weight: "+t.weight+"; font-family: '"+t.family+"';",getMinHeight(t){const e=8+t.maxWidth+(this.state.casing[t.id]?this.state.casing[t.id].maxWidth:0);return e>25?e:25}},template:function(t,e,n,r){return t('

id
',[{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.props.title}},{type:e.ATTRIBUTE,name:"id",evaluate:function(t){return t.props.group}}]},{type:n.EACH,getKey:null,condition:null,template:t('
',[{redundantAttribute:"expr20",selector:"[expr20]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.zoom}}]},{type:n.EACH,getKey:null,condition:function(t){return t.state.symbols},template:t(' ',[{expressions:[{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["min-height: ",t.getMinHeight(t.symbol),"px;"].join("")}}]},{redundantAttribute:"expr22",selector:"[expr22]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.symbol.example||t.symbol.id}},{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["font-size: ",t.symbol[t.zoom].width,"px; color: ",t.symbol[t.zoom].color,"; ",t.state.casing[t.symbol.id]&&t.state.casing[t.symbol.id][t.zoom]?"text-shadow: 0 0 "+t.state.casing[t.symbol.id][t.zoom].width+"px "+t.state.casing[t.symbol.id][t.zoom].color+";":""," ",t.symbol.fontStyle," text-transform: ",t.symbol["text-transform"],";"].join("")}}]}]),redundantAttribute:"expr21",selector:"[expr21]",itemName:"symbol",indexName:null,evaluate:function(t){return t.state.symbols}}]),redundantAttribute:"expr19",selector:"[expr19]",itemName:"zoom",indexName:null,evaluate:function(t){return t.props.zooms}},{type:n.EACH,getKey:null,condition:function(t){return t.state.symbols},template:t(" ",[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return[t.symbol.id].join("")}},{type:e.ATTRIBUTE,name:"style",evaluate:function(t){return["min-height: ",t.getMinHeight(t.symbol),"px;"].join("")}}]}]),redundantAttribute:"expr23",selector:"[expr23]",itemName:"symbol",indexName:null,evaluate:function(t){return t.state.symbols}}])},name:"symbol-render"}},fetchStyleURL(t){var e=new XMLHttpRequest;e.addEventListener("load",(function(){switch(this.status){case 200:return t(null,JSON.parse(this.responseText));case 400:return t("You sent a bad request.");case 401:return t("You are not authorized to use this style.");case 500:return t("This server can not answer yet.")}})),e.open("GET",this.props.styleUrl),e.send()},setBackgroundColor(){var t=this.style.layers;for(var e in t)if("background"===t[e].type)return void(this.$(".container").style["background-color"]=t[e].paint["background-color"]||"#fff")},onMounted(){if(!this.props.styleUrl)return console.error("Style URL is missing");this.fetchStyleURL(((t,e)=>{if(t)return console.error("Error in fetch style");this.style=e,this.update()}))},onUpdated(){this.setBackgroundColor(),re.fonts.download();const t=location&&location.hash&&location.hash.replace("#",""),e=t&&this.$(t);e&&window.scrollTo({top:e.offsetTop,behavior:"smooth"})},taxonomy:re},template:function(t,e,n,r){return t('
',[{type:n.IF,evaluate:function(t){return t.style&&t.style.metadata},redundantAttribute:"expr0",selector:"[expr0]",template:t('
\n Powered by JawgMaps. Contribute on GitHub.\n
',[{type:n.IF,evaluate:function(t){return t.style.metadata["taxonomy:title"]},redundantAttribute:"expr1",selector:"[expr1]",template:t('

',[{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:function(t){return t.style.metadata["taxonomy:title"]}}]}])},{type:n.EACH,getKey:null,condition:null,template:t('',[{type:n.IF,evaluate:function(t){return"line"===t.group.type},redundantAttribute:"expr4",selector:"[expr4]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:function(t){return"line-render"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"layers",evaluate:function(t){return t.style.layers}},{type:e.ATTRIBUTE,name:"title",evaluate:function(t){return t.group.title}},{type:e.ATTRIBUTE,name:"group",evaluate:function(t){return t.group.id}},{type:e.ATTRIBUTE,name:"zooms",evaluate:function(t){return t.taxonomy.getZooms(t.group.zooms)}}]}])},{type:n.IF,evaluate:function(t){return"polygon"===t.group.type},redundantAttribute:"expr5",selector:"[expr5]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:function(t){return"polygon-render"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"layers",evaluate:function(t){return t.style.layers}},{type:e.ATTRIBUTE,name:"title",evaluate:function(t){return t.group.title}},{type:e.ATTRIBUTE,name:"group",evaluate:function(t){return t.group.id}},{type:e.ATTRIBUTE,name:"zooms",evaluate:function(t){return t.taxonomy.getZooms(t.group.zooms)}}]}])},{type:n.IF,evaluate:function(t){return"symbol"===t.group.type},redundantAttribute:"expr6",selector:"[expr6]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:function(t){return"symbol-render"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"layers",evaluate:function(t){return t.style.layers}},{type:e.ATTRIBUTE,name:"title",evaluate:function(t){return t.group.title}},{type:e.ATTRIBUTE,name:"group",evaluate:function(t){return t.group.id}},{type:e.ATTRIBUTE,name:"zooms",evaluate:function(t){return t.taxonomy.getZooms(t.group.zooms)}}]}])},{type:n.IF,evaluate:function(t){return"annotation"===t.group.type},redundantAttribute:"expr7",selector:"[expr7]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:function(t){return"annotation"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"layers",evaluate:function(t){return t.style.layers}},{type:e.ATTRIBUTE,name:"content",evaluate:function(t){return t.group.content}},{type:e.ATTRIBUTE,name:"group",evaluate:function(t){return t.group.id}},{type:e.ATTRIBUTE,name:"zooms",evaluate:function(t){return t.taxonomy.getZooms(t.group.zooms)}}]}])}]),redundantAttribute:"expr3",selector:"[expr3]",itemName:"group",indexName:null,evaluate:function(t){return t.style.metadata["taxonomy:groups"]}}])}])},name:"taxonomy"},function(t,e,n){var r=void 0===n?{}:n,i=r.slots,o=r.attributes,a=r.parentScope;return function(){for(var t=arguments.length,e=new Array(t),n=0;n=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function C(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,u=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(t,e)||B(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t){return function(t){if(Array.isArray(t))return z(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||B(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){if(t){if("string"==typeof t)return z(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(t,e):void 0}}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&void 0!==arguments[2]&&arguments[2];n?tt(this.el):n||Q(this.el)})),"clone",q),"createDOM",q),rt={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4}; +/* Riot WIP, @license MIT */ +function ot(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Object.defineProperty(t,e,k({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function it(t,e,n){return Object.entries(e).forEach((function(e){var r=C(e,2),o=r[0],i=r[1];ot(t,o,i,n)})),t}function at(t,e){return Object.entries(e).forEach((function(e){var n=C(e,2),r=n[0],o=n[1];t[r]||(t[r]=o)})),t}var st=Symbol(),lt=Symbol();function ut(t){var e=t.dom.cloneNode(!0),n=function(){var t=document.createTextNode(""),e=document.createTextNode("");return t[st]=!0,e[lt]=!0,{head:t,tail:e}}(),r=n.head,o=n.tail;return{avoidDOMInjection:!0,fragment:e,head:r,tail:o,children:[r].concat(M(Array.from(e.childNodes)),[o])}}var ct=Symbol("unmount"),pt={nodes:[],mount:function(t,e){return this.update(t,e)},update:function(t,e){var n=this.placeholder,r=this.nodes,o=this.childrenMap,i=t===ct?null:this.evaluate(t),a=function(t,e,n,r){var o=r.condition,i=r.template,a=r.childrenMap,s=r.itemName,l=r.getKey,u=r.indexName,c=r.root,p=r.isTemplateTag,h=new Map,d=[],f=[];return t.forEach((function(t,r){var m=function(t,e){var n=e.itemName,r=e.indexName,o=e.index,i=e.item;ot(t,n,i),r&&ot(t,r,o);return t}(Object.create(e),{itemName:s,indexName:u,index:r,item:t}),y=l?l(m):r,g=a.get(y),v=[];if(!function(t,e){return!!t&&!t(e)}(o,m)){var x=!g,b=g?g.template:i.clone(),w=b.el||c.cloneNode(),T=p&&x?ut(b):b.meta;x?d.push((function(){return b.mount(w,m,n,T)})):d.push((function(){return b.update(m,n)})),p?v.push.apply(v,M(T.children)):v.push(w),a.delete(y),f.push.apply(f,v),h.set(y,{nodes:v,template:b,context:m,index:r})}})),{newChildrenMap:h,batches:d,futureNodes:f}}(i?Array.from(i):[],t,e,this),s=a.newChildrenMap,l=a.batches,u=a.futureNodes;return function(t,e,n,r){for(var o,i,a=e.length,s=t.length,l=a,u=0,c=0,p=null;um-c)for(var v=n(t[u],0);c1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t?t({slots:e,attributes:n}):Bt(function(t){return t.reduce((function(t,e){return t+e.html}),"")}(e),[].concat(M(function(t){return t.reduce((function(t,e){var n=e.bindings;return t.concat(n)}),[])}(e)),[{expressions:n.map((function(t){return k({type:P},t)}))}]))}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount:function(t,e,n){return this.tag&&this.tag.unmount(n),this}};var Ot=O(O(O(O(O({},1,(function(t,e){var n=e.evaluate,r=e.template,o=document.createTextNode("");return et(o,t),tt(t),k(k({},ht),{},{node:t,evaluate:n,placeholder:o,template:r.createDOM(t)})})),2,(function(t,e){var n,r,o=e.expressions;return k({},(n=o.map((function(e){return kt(t,e)})),["mount","update","unmount"].reduce((function(t,e){return k(k({},t),{},O({},e,(function(t){return n.map((function(n){return n[e](t)}))&&r})))}),{})))})),0,(function(t,e){var n=e.evaluate,r=e.condition,o=e.itemName,i=e.indexName,a=e.getKey,s=e.template,l=document.createTextNode(""),u=t.cloneNode();return et(l,t),tt(t),k(k({},pt),{},{childrenMap:new Map,node:t,root:u,condition:r,evaluate:n,isTemplateTag:G(u),template:s.createDOM(t),getKey:a,indexName:i,itemName:o,placeholder:l})})),3,(function(t,e){var n=e.evaluate,r=e.getComponent,o=e.slots,i=e.attributes;return k(k({},jt),{},{node:t,evaluate:n,slots:o,attributes:i,getComponent:r})})),4,(function(t,e){var n=e.name,r=e.attributes;return k(k({},St),{},{attributes:r,node:t,name:n})}));function It(t,e){return t.map((function(t){return t.type===U?k(k({},t),{},{childNodeIndex:t.childNodeIndex+e}):t}))}function Ct(t,e){return V(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(''.concat(t,""),"application/xml").documentElement,!0)}(e,t):function(t,e){var n=G(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}var Mt={createDOM:function(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?Ct(t,e):e)}(t,this.html)||document.createDocumentFragment(),this},mount:function(t,e,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t||H("Please provide DOM node to mount properly your template"),this.el&&this.unmount(e);var i=o.fragment,a=o.children,s=o.avoidDOMInjection,l=(a?a[0]:t).parentNode,u=G(t),c=u?function(t,e,n){var r=Array.from(t.childNodes);return Math.max(r.indexOf(e),r.indexOf(n.head)+1,0)}(l,t,o):null;this.createDOM(t);var p=i||this.dom.cloneNode(!0);return this.el=u?l:t,this.children=u?a||Array.from(p.childNodes):null,!s&&p&&function(t,e){switch(!0){case V(t):!function(t,e){for(;t.firstChild;)e.appendChild(t.firstChild)}(e,t);break;case G(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}(t,p),this.bindings=this.bindingsData.map((function(t){return function(t,e,n){var r=e.selector,o=e.type,i=e.redundantAttribute,a=e.expressions,s=r?t.querySelector(r):t;i&&s.removeAttribute(i);var l=a||[];return(Ot[o]||Ot[2])(s,k(k({},e),{},{expressions:n&&!r?It(l,n):l}))}(r.el,t,c)})),this.bindings.forEach((function(t){return t.mount(e,n)})),this.meta=o,this},update:function(t,e){return this.bindings.forEach((function(n){return n.update(t,e)})),this},unmount:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.el;if(!r)return this;switch(this.bindings.forEach((function(r){return r.unmount(t,e,n)})),!0){case r[v]||null===n:break;case Array.isArray(this.children):!function(t){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return k(k({},Mt),{},{html:t,bindingsData:e})} +/* Riot v9.1.2, @license MIT */var zt=Object.freeze(O(O(O({},o,q),i,q),a,q)),Ft=function(t,n){return t[e]=n}; +/* Riot v9.1.2, @license MIT */ +/* Riot v9.1.2, @license MIT */ +function Pt(t){return[o,i,a].reduce((function(e,n){return e[n]=t(n),e}),{})} +/* Riot v9.1.2, @license MIT */ +/* Riot WIP, @license MIT */ +function Ut(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]} +/* Riot WIP, @license MIT */function Rt(t,e){return Ut("string"==typeof t?(e||document).querySelectorAll(t):t)} +/* Riot v9.1.2, @license MIT */var _t=Object.freeze({$:function(t){return Rt(t,this.root)[0]},$$:function(t){return Rt(t,this.root)}}),Lt=Object.freeze(O(O(O(O(O(O(O({},s,q),l,q),u,q),c,q),p,q),h,q),d,q)),Ht=function(t){return 1===t.length?t[0]:t};function $t(t,e,n){var r="object"===E(e)?e:O({},e,n),o=Object.keys(r);return Ut(t).forEach((function(t){o.forEach((function(e){return t.setAttribute(e,r[e])}))})),t}function Wt(t,e){return function(t,e,n){var r="string"==typeof e?[e]:e;return Ht(Ut(t).map((function(t){return Ht(r.map((function(e){return t[n](e)})))})))}(t,e,"getAttribute")}var Dt,Vt=new Map,Gt=function(){return Dt||($t(Dt=Rt("style[riot]")[0]||document.createElement("style"),"type","text/css"),Dt.parentNode||document.head.appendChild(Dt),Dt)},Xt={CSS_BY_NAME:Vt,add:function(t,e){return Vt.has(t)||(Vt.set(t,e),this.inject()),this},inject:function(){return Gt().innerHTML=M(Vt.values()).join("\n"),this},remove:function(t){return Vt.has(t)&&(Vt.delete(t),this.inject()),this}}; +/* Riot WIP, @license MIT */ +function Kt(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return ot(e,v,!1),this[b]=r,this[w]=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).map((function(e){return kt(t,e)})),n={};return Object.assign(n,k({expressions:e},Pt((function(t){return function(r){return e.forEach((function(e){return e[t](r)})),n}}))))}(e,a).mount(r),ot(this,f,Object.freeze(k(k({},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(k({},Y(t)),J(e))}(e,A)),W(this[w].expressions)))),this[m]=qt(this[m],n),this[T]=this.template.createDOM(e).clone(),Ft(e,this),t.name&&Zt(e,t.name),ot(this,g,e),ot(this,y,i),this[l](this[f],this[m]),this[T].mount(e,this,r),this[u](this[f],this[m]),this},update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;e&&(this[b]=e,this[w].update(e));var n=k(k({},Y(this[g])),W(this[w].expressions));n[r];var o=I(n,[r].map(F));if(!1!==this[s](o,this[f]))return ot(this,f,Object.freeze(k(k({},e?null:this[f]),o))),this[m]=qt(this[m],t),this[c](this[f],this[m]),this[x]||(this[x]=!0,this[T].update(this,this[b])),this[p](this[f],this[m]),this[x]=!1,this},unmount:function(t){return this[h](this[f],this[m]),this[w].unmount(),this[T].unmount(this,this[b],null===t?null:!t),this[d](this[f],this[m]),this}})),Object.keys(t).filter((function(e){return X(t[e])})).forEach((function(t){o[t]=o[t].bind(o)})),o}function Yt(t){var e=t.css,n=t.template,r=t.componentAPI,o=t.name;return e&&o&&Xt.add(o,e),Kt(Jt)(it(at(r,k(k({},Lt),{},O(O({},f,{}),m,{}))),k(k(O(O({},y,null),g,null),_t),{},{name:o,css:e,template:n})))}var Qt=function(e){var n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.entries(J(t)).reduce((function(t,e){var n,r=C(e,2),o=r[0],i=r[1];return t[(n=o,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=ee(i),t}),{})}(e.exports?e.exports.components:{});return function(r){return r===e.name?te(e):n[r]||t.get(r)}},te=$(ee);function ee(t){var e=t.css,n=t.template,r=t.exports,i=t.name,a=n?function(t,e,n){return t(Bt,_,rt,n)}(n,0,Qt(t)):nt;return function(t){var s=t.slots,l=t.attributes,u=t.props;if(r&&r[v])return function(t,e){var n=e.slots,r=e.attributes,i=e.props,a=e.css;e.template&&H("Pure components can not have html"),a&&H("Pure components do not have css");var s=at(t({slots:n,attributes:r,props:i}),zt);return Pt((function(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r>8)+16*(t>>8),((240&t)>>4)+16*((240&t)>>4),(15&t)+16*(15&t)]:t&&null!=t.match(/^0x([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/i)?[t>>16,(65280&t)>>8,255&t]:void 0},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],1]:null},hsl:function(t){var n=this.rgb(t);return n?e.rgb.hsl(n):null},hsla:function(t){var e=this.hsl(t);return!e||[e[0],e[1],e[2],1]},fromString:function(t){if(t)return(t=t.replace(/^#*/,"0x"))<=16777215&&(5==t.length||8==t.length)?t:void 0},toString:function(t){if(t)return t.replace(/^(0x)?/i,"#")},isValid:function(t){return null!=this.fromString(t)}},e.rgb={hex:function(t){if(t){var e=Number(t[0]).toString(16),n=Number(t[1]).toString(16),r=Number(t[2]).toString(16);return(1===e.length?"0":"")+e+(1===n.length?"0":"")+n+(1===r.length?"0":"")+r}},rgba:function(t){return t?[t[0],t[1],t[2],1]:null},hsl:function(t){if(t&&Array.isArray(t)&&!(t.length<3)){var e=t[0]/255,n=t[1]/255,r=t[2]/255,o=Math.max(e,n,r),i=Math.min(e,n,r),a=o-i,s=0;switch(o){case i:s=0;break;case e:s=(n-r)/a+(n=4)return"rgba("+Math.round(t[0])+","+Math.round(t[1])+","+Math.round(t[2])+","+t[3]+")"},isValid:function(t){return null!=this.fromString(t)}},e.hsl={hex:function(t){var n=e.hsl.rgb(t);return n?e.rgb.hex(n):null},rgb:function(t){if(t){var e,n=t[0],r=t[1],o=t[2],i=(1-Math.abs(2*o-1))*r,a=i*(1-Math.abs(n/60%2-1)),s=o-i/2;return n<60?e=[i+s,a+s,s]:n<120?e=[a+s,i+s,s]:n<180?e=[s,i+s,a+s]:n<240?e=[s,a+s,i+s]:n<300?e=[a+s,s,i+s]:n<360&&(e=[i+s,s,a+s]),e?[Math.round(255*e[0]),Math.round(255*e[1]),Math.round(255*e[2])]:void 0}},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],1]:null},hsla:function(t){return t?[t[0],t[1],t[2],1]:null},fromString:function(t){var e;if(t&&(null!=(e=(t=t.replace(/ /g,"")).match(/^hsl\(([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?)\)$/i))||null!=(e=t.match(/^\[?([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?)\]?$/)))){var n=[parseFloat(e[1]),"%"==e[3]?e[2]/100:parseFloat(e[2]),"%"==e[5]?e[4]/100:parseFloat(e[4])];if(n[0]<360&&n[1]<=1&&n[2]<=1)return n}},toString:function(t){if(t&&Array.isArray(t)&&3==t.length)return"hsl("+(1*t[0]).toFixed(2)+", "+(100*t[1]).toFixed(2)+"%, "+(100*t[2]).toFixed(2)+"%)"},isValid:function(t){return null!=this.fromString(t)}},e.hsla={hex:function(t){return e.hsl.hex(t)},rgb:function(t){return e.hsl.rgb(t)},rgba:function(t){var e=this.rgb(t);return e?[e[0],e[1],e[2],t[3]]:null},hsl:function(t){return t?[t[0],t[1],t[2]]:null},fromString:function(t){var e;if(t&&((null!=(e=(t=t.replace(/ /g,"")).match(/^hsla\(([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?),([0-9.]+)\)$/i))||null!=(e=t.match(/^\[?([0-9.]+),([0-9.]+)(%?),([0-9.]+)(%?),([0-9.]+)\]?$/)))&&(t=[parseFloat(e[1]),"%"==e[3]?e[2]/100:parseFloat(e[2]),"%"==e[5]?e[4]/100:parseFloat(e[4]),parseFloat(e[6])])[0]<360&&t[1]<=1&&t[2]<=1))return t},toString:function(t){if(t&&Array.isArray(t)&&4==t.length)return"hsla("+(1*t[0]).toFixed(2)+", "+(100*t[1]).toFixed(2)+"%, "+(100*t[2]).toFixed(2)+"%,"+t[3]+")"},isValid:function(t){return null!=this.fromString(t)}},e.isValid=function(t){return e.hex.isValid(t)||e.rgb.isValid(t)||e.rgba.isValid(t)||e.hsl.isValid(t)||e.hsla.isValid(t)},e.getStringTypeAndValue=function(t){var n=e.hex.fromString(t),r=e.rgb.fromString(t),o=e.rgba.fromString(t),i=e.hsl.fromString(t),a=e.hsla.fromString(t);return n?{value:n,type:"hex"}:r?{value:r,type:"rgb"}:o?{value:o,type:"rgba"}:i?{value:i,type:"hsl"}:a?{value:a,type:"hsla"}:void 0},t.exports=e,"undefined"!=typeof window&&(window.colorConverter=e)}(oe);var ie,ae=re(oe.exports),se=function(){function t(){S(this,t)}return j(t,[{key:"findStopLessThanOrEqualTo",value:function(t,e){for(var n,r,o=0,i=t.length-1,a=0;o<=i;){if(n=t[a=Math.floor((o+i)/2)][0],r=t[a+1][0],e===n||e>n&&ee&&(i=a-1)}return Math.max(a-1,0)}},{key:"interpolationFactor",value:function(t,e,n,r){var o=r-n,i=t-n;return 0===o?0:1===e||void 0===e?i/o:(Math.pow(e,i)-1)/(Math.pow(e,o)-1)}},{key:"number",value:function(t,e,n){return t*(1-n)+e*n}},{key:"array",value:function(t,e,n){return t.map((function(t,r){return this.number(t,e[r],n)}))}},{key:"asExpression",value:function(t){if(Array.isArray(t))return t;if(!t.stops)throw new Error("".concat(JSON.stringify(t)," is not a correct expression"));return 1===t.base||void 0===t.base?["interpolate",["linear"],["zoom"]].concat(t.stops.reduce((function(t,e){return t.concat(e)}),[])):["interpolate",["exponential",t.base],["zoom"]].concat(t.stops.reduce((function(t,e){return t.concat(e)}),[]))}},{key:"parseInterpolate",value:function(t,e){if(!t||"interpolate"!==t[0]||t.length<4)return null;var n="exponential"===t[1][0]?t[1][1]:1,r=t.slice(3).reduce((function(t,e,n){return n%2==0?t.push([e]):t[t.length-1].push(e),t}),[]);if(1===r.length||r[0][0]>=e)return{value:r[0][1]};if(r[r.length-1][0]<=e)return{value:r[r.length-1][1]};var o=this.findStopLessThanOrEqualTo(r,e);return{lower:r[o][1],upper:r[o+1][1],t:this.interpolationFactor(e,n,r[o][0],r[o+1][0])}}},{key:"renderMatch",value:function(t,e){var n=this;return Array.isArray(t)?this.decision(t.map((function(t){return n.renderMatch(t,e)})),e):t}},{key:"lookup",value:function(t,e){if(!Array.isArray(t))return t;switch(t[0]){case"at":return this.lookup(t[2],e)[t[1]];case"get":case"has":case"!has":return e["".concat(t[0],":").concat(t[1])];case"in":return this.lookup(t[2],e).indexOf(t[1])>=0;case"!in":return this.lookup(t[2],e).indexOf(t[1])<0;case"index-of":return this.lookup(t[2],e).indexOf(t[1]);case"length":return this.lookup(t[1],e).length;case"slice":return this.lookup(t[1],e).slice(t[2],t[3])}return t}},{key:"decision",value:function(t,e){var n=this;if(!Array.isArray(t))return t;switch(t[0]){case"!":return!this.lookup(t[1],e);case"==":return this.lookup(t[1],e)==t[2];case"!=":return this.lookup(t[1],e)!=t[2];case">":return this.lookup(t[1],e)>t[2];case"<":return this.lookup(t[1],e)=":return this.lookup(t[1],e)>=t[2];case"<=":return this.lookup(t[1],e)<=t[2];case"all":return t.slice(1).every((function(t){return!0===n.lookup(t,e)}));case"some":return t.slice(1).any((function(t){return!0===n.lookup(t,e)}));case"match":for(var r=2;r=i)return t[s+1];return a;case"coalesce":return t.slice(1).find((function(t){return null!=t}))}return this.lookup(t,e)}}]),t}(),le={exports:{}};ie=le,function(){function t(t,e,n){return t.call.apply(t.bind,arguments)}function e(t,e,n){if(!t)throw Error();if(2=e.f?i():t.fonts.load(function(t){return w(t)+" "+t.f+"00 300px "+x(t.c)}(e.a),e.h).then((function(t){1<=t.length?o():setTimeout(a,25)}),(function(){i()}))}()})),i=null,a=new Promise((function(t,n){i=setTimeout(n,e.f)}));Promise.race([a,o]).then((function(){i&&(clearTimeout(i),i=null),e.g(e.a)}),(function(){e.j(e.a)}))};var M={D:"serif",C:"sans-serif"},B=null;function z(){if(null===B){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);B=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))}return B}function F(t,e,n){for(var r in M)if(M.hasOwnProperty(r)&&e===t.f[M[r]]&&n===t.f[M[r]])return!0;return!1}function P(t){var e,o=t.g.a.offsetWidth,i=t.h.a.offsetWidth;(e=o===t.f.serif&&i===t.f["sans-serif"])||(e=z()&&F(t,o,i)),e?r()-t.A>=t.w?z()&&F(t,o,i)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?U(t,t.v):U(t,t.B):function(t){setTimeout(n((function(){P(this)}),t),50)}(t):U(t,t.v)}function U(t,e){setTimeout(n((function(){l(this.g.a),l(this.h.a),l(this.j.a),l(this.m.a),e(this.a)}),t),0)}function R(t,e,n){this.c=t,this.a=e,this.f=0,this.m=this.j=!1,this.s=n}C.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=r(),P(this)};var _=null;function L(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&u(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),E(t,"active")):k(t.a))}function H(t){this.j=t,this.a=new S,this.h=0,this.f=this.g=!0}function $(t,e,r,o,i){var a=0==--t.h;(t.f||t.g)&&setTimeout((function(){var t=i||null,s=o||{};if(0===r.length&&a)k(e.a);else{e.f+=r.length,a&&(e.j=a);var l,c=[];for(l=0;l0&&ce.load({google:{families:t}})}}]),t}(),he=function(){function t(){S(this,t),this.zooms=this.generateArray(1,20),this.expressions=new se,this.fonts=new pe}return j(t,[{key:"generateArray",value:function(t,e){for(var n=[],r=t;r2&&void 0!==arguments[2]?arguments[2]:"line",o=e["".concat(r,"-color")]||"#000",i=e["".concat(r,"-width")]||1,a=e["".concat(r,"-opacity")],s=e.zooms||this.zooms,l={maxWidth:0};return l.id=t.id,s.forEach((function(e){var s=n.parseNumber(t,i,e);s>l.maxWidth&&(l.maxWidth=s),l[e]=O(O(O({},"".concat(r,"-width"),isNaN(s)?0:s),"".concat(r,"-color"),n.parseColor(t,o,e)),"".concat(r,"-opacity"),n.parseNumber(t,a,e))})),l}},{key:"searchMatches",value:function(t,e,n){var r=this;if("match"===t[0]){for(var o=Array.isArray(t[1])?t[1].join(":"):t[1],i=function(){var n=Array.isArray(t[a+1])?t[a+1][0]:t[a+1];e.find((function(t){return t.name===n}))||e.push(O({name:n},o,n))},a=1;a0&&(t.metadata["taxonomy:matches"]=n),n}}},{key:"generateLayersWithMatches",value:function(){var t=this;return function(e,n){return t.autoGenerateMatches(n),!n.metadata["taxonomy:matches"]||n.metadata["taxonomy:matches"].length<1?(e.push(n),e):e.concat(t.renderMatches(n,n.metadata["taxonomy:matches"]))}}}]),t}(),de=new he,fe={css:'popover,[is="popover"]{ display: flex; flex-direction: column; align-items: center; } popover .popover-wrapper,[is="popover"] .popover-wrapper{ position: relative; } popover .popover-dialog,[is="popover"] .popover-dialog{ position: absolute; min-width: 10rem; bottom: 0; transform: translateX(-50%); } popover .popover-dialog::after,[is="popover"] .popover-dialog::after{ position: absolute; display: block; content: \'\'; border-color: transparent; border-style: solid; border-width: 0.5rem 0.5rem 0; left: calc(50% - 0.25rem); bottom: 0; border-top-color: #fff; } popover .popover-body,[is="popover"] .popover-body{ font-size: 0.75rem; margin-bottom: 0.5rem; background-color: #fff; padding: 0.5rem; border-radius: 0.5rem 0.75rem; box-shadow: 0 2px 4px rgb(0 0 0 / 20%), 0 -1px 0 rgb(0 0 0 / 2%); cursor: default; } popover .popover-close,[is="popover"] .popover-close{ position: absolute; top: 0; right: 0; margin: 0.25em 0.5em; padding: 0.5em; line-height: 0; border-radius: 0.375rem; cursor: pointer; } popover .popover-close:hover,[is="popover"] .popover-close:hover{ background-color: rgba(0, 0, 0, 0.1); } popover .popover-color,[is="popover"] .popover-color{ display: inline-block; border-radius: 50%; border: solid 1px rgba(0, 0, 0, 0.2); line-height: 0; margin: auto; margin-left: 0.5rem; width: 0.8rem; height: 0.8rem; background-color: #fff; } popover code,[is="popover"] code{ cursor: pointer; transition: background-color 0.5s ease-out; }',exports:{updateColors(t,e){let n=this.$$(".popover-color");for(let t in n)n[t].style["background-color"]=n[t].getAttribute("color")},onMounted(t,e){this.updateColors(t,e)},onUpdated(t,e){this.updateColors(t,e)},copyToClipboard(t){navigator.clipboard.writeText(t.target.innerHTML),t.target.style["background-color"]="#8bc34a",setTimeout((()=>{t.target.style["background-color"]=null}),4e3)}},template:(t,e,n,r)=>t('
',[{type:n.IF,evaluate:t=>t.props.opened&&t.props.styleProps,redundantAttribute:"expr28",selector:"[expr28]",template:t('
',[{redundantAttribute:"expr29",selector:"[expr29]",expressions:[{type:e.EVENT,name:"onclick",evaluate:t=>t=>t.stopPropagation()}]},{redundantAttribute:"expr30",selector:"[expr30]",expressions:[{type:e.EVENT,name:"onclick",evaluate:t=>t.props.onClose}]},{type:n.EACH,getKey:null,condition:null,template:t('',[{type:n.IF,evaluate:t=>t.props.styleProps[t.style],redundantAttribute:"expr32",selector:"[expr32]",template:t(' ',[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>[t.style,":"].join("")}]},{redundantAttribute:"expr33",selector:"[expr33]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.props.styleProps[t.style]},{type:e.EVENT,name:"onclick",evaluate:t=>t.copyToClipboard}]},{type:n.IF,evaluate:t=>t.style.indexOf("color")>-1,redundantAttribute:"expr34",selector:"[expr34]",template:t(null,[{expressions:[{type:e.ATTRIBUTE,isBoolean:!1,name:"color",evaluate:t=>t.props.styleProps[t.style]}]}])}])}]),redundantAttribute:"expr31",selector:"[expr31]",itemName:"style",indexName:null,evaluate:t=>Object.keys(t.props.styleProps)}])},{type:n.SLOT,attributes:[],name:"default",redundantAttribute:"expr35",selector:"[expr35]"}]),name:"popover"},me={css:'render-item,[is="render-item"]{ cursor: pointer; }',exports:{components:{popover:fe},onMounted(t){t.minHeight&&(this.root.style["min-height"]=`${t.minHeight}px`);const e="canvas"===t.type?this.$("canvas"):this.$("span");this.applyStyles(e,t.styleProps)},onClick(t){this.update({popover:!this.state.popover})},onClose(t){this.update({popover:!1}),t.stopPropagation()},applyStyles(t,e){t&&t.style&&e&&Object.entries(e).forEach((([e,n])=>{t.style[e]=n}))}},template:(t,e,n,r)=>t('',[{expressions:[{type:e.EVENT,name:"onclick",evaluate:t=>t.onClick}]},{type:n.TAG,getComponent:r,evaluate:t=>"popover",slots:[{id:"default",html:'',bindings:[{type:n.IF,evaluate:t=>"canvas"===t.props.type,redundantAttribute:"expr26",selector:"[expr26]",template:t(null,[])},{type:n.SLOT,attributes:[],name:"default",redundantAttribute:"expr27",selector:"[expr27]"}]}],attributes:[{type:e.EVENT,name:"onClose",evaluate:t=>t.onClose},{type:e.ATTRIBUTE,isBoolean:!1,name:"opened",evaluate:t=>t.state.popover},{type:e.ATTRIBUTE,isBoolean:!1,name:"style-props",evaluate:t=>t.props.styleProps}],redundantAttribute:"expr25",selector:"[expr25]"}]),name:"render-item"},ye=function(t){if(void 0!==t)return"".concat(t,"px")},ge=function(t,e,n){t["border-top-width"]=ye(n),t["border-bottom-width"]=ye(n),t["border-top-color"]=e["line-color"],t["border-bottom-color"]=e["line-color"],t["border-top-style"]="solid",t["border-bottom-style"]="solid"},ve={css:null,exports:{state:{casing:{},lines:[],minHeight:0},components:{renderItem:me},onMounted(){this.state.casing={},this.state.lines=this.props.layers.filter((t=>{if(t.metadata&&t.metadata["taxonomy:group"]===this.props.group&&("line"==t.type||t.ref)){if(!t.metadata["taxonomy:casing"]&&!t.ref)return!0;this.state.casing[t.metadata["taxonomy:casing"]||t.ref]=t}return!1})).reduce(de.generateLayersWithMatches(),[]).map((t=>{this.state.casing[t.id]&&(this.state.casing[t.id]=de.renderLine(this.state.casing[t.id],this.props.zooms));const e=de.renderLine(t,this.props.zooms);return e.id=t.name||t.id,e})),this.state.minHeight=this.state.lines.reduce(((t,e)=>Math.max(t,this.getMinHeight(e))),0),this.update()},getMinHeight(t){const e=12+t.maxWidth+(this.state.casing[t.id]?this.state.casing[t.id].maxWidth:0);return Math.max(e,25)},taxonomy:de,lineStyleFormatter:function(t,e){var n={height:ye(t["line-width"]),"background-color":t["line-color"],opacity:t["line-opacity"],width:"55px"};if(e){var r=Math.max((e["line-width"]-t["line-width"])/2,0);ge(n,e,r)}return n}},template:(t,e,n,r)=>t('

id
',[{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.props.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"id",evaluate:t=>t.props.group}]},{type:n.EACH,getKey:null,condition:null,template:t(' ',[{redundantAttribute:"expr11",selector:"[expr11]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.zoom}]},{type:n.EACH,getKey:null,condition:t=>t.state.lines,template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"render-item",slots:[],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"min-height",evaluate:t=>t.state.minHeight},{type:e.ATTRIBUTE,isBoolean:!1,name:"style-props",evaluate:t=>t.lineStyleFormatter(t.line[t.zoom],t.state.casing[t.line.id]&&t.state.casing[t.line.id][t.zoom])}]}]),redundantAttribute:"expr12",selector:"[expr12]",itemName:"line",indexName:null,evaluate:t=>t.state.lines}]),redundantAttribute:"expr10",selector:"[expr10]",itemName:"zoom",indexName:null,evaluate:t=>t.props.zooms},{type:n.EACH,getKey:null,condition:t=>t.state.lines,template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"render-item",slots:[{id:"default",html:' ',bindings:[{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.line.id}]}]}],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"min-height",evaluate:t=>t.state.minHeight}]}]),redundantAttribute:"expr13",selector:"[expr13]",itemName:"line",indexName:null,evaluate:t=>t.state.lines}]),name:"line-render"},xe={css:null,exports:{state:{casing:{},polygons:[]},components:{renderItem:me},onMounted(){this.state.polygons=this.props.layers.filter((t=>{if(t.metadata&&t.metadata["taxonomy:group"]===this.props.group){if("fill"==t.type&&!t.metadata["taxonomy:casing"])return!0;"line"==t.type&&t.metadata["taxonomy:casing"]&&(this.state.casing[t.metadata["taxonomy:casing"]]=t)}return!1})).reduce(de.generateLayersWithMatches(),[]).map((t=>(this.state.casing[t.id]?this.state.casing[t.id]={"line-color":de.parseColor(t,this.state.casing[t.id].paint["line-color"],this.props.zooms[0]),"line-width":de.parseNumber(t,this.state.casing[t.id].paint["line-width"],this.props.zooms[0]),id:this.state.casing[t.id].id}:t.paint["fill-outline-color"]&&(this.state.casing[t.id]={"line-color":de.parseColor(t,t.paint["fill-outline-color"],this.props.zooms[0]),"line-width":1,id:t.id}),{"fill-color":de.parseColor(t,t.paint["fill-color"],this.props.zooms[0]),id:t.name||t.id,"fill-opacity":de.parseNumber(t,t.paint["fill-opacity"],this.props.zooms[0])}))),this.update()},polygonStyleFormatter:function(t,e){var n={height:"100px",width:"100px","background-color":t["fill-color"],opacity:t["fill-opacity"]};return e&&ge(n,e,e["line-width"]),n}},template:(t,e,n,r)=>t('

',[{redundantAttribute:"expr15",selector:"[expr15]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.props.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"id",evaluate:t=>t.props.group}]},{type:n.EACH,getKey:null,condition:t=>t.state.polygons,template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"render-item",slots:[{id:"default",html:' ',bindings:[{redundantAttribute:"expr17",selector:"[expr17]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.polygon.id}]}]}],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"min-height",evaluate:t=>t.state.minHeight},{type:e.ATTRIBUTE,isBoolean:!1,name:"style-props",evaluate:t=>t.polygonStyleFormatter(t.polygon,t.state.casing[t.polygon.id])}]}]),redundantAttribute:"expr16",selector:"[expr16]",itemName:"polygon",indexName:null,evaluate:t=>t.state.polygons}]),name:"polygon-render"},be={css:null,exports:{state:{casing:{},symbols:[]},components:{renderItem:me},onMounted(){this.state.symbols=this.props.layers.filter((t=>t.metadata&&t.metadata["taxonomy:group"]===this.props.group&&"symbol"==t.type)).reduce(de.generateLayersWithMatches(),[]).map((t=>{t.paint["text-halo-color"]&&(this.state.casing[t.id]=de.widthAndColorByZooms(t,{"text-width":t.paint["text-halo-width"],"text-color":t.paint["text-halo-color"],zooms:this.props.zooms},"text"));const e=de.widthAndColorByZooms(t,{"text-width":t.layout["text-size"],"text-color":t.paint["text-color"],zooms:this.props.zooms},"text");e.id=t.name||t.id,e["text-transform"]=t.layout["text-transform"]||"none",e.example=t.metadata["taxonomy:example"];const n=de.fonts.getProps(t.layout["text-font"][0]);return e.fontProps=n,de.fonts.add(n),e})),this.update()},getMinHeight(t){const e=8+t.maxWidth+(this.state.casing[t.id]?this.state.casing[t.id].maxWidth:0);return e>25?e:25},symbolStyleFormatter:function(t,e,n){var r={"font-size":ye(t["text-width"]),color:t["text-color"],"text-transform":t["text-transform"],"font-style":e.style,"font-weight":e.weight,"font-family":e.family};return n&&(r["text-shadow"]="0 0 ".concat(ye(n["text-width"])," ").concat(n["text-color"])),r}},template:(t,e,n,r)=>t('

id
',[{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.props.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"id",evaluate:t=>t.props.group}]},{type:n.EACH,getKey:null,condition:null,template:t(' ',[{redundantAttribute:"expr20",selector:"[expr20]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.zoom}]},{type:n.EACH,getKey:null,condition:t=>t.state.symbols,template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"render-item",slots:[{id:"default",html:' ',bindings:[{redundantAttribute:"expr22",selector:"[expr22]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.symbol.example||t.symbol.id}]}]}],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"min-height",evaluate:t=>t.getMinHeight(t.symbol)},{type:e.ATTRIBUTE,isBoolean:!1,name:"style-props",evaluate:t=>t.symbolStyleFormatter(t.symbol[t.zoom],t.symbol.fontProps,t.state.casing[t.symbol.id]&&t.state.casing[t.symbol.id][t.zoom])}]}]),redundantAttribute:"expr21",selector:"[expr21]",itemName:"symbol",indexName:null,evaluate:t=>t.state.symbols}]),redundantAttribute:"expr19",selector:"[expr19]",itemName:"zoom",indexName:null,evaluate:t=>t.props.zooms},{type:n.EACH,getKey:null,condition:t=>t.state.symbols,template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"render-item",slots:[{id:"default",html:' ',bindings:[{redundantAttribute:"expr24",selector:"[expr24]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.symbol.id}]}]}],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"min-height",evaluate:t=>t.getMinHeight(t.symbol)}]}]),redundantAttribute:"expr23",selector:"[expr23]",itemName:"symbol",indexName:null,evaluate:t=>t.state.symbols}]),name:"symbol-render"},we={css:'taxonomy { margin: auto; font-family: \'Roboto\', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1em; } taxonomy .background-color { top: 0; left: 0; padding-top: 0.5em; } taxonomy code,[is="taxonomy"] code{ padding: 0.25em 0.5em; border-radius: 0.5em; line-height: 2em; background-color: #eee; } taxonomy h1 { margin: 0; } taxonomy h1, taxonomy h2 { line-height: 1.5; text-align: center; background-color: rgba(255, 255, 255, 0.2); } taxonomy a { color: inherit; text-decoration: none; } taxonomy > .container { min-height: 100%; min-width: 500px; padding: 0 30px; margin: auto; } taxonomy .taxonomy-item { padding: 20px 0; border-bottom: 1px solid #eaecef; } taxonomy .render-container { display: flex; flex-wrap: wrap; justify-content: center; } taxonomy .render-column, taxonomy render-item { padding: 0px; display: flex; flex-direction: column; text-align: left; } taxonomy span.render-header { font-weight: bold; text-align: center; background-color: rgba(255, 255, 255, 0.2); border-radius: 1rem; padding: 0 0.5em; margin: 0 0.5em; } taxonomy line-render render-item > canvas,[is="taxonomy"] line-render render-item > canvas,taxonomy polygon-render render-item > *,[is="taxonomy"] polygon-render render-item > *{ margin: auto; } taxonomy polygon-render render-item,[is="taxonomy"] polygon-render render-item{ padding: 10px; } taxonomy line-render render-item,[is="taxonomy"] line-render render-item{ padding: 0px 4px; } taxonomy line-render render-item,[is="taxonomy"] line-render render-item,taxonomy symbol-render render-item,[is="taxonomy"] symbol-render render-item{ display: flex; align-items: center; flex-direction: row; padding: 0px 15px; } @media print { taxonomy .taxonomy-item { page-break-inside: avoid; break-inside: avoid; } taxonomy render-item > * { page-break-inside: avoid; break-inside: avoid; } }',exports:{components:{Annotation:ne,LineRender:ve,PolygonRender:xe,SymbolRender:be},fetchStyleURL(t){var e=new XMLHttpRequest;e.addEventListener("load",(function(){switch(this.status){case 200:return t(null,JSON.parse(this.responseText));case 400:return t("You sent a bad request.");case 401:return t("You are not authorized to use this style.");case 500:return t("This server can not answer yet.")}})),e.open("GET",this.props.styleUrl),e.send()},getBackgroundColor(t){var e=t.layers;for(var n in e)if("background"===e[n].type)return e[n].paint["background-color"]},onMounted(){if(!this.props.styleUrl)return console.error("Style URL is missing");this.fetchStyleURL(((t,e)=>{if(t)return console.error("Error in fetch style");this.style=e;let n=this.getBackgroundColor(e)||"#fff";this.update({backgroundColor:n})}))},onUpdated(t,e){this.$(".container").style["background-color"]=e.backgroundColor,de.fonts.download();const n=location&&/^#[a-zA-Z0-9]/.test(location.hash)&&location.hash,r=n&&this.$(n);r&&window.scrollTo({top:r.offsetTop,behavior:"smooth"})},taxonomy:de},template:(t,e,n,r)=>t('
',[{type:n.IF,evaluate:t=>t.style&&t.style.metadata,redundantAttribute:"expr0",selector:"[expr0]",template:t('
background-color:
\n Powered by JawgMaps. Contribute on GitHub.\n
',[{redundantAttribute:"expr1",selector:"[expr1]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.state.backgroundColor}]},{type:n.IF,evaluate:t=>t.style.metadata["taxonomy:title"],redundantAttribute:"expr2",selector:"[expr2]",template:t('

',[{redundantAttribute:"expr3",selector:"[expr3]",expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>t.style.metadata["taxonomy:title"]}]}])},{type:n.EACH,getKey:null,condition:null,template:t('',[{type:n.IF,evaluate:t=>"line"===t.group.type,redundantAttribute:"expr5",selector:"[expr5]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"line-render",slots:[],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"layers",evaluate:t=>t.style.layers},{type:e.ATTRIBUTE,isBoolean:!1,name:"title",evaluate:t=>t.group.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"group",evaluate:t=>t.group.id},{type:e.ATTRIBUTE,isBoolean:!1,name:"zooms",evaluate:t=>t.taxonomy.getZooms(t.group.zooms)}]}])},{type:n.IF,evaluate:t=>"polygon"===t.group.type,redundantAttribute:"expr6",selector:"[expr6]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"polygon-render",slots:[],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"layers",evaluate:t=>t.style.layers},{type:e.ATTRIBUTE,isBoolean:!1,name:"title",evaluate:t=>t.group.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"group",evaluate:t=>t.group.id},{type:e.ATTRIBUTE,isBoolean:!1,name:"zooms",evaluate:t=>t.taxonomy.getZooms(t.group.zooms)}]}])},{type:n.IF,evaluate:t=>"symbol"===t.group.type,redundantAttribute:"expr7",selector:"[expr7]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"symbol-render",slots:[],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"layers",evaluate:t=>t.style.layers},{type:e.ATTRIBUTE,isBoolean:!1,name:"title",evaluate:t=>t.group.title},{type:e.ATTRIBUTE,isBoolean:!1,name:"group",evaluate:t=>t.group.id},{type:e.ATTRIBUTE,isBoolean:!1,name:"zooms",evaluate:t=>t.taxonomy.getZooms(t.group.zooms)}]}])},{type:n.IF,evaluate:t=>"annotation"===t.group.type,redundantAttribute:"expr8",selector:"[expr8]",template:t(null,[{type:n.TAG,getComponent:r,evaluate:t=>"annotation",slots:[],attributes:[{type:e.ATTRIBUTE,isBoolean:!1,name:"layers",evaluate:t=>t.style.layers},{type:e.ATTRIBUTE,isBoolean:!1,name:"content",evaluate:t=>t.group.content},{type:e.ATTRIBUTE,isBoolean:!1,name:"group",evaluate:t=>t.group.id},{type:e.ATTRIBUTE,isBoolean:!1,name:"zooms",evaluate:t=>t.taxonomy.getZooms(t.group.zooms)}]}])}]),redundantAttribute:"expr4",selector:"[expr4]",itemName:"group",indexName:null,evaluate:t=>t.style.metadata["taxonomy:groups"]}])}]),name:"taxonomy"},Te=(ue=we,function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.slots,o=n.attributes,i=n.parentScope;return function(){for(var t=arguments.length,e=new Array(t),n=0;n + fs + .readFileSync('./demo/index.html') + .toString() + .replace(/..\/dist\//g, './') + .replace('https://jawg.github.io/taxonomy/example.json', './example.json'), + }), +].filter(plugin => plugin) + export default [ { input: 'src/index.js', output: { - file: 'dist/taxonomy-bundle+riot.js', + file: `${output}/taxonomy-bundle+riot.js`, format: 'iife', + sourcemap: useServe, }, - plugins: [ - emptyDirectories('dist'), - riot(), - nodeResolve(), - commonjs(), - babel({ babelHelpers: 'bundled', presets: ['@babel/env'] }), - terser(), - ], + plugins, }, ]; diff --git a/rollup.serve.js b/rollup.serve.js deleted file mode 100644 index fd5b7ed..0000000 --- a/rollup.serve.js +++ /dev/null @@ -1,32 +0,0 @@ -import riot from 'rollup-plugin-riot'; -import nodeResolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import { babel } from '@rollup/plugin-babel'; -import serve from 'rollup-plugin-serve'; -import html from '@rollup/plugin-html'; -import fs from 'fs'; - -export default [ - { - input: 'src/index.js', - output: { - file: '.serve/taxonomy-bundle+riot.js', - format: 'iife', - }, - plugins: [ - riot(), - nodeResolve(), - commonjs(), - babel({ babelHelpers: 'bundled', presets: ['@babel/env'] }), - serve({ host: 'localhost', port: 8000, contentBase: ['.serve', './'] }), - html({ - template: () => - fs - .readFileSync('./demo/index.html') - .toString() - .replace(/..\/dist\//g, './') - .replace('https://jawg.github.io/taxonomy/example.json', './example.json'), - }), - ], - }, -]; diff --git a/src/components/taxonomy.riot b/src/components/taxonomy.riot index 4cdc040..90e1421 100644 --- a/src/components/taxonomy.riot +++ b/src/components/taxonomy.riot @@ -34,9 +34,9 @@ zooms="{ taxonomy.getZooms(group.zooms) }" > -
+
Powered by JawgMaps. Contribute on GitHub. + >. Contribute on GitHub. v{version}