n8n-demo-component
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
var v;u.finalized=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==l||l({ReactiveElement:u}),(null!==(n=globalThis.reactiveElementVersions)&&void 0!==n?n:globalThis.reactiveElementVersions=[]).push("1.2.1");const f=globalThis.trustedTypes,w=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,p=`lit$${(Math.random()+"").slice(9)}$`,m="?"+p,g=`<${m}>`,b=document,y=(t="")=>b.createComment(t),_=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,k=/-->/g,x=/>/g,A=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,C=/'/g,E=/"/g,M=/^(?:script|style|textarea)$/i,O=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),T=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),N=new WeakMap,U=b.createTreeWalker(b,129,null,!1),z=(t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=S;for(let i=0;i<s;i++){const s=t[i];let h,l,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,l=r.exec(s),null!==l);)a=r.lastIndex,r===S?"!--"===l[1]?r=k:void 0!==l[1]?r=x:void 0!==l[2]?(M.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=A):void 0!==l[3]&&(r=A):r===A?">"===l[0]?(r=null!=o?o:S,d=-1):void 0===l[1]?d=-2:(d=r.lastIndex-l[2].length,h=l[1],r=void 0===l[3]?A:'"'===l[3]?E:C):r===E||r===C?r=A:r===k||r===x?r=S:(r=A,o=void 0);const c=r===A&&t[i+1].startsWith("/>")?" ":"";n+=r===S?s+g:d>=0?(e.push(h),s.slice(0,d)+"$lit$"+s.slice(d)+p+c):s+p+(-2===d?(e.push(void 0),i):c)}const h=n+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==w?w.createHTML(h):h,e]};class R{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,h=this.parts,[l,d]=z(t,i);if(this.el=R.createElement(l,s),U.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=U.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(p)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+"$lit$").split(p),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?L:"?"===i[1]?B:"@"===i[1]?W:P})}else h.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(M.test(e.tagName)){const t=e.textContent.split(p),i=t.length-1;if(i>0){e.textContent=f?f.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],y()),U.nextNode(),h.push({type:2,index:++o});e.append(t[i],y())}}}else if(8===e.nodeType)if(e.data===m)h.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf(p,t+1));)h.push({type:7,index:o}),t+=p.length-1}o++}}static createElement(t,i){const s=b.createElement("template");return s.innerHTML=t,s}}function D(t,i,s=t,e){var o,n,r,h;if(i===T)return i;let l=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const d=_(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==d&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===d?l=void 0:(l=new d(t),l._$AT(t,s,e)),void 0!==e?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[e]=l:s._$Cu=l),void 0!==l&&(i=D(t,l._$AS(t,i.values),l,e)),i}class J{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:b).importNode(s,!0);U.currentNode=o;let n=U.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new I(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new H(n,this,t)),this.v.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=U.nextNode(),r++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class I{constructor(t,i,s,e){var o;this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=D(this,t,i),_(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==T&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var i;return $(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==j&&_(this._$AH)?this._$AA.nextSibling.data=t:this.S(b.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=R.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new J(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=N.get(t.strings);return void 0===i&&N.set(t.strings,i=new R(t)),i}A(t){$(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new I(this.M(y()),this.M(y()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class P{constructor(t,i,s,e,o){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=j}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=D(this,t,i,0),n=!_(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else{const e=t;let r,h;for(t=o[0],r=0;r<o.length-1;r++)h=D(this,e[s+r],i,r),h===T&&(h=this._$AH[r]),n||(n=!_(h)||h!==this._$AH[r]),h===j?t=j:t!==j&&(t+=(null!=h?h:"")+o[r+1]),this._$AH[r]=h}n&&!e&&this.k(t)}k(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class L extends P{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===j?void 0:t}}const V=f?f.emptyScript:"";class B extends P{constructor(){super(...arguments),this.type=4}k(t){t&&t!==j?this.element.setAttribute(this.name,V):this.element.removeAttribute(this.name)}}class W extends P{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=D(this,t,i,0))&&void 0!==s?s:j)===T)return;const e=this._$AH,o=t===j&&e!==j||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==j&&(e===j||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class H{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){D(this,t)}}const K=window.litHtmlPolyfillSupport; | ||
var v;u.finalized=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==l||l({ReactiveElement:u}),(null!==(n=globalThis.reactiveElementVersions)&&void 0!==n?n:globalThis.reactiveElementVersions=[]).push("1.2.1");const f=globalThis.trustedTypes,p=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,w=`lit$${(Math.random()+"").slice(9)}$`,m="?"+w,g=`<${m}>`,b=document,y=(t="")=>b.createComment(t),_=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,k=/-->/g,x=/>/g,A=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,C=/'/g,E=/"/g,M=/^(?:script|style|textarea)$/i,O=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),T=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),N=new WeakMap,U=b.createTreeWalker(b,129,null,!1),z=(t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=S;for(let i=0;i<s;i++){const s=t[i];let h,l,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,l=r.exec(s),null!==l);)a=r.lastIndex,r===S?"!--"===l[1]?r=k:void 0!==l[1]?r=x:void 0!==l[2]?(M.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=A):void 0!==l[3]&&(r=A):r===A?">"===l[0]?(r=null!=o?o:S,d=-1):void 0===l[1]?d=-2:(d=r.lastIndex-l[2].length,h=l[1],r=void 0===l[3]?A:'"'===l[3]?E:C):r===E||r===C?r=A:r===k||r===x?r=S:(r=A,o=void 0);const c=r===A&&t[i+1].startsWith("/>")?" ":"";n+=r===S?s+g:d>=0?(e.push(h),s.slice(0,d)+"$lit$"+s.slice(d)+w+c):s+w+(-2===d?(e.push(void 0),i):c)}const h=n+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==p?p.createHTML(h):h,e]};class R{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,h=this.parts,[l,d]=z(t,i);if(this.el=R.createElement(l,s),U.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=U.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(w)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+"$lit$").split(w),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?L:"?"===i[1]?B:"@"===i[1]?W:P})}else h.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(M.test(e.tagName)){const t=e.textContent.split(w),i=t.length-1;if(i>0){e.textContent=f?f.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],y()),U.nextNode(),h.push({type:2,index:++o});e.append(t[i],y())}}}else if(8===e.nodeType)if(e.data===m)h.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf(w,t+1));)h.push({type:7,index:o}),t+=w.length-1}o++}}static createElement(t,i){const s=b.createElement("template");return s.innerHTML=t,s}}function D(t,i,s=t,e){var o,n,r,h;if(i===T)return i;let l=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const d=_(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==d&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===d?l=void 0:(l=new d(t),l._$AT(t,s,e)),void 0!==e?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[e]=l:s._$Cu=l),void 0!==l&&(i=D(t,l._$AS(t,i.values),l,e)),i}class J{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:b).importNode(s,!0);U.currentNode=o;let n=U.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new I(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new H(n,this,t)),this.v.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=U.nextNode(),r++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class I{constructor(t,i,s,e){var o;this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=D(this,t,i),_(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==T&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var i;return $(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==j&&_(this._$AH)?this._$AA.nextSibling.data=t:this.S(b.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=R.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new J(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=N.get(t.strings);return void 0===i&&N.set(t.strings,i=new R(t)),i}A(t){$(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new I(this.M(y()),this.M(y()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class P{constructor(t,i,s,e,o){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=j}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=D(this,t,i,0),n=!_(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else{const e=t;let r,h;for(t=o[0],r=0;r<o.length-1;r++)h=D(this,e[s+r],i,r),h===T&&(h=this._$AH[r]),n||(n=!_(h)||h!==this._$AH[r]),h===j?t=j:t!==j&&(t+=(null!=h?h:"")+o[r+1]),this._$AH[r]=h}n&&!e&&this.k(t)}k(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class L extends P{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===j?void 0:t}}const V=f?f.emptyScript:"";class B extends P{constructor(){super(...arguments),this.type=4}k(t){t&&t!==j?this.element.setAttribute(this.name,V):this.element.removeAttribute(this.name)}}class W extends P{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=D(this,t,i,0))&&void 0!==s?s:j)===T)return;const e=this._$AH,o=t===j&&e!==j||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==j&&(e===j||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class H{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){D(this,t)}}const K=window.litHtmlPolyfillSupport; | ||
/** | ||
@@ -57,3 +57,3 @@ * @license | ||
*/ | ||
const st=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}{constructor(t){var i;if(super(t),t.type!==it||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(t,[i]){var s,e;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(i)}const o=t.element.classList;this.st.forEach((t=>{t in i||(o.remove(t),this.st.delete(t))}));for(const t in i){const s=!!i[t];s===this.st.has(t)||(null===(e=this.et)||void 0===e?void 0:e.has(t))||(s?(o.add(t),this.st.add(t)):(o.remove(t),this.st.delete(t)))}return T}});var et=function(t,i,s,e){for(var o,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,h=t.length-1;h>=0;h--)(o=t[h])&&(r=(n<3?o(r):n>3?o(i,s,r):o(i,s))||r);return n>3&&r&&Object.defineProperty(i,s,r),r};let ot=class extends F{constructor(){super(...arguments),this.workflow="{}",this.frame=!1,this.src="https://n8n-test3.herokuapp.com/workflows/demo",this.showCode=!1,this.showPreview=!0,this.nodeView=!1,this.insideIframe=!1,this.scrollX=0,this.scrollY=0}onDocumentScroll(){this.insideIframe&&window.scrollTo(this.scrollX,this.scrollY)}loadWorkflow(){try{const t=JSON.parse(this.workflow);if(!t)throw new Error("Missing workflow");if(!t.nodes||!Array.isArray(t.nodes))throw new Error("Must have an array of nodes");const i=this.shadowRoot.getElementById("int_iframe");throw i.contentWindow&&i.contentWindow.postMessage(JSON.stringify({command:"openWorkflow",workflow:t}),"*"),new Error("Must have an array of nodes")}catch(t){this.showPreview=!1}}toggleCode(){this.showCode=!this.showCode}onMouseEnter(){this.insideIframe=!0,this.scrollX=window.scrollX,this.scrollY=window.scrollY}onMouseLeave(){this.insideIframe=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("message",(({data:t})=>{try{const i=JSON.parse(t);"n8nReady"===i.command?this.loadWorkflow():"openNDV"===i.command?this.nodeView=!0:"closeNDV"===i.command?this.nodeView=!1:"error"===i.command&&(this.showPreview=!1)}catch(t){this.nodeView=!1}})),document.addEventListener("scroll",this.onDocumentScroll)}disconnectedCallback(){document.removeEventListener("scroll",this.onDocumentScroll),super.disconnectedCallback()}render(){return O` | ||
const st=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}{constructor(t){var i;if(super(t),t.type!==it||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(t,[i]){var s,e;if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.et=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!(null===(s=this.et)||void 0===s?void 0:s.has(t))&&this.st.add(t);return this.render(i)}const o=t.element.classList;this.st.forEach((t=>{t in i||(o.remove(t),this.st.delete(t))}));for(const t in i){const s=!!i[t];s===this.st.has(t)||(null===(e=this.et)||void 0===e?void 0:e.has(t))||(s?(o.add(t),this.st.add(t)):(o.remove(t),this.st.delete(t)))}return T}});var et=function(t,i,s,e){for(var o,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,h=t.length-1;h>=0;h--)(o=t[h])&&(r=(n<3?o(r):n>3?o(i,s,r):o(i,s))||r);return n>3&&r&&Object.defineProperty(i,s,r),r};let ot=class extends F{constructor(){super(...arguments),this.workflow="{}",this.frame=!1,this.src="https://n8n-test3.herokuapp.com/workflows/demo",this.showCode=!1,this.showPreview=!0,this.nodeView=!1,this.insideIframe=!1,this.scrollX=0,this.scrollY=0}onDocumentScroll(){this.insideIframe&&window.scrollTo(this.scrollX,this.scrollY)}loadWorkflow(){const t=JSON.parse(this.workflow);if(!t)throw new Error("Missing workflow");if(!t.nodes||!Array.isArray(t.nodes))throw new Error("Must have an array of nodes");const i=this.shadowRoot.getElementById("int_iframe");i.contentWindow&&i.contentWindow.postMessage(JSON.stringify({command:"openWorkflow",workflow:t}),"*")}toggleCode(){this.showCode=!this.showCode}onMouseEnter(){this.insideIframe=!0,this.scrollX=window.scrollX,this.scrollY=window.scrollY}onMouseLeave(){this.insideIframe=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("message",(({data:t})=>{console.log(t);try{const i=JSON.parse(t);"n8nReady"===i.command?(this.loadWorkflow(),this.showPreview=!0):"openNDV"===i.command?this.nodeView=!0:"closeNDV"===i.command?this.nodeView=!1:"error"===i.command&&(this.showPreview=!1)}catch(t){this.nodeView=!1}})),document.addEventListener("scroll",this.onDocumentScroll)}disconnectedCallback(){document.removeEventListener("scroll",this.onDocumentScroll),super.disconnectedCallback()}render(){return O` | ||
<div | ||
@@ -71,3 +71,3 @@ class="embedded_workflow" | ||
<div class="embedded_tip_error" ?hidden=${this.showPreview}> | ||
something went wrong, unable to preview workflow at the moment | ||
something went wrong, unable to preview workflow at the moment | ||
</div> | ||
@@ -89,3 +89,3 @@ <div class="embedded_tip" ?hidden=${!this.frame}> | ||
background-color: var(--n8n-json-background-color, hsl(228, 9.6%, 79.6%)); | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
font-size: 0.9em; | ||
@@ -103,27 +103,21 @@ color: hsl(0, 100%, 0%); | ||
padding: 10px; | ||
background-color: var( | ||
--n8n-frame-background-color, | ||
hsl(260, 11%, 95%) | ||
); | ||
background-color: var(--n8n-frame-background-color, hsl(260, 11%, 95%)); | ||
} | ||
.embedded_workflow .embedded_tip_error { | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow .embedded_tip { | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow_iframe { | ||
width: 100%; | ||
min-height: var( | ||
--n8n-workflow-min-height, | ||
300px | ||
); | ||
min-height: var(--n8n-workflow-min-height, 300px); | ||
border: 0; | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
} | ||
@@ -130,0 +124,0 @@ .embedded_workflow_iframe_node_view { |
@@ -29,23 +29,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
loadWorkflow() { | ||
try { | ||
const workflow = JSON.parse(this.workflow); | ||
// Workflow Check | ||
if (!workflow) { | ||
throw new Error('Missing workflow'); | ||
} | ||
if (!workflow.nodes || !Array.isArray(workflow.nodes)) { | ||
throw new Error('Must have an array of nodes'); | ||
} | ||
const iframe = this.shadowRoot.getElementById('int_iframe'); | ||
// set workflow in canvas | ||
if (iframe.contentWindow) { | ||
iframe.contentWindow.postMessage(JSON.stringify({ | ||
command: 'openWorkflow', | ||
workflow, | ||
}), '*'); | ||
} | ||
const workflow = JSON.parse(this.workflow); | ||
// Workflow Check | ||
if (!workflow) { | ||
throw new Error('Missing workflow'); | ||
} | ||
if (!workflow.nodes || !Array.isArray(workflow.nodes)) { | ||
throw new Error('Must have an array of nodes'); | ||
} | ||
catch (e) { | ||
this.showPreview = false; | ||
const iframe = this.shadowRoot.getElementById('int_iframe'); | ||
// set workflow in canvas | ||
if (iframe.contentWindow) { | ||
iframe.contentWindow.postMessage(JSON.stringify({ | ||
command: 'openWorkflow', | ||
workflow, | ||
}), '*'); | ||
} | ||
@@ -67,2 +61,3 @@ } | ||
window.addEventListener('message', ({ data }) => { | ||
console.log(data); | ||
try { | ||
@@ -72,2 +67,3 @@ const json = JSON.parse(data); | ||
this.loadWorkflow(); | ||
this.showPreview = true; | ||
} | ||
@@ -113,3 +109,3 @@ else if (json.command === 'openNDV') { | ||
<div class="embedded_tip_error" ?hidden=${this.showPreview}> | ||
something went wrong, unable to preview workflow at the moment | ||
something went wrong, unable to preview workflow at the moment | ||
</div> | ||
@@ -134,3 +130,3 @@ <div class="embedded_tip" ?hidden=${!this.frame}> | ||
background-color: var(--n8n-json-background-color, hsl(228, 9.6%, 79.6%)); | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
font-size: 0.9em; | ||
@@ -148,27 +144,21 @@ color: hsl(0, 100%, 0%); | ||
padding: 10px; | ||
background-color: var( | ||
--n8n-frame-background-color, | ||
hsl(260, 11%, 95%) | ||
); | ||
background-color: var(--n8n-frame-background-color, hsl(260, 11%, 95%)); | ||
} | ||
.embedded_workflow .embedded_tip_error { | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow .embedded_tip { | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow_iframe { | ||
width: 100%; | ||
min-height: var( | ||
--n8n-workflow-min-height, | ||
300px | ||
); | ||
min-height: var(--n8n-workflow-min-height, 300px); | ||
border: 0; | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
} | ||
@@ -175,0 +165,0 @@ .embedded_workflow_iframe_node_view { |
{ | ||
"name": "n8n-demo-component", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "web component for workflow previews", | ||
@@ -5,0 +5,0 @@ "main": "n8n-demo.js", |
@@ -38,25 +38,25 @@ import {LitElement, html, css} from 'lit'; | ||
loadWorkflow() { | ||
const workflow = JSON.parse(this.workflow); | ||
const workflow = JSON.parse(this.workflow); | ||
// Workflow Check | ||
if (!workflow) { | ||
throw new Error('Missing workflow'); | ||
} | ||
if (!workflow.nodes || !Array.isArray(workflow.nodes)) { | ||
throw new Error('Must have an array of nodes'); | ||
} | ||
const iframe = this.shadowRoot!.getElementById( | ||
'int_iframe' | ||
) as HTMLIFrameElement; | ||
// Workflow Check | ||
if (!workflow) { | ||
throw new Error('Missing workflow'); | ||
} | ||
if (!workflow.nodes || !Array.isArray(workflow.nodes)) { | ||
throw new Error('Must have an array of nodes'); | ||
} | ||
const iframe = this.shadowRoot!.getElementById( | ||
'int_iframe' | ||
) as HTMLIFrameElement; | ||
// set workflow in canvas | ||
if (iframe.contentWindow) { | ||
iframe.contentWindow.postMessage( | ||
JSON.stringify({ | ||
command: 'openWorkflow', | ||
workflow, | ||
}), | ||
'*' | ||
); | ||
} | ||
// set workflow in canvas | ||
if (iframe.contentWindow) { | ||
iframe.contentWindow.postMessage( | ||
JSON.stringify({ | ||
command: 'openWorkflow', | ||
workflow, | ||
}), | ||
'*' | ||
); | ||
} | ||
} | ||
@@ -84,3 +84,3 @@ | ||
background-color: var(--n8n-json-background-color, hsl(228, 9.6%, 79.6%)); | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
font-size: 0.9em; | ||
@@ -98,27 +98,21 @@ color: hsl(0, 100%, 0%); | ||
padding: 10px; | ||
background-color: var( | ||
--n8n-frame-background-color, | ||
hsl(260, 11%, 95%) | ||
); | ||
background-color: var(--n8n-frame-background-color, hsl(260, 11%, 95%)); | ||
} | ||
.embedded_workflow .embedded_tip_error { | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 100%, 50%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow .embedded_tip { | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
margin-top: 10px; | ||
color: hsl(0, 0%, 40%); | ||
text-align: center; | ||
font-size: 0.9em; | ||
} | ||
.embedded_workflow_iframe { | ||
width: 100%; | ||
min-height: var( | ||
--n8n-workflow-min-height, | ||
300px | ||
); | ||
min-height: var(--n8n-workflow-min-height, 300px); | ||
border: 0; | ||
border-radius : 5px; | ||
border-radius: 5px; | ||
} | ||
@@ -138,21 +132,21 @@ .embedded_workflow_iframe_node_view { | ||
window.addEventListener('message', ({data}) => { | ||
console.log(data); | ||
try { | ||
const json = JSON.parse(data); | ||
if (json.command === 'n8nReady') { | ||
this.loadWorkflow(); | ||
this.showPreview = true; | ||
} else if (json.command === 'openNDV') { | ||
// expand iframe | ||
this.nodeView = true; | ||
} else if (json.command === 'closeNDV') { | ||
// close iframe | ||
this.nodeView = false; | ||
} else if (json.command === 'error') { | ||
this.showPreview = false; | ||
} | ||
} catch (e) { | ||
console.log(data); | ||
try { | ||
const json = JSON.parse(data); | ||
if (json.command === 'n8nReady') { | ||
this.loadWorkflow(); | ||
this.showPreview = true; | ||
} else if (json.command === 'openNDV') { | ||
// expand iframe | ||
this.nodeView = true; | ||
} else if (json.command === 'closeNDV') { | ||
// close iframe | ||
this.nodeView = false; | ||
} else if (json.command === 'error') { | ||
//this.showPreview = false; | ||
} | ||
}); | ||
} catch (e) { | ||
this.nodeView = false; | ||
} | ||
}); | ||
document.addEventListener('scroll', this.onDocumentScroll); | ||
@@ -183,3 +177,3 @@ } | ||
<div class="embedded_tip_error" ?hidden=${this.showPreview}> | ||
something went wrong, unable to preview workflow at the moment | ||
something went wrong, unable to preview workflow at the moment | ||
</div> | ||
@@ -186,0 +180,0 @@ <div class="embedded_tip" ?hidden=${!this.frame}> |
3523689
5374