@lengkapp/edge 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.10
2
+ * @lengkapp/edge v0.0.12
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
@@ -30,4 +30,4 @@
30
30
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
31
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
32
  */
33
- !function(){if(!window.__edge){window.__edge=!0;var e=document,n=e.head,t=e.documentElement,r=["get","post","put","patch","delete"].map(function(e){return"_"+e}),i={post:1,put:1,patch:1},o=r.map(function(e){return"["+e+"]"}).join(","),a=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focusin","focusout","keydown","keyup","keypress","change","input","submit","reset","wheel","touchstart","touchend","touchmove"]),u=new WeakSet,c=new WeakSet,s=new WeakMap,f=new WeakMap,d=new Map,l=new Set,h=new Set,v=e.createElement("style");v.textContent=".aj-skel-wrap{box-sizing:border-box;width:100%;height:100%;min-width:80px;min-height:48px;max-width:100%;max-height:600px;display:flex;align-items:center;justify-content:center}.aj-skel-wrap svg{width:1.75em;height:1.75em;color:#c7c7c7;animation:aj-pulse 1.4s ease-in-out infinite}@keyframes aj-pulse{0%,100%{opacity:.35;transform:scale(.92)}50%{opacity:1;transform:scale(1)}}.aj-retry-wrap{box-sizing:border-box;width:100%;height:100%;min-width:80px;min-height:48px;max-height:600px;display:flex;align-items:center;justify-content:center}.aj-retry{width:2.5em;height:2.5em;padding:0;cursor:pointer;background:#007bff;color:#fff;border:0;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;transition:background .15s ease}.aj-retry:hover{background:#0056b3}.aj-retry:hover svg{transform:rotate(-90deg)}.aj-retry svg{width:1.25em;height:1.25em;transition:transform .3s ease}",n.appendChild(v);var w=!1,p=new Set,m=new Set,g=!1;new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){1===e.nodeType&&p.add(e)}),e.removedNodes.forEach(function(e){1===e.nodeType&&m.add(e)})}),g||(g=!0,queueMicrotask(_))}).observe(t,{childList:!0,subtree:!0}),"loading"===e.readyState?e.addEventListener("DOMContentLoaded",C,{once:!0}):C()}function k(e){for(var n=null,t=0;t<r.length;t++)if(e.hasAttribute(r[t])){n=r[t];break}if(!n)return null;var o=n.slice(1);return{url:e.getAttribute(n),method:o.toUpperCase(),hasBody:!!i[o],target:e.getAttribute("_target"),trigger:e.getAttribute("_trigger"),form:e.getAttribute("_form"),json:e.getAttribute("_json"),skeleton:"false"!==e.getAttribute("_skeleton"),retry:"false"!==e.getAttribute("_retry")}}function y(e){return(e.trigger||("this"===e.target?"load":"click")).split(",").map(function(e){return e.trim().toLowerCase()})}function b(e){return e?e.replace(/^\[|\]$/g,"").split(",").map(function(e){return e.trim().replace(/^['"]|['"]$/g,"")}).filter(Boolean):[]}function x(t,r){if(!c.has(t)){c.add(t);var i=function(n,t){if(!t.target||"this"===t.target)return n;var r=s.get(n);if(r&&r.isConnected)return r;var i=e.querySelector(t.target);return i&&s.set(n,i),i}(t,r);if(i){r.skeleton&&function(e){e.innerHTML='<div class="aj-skel-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg></div>'}(i);var o={method:r.method};if(r.hasBody)if(r.json){var a={};r.json.split(",").forEach(function(n){n=n.trim();var t=e.querySelector('[name="'+n+'"]');a[n]=t?t.value:void 0}),o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(a)}else if(r.form){var u=e.getElementById(r.form);o.headers={"Content-Type":"application/x-www-form-urlencoded"},o.body=u?new URLSearchParams(new FormData(u)).toString():""}fetch(r.url,o).then(function(t){if(!t.ok)throw new Error("HTTP "+t.status);var r;return b((r=t.headers).get("x-css-required")).forEach(function(t){if(!l.has(t)){l.add(t);var r=e.createElement("link");r.rel="stylesheet",r.href=t,n.appendChild(r)}}),b(r.get("x-js-required")).forEach(function(t){if(!l.has(t)){l.add(t);var r=e.createElement("script");r.src=t,n.appendChild(r)}}),t.text()}).then(function(n){!function(n,t){var r,i,o;n.innerHTML=t,r=n,i=Array.prototype.slice.call(r.querySelectorAll("script")),o=0,function n(){if(!(o>=i.length)){for(var t=i[o],r=e.createElement("script"),a=0;a<t.attributes.length;a++)r.setAttribute(t.attributes[a].name,t.attributes[a].value);if(t.nonce&&(r.nonce=t.nonce),t.src){if(h.has(t.src))return t.remove(),o++,void n();h.add(t.src),r.onload=r.onerror=function(){o++,n()},t.replaceWith(r)}else r.textContent="{\n"+t.textContent+"\n}",t.replaceWith(r),o++,n()}}(),M(n)}(i,n)}).catch(function(n){console.error(n),r.retry&&function(n,t){n.innerHTML="";var r=e.createElement("div");r.className="aj-retry-wrap";var i=e.createElement("button");i.type="button",i.className="aj-retry",i.setAttribute("aria-label","Retry"),i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>',i.addEventListener("click",t,{once:!0}),r.appendChild(i),n.appendChild(r)}(i,function(){x(t,r)})}).finally(function(){c.delete(t)})}else c.delete(t)}}function j(e){if(!u.has(e)){u.add(e);var n=k(e);n&&y(n).forEach(function(t){if("load"===t||"domcontentloaded"===t||"ready"===t)queueMicrotask(function(){x(e,n)});else if("visible"===t||"intersect"===t){f.set(e,!1);var r=new IntersectionObserver(function(t){t.forEach(function(t){if(!t.target.isConnected)return r.disconnect(),void d.delete(e);var i=t.isIntersecting&&function(e){var n=getComputedStyle(e);if("none"===n.display||"hidden"===n.visibility||"0"===n.opacity)return!1;var t=e.getBoundingClientRect();return t.width>0&&t.height>0}(e);i&&!f.get(e)&&x(e,n),f.set(e,i)})});r.observe(e),d.set(e,r)}else a.has(t)||e.addEventListener(t,function(){x(e,n)})})}}function M(e){1===e.nodeType&&(e.matches&&e.matches(o)&&j(e),e.querySelectorAll&&e.querySelectorAll(o).forEach(j))}function S(e){d.size&&d.forEach(function(n,t){(e===t||e.contains(t))&&(n.disconnect(),d.delete(t),u.delete(t))})}function _(){g=!1;var e=Array.from(p);p.clear();var n=Array.from(m);m.clear(),e.forEach(M),n.forEach(S)}function C(){w||(w=!0,a.forEach(function(n){var t="click"===n||"submit"===n;e.addEventListener(n,function(e){var r=e.target;if(r instanceof Element){var i=r.closest(o);if(i){var a=k(i);a&&-1!==y(a).indexOf(n)&&(t&&e.preventDefault(),x(i,a))}}},!t&&{passive:!0})})),M(t)}}();
33
+ !function(){if(!window.__edgeSecure){window.__edgeSecure=!0;var n=document,e=n.head,t=n.documentElement;window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("aj-policy",{createHTML:function(n){return n}});var r=["get","post","put","patch","delete"].map(function(n){return"_"+n}),o={post:1,put:1,patch:1},i=r.map(function(n){return"["+n+"]"}).join(","),u=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focusin","focusout","keydown","keyup","keypress","change","input","submit","reset","wheel","touchstart","touchend","touchmove"]),a=new WeakSet,c=new WeakSet,s=new WeakMap,f=new WeakMap,l=new Map,v=new Set,d=new Set(["__proto__","constructor","prototype"]),w=!1,p=new Set,h=new Set,m=!1;new MutationObserver(function(n){n.forEach(function(n){n.addedNodes.forEach(function(n){1===n.nodeType&&p.add(n)}),n.removedNodes.forEach(function(n){1===n.nodeType&&h.add(n)})}),m||(m=!0,queueMicrotask(j))}).observe(t,{childList:!0,subtree:!0}),"loading"===n.readyState?n.addEventListener("DOMContentLoaded",_,{once:!0}):_()}function g(n){return(n.trigger||("this"===n.target?"load":"click")).split(",").map(function(n){return n.trim().toLowerCase()})}function k(n){return n?n.replace(/^\[|\]$/g,"").split(",").map(function(n){return n.trim().replace(/^['"]|['"]$/g,"")}).filter(Boolean):[]}function y(t,r){if(!c.has(t)){c.add(t);var i=function(e,t){if(!t.target||"this"===t.target)return e;if(!/^[#.]?[\w-]+$/.test(t.target))return e;var r=s.get(e);if(r&&r.isConnected)return r;var o=n.querySelector(t.target);return o&&s.set(e,o),o}(t,r);if(i){r.skeleton&&function(e){var t=n.createElement("div");t.className="aj-skel-wrap";var r=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg>',"image/svg+xml").documentElement;t.appendChild(n.importNode(r,!0)),e.textContent="",e.appendChild(t)}(i);var u={method:r.method,credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"}};if(o[r.method.toLowerCase()]){var a=function(){var e=n.querySelector('meta[name="csrf-token"]');if(e)return e.getAttribute("content");var t=n.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/);return t?decodeURIComponent(t[1]):null}();a&&(u.headers["X-CSRF-Token"]=a)}if(r.hasBody)if(r.json){var f=function(e){var t=Object.create(null);return e.forEach(function(e){if((e=e.trim())&&!d.has(e)){var r=n.querySelector('[name="'+CSS.escape(e)+'"]');t[e]=r?r.value:void 0}}),t}(r.json.split(","));u.headers["Content-Type"]="application/json",u.body=JSON.stringify(f)}else if(r.form){var l=n.getElementById(r.form);u.headers["Content-Type"]="application/x-www-form-urlencoded",u.body=l?new URLSearchParams(new FormData(l)).toString():""}fetch(r.url,u).then(function(t){if(!t.ok)throw new Error("HTTP "+t.status);var r,o=t.headers.get("content-type")||"";if(!o.includes("text/html")&&!o.includes("text/plain"))throw new Error("Unsupported content type: "+o);return k((r=t.headers).get("x-css-required")).forEach(function(t){if(!v.has(t)){v.add(t);var o=n.createElement("link");o.rel="stylesheet",o.href=t;var i=r.get("x-css-integrity");i&&(o.integrity=i,o.crossOrigin="anonymous"),e.appendChild(o)}}),k(r.get("x-js-required")).forEach(function(t){if(!v.has(t)){v.add(t);var o=n.createElement("script");o.src=t,o.async=!1;var i=r.get("x-js-integrity");i&&(o.integrity=i,o.crossOrigin="anonymous"),e.appendChild(o)}}),t.text()}).then(function(e){!function(e,t){e.textContent="";var r=(new DOMParser).parseFromString(t,"text/html");r.querySelectorAll("script").forEach(function(n){n.remove()});for(var o=n.createDocumentFragment(),i=r.body.childNodes,u=0;u<i.length;u++)o.appendChild(n.importNode(i[u],!0));e.appendChild(o),S(e)}(i,e)}).catch(function(e){console.error(e),r.retry&&function(e,t){e.textContent="";var r=n.createElement("div");r.className="aj-retry-wrap";var o=n.createElement("button");o.type="button",o.className="aj-retry",o.setAttribute("aria-label","Retry");var i=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>',"image/svg+xml");o.appendChild(n.importNode(i.documentElement,!0)),o.addEventListener("click",t,{once:!0}),r.appendChild(o),e.appendChild(r)}(i,function(){y(t,r)})}).finally(function(){c.delete(t)})}else c.delete(t)}}function x(n){for(var e=null,t=0;t<r.length;t++)if(n.hasAttribute(r[t])){e=r[t];break}if(!e)return null;var i=e.slice(1);return{url:n.getAttribute(e),method:i.toUpperCase(),hasBody:!!o[i],target:n.getAttribute("_target"),trigger:n.getAttribute("_trigger"),form:n.getAttribute("_form"),json:n.getAttribute("_json"),skeleton:"false"!==n.getAttribute("_skeleton"),retry:"false"!==n.getAttribute("_retry")}}function M(n){if(!a.has(n)){a.add(n);var e=x(n);e&&g(e).forEach(function(t){if("load"===t||"domcontentloaded"===t||"ready"===t)queueMicrotask(function(){y(n,e)});else if("visible"===t||"intersect"===t){f.set(n,!1);var r=new IntersectionObserver(function(t){t.forEach(function(t){if(!t.target.isConnected)return r.disconnect(),void l.delete(n);var o=t.isIntersecting&&function(n){var e=getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"0"===e.opacity)return!1;var t=n.getBoundingClientRect();return t.width>0&&t.height>0}(n);o&&!f.get(n)&&y(n,e),f.set(n,o)})});r.observe(n),l.set(n,r)}else u.has(t)||n.addEventListener(t,function(){y(n,e)})})}}function S(n){1===n.nodeType&&(n.matches&&n.matches(i)&&M(n),n.querySelectorAll&&n.querySelectorAll(i).forEach(M))}function b(n){l.size&&l.forEach(function(e,t){(n===t||n.contains(t))&&(e.disconnect(),l.delete(t),a.delete(t))})}function j(){m=!1;var n=Array.from(p);p.clear();var e=Array.from(h);h.clear(),n.forEach(S),e.forEach(b)}function _(){w||(w=!0,u.forEach(function(e){var t="click"===e||"submit"===e;n.addEventListener(e,function(n){var r=n.target;if(r instanceof Element){var o=r.closest(i);if(o){var u=x(o);u&&-1!==g(u).indexOf(e)&&(t&&n.preventDefault(),y(o,u))}}},!t&&{passive:!0})})),S(t)}}();
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.10
2
+ * @lengkapp/edge v0.0.12
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @lengkapp/edge v0.0.10
2
+ * @lengkapp/edge v0.0.12
3
3
  * MIT License
4
4
  *
5
5
  * LengkApp Edge License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lengkapp/edge",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Edge framework used by Lengkapp",
5
5
  "main": "dist/edge-server.js",
6
6
  "types": "dist/edge-server.d.ts",