diff --git a/HypeReactiveContent.min.js b/HypeReactiveContent.min.js index b6fb59a..5f48a19 100644 --- a/HypeReactiveContent.min.js +++ b/HypeReactiveContent.min.js @@ -1,9 +1,9 @@ /* - Hype Reactive Content 1.0.6 + Hype Reactive Content 1.0.7 copyright (c) 2022 Max Ziebell, (https://maxziebell.de). MIT-license */ !1==="HypeReactiveContent"in window&&(window.HypeReactiveContent=function(){function k(a,e,f){if(a[l])return a;f=f||{};f=Object.assign({get:function(b,c,d){if(c===l)return!0;b=Reflect.get(b,c,d);return"object"===typeof b?k(b,e):b},set:function(b,c,d,g){var h=Reflect.set(b,c,d,g);e(c,d,b,g);return h}},f.topLevel||f);return new Proxy(a,f)}function n(a){if(!a[l])return a;var e={},f;for(f in a)if(a.hasOwnProperty(f)){var b=a[f];e[f]="object"===typeof b?n(b):b}return e}function p(a){return function(){if(!a.timeout){var e= -arguments;a.timeout=requestAnimationFrame(function(){a.apply(this,e);a.timeout=null}.bind(this))}}}function m(a,e){try{var f=new Proxy(Object.assign({},e),{set:function(b,c,d,g){return Reflect.get(b,c,g)?Reflect.set(b,c,d,g):Reflect.set(e.customData,c,d)},get:function(b,c,d){return(b=Reflect.get(b,c,d))?b:Reflect.get(e.customData,c)},has:function(b,c,d){return"hypeDocument"==c?!1:b.hasOwnProperty(c)||window[c]?Reflect.has(b,c,d):!0}});return(new Function("$context","with($context){ "+a+"}"))(f)}catch(b){console.error(b)}} +arguments;a.timeout=requestAnimationFrame(function(){a.apply(this,e);a.timeout=null}.bind(this))}}}function m(a,e){try{var f=new Proxy(Object.assign({},e),{set:function(b,c,d,g){return Reflect.get(b,c,g)?Reflect.set(b,c,d,g):Reflect.set(e.customData,c,d)},get:function(b,c,d){return(b=Reflect.get(b,c,d))?b:Reflect.get(e.customData,c)},has:function(b,c,d){return b.hasOwnProperty(c)||window[c]?Reflect.has(b,c,d):!0}});return(new Function("$context","with($context){ "+a+"}"))(f)}catch(b){console.error(b)}} function q(a,e,f){!1==="HypeActionEvents"in window&&(e=f.customBehaviorName,/[;=()]/.test(e)&&m(e,a))}var l=Symbol("isProxy");!1==="HYPE_eventListeners"in window&&(window.HYPE_eventListeners=[]);window.HYPE_eventListeners.push({type:"HypeDocumentLoad",callback:function(a,e,f){a.refreshReactiveContent=function(b,c){void 0!==b&&void 0!==c&&a.triggerCustomBehaviorNamed(b+" equals "+("string"===typeof c?'"'+c+'"':c));void 0!==b&&a.triggerCustomBehaviorNamed(b+" was updated");document.getElementById(a.currentSceneId()).querySelectorAll("[data-content], [data-visibility]").forEach(function(d){var g= d.getAttribute("data-content"),h=d.getAttribute("data-visibility");!1==="HypeActionEvents"in window?(g&&(g=m("return "+g,a),d.innerHTML=void 0!==g?g:""),h&&(h=m("return "+h,a),d.style.visibility=h?"visible":"hidden")):(g&&(g=a.triggerAction("return "+g,{element:d,event:{type:"HypeReactiveContent"}}),d.innerHTML=void 0!==g?g:""),h&&(h=a.triggerAction("return "+h,{element:d,event:{type:"HypeReactiveVisibility"}}),d.style.visibility=h?"visible":"hidden"))});!1!=="HypeDataMagic"in window&&HypeDataMagic.getDefault("refreshOnCustomData")&& -a.refresh()};a.customData=k(a.customData,p(a.refreshReactiveContent));a.functions().HypeReactiveContent&&a.functions().HypeReactiveContent(a,e,f)}});window.HYPE_eventListeners.push({type:"HypeScenePrepareForDisplay",callback:function(a,e,f){a.refreshReactiveContent()}});!1==="HypeActionEvents"in window&&window.HYPE_eventListeners.push({type:"HypeTriggerCustomBehavior",callback:q});return{version:"1.0.6",enableReactiveObject:k,disableReactiveObject:n,debounceByRequestFrame:p}}()); +a.refresh()};a.customData=k(a.customData,p(a.refreshReactiveContent));a.functions().HypeReactiveContent&&a.functions().HypeReactiveContent(a,e,f)}});window.HYPE_eventListeners.push({type:"HypeScenePrepareForDisplay",callback:function(a,e,f){a.refreshReactiveContent()}});!1==="HypeActionEvents"in window&&window.HYPE_eventListeners.push({type:"HypeTriggerCustomBehavior",callback:q});return{version:"1.0.7",enableReactiveObject:k,disableReactiveObject:n,debounceByRequestFrame:p}}());