@evs-chris/raui
Advanced tools
Comparing version
@@ -6,3 +6,3 @@ import Ractive from 'ractive'; | ||
var template = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._member(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._member(_1)":function (_0,_1){return(_0._member(_1));}}}; | ||
var template = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
@@ -29,3 +29,2 @@ function safeGet(obj, path) { | ||
h.set('rac.popped', false); | ||
h.set('rac.display', ''); | ||
h.set('rac.display', h.get('rac.tempDisplay')); | ||
@@ -76,3 +75,3 @@ h.set('rac.value', h.get('rac.tempValue')); | ||
} else if (Array.isArray(items)) { | ||
var member = h.get('rac._member'); | ||
var member = h.get('rac._display'); | ||
var re; | ||
@@ -89,4 +88,4 @@ try { | ||
function refresh(value, old, path) { | ||
var v = h.get('rac.member'); | ||
if (h.get('rac.__member') !== v || h.get('rac._member') === undefined) { | ||
var v = h.get('rac.displayprop'); | ||
if (h.get('rac.__display') !== v || h.get('rac._display') === undefined) { | ||
if (typeof v === 'string') { | ||
@@ -98,5 +97,17 @@ var path$1 = Ractive.splitKeypath(v); | ||
h.set('rac._display', v); | ||
h.set('rac.__display', h.get('rac.displayprop')); | ||
h.set('rac.display', v(h.get('rac.value'))); | ||
} | ||
v = h.get('rac.member') | ||
if (h.get('rac.__member') !== v || h.get('rac._member') === undefined) { | ||
if (typeof v === 'string') { | ||
var path$2 = Ractive.splitKeypath(v); | ||
v = function (v) { return safeGet(v, path$2); }; | ||
} else if (Array.isArray(v)) { v = function (v) { return safeGet(v, v); }; } | ||
else if (!v) { v = function (v) { return v; }; } | ||
h.set('rac._member', v); | ||
h.set('rac.__member', h.get('rac.member')); | ||
h.set('rac.display', v(h.get('rac.value'))); | ||
} | ||
@@ -121,20 +132,4 @@ | ||
var opts = { init: false, defer: true }; | ||
var watches = [ | ||
h.observe('rac.display', refresh, opts), | ||
h.observe('rac.member', refresh, opts), | ||
h.observe('rac.items', refresh, opts), | ||
h.observe('rac.list', function (v) { | ||
if (Array.isArray(v)) { h.set('rac.selected', v.indexOf(h.get('rac.value'))); } | ||
else { h.set('rac.selected', -1); } | ||
}, opts), | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
h.set('rac.popped', false); | ||
h.set('rac.tempValue', v); | ||
}) | ||
]; | ||
function display() { | ||
var member = h.get('rac._member'); | ||
var member = h.get('rac._display'); | ||
if (typeof member === 'function') { | ||
@@ -146,2 +141,13 @@ var disp = member(h.get('rac.value')); | ||
} | ||
function value() { | ||
if (h.get('rac._value') && !h.get('rac.value')) { return; } | ||
var member = h.get('rac._member'); | ||
if (typeof member === 'function') { | ||
var v = member(h.get('rac.value')); | ||
h.set('rac._value', v); | ||
} | ||
(h.ractive.getContext(h.find('input'))).raise('selected', {}, h.get('rac._value'), h.get('rac.display')); | ||
} | ||
h.set('rac.updateDisplay', function(ev) { | ||
@@ -153,5 +159,6 @@ setTimeout(function () { if (root && h.get('rac.limit') && !root.contains(document.activeElement)) { display(); } }, 140); | ||
if (attrs.items) { h.link(attrs.items, 'rac.items'); } | ||
if (attrs.display) { h.link(attrs.display, 'rac.display'); } | ||
if (attrs.value) { h.link(attrs.value, 'rac.value'); } | ||
if (attrs.value) { h.link(attrs.value, 'rac._value'); } | ||
if (attrs.selected) { h.link(attrs.selected, 'rac.selected'); } | ||
if (attrs['display-value']) { h.link(attrs['display-value'], 'rac.display'); } | ||
if ('display' in attrs) { h.set('rac.displayprop', attrs.display); } | ||
if ('member' in attrs) { h.set('rac.member', attrs.member); } | ||
@@ -172,7 +179,31 @@ if ('offsets' in attrs) { | ||
update(h.attributes); | ||
var opts = { init: false, defer: true }; | ||
var watches = [ | ||
h.observe('rac.displayprop', refresh, opts), | ||
h.observe('rac.memberprop', refresh, opts), | ||
h.observe('rac.items', refresh, opts), | ||
h.observe('rac.list', function (v) { | ||
if (Array.isArray(v)) { h.set('rac.selected', v.indexOf(h.get('rac.value'))); } | ||
else { h.set('rac.selected', -1); } | ||
}, opts), | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
value(); | ||
h.set('rac.popped', false); | ||
h.set('rac.tempValue', v); | ||
}), | ||
h.observe('rac._value', function (v) { | ||
var member = h.get('rac._member') | ||
var which = h.get('rac.list').find(function (i) { return member(i) === v; }); | ||
if (which !== h.get('rac.value')) { h.set('rac.value', which); } | ||
}) | ||
]; | ||
function teardown() { | ||
h.unlink('rac.items'); | ||
h.unlink('rac._value'); | ||
h.unlink('rac.selected'); | ||
h.unlink('rac.display'); | ||
h.unlink('rac.value'); | ||
h.unlink('rac.selected'); | ||
@@ -182,10 +213,8 @@ watches.forEach(function (w) { return w.cancel(); }); | ||
update(h.attributes); | ||
return { teardown: teardown, update: update, render: function render() { root = h.find('span'); } }; | ||
}, { | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets'], | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets', 'display-value'], | ||
css: function(data) { return [(function(data) { | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete.primary")); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 10em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
}).call(this, data)].join(' '); }, | ||
@@ -192,0 +221,0 @@ cssId: 'rautocomplete', |
@@ -1,1 +0,1 @@ | ||
import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._member(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1)]':function(_0,_1){return[_0.set("rac.value",_1)]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._member(_1)":function(_0,_1){return _0._member(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display","");h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")])}}else if(k===9){h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);h.get("rac.pop").show(h.find("input"))},500);h.set("rac.display",e.target.value)});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._member");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function refresh(value,old,path){var v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){return v==null?"(none)":safeGet(v,path$1)}}else if(Array.isArray(v)){v=function(v){return v==null?"(none)":safeGet(v,v)}}else if(!v){v=function(v){return v==null?"(none)":""+v}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}var opts={init:false,defer:true};var watches=[h.observe("rac.display",refresh,opts),h.observe("rac.member",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();h.set("rac.popped",false);h.set("rac.tempValue",v)})];function display(){var member=h.get("rac._member");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.display){h.link(attrs.display,"rac.display")}if(attrs.value){h.link(attrs.value,"rac.value")}if(attrs.selected){h.link(attrs.selected,"rac.selected")}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit",true)}else{h.set("rac.fit",false)}h.set("rac.limit",attrs["limit-set"]);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}function teardown(){h.unlink("rac.items");h.unlink("rac.display");h.unlink("rac.value");h.unlink("rac.selected");watches.forEach(function(w){return w.cancel()})}update(h.attributes);return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 10em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin; | ||
import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1)]':function(_0,_1){return[_0.set("rac.value",_1)]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._display(_1)":function(_0,_1){return _0._display(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")])}}else if(k===9){h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);h.get("rac.pop").show(h.find("input"))},500);h.set("rac.display",e.target.value)});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._display");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function refresh(value,old,path){var v=h.get("rac.displayprop");if(h.get("rac.__display")!==v||h.get("rac._display")===undefined){if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){return v==null?"(none)":safeGet(v,path$1)}}else if(Array.isArray(v)){v=function(v){return v==null?"(none)":safeGet(v,v)}}else if(!v){v=function(v){return v==null?"(none)":""+v}}h.set("rac._display",v);h.set("rac.__display",h.get("rac.displayprop"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$2=Ractive.splitKeypath(v);v=function(v){return safeGet(v,path$2)}}else if(Array.isArray(v)){v=function(v){return safeGet(v,v)}}else if(!v){v=function(v){return v}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}function display(){var member=h.get("rac._display");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}function value(){if(h.get("rac._value")&&!h.get("rac.value")){return}var member=h.get("rac._member");if(typeof member==="function"){var v=member(h.get("rac.value"));h.set("rac._value",v)}h.ractive.getContext(h.find("input")).raise("selected",{},h.get("rac._value"),h.get("rac.display"))}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.value){h.link(attrs.value,"rac._value")}if(attrs.selected){h.link(attrs.selected,"rac.selected")}if(attrs["display-value"]){h.link(attrs["display-value"],"rac.display")}if("display"in attrs){h.set("rac.displayprop",attrs.display)}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit",true)}else{h.set("rac.fit",false)}h.set("rac.limit",attrs["limit-set"]);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}update(h.attributes);var opts={init:false,defer:true};var watches=[h.observe("rac.displayprop",refresh,opts),h.observe("rac.memberprop",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();value();h.set("rac.popped",false);h.set("rac.tempValue",v)}),h.observe("rac._value",function(v){var member=h.get("rac._member");var which=h.get("rac.list").find(function(i){return member(i)===v});if(which!==h.get("rac.value")){h.set("rac.value",which)}})];function teardown(){h.unlink("rac.items");h.unlink("rac._value");h.unlink("rac.selected");h.unlink("rac.display");watches.forEach(function(w){return w.cancel()})}return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets","display-value"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin; |
@@ -9,2 +9,3 @@ import globalRegister from './globalRegister'; | ||
if (pct > 1) { pct /= 100; } | ||
if (pct >= 1) { pct = 0.99995; } | ||
var t2 = (pct * 360) * (Math.PI / 180); | ||
@@ -54,8 +55,23 @@ var cos2 = Math.cos(t2); | ||
/** | ||
* data: { value, label, color}[] || { values: { value, label }[], label, color }[] | ||
* type: line|bar|pie|donut|tire|hoop | ||
* horizontal: boolean (for bars - default false) | ||
* colors: string[] (list of colors to assign to uncolored data points) | ||
* point: number (width of data points - default 30) | ||
* space: number (distance between bars bar graph - default 5) | ||
* flip: boolean (invert graph - line, bar - default false) | ||
* dot: number (radius of line graph points - default 3) | ||
* smooth: number (apply smoothing rate (0.2 recommended) to line chart beziers - default none) | ||
* project: boolean (allow line chart to project when smoothed - default false) | ||
* span: number (target height of the viewbox for line, bar - default 200) | ||
* sub: cluster|stack (sub type for bar graphs - default cluster) | ||
*/ | ||
Ractive.extendWith(Chart, { | ||
template: {v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:"_0===\"bar\""}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1"}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:"[_0.unlink(\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:"[_0.link(\"data.\"+_1,\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\""}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:"_0===\"bar\""},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:"\"sx\" in _0"}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:"\" \""}}],n:52,r:"graph.points"}," L ",{t:2,r:"graph.maxX"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"fill",f:"blue",t:13,g:1},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}]}],n:50,x:{r:[".type"],s:"_0===\"line\""},l:1}]}],e:{"!_0":function (_0){return(!_0);},"_0===\"bar\"":function (_0){return(_0==="bar");},"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1":function (_0,_1){return((_0==="donut"||_0==="tire"||_0==="hoop")&&_1);},"[_0.unlink(\"hovered\")]":function (_0){return([_0.unlink("hovered")]);},"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]);},"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]":function (_0,_1,_2,_3){return([["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]);},"[_0.link(\"data.\"+_1,\"hovered\")]":function (_0,_1){return([_0.link("data."+_1,"hovered")]);},"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\"":function (_0){return(_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop");},"_0?_1:_2":function (_0,_1,_2){return(_0?_1:_2);},"_0+(2*_1)":function (_0,_1){return(_0+(2*_1));},"\"sx\" in _0":function (_0){return("sx" in _0);},"\" \"":function (){return(" ");},"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]);},"_0===\"line\"":function (_0){return(_0==="line");}}}, | ||
css: " .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }", | ||
template: {v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:"_0===\"bar\""}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1"}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:"[_0.unlink(\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:"[_0.link(\"data.\"+_1,\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\""}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:"_0===\"bar\""},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:"\"sx\" in _0"}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:"\" \""}}],n:52,r:".points"}," L ",{t:2,r:"~/graph.maxX"},",",{t:2,r:"~/graph.bottom"}," Z"],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".sx"}],t:13},{n:"cy",f:[{t:2,r:".sy"}],t:13},{n:"fill",f:"red",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".sx"}],t:13},{n:"y2",f:[{t:2,r:".sy"}],t:13},{n:"stroke",f:"red",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".ex"}],t:13},{n:"cy",f:[{t:2,r:".ey"}],t:13},{n:"fill",f:"blue",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".ex"}],t:13},{n:"y2",f:[{t:2,r:".ey"}],t:13},{n:"stroke",f:"blue",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}],n:52,r:".points"}],n:52,r:"graph.groups"}]}],n:50,x:{r:[".type"],s:"_0===\"line\""},l:1}]}],e:{"!_0":function (_0){return(!_0);},"_0===\"bar\"":function (_0){return(_0==="bar");},"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1":function (_0,_1){return((_0==="donut"||_0==="tire"||_0==="hoop")&&_1);},"[_0.unlink(\"hovered\")]":function (_0){return([_0.unlink("hovered")]);},"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]);},"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]":function (_0,_1,_2,_3){return([["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]);},"[_0.link(\"data.\"+_1,\"hovered\")]":function (_0,_1){return([_0.link("data."+_1,"hovered")]);},"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\"":function (_0){return(_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop");},"_0?_1:_2":function (_0,_1,_2){return(_0?_1:_2);},"_0+(2*_1)":function (_0,_1){return(_0+(2*_1));},"\"sx\" in _0":function (_0){return("sx" in _0);},"\" \"":function (){return(" ");},"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]);},"_0===\"line\"":function (_0){return(_0==="line");}}}, | ||
css: " .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; left: 0; top: 0; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }", | ||
cssId: 'rchart', | ||
noCssTransform: true, | ||
attributes: ['data', 'type', 'horizontal', 'colors', 'point', 'space', 'flip', 'dot', 'smooth', 'project', 'span'], | ||
attributes: ['data', 'type', 'horizontal', 'colors', 'point', 'space', 'flip', 'dot', 'smooth', 'project', 'span', 'sub'], | ||
computed: { | ||
@@ -133,2 +149,5 @@ chonks: function chonks() { | ||
} | ||
var groups = [{ points: points }]; | ||
if (type === 'line') { groups.forEach(function (g, i) { return g.color = colors[i % colors.length]; }); } | ||
@@ -142,3 +161,3 @@ return { | ||
maxX: points[points.length - 1].x, | ||
points: points | ||
groups: groups | ||
}; | ||
@@ -153,3 +172,4 @@ } | ||
dot: 3, | ||
span: 200 | ||
span: 200, | ||
color: '#1f5b93' | ||
} | ||
@@ -156,0 +176,0 @@ }, |
@@ -1,1 +0,1 @@ | ||
import globalRegister from"./globalRegister";import Ractive from"ractive";function chonk(r1,r2,startPct,pct){var t1=(startPct>1?startPct/100:startPct)*360*(Math.PI/180);var cos1=Math.cos(t1);var sin1=Math.sin(t1);if(pct>1){pct/=100}var t2=pct*360*(Math.PI/180);var cos2=Math.cos(t2);var sin2=Math.sin(t2);var pt1=[0*cos1-r1*sin1,0*sin1+r1*cos1];var pt2=[0*cos1-r2*sin1,0*sin1+r2*cos1];var pt3=[pt1[0]*cos2-pt1[1]*sin2,pt1[0]*sin2+pt1[1]*cos2];var pt4=[pt2[0]*cos2-pt2[1]*sin2,pt2[0]*sin2+pt2[1]*cos2];var bits=pct<.5?["0 0 1","0 0 0"]:["0 1 1","0 1 0"];return"M "+pt1[0]+","+pt1[1]+" "+pt2[0]+","+pt2[1]+" A "+Math.abs(r2)+","+Math.abs(r2)+" "+bits[0]+" "+pt4[0]+","+pt4[1]+" L "+pt3[0]+","+pt3[1]+" A "+Math.abs(r1)+","+Math.abs(r1)+" "+bits[1]+" "+pt1[0]+","+pt1[1]+" Z"}function bezierControl(start,cur,prev,next,smooth){var p=prev||cur;var n=next||cur;var len,a;{var lenX=n.x-p.x;var lenY=n.y2-p.y2;len=Math.sqrt(Math.pow(lenX,2)+Math.pow(lenY,2));a=Math.atan2(lenY,lenX)}if(!start){a+=Math.PI}len*=smooth;return[cur.x+Math.cos(a)*len,cur.y2+Math.sin(a)*len]}export var Chart=function(Ractive){function Chart(opts){Ractive.call(this,opts)}if(Ractive)Chart.__proto__=Ractive;Chart.prototype=Object.create(Ractive&&Ractive.prototype);Chart.prototype.constructor=Chart;return Chart}(Ractive);Ractive.extendWith(Chart,{template:{v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:'_0==="bar"'}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1'}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:'[_0.unlink("hovered")]'}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:'[_0.link("data."+_1,"hovered")]'}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"'}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:'_0==="bar"'},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:'"sx" in _0'}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:'" "'}}],n:52,r:"graph.points"}," L ",{t:2,r:"graph.maxX"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"fill",f:"blue",t:13,g:1},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}]}],n:50,x:{r:[".type"],s:'_0==="line"'},l:1}]}],e:{"!_0":function(_0){return!_0},'_0==="bar"':function(_0){return _0==="bar"},'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1':function(_0,_1){return(_0==="donut"||_0==="tire"||_0==="hoop")&&_1},'[_0.unlink("hovered")]':function(_0){return[_0.unlink("hovered")]},'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]':function(_0,_1,_2,_3,_4){return[_4.click(_0,_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]},'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]':function(_0,_1,_2,_3){return[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]},'[_0.link("data."+_1,"hovered")]':function(_0,_1){return[_0.link("data."+_1,"hovered")]},'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"':function(_0){return _0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"},"_0?_1:_2":function(_0,_1,_2){return _0?_1:_2},"_0+(2*_1)":function(_0,_1){return _0+2*_1},'"sx" in _0':function(_0){return"sx"in _0},'" "':function(){return" "},'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]':function(_0,_1,_2,_3,_4){return[_4.click(_0,_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]},'_0==="line"':function(_0){return _0==="line"}}},css:" .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }",cssId:"rchart",noCssTransform:true,attributes:["data","type","horizontal","colors","point","space","flip","dot","smooth","project","span"],computed:{chonks:function chonks(){var data=this.get("data");var total=data.reduce(function(a,c){return a+c.value},0);var type=this.get("type");var colors=this.get("colors");var inner=this.get("hole")||(type==="pie"?0:type==="donut"?15:type==="tire"?25:40);var agg=0;return data.map(function(d,i){var percent=d.value/total;var datum=Object.assign({idx:i,percent:percent,d:chonk(inner,50,agg,percent)},d);if(!datum.color){datum.color=colors[i%colors.length]}agg+=percent;return datum})},graph:function graph(){var data=this.get("data");var type=this.get("type");var ref=data.reduce(function(a,c){if(c.value<a[0]){a[0]=c.value}if(c.value>a[1]){a[1]=c.value}return a},[0,0]);var min=ref[0];var max=ref[1];var dot=this.get("dot")||1;var range=max-min;var bottom=min<0?min*-1:-min;var colors=this.get("colors");var point=this.get("point");var space=type==="line"?0:this.get("space");var horiz=this.get("horizontal");var flip=horiz?this.get("flip"):!this.get("flip");var bar=this.get("span");var points=data.map(function(d,i){var p=Object.assign({x:i*point+i*space+space,y:bottom/range*bar,y2:(d.value+bottom)/range*bar,idx:i},d);p.x2=p.x+point;if(type==="line"){p.x+=dot;p.x2+=dot}if(flip){p.y=bar-p.y;p.y2=bar-p.y2}if(!p.color){p.color=colors[i%colors.length]}return p});var smooth=type==="line"&&this.get("smooth");if(smooth){points.forEach(function(p,i){var assign,assign$1;if(i===0){return}assign=bezierControl(true,points[i-1],points[i-2],p,smooth),p.sx=assign[0],p.sy=assign[1];assign$1=bezierControl(false,p,points[i-1],points[i+1],smooth),p.ex=assign$1[0],p.ey=assign$1[1]})}return{bottom:flip?bar-bottom/range*bar:bottom/range*bar,min:min,max:max,horiz:horiz,flip:flip,span:(type==="line"?data.length-1:data.length)*point+(data.length+2)*space+(type==="line"?dot*2:0),minX:points[0].x,maxX:points[points.length-1].x,points:points}}},data:function data(){return{colors:["#1f5b93","#F8D306","#03aa0f","#d21a1a","#2DD3C7","#633294","#FB4700"],point:30,space:5,dot:3,span:200}},on:{select:function select(ctx,val,parentpath,local,srcpath){this.link(srcpath,"selected")}}});export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.components[opts.name||"chart"]=Chart}}globalRegister("RMChart","components",Chart);export default plugin; | ||
import globalRegister from"./globalRegister";import Ractive from"ractive";function chonk(r1,r2,startPct,pct){var t1=(startPct>1?startPct/100:startPct)*360*(Math.PI/180);var cos1=Math.cos(t1);var sin1=Math.sin(t1);if(pct>1){pct/=100}if(pct>=1){pct=.99995}var t2=pct*360*(Math.PI/180);var cos2=Math.cos(t2);var sin2=Math.sin(t2);var pt1=[0*cos1-r1*sin1,0*sin1+r1*cos1];var pt2=[0*cos1-r2*sin1,0*sin1+r2*cos1];var pt3=[pt1[0]*cos2-pt1[1]*sin2,pt1[0]*sin2+pt1[1]*cos2];var pt4=[pt2[0]*cos2-pt2[1]*sin2,pt2[0]*sin2+pt2[1]*cos2];var bits=pct<.5?["0 0 1","0 0 0"]:["0 1 1","0 1 0"];return"M "+pt1[0]+","+pt1[1]+" "+pt2[0]+","+pt2[1]+" A "+Math.abs(r2)+","+Math.abs(r2)+" "+bits[0]+" "+pt4[0]+","+pt4[1]+" L "+pt3[0]+","+pt3[1]+" A "+Math.abs(r1)+","+Math.abs(r1)+" "+bits[1]+" "+pt1[0]+","+pt1[1]+" Z"}function bezierControl(start,cur,prev,next,smooth){var p=prev||cur;var n=next||cur;var len,a;{var lenX=n.x-p.x;var lenY=n.y2-p.y2;len=Math.sqrt(Math.pow(lenX,2)+Math.pow(lenY,2));a=Math.atan2(lenY,lenX)}if(!start){a+=Math.PI}len*=smooth;return[cur.x+Math.cos(a)*len,cur.y2+Math.sin(a)*len]}export var Chart=function(Ractive){function Chart(opts){Ractive.call(this,opts)}if(Ractive)Chart.__proto__=Ractive;Chart.prototype=Object.create(Ractive&&Ractive.prototype);Chart.prototype.constructor=Chart;return Chart}(Ractive);Ractive.extendWith(Chart,{template:{v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:'_0==="bar"'}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1'}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:'[_0.unlink("hovered")]'}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:'[_0.link("data."+_1,"hovered")]'}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"'}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:'_0==="bar"'},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:'"sx" in _0'}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:'" "'}}],n:52,r:".points"}," L ",{t:2,r:"~/graph.maxX"},",",{t:2,r:"~/graph.bottom"}," Z"],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".sx"}],t:13},{n:"cy",f:[{t:2,r:".sy"}],t:13},{n:"fill",f:"red",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".sx"}],t:13},{n:"y2",f:[{t:2,r:".sy"}],t:13},{n:"stroke",f:"red",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".ex"}],t:13},{n:"cy",f:[{t:2,r:".ey"}],t:13},{n:"fill",f:"blue",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".ex"}],t:13},{n:"y2",f:[{t:2,r:".ey"}],t:13},{n:"stroke",f:"blue",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}],n:52,r:".points"}],n:52,r:"graph.groups"}]}],n:50,x:{r:[".type"],s:'_0==="line"'},l:1}]}],e:{"!_0":function(_0){return!_0},'_0==="bar"':function(_0){return _0==="bar"},'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1':function(_0,_1){return(_0==="donut"||_0==="tire"||_0==="hoop")&&_1},'[_0.unlink("hovered")]':function(_0){return[_0.unlink("hovered")]},'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]':function(_0,_1,_2,_3,_4){return[_4.click(_0,_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]},'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]':function(_0,_1,_2,_3){return[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]},'[_0.link("data."+_1,"hovered")]':function(_0,_1){return[_0.link("data."+_1,"hovered")]},'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"':function(_0){return _0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"},"_0?_1:_2":function(_0,_1,_2){return _0?_1:_2},"_0+(2*_1)":function(_0,_1){return _0+2*_1},'"sx" in _0':function(_0){return"sx"in _0},'" "':function(){return" "},'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]':function(_0,_1,_2,_3,_4){return[_4.click(_0,_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]},'_0==="line"':function(_0){return _0==="line"}}},css:" .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; left: 0; top: 0; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }",cssId:"rchart",noCssTransform:true,attributes:["data","type","horizontal","colors","point","space","flip","dot","smooth","project","span","sub"],computed:{chonks:function chonks(){var data=this.get("data");var total=data.reduce(function(a,c){return a+c.value},0);var type=this.get("type");var colors=this.get("colors");var inner=this.get("hole")||(type==="pie"?0:type==="donut"?15:type==="tire"?25:40);var agg=0;return data.map(function(d,i){var percent=d.value/total;var datum=Object.assign({idx:i,percent:percent,d:chonk(inner,50,agg,percent)},d);if(!datum.color){datum.color=colors[i%colors.length]}agg+=percent;return datum})},graph:function graph(){var data=this.get("data");var type=this.get("type");var ref=data.reduce(function(a,c){if(c.value<a[0]){a[0]=c.value}if(c.value>a[1]){a[1]=c.value}return a},[0,0]);var min=ref[0];var max=ref[1];var dot=this.get("dot")||1;var range=max-min;var bottom=min<0?min*-1:-min;var colors=this.get("colors");var point=this.get("point");var space=type==="line"?0:this.get("space");var horiz=this.get("horizontal");var flip=horiz?this.get("flip"):!this.get("flip");var bar=this.get("span");var points=data.map(function(d,i){var p=Object.assign({x:i*point+i*space+space,y:bottom/range*bar,y2:(d.value+bottom)/range*bar,idx:i},d);p.x2=p.x+point;if(type==="line"){p.x+=dot;p.x2+=dot}if(flip){p.y=bar-p.y;p.y2=bar-p.y2}if(!p.color){p.color=colors[i%colors.length]}return p});var smooth=type==="line"&&this.get("smooth");if(smooth){points.forEach(function(p,i){var assign,assign$1;if(i===0){return}assign=bezierControl(true,points[i-1],points[i-2],p,smooth),p.sx=assign[0],p.sy=assign[1];assign$1=bezierControl(false,p,points[i-1],points[i+1],smooth),p.ex=assign$1[0],p.ey=assign$1[1]})}var groups=[{points:points}];if(type==="line"){groups.forEach(function(g,i){return g.color=colors[i%colors.length]})}return{bottom:flip?bar-bottom/range*bar:bottom/range*bar,min:min,max:max,horiz:horiz,flip:flip,span:(type==="line"?data.length-1:data.length)*point+(data.length+2)*space+(type==="line"?dot*2:0),minX:points[0].x,maxX:points[points.length-1].x,groups:groups}}},data:function data(){return{colors:["#1f5b93","#F8D306","#03aa0f","#d21a1a","#2DD3C7","#633294","#FB4700"],point:30,space:5,dot:3,span:200,color:"#1f5b93"}},on:{select:function select(ctx,val,parentpath,local,srcpath){this.link(srcpath,"selected")}}});export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.components[opts.name||"chart"]=Chart}}globalRegister("RMChart","components",Chart);export default plugin; |
{ | ||
"name": "@evs-chris/raui", | ||
"version": "0.5.29", | ||
"version": "0.5.30", | ||
"description": "Components, decorators, and helpers for Ractive apps that are generally Material-ish", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/evs-chris/raui", |
@@ -709,3 +709,3 @@ (function (global, factory) { | ||
var template$1 = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._member(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._member(_1)":function (_0,_1){return(_0._member(_1));}}}; | ||
var template$1 = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
@@ -732,3 +732,2 @@ function safeGet(obj, path) { | ||
h.set('rac.popped', false); | ||
h.set('rac.display', ''); | ||
h.set('rac.display', h.get('rac.tempDisplay')); | ||
@@ -779,3 +778,3 @@ h.set('rac.value', h.get('rac.tempValue')); | ||
} else if (Array.isArray(items)) { | ||
var member = h.get('rac._member'); | ||
var member = h.get('rac._display'); | ||
var re; | ||
@@ -792,4 +791,4 @@ try { | ||
function refresh(value, old, path) { | ||
var v = h.get('rac.member'); | ||
if (h.get('rac.__member') !== v || h.get('rac._member') === undefined) { | ||
var v = h.get('rac.displayprop'); | ||
if (h.get('rac.__display') !== v || h.get('rac._display') === undefined) { | ||
if (typeof v === 'string') { | ||
@@ -801,5 +800,17 @@ var path$1 = Ractive$1.splitKeypath(v); | ||
h.set('rac._display', v); | ||
h.set('rac.__display', h.get('rac.displayprop')); | ||
h.set('rac.display', v(h.get('rac.value'))); | ||
} | ||
v = h.get('rac.member'); | ||
if (h.get('rac.__member') !== v || h.get('rac._member') === undefined) { | ||
if (typeof v === 'string') { | ||
var path$2 = Ractive$1.splitKeypath(v); | ||
v = function (v) { return safeGet(v, path$2); }; | ||
} else if (Array.isArray(v)) { v = function (v) { return safeGet(v, v); }; } | ||
else if (!v) { v = function (v) { return v; }; } | ||
h.set('rac._member', v); | ||
h.set('rac.__member', h.get('rac.member')); | ||
h.set('rac.display', v(h.get('rac.value'))); | ||
} | ||
@@ -824,20 +835,4 @@ | ||
var opts = { init: false, defer: true }; | ||
var watches = [ | ||
h.observe('rac.display', refresh, opts), | ||
h.observe('rac.member', refresh, opts), | ||
h.observe('rac.items', refresh, opts), | ||
h.observe('rac.list', function (v) { | ||
if (Array.isArray(v)) { h.set('rac.selected', v.indexOf(h.get('rac.value'))); } | ||
else { h.set('rac.selected', -1); } | ||
}, opts), | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
h.set('rac.popped', false); | ||
h.set('rac.tempValue', v); | ||
}) | ||
]; | ||
function display() { | ||
var member = h.get('rac._member'); | ||
var member = h.get('rac._display'); | ||
if (typeof member === 'function') { | ||
@@ -849,2 +844,13 @@ var disp = member(h.get('rac.value')); | ||
} | ||
function value() { | ||
if (h.get('rac._value') && !h.get('rac.value')) { return; } | ||
var member = h.get('rac._member'); | ||
if (typeof member === 'function') { | ||
var v = member(h.get('rac.value')); | ||
h.set('rac._value', v); | ||
} | ||
(h.ractive.getContext(h.find('input'))).raise('selected', {}, h.get('rac._value'), h.get('rac.display')); | ||
} | ||
h.set('rac.updateDisplay', function(ev) { | ||
@@ -856,5 +862,6 @@ setTimeout(function () { if (root && h.get('rac.limit') && !root.contains(document.activeElement)) { display(); } }, 140); | ||
if (attrs.items) { h.link(attrs.items, 'rac.items'); } | ||
if (attrs.display) { h.link(attrs.display, 'rac.display'); } | ||
if (attrs.value) { h.link(attrs.value, 'rac.value'); } | ||
if (attrs.value) { h.link(attrs.value, 'rac._value'); } | ||
if (attrs.selected) { h.link(attrs.selected, 'rac.selected'); } | ||
if (attrs['display-value']) { h.link(attrs['display-value'], 'rac.display'); } | ||
if ('display' in attrs) { h.set('rac.displayprop', attrs.display); } | ||
if ('member' in attrs) { h.set('rac.member', attrs.member); } | ||
@@ -875,7 +882,31 @@ if ('offsets' in attrs) { | ||
update(h.attributes); | ||
var opts = { init: false, defer: true }; | ||
var watches = [ | ||
h.observe('rac.displayprop', refresh, opts), | ||
h.observe('rac.memberprop', refresh, opts), | ||
h.observe('rac.items', refresh, opts), | ||
h.observe('rac.list', function (v) { | ||
if (Array.isArray(v)) { h.set('rac.selected', v.indexOf(h.get('rac.value'))); } | ||
else { h.set('rac.selected', -1); } | ||
}, opts), | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
value(); | ||
h.set('rac.popped', false); | ||
h.set('rac.tempValue', v); | ||
}), | ||
h.observe('rac._value', function (v) { | ||
var member = h.get('rac._member'); | ||
var which = h.get('rac.list').find(function (i) { return member(i) === v; }); | ||
if (which !== h.get('rac.value')) { h.set('rac.value', which); } | ||
}) | ||
]; | ||
function teardown() { | ||
h.unlink('rac.items'); | ||
h.unlink('rac._value'); | ||
h.unlink('rac.selected'); | ||
h.unlink('rac.display'); | ||
h.unlink('rac.value'); | ||
h.unlink('rac.selected'); | ||
@@ -885,10 +916,8 @@ watches.forEach(function (w) { return w.cancel(); }); | ||
update(h.attributes); | ||
return { teardown: teardown, update: update, render: function render() { root = h.find('span'); } }; | ||
}, { | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets'], | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets', 'display-value'], | ||
css: function(data) { return [(function(data) { | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete.primary")); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 10em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
}).call(this, data)].join(' '); }, | ||
@@ -895,0 +924,0 @@ cssId: 'rautocomplete', |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RMAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function o(e,t,o){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var i=document.currentScript;if(i||(i=(i=document.querySelectorAll("script"))[i.length-1]),i){var r=i.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(e,t){var n=t.split("="),o=n[0],i=n[1];return e[o]=i,e},{})),Ractive[t][r&&r[e]||e]=o}}}function i(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var o=t.distance||"20px",i=t.scale||"0.9",r="above"===t.dir?"translateY("+o+")":"left"===t.dir?"translateX("+o+")":"right"===t.dir?"translateX(-"+o+")":"translateY(-"+o+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+i+") "+r),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+i+") "+r},n))}function r(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=i}}function a(e,t){var n=!1,o=!1;function i(n){for(var o=n.target;o;){if(o===e)return;if(!o.parentNode&&o!==document)return;o=o.parentNode}t(n)}return setTimeout(function(){n=!0,o||(document.body.addEventListener("click",i),document.body.addEventListener("touchstop",i))}),{teardown:function(){o=!0,n&&(document.body.removeEventListener("click",i),document.body.removeEventListener("touchstop",i))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}o("pop","transitions",i),o("fade","transitions",l);var s,p,f,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailRight"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailRight"}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content"}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?1:0)":function(e,t){return e+(t?1:0)},"_0+(_1?0:1)":function(e,t){return e+(t?0:1)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(e){var t=e||this.source,n=this.get("popped");if(t&&n){var o=this.find("div");if(t&&o&&o.offsetParent){var i=o.offsetParent,r=i.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),c=this.get("where")||"below",s=this.get("align")||"middle",p=this.get("tail"),f="above"===c||"below"===c,d=this.get("fit"),u=this.get("gap"),b="above"===c||"below"===c?0:"left"===c?-a.width-u:l.width+u,m="left"===c||"right"===c?-l.height:"above"===c?-l.height-a.height-u:u;"middle"===s?"below"===c||"above"===c?b-=(a.width-l.width)/2:"left"!==c&&"right"!==c||(m-=(a.height-l.height)/2):"end"===s&&("below"===c||"above"===c?b+=l.width-a.width:"left"!==c&&"right"!==c||(m+=l.height-a.height));var h={popTop:l.bottom-r.top+m,popLeft:l.left-r.left+b,tail:p,vert:"above"===c||"below"===c};if(i.scrollTop&&(h.popTop+=i.scrollTop),i.scrollLeft&&(h.popLeft+=i.scrollLeft),p){"above"===c?h.tailBottom=-10:"below"===c?h.tailTop=-10:"left"===c?h.tailRight=-10:"right"===c&&(h.tailLeft=-10);var g=this.tailSource?this.tailSource.getBoundingClientRect():l;"start"===s?f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10:"end"===s?f?h.tailRight=Math.floor(g.width/2)-10:h.tailBottom=Math.floor(g.height/2)-10:"middle"===s&&(f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10),g!==l?f?(h.tailLeft&&(h.tailLeft+=g.left-l.left),h.tailRight&&(h.tailRight+=l.right-g.right)):(h.tailTop&&(h.tailTop+=g.top-l.top),h.tailBottom&&(h.tailBottom+=l.bottom-g.bottom)):"middle"===s&&(f?(h.tailLeft&&(h.tailLeft+=g.left-(h.popLeft+r.left)),h.tailRight&&(h.tailRight+=h.popLeft+r.left+a.width-g.right)):(h.tailTop&&(h.tailTop+=g.top-(h.popTop+r.top)),h.tailBottom&&(h.tailBottom+=h.popTop+r.top+a.height-g.bottom)))}if(d){var v=i;if(this.get("offsets"))for(var y=this.get("offsets");y--;)v=v.offsetParent;var x=i.scrollWidth,w=i.scrollHeight;if(h.popLeft+a.width>x){var _=h.popLeft-(x-a.width);h.popLeft-=_,f&&h.tailLeft&&(h.tailLeft+=_),f&&h.tailRight&&(h.tailRight-=_),p&&!f&&(h.tail=!1)}if(h.popLeft<0){var k=-1*h.popLeft;h.popLeft+=k,f&&h.tailLeft&&(h.tailLeft-=k),f&&h.tailRight&&(h.tailRight+=k),p&&!f&&(h.tail=!1)}if(h.popTop+a.height>w){var O=h.popTop-(w-a.height);h.popTop-=O,!f&&h.tailTop&&(h.tailTop+=O),!f&&h.tailBottom&&(h.tailBottom-=O),p&&f&&(h.tail=!1)}if(h.popTop<0){var T=-1*h.popTop;h.popTop+=T,!f&&h.tailTop&&(h.tailTop-=T),!f&&h.tailBottom&&(h.tailBottom+=T),p&&f&&(h.tail=!1)}}this.set("position",h)}else this.set("position",null)}},t.prototype.show=function(e){this.source=e,this.set("popped",!0)},t.prototype.hide=function(){this.set("popped",!1)},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===f&&(f={}),function(e){e.instance.events[f.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 11;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 10;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t=this;setTimeout(function(){t.get("popped")===e&&t.set("_popped",e)},100)},_popped:{handler:function(e){var t=this;if(e){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){p||(p=new b({target:document.body,append:!0})).observe("contents",function(e){s=(e||[]).length>0});var o=this.getContext().getParent(!0);o.isContext=1,p.unshift("contents",{content:this.partials.content,context:o,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?p.shift("contents"):this.set("__popped",!1)},defer:!0},__popped:{handler:function(e){if(e){var t=this.find("div"),n=t,o=n.offsetHeight+n.offsetTop,i=n.offsetWidth+n.offsetLeft,r=n.offsetParent;if(!this.overflows)for(var a=this.overflows={e:[],v:[]};t&&t.style;){if(t===r){if(t.offsetWidth>=i&&t.offsetHeight>=o)break;i+=t.offsetLeft,o+=t.offsetTop,r=t.offsetParent}var l=getComputedStyle(t);if("auto"===l.overflow)break;"hidden"===l.overflow&&(a.e.push(t),a.v.push(t.style.overflow),t.style.overflow="visible"),t=t.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"})}else this.source=null,this.tailSource=null},defer:!0},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,o,i,r,a,l,c,s,p,f,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(o=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||o;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&p?(p.cancel(),p=0,f&&(f.disconnect(),f=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var o=[];o.push.apply(o,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(o=o.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var i=m.checked;i&&!~e.className.indexOf("checked")?e.className+=" checked":!i&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(f=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),p=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(i=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(r=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||o||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var p=e.className;return t||(p=p.replace(/\bfield\b/g,"").trim()),n||(p=p.replace(/\bcheck(ed)?\b/g,"").trim()),o||(p=p.replace(/\bradio\b/g,"").trim()),i||(p=p.replace(/\btextarea\b/g,"").trim()),r||(p=p.replace(/\bselect\b/g,"").trim()),a||(p=p.replace(/\bfile\b/g,"").trim()),l||(p=p.replace(/\bbutton\b/g,"").trim()),c||(p=p.replace(/\bplain\b/g,"").trim()),s||(p=p.replace(/\binput\b/g,"").trim()),p=p.replace(/ +/g," ")}var x=b.listen("focusin",h),w=b.listen("focusout",g);return v.call(this),{update:m,invalidate:v.bind(this),teardown:function(){var t=y();t=t.replace(/\bfocus\b/g,"").trim(),x.cancel(),w.cancel(),p&&p.cancel(),f&&f.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t}}}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),c()]}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),o=e("raui.form.boxy");return"\n label.field {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(o?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(o?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea\n {\n display: block;\n border-width: "+(o?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(o?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(o?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(o?"":":disabled")+",\n label.field select"+(o?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(o?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field select:disabled,\n label.field textarea:disabled {\n background: #f4f4f4;\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(o?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -3px;\n top: 23px;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 40px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input {\n top: 3px;\n left: -3px;\n }\n\n label.field.check input:checked {\n background-color: "+(t.fga||"#07e")+';\n }\n\n label.field.check:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 3px 11px 3px 1px;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.8em, 2.65em) rotate(-45deg);\n }\n\n label.field.check.inline:after {\n transform: translate(0.8em, 1.2em) rotate(-45deg);\n }\n\n label.field.check.checked:before {\n border-color: '+(t.fga||"#07e")+";\n background-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:after {\n border-color: "+(t.bg||"#fff")+";\n }\n\n label.field.check input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.check.checked.disabled:before {\n border-color: transparent;\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n /**** RADIO BUTTONS ****/\n \n label.field.radio {\n z-index: 0;\n position: relative;\n display: inline-block;\n overflow: visible;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.radio.inline {\n padding-top: 0.8em;\n }\n\n label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: 0;\n top: 0;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 41px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+';\n outline: none;\n opacity: 0;\n pointer-events: none;\n transform: translate(-0.2em, 24px) scale(1);\n transition: opacity 0.3s, transform 0.3s;\n }\n label.field.inline.radio input {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio {\n cursor: pointer;\n position: relative;\n }\n\n label.field.radio:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 2px 10px 2px 0;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 50%;\n width: 20px;\n height: 20px;\n vertical-align: middle;\n transition: border-color 0.2s;\n }\n\n label.field.radio:after {\n content: "";\n display: block;\n position: absolute;\n border-radius: 50%;\n width: 10px;\n height: 10px;\n background-color: '+(t.fga||"#07e")+";\n transform: translate(5px, -17px) scale(0);\n transition: transform 0.2s;\n }\n\n label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:after {\n transform: translate(5px, -17px) scale(1);\n }\n\n label.field.radio:hover input {\n opacity: 0.04;\n }\n\n label.field.radio input:focus {\n opacity: 0.12;\n transform: translate(-0.2em, 24px) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n }\n label.field.inline.radio input:focus {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio:hover input:focus {\n opacity: 0.16;\n }\n\n label.field.radio input:active {\n opacity: 1;\n transform: translate(-0.2em, 24px) scale(0);\n transition: transform 0s, opacity 0s;\n }\n label.field.inline.radio input:active {\n transform: translate(-0.2em, 3px) scale(0);\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.radio.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.radio.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.radio.disabled:after {\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 19px;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(o?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(o?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(o?"center":"left")+";\n padding: 0.5em "+(o?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(o?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(o?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(o?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(o?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(o?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(o?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var x=t.macro(function(e){var t=[],n=(e.template.m||[]).slice(),o=e.template.f||[],i=n.find(function(e){return"value"===e.n}),r=n.find(function(e){return"type"===e.n}),a=n.find(function(e){return"tip"===e.n});if(a&&n.splice(n.indexOf(a),1),r&&"function"==typeof x.types[r.f])t.push.apply(t,x.types[r.f](n,o,e));else if(i){var l={t:7,e:"input",m:[i]};if(y(o,"option")&&(l.e="select",l.f=o),r&&(l.m.push(r),"checkbox"===r.f||"radio"===r.f)){var c=n.find(function(e){return"target"===e.n});c?l.m.push(Object.assign({},c,{n:"name"})):l.m.splice(l.m.indexOf(i),1,Object.assign({},i,{n:"checked"}))}l.m=l.m.concat(n.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(l);var s=o.filter(function(e){return"button"===e.e||y(e.f,"button")});s.length&&(t.push.apply(t,s),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{var p=o.filter(function(e){return e.e});p.find(function(e){return"button"===e.e})&&p.length>1?t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:o}]:t.push.apply(t,o)}var f=n.find(function(e){return"label"===e.n});a&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(f?"":" field-solo-tip"),g:1},{t:13,n:"title",f:a.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"}),f?t.unshift(f.f):t.unshift(" ");var d={t:7,e:"label",m:[{t:71,n:"field"}].concat(n.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n})),f:t};n.find(function(e){return"inline"===e.n})&&d.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([d])});function w(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}x.types={},o("field","decorators",v),o("field","partials",x),o("autofocus","decorators",w);var _={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._member(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1)]':function(e,t){return[e.set("rac.value",t)]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._member(_1)":function(e,t){return e._member(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var O=t.macro(function(e){var n,o;function i(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var o=n(t);"object"==typeof o&&"function"==typeof o.then?o.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",o)}else if(Array.isArray(n)){var i,r=e.get("rac._member");try{i=new RegExp(t||"","i")}catch(e){i=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return i.test(r(e))}))}else e.set("rac.list",[])}function r(n,r,a){var l=e.get("rac.member");if(e.get("rac.__member")!==l||void 0===e.get("rac._member")){if("string"==typeof l){var s=t.splitKeypath(l);l=function(e){return null==e?"(none)":k(e,s)}}else Array.isArray(l)?l=function(e){return null==e?"(none)":k(e,e)}:l||(l=function(e){return null==e?"(none)":""+e});e.set("rac._member",l),e.set("rac.__member",e.get("rac.member")),e.set("rac.display",l(e.get("rac.value")))}l=e.get("rac.items"),e.get("rac.__items")===l&&void 0!==e.get("rac._items")||(Array.isArray(l)?e.set("rac._items",l):"function"==typeof l?e.set("rac._items",l):"object"==typeof l&&"function"==typeof l.then?l.then(function(t){e.set("rac._items",t),i()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),o&&"rac.display"===a&&e.get("rac.limit")&&!o.contains(document.activeElement)&&c(),i()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",""),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var o=e.get("rac.selected"),i=e.get("rac.list");38===n?o<=0||null==o?e.set("rac.selected",Array.isArray(i)?i.length-1:0):e.set("rac.selected",o-1):Array.isArray(i)?e.set("rac.selected",o<i.length?o+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var r=e.get("rac.list");Array.isArray(r)&&e.set("rac.value",r[e.get("rac.selected")])}else 9===n&&(e.set("rac.popped",!1),e.get("rac.updateDisplay")())}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,i(t.target.value),e.get("rac.pop").show(e.find("input"))},500),e.set("rac.display",t.target.value)}),e.setTemplate(_);var a={init:!1,defer:!0},l=[e.observe("rac.display",r,a),e.observe("rac.member",r,a),e.observe("rac.items",r,a),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},a),e.observe("rac.value",function(t){c(),e.set("rac.popped",!1),e.set("rac.tempValue",t)})];function c(){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function s(t){(t.items&&e.link(t.items,"rac.items"),t.display&&e.link(t.display,"rac.display"),t.value&&e.link(t.value,"rac.value"),t.selected&&e.link(t.selected,"rac.selected"),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!0)):e.set("rac.fit",!1),e.set("rac.limit",t["limit-set"]),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&c());r()}return e.set("rac.updateDisplay",function(t){setTimeout(function(){o&&e.get("rac.limit")&&!o.contains(document.activeElement)&&c()},140)}),s(e.attributes),{teardown:function(){e.unlink("rac.items"),e.unlink("rac.display"),e.unlink("rac.value"),e.unlink("rac.selected"),l.forEach(function(e){return e.cancel()})},update:s,render:function(){o=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 10em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function T(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=O,n.components["rac-pop"]=u,n.decorators.autocompletefocus=w}}e.Autocomplete=O,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,o){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=T,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RMAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function i(e,t,i){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var o=document.currentScript;if(o||(o=(o=document.querySelectorAll("script"))[o.length-1]),o){var r=o.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(e,t){var n=t.split("="),i=n[0],o=n[1];return e[i]=o,e},{})),Ractive[t][r&&r[e]||e]=i}}}function o(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var i=t.distance||"20px",o=t.scale||"0.9",r="above"===t.dir?"translateY("+i+")":"left"===t.dir?"translateX("+i+")":"right"===t.dir?"translateX(-"+i+")":"translateY(-"+i+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+o+") "+r),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+o+") "+r},n))}function r(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=o}}function a(e,t){var n=!1,i=!1;function o(n){for(var i=n.target;i;){if(i===e)return;if(!i.parentNode&&i!==document)return;i=i.parentNode}t(n)}return setTimeout(function(){n=!0,i||(document.body.addEventListener("click",o),document.body.addEventListener("touchstop",o))}),{teardown:function(){i=!0,n&&(document.body.removeEventListener("click",o),document.body.removeEventListener("touchstop",o))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}i("pop","transitions",o),i("fade","transitions",l);var s,p,f,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailRight"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailRight"}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content"}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?1:0)":function(e,t){return e+(t?1:0)},"_0+(_1?0:1)":function(e,t){return e+(t?0:1)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(e){var t=e||this.source,n=this.get("popped");if(t&&n){var i=this.find("div");if(t&&i&&i.offsetParent){var o=i.offsetParent,r=o.getBoundingClientRect(),a=i.getBoundingClientRect(),l=t.getBoundingClientRect(),c=this.get("where")||"below",s=this.get("align")||"middle",p=this.get("tail"),f="above"===c||"below"===c,d=this.get("fit"),u=this.get("gap"),b="above"===c||"below"===c?0:"left"===c?-a.width-u:l.width+u,m="left"===c||"right"===c?-l.height:"above"===c?-l.height-a.height-u:u;"middle"===s?"below"===c||"above"===c?b-=(a.width-l.width)/2:"left"!==c&&"right"!==c||(m-=(a.height-l.height)/2):"end"===s&&("below"===c||"above"===c?b+=l.width-a.width:"left"!==c&&"right"!==c||(m+=l.height-a.height));var h={popTop:l.bottom-r.top+m,popLeft:l.left-r.left+b,tail:p,vert:"above"===c||"below"===c};if(o.scrollTop&&(h.popTop+=o.scrollTop),o.scrollLeft&&(h.popLeft+=o.scrollLeft),p){"above"===c?h.tailBottom=-10:"below"===c?h.tailTop=-10:"left"===c?h.tailRight=-10:"right"===c&&(h.tailLeft=-10);var g=this.tailSource?this.tailSource.getBoundingClientRect():l;"start"===s?f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10:"end"===s?f?h.tailRight=Math.floor(g.width/2)-10:h.tailBottom=Math.floor(g.height/2)-10:"middle"===s&&(f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10),g!==l?f?(h.tailLeft&&(h.tailLeft+=g.left-l.left),h.tailRight&&(h.tailRight+=l.right-g.right)):(h.tailTop&&(h.tailTop+=g.top-l.top),h.tailBottom&&(h.tailBottom+=l.bottom-g.bottom)):"middle"===s&&(f?(h.tailLeft&&(h.tailLeft+=g.left-(h.popLeft+r.left)),h.tailRight&&(h.tailRight+=h.popLeft+r.left+a.width-g.right)):(h.tailTop&&(h.tailTop+=g.top-(h.popTop+r.top)),h.tailBottom&&(h.tailBottom+=h.popTop+r.top+a.height-g.bottom)))}if(d){var v=o;if(this.get("offsets"))for(var y=this.get("offsets");y--;)v=v.offsetParent;var x=o.scrollWidth,w=o.scrollHeight;if(h.popLeft+a.width>x){var _=h.popLeft-(x-a.width);h.popLeft-=_,f&&h.tailLeft&&(h.tailLeft+=_),f&&h.tailRight&&(h.tailRight-=_),p&&!f&&(h.tail=!1)}if(h.popLeft<0){var k=-1*h.popLeft;h.popLeft+=k,f&&h.tailLeft&&(h.tailLeft-=k),f&&h.tailRight&&(h.tailRight+=k),p&&!f&&(h.tail=!1)}if(h.popTop+a.height>w){var O=h.popTop-(w-a.height);h.popTop-=O,!f&&h.tailTop&&(h.tailTop+=O),!f&&h.tailBottom&&(h.tailBottom-=O),p&&f&&(h.tail=!1)}if(h.popTop<0){var T=-1*h.popTop;h.popTop+=T,!f&&h.tailTop&&(h.tailTop-=T),!f&&h.tailBottom&&(h.tailBottom+=T),p&&f&&(h.tail=!1)}}this.set("position",h)}else this.set("position",null)}},t.prototype.show=function(e){this.source=e,this.set("popped",!0)},t.prototype.hide=function(){this.set("popped",!1)},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===f&&(f={}),function(e){e.instance.events[f.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 11;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 10;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t=this;setTimeout(function(){t.get("popped")===e&&t.set("_popped",e)},100)},_popped:{handler:function(e){var t=this;if(e){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){p||(p=new b({target:document.body,append:!0})).observe("contents",function(e){s=(e||[]).length>0});var i=this.getContext().getParent(!0);i.isContext=1,p.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?p.shift("contents"):this.set("__popped",!1)},defer:!0},__popped:{handler:function(e){if(e){var t=this.find("div"),n=t,i=n.offsetHeight+n.offsetTop,o=n.offsetWidth+n.offsetLeft,r=n.offsetParent;if(!this.overflows)for(var a=this.overflows={e:[],v:[]};t&&t.style;){if(t===r){if(t.offsetWidth>=o&&t.offsetHeight>=i)break;o+=t.offsetLeft,i+=t.offsetTop,r=t.offsetParent}var l=getComputedStyle(t);if("auto"===l.overflow)break;"hidden"===l.overflow&&(a.e.push(t),a.v.push(t.style.overflow),t.style.overflow="visible"),t=t.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"})}else this.source=null,this.tailSource=null},defer:!0},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,i,o,r,a,l,c,s,p,f,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(i=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||i;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&p?(p.cancel(),p=0,f&&(f.disconnect(),f=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var i=[];i.push.apply(i,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(i=i.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var o=m.checked;o&&!~e.className.indexOf("checked")?e.className+=" checked":!o&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(f=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),p=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(o=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(r=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||i||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var p=e.className;return t||(p=p.replace(/\bfield\b/g,"").trim()),n||(p=p.replace(/\bcheck(ed)?\b/g,"").trim()),i||(p=p.replace(/\bradio\b/g,"").trim()),o||(p=p.replace(/\btextarea\b/g,"").trim()),r||(p=p.replace(/\bselect\b/g,"").trim()),a||(p=p.replace(/\bfile\b/g,"").trim()),l||(p=p.replace(/\bbutton\b/g,"").trim()),c||(p=p.replace(/\bplain\b/g,"").trim()),s||(p=p.replace(/\binput\b/g,"").trim()),p=p.replace(/ +/g," ")}var x=b.listen("focusin",h),w=b.listen("focusout",g);return v.call(this),{update:m,invalidate:v.bind(this),teardown:function(){var t=y();t=t.replace(/\bfocus\b/g,"").trim(),x.cancel(),w.cancel(),p&&p.cancel(),f&&f.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t}}}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),c()]}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),i=e("raui.form.boxy");return"\n label.field {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea\n {\n display: block;\n border-width: "+(i?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(i?"":":disabled")+",\n label.field select"+(i?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(i?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field select:disabled,\n label.field textarea:disabled {\n background: #f4f4f4;\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(i?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -3px;\n top: 23px;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 40px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input {\n top: 3px;\n left: -3px;\n }\n\n label.field.check input:checked {\n background-color: "+(t.fga||"#07e")+';\n }\n\n label.field.check:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 3px 11px 3px 1px;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.8em, 2.65em) rotate(-45deg);\n }\n\n label.field.check.inline:after {\n transform: translate(0.8em, 1.2em) rotate(-45deg);\n }\n\n label.field.check.checked:before {\n border-color: '+(t.fga||"#07e")+";\n background-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:after {\n border-color: "+(t.bg||"#fff")+";\n }\n\n label.field.check input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.check.checked.disabled:before {\n border-color: transparent;\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n /**** RADIO BUTTONS ****/\n \n label.field.radio {\n z-index: 0;\n position: relative;\n display: inline-block;\n overflow: visible;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.radio.inline {\n padding-top: 0.8em;\n }\n\n label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: 0;\n top: 0;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 41px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+';\n outline: none;\n opacity: 0;\n pointer-events: none;\n transform: translate(-0.2em, 24px) scale(1);\n transition: opacity 0.3s, transform 0.3s;\n }\n label.field.inline.radio input {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio {\n cursor: pointer;\n position: relative;\n }\n\n label.field.radio:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 2px 10px 2px 0;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 50%;\n width: 20px;\n height: 20px;\n vertical-align: middle;\n transition: border-color 0.2s;\n }\n\n label.field.radio:after {\n content: "";\n display: block;\n position: absolute;\n border-radius: 50%;\n width: 10px;\n height: 10px;\n background-color: '+(t.fga||"#07e")+";\n transform: translate(5px, -17px) scale(0);\n transition: transform 0.2s;\n }\n\n label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:after {\n transform: translate(5px, -17px) scale(1);\n }\n\n label.field.radio:hover input {\n opacity: 0.04;\n }\n\n label.field.radio input:focus {\n opacity: 0.12;\n transform: translate(-0.2em, 24px) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n }\n label.field.inline.radio input:focus {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio:hover input:focus {\n opacity: 0.16;\n }\n\n label.field.radio input:active {\n opacity: 1;\n transform: translate(-0.2em, 24px) scale(0);\n transition: transform 0s, opacity 0s;\n }\n label.field.inline.radio input:active {\n transform: translate(-0.2em, 3px) scale(0);\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.radio.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.radio.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.radio.disabled:after {\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 19px;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(i?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(i?"center":"left")+";\n padding: 0.5em "+(i?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(i?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(i?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(i?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(i?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(i?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var x=t.macro(function(e){var t=[],n=(e.template.m||[]).slice(),i=e.template.f||[],o=n.find(function(e){return"value"===e.n}),r=n.find(function(e){return"type"===e.n}),a=n.find(function(e){return"tip"===e.n});if(a&&n.splice(n.indexOf(a),1),r&&"function"==typeof x.types[r.f])t.push.apply(t,x.types[r.f](n,i,e));else if(o){var l={t:7,e:"input",m:[o]};if(y(i,"option")&&(l.e="select",l.f=i),r&&(l.m.push(r),"checkbox"===r.f||"radio"===r.f)){var c=n.find(function(e){return"target"===e.n});c?l.m.push(Object.assign({},c,{n:"name"})):l.m.splice(l.m.indexOf(o),1,Object.assign({},o,{n:"checked"}))}l.m=l.m.concat(n.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(l);var s=i.filter(function(e){return"button"===e.e||y(e.f,"button")});s.length&&(t.push.apply(t,s),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{var p=i.filter(function(e){return e.e});p.find(function(e){return"button"===e.e})&&p.length>1?t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:i}]:t.push.apply(t,i)}var f=n.find(function(e){return"label"===e.n});a&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(f?"":" field-solo-tip"),g:1},{t:13,n:"title",f:a.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"}),f?t.unshift(f.f):t.unshift(" ");var d={t:7,e:"label",m:[{t:71,n:"field"}].concat(n.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n})),f:t};n.find(function(e){return"inline"===e.n})&&d.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([d])});function w(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}x.types={},i("field","decorators",v),i("field","partials",x),i("autofocus","decorators",w);var _={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1)]':function(e,t){return[e.set("rac.value",t)]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._display(_1)":function(e,t){return e._display(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var O=t.macro(function(e){var n,i;function o(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var i=n(t);"object"==typeof i&&"function"==typeof i.then?i.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",i)}else if(Array.isArray(n)){var o,r=e.get("rac._display");try{o=new RegExp(t||"","i")}catch(e){o=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return o.test(r(e))}))}else e.set("rac.list",[])}function r(n,r,l){var c=e.get("rac.displayprop");if(e.get("rac.__display")!==c||void 0===e.get("rac._display")){if("string"==typeof c){var s=t.splitKeypath(c);c=function(e){return null==e?"(none)":k(e,s)}}else Array.isArray(c)?c=function(e){return null==e?"(none)":k(e,e)}:c||(c=function(e){return null==e?"(none)":""+e});e.set("rac._display",c),e.set("rac.__display",e.get("rac.displayprop")),e.set("rac.display",c(e.get("rac.value")))}if(c=e.get("rac.member"),e.get("rac.__member")!==c||void 0===e.get("rac._member")){if("string"==typeof c){var p=t.splitKeypath(c);c=function(e){return k(e,p)}}else Array.isArray(c)?c=function(e){return k(e,e)}:c||(c=function(e){return e});e.set("rac._member",c),e.set("rac.__member",e.get("rac.member"))}c=e.get("rac.items"),e.get("rac.__items")===c&&void 0!==e.get("rac._items")||(Array.isArray(c)?e.set("rac._items",c):"function"==typeof c?e.set("rac._items",c):"object"==typeof c&&"function"==typeof c.then?c.then(function(t){e.set("rac._items",t),o()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),i&&"rac.display"===l&&e.get("rac.limit")&&!i.contains(document.activeElement)&&a(),o()}function a(){var t=e.get("rac._display");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function l(t){(t.items&&e.link(t.items,"rac.items"),t.value&&e.link(t.value,"rac._value"),t.selected&&e.link(t.selected,"rac.selected"),t["display-value"]&&e.link(t["display-value"],"rac.display"),"display"in t&&e.set("rac.displayprop",t.display),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!0)):e.set("rac.fit",!1),e.set("rac.limit",t["limit-set"]),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&a());r()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var i=e.get("rac.selected"),o=e.get("rac.list");38===n?i<=0||null==i?e.set("rac.selected",Array.isArray(o)?o.length-1:0):e.set("rac.selected",i-1):Array.isArray(o)?e.set("rac.selected",i<o.length?i+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var r=e.get("rac.list");Array.isArray(r)&&e.set("rac.value",r[e.get("rac.selected")])}else 9===n&&(e.set("rac.popped",!1),e.get("rac.updateDisplay")())}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,o(t.target.value),e.get("rac.pop").show(e.find("input"))},500),e.set("rac.display",t.target.value)}),e.setTemplate(_),e.set("rac.updateDisplay",function(t){setTimeout(function(){i&&e.get("rac.limit")&&!i.contains(document.activeElement)&&a()},140)}),l(e.attributes);var c={init:!1,defer:!0},s=[e.observe("rac.displayprop",r,c),e.observe("rac.memberprop",r,c),e.observe("rac.items",r,c),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},c),e.observe("rac.value",function(t){a(),function(){if(!e.get("rac._value")||e.get("rac.value")){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac._value",n)}e.ractive.getContext(e.find("input")).raise("selected",{},e.get("rac._value"),e.get("rac.display"))}}(),e.set("rac.popped",!1),e.set("rac.tempValue",t)}),e.observe("rac._value",function(t){var n=e.get("rac._member"),i=e.get("rac.list").find(function(e){return n(e)===t});i!==e.get("rac.value")&&e.set("rac.value",i)})];return{teardown:function(){e.unlink("rac.items"),e.unlink("rac._value"),e.unlink("rac.selected"),e.unlink("rac.display"),s.forEach(function(e){return e.cancel()})},update:l,render:function(){i=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets","display-value"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function T(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=O,n.components["rac-pop"]=u,n.decorators.autocompletefocus=w}}e.Autocomplete=O,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,i){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=T,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -42,2 +42,3 @@ (function (global, factory) { | ||
if (pct > 1) { pct /= 100; } | ||
if (pct >= 1) { pct = 0.99995; } | ||
var t2 = (pct * 360) * (Math.PI / 180); | ||
@@ -87,8 +88,23 @@ var cos2 = Math.cos(t2); | ||
/** | ||
* data: { value, label, color}[] || { values: { value, label }[], label, color }[] | ||
* type: line|bar|pie|donut|tire|hoop | ||
* horizontal: boolean (for bars - default false) | ||
* colors: string[] (list of colors to assign to uncolored data points) | ||
* point: number (width of data points - default 30) | ||
* space: number (distance between bars bar graph - default 5) | ||
* flip: boolean (invert graph - line, bar - default false) | ||
* dot: number (radius of line graph points - default 3) | ||
* smooth: number (apply smoothing rate (0.2 recommended) to line chart beziers - default none) | ||
* project: boolean (allow line chart to project when smoothed - default false) | ||
* span: number (target height of the viewbox for line, bar - default 200) | ||
* sub: cluster|stack (sub type for bar graphs - default cluster) | ||
*/ | ||
Ractive$1.extendWith(Chart, { | ||
template: {v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:"_0===\"bar\""}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1"}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:"[_0.unlink(\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:"[_0.link(\"data.\"+_1,\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\""}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:"_0===\"bar\""},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:"\"sx\" in _0"}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:"\" \""}}],n:52,r:"graph.points"}," L ",{t:2,r:"graph.maxX"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"fill",f:"blue",t:13,g:1},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}]}],n:50,x:{r:[".type"],s:"_0===\"line\""},l:1}]}],e:{"!_0":function (_0){return(!_0);},"_0===\"bar\"":function (_0){return(_0==="bar");},"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1":function (_0,_1){return((_0==="donut"||_0==="tire"||_0==="hoop")&&_1);},"[_0.unlink(\"hovered\")]":function (_0){return([_0.unlink("hovered")]);},"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]);},"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]":function (_0,_1,_2,_3){return([["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]);},"[_0.link(\"data.\"+_1,\"hovered\")]":function (_0,_1){return([_0.link("data."+_1,"hovered")]);},"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\"":function (_0){return(_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop");},"_0?_1:_2":function (_0,_1,_2){return(_0?_1:_2);},"_0+(2*_1)":function (_0,_1){return(_0+(2*_1));},"\"sx\" in _0":function (_0){return("sx" in _0);},"\" \"":function (){return(" ");},"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]);},"_0===\"line\"":function (_0){return(_0==="line");}}}, | ||
css: " .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }", | ||
template: {v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:"_0===\"bar\""}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1"}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:"[_0.unlink(\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:"[_0.link(\"data.\"+_1,\"hovered\")]"}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\""}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:"_0===\"bar\""},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:"\"sx\" in _0"}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:"\" \""}}],n:52,r:".points"}," L ",{t:2,r:"~/graph.maxX"},",",{t:2,r:"~/graph.bottom"}," Z"],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]"}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]"}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".sx"}],t:13},{n:"cy",f:[{t:2,r:".sy"}],t:13},{n:"fill",f:"red",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".sx"}],t:13},{n:"y2",f:[{t:2,r:".sy"}],t:13},{n:"stroke",f:"red",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".ex"}],t:13},{n:"cy",f:[{t:2,r:".ey"}],t:13},{n:"fill",f:"blue",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".ex"}],t:13},{n:"y2",f:[{t:2,r:".ey"}],t:13},{n:"stroke",f:"blue",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}],n:52,r:".points"}],n:52,r:"graph.groups"}]}],n:50,x:{r:[".type"],s:"_0===\"line\""},l:1}]}],e:{"!_0":function (_0){return(!_0);},"_0===\"bar\"":function (_0){return(_0==="bar");},"(_0===\"donut\"||_0===\"tire\"||_0===\"hoop\")&&_1":function (_0,_1){return((_0==="donut"||_0==="tire"||_0==="hoop")&&_1);},"[_0.unlink(\"hovered\")]":function (_0){return([_0.unlink("hovered")]);},"[_4.click((_0),_2.get(\"data.\"+_1),_2.readLink(\"data.\"+_3).keypath,_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]);},"[[\"select\",_1.get(\"data.\"+_0),_1.readLink(\"data.\"+_3).keypath,_2,\"data.\"+_3]]":function (_0,_1,_2,_3){return([["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]);},"[_0.link(\"data.\"+_1,\"hovered\")]":function (_0,_1){return([_0.link("data."+_1,"hovered")]);},"_0===\"pie\"||_0===\"donut\"||_0===\"tire\"||_0===\"hoop\"":function (_0){return(_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop");},"_0?_1:_2":function (_0,_1,_2){return(_0?_1:_2);},"_0+(2*_1)":function (_0,_1){return(_0+(2*_1));},"\"sx\" in _0":function (_0){return("sx" in _0);},"\" \"":function (){return(" ");},"[_4.click((_0),_1.get(\"data.\"+_2),_1.readLink(\"data.\"+_2,_3),_4)]":function (_0,_1,_2,_3,_4){return([_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]);},"_0===\"line\"":function (_0){return(_0==="line");}}}, | ||
css: " .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; left: 0; top: 0; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }", | ||
cssId: 'rchart', | ||
noCssTransform: true, | ||
attributes: ['data', 'type', 'horizontal', 'colors', 'point', 'space', 'flip', 'dot', 'smooth', 'project', 'span'], | ||
attributes: ['data', 'type', 'horizontal', 'colors', 'point', 'space', 'flip', 'dot', 'smooth', 'project', 'span', 'sub'], | ||
computed: { | ||
@@ -166,2 +182,5 @@ chonks: function chonks() { | ||
} | ||
var groups = [{ points: points }]; | ||
if (type === 'line') { groups.forEach(function (g, i) { return g.color = colors[i % colors.length]; }); } | ||
@@ -175,3 +194,3 @@ return { | ||
maxX: points[points.length - 1].x, | ||
points: points | ||
groups: groups | ||
}; | ||
@@ -186,3 +205,4 @@ } | ||
dot: 3, | ||
span: 200 | ||
span: 200, | ||
color: '#1f5b93' | ||
} | ||
@@ -189,0 +209,0 @@ }, |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],r):r(t.RMChart={},t.Ractive)}(this,function(t,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var e="undefined"!=typeof window?window:null;function a(t,r,e,a,n){var i,o,h=e||r,s=a||r,c=s.x-h.x,g=s.y2-h.y2;return i=Math.sqrt(Math.pow(c,2)+Math.pow(g,2)),o=Math.atan2(g,c),t||(o+=Math.PI),i*=n,[r.x+Math.cos(o)*i,r.y2+Math.sin(o)*i]}var n=function(t){function r(r){t.call(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(r);function i(t){return void 0===t&&(t={}),function(r){r.instance.components[t.name||"chart"]=n}}r.extendWith(n,{template:{v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:'_0==="bar"'}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1'}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:'[_0.unlink("hovered")]'}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:'[_0.link("data."+_1,"hovered")]'}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"'}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:'_0==="bar"'},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:'"sx" in _0'}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:'" "'}}],n:52,r:"graph.points"}," L ",{t:2,r:"graph.maxX"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"fill",f:"blue",t:13,g:1},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:"graph.points"}]}],n:50,x:{r:[".type"],s:'_0==="line"'},l:1}]}],e:{"!_0":function(t){return!t},'_0==="bar"':function(t){return"bar"===t},'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1':function(t,r){return("donut"===t||"tire"===t||"hoop"===t)&&r},'[_0.unlink("hovered")]':function(t){return[t.unlink("hovered")]},'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]':function(t,r,e,a,n){return[n.click(t,e.get("data."+r),e.readLink("data."+a).keypath,n)]},'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]':function(t,r,e,a){return[["select",r.get("data."+t),r.readLink("data."+a).keypath,e,"data."+a]]},'[_0.link("data."+_1,"hovered")]':function(t,r){return[t.link("data."+r,"hovered")]},'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"':function(t){return"pie"===t||"donut"===t||"tire"===t||"hoop"===t},"_0?_1:_2":function(t,r,e){return t?r:e},"_0+(2*_1)":function(t,r){return t+2*r},'"sx" in _0':function(t){return"sx"in t},'" "':function(){return" "},'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]':function(t,r,e,a,n){return[n.click(t,r.get("data."+e),r.readLink("data."+e,a),n)]},'_0==="line"':function(t){return"line"===t}}},css:" .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }",cssId:"rchart",noCssTransform:!0,attributes:["data","type","horizontal","colors","point","space","flip","dot","smooth","project","span"],computed:{chonks:function(){var t=this.get("data"),r=t.reduce(function(t,r){return t+r.value},0),e=this.get("type"),a=this.get("colors"),n=this.get("hole")||("pie"===e?0:"donut"===e?15:"tire"===e?25:40),i=0;return t.map(function(t,e){var o=t.value/r,h=Object.assign({idx:e,percent:o,d:function(t,r,e,a){var n=360*(e>1?e/100:e)*(Math.PI/180),i=Math.cos(n),o=Math.sin(n);a>1&&(a/=100);var h=360*a*(Math.PI/180),s=Math.cos(h),c=Math.sin(h),g=[0*i-t*o,0*o+t*i],p=[0*i-r*o,0*o+r*i],l=[g[0]*s-g[1]*c,g[0]*c+g[1]*s],d=[p[0]*s-p[1]*c,p[0]*c+p[1]*s],f=a<.5?["0 0 1","0 0 0"]:["0 1 1","0 1 0"];return"M "+g[0]+","+g[1]+" "+p[0]+","+p[1]+" A "+Math.abs(r)+","+Math.abs(r)+" "+f[0]+" "+d[0]+","+d[1]+" L "+l[0]+","+l[1]+" A "+Math.abs(t)+","+Math.abs(t)+" "+f[1]+" "+g[0]+","+g[1]+" Z"}(n,50,i,o)},t);return h.color||(h.color=a[e%a.length]),i+=o,h})},graph:function(){var t=this.get("data"),r=this.get("type"),e=t.reduce(function(t,r){return r.value<t[0]&&(t[0]=r.value),r.value>t[1]&&(t[1]=r.value),t},[0,0]),n=e[0],i=e[1],o=this.get("dot")||1,h=i-n,s=n<0?-1*n:-n,c=this.get("colors"),g=this.get("point"),p="line"===r?0:this.get("space"),l=this.get("horizontal"),d=l?this.get("flip"):!this.get("flip"),f=this.get("span"),u=t.map(function(t,e){var a=Object.assign({x:e*g+e*p+p,y:s/h*f,y2:(t.value+s)/h*f,idx:e},t);return a.x2=a.x+g,"line"===r&&(a.x+=o,a.x2+=o),d&&(a.y=f-a.y,a.y2=f-a.y2),a.color||(a.color=c[e%c.length]),a}),_="line"===r&&this.get("smooth");return _&&u.forEach(function(t,r){var e,n;0!==r&&(e=a(!0,u[r-1],u[r-2],t,_),t.sx=e[0],t.sy=e[1],n=a(!1,t,u[r-1],u[r+1],_),t.ex=n[0],t.ey=n[1])}),{bottom:d?f-s/h*f:s/h*f,min:n,max:i,horiz:l,flip:d,span:("line"===r?t.length-1:t.length)*g+(t.length+2)*p+("line"===r?2*o:0),minX:u[0].x,maxX:u[u.length-1].x,points:u}}},data:function(){return{colors:["#1f5b93","#F8D306","#03aa0f","#d21a1a","#2DD3C7","#633294","#FB4700"],point:30,space:5,dot:3,span:200}},on:{select:function(t,r,e,a,n){this.link(n,"selected")}}}),function(t,r,a){if(e&&e.Ractive&&"object"==typeof e.Ractive[r]){var n=document.currentScript;if(n||(n=(n=document.querySelectorAll("script"))[n.length-1]),n){var i=n.getAttribute("data-alias");i&&(i=(i=i.split("&")).reduce(function(t,r){var e=r.split("="),a=e[0],n=e[1];return t[a]=n,t},{})),Ractive[r][i&&i[t]||t]=a}}}("RMChart","components",n),t.Chart=n,t.plugin=i,t.default=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],r):r(t.RMChart={},t.Ractive)}(this,function(t,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var e="undefined"!=typeof window?window:null;function n(t,r,e,n,a){var i,o,h=e||r,s=n||r,c=s.x-h.x,g=s.y2-h.y2;return i=Math.sqrt(Math.pow(c,2)+Math.pow(g,2)),o=Math.atan2(g,c),t||(o+=Math.PI),i*=a,[r.x+Math.cos(o)*i,r.y2+Math.sin(o)*i]}var a=function(t){function r(r){t.call(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(r);function i(t){return void 0===t&&(t={}),function(r){r.instance.components[t.name||"chart"]=a}}r.extendWith(a,{template:{v:4,t:[{t:7,e:"div",m:[{n:"class",f:["rg-graph rg-graph-",{t:2,r:".type"}],t:13},{t:4,f:[{n:"class-rg-graph-h",t:13,f:[{t:2,r:"graph.horiz"}]},{n:"class-rg-graph-v",t:13,f:[{t:2,x:{r:["graph.horiz"],s:"!_0"}}]}],n:50,x:{r:[".type"],s:'_0==="bar"'}},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-circular",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-graph-middle",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rg-content",g:1}],f:[{t:16,z:[{n:"selected",x:{r:"~/selected"}},{n:"hovered",x:{r:"~/hovered"}}]}]}]}],n:50,x:{r:[".type","@this.partials.content"],s:'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1'}}," ",{t:7,e:"svg",m:[{n:"width",f:"100%",t:13,g:1},{n:"height",f:"100%",t:13,g:1},{n:"viewBox",f:"-55 -55 110 110",t:13,g:1},{n:["mouseout"],t:70,f:{r:["@this"],s:'[_0.unlink("hovered")]'}}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:[{t:2,r:".d"}],t:13},{n:"class",f:["rg-chonk rg-chonk-",{t:2,r:"@index"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{n:["mouseover"],t:70,f:{r:["@this","idx"],s:'[_0.link("data."+_1,"hovered")]'}}],f:[{t:4,f:[{t:7,e:"title",f:[{t:2,r:".label"}]}],n:50,r:".label"}]}],n:52,r:"chonks"}]}]}],n:50,x:{r:[".type"],s:'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"'}},{t:4,f:[{t:7,e:"svg",m:[{n:"viewBox",f:["0 0 ",{t:2,x:{r:["graph.horiz","~/span","graph.span"],s:"_0?_1:_2"}}," ",{t:2,x:{r:["graph.horiz","graph.span","~/span"],s:"_0?_1:_2"}}],t:13},{t:4,f:[{n:"style-min-height",f:[{t:2,r:"graph.span"},"px"],t:13}],n:50,r:"graph.horiz"},{t:4,f:[{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],n:51,l:1}],f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".x"},",",{t:2,r:".y"}," ",{t:2,r:".x"},",",{t:2,r:".y2"},", ",{t:2,r:".x2"},",",{t:2,r:".y2"}," ",{t:2,r:".x2"},",",{t:2,r:".y"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:50,x:{r:["graph.horiz"],s:"!_0"}},{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.bottom"},",0 ",{t:2,r:"graph.bottom"},",",{t:2,r:"graph.span"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:".y"},",",{t:2,r:".x"}," ",{t:2,r:".y"},",",{t:2,r:".x2"},", ",{t:2,r:".y2"},",",{t:2,r:".x2"}," ",{t:2,r:".y2"},",",{t:2,r:".x"}," Z"],t:13},{n:"style-fill",f:[{t:2,r:".color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".idx","@this","idx","."],s:'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}],n:52,r:".points"}],n:52,r:"graph.groups"}],n:51,l:1}]}," "],n:50,x:{r:[".type"],s:'_0==="bar"'},l:1},{t:4,f:[" ",{t:7,e:"svg",m:[{n:"viewBox",f:["0 -",{t:2,r:"~/dot"}," ",{t:2,r:"graph.span"}," ",{t:2,x:{r:["~/span","~/dot"],s:"_0+(2*_1)"}}],t:13},{n:"style-min-width",f:[{t:2,r:"graph.span"},"px"],t:13}],f:[{t:7,e:"path",m:[{n:"d",f:["M 0,",{t:2,r:"graph.bottom"}," ",{t:2,r:"graph.span"},",",{t:2,r:"graph.bottom"}," Z"],t:13},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"path",m:[{n:"d",f:["M ",{t:2,r:"graph.minX"},",",{t:2,r:"graph.bottom"}," ",{t:4,f:[{t:4,f:[{t:4,f:["S ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:50,r:"~/project"},{t:4,f:["C ",{t:2,r:".sx"},",",{t:2,r:".sy"}," ",{t:2,r:".ex"},",",{t:2,r:".ey"}," ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1}],n:50,x:{r:["."],s:'"sx" in _0'}},{t:4,f:["L ",{t:2,r:".x"},",",{t:2,r:".y2"}],n:51,l:1},{t:2,x:{r:[],s:'" "'}}],n:52,r:".points"}," L ",{t:2,r:"~/graph.maxX"},",",{t:2,r:"~/graph.bottom"}," Z"],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{n:"opacity",f:"0.8",t:13,g:1},{n:"stroke",f:"#000",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:4,f:[{t:7,e:"circle",m:[{n:"r",f:[{t:2,r:"~/dot"}],t:13},{n:"cx",f:[{t:2,r:".x"}],t:13},{n:"cy",f:[{t:2,r:".y2"}],t:13},{n:"fill",f:[{t:2,r:"^^/color"}],t:13},{t:4,f:[{n:["click"],t:70,f:{r:["@context","@this",".idx","@this.parent","."],s:'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]'}}],n:50,r:".click"},{n:["click"],t:70,f:{r:[".idx","@this",".","idx"],s:'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]'}}],f:[{t:7,e:"title",f:[{t:4,f:[{t:2,r:".label"}," (",{t:2,r:".value"},")"],n:50,r:".label"},{t:4,f:[{t:2,r:".value"}],n:51,l:1}]}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".sx"}],t:13},{n:"cy",f:[{t:2,r:".sy"}],t:13},{n:"fill",f:"red",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".sx"}],t:13},{n:"y2",f:[{t:2,r:".sy"}],t:13},{n:"stroke",f:"red",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}," ",{t:7,e:"circle",m:[{n:"r",f:"3",t:13,g:1},{n:"cx",f:[{t:2,r:".ex"}],t:13},{n:"cy",f:[{t:2,r:".ey"}],t:13},{n:"fill",f:"blue",t:13,g:1}],f:[{t:7,e:"title",f:[{t:2,r:".value"}]}]}," ",{t:7,e:"line",m:[{n:"x1",f:[{t:2,r:".x"}],t:13},{n:"y1",f:[{t:2,r:".y2"}],t:13},{n:"x2",f:[{t:2,r:".ex"}],t:13},{n:"y2",f:[{t:2,r:".ey"}],t:13},{n:"stroke",f:"blue",t:13,g:1},{n:"stroke-width",f:"1",t:13,g:1}]}],n:52,r:".points"}],n:52,r:"graph.groups"}]}],n:50,x:{r:[".type"],s:'_0==="line"'},l:1}]}],e:{"!_0":function(t){return!t},'_0==="bar"':function(t){return"bar"===t},'(_0==="donut"||_0==="tire"||_0==="hoop")&&_1':function(t,r){return("donut"===t||"tire"===t||"hoop"===t)&&r},'[_0.unlink("hovered")]':function(t){return[t.unlink("hovered")]},'[_4.click((_0),_2.get("data."+_1),_2.readLink("data."+_3).keypath,_4)]':function(t,r,e,n,a){return[a.click(t,e.get("data."+r),e.readLink("data."+n).keypath,a)]},'[["select",_1.get("data."+_0),_1.readLink("data."+_3).keypath,_2,"data."+_3]]':function(t,r,e,n){return[["select",r.get("data."+t),r.readLink("data."+n).keypath,e,"data."+n]]},'[_0.link("data."+_1,"hovered")]':function(t,r){return[t.link("data."+r,"hovered")]},'_0==="pie"||_0==="donut"||_0==="tire"||_0==="hoop"':function(t){return"pie"===t||"donut"===t||"tire"===t||"hoop"===t},"_0?_1:_2":function(t,r,e){return t?r:e},"_0+(2*_1)":function(t,r){return t+2*r},'"sx" in _0':function(t){return"sx"in t},'" "':function(){return" "},'[_4.click((_0),_1.get("data."+_2),_1.readLink("data."+_2,_3),_4)]':function(t,r,e,n,a){return[a.click(t,r.get("data."+e),r.readLink("data."+e,n),a)]},'_0==="line"':function(t){return"line"===t}}},css:" .rg-graph { position: relative; } .rg-graph-circular { position: relative; width: 100%; height: 0; padding-bottom: 100%; } .rg-graph-circular svg { position: absolute; left: 0; top: 0; } .rg-graph svg { box-sizing: border-box; } .rg-graph-pie .rg-chonk, .rg-graph-donut .rg-chonk, .rg-graph-tire .rg-chonk { transition: transform 0.3s ease, opacity 0.3s ease; } .rg-chonk { opacity: 0.8; user-select: none; } .rg-chonk.clicky { cursor: pointer; } .rg-graph-pie .rg-chonk:hover, .rg-graph-donut .rg-chonk:hover, .rg-graph-tire .rg-chonk:hover { transform: scale(1.1); opacity: 1; } .rg-graph-pie .rg-chonk:active, .rg-graph-donut .rg-chonk:active, .rg-graph-tire .rg-chonk:active { transform: none; } .rg-graph-hoop .rg-chonk:hover { opacity: 1; } .rg-graph-middle { position: absolute; display: flex; align-items: center; justify-content: space-around; text-align: center; } .rg-graph-middle .rg-content { display: inline-block; } .rg-graph-donut .rg-graph-middle { top: 36%; left: 36%; width: 28%; height: 28%; } .rg-graph-tire .rg-graph-middle { left: 28%; top: 28%; height: 43%; width: 43%; } .rg-graph-hoop .rg-graph-middle { left: 14%; top: 14%; width: 72%; height: 72%; } /* bar */ .rg-graph-bar.rg-graph-h { overflow-y: auto; } .rg-graph-bar.rg-graph-h svg { width: 100%; } .rg-graph-bar.rg-graph-v, .rg-graph-line { overflow-x: auto; } .rg-graph-bar.rg-graph-v svg, .rg-graph-line svg { height: 100%; }",cssId:"rchart",noCssTransform:!0,attributes:["data","type","horizontal","colors","point","space","flip","dot","smooth","project","span","sub"],computed:{chonks:function(){var t=this.get("data"),r=t.reduce(function(t,r){return t+r.value},0),e=this.get("type"),n=this.get("colors"),a=this.get("hole")||("pie"===e?0:"donut"===e?15:"tire"===e?25:40),i=0;return t.map(function(t,e){var o=t.value/r,h=Object.assign({idx:e,percent:o,d:function(t,r,e,n){var a=360*(e>1?e/100:e)*(Math.PI/180),i=Math.cos(a),o=Math.sin(a);n>1&&(n/=100),n>=1&&(n=.99995);var h=360*n*(Math.PI/180),s=Math.cos(h),c=Math.sin(h),g=[0*i-t*o,0*o+t*i],l=[0*i-r*o,0*o+r*i],p=[g[0]*s-g[1]*c,g[0]*c+g[1]*s],f=[l[0]*s-l[1]*c,l[0]*c+l[1]*s],d=n<.5?["0 0 1","0 0 0"]:["0 1 1","0 1 0"];return"M "+g[0]+","+g[1]+" "+l[0]+","+l[1]+" A "+Math.abs(r)+","+Math.abs(r)+" "+d[0]+" "+f[0]+","+f[1]+" L "+p[0]+","+p[1]+" A "+Math.abs(t)+","+Math.abs(t)+" "+d[1]+" "+g[0]+","+g[1]+" Z"}(a,50,i,o)},t);return h.color||(h.color=n[e%n.length]),i+=o,h})},graph:function(){var t=this.get("data"),r=this.get("type"),e=t.reduce(function(t,r){return r.value<t[0]&&(t[0]=r.value),r.value>t[1]&&(t[1]=r.value),t},[0,0]),a=e[0],i=e[1],o=this.get("dot")||1,h=i-a,s=a<0?-1*a:-a,c=this.get("colors"),g=this.get("point"),l="line"===r?0:this.get("space"),p=this.get("horizontal"),f=p?this.get("flip"):!this.get("flip"),d=this.get("span"),u=t.map(function(t,e){var n=Object.assign({x:e*g+e*l+l,y:s/h*d,y2:(t.value+s)/h*d,idx:e},t);return n.x2=n.x+g,"line"===r&&(n.x+=o,n.x2+=o),f&&(n.y=d-n.y,n.y2=d-n.y2),n.color||(n.color=c[e%c.length]),n}),_="line"===r&&this.get("smooth");_&&u.forEach(function(t,r){var e,a;0!==r&&(e=n(!0,u[r-1],u[r-2],t,_),t.sx=e[0],t.sy=e[1],a=n(!1,t,u[r-1],u[r+1],_),t.ex=a[0],t.ey=a[1])});var x=[{points:u}];return"line"===r&&x.forEach(function(t,r){return t.color=c[r%c.length]}),{bottom:f?d-s/h*d:s/h*d,min:a,max:i,horiz:p,flip:f,span:("line"===r?t.length-1:t.length)*g+(t.length+2)*l+("line"===r?2*o:0),minX:u[0].x,maxX:u[u.length-1].x,groups:x}}},data:function(){return{colors:["#1f5b93","#F8D306","#03aa0f","#d21a1a","#2DD3C7","#633294","#FB4700"],point:30,space:5,dot:3,span:200,color:"#1f5b93"}},on:{select:function(t,r,e,n,a){this.link(a,"selected")}}}),function(t,r,n){if(e&&e.Ractive&&"object"==typeof e.Ractive[r]){var a=document.currentScript;if(a||(a=(a=document.querySelectorAll("script"))[a.length-1]),a){var i=a.getAttribute("data-alias");i&&(i=(i=i.split("&")).reduce(function(t,r){var e=r.split("="),n=e[0],a=e[1];return t[n]=a,t},{})),Ractive[r][i&&i[t]||t]=n}}}("RMChart","components",a),t.Chart=a,t.plugin=i,t.default=i,Object.defineProperty(t,"__esModule",{value:!0})}); |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2446175
0.46%26694
0.41%