Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

carinthia

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carinthia - npm Package Compare versions

Comparing version 0.2.1 to 0.4.0

2

dist/carinthia.esm.js

@@ -1,2 +0,2 @@

function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var n,r="undefined"==typeof document?void 0:document,o=!!r&&"content"in r.createElement("template"),a=!!r&&r.createRange&&"createContextualFragment"in r.createRange();function i(e,t){var n,r,o=e.nodeName,a=t.nodeName;return o===a||(n=o.charCodeAt(0),r=a.charCodeAt(0),n<=90&&r>=97?o===a.toUpperCase():r<=90&&n>=97&&a===o.toUpperCase())}function d(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var l={OPTION:function(e,t){var n=e.parentNode;if(n){var r=n.nodeName.toUpperCase();"OPTGROUP"===r&&(r=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==r||n.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}d(e,t,"selected")},INPUT:function(e,t){d(e,t,"checked"),d(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var r=e.firstChild;if(r){var o=r.nodeValue;if(o==n||!n&&o==e.placeholder)return;r.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n,r,o=-1,a=0,i=e.firstChild;i;)if("OPTGROUP"===(r=i.nodeName&&i.nodeName.toUpperCase()))i=(n=i).firstChild;else{if("OPTION"===r){if(i.hasAttribute("selected")){o=a;break}a++}!(i=i.nextSibling)&&n&&(i=n.nextSibling,n=null)}e.selectedIndex=o}}};function u(){}function c(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var f=function(e,t,d){if(d||(d={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var f=t;(t=r.createElement("html")).innerHTML=f}else s=(s=t).trim(),t=o?function(e){var t=r.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(s):a?function(e){return n||(n=r.createRange()).selectNode(r.body),n.createContextualFragment(e).childNodes[0]}(s):function(e){var t=r.createElement("body");return t.innerHTML=e,t.childNodes[0]}(s);var s,v=d.getNodeKey||c,m=d.onBeforeNodeAdded||u,h=d.onNodeAdded||u,p=d.onBeforeElUpdated||u,b=d.onElUpdated||u,N=d.onBeforeNodeDiscarded||u,A=d.onNodeDiscarded||u,y=d.onBeforeElChildrenUpdated||u,g=!0===d.childrenOnly,C=Object.create(null),S=[];function T(e){S.push(e)}function E(e,t){if(1===e.nodeType)for(var n=e.firstChild;n;){var r=void 0;t&&(r=v(n))?T(r):(A(n),n.firstChild&&E(n,t)),n=n.nextSibling}}function x(e,t,n){!1!==N(e)&&(t&&t.removeChild(e),A(e),E(e,n))}function w(e){h(e);for(var t=e.firstChild;t;){var n=t.nextSibling,r=v(t);if(r){var o=C[r];o&&i(t,o)?(t.parentNode.replaceChild(o,t),O(o,t)):w(t)}else w(t);t=n}}function O(e,t,n){var o=v(t);if(o&&delete C[o],!n){if(!1===p(e,t))return;if(function(e,t){var n,r,o,a,i=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var d=i.length-1;d>=0;d--)r=(n=i[d]).name,a=n.value,(o=n.namespaceURI)?e.getAttributeNS(o,r=n.localName||r)!==a&&("xmlns"===n.prefix&&(r=n.name),e.setAttributeNS(o,r,a)):e.getAttribute(r)!==a&&e.setAttribute(r,a);for(var l=e.attributes,u=l.length-1;u>=0;u--)r=(n=l[u]).name,(o=n.namespaceURI)?t.hasAttributeNS(o,r=n.localName||r)||e.removeAttributeNS(o,r):t.hasAttribute(r)||e.removeAttribute(r)}}(e,t),b(e),!1===y(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var n,o,a,d,u,c=t.firstChild,f=e.firstChild;e:for(;c;){for(d=c.nextSibling,n=v(c);f;){if(a=f.nextSibling,c.isSameNode&&c.isSameNode(f)){c=d,f=a;continue e}o=v(f);var s=f.nodeType,h=void 0;if(s===c.nodeType&&(1===s?(n?n!==o&&((u=C[n])?a===u?h=!1:(e.insertBefore(u,f),o?T(o):x(f,e,!0),f=u):h=!1):o&&(h=!1),(h=!1!==h&&i(f,c))&&O(f,c)):3!==s&&8!=s||(h=!0,f.nodeValue!==c.nodeValue&&(f.nodeValue=c.nodeValue))),h){c=d,f=a;continue e}o?T(o):x(f,e,!0),f=a}if(n&&(u=C[n])&&i(u,c))e.appendChild(u),O(u,c);else{var p=m(c);!1!==p&&(p&&(c=p),c.actualize&&(c=c.actualize(e.ownerDocument||r)),e.appendChild(c),w(c))}c=d,f=a}!function(e,t,n){for(;t;){var r=t.nextSibling;(n=v(t))?T(n):x(t,e,!0),t=r}}(e,f,o);var b=l[e.nodeName];b&&b(e,t)}(e,t):l.TEXTAREA(e,t)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var r=v(n);r&&(C[r]=n),e(n),n=n.nextSibling}}(e);var U,I,P=e,R=P.nodeType,L=t.nodeType;if(!g)if(1===R)1===L?i(e,t)||(A(e),P=function(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}(e,(U=t.nodeName,(I=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==I?r.createElementNS(I,U):r.createElement(U)))):P=t;else if(3===R||8===R){if(L===R)return P.nodeValue!==t.nodeValue&&(P.nodeValue=t.nodeValue),P;P=t}if(P===t)A(e);else{if(t.isSameNode&&t.isSameNode(P))return;if(O(P,t,g),S)for(var V=0,D=S.length;V<D;V++){var M=C[S[V]];M&&x(M,M.parentNode,!1)}}return!g&&P!==e&&e.parentNode&&(P.actualize&&(P=P.actualize(e.ownerDocument||r)),e.parentNode.replaceChild(P,e)),P},s=new DOMParser,v=function(e){try{return Promise.resolve(fetch(e)).then(function(t){var n=function(){if(t.ok)return Promise.resolve(t.text()).then(function(t){var n=s.parseFromString(t,"text/html");f(document.body,n.body),document.title=n.title,h(),document.dispatchEvent(p("carinthia:load")),window.history.pushState({},"",e)});location.replace(e)}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}},m=function(e){e.preventDefault(),v(e.currentTarget.href)},h=function(){var e=function(e){return e.forEach(function(e){window.location.hostname===e.hostname&&e.addEventListener("click",m)})};e(document.querySelectorAll("a[href]"));for(var n,r=document.querySelectorAll("[x-carinthia-enhance]"),o=new MutationObserver(function(n,r){for(var o,a=t(n);!(o=a()).done;)for(var i,d=t(o.value.addedNodes);!(i=d()).done;)e(i.value.parentNode.querySelectorAll("a[href]"))}),a=t(r);!(n=a()).done;)o.observe(n.value,{attributes:!1,childList:!0,subtree:!1})},p=function(e,t){return void 0===t&&(t=void 0),new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:t})};document.addEventListener("DOMContentLoaded",function(){h(),window.onpopstate=function(e){var t,n;return v(null==(t=e.path[0])||null==(n=t.location)?void 0:n.href)},document.dispatchEvent(p("carinthia:load"))});
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var n,r="undefined"==typeof document?void 0:document,o=!!r&&"content"in r.createElement("template"),i=!!r&&r.createRange&&"createContextualFragment"in r.createRange();function a(e,t){var n,r,o=e.nodeName,i=t.nodeName;return o===i||(n=o.charCodeAt(0),r=i.charCodeAt(0),n<=90&&r>=97?o===i.toUpperCase():r<=90&&n>=97&&i===o.toUpperCase())}function d(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var u={OPTION:function(e,t){var n=e.parentNode;if(n){var r=n.nodeName.toUpperCase();"OPTGROUP"===r&&(r=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==r||n.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}d(e,t,"selected")},INPUT:function(e,t){d(e,t,"checked"),d(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var r=e.firstChild;if(r){var o=r.nodeValue;if(o==n||!n&&o==e.placeholder)return;r.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n,r,o=-1,i=0,a=e.firstChild;a;)if("OPTGROUP"===(r=a.nodeName&&a.nodeName.toUpperCase()))a=(n=a).firstChild;else{if("OPTION"===r){if(a.hasAttribute("selected")){o=i;break}i++}!(a=a.nextSibling)&&n&&(a=n.nextSibling,n=null)}e.selectedIndex=o}}};function l(){}function c(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var f=function(e,t,d){if(d||(d={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var f=t;(t=r.createElement("html")).innerHTML=f}else s=(s=t).trim(),t=o?function(e){var t=r.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(s):i?function(e){return n||(n=r.createRange()).selectNode(r.body),n.createContextualFragment(e).childNodes[0]}(s):function(e){var t=r.createElement("body");return t.innerHTML=e,t.childNodes[0]}(s);var s,m=d.getNodeKey||c,v=d.onBeforeNodeAdded||l,h=d.onNodeAdded||l,p=d.onBeforeElUpdated||l,b=d.onElUpdated||l,y=d.onBeforeNodeDiscarded||l,N=d.onNodeDiscarded||l,A=d.onBeforeElChildrenUpdated||l,g=!0===d.childrenOnly,E=Object.create(null),S=[];function C(e){S.push(e)}function T(e,t){if(1===e.nodeType)for(var n=e.firstChild;n;){var r=void 0;t&&(r=m(n))?C(r):(N(n),n.firstChild&&T(n,t)),n=n.nextSibling}}function x(e,t,n){!1!==y(e)&&(t&&t.removeChild(e),N(e),T(e,n))}function w(e){h(e);for(var t=e.firstChild;t;){var n=t.nextSibling,r=m(t);if(r){var o=E[r];o&&a(t,o)?(t.parentNode.replaceChild(o,t),O(o,t)):w(t)}else w(t);t=n}}function O(e,t,n){var o=m(t);if(o&&delete E[o],!n){if(!1===p(e,t))return;if(function(e,t){var n,r,o,i,a=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var d=a.length-1;d>=0;d--)r=(n=a[d]).name,i=n.value,(o=n.namespaceURI)?e.getAttributeNS(o,r=n.localName||r)!==i&&("xmlns"===n.prefix&&(r=n.name),e.setAttributeNS(o,r,i)):e.getAttribute(r)!==i&&e.setAttribute(r,i);for(var u=e.attributes,l=u.length-1;l>=0;l--)r=(n=u[l]).name,(o=n.namespaceURI)?t.hasAttributeNS(o,r=n.localName||r)||e.removeAttributeNS(o,r):t.hasAttribute(r)||e.removeAttribute(r)}}(e,t),b(e),!1===A(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var n,o,i,d,l,c=t.firstChild,f=e.firstChild;e:for(;c;){for(d=c.nextSibling,n=m(c);f;){if(i=f.nextSibling,c.isSameNode&&c.isSameNode(f)){c=d,f=i;continue e}o=m(f);var s=f.nodeType,h=void 0;if(s===c.nodeType&&(1===s?(n?n!==o&&((l=E[n])?i===l?h=!1:(e.insertBefore(l,f),o?C(o):x(f,e,!0),f=l):h=!1):o&&(h=!1),(h=!1!==h&&a(f,c))&&O(f,c)):3!==s&&8!=s||(h=!0,f.nodeValue!==c.nodeValue&&(f.nodeValue=c.nodeValue))),h){c=d,f=i;continue e}o?C(o):x(f,e,!0),f=i}if(n&&(l=E[n])&&a(l,c))e.appendChild(l),O(l,c);else{var p=v(c);!1!==p&&(p&&(c=p),c.actualize&&(c=c.actualize(e.ownerDocument||r)),e.appendChild(c),w(c))}c=d,f=i}!function(e,t,n){for(;t;){var r=t.nextSibling;(n=m(t))?C(n):x(t,e,!0),t=r}}(e,f,o);var b=u[e.nodeName];b&&b(e,t)}(e,t):u.TEXTAREA(e,t)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var r=m(n);r&&(E[r]=n),e(n),n=n.nextSibling}}(e);var U,P,I=e,R=I.nodeType,L=t.nodeType;if(!g)if(1===R)1===L?a(e,t)||(N(e),I=function(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}(e,(U=t.nodeName,(P=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==P?r.createElementNS(P,U):r.createElement(U)))):I=t;else if(3===R||8===R){if(L===R)return I.nodeValue!==t.nodeValue&&(I.nodeValue=t.nodeValue),I;I=t}if(I===t)N(e);else{if(t.isSameNode&&t.isSameNode(I))return;if(O(I,t,g),S)for(var D=0,V=S.length;D<V;D++){var M=E[S[D]];M&&x(M,M.parentNode,!1)}}return!g&&I!==e&&e.parentNode&&(I.actualize&&(I=I.actualize(e.ownerDocument||r)),e.parentNode.replaceChild(I,e)),I},s=new DOMParser,m=function(e){try{return Promise.resolve(fetch(e)).then(function(t){var n=function(){if(t.ok)return Promise.resolve(t.text()).then(function(e){var n=s.parseFromString(e,"text/html");document.dispatchEvent(b("carinthia:unload")),f(document.body,n.body),document.title=n.title,p(),document.dispatchEvent(b("carinthia:load")),window.history.pushState({},"",t.url)});location.replace(e)}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}},v=function(e){e.preventDefault(),m(e.currentTarget.href)},h=function(e){e.preventDefault(),function(e){try{var t=e.action,n=e.method,r=new FormData(e),o=[].concat(r.entries()).map(function(e){var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)}).join("&");Promise.resolve(fetch(t,{method:n,body:o})).then(function(e){return Promise.resolve(e.text()).then(function(t){var n=s.parseFromString(t,"text/html");document.dispatchEvent(b("carinthia:unload")),f(document.body,n.body),document.title=n.title,p(),document.dispatchEvent(b("carinthia:load")),e.redirected&&window.history.pushState({},"",e.url)})})}catch(e){return Promise.reject(e)}}(e.currentTarget)},p=function(){var e=function(e){return e.forEach(function(e){window.location.hostname===e.hostname&&e.addEventListener("click",v)})},n=function(e){return e.forEach(function(e){return e.addEventListener("submit",h)})};e(document.querySelectorAll('a[href]:not([href^="#"])')),n(document.querySelectorAll("form[x-carinthia-enhance]")),new MutationObserver(function(r,o){for(var i,a=t(r);!(i=a()).done;)for(var d,u=t(i.value.addedNodes);!(d=u()).done;){var l=d.value;l.nodeType==l.ELEMENT_NODE&&(e(l.querySelectorAll('a[href]:not([href^="#"])')),n(l.querySelectorAll("form[x-carinthia-enhance]")))}}).observe(document.body,{attributes:!1,childList:!0,subtree:!0})},b=function(e,t){return void 0===t&&(t=void 0),new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:t})};document.addEventListener("DOMContentLoaded",function(){p(),document.dispatchEvent(b("carinthia:load")),window.onpopstate=function(e){var t,n;return m(null==(t=e.path[0])||null==(n=t.location)?void 0:n.href)}});
//# sourceMappingURL=carinthia.esm.js.map
{
"name": "carinthia",
"version": "0.2.1",
"version": "0.4.0",
"description": "follow links, morph the dom",

@@ -14,3 +14,4 @@ "exports": "./dist/carinthia.js",

"keywords": [
"turbolinks", "morphdom"
"turbolinks",
"morphdom"
],

@@ -17,0 +18,0 @@ "author": "ziga.dev",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc