You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
22 KiB
11 lines
22 KiB
3 years ago
|
(()=>{var e,t={432:e=>{!function(t,n){const r="*",s=Object.defineProperties,o=Object.entries,i=(e,t)=>(n,r)=>(e.has(n)?e.get(n).add(r):e.set(n,(new Set).add(r)),t),a=(e,t)=>(n,s)=>(n!==r||s?((e,t,n,r)=>{if(r){const t=e.get(n);t&&(t.delete(r),0===t.size&&e.delete(n))}else e.delete(n)})(e,0,n,s):e.clear(),t),u=(e,t)=>(e,n)=>t.on(e,(function r(...s){t.off(e,r),n.apply(t,s)})),l=(e,t)=>(n,...s)=>{const o=e.get(n);return o&&o.forEach((e=>e.apply(t,s))),e.get(r)&&n!==r&&t.trigger(r,n,...s),t};e.exports=function(e){const t=new Map;return s(e=e||{},o({on:i,off:a,one:u,trigger:l}).reduce(((n,[r,s])=>(n[r]={value:s(t,e),enumerable:!1,writable:!1,configurable:!1},n)),{})),e}}("undefined"!=typeof window&&window)},737:(e,t,n)=>{"use strict";function r(e){return e.replace(/-(\w)/g,((e,t)=>t.toUpperCase()))}function s(e,t){e.firstChild&&(t.appendChild(e.firstChild),s(e,t))}function o(e){i(e.childNodes)}function i(e){Array.from(e).forEach(a)}const a=e=>e&&e.parentNode&&e.parentNode.removeChild(e),u=(e,t)=>t&&t.parentNode&&t.parentNode.insertBefore(e,t),l=new Map,c=Symbol("riot-component"),p=new Set,d="is",h="mount",m="update",f="unmount",b="shouldUpdate",v="onBeforeMount",g="onMounted",O="onBeforeUpdate",x="onUpdated",y="onBeforeUnmount",E="onUnmounted",T="props",N="state",_="slots",A="root",M=Symbol("pure"),j=Symbol("is_updating"),S=Symbol("parent"),w=Symbol("attributes"),C=Symbol("template");var U=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:l,DOM_COMPONENT_INSTANCE_PROPERTY:c,PLUGINS_SET:p,IS_DIRECTIVE:d,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:h,UPDATE_METHOD_KEY:m,UNMOUNT_METHOD_KEY:f,SHOULD_UPDATE_KEY:b,ON_BEFORE_MOUNT_KEY:v,ON_MOUNTED_KEY:g,ON_BEFORE_UPDATE_KEY:O,ON_UPDATED_KEY:x,ON_BEFORE_UNMOUNT_KEY:y,ON_UNMOUNTED_KEY:E,PROPS_KEY:T,STATE_KEY:N,SLOTS_KEY:_,ROOT_KEY:A,IS_PURE_SYMBOL:M,IS_COMPONENT_UPDATING:j,PARENT_KEY_SYMBOL:S,ATTRIBUTES_KEY_SYMBOL:w,TEMPLATE_KEY_SYMBOL:C});var I={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const D=Symbol("head"),L=Symbol("tail");function B(e){const t=e.dom.cloneNode(!0),{head:n,tail:r}=function(){const e=document.createTextNode(""),t=document.createTextNode("");return e[D]=!0,t[L]=!0,{head:e,tail:t}}();return{avoidDOMInjection:!0,fragment:t,head:n,tail:r,children:[n,...Array.from(t.childNodes),r]}}function k(e,t,n,r){return void 0===r&&(r={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function R(e,t,n){return Object.entries(t).forEach((t=>{let[r,s]=t;k(e,r,s,n)})),e}function Y(e,t){return Object.entries(t).forEach((t=>{let[n,r]=t;e[n]||(e[n]=r)})),e}function K(e,t){return typeof e===t}function z(e){const t=e.ownerSVGElement;return!!t||null===t}function $(e){return"template"===e.tagName.toLowerCase()}function H(e){return K(e,"function")}function V(e){return!F(e)&&e.constructor===Object}function F(e){return null==e}const G=Symbol("unmount"),q={nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:r,childrenMap:s}=this,o=e===G?null:this.evaluate(e),i=o?Array.from(o):[],{newChildrenMap:l,batches:c,futureNodes:p}=function(e,t,n,r){const{condition:s,template:o,childrenMap:i,itemName:a,getKey:u,indexName:l,root:c,isTemplateTag:p}=r,d=new Map,h=[],m=[];return e.forEach(((e,r)=>{const f=function(e,t){let{itemName:n,indexName:r,index:s,item:o}=t;k(e,n,o),r&&k(e,r,s);return e}(Object.create(t),{itemName:a,indexName:l,index:r,item:e}),b=u?u(f):r,v=i.get(b),g=[];if(function(e,t){return!!e&&!e(t)}(s,f))return;const O=!v,x=v?v.template:o.clone(),y=x.el||c.cloneNode(),E=p&&O?B(x):x.meta;O?h.push((()=>x.mount(y,f,n,E))):h.push((()=>x.update(f,n))),p?g.push(...E.children):g.push(y),i.delete(b),m.push(...g),d.set(b,{nodes:g,template:x,context:f,index:r})})),{newChildrenMap:d,batches:h,futureNodes:m}}(i,e,t,this);return((e,t,n,r)=>{const s=t.length;let o=e.length,i=s,l=0,c=0,p=null;for(;l<o||c<i;)if(o===l){const e=i<s?c?n(t[c-1],-0).nextSibling:n(t[i-c],0):r;for(;c<i;)u(n(t[c++],1),e)}else if(i===c)for(;l<o;)p&&p.has(e[l])||a(n(e[l],-1)),l++;else if(e[l]===t[c])l++,c++;else if(e[o-1
|
||
|
/* Riot v6.1.2, @license MIT */
|
||
|
var s;return e[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ve(r),e}),{})}(t.exports?t.exports.components:{});return e(Ee,P,I,(e=>e===t.name?Ye(t):n[e]||l.get(e)))}function Ve(e){const{css:t,template:n,exports:r,name:s}=e,o=n?He(n,e):Re;return e=>{let{slots:i,attributes:a,props:u}=e;if(r&&r[M])return function(e,t){let{slots:n,attributes:r,props:s,css:o,template:i}=t;i&&X("Pure components can not have html"),o&&X("Pure components do not have css");const a=Y(e({slots:n,attributes:r,props:s}),Be);return $e((e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(e===h){const[e]=n;k(e,M,!0),ze(e,a)}return a[e](...n),a}))}(r,{slots:i,attributes:a,props:u,css:t,template:n});const l=Ne(r)||{},c=Fe({css:t,template:o,componentAPI:l,name:s})({slots:i,attributes:a,props:u});return{mount:(e,t,n)=>c.mount(e,n,t),update:(e,t)=>c.update(t,e),unmount:e=>c.unmount(e)}}}function Fe(e){let{css:t,template:n,componentAPI:r,name:s}=e;return t&&s&&Ie.add(s,t),Pe(qe)(R(Y(r,Object.assign({},ke,{[T]:{},[N]:{}})),Object.assign({[_]:null,[A]:null},Le,{name:s,css:t,template:n})))}function Ge(e,t){return Object.assign({},e,Ne(t))}function qe(e,t){let{slots:n,attributes:r,props:s}=t;return o=function(e){return[...p].reduce(((e,t)=>t(e)||e),e)}(R(V(e)?Object.create(e):e,{mount(t,o,i){return void 0===o&&(o={}),k(t,M,!1),this[S]=i,this[w]=function(e,t){void 0===t&&(t=[]);const n=t.map((t=>ce(e,t))),r={};return Object.assign(r,Object.assign({expressions:n},$e((e=>t=>(n.forEach((n=>n[e](t))),r)))))}(t,r).mount(i),k(this,T,Object.freeze(Object.assign({},Ke(t,s),J(this[w].expressions)))),this.state=Ge(this.state,o),this[C]=this.template.createDOM(t).clone(),ze(t,this),e.name&&function(e,t){De(e)!==t&&je(e,d,t)}(t,e.name),k(this,A,t),k(this,_,n),this.onBeforeMount(this.props,this.state),this[C].mount(t,this,i),this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&(this[S]=t,this[w].update(t));const n=J(this[w].expressions);if(!1!==this.shouldUpdate(n,this.props))return k(this,T,Object.freeze(Object.assign({},this.props,n))),this.state=Ge(this.state,e),this.onBeforeUpdate(this.props,this.state),this[j]||(this[j]=!0,this[C].update(this,this[S])),this.onUpdated(this.props,this.state),this[j]=!1,this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[w].unmount(),this[C].unmount(this,this[S],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter((t=>H(e[t]))).forEach((e=>{o[e]=o[e].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:We,COMPONENTS_IMPLEMENTATION_MAP:Xe,PLUGINS_SET:Ze}=U;function Je(e,t){let{css:n,template:r,exports:s}=t;return Xe.has(e)&&X(`The component "${e}" was already registered`),Xe.set(e,Ve({name:e,css:n,template:r,exports:s})),Xe}function Qe(e,t,n){return Ae(e).map((e=>function(e,t,n){const r=n||De(e);return l.has(r)||X(`The component named "${r}" was never registered`),l.get(r)({props:t}).mount(e)}(e,t,n)))}Je("tiny-loading",{css:null,exports:null,template:(e,t,n,r)=>e('<div expr10="expr10" class="loading-wrapper"></div>',[{type:n.IF,evaluate:e=>e.props.active,redundantAttribute:"expr10",selector:"[expr10]",template:e('<div class="loading"><span></span><span></span><span></span></div>',[])}]),name:"tiny-loading"});const et={css:null,exports:{handleClose(){this.props.close()},getCssClasses(){const e=["sidebar"];return!0===this.props.open&&e.push("sidebar--open"),e.join(" ")}},template:(e,t,n,r)=>e('<div expr0="expr0"><div class="sidebar__inner"><div class="bar"><div class="bar__main"><slot expr1="expr1" name="title"></slot></div><div class="bar__end"><button expr2="expr2" class="button button--transparent" type="button"><svg class="icon fill-danger fill-text-hover" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-close"/></svg></button></div></div><div class="sidebar__body"><slot expr3="expr3" name="form"></slot><tiny-loading expr4="expr4"></tiny-loading></div><div class="sidebar__footer"><button expr5="expr5" class="button m-bottom-0" type="submit">\n Save\n <svg clas
|
||
|
/**
|
||
|
* example store for trigger open
|
||
|
*
|
||
|
* @author Björn Hase
|
||
|
* @license http://opensource.org/licenses/MIT The MIT License
|
||
|
* @link https://gitea.node001.net/tiny-components/sidebar-form
|
||
|
*
|
||
|
*/const rt=n.n(nt)()({open:function(){this.trigger("open")}}),st={css:null,exports:()=>({...tt,onMounted(){rt.on("open",(()=>{this.state.isOpen=!0,this.update()}))},handleSubmit(e){e.preventDefault(),this.state.isLoading=!0,this.update(),setTimeout((()=>{this.state.isLoading=!1,e.submitter.attributes.close&&this.handleClose(),this.update()}),2500)}}),template:(e,t,n,r)=>e('<div class="m-top-4 m-bottom-4"><tiny-sidebar-form expr7="expr7" form-id="example-form"></tiny-sidebar-form></div>',[{type:n.TAG,getComponent:r,evaluate:e=>"tiny-sidebar-form",slots:[{id:"title",html:'<span slot="title">\n New\n </span>',bindings:[]},{id:"form",html:'<form expr8="expr8" id="example-form" class="form" slot="form"><div class="field-group"><label class="field-label">\n Note\n <textarea class="field-text" name="name"></textarea></label></div></form>',bindings:[{redundantAttribute:"expr8",selector:"[expr8]",expressions:[{type:t.EVENT,name:"onsubmit",evaluate:e=>t=>{e.handleSubmit(t)}}]}]}],attributes:[{type:t.ATTRIBUTE,name:"open",evaluate:e=>e.state.isOpen},{type:t.ATTRIBUTE,name:"close",evaluate:e=>()=>{e.handleClose()}},{type:t.ATTRIBUTE,name:"loading",evaluate:e=>e.state.isLoading}],redundantAttribute:"expr7",selector:"[expr7]"}]),name:"example-sidebar-form"},ot={css:null,exports:{handleClick(){rt.trigger("open")}},template:(e,t,n,r)=>e('<button expr9="expr9" class="button">\n Open\n </button>',[{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:t.EVENT,name:"onclick",evaluate:e=>t=>{e.handleClick(t)}}]}]),name:"example-button"};Je("tiny-sidebar-form",et),Je("example-sidebar-form",st),Qe("example-sidebar-form"),Je("example-button",ot),Qe("example-button")},37:()=>{}},n={};function r(e){var s=n[e];if(void 0!==s)return s.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,s,o)=>{if(!n){var i=1/0;for(c=0;c<e.length;c++){for(var[n,s,o]=e[c],a=!0,u=0;u<n.length;u++)(!1&o||i>=o)&&Object.keys(r.O).every((e=>r.O[e](n[u])))?n.splice(u--,1):(a=!1,o<i&&(i=o));if(a){e.splice(c--,1);var l=s();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,s,o]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={268:0,908:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var s,o,[i,a,u]=n,l=0;if(i.some((t=>0!==e[t]))){for(s in a)r.o(a,s)&&(r.m[s]=a[s]);if(u)var c=u(r)}for(t&&t(n);l<i.length;l++)o=i[l],r.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return r.O(c)},n=self.webpackChunk_tiny_components_sidebar_form=self.webpackChunk_tiny_components_sidebar_form||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.O(void 0,[908],(()=>r(737)));var s=r.O(void 0,[908],(()=>r(37)));s=r.O(s)})();
|