turbo_boost-streams 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbf5c6f7d153530d60e070a09d8310ddd7e7f0b894125f5f5154b12257058f81
4
- data.tar.gz: b5715c20c9defc1887cec395f733a5ce7b0b1402ea35dd3b71d5c9ebe46ca48b
3
+ metadata.gz: d10440671fb69eae54c6f1e6ccfffc05b4180858a6c9c9aa481eff0e6c061ddc
4
+ data.tar.gz: 5862cb137bd2d8d32ddb7b0650504c312296623719900aa39fa236552ae3557a
5
5
  SHA512:
6
- metadata.gz: d212f56f49fd2974592d8a677179036e59a672724dc96ea9cea42b4241448efbc1c7c51d5464b69a36dd0d3339f6e79e88b4224154d63e735ae88a8081f2b296
7
- data.tar.gz: 5438fecc2b4d15fe04962000269b2f6248f1083265bb222dbab3b24793e44cdb8b1a28318cc42275719ad027f160c77ca6181b84022eed97c30cb6fa9b4d2de9
6
+ metadata.gz: fd5ad99ecfa356900077180d197f95a33ea0c06a29e26a6db8d1b8c45723ecfc88d0050812df85a27484eace7ceeb840d3f84f10bd97fedff02d69fbbbb4b42e
7
+ data.tar.gz: 71321891ddc2a593d551c033d56b085b4f01298eb2717705c45c18aae1d424d3ef62e05c38363e61bb4b4d8cfc679d7d95fa3dab52e1294c5b416520d14b4e0b
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  </h1>
9
9
  <p align="center">
10
10
  <a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/">
11
- <img alt="Lines of Code" src="https://img.shields.io/badge/loc-238-47d299.svg" />
11
+ <img alt="Lines of Code" src="https://img.shields.io/badge/loc-249-47d299.svg" />
12
12
  </a>
13
13
  <a href="https://codeclimate.com/github/hopsoft/turbo_boost-streams/maintainability">
14
14
  <img src="https://api.codeclimate.com/v1/badges/a6671f4294ec0f21f732/maintainability" />
@@ -429,14 +429,16 @@ fly deploy
429
429
  > Run these commands on the host machine _(i.e. not inside the dev container)_
430
430
 
431
431
  1. Run `npm update` and `bundle update` to pick up the latest dependencies
432
- 1. Bump version number at `lib/turbo_boost-streams/version.rb`. Pre-release versions use `.preN`
433
- 1. Bump version number at `package.json` _(make sure it matches)_. Pre-release versions use `-preN`
432
+ 1. Update the version number consistently in the following files:
433
+ * `lib/turbo_boost/streams/version.rb` - pre-release versions should use `.preN`
434
+ * `app/javascript/version.js` - pre-release versions use `-preN`
435
+ * `package.json` - pre-release versions use `-preN`
434
436
  1. Run `bin/standardize`
435
437
  1. Run `rake build`
436
438
  1. Run `npm run build`
437
439
  1. Commit and push any changes to GitHub
438
440
  1. Run `rake release`
439
- 1. Run `npm publish ???? --access public`
441
+ 1. Run `npm publish --access public`
440
442
  1. Create a new release on GitHub ([here](https://github.com/hopsoft/turbo_boost-streams/releases)) and generate the changelog for the stable release for it
441
443
 
442
444
  ## About TurboBoost
@@ -1,2 +1,2 @@
1
- var y=Object.defineProperty,g=Object.defineProperties;var A=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var d=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,E=(t,e)=>{for(var o in e||(e={}))x.call(e,o)&&d(t,o,e[o]);if(v)for(var o of v(e))C.call(e,o)&&d(t,o,e[o]);return t},w=(t,e)=>g(t,A(e));import T from"alpinejs";import N from"@alpinejs/morph";T.plugin(N);var S=/INPUT/i,j=/date|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/i,B=/TEXTAREA/i;function M(t,e,o,r){if(t.nodeType!==Node.ELEMENT_NODE||t!==document.activeElement)return;if(t.tagName.match(B)||t.tagName.match(S)&&t.getAttribute("type").match(j))return r()}function p(t,e){T.morph(t,e,{updating:M})}var u={before:"turbo-boost:stream:before-invoke",after:"turbo-boost:stream:after-invoke",finish:"turbo-boost:stream:finish-invoke"};function m(t,e,o){let{object:r,target:i}=t;e=e||{},e=w(E({},e),{object:t.object});let n={detail:e,bubbles:!0};i.dispatchEvent(new CustomEvent(u.before,n));let{delay:s}=e.invoke||{};s=s||0;let a=()=>{let c=o(r);n.detail.result=c,i.dispatchEvent(new CustomEvent(u.after,n));let f;c instanceof Animation&&(f=c.finished),c instanceof Promise&&(f=c),f?f.then(()=>{n.detail.promise="fulfilled",i.dispatchEvent(new CustomEvent(u.finish,n))},()=>{n.detail.promise="rejected",i.dispatchEvent(new CustomEvent(u.finish,n))}):i.dispatchEvent(new CustomEvent(u.finish,n))};s>0?setTimeout(a,s):a()}function O(t,e,o){let r=e[0],i=e[1],n={method:t,eventName:r,eventOptions:i};o.forEach(s=>m(s,n,a=>a.dispatchEvent(new CustomEvent(r,i))))}function I(t,e,o){let r=e[0],i={method:t,html:r};o.forEach(n=>m(n,i,s=>p(s,r)))}function D(t,e,o){let r=t.slice(0,-1).trim(),i=e[0],n={method:t,property:r,value:i};o.forEach(s=>m(s,n,a=>a[r]=i))}function P(t,e,o){let r={method:t,args:e};o.forEach(i=>m(i,r,n=>n[t].apply(n,e)))}function k(t,e,o){return t.match(/^dispatch(Event)?$/)?O(t,e,o):t.match(/^morph|mutate$/)?I(t,e,o):t.endsWith("=")?D(t,e,o):P(t,e,o)}function l(){let t=JSON.parse(this.templateContent.textContent),{id:e,selector:o,receiver:r,method:i,args:n,delay:s}=t,a=[{object:self,target:self}];o&&(a=Array.from(document.querySelectorAll(o)).map(c=>({object:c,target:c}))),r&&(a=a.map(c=>{let{object:f,target:h}=c,b=r.split(".");for(;b.length>0;)f=f[b.shift()],f.dispatchEvent&&(h=f);return{object:f,target:h}})),s>0?setTimeout(()=>k(i,n,a),s):k(i,n,a)}if(!self.Turbo)throw new Error("`Turbo` is not defined! Be sure to import `@turbo-boost/streams` after `@hotwired/turbo` or `@hotwired/turbo-rails`.");if(!Turbo.StreamActions)throw new Error("`Turbo.StreamActions` is not defined! Verify that you are running >= `7.2.0` of `@hotwired/turbo`.");Turbo.StreamActions.invoke=l;self.TurboBoost=self.TurboBoost||{};self.TurboBoost.Streams={invoke:l,invokeEvents:u};console.info("@turbo-boost/streams has initialized and registered new stream actions with Turbo.");var W=self.TurboBoost.Streams;export{W as default};
1
+ var ie=Object.defineProperty,le=Object.defineProperties;var ae=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var N=(a,o,u)=>o in a?ie(a,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[o]=u,q=(a,o)=>{for(var u in o||(o={}))oe.call(o,u)&&N(a,u,o[u]);if(F)for(var u of F(o))se.call(o,u)&&N(a,u,o[u]);return a},U=(a,o)=>le(a,ae(o));var W="0.1.9";var _=function(){"use strict";let a=new Set,o={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:A,afterNodeAdded:A,beforeNodeMorphed:A,afterNodeMorphed:A,beforeNodeRemoved:A,afterNodeRemoved:A,beforeAttributeUpdated:A},head:{style:"merge",shouldPreserve:function(e){return e.getAttribute("im-preserve")==="true"},shouldReAppend:function(e){return e.getAttribute("im-re-append")==="true"},shouldRemove:A,afterHeadMorphed:A}};function u(e,t,n={}){e instanceof Document&&(e=e.documentElement),typeof t=="string"&&(t=G(t));let r=K(t),i=J(e,r,n);return m(e,r,i)}function m(e,t,n){if(n.head.block){let r=e.querySelector("head"),i=t.querySelector("head");if(r&&i){let l=M(i,r,n);Promise.all(l).then(function(){m(e,t,Object.assign(n,{head:{block:!1,ignore:!0}}))});return}}if(n.morphStyle==="innerHTML")return b(t,e,n),e.children;if(n.morphStyle==="outerHTML"||n.morphStyle==null){let r=Z(t,e,n),i=r==null?void 0:r.previousSibling,l=r==null?void 0:r.nextSibling,s=f(e,r,n);return r?Q(i,s,l):[]}else throw"Do not understand how to morph style "+n.morphStyle}function d(e,t){return t.ignoreActiveValue&&e===document.activeElement&&e!==document.body}function f(e,t,n){if(!(n.ignoreActive&&e===document.activeElement))return t==null?n.callbacks.beforeNodeRemoved(e)===!1?e:(e.remove(),n.callbacks.afterNodeRemoved(e),null):H(e,t)?(n.callbacks.beforeNodeMorphed(e,t)===!1||(e instanceof HTMLHeadElement&&n.head.ignore||(e instanceof HTMLHeadElement&&n.head.style!=="morph"?M(t,e,n):(g(t,e,n),d(e,n)||b(t,e,n))),n.callbacks.afterNodeMorphed(e,t)),e):n.callbacks.beforeNodeRemoved(e)===!1||n.callbacks.beforeNodeAdded(t)===!1?e:(e.parentElement.replaceChild(t,e),n.callbacks.afterNodeAdded(t),n.callbacks.afterNodeRemoved(e),t)}function b(e,t,n){let r=e.firstChild,i=t.firstChild,l;for(;r;){if(l=r,r=l.nextSibling,i==null){if(n.callbacks.beforeNodeAdded(l)===!1)return;t.appendChild(l),n.callbacks.afterNodeAdded(l),S(n,l);continue}if(B(l,i,n)){f(i,l,n),i=i.nextSibling,S(n,l);continue}let s=X(e,t,l,i,n);if(s){i=C(i,s,n),f(s,l,n),S(n,l);continue}let p=Y(e,t,l,i,n);if(p){i=C(i,p,n),f(p,l,n),S(n,l);continue}if(n.callbacks.beforeNodeAdded(l)===!1)return;t.insertBefore(l,i),n.callbacks.afterNodeAdded(l),S(n,l)}for(;i!==null;){let s=i;i=i.nextSibling,j(s,n)}}function c(e,t,n,r){return e==="value"&&r.ignoreActiveValue&&t===document.activeElement?!0:r.callbacks.beforeAttributeUpdated(e,t,n)===!1}function g(e,t,n){let r=e.nodeType;if(r===1){let i=e.attributes,l=t.attributes;for(let s of i)c(s.name,t,"update",n)||t.getAttribute(s.name)!==s.value&&t.setAttribute(s.name,s.value);for(let s=l.length-1;0<=s;s--){let p=l[s];c(p.name,t,"remove",n)||e.hasAttribute(p.name)||t.removeAttribute(p.name)}}(r===8||r===3)&&t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue),d(t,n)||I(e,t,n)}function v(e,t,n,r){if(e[n]!==t[n]){let i=c(n,t,"update",r);i||(t[n]=e[n]),e[n]?i||t.setAttribute(n,e[n]):c(n,t,"remove",r)||t.removeAttribute(n)}}function I(e,t,n){if(e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&e.type!=="file"){let r=e.value,i=t.value;v(e,t,"checked",n),v(e,t,"disabled",n),e.hasAttribute("value")?r!==i&&(c("value",t,"update",n)||(t.setAttribute("value",r),t.value=r)):c("value",t,"remove",n)||(t.value="",t.removeAttribute("value"))}else if(e instanceof HTMLOptionElement)v(e,t,"selected",n);else if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){let r=e.value,i=t.value;if(c("value",t,"update",n))return;r!==i&&(t.value=r),t.firstChild&&t.firstChild.nodeValue!==r&&(t.firstChild.nodeValue=r)}}function M(e,t,n){let r=[],i=[],l=[],s=[],p=n.head.style,y=new Map;for(let h of e.children)y.set(h.outerHTML,h);for(let h of t.children){let E=y.has(h.outerHTML),w=n.head.shouldReAppend(h),V=n.head.shouldPreserve(h);E||V?w?i.push(h):(y.delete(h.outerHTML),l.push(h)):p==="append"?w&&(i.push(h),s.push(h)):n.head.shouldRemove(h)!==!1&&i.push(h)}s.push(...y.values());let D=[];for(let h of s){let E=document.createRange().createContextualFragment(h.outerHTML).firstChild;if(n.callbacks.beforeNodeAdded(E)!==!1){if(E.href||E.src){let w=null,V=new Promise(function(re){w=re});E.addEventListener("load",function(){w()}),D.push(V)}t.appendChild(E),n.callbacks.afterNodeAdded(E),r.push(E)}}for(let h of i)n.callbacks.beforeNodeRemoved(h)!==!1&&(t.removeChild(h),n.callbacks.afterNodeRemoved(h));return n.head.afterHeadMorphed(t,{added:r,kept:l,removed:i}),D}function ge(){}function A(){}function z(e){let t={};return Object.assign(t,o),Object.assign(t,e),t.callbacks={},Object.assign(t.callbacks,o.callbacks),Object.assign(t.callbacks,e.callbacks),t.head={},Object.assign(t.head,o.head),Object.assign(t.head,e.head),t}function J(e,t,n){return n=z(n),{target:e,newContent:t,config:n,morphStyle:n.morphStyle,ignoreActive:n.ignoreActive,ignoreActiveValue:n.ignoreActiveValue,idMap:ne(e,t),deadIds:new Set,callbacks:n.callbacks,head:n.head}}function B(e,t,n){return e==null||t==null?!1:e.nodeType===t.nodeType&&e.tagName===t.tagName?e.id!==""&&e.id===t.id?!0:T(n,e,t)>0:!1}function H(e,t){return e==null||t==null?!1:e.nodeType===t.nodeType&&e.tagName===t.tagName}function C(e,t,n){for(;e!==t;){let r=e;e=e.nextSibling,j(r,n)}return S(n,t),t.nextSibling}function X(e,t,n,r,i){let l=T(i,n,t),s=null;if(l>0){let p=r,y=0;for(;p!=null;){if(B(n,p,i))return p;if(y+=T(i,p,e),y>l)return null;p=p.nextSibling}}return s}function Y(e,t,n,r,i){let l=r,s=n.nextSibling,p=0;for(;l!=null;){if(T(i,l,e)>0)return null;if(H(n,l))return l;if(H(s,l)&&(p++,s=s.nextSibling,p>=2))return null;l=l.nextSibling}return l}function G(e){let t=new DOMParser,n=e.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(n.match(/<\/html>/)||n.match(/<\/head>/)||n.match(/<\/body>/)){let r=t.parseFromString(e,"text/html");if(n.match(/<\/html>/))return r.generatedByIdiomorph=!0,r;{let i=r.firstChild;return i?(i.generatedByIdiomorph=!0,i):null}}else{let i=t.parseFromString("<body><template>"+e+"</template></body>","text/html").body.querySelector("template").content;return i.generatedByIdiomorph=!0,i}}function K(e){if(e==null)return document.createElement("div");if(e.generatedByIdiomorph)return e;if(e instanceof Node){let t=document.createElement("div");return t.append(e),t}else{let t=document.createElement("div");for(let n of[...e])t.append(n);return t}}function Q(e,t,n){let r=[],i=[];for(;e!=null;)r.push(e),e=e.previousSibling;for(;r.length>0;){let l=r.pop();i.push(l),t.parentElement.insertBefore(l,t)}for(i.push(t);n!=null;)r.push(n),i.push(n),n=n.nextSibling;for(;r.length>0;)t.parentElement.insertBefore(r.pop(),t.nextSibling);return i}function Z(e,t,n){let r;r=e.firstChild;let i=r,l=0;for(;r;){let s=x(r,t,n);s>l&&(i=r,l=s),r=r.nextSibling}return i}function x(e,t,n){return H(e,t)?.5+T(n,e,t):0}function j(e,t){S(t,e),t.callbacks.beforeNodeRemoved(e)!==!1&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function ee(e,t){return!e.deadIds.has(t)}function te(e,t,n){return(e.idMap.get(n)||a).has(t)}function S(e,t){let n=e.idMap.get(t)||a;for(let r of n)e.deadIds.add(r)}function T(e,t,n){let r=e.idMap.get(t)||a,i=0;for(let l of r)ee(e,l)&&te(e,l,n)&&++i;return i}function P(e,t){let n=e.parentElement,r=e.querySelectorAll("[id]");for(let i of r){let l=i;for(;l!==n&&l!=null;){let s=t.get(l);s==null&&(s=new Set,t.set(l,s)),s.add(i.id),l=l.parentElement}}}function ne(e,t){let n=new Map;return P(e,n),P(t,n),n}return{morph:u,defaults:o}}();var ue=/INPUT/i,fe=/date|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/i,de=/TEXTAREA/i,ce=a=>a.nodeType!==Node.ELEMENT_NODE||a!==document.activeElement?!0:a.tagName.match(de)?!1:a.tagName.match(ue)&&a.getAttribute("type").match(fe),he={beforeNodeMorphed:(a,o)=>ce(a)};function L(a,o){_.morph(a,o,{callbacks:he})}var k={before:"turbo-boost:stream:before-invoke",after:"turbo-boost:stream:after-invoke",finish:"turbo-boost:stream:finish-invoke"};function R(a,o,u){let{object:m,target:d}=a;o=o||{},o=U(q({},o),{object:a.object});let f={detail:o,bubbles:!0};d.dispatchEvent(new CustomEvent(k.before,f));let{delay:b}=o.invoke||{};b=b||0;let c=()=>{let g=u(m);f.detail.result=g,d.dispatchEvent(new CustomEvent(k.after,f));let v;g instanceof Animation&&(v=g.finished),g instanceof Promise&&(v=g),v?v.then(()=>{f.detail.promise="fulfilled",d.dispatchEvent(new CustomEvent(k.finish,f))},()=>{f.detail.promise="rejected",d.dispatchEvent(new CustomEvent(k.finish,f))}):d.dispatchEvent(new CustomEvent(k.finish,f))};b>0?setTimeout(c,b):c()}function pe(a,o,u){let m=o[0],d=o[1],f={method:a,eventName:m,eventOptions:d};u.forEach(b=>R(b,f,c=>c.dispatchEvent(new CustomEvent(m,d))))}function me(a,o,u){let m=o[0],d={method:a,html:m};u.forEach(f=>R(f,d,b=>L(b,m)))}function be(a,o,u){let m=a.slice(0,-1).trim(),d=o[0],f={method:a,property:m,value:d};u.forEach(b=>R(b,f,c=>c[m]=d))}function ve(a,o,u){let m={method:a,args:o};u.forEach(d=>R(d,m,f=>f[a].apply(f,o)))}function $(a,o,u){return a.match(/^dispatch(Event)?$/)?pe(a,o,u):a.match(/^morph|mutate$/)?me(a,o,u):a.endsWith("=")?be(a,o,u):ve(a,o,u)}function O(){let a=JSON.parse(this.templateContent.textContent),{id:o,selector:u,receiver:m,method:d,args:f,delay:b}=a,c=[{object:self,target:self}];u&&(c=Array.from(document.querySelectorAll(u)).map(g=>({object:g,target:g}))),m&&(c=c.map(g=>{let{object:v,target:I}=g,M=m.split(".");for(;M.length>0;)v=v[M.shift()],v.dispatchEvent&&(I=v);return{object:v,target:I}})),b>0?setTimeout(()=>$(d,f,c),b):$(d,f,c)}if(!self.Turbo)throw new Error("`Turbo` is not defined! Be sure to import `@turbo-boost/streams` after `@hotwired/turbo` or `@hotwired/turbo-rails`.");if(!Turbo.StreamActions)throw new Error("`Turbo.StreamActions` is not defined! Verify that you are running >= `7.2.0` of `@hotwired/turbo`.");Turbo.StreamActions.invoke=O;self.TurboBoost=self.TurboBoost||{};self.TurboBoost.Streams={invoke:O,invokeEvents:k,VERSION:W};console.info("@turbo-boost/streams has initialized and registered new stream actions with Turbo.");var Re=self.TurboBoost.Streams;export{Re as default};
2
2
  //# sourceMappingURL=streams.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../javascript/morph.js", "../../../javascript/invoke.js", "../../../javascript/index.js"],
4
- "sourcesContent": ["import alpine from 'alpinejs'\nimport alpineMorph from '@alpinejs/morph'\n\nalpine.plugin(alpineMorph)\n\nconst input = /INPUT/i\nconst inputTypes = /date|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/i\nconst textarea = /TEXTAREA/i\n\nfunction updating(el, toEl, childrenOnly, skip) {\n if (el.nodeType !== Node.ELEMENT_NODE) return\n if (el !== document.activeElement) return\n\n const protect =\n el.tagName.match(textarea) || (el.tagName.match(input) && el.getAttribute('type').match(inputTypes))\n\n if (protect) return skip()\n}\n\nexport default function morph(element, html) {\n alpine.morph(element, html, { updating })\n}\n", "import morph from './morph'\n\nexport const invokeEvents = {\n before: 'turbo-boost:stream:before-invoke',\n after: 'turbo-boost:stream:after-invoke',\n finish: 'turbo-boost:stream:finish-invoke'\n}\n\n// Invokes the callback on a single receiver with before/after events\nfunction withInvokeEvents(receiver, detail, callback) {\n const { object, target } = receiver\n detail = detail || {}\n detail = { ...detail, object: receiver.object }\n const options = { detail, bubbles: true }\n\n target.dispatchEvent(new CustomEvent(invokeEvents.before, options))\n\n // the before event can provide invoke instructions my modifying the event detail\n // For example, { delay: 1000 } will delay the invocation by 1000ms\n let { delay } = detail.invoke || {}\n delay = delay || 0\n\n const execute = () => {\n const result = callback(object)\n options.detail.result = result\n target.dispatchEvent(new CustomEvent(invokeEvents.after, options))\n\n let promise\n if (result instanceof Animation) promise = result.finished\n if (result instanceof Promise) promise = result\n\n if (promise)\n promise.then(\n () => {\n options.detail.promise = 'fulfilled'\n target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n },\n () => {\n options.detail.promise = 'rejected'\n target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n }\n )\n else target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n }\n\n if (delay > 0) setTimeout(execute, delay)\n else execute()\n}\n\nfunction invokeDispatchEvent(method, args, receivers) {\n const eventName = args[0]\n const eventOptions = args[1]\n const detail = { method, eventName, eventOptions }\n receivers.forEach(receiver =>\n withInvokeEvents(receiver, detail, object =>\n object.dispatchEvent(new CustomEvent(eventName, eventOptions))\n )\n )\n}\n\nfunction invokeMorph(method, args, receivers) {\n const html = args[0]\n const detail = { method, html }\n receivers.forEach(receiver => withInvokeEvents(receiver, detail, object => morph(object, html)))\n}\n\nfunction invokeAssignment(method, args, receivers) {\n const property = method.slice(0, -1).trim()\n const value = args[0]\n const detail = { method, property, value }\n receivers.forEach(receiver => withInvokeEvents(receiver, detail, object => (object[property] = value)))\n}\n\nfunction invokeMethod(method, args, receivers) {\n const detail = { method, args }\n receivers.forEach(receiver =>\n withInvokeEvents(receiver, detail, object => object[method].apply(object, args))\n )\n}\n\n// Performs an invocation on all receivers for the given method and args\nfunction performInvoke(method, args, receivers) {\n // dispatch ................................................................................................\n if (method.match(/^dispatch(Event)?$/)) return invokeDispatchEvent(method, args, receivers)\n\n // morph ...................................................................................................\n if (method.match(/^morph|mutate$/)) return invokeMorph(method, args, receivers)\n\n // assignment ..............................................................................................\n if (method.endsWith('=')) return invokeAssignment(method, args, receivers)\n\n // method ..................................................................................................\n return invokeMethod(method, args, receivers)\n}\n\nexport function invoke() {\n const payload = JSON.parse(this.templateContent.textContent)\n const { id, selector, receiver, method, args, delay } = payload\n let receivers = [{ object: self, target: self }]\n if (selector)\n receivers = Array.from(document.querySelectorAll(selector)).map(el => ({\n object: el,\n target: el\n }))\n\n if (receiver) {\n receivers = receivers.map(r => {\n let { object, target } = r\n const chain = receiver.split('.')\n while (chain.length > 0) {\n object = object[chain.shift()]\n if (object.dispatchEvent) target = object\n }\n return { object, target }\n })\n }\n\n if (delay > 0) setTimeout(() => performInvoke(method, args, receivers), delay)\n else performInvoke(method, args, receivers)\n}\n", "import { invoke, invokeEvents } from './invoke'\n\nif (!self['Turbo'])\n throw new Error(\n '`Turbo` is not defined! Be sure to import `@turbo-boost/streams` after `@hotwired/turbo` or `@hotwired/turbo-rails`.'\n )\n\nif (!Turbo['StreamActions'])\n throw new Error(\n '`Turbo.StreamActions` is not defined! Verify that you are running >= `7.2.0` of `@hotwired/turbo`.'\n )\n\nTurbo.StreamActions.invoke = invoke\nself.TurboBoost = self.TurboBoost || {}\nself.TurboBoost.Streams = { invoke, invokeEvents }\n\nconsole.info('@turbo-boost/streams has initialized and registered new stream actions with Turbo.')\n\nexport default self.TurboBoost.Streams\n"],
5
- "mappings": "6aAAA,OAAOA,MAAY,WACnB,OAAOC,MAAiB,kBAExBD,EAAO,OAAOC,CAAW,EAEzB,IAAMC,EAAQ,SACRC,EAAa,uFACbC,EAAW,YAEjB,SAASC,EAASC,EAAIC,EAAMC,EAAcC,EAAM,CAE9C,GADIH,EAAG,WAAa,KAAK,cACrBA,IAAO,SAAS,cAAe,OAKnC,GAFEA,EAAG,QAAQ,MAAMF,CAAQ,GAAME,EAAG,QAAQ,MAAMJ,CAAK,GAAKI,EAAG,aAAa,MAAM,EAAE,MAAMH,CAAU,EAEvF,OAAOM,EAAK,CAC3B,CAEe,SAARC,EAAuBC,EAASC,EAAM,CAC3CZ,EAAO,MAAMW,EAASC,EAAM,CAAE,SAAAP,CAAS,CAAC,CAC1C,CCnBO,IAAMQ,EAAe,CAC1B,OAAQ,mCACR,MAAO,kCACP,OAAQ,kCACV,EAGA,SAASC,EAAiBC,EAAUC,EAAQC,EAAU,CACpD,GAAM,CAAE,OAAAC,EAAQ,OAAAC,CAAO,EAAIJ,EAC3BC,EAASA,GAAU,CAAC,EACpBA,EAASI,EAAAC,EAAA,GAAKL,GAAL,CAAa,OAAQD,EAAS,MAAO,GAC9C,IAAMO,EAAU,CAAE,OAAAN,EAAQ,QAAS,EAAK,EAExCG,EAAO,cAAc,IAAI,YAAYN,EAAa,OAAQS,CAAO,CAAC,EAIlE,GAAI,CAAE,MAAAC,CAAM,EAAIP,EAAO,QAAU,CAAC,EAClCO,EAAQA,GAAS,EAEjB,IAAMC,EAAU,IAAM,CACpB,IAAMC,EAASR,EAASC,CAAM,EAC9BI,EAAQ,OAAO,OAASG,EACxBN,EAAO,cAAc,IAAI,YAAYN,EAAa,MAAOS,CAAO,CAAC,EAEjE,IAAII,EACAD,aAAkB,YAAWC,EAAUD,EAAO,UAC9CA,aAAkB,UAASC,EAAUD,GAErCC,EACFA,EAAQ,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EF,MAAM,cAAc,OAASkB,EAC7B,KAAK,WAAa,KAAK,YAAc,CAAC,EACtC,KAAK,WAAW,QAAU,CAAE,OAAAA,EAAQ,aAAAC,CAAa,EAEjD,QAAQ,KAAK,oFAAoF,EAEjG,IAAOC,EAAQ,KAAK,WAAW",
6
- "names": ["alpine", "alpineMorph", "input", "inputTypes", "textarea", "updating", "el", "toEl", "childrenOnly", "skip", "morph", "element", "html", "invokeEvents", "withInvokeEvents", "receiver", "detail", "callback", "object", "target", "__spreadProps", "__spreadValues", "options", "delay", "execute", "result", "promise", "invokeDispatchEvent", "method", "args", "receivers", "eventName", "eventOptions", "invokeMorph", "html", "morph", "invokeAssignment", "property", "value", "invokeMethod", "performInvoke", "invoke", "payload", "id", "selector", "el", "r", "chain", "invoke", "invokeEvents", "javascript_default"]
3
+ "sources": ["../../../javascript/version.js", "../../../../node_modules/idiomorph/dist/idiomorph.esm.js", "../../../javascript/morph.js", "../../../javascript/invoke.js", "../../../javascript/index.js"],
4
+ "sourcesContent": ["export default '0.1.9'\n", "// base IIFE to define idiomorph\nvar Idiomorph = (function () {\n 'use strict';\n\n //=============================================================================\n // AND NOW IT BEGINS...\n //=============================================================================\n let EMPTY_SET = new Set();\n\n // default configuration values, updatable by users now\n let defaults = {\n morphStyle: \"outerHTML\",\n callbacks : {\n beforeNodeAdded: noOp,\n afterNodeAdded: noOp,\n beforeNodeMorphed: noOp,\n afterNodeMorphed: noOp,\n beforeNodeRemoved: noOp,\n afterNodeRemoved: noOp,\n beforeAttributeUpdated: noOp,\n\n },\n head: {\n style: 'merge',\n shouldPreserve: function (elt) {\n return elt.getAttribute(\"im-preserve\") === \"true\";\n },\n shouldReAppend: function (elt) {\n return elt.getAttribute(\"im-re-append\") === \"true\";\n },\n shouldRemove: noOp,\n afterHeadMorphed: noOp,\n }\n };\n\n //=============================================================================\n // Core Morphing Algorithm - morph, morphNormalizedContent, morphOldNodeTo, morphChildren\n //=============================================================================\n function morph(oldNode, newContent, config = {}) {\n\n if (oldNode instanceof Document) {\n oldNode = oldNode.documentElement;\n }\n\n if (typeof newContent === 'string') {\n newContent = parseContent(newContent);\n }\n\n let normalizedContent = normalizeContent(newContent);\n\n let ctx = createMorphContext(oldNode, normalizedContent, config);\n\n return morphNormalizedContent(oldNode, normalizedContent, ctx);\n }\n\n function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {\n if (ctx.head.block) {\n let oldHead = oldNode.querySelector('head');\n let newHead = normalizedNewContent.querySelector('head');\n if (oldHead && newHead) {\n let promises = handleHeadElement(newHead, oldHead, ctx);\n // when head promises resolve, call morph again, ignoring the head tag\n Promise.all(promises).then(function () {\n morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx, {\n head: {\n block: false,\n ignore: true\n }\n }));\n });\n return;\n }\n }\n\n if (ctx.morphStyle === \"innerHTML\") {\n\n // innerHTML, so we are only updating the children\n morphChildren(normalizedNewContent, oldNode, ctx);\n return oldNode.children;\n\n } else if (ctx.morphStyle === \"outerHTML\" || ctx.morphStyle == null) {\n // otherwise find the best element match in the new content, morph that, and merge its siblings\n // into either side of the best match\n let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);\n\n // stash the siblings that will need to be inserted on either side of the best match\n let previousSibling = bestMatch?.previousSibling;\n let nextSibling = bestMatch?.nextSibling;\n\n // morph it\n let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);\n\n if (bestMatch) {\n // if there was a best match, merge the siblings in too and return the\n // whole bunch\n return insertSiblings(previousSibling, morphedNode, nextSibling);\n } else {\n // otherwise nothing was added to the DOM\n return []\n }\n } else {\n throw \"Do not understand how to morph style \" + ctx.morphStyle;\n }\n }\n\n\n /**\n * @param possibleActiveElement\n * @param ctx\n * @returns {boolean}\n */\n function ignoreValueOfActiveElement(possibleActiveElement, ctx) {\n return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body;\n }\n\n /**\n * @param oldNode root node to merge content into\n * @param newContent new content to merge\n * @param ctx the merge context\n * @returns {Element} the element that ended up in the DOM\n */\n function morphOldNodeTo(oldNode, newContent, ctx) {\n if (ctx.ignoreActive && oldNode === document.activeElement) {\n // don't morph focused element\n } else if (newContent == null) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n\n oldNode.remove();\n ctx.callbacks.afterNodeRemoved(oldNode);\n return null;\n } else if (!isSoftMatch(oldNode, newContent)) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n if (ctx.callbacks.beforeNodeAdded(newContent) === false) return oldNode;\n\n oldNode.parentElement.replaceChild(newContent, oldNode);\n ctx.callbacks.afterNodeAdded(newContent);\n ctx.callbacks.afterNodeRemoved(oldNode);\n return newContent;\n } else {\n if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false) return oldNode;\n\n if (oldNode instanceof HTMLHeadElement && ctx.head.ignore) {\n // ignore the head element\n } else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== \"morph\") {\n handleHeadElement(newContent, oldNode, ctx);\n } else {\n syncNodeFrom(newContent, oldNode, ctx);\n if (!ignoreValueOfActiveElement(oldNode, ctx)) {\n morphChildren(newContent, oldNode, ctx);\n }\n }\n ctx.callbacks.afterNodeMorphed(oldNode, newContent);\n return oldNode;\n }\n }\n\n /**\n * This is the core algorithm for matching up children. The idea is to use id sets to try to match up\n * nodes as faithfully as possible. We greedily match, which allows us to keep the algorithm fast, but\n * by using id sets, we are able to better match up with content deeper in the DOM.\n *\n * Basic algorithm is, for each node in the new content:\n *\n * - if we have reached the end of the old parent, append the new content\n * - if the new content has an id set match with the current insertion point, morph\n * - search for an id set match\n * - if id set match found, morph\n * - otherwise search for a \"soft\" match\n * - if a soft match is found, morph\n * - otherwise, prepend the new node before the current insertion point\n *\n * The two search algorithms terminate if competing node matches appear to outweigh what can be achieved\n * with the current node. See findIdSetMatch() and findSoftMatch() for details.\n *\n * @param {Element} newParent the parent element of the new content\n * @param {Element } oldParent the old content that we are merging the new content into\n * @param ctx the merge context\n */\n function morphChildren(newParent, oldParent, ctx) {\n\n let nextNewChild = newParent.firstChild;\n let insertionPoint = oldParent.firstChild;\n let newChild;\n\n // run through all the new content\n while (nextNewChild) {\n\n newChild = nextNewChild;\n nextNewChild = newChild.nextSibling;\n\n // if we are at the end of the exiting parent's children, just append\n if (insertionPoint == null) {\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.appendChild(newChild);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // if the current node has an id set match then morph\n if (isIdSetMatch(newChild, insertionPoint, ctx)) {\n morphOldNodeTo(insertionPoint, newChild, ctx);\n insertionPoint = insertionPoint.nextSibling;\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // otherwise search forward in the existing old children for an id set match\n let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a potential match, remove the nodes until that point and morph\n if (idSetMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx);\n morphOldNodeTo(idSetMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // no id set match found, so scan forward for a soft match for the current node\n let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a soft match for the current node, morph\n if (softMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx);\n morphOldNodeTo(softMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // abandon all hope of morphing, just insert the new child before the insertion point\n // and move on\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.insertBefore(newChild, insertionPoint);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n }\n\n // remove any remaining old nodes that didn't match up with new content\n while (insertionPoint !== null) {\n\n let tempNode = insertionPoint;\n insertionPoint = insertionPoint.nextSibling;\n removeNode(tempNode, ctx);\n }\n }\n\n //=============================================================================\n // Attribute Syncing Code\n //=============================================================================\n\n /**\n * @param attr {String} the attribute to be mutated\n * @param to {Element} the element that is going to be updated\n * @param updateType {(\"update\"|\"remove\")}\n * @param ctx the merge context\n * @returns {boolean} true if the attribute should be ignored, false otherwise\n */\n function ignoreAttribute(attr, to, updateType, ctx) {\n if(attr === 'value' && ctx.ignoreActiveValue && to === document.activeElement){\n return true;\n }\n return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;\n }\n\n /**\n * syncs a given node with another node, copying over all attributes and\n * inner element state from the 'from' node to the 'to' node\n *\n * @param {Element} from the element to copy attributes & state from\n * @param {Element} to the element to copy attributes & state to\n * @param ctx the merge context\n */\n function syncNodeFrom(from, to, ctx) {\n let type = from.nodeType\n\n // if is an element type, sync the attributes from the\n // new node into the new node\n if (type === 1 /* element type */) {\n const fromAttributes = from.attributes;\n const toAttributes = to.attributes;\n for (const fromAttribute of fromAttributes) {\n if (ignoreAttribute(fromAttribute.name, to, 'update', ctx)) {\n continue;\n }\n if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) {\n to.setAttribute(fromAttribute.name, fromAttribute.value);\n }\n }\n // iterate backwards to avoid skipping over items when a delete occurs\n for (let i = toAttributes.length - 1; 0 <= i; i--) {\n const toAttribute = toAttributes[i];\n if (ignoreAttribute(toAttribute.name, to, 'remove', ctx)) {\n continue;\n }\n if (!from.hasAttribute(toAttribute.name)) {\n to.removeAttribute(toAttribute.name);\n }\n }\n }\n\n // sync text nodes\n if (type === 8 /* comment */ || type === 3 /* text */) {\n if (to.nodeValue !== from.nodeValue) {\n to.nodeValue = from.nodeValue;\n }\n }\n\n if (!ignoreValueOfActiveElement(to, ctx)) {\n // sync input values\n syncInputValue(from, to, ctx);\n }\n }\n\n /**\n * @param from {Element} element to sync the value from\n * @param to {Element} element to sync the value to\n * @param attributeName {String} the attribute name\n * @param ctx the merge context\n */\n function syncBooleanAttribute(from, to, attributeName, ctx) {\n if (from[attributeName] !== to[attributeName]) {\n let ignoreUpdate = ignoreAttribute(attributeName, to, 'update', ctx);\n if (!ignoreUpdate) {\n to[attributeName] = from[attributeName];\n }\n if (from[attributeName]) {\n if (!ignoreUpdate) {\n to.setAttribute(attributeName, from[attributeName]);\n }\n } else {\n if (!ignoreAttribute(attributeName, to, 'remove', ctx)) {\n to.removeAttribute(attributeName);\n }\n }\n }\n }\n\n /**\n * NB: many bothans died to bring us information:\n *\n * https://github.com/patrick-steele-idem/morphdom/blob/master/src/specialElHandlers.js\n * https://github.com/choojs/nanomorph/blob/master/lib/morph.jsL113\n *\n * @param from {Element} the element to sync the input value from\n * @param to {Element} the element to sync the input value to\n * @param ctx the merge context\n */\n function syncInputValue(from, to, ctx) {\n if (from instanceof HTMLInputElement &&\n to instanceof HTMLInputElement &&\n from.type !== 'file') {\n\n let fromValue = from.value;\n let toValue = to.value;\n\n // sync boolean attributes\n syncBooleanAttribute(from, to, 'checked', ctx);\n syncBooleanAttribute(from, to, 'disabled', ctx);\n\n if (!from.hasAttribute('value')) {\n if (!ignoreAttribute('value', to, 'remove', ctx)) {\n to.value = '';\n to.removeAttribute('value');\n }\n } else if (fromValue !== toValue) {\n if (!ignoreAttribute('value', to, 'update', ctx)) {\n to.setAttribute('value', fromValue);\n to.value = fromValue;\n }\n }\n } else if (from instanceof HTMLOptionElement) {\n syncBooleanAttribute(from, to, 'selected', ctx)\n } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) {\n let fromValue = from.value;\n let toValue = to.value;\n if (ignoreAttribute('value', to, 'update', ctx)) {\n return;\n }\n if (fromValue !== toValue) {\n to.value = fromValue;\n }\n if (to.firstChild && to.firstChild.nodeValue !== fromValue) {\n to.firstChild.nodeValue = fromValue\n }\n }\n }\n\n //=============================================================================\n // the HEAD tag can be handled specially, either w/ a 'merge' or 'append' style\n //=============================================================================\n function handleHeadElement(newHeadTag, currentHead, ctx) {\n\n let added = []\n let removed = []\n let preserved = []\n let nodesToAppend = []\n\n let headMergeStyle = ctx.head.style;\n\n // put all new head elements into a Map, by their outerHTML\n let srcToNewHeadNodes = new Map();\n for (const newHeadChild of newHeadTag.children) {\n srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);\n }\n\n // for each elt in the current head\n for (const currentHeadElt of currentHead.children) {\n\n // If the current head element is in the map\n let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);\n let isReAppended = ctx.head.shouldReAppend(currentHeadElt);\n let isPreserved = ctx.head.shouldPreserve(currentHeadElt);\n if (inNewContent || isPreserved) {\n if (isReAppended) {\n // remove the current version and let the new version replace it and re-execute\n removed.push(currentHeadElt);\n } else {\n // this element already exists and should not be re-appended, so remove it from\n // the new content map, preserving it in the DOM\n srcToNewHeadNodes.delete(currentHeadElt.outerHTML);\n preserved.push(currentHeadElt);\n }\n } else {\n if (headMergeStyle === \"append\") {\n // we are appending and this existing element is not new content\n // so if and only if it is marked for re-append do we do anything\n if (isReAppended) {\n removed.push(currentHeadElt);\n nodesToAppend.push(currentHeadElt);\n }\n } else {\n // if this is a merge, we remove this content since it is not in the new head\n if (ctx.head.shouldRemove(currentHeadElt) !== false) {\n removed.push(currentHeadElt);\n }\n }\n }\n }\n\n // Push the remaining new head elements in the Map into the\n // nodes to append to the head tag\n nodesToAppend.push(...srcToNewHeadNodes.values());\n log(\"to append: \", nodesToAppend);\n\n let promises = [];\n for (const newNode of nodesToAppend) {\n log(\"adding: \", newNode);\n let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;\n log(newElt);\n if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {\n if (newElt.href || newElt.src) {\n let resolve = null;\n let promise = new Promise(function (_resolve) {\n resolve = _resolve;\n });\n newElt.addEventListener('load', function () {\n resolve();\n });\n promises.push(promise);\n }\n currentHead.appendChild(newElt);\n ctx.callbacks.afterNodeAdded(newElt);\n added.push(newElt);\n }\n }\n\n // remove all removed elements, after we have appended the new elements to avoid\n // additional network requests for things like style sheets\n for (const removedElement of removed) {\n if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {\n currentHead.removeChild(removedElement);\n ctx.callbacks.afterNodeRemoved(removedElement);\n }\n }\n\n ctx.head.afterHeadMorphed(currentHead, {added: added, kept: preserved, removed: removed});\n return promises;\n }\n\n //=============================================================================\n // Misc\n //=============================================================================\n\n function log() {\n //console.log(arguments);\n }\n\n function noOp() {\n }\n\n /*\n Deep merges the config object and the Idiomoroph.defaults object to\n produce a final configuration object\n */\n function mergeDefaults(config) {\n let finalConfig = {};\n // copy top level stuff into final config\n Object.assign(finalConfig, defaults);\n Object.assign(finalConfig, config);\n\n // copy callbacks into final config (do this to deep merge the callbacks)\n finalConfig.callbacks = {};\n Object.assign(finalConfig.callbacks, defaults.callbacks);\n Object.assign(finalConfig.callbacks, config.callbacks);\n\n // copy head config into final config (do this to deep merge the head)\n finalConfig.head = {};\n Object.assign(finalConfig.head, defaults.head);\n Object.assign(finalConfig.head, config.head);\n return finalConfig;\n }\n\n function createMorphContext(oldNode, newContent, config) {\n config = mergeDefaults(config);\n return {\n target: oldNode,\n newContent: newContent,\n config: config,\n morphStyle: config.morphStyle,\n ignoreActive: config.ignoreActive,\n ignoreActiveValue: config.ignoreActiveValue,\n idMap: createIdMap(oldNode, newContent),\n deadIds: new Set(),\n callbacks: config.callbacks,\n head: config.head\n }\n }\n\n function isIdSetMatch(node1, node2, ctx) {\n if (node1 == null || node2 == null) {\n return false;\n }\n if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) {\n if (node1.id !== \"\" && node1.id === node2.id) {\n return true;\n } else {\n return getIdIntersectionCount(ctx, node1, node2) > 0;\n }\n }\n return false;\n }\n\n function isSoftMatch(node1, node2) {\n if (node1 == null || node2 == null) {\n return false;\n }\n return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName\n }\n\n function removeNodesBetween(startInclusive, endExclusive, ctx) {\n while (startInclusive !== endExclusive) {\n let tempNode = startInclusive;\n startInclusive = startInclusive.nextSibling;\n removeNode(tempNode, ctx);\n }\n removeIdsFromConsideration(ctx, endExclusive);\n return endExclusive.nextSibling;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential id match\n // for the newChild. We stop if we find a potential id match for the new child OR\n // if the number of potential id matches we are discarding is greater than the\n // potential id matches for the new child\n //=============================================================================\n function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n // max id matches we are willing to discard in our search\n let newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);\n\n let potentialMatch = null;\n\n // only search forward if there is a possibility of an id match\n if (newChildPotentialIdCount > 0) {\n let potentialMatch = insertionPoint;\n // if there is a possibility of an id match, scan forward\n // keep track of the potential id match count we are discarding (the\n // newChildPotentialIdCount must be greater than this to make it likely\n // worth it)\n let otherMatchCount = 0;\n while (potentialMatch != null) {\n\n // If we have an id match, return the current potential match\n if (isIdSetMatch(newChild, potentialMatch, ctx)) {\n return potentialMatch;\n }\n\n // computer the other potential matches of this new content\n otherMatchCount += getIdIntersectionCount(ctx, potentialMatch, newContent);\n if (otherMatchCount > newChildPotentialIdCount) {\n // if we have more potential id matches in _other_ content, we\n // do not have a good candidate for an id match, so return null\n return null;\n }\n\n // advanced to the next old content child\n potentialMatch = potentialMatch.nextSibling;\n }\n }\n return potentialMatch;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential soft match\n // for the newChild. We stop if we find a potential soft match for the new child OR\n // if we find a potential id match in the old parents children OR if we find two\n // potential soft matches for the next two pieces of new content\n //=============================================================================\n function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n let potentialSoftMatch = insertionPoint;\n let nextSibling = newChild.nextSibling;\n let siblingSoftMatchCount = 0;\n\n while (potentialSoftMatch != null) {\n\n if (getIdIntersectionCount(ctx, potentialSoftMatch, newContent) > 0) {\n // the current potential soft match has a potential id set match with the remaining new\n // content so bail out of looking\n return null;\n }\n\n // if we have a soft match with the current node, return it\n if (isSoftMatch(newChild, potentialSoftMatch)) {\n return potentialSoftMatch;\n }\n\n if (isSoftMatch(nextSibling, potentialSoftMatch)) {\n // the next new node has a soft match with this node, so\n // increment the count of future soft matches\n siblingSoftMatchCount++;\n nextSibling = nextSibling.nextSibling;\n\n // If there are two future soft matches, bail to allow the siblings to soft match\n // so that we don't consume future soft matches for the sake of the current node\n if (siblingSoftMatchCount >= 2) {\n return null;\n }\n }\n\n // advanced to the next old content child\n potentialSoftMatch = potentialSoftMatch.nextSibling;\n }\n\n return potentialSoftMatch;\n }\n\n function parseContent(newContent) {\n let parser = new DOMParser();\n\n // remove svgs to avoid false-positive matches on head, etc.\n let contentWithSvgsRemoved = newContent.replace(/<svg(\\s[^>]*>|>)([\\s\\S]*?)<\\/svg>/gim, '');\n\n // if the newContent contains a html, head or body tag, we can simply parse it w/o wrapping\n if (contentWithSvgsRemoved.match(/<\\/html>/) || contentWithSvgsRemoved.match(/<\\/head>/) || contentWithSvgsRemoved.match(/<\\/body>/)) {\n let content = parser.parseFromString(newContent, \"text/html\");\n // if it is a full HTML document, return the document itself as the parent container\n if (contentWithSvgsRemoved.match(/<\\/html>/)) {\n content.generatedByIdiomorph = true;\n return content;\n } else {\n // otherwise return the html element as the parent container\n let htmlElement = content.firstChild;\n if (htmlElement) {\n htmlElement.generatedByIdiomorph = true;\n return htmlElement;\n } else {\n return null;\n }\n }\n } else {\n // if it is partial HTML, wrap it in a template tag to provide a parent element and also to help\n // deal with touchy tags like tr, tbody, etc.\n let responseDoc = parser.parseFromString(\"<body><template>\" + newContent + \"</template></body>\", \"text/html\");\n let content = responseDoc.body.querySelector('template').content;\n content.generatedByIdiomorph = true;\n return content\n }\n }\n\n function normalizeContent(newContent) {\n if (newContent == null) {\n // noinspection UnnecessaryLocalVariableJS\n const dummyParent = document.createElement('div');\n return dummyParent;\n } else if (newContent.generatedByIdiomorph) {\n // the template tag created by idiomorph parsing can serve as a dummy parent\n return newContent;\n } else if (newContent instanceof Node) {\n // a single node is added as a child to a dummy parent\n const dummyParent = document.createElement('div');\n dummyParent.append(newContent);\n return dummyParent;\n } else {\n // all nodes in the array or HTMLElement collection are consolidated under\n // a single dummy parent element\n const dummyParent = document.createElement('div');\n for (const elt of [...newContent]) {\n dummyParent.append(elt);\n }\n return dummyParent;\n }\n }\n\n function insertSiblings(previousSibling, morphedNode, nextSibling) {\n let stack = []\n let added = []\n while (previousSibling != null) {\n stack.push(previousSibling);\n previousSibling = previousSibling.previousSibling;\n }\n while (stack.length > 0) {\n let node = stack.pop();\n added.push(node); // push added preceding siblings on in order and insert\n morphedNode.parentElement.insertBefore(node, morphedNode);\n }\n added.push(morphedNode);\n while (nextSibling != null) {\n stack.push(nextSibling);\n added.push(nextSibling); // here we are going in order, so push on as we scan, rather than add\n nextSibling = nextSibling.nextSibling;\n }\n while (stack.length > 0) {\n morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling);\n }\n return added;\n }\n\n function findBestNodeMatch(newContent, oldNode, ctx) {\n let currentElement;\n currentElement = newContent.firstChild;\n let bestElement = currentElement;\n let score = 0;\n while (currentElement) {\n let newScore = scoreElement(currentElement, oldNode, ctx);\n if (newScore > score) {\n bestElement = currentElement;\n score = newScore;\n }\n currentElement = currentElement.nextSibling;\n }\n return bestElement;\n }\n\n function scoreElement(node1, node2, ctx) {\n if (isSoftMatch(node1, node2)) {\n return .5 + getIdIntersectionCount(ctx, node1, node2);\n }\n return 0;\n }\n\n function removeNode(tempNode, ctx) {\n removeIdsFromConsideration(ctx, tempNode)\n if (ctx.callbacks.beforeNodeRemoved(tempNode) === false) return;\n\n tempNode.remove();\n ctx.callbacks.afterNodeRemoved(tempNode);\n }\n\n //=============================================================================\n // ID Set Functions\n //=============================================================================\n\n function isIdInConsideration(ctx, id) {\n return !ctx.deadIds.has(id);\n }\n\n function idIsWithinNode(ctx, id, targetNode) {\n let idSet = ctx.idMap.get(targetNode) || EMPTY_SET;\n return idSet.has(id);\n }\n\n function removeIdsFromConsideration(ctx, node) {\n let idSet = ctx.idMap.get(node) || EMPTY_SET;\n for (const id of idSet) {\n ctx.deadIds.add(id);\n }\n }\n\n function getIdIntersectionCount(ctx, node1, node2) {\n let sourceSet = ctx.idMap.get(node1) || EMPTY_SET;\n let matchCount = 0;\n for (const id of sourceSet) {\n // a potential match is an id in the source and potentialIdsSet, but\n // that has not already been merged into the DOM\n if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {\n ++matchCount;\n }\n }\n return matchCount;\n }\n\n /**\n * A bottom up algorithm that finds all elements with ids inside of the node\n * argument and populates id sets for those nodes and all their parents, generating\n * a set of ids contained within all nodes for the entire hierarchy in the DOM\n *\n * @param node {Element}\n * @param {Map<Node, Set<String>>} idMap\n */\n function populateIdMapForNode(node, idMap) {\n let nodeParent = node.parentElement;\n // find all elements with an id property\n let idElements = node.querySelectorAll('[id]');\n for (const elt of idElements) {\n let current = elt;\n // walk up the parent hierarchy of that element, adding the id\n // of element to the parent's id set\n while (current !== nodeParent && current != null) {\n let idSet = idMap.get(current);\n // if the id set doesn't exist, create it and insert it in the map\n if (idSet == null) {\n idSet = new Set();\n idMap.set(current, idSet);\n }\n idSet.add(elt.id);\n current = current.parentElement;\n }\n }\n }\n\n /**\n * This function computes a map of nodes to all ids contained within that node (inclusive of the\n * node). This map can be used to ask if two nodes have intersecting sets of ids, which allows\n * for a looser definition of \"matching\" than tradition id matching, and allows child nodes\n * to contribute to a parent nodes matching.\n *\n * @param {Element} oldContent the old content that will be morphed\n * @param {Element} newContent the new content to morph to\n * @returns {Map<Node, Set<String>>} a map of nodes to id sets for the\n */\n function createIdMap(oldContent, newContent) {\n let idMap = new Map();\n populateIdMapForNode(oldContent, idMap);\n populateIdMapForNode(newContent, idMap);\n return idMap;\n }\n\n //=============================================================================\n // This is what ends up becoming the Idiomorph global object\n //=============================================================================\n return {\n morph,\n defaults\n }\n })();\n\nexport {Idiomorph};\n", "import { Idiomorph } from 'idiomorph'\n\nconst input = /INPUT/i\nconst inputTypes = /date|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/i\nconst textarea = /TEXTAREA/i\n\nconst morphAllowed = node => {\n if (node.nodeType !== Node.ELEMENT_NODE) return true\n if (node !== document.activeElement) return true\n\n // don't morph active textarea\n if (node.tagName.match(textarea)) return false\n\n // don't morph active inputs\n return node.tagName.match(input) && node.getAttribute('type').match(inputTypes)\n}\n\nconst callbacks = {\n beforeNodeMorphed: (oldNode, _newNode) => morphAllowed(oldNode)\n}\n\nexport default function morph(element, html) {\n Idiomorph.morph(element, html, { callbacks })\n}\n", "import morph from './morph'\n\nexport const invokeEvents = {\n before: 'turbo-boost:stream:before-invoke',\n after: 'turbo-boost:stream:after-invoke',\n finish: 'turbo-boost:stream:finish-invoke'\n}\n\n// Invokes the callback on a single receiver with before/after events\nfunction withInvokeEvents(receiver, detail, callback) {\n const { object, target } = receiver\n detail = detail || {}\n detail = { ...detail, object: receiver.object }\n const options = { detail, bubbles: true }\n\n target.dispatchEvent(new CustomEvent(invokeEvents.before, options))\n\n // the before event can provide invoke instructions my modifying the event detail\n // For example, { delay: 1000 } will delay the invocation by 1000ms\n let { delay } = detail.invoke || {}\n delay = delay || 0\n\n const execute = () => {\n const result = callback(object)\n options.detail.result = result\n target.dispatchEvent(new CustomEvent(invokeEvents.after, options))\n\n let promise\n if (result instanceof Animation) promise = result.finished\n if (result instanceof Promise) promise = result\n\n if (promise)\n promise.then(\n () => {\n options.detail.promise = 'fulfilled'\n target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n },\n () => {\n options.detail.promise = 'rejected'\n target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n }\n )\n else target.dispatchEvent(new CustomEvent(invokeEvents.finish, options))\n }\n\n if (delay > 0) setTimeout(execute, delay)\n else execute()\n}\n\nfunction invokeDispatchEvent(method, args, receivers) {\n const eventName = args[0]\n const eventOptions = args[1]\n const detail = { method, eventName, eventOptions }\n receivers.forEach(receiver =>\n withInvokeEvents(receiver, detail, object =>\n object.dispatchEvent(new CustomEvent(eventName, eventOptions))\n )\n )\n}\n\nfunction invokeMorph(method, args, receivers) {\n const html = args[0]\n const detail = { method, html }\n receivers.forEach(receiver => withInvokeEvents(receiver, detail, object => morph(object, html)))\n}\n\nfunction invokeAssignment(method, args, receivers) {\n const property = method.slice(0, -1).trim()\n const value = args[0]\n const detail = { method, property, value }\n receivers.forEach(receiver => withInvokeEvents(receiver, detail, object => (object[property] = value)))\n}\n\nfunction invokeMethod(method, args, receivers) {\n const detail = { method, args }\n receivers.forEach(receiver =>\n withInvokeEvents(receiver, detail, object => object[method].apply(object, args))\n )\n}\n\n// Performs an invocation on all receivers for the given method and args\nfunction performInvoke(method, args, receivers) {\n // dispatch ................................................................................................\n if (method.match(/^dispatch(Event)?$/)) return invokeDispatchEvent(method, args, receivers)\n\n // morph ...................................................................................................\n if (method.match(/^morph|mutate$/)) return invokeMorph(method, args, receivers)\n\n // assignment ..............................................................................................\n if (method.endsWith('=')) return invokeAssignment(method, args, receivers)\n\n // method ..................................................................................................\n return invokeMethod(method, args, receivers)\n}\n\nexport function invoke() {\n const payload = JSON.parse(this.templateContent.textContent)\n const { id, selector, receiver, method, args, delay } = payload\n let receivers = [{ object: self, target: self }]\n if (selector)\n receivers = Array.from(document.querySelectorAll(selector)).map(el => ({\n object: el,\n target: el\n }))\n\n if (receiver) {\n receivers = receivers.map(r => {\n let { object, target } = r\n const chain = receiver.split('.')\n while (chain.length > 0) {\n object = object[chain.shift()]\n if (object.dispatchEvent) target = object\n }\n return { object, target }\n })\n }\n\n if (delay > 0) setTimeout(() => performInvoke(method, args, receivers), delay)\n else performInvoke(method, args, receivers)\n}\n", "import VERSION from './version'\nimport { invoke, invokeEvents } from './invoke'\n\nif (!self['Turbo'])\n throw new Error(\n '`Turbo` is not defined! Be sure to import `@turbo-boost/streams` after `@hotwired/turbo` or `@hotwired/turbo-rails`.'\n )\n\nif (!Turbo['StreamActions'])\n throw new Error(\n '`Turbo.StreamActions` is not defined! Verify that you are running >= `7.2.0` of `@hotwired/turbo`.'\n )\n\nTurbo.StreamActions.invoke = invoke\nself.TurboBoost = self.TurboBoost || {}\nself.TurboBoost.Streams = { invoke, invokeEvents, VERSION }\n\nconsole.info('@turbo-boost/streams has initialized and registered new stream actions with Turbo.')\n\nexport default self.TurboBoost.Streams\n"],
5
+ "mappings": "ubAAA,IAAOA,EAAQ,QCCf,IAAIC,EAAa,UAAY,CACrB,aAKA,IAAIC,EAAY,IAAI,IAGhBC,EAAW,CACX,WAAY,YACZ,UAAY,CACR,gBAAiBC,EACjB,eAAgBA,EAChB,kBAAmBA,EACnB,iBAAkBA,EAClB,kBAAmBA,EACnB,iBAAkBA,EAClB,uBAAwBA,CAE5B,EACA,KAAM,CACF,MAAO,QACP,eAAgB,SAAUC,EAAK,CAC3B,OAAOA,EAAI,aAAa,aAAa,IAAM,MAC/C,EACA,eAAgB,SAAUA,EAAK,CAC3B,OAAOA,EAAI,aAAa,cAAc,IAAM,MAChD,EACA,aAAcD,EACd,iBAAkBA,CACtB,CACJ,EAKA,SAASE,EAAMC,EAASC,EAAYC,EAAS,CAAC,EAAG,CAEzCF,aAAmB,WACnBA,EAAUA,EAAQ,iBAGlB,OAAOC,GAAe,WACtBA,EAAaE,EAAaF,CAAU,GAGxC,IAAIG,EAAoBC,EAAiBJ,CAAU,EAE/CK,EAAMC,EAAmBP,EAASI,EAAmBF,CAAM,EAE/D,OAAOM,EAAuBR,EAASI,EAAmBE,CAAG,CACjE,CAEA,SAASE,EAAuBR,EAASS,EAAsBH,EAAK,CAChE,GAAIA,EAAI,KAAK,MAAO,CAChB,IAAII,EAAUV,EAAQ,cAAc,MAAM,EACtCW,EAAUF,EAAqB,cAAc,MAAM,EACvD,GAAIC,GAAWC,EAAS,CACpB,IAAIC,EAAWC,EAAkBF,EAASD,EAASJ,CAAG,EAEtD,QAAQ,IAAIM,CAAQ,EAAE,KAAK,UAAY,CACnCJ,EAAuBR,EAASS,EAAsB,OAAO,OAAOH,EAAK,CACrE,KAAM,CACF,MAAO,GACP,OAAQ,EACZ,CACJ,CAAC,CAAC,CACN,CAAC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,CAAS,EAAGP,CAAK,EACxEiB,EAAcZ,EAAQC,EAAMC,CAAS,CAC5C,CCpHA,GAAI,CAAC,KAAK,MACR,MAAM,IAAI,MACR,sHACF,EAEF,GAAI,CAAC,MAAM,cACT,MAAM,IAAI,MACR,oGACF,EAEF,MAAM,cAAc,OAASkB,EAC7B,KAAK,WAAa,KAAK,YAAc,CAAC,EACtC,KAAK,WAAW,QAAU,CAAE,OAAAA,EAAQ,aAAAC,EAAc,QAAAC,CAAQ,EAE1D,QAAQ,KAAK,oFAAoF,EAEjG,IAAOC,GAAQ,KAAK,WAAW",
6
+ "names": ["version_default", "Idiomorph", "EMPTY_SET", "defaults", "noOp", "elt", "morph", "oldNode", "newContent", "config", "parseContent", "normalizedContent", "normalizeContent", "ctx", "createMorphContext", "morphNormalizedContent", "normalizedNewContent", "oldHead", "newHead", "promises", "handleHeadElement", "morphChildren", "bestMatch", "findBestNodeMatch", "previousSibling", "nextSibling", "morphedNode", "morphOldNodeTo", "insertSiblings", "ignoreValueOfActiveElement", "possibleActiveElement", "isSoftMatch", "syncNodeFrom", "newParent", "oldParent", "nextNewChild", "insertionPoint", "newChild", "removeIdsFromConsideration", "isIdSetMatch", "idSetMatch", "findIdSetMatch", "removeNodesBetween", "softMatch", "findSoftMatch", "tempNode", "removeNode", "ignoreAttribute", "attr", "to", "updateType", "from", "type", "fromAttributes", "toAttributes", "fromAttribute", "i", "toAttribute", "syncInputValue", "syncBooleanAttribute", "attributeName", "ignoreUpdate", "fromValue", "toValue", "newHeadTag", "currentHead", "added", "removed", "preserved", "nodesToAppend", "headMergeStyle", "srcToNewHeadNodes", "newHeadChild", "currentHeadElt", "inNewContent", "isReAppended", "isPreserved", "newNode", "newElt", "resolve", "promise", "_resolve", "removedElement", "log", "mergeDefaults", "finalConfig", "createIdMap", "node1", "node2", "getIdIntersectionCount", "startInclusive", "endExclusive", "newChildPotentialIdCount", "potentialMatch", "otherMatchCount", "potentialSoftMatch", "siblingSoftMatchCount", "parser", "contentWithSvgsRemoved", "content", "htmlElement", "dummyParent", "stack", "node", "currentElement", "bestElement", "score", "newScore", "scoreElement", "isIdInConsideration", "id", "idIsWithinNode", "targetNode", "idSet", "sourceSet", "matchCount", "populateIdMapForNode", "idMap", "nodeParent", "idElements", "current", "oldContent", "input", "inputTypes", "textarea", "morphAllowed", "node", "callbacks", "oldNode", "_newNode", "morph", "element", "html", "Idiomorph", "invokeEvents", "withInvokeEvents", "receiver", "detail", "callback", "object", "target", "__spreadProps", "__spreadValues", "options", "delay", "execute", "result", "promise", "invokeDispatchEvent", "method", "args", "receivers", "eventName", "eventOptions", "invokeMorph", "html", "morph", "invokeAssignment", "property", "value", "invokeMethod", "performInvoke", "invoke", "payload", "id", "selector", "el", "r", "chain", "invoke", "invokeEvents", "version_default", "javascript_default"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ import VERSION from './version'
1
2
  import { invoke, invokeEvents } from './invoke'
2
3
 
3
4
  if (!self['Turbo'])
@@ -12,7 +13,7 @@ if (!Turbo['StreamActions'])
12
13
 
13
14
  Turbo.StreamActions.invoke = invoke
14
15
  self.TurboBoost = self.TurboBoost || {}
15
- self.TurboBoost.Streams = { invoke, invokeEvents }
16
+ self.TurboBoost.Streams = { invoke, invokeEvents, VERSION }
16
17
 
17
18
  console.info('@turbo-boost/streams has initialized and registered new stream actions with Turbo.')
18
19
 
@@ -1,22 +1,24 @@
1
- import alpine from 'alpinejs'
2
- import alpineMorph from '@alpinejs/morph'
3
-
4
- alpine.plugin(alpineMorph)
1
+ import { Idiomorph } from 'idiomorph'
5
2
 
6
3
  const input = /INPUT/i
7
4
  const inputTypes = /date|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/i
8
5
  const textarea = /TEXTAREA/i
9
6
 
10
- function updating(el, toEl, childrenOnly, skip) {
11
- if (el.nodeType !== Node.ELEMENT_NODE) return
12
- if (el !== document.activeElement) return
7
+ const morphAllowed = node => {
8
+ if (node.nodeType !== Node.ELEMENT_NODE) return true
9
+ if (node !== document.activeElement) return true
10
+
11
+ // don't morph active textarea
12
+ if (node.tagName.match(textarea)) return false
13
13
 
14
- const protect =
15
- el.tagName.match(textarea) || (el.tagName.match(input) && el.getAttribute('type').match(inputTypes))
14
+ // don't morph active inputs
15
+ return node.tagName.match(input) && node.getAttribute('type').match(inputTypes)
16
+ }
16
17
 
17
- if (protect) return skip()
18
+ const callbacks = {
19
+ beforeNodeMorphed: (oldNode, _newNode) => morphAllowed(oldNode)
18
20
  }
19
21
 
20
22
  export default function morph(element, html) {
21
- alpine.morph(element, html, { updating })
23
+ Idiomorph.morph(element, html, { callbacks })
22
24
  }
@@ -0,0 +1 @@
1
+ export default '0.1.9'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TurboBoost
4
4
  module Streams
5
- VERSION = "0.1.7"
5
+ VERSION = "0.1.9"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_boost-streams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hopkins (hopsoft)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-13 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -312,6 +312,7 @@ files:
312
312
  - app/javascript/index.js
313
313
  - app/javascript/invoke.js
314
314
  - app/javascript/morph.js
315
+ - app/javascript/version.js
315
316
  - app/jobs/turbo_boost/streams/broadcast_invoke_job.rb
316
317
  - lib/turbo_boost/streams.rb
317
318
  - lib/turbo_boost/streams/engine.rb