@syncify/cli 1.0.0-alpha.1 → 1.0.0-unstable.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/api.js +36 -0
- package/dist/cli.js +630 -0
- package/dist/index.d.ts +733 -284
- package/dist/index.js +18 -0
- package/dist/syncify.js +21907 -0
- package/hot.js.liquid +14 -0
- package/package.json +75 -70
- package/readme.md +93 -51
- package/scripts/postinstall.js +116 -0
- package/scripts/postversion.js +60 -0
- package/dist/index.d.cts +0 -1815
- package/pnpm-lock.yaml +0 -17544
- package/scripts/hot.js.liquid +0 -25
package/scripts/hot.js.liquid
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
{%- liquid
|
2
|
-
# !! SYNCIFY HOT CLIENT - DO NOT EDIT FILE !!
|
3
|
-
# v0.4.3
|
4
|
-
# inject@options
|
5
|
-
assign allow = false
|
6
|
-
for role in roles
|
7
|
-
if role == theme.role
|
8
|
-
assign allow = true
|
9
|
-
break
|
10
|
-
endif
|
11
|
-
endfor
|
12
|
-
if allow
|
13
|
-
echo '<style id="syncify-hot-style">'
|
14
|
-
if no-preview-bar
|
15
|
-
echo 'iframe#preview-bar-iframe {display:none!important;}'
|
16
|
-
endif
|
17
|
-
echo '.sy__hot-label{all:initial;position:fixed;display:flex;color:#e4e4e4;z-index:2147483647;font-family:system-ui;font-weight:600;text-align:center;justify-content:space-around;align-items:center;font-size:11px;user-select:none;transition:border .5s ease}.sy__hot-label-inner{all:initial;cursor:move;padding:7px 14px 8px 32px;border:0;border-radius:6px;color:inherit;font-weight:600;font-size:inherit;font-family:inherit;background-color:#000;transition:border-radius .5s ease;background-position:11px center;background-size:12px;background-repeat:no-repeat;will-change:border-radius}'
|
18
|
-
echo '</style>'
|
19
|
-
endif
|
20
|
-
-%}
|
21
|
-
{%- if allow -%}
|
22
|
-
<script id="syncify-hot-client">
|
23
|
-
var le=11;function he(r,o){var a=o.attributes,s,t,h,v,S;if(!(o.nodeType===le||r.nodeType===le)){for(var L=a.length-1;L>=0;L--)s=a[L],t=s.name,h=s.namespaceURI,v=s.value,h?(t=s.localName||t,S=r.getAttributeNS(h,t),S!==v&&(s.prefix==="xmlns"&&(t=s.name),r.setAttributeNS(h,t,v))):(S=r.getAttribute(t),S!==v&&r.setAttribute(t,v));for(var x=r.attributes,C=x.length-1;C>=0;C--)s=x[C],t=s.name,h=s.namespaceURI,h?(t=s.localName||t,o.hasAttributeNS(h,t)||r.removeAttributeNS(h,t)):o.hasAttribute(t)||r.removeAttribute(t)}}var ie,pe="http://www.w3.org/1999/xhtml",N=typeof document>"u"?void 0:document,ye=!!N&&"content"in N.createElement("template"),ve=!!N&&N.createRange&&"createContextualFragment"in N.createRange();function ge(r){var o=N.createElement("template");return o.innerHTML=r,o.content.childNodes[0]}function be(r){ie||(ie=N.createRange(),ie.selectNode(N.body));var o=ie.createContextualFragment(r);return o.childNodes[0]}function we(r){var o=N.createElement("body");return o.innerHTML=r,o.childNodes[0]}function Te(r){return r=r.trim(),ye?ge(r):ve?be(r):we(r)}function oe(r,o){var a=r.nodeName,s=o.nodeName,t,h;return a===s?!0:(t=a.charCodeAt(0),h=s.charCodeAt(0),t<=90&&h>=97?a===s.toUpperCase():h<=90&&t>=97?s===a.toUpperCase():!1)}function Se(r,o){return!o||o===pe?N.createElement(r):N.createElementNS(o,r)}function Oe(r,o){for(var a=r.firstChild;a;){var s=a.nextSibling;o.appendChild(a),a=s}return o}function ae(r,o,a){r[a]!==o[a]&&(r[a]=o[a],r[a]?r.setAttribute(a,""):r.removeAttribute(a))}var ce={OPTION:function(r,o){var a=r.parentNode;if(a){var s=a.nodeName.toUpperCase();s==="OPTGROUP"&&(a=a.parentNode,s=a&&a.nodeName.toUpperCase()),s==="SELECT"&&!a.hasAttribute("multiple")&&(r.hasAttribute("selected")&&!o.selected&&(r.setAttribute("selected","selected"),r.removeAttribute("selected")),a.selectedIndex=-1)}ae(r,o,"selected")},INPUT:function(r,o){ae(r,o,"checked"),ae(r,o,"disabled"),r.value!==o.value&&(r.value=o.value),o.hasAttribute("value")||r.removeAttribute("value")},TEXTAREA:function(r,o){var a=o.value;r.value!==a&&(r.value=a);var s=r.firstChild;if(s){var t=s.nodeValue;if(t==a||!a&&t==r.placeholder)return;s.nodeValue=a}},SELECT:function(r,o){if(!o.hasAttribute("multiple")){for(var a=-1,s=0,t=r.firstChild,h,v;t;)if(v=t.nodeName&&t.nodeName.toUpperCase(),v==="OPTGROUP")h=t,t=h.firstChild;else{if(v==="OPTION"){if(t.hasAttribute("selected")){a=s;break}s++}t=t.nextSibling,!t&&h&&(t=h.nextSibling,h=null)}r.selectedIndex=a}}},Y=1,ue=11,de=3,fe=8;function q(){}function $e(r){if(r)return r.getAttribute&&r.getAttribute("id")||r.id}function Ee(r){return function(a,s,t){if(t||(t={}),typeof s=="string")if(a.nodeName==="#document"||a.nodeName==="HTML"||a.nodeName==="BODY"){var h=s;s=N.createElement("html"),s.innerHTML=h}else s=Te(s);else s.nodeType===ue&&(s=s.firstElementChild);var v=t.getNodeKey||$e,S=t.onBeforeNodeAdded||q,L=t.onNodeAdded||q,x=t.onBeforeElUpdated||q,C=t.onElUpdated||q,B=t.onBeforeNodeDiscarded||q,k=t.onNodeDiscarded||q,J=t.onBeforeElChildrenUpdated||q,Z=t.skipFromChildren||q,Q=t.addChild||function(c,d){return c.appendChild(d)},W=t.childrenOnly===!0,P=Object.create(null),F=[];function K(c){F.push(c)}function ee(c,d){if(c.nodeType===Y)for(var w=c.firstChild;w;){var f=void 0;d&&(f=v(w))?K(f):(k(w),w.firstChild&&ee(w,d)),w=w.nextSibling}}function b(c,d,w){B(c)!==!1&&(d&&d.removeChild(c),k(c),ee(c,w))}function D(c){if(c.nodeType===Y||c.nodeType===ue)for(var d=c.firstChild;d;){var w=v(d);w&&(P[w]=d),D(d),d=d.nextSibling}}D(a);function U(c){L(c);for(var d=c.firstChild;d;){var w=d.nextSibling,f=v(d);if(f){var p=P[f];p&&oe(d,p)?(d.parentNode.replaceChild(p,d),V(p,d)):U(d)}else U(d);d=w}}function te(c,d,w){for(;d;){var f=d.nextSibling;(w=v(d))?K(w):b(d,c,!0),d=f}}function V(c,d,w){var f=v(d);if(f&&delete P[f],!w){var p=x(c,d);if(p===!1||(p instanceof HTMLElement&&(c=p,D(c)),r(c,d),C(c),J(c,d)===!1))return}c.nodeName!=="TEXTAREA"?ne(c,d):ce.TEXTAREA(c,d)}function ne(c,d){var w=Z(c,d),f=d.firstChild,p=c.firstChild,e,n,u,i,l;e:for(;f;){for(i=f.nextSibling,e=v(f);!w&&p;){if(u=p.nextSibling,f.isSameNode&&f.isSameNode(p)){f=i,p=u;continue e}n=v(p);var T=p.nodeType,g=void 0;if(T===f.nodeType&&(T===Y?(e?e!==n&&((l=P[e])?u===l?g=!1:(c.insertBefore(l,p),n?K(n):b(p,c,!0),p=l,n=v(p)):g=!1):n&&(g=!1),g=g!==!1&&oe(p,f),g&&V(p,f)):(T===de||T==fe)&&(g=!0,p.nodeValue!==f.nodeValue&&(p.nodeValue=f.nodeValue))),g){f=i,p=u;continue e}n?K(n):b(p,c,!0),p=u}if(e&&(l=P[e])&&oe(l,f))w||Q(c,l),V(l,f);else{var $=S(f);$!==!1&&($&&(f=$),f.actualize&&(f=f.actualize(c.ownerDocument||N)),Q(c,f),U(f))}f=i,p=u}te(c,p,n);var A=ce[c.nodeName];A&&A(c,d)}var O=a,I=O.nodeType,_=s.nodeType;if(!W){if(I===Y)_===Y?oe(a,s)||(k(a),O=Oe(a,Se(s.nodeName,s.namespaceURI))):O=s;else if(I===de||I===fe){if(_===I)return O.nodeValue!==s.nodeValue&&(O.nodeValue=s.nodeValue),O;O=s}}if(O===s)k(a);else{if(s.isSameNode&&s.isSameNode(O))return;if(V(O,s,W),F)for(var X=0,re=F.length;X<re;X++){var G=P[F[X]];G&&b(G,G.parentNode,!1)}}return!W&&O!==a&&a.parentNode&&(O.actualize&&(O=O.actualize(a.ownerDocument||N)),a.parentNode.replaceChild(O,a)),O}}var Ae=Ee(he),se=Ae;function me(r){let o={customElementDefine:customElements.define,customElementsGet:customElements.get,querySelector:Document.prototype.querySelector,querySelectorAll:Document.prototype.querySelectorAll,getElementsByTagName:Document.prototype.getElementsByTagName,matches:Element.prototype.matches,closest:Element.prototype.closest},a=(t=10,h)=>(h=h||"",t?a(--t,"abcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random()*60))+h):h);function s(t){return r.has(t)?r.get(t):t}Document.prototype.querySelector=function(t){return o.querySelector.call(this,s(t))},Document.prototype.querySelectorAll=function(t){return o.querySelectorAll.call(this,s(t))},Document.prototype.getElementsByName=function(t){return o.getElementsByTagName.call(this,s(t))},Element.prototype.matches=function(t){return o.matches.call(this,s(t))},Element.prototype.closest=function(t){return o.closest.call(this,s(t))},customElements.get=function(t){return o.customElementsGet.call(customElements,s(t))},customElements.define=function(t,h,v){if(r.has(t)){let S=`${t}-${a()}`,L=r.get(t);o.customElementDefine.call(customElements,S,h,v),document.body.querySelectorAll(L).forEach(x=>{console.info(`HOT: Web Component '${t}' was refined to ${S} (refresh to reset)`);let C=document.createElement(S);C.innerHTML=x.innerHTML,x.replaceWith(C)}),r.set(t,S)}else console.warn(`HOT: Web component '${t}' will be monkey patched during HOT Mode.`),o.customElementDefine.call(customElements,t,h,v),r.set(t,t)}}(function(o){if(!document)return;window.syncify||(window.syncify=Object.create(null),window.syncify.version="0.4.3");let a=new Map,s=[],t={"no-preview-bar":!1,"no-checkout-preloads":!1,"no-perfkit":!1,"no-shopify-features":!1,"no-trekkie":!1,"no-web-pixels-manager":!1},h=!1,v=!1,S=NaN,L=0,x,C=o.label,B=o.method,k=`http://localhost:${o.server}/`,J=`ws://localhost:${o.socket}/ws`;Object.defineProperty(window.syncify,"options",{get(){return o},set(e){for(let n in o)n in o&&(o[n]=e[n],n==="server"?k=`http://localhost:${o[n]}/`:n==="socket"?J=`ws://localhost:${o.socket}/ws`:n==="label"?C=o[n]:n==="method"?B=o[n]:n==="flags"&&Object.assign(t,o[n]))}});let Z={onBeforeNodeDiscarded(e){return!(e.id==="syncify-hot-label"||e.id==="syncify-hot-style")},onBeforeElUpdated(e,n){return!(e.id==="syncify-hot-label"||e.id==="syncify-hot-style"||e.tagName==="SCRIPT"&&e.hasAttribute("src")&&e.getAttribute("src").startsWith(k)||e.tagName==="LINK"&&e.hasAttribute("href")&&e.getAttribute("href").startsWith(k)||e.tagName!=="SCRIPT"&&e.isEqualNode(n))}},Q=e=>`url("data:image/svg+xml,%3Csvg%20fill%3D%22currentColor%22%20width%3D%2212px%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2092%2092%22%3E%3Cpath%20d%3D%22M45.6607%200h45.62v26.07h-45.62c-5.1825.0079-10.1505%202.0703-13.8151%205.7349-3.6647%203.6646-5.7269%208.6326-5.7349%2013.8152-.0768%204.8168%201.7153%209.4761%205%2013H1.76071c-1.191519-4.2298-1.7839619-8.6057-1.76001194-13%200-5.9896%201.17974194-11.9206%203.47186194-17.4543%202.29212-5.5336%205.65171-10.5616%209.88704-14.7969%204.2353-4.23528%209.2633-7.59491%2014.7969-9.88703C33.6902%201.18976%2039.6211.0100098%2045.6107.0100098L45.6607%200Zm0%2091.23H.050716V65.17H45.6607c5.1826-.0079%2010.1506-2.0702%2013.8152-5.7348s5.7269-8.6326%205.7348-13.8151c.0769-4.8169-1.7152-9.4762-5-13h29.32c1.1916%204.2297%201.784%208.6057%201.7601%2013%20.0013%205.9912-1.1779%2011.924-3.47%2017.4595-2.2922%205.5355-5.6525%2010.5651-9.8889%2014.8016-4.2365%204.2364-9.2661%207.5967-14.8016%209.8889-5.5355%202.2921-11.4683%203.4713-17.4596%203.47l-.01-.0101Z%22%20fill%3D%22%23${e}%22%2F%3E%3C%2Fsvg%3E")`;function W(e,n,u){let i=document.createElement(e);return i.className=n,u&&Object.assign(i.style,u),i}function P(e){requestAnimationFrame(()=>{e.body.querySelector("#preview-bar-iframe").remove(),e.documentElement.style.removeProperty("padding-bottom")});let n=[];if(t["no-trekkie"]&&n.push("script[src*=syncify\\.myshopify\\.com\\/cdn\\/s\\/trekkie\\.storefront]"),t["no-web-pixels-manager"]&&n.push("script[src*=syncify\\.myshopify\\.com\\/cdn\\/wpm\\/]","script#web-pixels-manager-setup"),t["no-perfkit"]&&n.push("script[src*=syncify\\.myshopify\\.com\\/cdn\\/shopifycloud\\/perf-kit\\/]"),t["no-checkout-preloads"]&&n.push("script[src*=\\/checkouts\\/internal\\/preloads\\.js]"),t["no-shopify-features"]&&n.push("script#shopify-features",'script[data-source-attribution="shopify.loadfeatures"]'),n.length===0)return;let u=e.head.querySelectorAll(n.join());u&&u.forEach(i=>{i.remove(),i.src.indexOf("/cdn/wpm")>-1?console.error(`HOT --no-web-pixels-manager: ${i.src} (BLOCKED)`):i.id==="web-pixels-manager-setup"?console.error(`HOT --no-web-pixels-manager: ${i.id} (BLOCKED)`):i.id==="shopify-features"?console.error(`HOT --no-shopify-features: ${i.id} (BLOCKED)`):i.src.indexOf("/perf-kit")>-1?console.error(`HOT --no-perf-kit: ${i.src} (BLOCKED)`):i.src.indexOf("/trekkie")>-1?console.error(`HOT --no-trekkie: ${i.src} (BLOCKED)`):i.src.indexOf("/checkouts/internal")>-1?console.error(`HOT --no-checkout-preloads: ${i.src} (BLOCKED)`):i.hasAttribute("data-source-attribution")?console.error(`HOT --no-source-attribution: ${i.getAttribute("data-source-attribution")} (BLOCKED)`):i.src.indexOf("/storefront/bars")>-1&&console.error(`HOT --no-preview-bar: ${i.src} (BLOCKED)`)})}function F(e,n){for(let[u,i]of n)e.addEventListener(u,i)}function K(e,n){for(let[u,i]of n)e.removeEventListener(u,i)}function ee(e){let n=!1,u,i,l=()=>{let y=e.getBoundingClientRect(),m="6px",E="0px",H={top:y.top<=6,bottom:y.bottom>=window.innerHeight-6,left:y.left<=6,right:y.right>=window.innerWidth-6},M;H.top&&H.left?M=`${E} ${m} ${m} ${m}`:H.top&&H.right?M=`${m} ${E} ${m} ${m}`:H.bottom&&H.left?M=`${m} ${m} ${m} ${E}`:H.bottom&&H.right?M=`${m} ${m} ${E} ${m}`:H.top?M=`${E} ${E} ${m} ${m}`:H.bottom?M=`${m} ${m} ${E} ${E}`:H.left?M=`${E} ${m} ${m} ${E}`:H.right?M=`${m} ${E} ${E} ${m}`:M=`${m} ${m} ${m} ${m}`,e.querySelector("span").style.borderRadius=M},T=(y,m)=>{let E=e.getBoundingClientRect();e.style.left=`${Math.min(Math.max(y,0),window.innerWidth-E.width)}px`,e.style.top=`${Math.min(Math.max(m,0),window.innerHeight-E.height)}px`,l()},g=()=>{e.style.visibility="hidden";let y=e.getBoundingClientRect(),m=(window.innerWidth-y.width)/2,E=window.innerHeight-y.height;T(m,E),e.style.visibility="visible"},$=y=>{let m=e.getBoundingClientRect();u=(y.touches?y.touches[0].clientX:y.clientX)-m.left,i=(y.touches?y.touches[0].clientY:y.clientY)-m.top,n=y.target===e||e.contains(y.target)},A=y=>{n&&(y.preventDefault(),T((y.touches?y.touches[0].clientX:y.clientX)-u,(y.touches?y.touches[0].clientY:y.clientY)-i))},z=()=>{n=!1},j=[["mousedown",$],["mousemove",A],["mouseup",z],["touchstart",$],["touchmove",A],["touchend",z]];F(document,j),F(e,j.filter(([y])=>y!=="mousemove"&&y!=="touchmove"));let R=()=>g();return window.addEventListener("resize",R),requestAnimationFrame(()=>g()),()=>{K(document,j),window.removeEventListener("resize",R)}}let b=function(){let e,n;return{get node(){return e},mount:i=>{if(e instanceof Element&&i.contains(e))return;let l=W("div","sy__hot-label");e=W("span","sy__hot-label-inner",{backgroundImage:Q("4DBB73")}),window.syncify&&typeof window.syncify.style!="object"&&(window.syncify.style=Object.create(null),window.syncify.style.parent=T=>Object.assign(l.style,T),window.syncify.style.label=T=>Object.assign(e,T)),e.innerText=B?"HOT":"LIVE",l.id="syncify-hot-label",l.style.visibility="hidden",l.appendChild(e),C&&(n=ee(l),i.append(l))},event(i,l){i!==void 0&&(l?e.style.setProperty("font-size",l):e.style.removeProperty("font-size"),e.innerText=i)},unmount(){n(),e.remove(),e=void 0}}}(),D=function(e){let n=null;return{start:()=>{e.push(performance.now())},stop:()=>{n!==null&&(clearTimeout(n),n=null),n=setTimeout(()=>{b.event(B==="hot"?"HOT":"LIVE"),n=null},6e3);let u=performance.now()-e.pop();if(u<1e3)return`${u.toFixed(0)}ms`;let i=u/1e3;if(i<60)return`${i.toFixed(0)}s ${+u.toFixed(0).slice(1)}ms`;let l=(i/60).toFixed(0);return`${l}m ${i-60*Number(l)}s ${+u.toFixed(0).slice(1)}ms`}}}([]),U=function(e){return{list(){return Object.keys(e).length>0?e:null},get(n){return n in e?document.body.querySelectorAll(e[n].join(",")):null},load:(n=document.body)=>{e={};let u=n.querySelectorAll(".shopify-section");if(!u)return null;for(let i=0,l=u.length;i<l;i++){let{id:T}=u[i],g=/[0-9]+_{2}[\w-]+$/.exec(T),$;if(g!==null)$=g[0].slice(g[0].indexOf("__")+2);else if(T.startsWith("shopify-section-"))$=T.slice(16);else{window.syncify.errors.push({title:"Unknown Section",description:`Syncify encountered an issue mapping the section id: ${T}`,group:"section"});continue}let A=`#${T}`;$ in e?e[$].indexOf(A)<0&&e[$].push(A):e[$]=[A]}return e}}}({});function te(e){let n=e.lastIndexOf("/")+1,u=e.indexOf("?",n);return(u>-1?e.substring(n,u):e.substring(n))+"?v="+Date.now()}function V(e,n){return typeof n!="string"?!1:e.slice(e.lastIndexOf("/")+1).startsWith(n)}function ne(e,n){let u=e.querySelectorAll("link[rel=stylesheet]");for(let i=0,l=u.length;i<l;i++){let T=u[i],g=T.getAttribute("href");V(g,n)&&T.setAttribute("href",k+te(g))}return e}function O(e,n){let u=e.querySelectorAll("script[src]"),i=[];for(let l=0,T=u.length;l<T;l++){let g=u[l],$=g.getAttribute("src");if(V($,n)){let A=new Promise((z,j)=>{let R=document.createElement("script");R.setAttribute("src",k+te($));let y=Array.from(g.attributes);for(let m of y)m.nodeName!=="src"&&R.setAttribute(m.nodeName,m.nodeValue);R.onload=()=>z($),R.onerror=m=>{console.error("HOT Script failed to reload:",m),j(new Error("HOT Script Error"))},g.replaceWith(R)});i.push(A)}}return i}function I(e=document){return ne(e),Promise.allSettled(O(e))}function _(e,n){return new Promise(function(u,i){let l=new XMLHttpRequest;l.responseType=n,l.open("GET",e,!0),l.setRequestHeader("x-syncify-hot","true"),l.onload=()=>u(l.response),l.onerror=()=>i(l.statusText),l.send()})}let X=()=>_(location.href,"document").then(e=>{I(e).then(()=>{se(document.body,e.body,Z),U.load(document.body),b.mount(document.body)})});function re(){if(v!==!0){if(L>5){x=void 0,f(),console.warn("HOT Reconnection could not be established and process was killed");return}x=new WebSocket(J),G(x)}}function G(e){isNaN(S)||clearTimeout(S),e.addEventListener("close",()=>{L===0&&console.warn("HOT Reconnection will be attempted 5 times for the next 10 seconds"),L>0||b.event("DISCONNECTED","10px"),v=!1,L++,S=setTimeout(re,2e3)}),e.addEventListener("open",()=>{v?(D.start(),b.event("Reconnecting"),X().then(()=>{b.event(`Reconnected in ${D.stop()}`),v=!0})):(v=!0,b.event(B==="hot"?"HOT":"LIVE"),w())});let n=B==="hot"?"HOT ":"LIVE ";e.addEventListener("message",function({data:u}){if(u==="reload")return b.event("Refresh"),top.location.reload();if(u==="replace")return D.start(),b.event(`${n} RELOAD`),isNaN(S)||clearTimeout(S),X().then(()=>{b.event(`Reloaded in ${D.stop()}`),S=NaN});if(D.start(),B==="live")return _(location.href,"document").then(i=>{document.body.replaceWith(i.body),b.mount(document.body),b.event(`Reloaded in ${D.stop()}`),S=NaN});{let[i,l,T]=u.split(",");if(i==="section"){let g=U.get(l);if(g===null){c(()=>b.event(`Reloaded in ${D.stop()}`));return}let $=`${location.pathname}?sections=${l}`;return g.length>1?b.event(`${g.length} ${n}SECTIONS`):b.event(`${n}SECTION`),_($,"json").then(A=>{g.forEach(z=>{se(z,A[l],{childrenOnly:!0,onBeforeElUpdated:(j,R)=>!j.isEqualNode(R)})}),b.event(`Reloaded "${l}" in ${D.stop()}`)}).catch(A=>{s.push({title:"XHR Error fetching section",description:`Section with id: ${l} failed to return a response from Shopify`,group:"sections"}),console.error("SYNCIFY: ",A)})}else i==="script"?(b.event(`${n}JavaScript: ${l}`),Promise.allSettled(O(document,l)).then(()=>{e.send(T),b.event(`Reloaded in ${D.stop()}`)})):i==="stylesheet"&&(b.event(`${n}Stylesheet: ${l}`),ne(document,l),e.send(T),b.event(`Reloaded in ${D.stop()}`))}})}function c(e){_(location.href,"document").then(n=>{I(n).then(()=>{se(document.body,n.body,Z),typeof e=="function"&&e(document)})})}function d(){return top.location.reload()}function w(e){x.send("ROUTE:"+JSON.stringify(e||{url:location.href,template:"{%-if template.directory-%}{{-template.directory-}}/{%-endif-%}{{-template.name-}}"}))}function f(){let e=document.body;return h&&(h=!1,x&&(v=!1,x.close()),b.unmount()),e}function p(e){if(document.readyState!=="complete")setTimeout(()=>p(e),25);else{let n=h?f():document.body;typeof e=="object"&&(window.syncify.options=e),U.load(n),b.mount(n),h=!0,re()}}Object.defineProperties(window.syncify,{isReady:{get(){return h}},isConnected:{get(){return v}},errors:{get(){return s}},WebC:{get(){return a}},connect:{value:p},disconnect:{value:f},sections:{value:U},route:{value:w},assets:{value:I},refresh:{value:d},reload:{value:c}}),document.addEventListener("readystatechange",function(){this.readyState==="interactive"?me(a):this.readyState==="complete"&&P(this)}),p()})({method:"{{method|default:'hot'}}",server:+"{{server|default:41001}}",socket:+"{{socket|default:51001}}",label:!0,roles:"{{roles|default:'unpublished,development'}}".split(","),flags:{"no-preview-bar":!0,"no-web-pixels-manager":!0,"no-shopify-features":!0,"no-trekkie":!0,"no-perfkit":!0,"no-checkout-preloads":!0}});
|
24
|
-
</script>
|
25
|
-
{%- endif -%}
|