shopify-theme-devtools 1.0.0
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 +22 -0
- package/README.md +174 -0
- package/dist/theme-devtools.css +0 -0
- package/dist/theme-devtools.js +1836 -0
- package/package.json +61 -0
- package/src/liquid/theme-devtools-bridge.liquid +445 -0
|
@@ -0,0 +1,1836 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty,__defNormalProp=(t,e,s)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,__publicField=(t,e,s)=>__defNormalProp(t,"symbol"!=typeof e?e+"":e,s);!function(){"use strict";var t;const e=globalThis,s=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let o=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&a.set(e,t))}return t}toString(){return this.cssText}};const n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1],t[0]);return new o(s,t,i)},r=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:h,getPrototypeOf:u}=Object,v=globalThis,g=v.trustedTypes,b=g?g.emptyScript:"",m=v.reactiveElementPolyfillSupport,f=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(i){s=null}}return s}},y=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:x,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);let $=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&d(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:a}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=null==i?void 0:i.call(this);null==a||a.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const t=this.properties,e=[...p(t),...h(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach(t=>t(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,i)=>{if(s)t.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of i){const i=document.createElement("style"),a=e.litNonce;void 0!==a&&i.setAttribute("nonce",a),i.textContent=s.cssText,t.appendChild(i)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){var s;const i=this.constructor.elementProperties.get(t),a=this.constructor._$Eu(t,i);if(void 0!==a&&!0===i.reflect){const o=(void 0!==(null==(s=i.converter)?void 0:s.toAttribute)?i.converter:x).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(a):this.setAttribute(a,o),this._$Em=null}}_$AK(t,e){var s,i;const a=this.constructor,o=a._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=a.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(s=t.converter)?void 0:s.fromAttribute)?t.converter:x;this._$Em=o;const r=n.fromAttribute(e,t.type);this[o]=r??(null==(i=this._$Ej)?void 0:i.get(o))??r,this._$Em=null}}requestUpdate(t,e,s,i=!1,a){var o;if(void 0!==t){const n=this.constructor;if(!1===i&&(a=this[t]),s??(s=n.getPropertyOptions(t)),!((s.hasChanged??y)(a,e)||s.useDefault&&s.reflect&&a===(null==(o=this._$Ej)?void 0:o.get(t))&&!this.hasAttribute(n._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==a||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostUpdate)?void 0:e.call(t)}),this.update(s)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;null==(e=this._$EO)||e.forEach(t=>{var e;return null==(e=t.hostUpdated)?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[f("elementProperties")]=new Map,$[f("finalized")]=new Map,null==m||m({ReactiveElement:$}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.1.2");const w=globalThis,k=t=>t,S=w.trustedTypes,j=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+A,O=`<${C}>`,P=document,T=()=>P.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,N="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,U=/>/g,q=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,D=/"/g,V=/^(?:script|style|textarea|title)$/i,I=(K=1,(t,...e)=>({_$litType$:K,strings:t,values:e})),F=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),B=new WeakMap,J=P.createTreeWalker(P,129);var K;function W(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==j?j.createHTML(e):e}class G{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let a=0,o=0;const n=t.length-1,r=this.parts,[l,d]=((t,e)=>{const s=t.length-1,i=[];let a,o=2===e?"<svg>":3===e?"<math>":"",n=R;for(let r=0;r<s;r++){const e=t[r];let s,l,d=-1,c=0;for(;c<e.length&&(n.lastIndex=c,l=n.exec(e),null!==l);)c=n.lastIndex,n===R?"!--"===l[1]?n=L:void 0!==l[1]?n=U:void 0!==l[2]?(V.test(l[2])&&(a=RegExp("</"+l[2],"g")),n=q):void 0!==l[3]&&(n=q):n===q?">"===l[0]?(n=a??R,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,s=l[1],n=void 0===l[3]?q:'"'===l[3]?D:H):n===D||n===H?n=q:n===L||n===U?n=R:(n=q,a=void 0);const p=n===q&&t[r+1].startsWith("/>")?" ":"";o+=n===R?e+O:d>=0?(i.push(s),e.slice(0,d)+E+e.slice(d)+A+p):e+A+(-2===d?r:p)}return[W(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]})(t,e);if(this.el=G.createElement(l,s),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=J.nextNode())&&r.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(E)){const e=d[o++],s=i.getAttribute(t).split(A),n=/([.?@])?(.*)/.exec(e);r.push({type:1,index:a,name:n[2],strings:s,ctor:"."===n[1]?et:"?"===n[1]?st:"@"===n[1]?it:tt}),i.removeAttribute(t)}else t.startsWith(A)&&(r.push({type:6,index:a}),i.removeAttribute(t));if(V.test(i.tagName)){const t=i.textContent.split(A),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],T()),J.nextNode(),r.push({type:2,index:++a});i.append(t[e],T())}}}else if(8===i.nodeType)if(i.data===C)r.push({type:2,index:a});else{let t=-1;for(;-1!==(t=i.data.indexOf(A,t+1));)r.push({type:7,index:a}),t+=A.length-1}a++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function X(t,e,s=t,i){var a,o;if(e===F)return e;let n=void 0!==i?null==(a=s._$Co)?void 0:a[i]:s._$Cl;const r=z(e)?void 0:e._$litDirective$;return(null==n?void 0:n.constructor)!==r&&(null==(o=null==n?void 0:n._$AO)||o.call(n,!1),void 0===r?n=void 0:(n=new r(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??(s._$Co=[]))[i]=n:s._$Cl=n),void 0!==n&&(e=X(t,n._$AS(t,e.values),n,i)),e}class Y{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((null==t?void 0:t.creationScope)??P).importNode(e,!0);J.currentNode=i;let a=J.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let e;2===r.type?e=new Z(a,a.nextSibling,this,t):1===r.type?e=new r.ctor(a,r.name,r.strings,this,t):6===r.type&&(e=new at(a,this,t)),this._$AV.push(e),r=s[++n]}o!==(null==r?void 0:r.index)&&(a=J.nextNode(),o++)}return J.currentNode=P,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Z{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(null==i?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),z(t)?t===Q||null==t||""===t?(this._$AH!==Q&&this._$AR(),this._$AH=Q):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>M(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Q&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var e;const{values:s,_$litType$:i}=t,a="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=G.createElement(W(i.h,i.h[0]),this.options)),i);if((null==(e=this._$AH)?void 0:e._$AD)===a)this._$AH.p(s);else{const t=new Y(a,this),e=t.u(this.options);t.p(s),this.T(e),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new G(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const a of t)i===e.length?e.push(s=new Z(this.O(T()),this.O(T()),this,this.options)):s=e[i],s._$AI(a),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for(null==(s=this._$AP)||s.call(this,!1,!0,e);t!==this._$AB;){const e=k(t).nextSibling;k(t).remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cv=t,null==(e=this._$AP)||e.call(this,t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,a){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=a,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Q}_$AI(t,e=this,s,i){const a=this.strings;let o=!1;if(void 0===a)t=X(this,t,e,0),o=!z(t)||t!==this._$AH&&t!==F,o&&(this._$AH=t);else{const i=t;let n,r;for(t=a[0],n=0;n<a.length-1;n++)r=X(this,i[s+n],e,n),r===F&&(r=this._$AH[n]),o||(o=!z(r)||r!==this._$AH[n]),r===Q?t=Q:t!==Q&&(t+=(r??"")+a[n+1]),this._$AH[n]=r}o&&!i&&this.j(t)}j(t){t===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Q?void 0:t}}class st extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Q)}}class it extends tt{constructor(t,e,s,i,a){super(t,e,s,i,a),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??Q)===F)return;const s=this._$AH,i=t===Q&&s!==Q||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==Q&&(s===Q||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;"function"==typeof this._$AH?this._$AH.call((null==(e=this.options)?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const ot=w.litHtmlPolyfillSupport;null==ot||ot(G,Z),(w.litHtmlVersions??(w.litHtmlVersions=[])).push("3.3.2");const nt=globalThis;class rt extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=(null==s?void 0:s.renderBefore)??e;let a=i._$litPart$;if(void 0===a){const t=(null==s?void 0:s.renderBefore)??null;i._$litPart$=a=new Z(e.insertBefore(T(),t),t,void 0,s??{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return F}}rt._$litElement$=!0,rt.finalized=!0,null==(t=nt.litElementHydrateSupport)||t.call(nt,{LitElement:rt});const lt=nt.litElementPolyfillSupport;null==lt||lt({LitElement:rt}),(nt.litElementVersions??(nt.litElementVersions=[])).push("4.2.2");const dt=n`
|
|
2
|
+
:host {
|
|
3
|
+
--tdt-bg: #1a1a1a;
|
|
4
|
+
--tdt-bg-secondary: #242424;
|
|
5
|
+
--tdt-bg-hover: #2a2a2a;
|
|
6
|
+
--tdt-border: #333;
|
|
7
|
+
--tdt-text: #e0e0e0;
|
|
8
|
+
--tdt-text-muted: #888;
|
|
9
|
+
--tdt-accent: #3b82f6;
|
|
10
|
+
--tdt-accent-hover: #2563eb;
|
|
11
|
+
--tdt-success: #22c55e;
|
|
12
|
+
--tdt-warning: #eab308;
|
|
13
|
+
--tdt-danger: #ef4444;
|
|
14
|
+
--tdt-string: #a5d6ff;
|
|
15
|
+
--tdt-number: #79c0ff;
|
|
16
|
+
--tdt-boolean: #ff7b72;
|
|
17
|
+
--tdt-null: #888;
|
|
18
|
+
--tdt-key: #c792ea;
|
|
19
|
+
--tdt-font: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
|
|
20
|
+
--tdt-font-size: 12px;
|
|
21
|
+
--tdt-radius: 4px;
|
|
22
|
+
|
|
23
|
+
all: initial;
|
|
24
|
+
font-family: var(--tdt-font);
|
|
25
|
+
font-size: var(--tdt-font-size);
|
|
26
|
+
line-height: 1.5;
|
|
27
|
+
color: var(--tdt-text);
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
*, *::before, *::after {
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.btn {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
gap: 0.5rem;
|
|
40
|
+
background: var(--tdt-bg-secondary);
|
|
41
|
+
border: 1px solid var(--tdt-border);
|
|
42
|
+
border-radius: var(--tdt-radius);
|
|
43
|
+
padding: 6px 12px;
|
|
44
|
+
color: var(--tdt-text);
|
|
45
|
+
font-family: var(--tdt-font);
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition: all 0.15s ease;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.btn:hover:not(:disabled) {
|
|
52
|
+
background: var(--tdt-bg-hover);
|
|
53
|
+
border-color: var(--tdt-accent);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.btn:disabled {
|
|
57
|
+
opacity: 0.5;
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.btn--sm {
|
|
62
|
+
padding: 4px 8px;
|
|
63
|
+
font-size: 10px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.btn--danger {
|
|
67
|
+
border-color: var(--tdt-danger);
|
|
68
|
+
color: var(--tdt-danger);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.btn--danger:hover:not(:disabled) {
|
|
72
|
+
background: rgba(239, 68, 68, 0.1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.badge {
|
|
76
|
+
font-size: 10px;
|
|
77
|
+
padding: 2px 8px;
|
|
78
|
+
border-radius: 10px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
text-transform: uppercase;
|
|
81
|
+
letter-spacing: 0.3px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.badge--development {
|
|
85
|
+
background: rgba(34, 197, 94, 0.2);
|
|
86
|
+
color: var(--tdt-success);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.badge--unpublished {
|
|
90
|
+
background: rgba(234, 179, 8, 0.2);
|
|
91
|
+
color: var(--tdt-warning);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.badge--design {
|
|
95
|
+
background: rgba(59, 130, 246, 0.2);
|
|
96
|
+
color: var(--tdt-accent);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.empty-state {
|
|
100
|
+
color: var(--tdt-text-muted);
|
|
101
|
+
text-align: center;
|
|
102
|
+
padding: 24px;
|
|
103
|
+
font-style: italic;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input, select, textarea {
|
|
107
|
+
font-family: var(--tdt-font);
|
|
108
|
+
font-size: var(--tdt-font-size);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
input[type="text"],
|
|
112
|
+
input[type="number"],
|
|
113
|
+
input[type="search"] {
|
|
114
|
+
background: var(--tdt-bg-secondary);
|
|
115
|
+
border: 1px solid var(--tdt-border);
|
|
116
|
+
border-radius: var(--tdt-radius);
|
|
117
|
+
padding: 6px 10px;
|
|
118
|
+
color: var(--tdt-text);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
input:focus {
|
|
122
|
+
outline: none;
|
|
123
|
+
border-color: var(--tdt-accent);
|
|
124
|
+
}
|
|
125
|
+
`;const ct=new class{constructor(){this.context=null}parse(){const t=document.getElementById("__THEME_DEVTOOLS_CONTEXT__");if(!t)return console.warn("[Theme Devtools] Context element not found"),null;try{return this.context=JSON.parse(t.textContent),this.context}catch(e){return console.error("[Theme Devtools] Failed to parse context:",e),null}}get(t){if(this.context)return t.split(".").reduce((t,e)=>null==t?void 0:t[e],this.context)}getMeta(){var t;return(null==(t=this.context)?void 0:t.meta)||{}}getObjects(){var t;return(null==(t=this.context)?void 0:t.objects)||{}}};function pt(t){try{return JSON.parse(JSON.stringify(t))}catch{return t}}const ht=new class{constructor(){this.listeners=new Set,this.currentCart=null,this.cartHistory=[],this.pollInterval=null}async fetch(){try{const t=await fetch("/cart.js",{headers:{Accept:"application/json"}});return await t.json()}catch(t){return console.error("[Theme Devtools] Cart fetch failed:",t),null}}async update(t){try{const e=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({updates:t})}),s=await e.json();return this.setCart(s),s}catch(e){return console.error("[Theme Devtools] Cart update failed:",e),null}}async change(t,e){try{const s=await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({line:t,quantity:e})}),i=await s.json();return this.setCart(i),i}catch(s){return console.error("[Theme Devtools] Cart change failed:",s),null}}async clear(){try{const t=await fetch("/cart/clear.js",{method:"POST",headers:{Accept:"application/json"}}),e=await t.json();return this.setCart(e),e}catch(t){return console.error("[Theme Devtools] Cart clear failed:",t),null}}setCart(t){const e=this.currentCart;this.currentCart=t,e&&(this.cartHistory.push({timestamp:Date.now(),diff:this.diffCart(e,t),snapshot:pt(e)}),this.cartHistory.length>50&&this.cartHistory.shift()),this.notify(t,e)}diffCart(t,e){const s={itemCount:{old:(null==t?void 0:t.item_count)||0,new:(null==e?void 0:e.item_count)||0},totalPrice:{old:(null==t?void 0:t.total_price)||0,new:(null==e?void 0:e.total_price)||0},items:{added:[],removed:[],modified:[]}},i=new Map(((null==t?void 0:t.items)||[]).map(t=>[t.key,t])),a=new Map(((null==e?void 0:e.items)||[]).map(t=>[t.key,t]));return a.forEach((t,e)=>{const a=i.get(e);a?a.quantity!==t.quantity&&s.items.modified.push({item:t,oldQuantity:a.quantity,newQuantity:t.quantity}):s.items.added.push(t)}),i.forEach((t,e)=>{a.has(e)||s.items.removed.push(t)}),s}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(t,e){this.listeners.forEach(s=>{try{s(t,e)}catch(i){console.error("[Theme Devtools] Cart listener error:",i)}})}startPolling(t=2e3){if(this.pollInterval)return;const e=async()=>{const t=await this.fetch();t&&JSON.stringify(t)!==JSON.stringify(this.currentCart)&&this.setCart(t)};e(),this.pollInterval=setInterval(e,t)}stopPolling(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}interceptAjax(){const t=this,e=window.fetch;window.fetch=async function(s,i){const a=await e.apply(this,arguments);if("string"==typeof s&&s.includes("/cart"))try{const e=a.clone(),s=await e.json();s&&void 0!==s.item_count&&setTimeout(()=>t.setCart(s),0)}catch{}return a};const s=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,i){return"string"==typeof i&&i.includes("/cart")&&this.addEventListener("load",function(){try{const e=JSON.parse(this.responseText);e&&void 0!==e.item_count&&setTimeout(()=>t.setCart(e),0)}catch{}}),s.apply(this,arguments)}}};const ut=new class{constructor(){this.overlay=null,this.currentSection=null}init(){this.overlay=document.createElement("div"),this.overlay.className="tdt-section-overlay",Object.assign(this.overlay.style,{position:"fixed",pointerEvents:"none",border:"2px solid #3b82f6",backgroundColor:"rgba(59, 130, 246, 0.1)",zIndex:"2147483646",display:"none",transition:"all 0.2s ease"}),document.body.appendChild(this.overlay)}findSections(){const t=[];Array.from(document.querySelectorAll('[id^="shopify-section-"]')).forEach(e=>{var s;const i=e.id.replace("shopify-section-",""),a=e.dataset.sectionType||(null==(s=e.className.match(/section-(\w+)/))?void 0:s[1])||"unknown",o=Array.from(e.querySelectorAll('[data-block-id], [id*="block"]'));t.push({id:i,type:a,element:e,blockCount:o.length,rect:e.getBoundingClientRect()})});return Array.from(document.querySelectorAll("[data-section-id]")).forEach(e=>{const s=e.dataset.sectionId;if(!t.find(t=>t.id===s)){const i=e.dataset.sectionType||"unknown",a=Array.from(e.querySelectorAll("[data-block-id]"));t.push({id:s,type:i,element:e,blockCount:a.length,rect:e.getBoundingClientRect()})}}),t}highlight(t){const e=this.findSections().find(e=>e.id===t);if(!e||!e.element)return void this.hide();const s=e.element.getBoundingClientRect();Object.assign(this.overlay.style,{display:"block",top:`${s.top}px`,left:`${s.left}px`,width:`${s.width}px`,height:`${s.height}px`}),this.currentSection=t,e.element.scrollIntoView({behavior:"smooth",block:"center"})}hide(){this.overlay&&(this.overlay.style.display="none"),this.currentSection=null}destroy(){this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};class vt extends rt{constructor(){super(),this.data=null,this.path="",this.expanded=new Set}_getType(t){return null===t?"null":void 0===t?"undefined":Array.isArray(t)?"array":typeof t}_isExpandable(t){const e=this._getType(t);return("object"===e||"array"===e)&&null!==t&&Object.keys(t).length>0}_toggleExpand(t,e){e.stopPropagation();const s=new Set(this.expanded);s.has(t)?s.delete(t):s.add(t),this.expanded=s}async _copyPath(t,e){e.stopPropagation();const s=t.replace(/^objects\./,"").replace(/^meta\./,"");try{await navigator.clipboard.writeText(`{{ ${s} }}`);const t=e.target;t.classList.add("key--copied"),setTimeout(()=>t.classList.remove("key--copied"),1e3)}catch(i){console.error("Failed to copy:",i)}}_renderValue(t,e){switch(e){case"string":const e=t.length>80?t.slice(0,80)+"...":t;return I`<span class="value value--string">"${e}"</span>`;case"number":return I`<span class="value value--number">${t}</span>`;case"boolean":return I`<span class="value value--boolean">${t}</span>`;case"null":return I`<span class="value value--null">null</span>`;case"undefined":return I`<span class="value value--undefined">undefined</span>`;default:return I`<span class="value">${String(t)}</span>`}}_renderPreview(t,e){const s=Object.keys(t).length;return I`<span class="preview">${"array"===e?`Array(${s})`:`{${s} ${1===s?"key":"keys"}}`}</span>`}_renderNode(t,e,s,i=!1,a=!1){const o=this._getType(e),n=this._isExpandable(e),r=this.expanded.has(s),l=["node",i?"node--root":"",n?"node--expandable":"",r?"node--expanded":""].filter(Boolean).join(" ");return I`
|
|
126
|
+
<div
|
|
127
|
+
class=${l}
|
|
128
|
+
@click=${n?t=>this._toggleExpand(s,t):null}
|
|
129
|
+
>
|
|
130
|
+
<span class="key" @click=${t=>this._copyPath(s,t)}>${a?`[${t}]`:t}</span>
|
|
131
|
+
<span class="separator">: </span>
|
|
132
|
+
${n?this._renderPreview(e,o):this._renderValue(e,o)}
|
|
133
|
+
${n&&r?I`
|
|
134
|
+
<div class="children">
|
|
135
|
+
${this._renderObject(e,s)}
|
|
136
|
+
</div>
|
|
137
|
+
`:""}
|
|
138
|
+
</div>
|
|
139
|
+
`}_renderObject(t,e=""){if(null==t)return I`<span class="value value--null">${null===t?"null":"undefined"}</span>`;const s=this._getType(t),i=Object.entries(t);return 0===i.length?I`<span class="preview">${"array"===s?"[]":"{}"}</span>`:i.map(([t,i])=>{const a=e?`${e}.${t}`:t;return this._renderNode(t,i,a,!e,"array"===s)})}render(){return null===this.data?I`<span class="value value--null">null</span>`:void 0===this.data?I`<span class="value value--undefined">undefined</span>`:I`${this._renderObject(this.data,this.path)}`}}__publicField(vt,"properties",{data:{type:Object},path:{type:String},expanded:{type:Object,state:!0}}),__publicField(vt,"styles",[dt,n`
|
|
140
|
+
:host {
|
|
141
|
+
display: block;
|
|
142
|
+
font-family: var(--tdt-font);
|
|
143
|
+
font-size: var(--tdt-font-size);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.node {
|
|
147
|
+
padding: 2px 0;
|
|
148
|
+
padding-left: 16px;
|
|
149
|
+
position: relative;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.node--root {
|
|
153
|
+
padding-left: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.node--expandable {
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.node--expandable::before {
|
|
161
|
+
content: '▶';
|
|
162
|
+
position: absolute;
|
|
163
|
+
left: 2px;
|
|
164
|
+
font-size: 8px;
|
|
165
|
+
color: var(--tdt-text-muted);
|
|
166
|
+
transition: transform 0.15s ease;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.node--root.node--expandable::before {
|
|
170
|
+
left: -12px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.node--expanded::before {
|
|
174
|
+
transform: rotate(90deg);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.key {
|
|
178
|
+
color: var(--tdt-key);
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
border-radius: 2px;
|
|
181
|
+
padding: 0 2px;
|
|
182
|
+
margin: 0 -2px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.key:hover {
|
|
186
|
+
background: rgba(199, 146, 234, 0.2);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.key--copied {
|
|
190
|
+
background: rgba(34, 197, 94, 0.3) !important;
|
|
191
|
+
transition: background 0.3s ease;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.separator {
|
|
195
|
+
color: var(--tdt-text-muted);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.value {
|
|
199
|
+
word-break: break-all;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.value--string { color: var(--tdt-string); }
|
|
203
|
+
.value--number { color: var(--tdt-number); }
|
|
204
|
+
.value--boolean { color: var(--tdt-boolean); }
|
|
205
|
+
.value--null, .value--undefined {
|
|
206
|
+
color: var(--tdt-null);
|
|
207
|
+
font-style: italic;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.preview {
|
|
211
|
+
color: var(--tdt-text-muted);
|
|
212
|
+
font-style: italic;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.children {
|
|
216
|
+
border-left: 1px solid var(--tdt-border);
|
|
217
|
+
margin-left: 6px;
|
|
218
|
+
}
|
|
219
|
+
`]),customElements.define("tdt-object-inspector",vt);class gt extends rt{constructor(){super(),this.objects={},this.activeObject=null,this.searchQuery=""}updated(t){if(t.has("objects")&&this.objects){const t=Object.keys(this.objects).filter(t=>null!==this.objects[t]);t.length>0&&!this.activeObject&&(this.activeObject=t[0])}}_handleSearch(t){this.searchQuery=t.target.value}_selectObject(t){this.activeObject=t}render(){if(!this.objects||0===Object.keys(this.objects).length)return I`<div class="empty-state">No Liquid objects available on this page</div>`;const t=Object.keys(this.objects),e=this.activeObject?this.objects[this.activeObject]:null;return I`
|
|
220
|
+
<input
|
|
221
|
+
type="search"
|
|
222
|
+
class="search"
|
|
223
|
+
placeholder="Filter objects..."
|
|
224
|
+
.value=${this.searchQuery}
|
|
225
|
+
@input=${this._handleSearch}
|
|
226
|
+
>
|
|
227
|
+
|
|
228
|
+
<div class="object-tabs">
|
|
229
|
+
${t.map(t=>I`
|
|
230
|
+
<button
|
|
231
|
+
class="object-tab ${this.activeObject===t?"object-tab--active":""} ${null===this.objects[t]?"object-tab--null":""}"
|
|
232
|
+
@click=${()=>this._selectObject(t)}
|
|
233
|
+
>
|
|
234
|
+
${t}${null===this.objects[t]?" ∅":""}
|
|
235
|
+
</button>
|
|
236
|
+
`)}
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<div class="object-content">
|
|
240
|
+
${null===e?I`<div class="null-state">${this.activeObject} is null on this page</div>`:I`
|
|
241
|
+
<tdt-object-inspector
|
|
242
|
+
.data=${e}
|
|
243
|
+
.path=${"objects."+this.activeObject}
|
|
244
|
+
></tdt-object-inspector>
|
|
245
|
+
`}
|
|
246
|
+
</div>
|
|
247
|
+
`}}__publicField(gt,"properties",{objects:{type:Object},activeObject:{type:String,state:!0},searchQuery:{type:String,state:!0}}),__publicField(gt,"styles",[dt,n`
|
|
248
|
+
:host {
|
|
249
|
+
display: block;
|
|
250
|
+
padding: 12px;
|
|
251
|
+
height: 100%;
|
|
252
|
+
overflow: auto;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.search {
|
|
256
|
+
width: 100%;
|
|
257
|
+
margin-bottom: 12px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.object-tabs {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-wrap: wrap;
|
|
263
|
+
gap: 6px;
|
|
264
|
+
margin-bottom: 12px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.object-tab {
|
|
268
|
+
background: var(--tdt-bg-secondary);
|
|
269
|
+
border: 1px solid var(--tdt-border);
|
|
270
|
+
border-radius: var(--tdt-radius);
|
|
271
|
+
padding: 4px 10px;
|
|
272
|
+
color: var(--tdt-text-muted);
|
|
273
|
+
font-family: var(--tdt-font);
|
|
274
|
+
font-size: 11px;
|
|
275
|
+
cursor: pointer;
|
|
276
|
+
transition: all 0.15s ease;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.object-tab:hover {
|
|
280
|
+
background: var(--tdt-bg-hover);
|
|
281
|
+
color: var(--tdt-text);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.object-tab--active {
|
|
285
|
+
background: var(--tdt-accent);
|
|
286
|
+
border-color: var(--tdt-accent);
|
|
287
|
+
color: white;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.object-tab--null {
|
|
291
|
+
opacity: 0.5;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.object-content {
|
|
295
|
+
overflow: auto;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.null-state {
|
|
299
|
+
color: var(--tdt-text-muted);
|
|
300
|
+
padding: 24px;
|
|
301
|
+
text-align: center;
|
|
302
|
+
font-style: italic;
|
|
303
|
+
}
|
|
304
|
+
`]),customElements.define("tdt-objects-panel",gt);class bt extends rt{constructor(){super(),this.sections=[],this.activeSection=null}connectedCallback(){super.connectedCallback(),this._refreshSections()}_refreshSections(){this.sections=ut.findSections()}_handleSectionClick(t){this.activeSection=t,ut.highlight(t)}_handleSectionLeave(){this.activeSection=null,ut.hide()}render(){return I`
|
|
305
|
+
<div class="header">
|
|
306
|
+
<button class="btn btn--sm" @click=${this._refreshSections}>↻ Refresh</button>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
${0===this.sections.length?I`<div class="empty-state">No sections found on this page</div>`:I`
|
|
310
|
+
<div class="section-list">
|
|
311
|
+
${this.sections.map(t=>I`
|
|
312
|
+
<div
|
|
313
|
+
class="section-item ${this.activeSection===t.id?"section-item--active":""}"
|
|
314
|
+
@click=${()=>this._handleSectionClick(t.id)}
|
|
315
|
+
@mouseleave=${this._handleSectionLeave}
|
|
316
|
+
>
|
|
317
|
+
<span class="section-id">${t.id}</span>
|
|
318
|
+
<span class="section-type">${t.type}</span>
|
|
319
|
+
<span class="section-blocks">${t.blockCount} blocks</span>
|
|
320
|
+
</div>
|
|
321
|
+
`)}
|
|
322
|
+
</div>
|
|
323
|
+
`}
|
|
324
|
+
`}}__publicField(bt,"properties",{sections:{type:Array,state:!0},activeSection:{type:String,state:!0}}),__publicField(bt,"styles",[dt,n`
|
|
325
|
+
:host {
|
|
326
|
+
display: block;
|
|
327
|
+
padding: 12px;
|
|
328
|
+
height: 100%;
|
|
329
|
+
overflow: auto;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.header {
|
|
333
|
+
margin-bottom: 12px;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.section-list {
|
|
337
|
+
display: flex;
|
|
338
|
+
flex-direction: column;
|
|
339
|
+
gap: 4px;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.section-item {
|
|
343
|
+
display: flex;
|
|
344
|
+
align-items: center;
|
|
345
|
+
gap: 12px;
|
|
346
|
+
padding: 8px 12px;
|
|
347
|
+
background: var(--tdt-bg-secondary);
|
|
348
|
+
border: 1px solid var(--tdt-border);
|
|
349
|
+
border-radius: var(--tdt-radius);
|
|
350
|
+
cursor: pointer;
|
|
351
|
+
transition: all 0.15s ease;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.section-item:hover {
|
|
355
|
+
background: var(--tdt-bg-hover);
|
|
356
|
+
border-color: var(--tdt-accent);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.section-item--active {
|
|
360
|
+
border-color: var(--tdt-accent);
|
|
361
|
+
background: rgba(59, 130, 246, 0.1);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.section-id {
|
|
365
|
+
font-weight: 600;
|
|
366
|
+
color: var(--tdt-text);
|
|
367
|
+
flex: 1;
|
|
368
|
+
overflow: hidden;
|
|
369
|
+
text-overflow: ellipsis;
|
|
370
|
+
white-space: nowrap;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.section-type {
|
|
374
|
+
color: var(--tdt-accent);
|
|
375
|
+
font-size: 11px;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.section-blocks {
|
|
379
|
+
color: var(--tdt-text-muted);
|
|
380
|
+
font-size: 11px;
|
|
381
|
+
}
|
|
382
|
+
`]),customElements.define("tdt-sections-panel",bt);class mt extends rt{constructor(){super(),this.cart=null,this.previousCart=null,this.diff=null}updated(t){if(t.has("cart")&&this.cart){const e=t.get("cart");e&&(this.previousCart=e,this.diff=ht.diffCart(e,this.cart))}}async _refresh(){const t=await ht.fetch();t&&ht.setCart(t)}async _clear(){confirm("Clear entire cart?")&&await ht.clear()}async _updateQuantity(t,e){await ht.change(t+1,e)}async _remove(t){await ht.change(t+1,0)}_formatMoney(t){return null==t?"—":`$${(t/100).toFixed(2)}`}render(){if(!this.cart)return I`<div class="empty-state">Loading cart...</div>`;const t=this.diff&&(this.diff.items.added.length>0||this.diff.items.removed.length>0||this.diff.items.modified.length>0);return I`
|
|
383
|
+
<div class="toolbar">
|
|
384
|
+
<div class="stats">
|
|
385
|
+
<span><strong>${this.cart.item_count}</strong> items</span>
|
|
386
|
+
<span><strong>${this._formatMoney(this.cart.total_price)}</strong> total</span>
|
|
387
|
+
<span>${this.cart.total_weight}g · ${this.cart.currency}</span>
|
|
388
|
+
</div>
|
|
389
|
+
<div class="actions">
|
|
390
|
+
<button class="btn btn--sm" @click=${this._refresh}>↻ Refresh</button>
|
|
391
|
+
<button class="btn btn--sm btn--danger" @click=${this._clear}>Clear</button>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
${t?I`
|
|
396
|
+
<div class="diff">
|
|
397
|
+
${this.diff.items.added.map(t=>I`
|
|
398
|
+
<span class="diff__added">+ ${t.title} ×${t.quantity}</span>
|
|
399
|
+
`)}
|
|
400
|
+
${this.diff.items.removed.map(t=>I`
|
|
401
|
+
<span class="diff__removed">− ${t.title}</span>
|
|
402
|
+
`)}
|
|
403
|
+
${this.diff.items.modified.map(({item:t,oldQuantity:e,newQuantity:s})=>I`
|
|
404
|
+
<span class="diff__modified">~ ${t.title}: ${e}→${s}</span>
|
|
405
|
+
`)}
|
|
406
|
+
</div>
|
|
407
|
+
`:""}
|
|
408
|
+
|
|
409
|
+
${0===this.cart.items.length?I`<div class="empty-state">Cart is empty</div>`:I`
|
|
410
|
+
<table>
|
|
411
|
+
<thead>
|
|
412
|
+
<tr>
|
|
413
|
+
<th class="col-img"></th>
|
|
414
|
+
<th>Product</th>
|
|
415
|
+
<th>SKU</th>
|
|
416
|
+
<th class="col-qty">Qty</th>
|
|
417
|
+
<th class="col-price">Price</th>
|
|
418
|
+
<th class="col-actions"></th>
|
|
419
|
+
</tr>
|
|
420
|
+
</thead>
|
|
421
|
+
<tbody>
|
|
422
|
+
${this.cart.items.map((t,e)=>I`
|
|
423
|
+
<tr>
|
|
424
|
+
<td class="col-img">
|
|
425
|
+
${t.image?I`<img class="item-img" src="${t.image.replace(/(\.[^.]+)$/,"_60x60$1")}" alt="">`:I`<div class="item-img"></div>`}
|
|
426
|
+
</td>
|
|
427
|
+
<td>
|
|
428
|
+
<div class="item-title" title="${t.product_title}">${t.product_title}</div>
|
|
429
|
+
${t.variant_title?I`<div class="item-variant">${t.variant_title}</div>`:""}
|
|
430
|
+
</td>
|
|
431
|
+
<td class="item-sku">${t.sku||"—"}</td>
|
|
432
|
+
<td>
|
|
433
|
+
<input
|
|
434
|
+
type="number"
|
|
435
|
+
class="qty-input"
|
|
436
|
+
.value=${t.quantity}
|
|
437
|
+
min="0"
|
|
438
|
+
@change=${t=>this._updateQuantity(e,parseInt(t.target.value,10))}
|
|
439
|
+
>
|
|
440
|
+
</td>
|
|
441
|
+
<td class="item-price">${this._formatMoney(t.line_price)}</td>
|
|
442
|
+
<td>
|
|
443
|
+
<button class="remove-btn" @click=${()=>this._remove(e)} title="Remove">×</button>
|
|
444
|
+
</td>
|
|
445
|
+
</tr>
|
|
446
|
+
`)}
|
|
447
|
+
</tbody>
|
|
448
|
+
</table>
|
|
449
|
+
`}
|
|
450
|
+
`}}__publicField(mt,"properties",{cart:{type:Object},previousCart:{type:Object,state:!0},diff:{type:Object,state:!0}}),__publicField(mt,"styles",[dt,n`
|
|
451
|
+
:host {
|
|
452
|
+
display: block;
|
|
453
|
+
padding: 8px 12px;
|
|
454
|
+
height: 100%;
|
|
455
|
+
overflow: auto;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.toolbar {
|
|
459
|
+
display: flex;
|
|
460
|
+
align-items: center;
|
|
461
|
+
gap: 16px;
|
|
462
|
+
margin-bottom: 8px;
|
|
463
|
+
flex-wrap: wrap;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.stats {
|
|
467
|
+
display: flex;
|
|
468
|
+
gap: 12px;
|
|
469
|
+
font-size: 11px;
|
|
470
|
+
color: var(--tdt-text-muted);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.stats strong {
|
|
474
|
+
color: var(--tdt-text);
|
|
475
|
+
font-weight: 600;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.actions {
|
|
479
|
+
display: flex;
|
|
480
|
+
gap: 6px;
|
|
481
|
+
margin-left: auto;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.diff {
|
|
485
|
+
display: flex;
|
|
486
|
+
gap: 12px;
|
|
487
|
+
flex-wrap: wrap;
|
|
488
|
+
padding: 4px 8px;
|
|
489
|
+
background: var(--tdt-bg-secondary);
|
|
490
|
+
border-radius: var(--tdt-radius);
|
|
491
|
+
margin-bottom: 8px;
|
|
492
|
+
font-size: 10px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.diff__added { color: var(--tdt-success); }
|
|
496
|
+
.diff__removed { color: var(--tdt-danger); }
|
|
497
|
+
.diff__modified { color: var(--tdt-warning); }
|
|
498
|
+
|
|
499
|
+
table {
|
|
500
|
+
width: 100%;
|
|
501
|
+
border-collapse: collapse;
|
|
502
|
+
font-size: 11px;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
th {
|
|
506
|
+
text-align: left;
|
|
507
|
+
padding: 4px 8px;
|
|
508
|
+
font-size: 10px;
|
|
509
|
+
font-weight: 600;
|
|
510
|
+
color: var(--tdt-text-muted);
|
|
511
|
+
text-transform: uppercase;
|
|
512
|
+
letter-spacing: 0.5px;
|
|
513
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
514
|
+
background: var(--tdt-bg-secondary);
|
|
515
|
+
position: sticky;
|
|
516
|
+
top: 0;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
td {
|
|
520
|
+
padding: 6px 8px;
|
|
521
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
522
|
+
vertical-align: middle;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
tr:hover td {
|
|
526
|
+
background: var(--tdt-bg-secondary);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.col-img { width: 32px; }
|
|
530
|
+
.col-qty { width: 50px; }
|
|
531
|
+
.col-price { width: 70px; text-align: right; }
|
|
532
|
+
.col-actions { width: 30px; text-align: center; }
|
|
533
|
+
|
|
534
|
+
.item-img {
|
|
535
|
+
width: 28px;
|
|
536
|
+
height: 28px;
|
|
537
|
+
object-fit: cover;
|
|
538
|
+
border-radius: 3px;
|
|
539
|
+
background: var(--tdt-bg);
|
|
540
|
+
display: block;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.item-title {
|
|
544
|
+
font-weight: 500;
|
|
545
|
+
color: var(--tdt-text);
|
|
546
|
+
white-space: nowrap;
|
|
547
|
+
overflow: hidden;
|
|
548
|
+
text-overflow: ellipsis;
|
|
549
|
+
max-width: 200px;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.item-variant {
|
|
553
|
+
color: var(--tdt-text-muted);
|
|
554
|
+
font-size: 10px;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.item-sku {
|
|
558
|
+
color: var(--tdt-text-muted);
|
|
559
|
+
font-size: 10px;
|
|
560
|
+
font-family: var(--tdt-font-mono);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.item-price {
|
|
564
|
+
font-weight: 600;
|
|
565
|
+
color: var(--tdt-accent);
|
|
566
|
+
text-align: right;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.qty-input {
|
|
570
|
+
width: 70px;
|
|
571
|
+
padding: 2px 4px;
|
|
572
|
+
text-align: center;
|
|
573
|
+
font-size: 11px;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.remove-btn {
|
|
577
|
+
padding: 2px 6px;
|
|
578
|
+
font-size: 10px;
|
|
579
|
+
line-height: 1;
|
|
580
|
+
background: transparent;
|
|
581
|
+
border: 1px solid var(--tdt-border);
|
|
582
|
+
color: var(--tdt-text-muted);
|
|
583
|
+
border-radius: 3px;
|
|
584
|
+
cursor: pointer;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.remove-btn:hover {
|
|
588
|
+
background: var(--tdt-danger);
|
|
589
|
+
border-color: var(--tdt-danger);
|
|
590
|
+
color: white;
|
|
591
|
+
}
|
|
592
|
+
`]),customElements.define("tdt-cart-panel",mt);class ft extends rt{constructor(){super(),this.meta={}}_renderSection(t,e){return I`
|
|
593
|
+
<div class="section">
|
|
594
|
+
<h4 class="section__title">${t}</h4>
|
|
595
|
+
<table class="table">
|
|
596
|
+
${e.map(([t,e])=>I`
|
|
597
|
+
<tr>
|
|
598
|
+
<td class="table__label">${t}</td>
|
|
599
|
+
<td class="table__value">${e??"—"}</td>
|
|
600
|
+
</tr>
|
|
601
|
+
`)}
|
|
602
|
+
</table>
|
|
603
|
+
</div>
|
|
604
|
+
`}render(){var t,e,s,i,a,o,n,r,l,d,c,p,h,u,v,g,b,m,f,x,y,_,$,w,k,S,j;if(!this.meta)return I`<div class="empty-state">No metadata available</div>`;const E=[{title:"Theme",items:[["ID",null==(t=this.meta.theme)?void 0:t.id],["Name",null==(e=this.meta.theme)?void 0:e.name],["Role",null==(s=this.meta.theme)?void 0:s.role]]},{title:"Template",items:[["Name",null==(i=this.meta.template)?void 0:i.name],["Suffix",(null==(a=this.meta.template)?void 0:a.suffix)||"—"],["Directory",(null==(o=this.meta.template)?void 0:o.directory)||"—"]]},{title:"Request",items:[["Page Type",null==(n=this.meta.request)?void 0:n.page_type],["Path",null==(r=this.meta.request)?void 0:r.path],["Host",null==(l=this.meta.request)?void 0:l.host],["Design Mode",(null==(d=this.meta.request)?void 0:d.design_mode)?"Yes":"No"],["Visual Preview",(null==(c=this.meta.request)?void 0:c.visual_preview_mode)?"Yes":"No"]]},{title:"Localization",items:[["Locale",`${(null==(h=null==(p=this.meta.request)?void 0:p.locale)?void 0:h.name)||""} (${(null==(v=null==(u=this.meta.request)?void 0:u.locale)?void 0:v.iso_code)||""})`],["Country",`${(null==(b=null==(g=this.meta.localization)?void 0:g.country)?void 0:b.name)||""} (${(null==(f=null==(m=this.meta.localization)?void 0:m.country)?void 0:f.iso_code)||""})`],["Currency",`${(null==(_=null==(y=null==(x=this.meta.localization)?void 0:x.country)?void 0:y.currency)?void 0:_.symbol)||""} ${(null==(k=null==(w=null==($=this.meta.localization)?void 0:$.country)?void 0:w.currency)?void 0:k.iso_code)||""}`],["Market",(null==(j=null==(S=this.meta.localization)?void 0:S.market)?void 0:j.handle)||"—"]]}];return I`
|
|
605
|
+
${E.map(t=>this._renderSection(t.title,t.items))}
|
|
606
|
+
`}}__publicField(ft,"properties",{meta:{type:Object}}),__publicField(ft,"styles",[dt,n`
|
|
607
|
+
:host {
|
|
608
|
+
display: block;
|
|
609
|
+
padding: 12px;
|
|
610
|
+
height: 100%;
|
|
611
|
+
overflow: auto;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.section {
|
|
615
|
+
margin-bottom: 16px;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.section__title {
|
|
619
|
+
font-size: 11px;
|
|
620
|
+
font-weight: 600;
|
|
621
|
+
text-transform: uppercase;
|
|
622
|
+
letter-spacing: 0.5px;
|
|
623
|
+
color: var(--tdt-text-muted);
|
|
624
|
+
margin: 0 0 8px 0;
|
|
625
|
+
padding-bottom: 4px;
|
|
626
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.table {
|
|
630
|
+
width: 100%;
|
|
631
|
+
border-collapse: collapse;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.table td {
|
|
635
|
+
padding: 4px 0;
|
|
636
|
+
vertical-align: top;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.table__label {
|
|
640
|
+
color: var(--tdt-text-muted);
|
|
641
|
+
width: 120px;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.table__value {
|
|
645
|
+
color: var(--tdt-text);
|
|
646
|
+
word-break: break-all;
|
|
647
|
+
}
|
|
648
|
+
`]),customElements.define("tdt-info-panel",ft);class xt extends rt{constructor(){super(),this.metafields=null,this.searchQuery="",this.expandedPaths=new Set(["shop","product","collection","customer"]),this.copiedPath=null}_getResourceIcon(t){return{shop:"🏪",product:"📦",collection:"📂",customer:"👤",article:"📝",blog:"📰",page:"📄"}[t]||"📋"}_getTypeClass(t){if(!t)return"unknown";const e=t.toLowerCase().replace(/\s+/g,"_"),s=["string","number","integer","boolean","json","date","date_time","url","link","color","rich_text","multi_line_text","file","file_reference","list","rating"].find(t=>e.includes(t));return s||"unknown"}_toggleResource(t){const e=new Set(this.expandedPaths);e.has(t)?e.delete(t):e.add(t),this.expandedPaths=e}_toggleNamespace(t){const e=new Set(this.expandedPaths);e.has(t)?e.delete(t):e.add(t),this.expandedPaths=e}async _copyLiquidPath(t,e,s,i){i.stopPropagation();const a=`{{ ${t}.metafields.${e}.${s} }}`;try{await navigator.clipboard.writeText(a),this.copiedPath=`${t}.${e}.${s}`,setTimeout(()=>{this.copiedPath=null},1500)}catch(o){console.error("Failed to copy:",o)}}_formatValue(t,e){if(null==t)return I`<span class="value--null">null</span>`;if("object"==typeof t){const e=JSON.stringify(t,null,2),s=e.length>100;return I`
|
|
649
|
+
<span class="value--json ${s?"value--truncated":""}"
|
|
650
|
+
title="${s?"Click to expand":""}"
|
|
651
|
+
@click=${s?()=>alert(e):null}>
|
|
652
|
+
${s?e.slice(0,100)+"...":e}
|
|
653
|
+
</span>
|
|
654
|
+
`}if("string"==typeof t){const e=t.length>80;return I`
|
|
655
|
+
<span class="value--string" title="${e?t:""}">
|
|
656
|
+
"${e?t.slice(0,80)+"...":t}"
|
|
657
|
+
</span>
|
|
658
|
+
`}return"number"==typeof t?I`<span class="value--number">${t}</span>`:"boolean"==typeof t?I`<span class="value--boolean">${t}</span>`:I`<span>${String(t)}</span>`}_filterMetafields(t){if(!this.searchQuery.trim())return t;const e=this.searchQuery.toLowerCase(),s={};for(const[i,a]of Object.entries(t)){if(!a||"object"!=typeof a)continue;const t={};for(const[s,i]of Object.entries(a)){if(!i||"object"!=typeof i)continue;const a={};for(const[t,o]of Object.entries(i)){const i=t.toLowerCase().includes(e),n=s.toLowerCase().includes(e),r=(null==o?void 0:o.value)&&String(o.value).toLowerCase().includes(e);(i||n||r)&&(a[t]=o)}Object.keys(a).length>0&&(t[s]=a)}Object.keys(t).length>0&&(s[i]=t)}return s}_countMetafields(t){let e=0;if(!t)return e;for(const s of Object.values(t))if(s&&"object"==typeof s)for(const t of Object.values(s))t&&"object"==typeof t&&(e+=Object.keys(t).length);return e}_countResourceMetafields(t){let e=0;if(!t||"object"!=typeof t)return e;for(const s of Object.values(t))s&&"object"==typeof s&&(e+=Object.keys(s).length);return e}_renderMetafield(t,e,s,i){const a=`${t}.${e}.${s}`,o=this.copiedPath===a;return I`
|
|
659
|
+
<div class="metafield">
|
|
660
|
+
<div class="metafield__key">
|
|
661
|
+
<span
|
|
662
|
+
class="metafield__name ${o?"metafield__name--copied":""}"
|
|
663
|
+
@click=${i=>this._copyLiquidPath(t,e,s,i)}
|
|
664
|
+
title="Click to copy Liquid path"
|
|
665
|
+
>${s}</span>
|
|
666
|
+
${(null==i?void 0:i.type)?I`
|
|
667
|
+
<span class="metafield__type type--${this._getTypeClass(i.type)}">
|
|
668
|
+
${i.type}
|
|
669
|
+
</span>
|
|
670
|
+
`:""}
|
|
671
|
+
</div>
|
|
672
|
+
<div class="metafield__value">
|
|
673
|
+
${this._formatValue(null==i?void 0:i.value,null==i?void 0:i.type)}
|
|
674
|
+
</div>
|
|
675
|
+
<button
|
|
676
|
+
class="copy-btn"
|
|
677
|
+
@click=${i=>this._copyLiquidPath(t,e,s,i)}
|
|
678
|
+
title="Copy Liquid path"
|
|
679
|
+
>
|
|
680
|
+
${o?"✓":"Copy"}
|
|
681
|
+
</button>
|
|
682
|
+
</div>
|
|
683
|
+
`}_renderNamespace(t,e,s){const i=`${t}.${e}`,a=this.expandedPaths.has(i),o=Object.keys(s).length;return I`
|
|
684
|
+
<div class="namespace">
|
|
685
|
+
<div class="namespace-header" @click=${()=>this._toggleNamespace(i)}>
|
|
686
|
+
<span class="expand-icon ${a?"expand-icon--open":""}">▶</span>
|
|
687
|
+
<span class="namespace-name">${e}</span>
|
|
688
|
+
<span class="resource-count">${o}</span>
|
|
689
|
+
</div>
|
|
690
|
+
${a?I`
|
|
691
|
+
<div class="metafield-list">
|
|
692
|
+
${Object.entries(s).map(([s,i])=>this._renderMetafield(t,e,s,i))}
|
|
693
|
+
</div>
|
|
694
|
+
`:""}
|
|
695
|
+
</div>
|
|
696
|
+
`}_renderResource(t,e){const s=this.expandedPaths.has(t),i=this._countResourceMetafields(e);return 0===i?"":I`
|
|
697
|
+
<div class="resource-group">
|
|
698
|
+
<div class="resource-header" @click=${()=>this._toggleResource(t)}>
|
|
699
|
+
<span class="resource-icon">${this._getResourceIcon(t)}</span>
|
|
700
|
+
<span class="resource-name">${t}</span>
|
|
701
|
+
<span class="resource-count">${i} metafield${1!==i?"s":""}</span>
|
|
702
|
+
<span class="expand-icon ${s?"expand-icon--open":""}">▶</span>
|
|
703
|
+
</div>
|
|
704
|
+
${s?I`
|
|
705
|
+
<div class="namespace-list">
|
|
706
|
+
${Object.entries(e).map(([e,s])=>this._renderNamespace(t,e,s))}
|
|
707
|
+
</div>
|
|
708
|
+
`:""}
|
|
709
|
+
</div>
|
|
710
|
+
`}render(){if(!this.metafields||0===Object.keys(this.metafields).length)return I`
|
|
711
|
+
<div class="empty-state">
|
|
712
|
+
<div class="empty-state__icon">🏷️</div>
|
|
713
|
+
<div class="empty-state__title">No Metafields Found</div>
|
|
714
|
+
<div class="empty-state__hint">
|
|
715
|
+
Metafields will appear here when available. Make sure your theme-devtools-bridge.liquid
|
|
716
|
+
is configured with your metafield namespaces.
|
|
717
|
+
</div>
|
|
718
|
+
</div>
|
|
719
|
+
`;const t=this._filterMetafields(this.metafields),e=this._countMetafields(this.metafields),s=this._countMetafields(t),i=Object.keys(t).length>0;return I`
|
|
720
|
+
<div class="toolbar">
|
|
721
|
+
<input
|
|
722
|
+
type="text"
|
|
723
|
+
class="search-input"
|
|
724
|
+
placeholder="Search metafields by namespace, key, or value..."
|
|
725
|
+
.value=${this.searchQuery}
|
|
726
|
+
@input=${t=>this.searchQuery=t.target.value}
|
|
727
|
+
>
|
|
728
|
+
<div class="stats">
|
|
729
|
+
${this.searchQuery?I`<strong>${s}</strong> of ${e} metafields`:I`<strong>${e}</strong> metafields`}
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
|
|
733
|
+
${i?Object.entries(t).map(([t,e])=>this._renderResource(t,e)):I`<div class="no-results">No metafields match "${this.searchQuery}"</div>`}
|
|
734
|
+
`}}__publicField(xt,"properties",{metafields:{type:Object},searchQuery:{type:String,state:!0},expandedPaths:{type:Object,state:!0},copiedPath:{type:String,state:!0}}),__publicField(xt,"styles",[dt,n`
|
|
735
|
+
:host {
|
|
736
|
+
display: block;
|
|
737
|
+
padding: 8px 12px;
|
|
738
|
+
height: 100%;
|
|
739
|
+
overflow: auto;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.toolbar {
|
|
743
|
+
display: flex;
|
|
744
|
+
align-items: center;
|
|
745
|
+
gap: 8px;
|
|
746
|
+
margin-bottom: 12px;
|
|
747
|
+
flex-wrap: wrap;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.search-input {
|
|
751
|
+
flex: 1;
|
|
752
|
+
min-width: 200px;
|
|
753
|
+
padding: 6px 10px;
|
|
754
|
+
background: var(--tdt-bg-secondary);
|
|
755
|
+
border: 1px solid var(--tdt-border);
|
|
756
|
+
border-radius: var(--tdt-radius);
|
|
757
|
+
color: var(--tdt-text);
|
|
758
|
+
font-size: 11px;
|
|
759
|
+
font-family: var(--tdt-font);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
.search-input:focus {
|
|
763
|
+
outline: none;
|
|
764
|
+
border-color: var(--tdt-accent);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
.search-input::placeholder {
|
|
768
|
+
color: var(--tdt-text-muted);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
.stats {
|
|
772
|
+
font-size: 11px;
|
|
773
|
+
color: var(--tdt-text-muted);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.stats strong {
|
|
777
|
+
color: var(--tdt-text);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.resource-group {
|
|
781
|
+
margin-bottom: 16px;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
.resource-header {
|
|
785
|
+
display: flex;
|
|
786
|
+
align-items: center;
|
|
787
|
+
gap: 8px;
|
|
788
|
+
padding: 8px 10px;
|
|
789
|
+
background: var(--tdt-bg-secondary);
|
|
790
|
+
border: 1px solid var(--tdt-border);
|
|
791
|
+
border-radius: var(--tdt-radius);
|
|
792
|
+
cursor: pointer;
|
|
793
|
+
user-select: none;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.resource-header:hover {
|
|
797
|
+
background: var(--tdt-bg-hover);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.resource-icon {
|
|
801
|
+
font-size: 14px;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.resource-name {
|
|
805
|
+
font-weight: 600;
|
|
806
|
+
font-size: 12px;
|
|
807
|
+
color: var(--tdt-text);
|
|
808
|
+
flex: 1;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
.resource-count {
|
|
812
|
+
font-size: 10px;
|
|
813
|
+
color: var(--tdt-text-muted);
|
|
814
|
+
background: var(--tdt-bg);
|
|
815
|
+
padding: 2px 6px;
|
|
816
|
+
border-radius: 10px;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.expand-icon {
|
|
820
|
+
font-size: 10px;
|
|
821
|
+
color: var(--tdt-text-muted);
|
|
822
|
+
transition: transform 0.15s ease;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.expand-icon--open {
|
|
826
|
+
transform: rotate(90deg);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.namespace-list {
|
|
830
|
+
margin-top: 4px;
|
|
831
|
+
margin-left: 12px;
|
|
832
|
+
border-left: 1px solid var(--tdt-border);
|
|
833
|
+
padding-left: 12px;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.namespace {
|
|
837
|
+
margin-bottom: 8px;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
.namespace-header {
|
|
841
|
+
display: flex;
|
|
842
|
+
align-items: center;
|
|
843
|
+
gap: 6px;
|
|
844
|
+
padding: 4px 8px;
|
|
845
|
+
cursor: pointer;
|
|
846
|
+
border-radius: var(--tdt-radius);
|
|
847
|
+
font-size: 11px;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
.namespace-header:hover {
|
|
851
|
+
background: var(--tdt-bg-hover);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.namespace-name {
|
|
855
|
+
color: var(--tdt-accent);
|
|
856
|
+
font-family: var(--tdt-font-mono);
|
|
857
|
+
font-weight: 500;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.metafield-list {
|
|
861
|
+
margin-left: 16px;
|
|
862
|
+
margin-top: 4px;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.metafield {
|
|
866
|
+
display: flex;
|
|
867
|
+
align-items: flex-start;
|
|
868
|
+
gap: 8px;
|
|
869
|
+
padding: 6px 8px;
|
|
870
|
+
border-radius: var(--tdt-radius);
|
|
871
|
+
font-size: 11px;
|
|
872
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
.metafield:last-child {
|
|
876
|
+
border-bottom: none;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.metafield:hover {
|
|
880
|
+
background: var(--tdt-bg-hover);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
.metafield__key {
|
|
884
|
+
display: flex;
|
|
885
|
+
align-items: center;
|
|
886
|
+
gap: 6px;
|
|
887
|
+
min-width: 140px;
|
|
888
|
+
flex-shrink: 0;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.metafield__name {
|
|
892
|
+
color: var(--tdt-key);
|
|
893
|
+
font-family: var(--tdt-font-mono);
|
|
894
|
+
cursor: pointer;
|
|
895
|
+
padding: 1px 4px;
|
|
896
|
+
border-radius: 2px;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.metafield__name:hover {
|
|
900
|
+
background: rgba(199, 146, 234, 0.2);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
.metafield__name--copied {
|
|
904
|
+
background: rgba(34, 197, 94, 0.3) !important;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.metafield__type {
|
|
908
|
+
font-size: 9px;
|
|
909
|
+
padding: 2px 5px;
|
|
910
|
+
border-radius: 3px;
|
|
911
|
+
text-transform: uppercase;
|
|
912
|
+
letter-spacing: 0.3px;
|
|
913
|
+
font-weight: 500;
|
|
914
|
+
white-space: nowrap;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
.type--string { background: #2d4a3e; color: #98c379; }
|
|
918
|
+
.type--number, .type--integer { background: #3d3a2d; color: #d19a66; }
|
|
919
|
+
.type--boolean { background: #2d3a4a; color: #61afef; }
|
|
920
|
+
.type--json { background: #4a2d4a; color: #c678dd; }
|
|
921
|
+
.type--date, .type--date_time { background: #2d4a4a; color: #56b6c2; }
|
|
922
|
+
.type--url, .type--link { background: #3d2d2d; color: #e06c75; }
|
|
923
|
+
.type--color { background: #4a3d2d; color: #e5c07b; }
|
|
924
|
+
.type--rich_text, .type--multi_line_text { background: #2d3d3d; color: #abb2bf; }
|
|
925
|
+
.type--file, .type--file_reference { background: #3a3d2d; color: #98c379; }
|
|
926
|
+
.type--list { background: #3d2d4a; color: #c678dd; }
|
|
927
|
+
.type--rating { background: #4a4a2d; color: #e5c07b; }
|
|
928
|
+
.type--unknown { background: var(--tdt-bg); color: var(--tdt-text-muted); }
|
|
929
|
+
|
|
930
|
+
.metafield__value {
|
|
931
|
+
flex: 1;
|
|
932
|
+
min-width: 0;
|
|
933
|
+
word-break: break-word;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
.value--string { color: var(--tdt-string); }
|
|
937
|
+
.value--number { color: var(--tdt-number); }
|
|
938
|
+
.value--boolean { color: var(--tdt-boolean); }
|
|
939
|
+
.value--null { color: var(--tdt-null); font-style: italic; }
|
|
940
|
+
.value--json {
|
|
941
|
+
color: var(--tdt-text-muted);
|
|
942
|
+
font-family: var(--tdt-font-mono);
|
|
943
|
+
font-size: 10px;
|
|
944
|
+
}
|
|
945
|
+
.value--truncated {
|
|
946
|
+
cursor: pointer;
|
|
947
|
+
}
|
|
948
|
+
.value--truncated:hover {
|
|
949
|
+
text-decoration: underline;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
.copy-btn {
|
|
953
|
+
opacity: 0;
|
|
954
|
+
padding: 2px 6px;
|
|
955
|
+
font-size: 10px;
|
|
956
|
+
background: var(--tdt-bg);
|
|
957
|
+
border: 1px solid var(--tdt-border);
|
|
958
|
+
border-radius: 3px;
|
|
959
|
+
color: var(--tdt-text-muted);
|
|
960
|
+
cursor: pointer;
|
|
961
|
+
transition: opacity 0.15s;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.metafield:hover .copy-btn {
|
|
965
|
+
opacity: 1;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
.copy-btn:hover {
|
|
969
|
+
background: var(--tdt-accent);
|
|
970
|
+
border-color: var(--tdt-accent);
|
|
971
|
+
color: white;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.empty-state {
|
|
975
|
+
text-align: center;
|
|
976
|
+
padding: 40px 20px;
|
|
977
|
+
color: var(--tdt-text-muted);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.empty-state__icon {
|
|
981
|
+
font-size: 32px;
|
|
982
|
+
margin-bottom: 12px;
|
|
983
|
+
opacity: 0.5;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
.empty-state__title {
|
|
987
|
+
font-size: 14px;
|
|
988
|
+
font-weight: 600;
|
|
989
|
+
color: var(--tdt-text);
|
|
990
|
+
margin-bottom: 8px;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
.empty-state__hint {
|
|
994
|
+
font-size: 11px;
|
|
995
|
+
max-width: 300px;
|
|
996
|
+
margin: 0 auto;
|
|
997
|
+
line-height: 1.5;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
.no-results {
|
|
1001
|
+
padding: 20px;
|
|
1002
|
+
text-align: center;
|
|
1003
|
+
color: var(--tdt-text-muted);
|
|
1004
|
+
font-size: 12px;
|
|
1005
|
+
}
|
|
1006
|
+
`]),customElements.define("tdt-metafields-panel",xt);class yt extends rt{constructor(){super(),this.settings=null,this.sectionSettings=null,this.searchQuery="",this.expandedPaths=new Set(["theme","colors","typography"]),this.activeView="theme",this.copiedPath=null,this.validationErrors=[],this._showExportModal=!1,this._showValidationModal=!1}_getTypeClass(t){if(!t)return"";return{color:"color",color_background:"color",text:"text",textarea:"textarea",richtext:"richtext",html:"html",number:"number",range:"range",checkbox:"checkbox",select:"select",radio:"radio",image_picker:"image_picker",video:"video",video_url:"video_url",url:"url",link_list:"link_list",product:"product",collection:"collection",blog:"blog",page:"page",article:"article",font_picker:"font_picker"}[t]||""}_toggleGroup(t){const e=new Set(this.expandedPaths);e.has(t)?e.delete(t):e.add(t),this.expandedPaths=e}async _copySettingPath(t,e){null==e||e.stopPropagation();const s=`{{ settings.${t} }}`;try{await navigator.clipboard.writeText(s),this.copiedPath=t,setTimeout(()=>{this.copiedPath=null},1500)}catch(i){console.error("Failed to copy:",i)}}_formatValue(t,e){if(null==t)return I`<span class="value--null">null</span>`;if("color"===e||"color_background"===e)return I`
|
|
1007
|
+
<span class="value--color">
|
|
1008
|
+
<span class="color-swatch" style="background: ${t}"></span>
|
|
1009
|
+
<span class="value--string">${t}</span>
|
|
1010
|
+
</span>
|
|
1011
|
+
`;if("image_picker"===e&&t){const e="object"==typeof t?t.src:t;return I`
|
|
1012
|
+
<span class="value--image">
|
|
1013
|
+
${e?I`<img class="image-preview" src="${e}" alt="">`:""}
|
|
1014
|
+
<span class="value--string value--truncated">${e||"No image"}</span>
|
|
1015
|
+
</span>
|
|
1016
|
+
`}if("object"==typeof t)return I`<span class="value--string">${JSON.stringify(t)}</span>`;if("string"==typeof t){const e=t.length>60?t.slice(0,60)+"...":t;return I`<span class="value--string" title="${t}">"${e}"</span>`}return"number"==typeof t?I`<span class="value--number">${t}</span>`:"boolean"==typeof t?I`<span class="value--boolean">${t}</span>`:I`<span>${String(t)}</span>`}_filterSettings(t){var e;if(!this.searchQuery.trim()||!t)return t;const s=this.searchQuery.toLowerCase(),i={};for(const[a,o]of Object.entries(t)){if("object"!=typeof o||null===o)continue;const t={};for(const[i,n]of Object.entries(o)){const o=i.toLowerCase().includes(s),r=a.toLowerCase().includes(s),l=null==(e=null==n?void 0:n.label)?void 0:e.toLowerCase().includes(s),d=(null==n?void 0:n.value)&&String(n.value).toLowerCase().includes(s);(o||r||l||d)&&(t[i]=n)}Object.keys(t).length>0&&(i[a]=t)}return i}_countSettings(t){let e=0;if(!t)return e;for(const s of Object.values(t))s&&"object"==typeof s&&(e+=Object.keys(s).length);return e}_exportSettings(){const t={theme_settings:this.settings,section_settings:this.sectionSettings,exported_at:(new Date).toISOString()};this._exportData=JSON.stringify(t,null,2),this._showExportModal=!0,this.requestUpdate()}_closeExportModal(){this._showExportModal=!1,this.requestUpdate()}async _copyExport(){try{await navigator.clipboard.writeText(this._exportData),this._closeExportModal()}catch(t){console.error("Failed to copy:",t)}}_downloadExport(){const t=new Blob([this._exportData],{type:"application/json"}),e=URL.createObjectURL(t),s=document.createElement("a");s.href=e,s.download=`theme-settings-${(new Date).toISOString().split("T")[0]}.json`,s.click(),URL.revokeObjectURL(e),this._closeExportModal()}_showValidation(){this._showValidationModal=!this._showValidationModal,this.requestUpdate()}_renderSetting(t,e,s){var i;const a=this.copiedPath===t,o=this.validationErrors.some(e=>e.path===t);return I`
|
|
1017
|
+
<div class="setting-item ${o?"setting-item--error":""}">
|
|
1018
|
+
<div class="setting__key">
|
|
1019
|
+
<span
|
|
1020
|
+
class="setting__id ${a?"setting__id--copied":""}"
|
|
1021
|
+
@click=${e=>this._copySettingPath(t,e)}
|
|
1022
|
+
title="Click to copy Liquid path"
|
|
1023
|
+
>${t}</span>
|
|
1024
|
+
${(null==e?void 0:e.label)?I`<span class="setting__label">${e.label}</span>`:""}
|
|
1025
|
+
</div>
|
|
1026
|
+
${(null==e?void 0:e.type)?I`
|
|
1027
|
+
<span class="setting__type type--${this._getTypeClass(e.type)}">
|
|
1028
|
+
${e.type}
|
|
1029
|
+
</span>
|
|
1030
|
+
`:""}
|
|
1031
|
+
<div class="setting__value">
|
|
1032
|
+
${this._formatValue((null==e?void 0:e.value)??e,null==e?void 0:e.type)}
|
|
1033
|
+
${o?I`
|
|
1034
|
+
<div class="setting__error">
|
|
1035
|
+
⚠️ ${null==(i=this.validationErrors.find(e=>e.path===t))?void 0:i.message}
|
|
1036
|
+
</div>
|
|
1037
|
+
`:""}
|
|
1038
|
+
</div>
|
|
1039
|
+
</div>
|
|
1040
|
+
`}_renderGroup(t,e){const s=this.expandedPaths.has(t),i=Object.keys(e).length;return I`
|
|
1041
|
+
<div class="settings-group">
|
|
1042
|
+
<div class="group-header" @click=${()=>this._toggleGroup(t)}>
|
|
1043
|
+
<span class="group-icon">${{colors:"🎨",typography:"🔤",layout:"📐",header:"⬆️",footer:"⬇️",product:"📦",collection:"📂",cart:"🛒",social:"🔗",favicon:"⭐",checkout:"💳",theme:"🎭"}[t]||"⚙️"}</span>
|
|
1044
|
+
<span class="group-name">${t}</span>
|
|
1045
|
+
<span class="group-count">${i}</span>
|
|
1046
|
+
<span class="expand-icon ${s?"expand-icon--open":""}">▶</span>
|
|
1047
|
+
</div>
|
|
1048
|
+
${s?I`
|
|
1049
|
+
<div class="settings-list">
|
|
1050
|
+
${Object.entries(e).map(([e,s])=>this._renderSetting(e,s,t))}
|
|
1051
|
+
</div>
|
|
1052
|
+
`:""}
|
|
1053
|
+
</div>
|
|
1054
|
+
`}_renderSectionSettings(){return this.sectionSettings&&0!==Object.keys(this.sectionSettings).length?Object.entries(this.sectionSettings).map(([t,e])=>{const s=this.expandedPaths.has(`section-${t}`),i=e.settings?Object.keys(e.settings).length:0;return I`
|
|
1055
|
+
<div class="section-card">
|
|
1056
|
+
<div class="section-header" @click=${()=>this._toggleGroup(`section-${t}`)}>
|
|
1057
|
+
<span class="expand-icon ${s?"expand-icon--open":""}">▶</span>
|
|
1058
|
+
<span class="section-type">${e.type||"unknown"}</span>
|
|
1059
|
+
<span class="section-id">#${t}</span>
|
|
1060
|
+
<span class="group-count" style="margin-left: auto">${i} settings</span>
|
|
1061
|
+
</div>
|
|
1062
|
+
${s&&e.settings?I`
|
|
1063
|
+
<div class="section-content">
|
|
1064
|
+
${Object.entries(e.settings).map(([t,e])=>I`
|
|
1065
|
+
<div class="setting-item">
|
|
1066
|
+
<div class="setting__key">
|
|
1067
|
+
<span class="setting__id">${t}</span>
|
|
1068
|
+
</div>
|
|
1069
|
+
<div class="setting__value">
|
|
1070
|
+
${this._formatValue(e)}
|
|
1071
|
+
</div>
|
|
1072
|
+
</div>
|
|
1073
|
+
`)}
|
|
1074
|
+
</div>
|
|
1075
|
+
`:""}
|
|
1076
|
+
</div>
|
|
1077
|
+
`}):I`
|
|
1078
|
+
<div class="empty-state">
|
|
1079
|
+
<div class="empty-state__icon">📐</div>
|
|
1080
|
+
<div class="empty-state__title">No Section Settings</div>
|
|
1081
|
+
<div class="empty-state__hint">
|
|
1082
|
+
Section settings will appear here when available on the current page.
|
|
1083
|
+
</div>
|
|
1084
|
+
</div>
|
|
1085
|
+
`}_renderValidationModal(){return this._showValidationModal?I`
|
|
1086
|
+
<div class="validation-list">
|
|
1087
|
+
${0===this.validationErrors.length?I`<div class="no-results">✅ No validation errors found</div>`:this.validationErrors.map(t=>I`
|
|
1088
|
+
<div class="validation-item">
|
|
1089
|
+
<span class="validation-item__icon">⚠️</span>
|
|
1090
|
+
<span class="validation-item__path">${t.path}</span>
|
|
1091
|
+
<span class="validation-item__message">${t.message}</span>
|
|
1092
|
+
</div>
|
|
1093
|
+
`)}
|
|
1094
|
+
</div>
|
|
1095
|
+
`:""}_renderExportModal(){return this._showExportModal?I`
|
|
1096
|
+
<div class="export-modal" @click=${this._closeExportModal}>
|
|
1097
|
+
<div class="modal-content" @click=${t=>t.stopPropagation()}>
|
|
1098
|
+
<div class="modal-header">
|
|
1099
|
+
<span class="modal-title">📤 Export Settings</span>
|
|
1100
|
+
<button class="modal-close" @click=${this._closeExportModal}>×</button>
|
|
1101
|
+
</div>
|
|
1102
|
+
<textarea class="modal-textarea" readonly .value=${this._exportData||""}></textarea>
|
|
1103
|
+
<div class="modal-actions">
|
|
1104
|
+
<button class="btn btn--sm" @click=${this._copyExport}>📋 Copy</button>
|
|
1105
|
+
<button class="btn btn--sm btn--primary" @click=${this._downloadExport}>⬇️ Download</button>
|
|
1106
|
+
</div>
|
|
1107
|
+
</div>
|
|
1108
|
+
</div>
|
|
1109
|
+
`:""}render(){const t=this.settings&&Object.keys(this.settings).length>0,e=this.sectionSettings&&Object.keys(this.sectionSettings).length>0;if(!(t||e))return I`
|
|
1110
|
+
<div class="empty-state">
|
|
1111
|
+
<div class="empty-state__icon">🎨</div>
|
|
1112
|
+
<div class="empty-state__title">No Settings Found</div>
|
|
1113
|
+
<div class="empty-state__hint">
|
|
1114
|
+
Theme settings will appear here when available. Make sure your theme-devtools-bridge.liquid
|
|
1115
|
+
is configured to expose settings data.
|
|
1116
|
+
</div>
|
|
1117
|
+
</div>
|
|
1118
|
+
`;const s=this._filterSettings(this.settings);this._countSettings(this.settings),this._countSettings(s);const i=Object.keys(s||{}).length>0,a=this.validationErrors.length>0;return I`
|
|
1119
|
+
<div class="toolbar">
|
|
1120
|
+
<div class="view-tabs">
|
|
1121
|
+
<button
|
|
1122
|
+
class="view-tab ${"theme"===this.activeView?"view-tab--active":""}"
|
|
1123
|
+
@click=${()=>this.activeView="theme"}
|
|
1124
|
+
>Theme</button>
|
|
1125
|
+
<button
|
|
1126
|
+
class="view-tab ${"sections"===this.activeView?"view-tab--active":""}"
|
|
1127
|
+
@click=${()=>this.activeView="sections"}
|
|
1128
|
+
>Sections</button>
|
|
1129
|
+
${a?I`
|
|
1130
|
+
<button
|
|
1131
|
+
class="view-tab ${"validation"===this.activeView?"view-tab--active":""}"
|
|
1132
|
+
@click=${()=>this.activeView="validation"}
|
|
1133
|
+
style="color: var(--tdt-danger)"
|
|
1134
|
+
>⚠️ ${this.validationErrors.length}</button>
|
|
1135
|
+
`:""}
|
|
1136
|
+
</div>
|
|
1137
|
+
|
|
1138
|
+
${"theme"===this.activeView?I`
|
|
1139
|
+
<input
|
|
1140
|
+
type="text"
|
|
1141
|
+
class="search-input"
|
|
1142
|
+
placeholder="Search settings..."
|
|
1143
|
+
.value=${this.searchQuery}
|
|
1144
|
+
@input=${t=>this.searchQuery=t.target.value}
|
|
1145
|
+
>
|
|
1146
|
+
`:""}
|
|
1147
|
+
|
|
1148
|
+
<div class="actions">
|
|
1149
|
+
<button class="btn btn--sm" @click=${()=>this._exportSettings()}>📤 Export</button>
|
|
1150
|
+
</div>
|
|
1151
|
+
</div>
|
|
1152
|
+
|
|
1153
|
+
${a&&"validation"!==this.activeView?I`
|
|
1154
|
+
<div class="validation-banner">
|
|
1155
|
+
<span class="validation-banner__icon">⚠️</span>
|
|
1156
|
+
<span class="validation-banner__text">
|
|
1157
|
+
${this.validationErrors.length} validation issue${1!==this.validationErrors.length?"s":""} found
|
|
1158
|
+
</span>
|
|
1159
|
+
<button class="validation-banner__btn" @click=${()=>this.activeView="validation"}>
|
|
1160
|
+
View
|
|
1161
|
+
</button>
|
|
1162
|
+
</div>
|
|
1163
|
+
`:""}
|
|
1164
|
+
|
|
1165
|
+
${"theme"===this.activeView?I`
|
|
1166
|
+
${i?Object.entries(s).map(([t,e])=>this._renderGroup(t,e)):this.searchQuery?I`<div class="no-results">No settings match "${this.searchQuery}"</div>`:""}
|
|
1167
|
+
`:""}
|
|
1168
|
+
|
|
1169
|
+
${"sections"===this.activeView?this._renderSectionSettings():""}
|
|
1170
|
+
|
|
1171
|
+
${"validation"===this.activeView?this._renderValidationModal():""}
|
|
1172
|
+
|
|
1173
|
+
${this._renderExportModal()}
|
|
1174
|
+
`}}__publicField(yt,"properties",{settings:{type:Object},sectionSettings:{type:Object},searchQuery:{type:String,state:!0},expandedPaths:{type:Object,state:!0},activeView:{type:String,state:!0},copiedPath:{type:String,state:!0},validationErrors:{type:Array,state:!0}}),__publicField(yt,"styles",[dt,n`
|
|
1175
|
+
:host {
|
|
1176
|
+
display: block;
|
|
1177
|
+
padding: 8px 12px;
|
|
1178
|
+
height: 100%;
|
|
1179
|
+
overflow: auto;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
.toolbar {
|
|
1183
|
+
display: flex;
|
|
1184
|
+
align-items: center;
|
|
1185
|
+
gap: 8px;
|
|
1186
|
+
margin-bottom: 12px;
|
|
1187
|
+
flex-wrap: wrap;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
.view-tabs {
|
|
1191
|
+
display: flex;
|
|
1192
|
+
background: var(--tdt-bg-secondary);
|
|
1193
|
+
border-radius: var(--tdt-radius);
|
|
1194
|
+
padding: 2px;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
.view-tab {
|
|
1198
|
+
padding: 4px 12px;
|
|
1199
|
+
font-size: 10px;
|
|
1200
|
+
background: transparent;
|
|
1201
|
+
border: none;
|
|
1202
|
+
color: var(--tdt-text-muted);
|
|
1203
|
+
cursor: pointer;
|
|
1204
|
+
border-radius: 3px;
|
|
1205
|
+
font-family: var(--tdt-font);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
.view-tab:hover {
|
|
1209
|
+
color: var(--tdt-text);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
.view-tab--active {
|
|
1213
|
+
background: var(--tdt-accent);
|
|
1214
|
+
color: white;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.search-input {
|
|
1218
|
+
flex: 1;
|
|
1219
|
+
min-width: 150px;
|
|
1220
|
+
padding: 6px 10px;
|
|
1221
|
+
background: var(--tdt-bg-secondary);
|
|
1222
|
+
border: 1px solid var(--tdt-border);
|
|
1223
|
+
border-radius: var(--tdt-radius);
|
|
1224
|
+
color: var(--tdt-text);
|
|
1225
|
+
font-size: 11px;
|
|
1226
|
+
font-family: var(--tdt-font);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.search-input:focus {
|
|
1230
|
+
outline: none;
|
|
1231
|
+
border-color: var(--tdt-accent);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
.search-input::placeholder {
|
|
1235
|
+
color: var(--tdt-text-muted);
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
.actions {
|
|
1239
|
+
display: flex;
|
|
1240
|
+
gap: 6px;
|
|
1241
|
+
margin-left: auto;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
.validation-banner {
|
|
1245
|
+
display: flex;
|
|
1246
|
+
align-items: center;
|
|
1247
|
+
gap: 8px;
|
|
1248
|
+
padding: 8px 12px;
|
|
1249
|
+
background: rgba(231, 76, 60, 0.1);
|
|
1250
|
+
border: 1px solid rgba(231, 76, 60, 0.3);
|
|
1251
|
+
border-radius: var(--tdt-radius);
|
|
1252
|
+
margin-bottom: 12px;
|
|
1253
|
+
font-size: 11px;
|
|
1254
|
+
color: var(--tdt-danger);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
.validation-banner__icon {
|
|
1258
|
+
font-size: 14px;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
.validation-banner__text {
|
|
1262
|
+
flex: 1;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
.validation-banner__btn {
|
|
1266
|
+
padding: 4px 8px;
|
|
1267
|
+
font-size: 10px;
|
|
1268
|
+
background: transparent;
|
|
1269
|
+
border: 1px solid currentColor;
|
|
1270
|
+
border-radius: 3px;
|
|
1271
|
+
color: inherit;
|
|
1272
|
+
cursor: pointer;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
.validation-banner__btn:hover {
|
|
1276
|
+
background: var(--tdt-danger);
|
|
1277
|
+
color: white;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
.settings-group {
|
|
1281
|
+
margin-bottom: 16px;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
.group-header {
|
|
1285
|
+
display: flex;
|
|
1286
|
+
align-items: center;
|
|
1287
|
+
gap: 8px;
|
|
1288
|
+
padding: 8px 10px;
|
|
1289
|
+
background: var(--tdt-bg-secondary);
|
|
1290
|
+
border: 1px solid var(--tdt-border);
|
|
1291
|
+
border-radius: var(--tdt-radius);
|
|
1292
|
+
cursor: pointer;
|
|
1293
|
+
user-select: none;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
.group-header:hover {
|
|
1297
|
+
background: var(--tdt-bg-hover);
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
.group-icon {
|
|
1301
|
+
font-size: 14px;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
.group-name {
|
|
1305
|
+
font-weight: 600;
|
|
1306
|
+
font-size: 12px;
|
|
1307
|
+
color: var(--tdt-text);
|
|
1308
|
+
flex: 1;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
.group-count {
|
|
1312
|
+
font-size: 10px;
|
|
1313
|
+
color: var(--tdt-text-muted);
|
|
1314
|
+
background: var(--tdt-bg);
|
|
1315
|
+
padding: 2px 6px;
|
|
1316
|
+
border-radius: 10px;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
.expand-icon {
|
|
1320
|
+
font-size: 10px;
|
|
1321
|
+
color: var(--tdt-text-muted);
|
|
1322
|
+
transition: transform 0.15s ease;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
.expand-icon--open {
|
|
1326
|
+
transform: rotate(90deg);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.settings-list {
|
|
1330
|
+
margin-top: 4px;
|
|
1331
|
+
margin-left: 12px;
|
|
1332
|
+
border-left: 1px solid var(--tdt-border);
|
|
1333
|
+
padding-left: 12px;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.setting-item {
|
|
1337
|
+
display: flex;
|
|
1338
|
+
align-items: flex-start;
|
|
1339
|
+
gap: 8px;
|
|
1340
|
+
padding: 8px;
|
|
1341
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
1342
|
+
font-size: 11px;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
.setting-item:last-child {
|
|
1346
|
+
border-bottom: none;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
.setting-item:hover {
|
|
1350
|
+
background: var(--tdt-bg-hover);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.setting-item--error {
|
|
1354
|
+
background: rgba(231, 76, 60, 0.05);
|
|
1355
|
+
border-color: rgba(231, 76, 60, 0.2);
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
.setting__key {
|
|
1359
|
+
display: flex;
|
|
1360
|
+
flex-direction: column;
|
|
1361
|
+
gap: 2px;
|
|
1362
|
+
min-width: 160px;
|
|
1363
|
+
flex-shrink: 0;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
.setting__id {
|
|
1367
|
+
color: var(--tdt-key);
|
|
1368
|
+
font-family: var(--tdt-font-mono);
|
|
1369
|
+
cursor: pointer;
|
|
1370
|
+
padding: 1px 4px;
|
|
1371
|
+
border-radius: 2px;
|
|
1372
|
+
display: inline-block;
|
|
1373
|
+
width: fit-content;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
.setting__id:hover {
|
|
1377
|
+
background: rgba(199, 146, 234, 0.2);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
.setting__id--copied {
|
|
1381
|
+
background: rgba(34, 197, 94, 0.3) !important;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.setting__label {
|
|
1385
|
+
font-size: 10px;
|
|
1386
|
+
color: var(--tdt-text-muted);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
.setting__type {
|
|
1390
|
+
font-size: 9px;
|
|
1391
|
+
padding: 2px 5px;
|
|
1392
|
+
border-radius: 3px;
|
|
1393
|
+
text-transform: uppercase;
|
|
1394
|
+
letter-spacing: 0.3px;
|
|
1395
|
+
font-weight: 500;
|
|
1396
|
+
white-space: nowrap;
|
|
1397
|
+
background: var(--tdt-bg);
|
|
1398
|
+
color: var(--tdt-text-muted);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
.type--color { background: #4a3d2d; color: #e5c07b; }
|
|
1402
|
+
.type--text { background: #2d4a3e; color: #98c379; }
|
|
1403
|
+
.type--textarea, .type--richtext, .type--html { background: #2d4a3e; color: #98c379; }
|
|
1404
|
+
.type--number, .type--range { background: #3d3a2d; color: #d19a66; }
|
|
1405
|
+
.type--checkbox { background: #2d3a4a; color: #61afef; }
|
|
1406
|
+
.type--select, .type--radio { background: #4a2d4a; color: #c678dd; }
|
|
1407
|
+
.type--image_picker, .type--video, .type--video_url { background: #3a3d2d; color: #98c379; }
|
|
1408
|
+
.type--url, .type--link_list { background: #3d2d2d; color: #e06c75; }
|
|
1409
|
+
.type--product, .type--collection, .type--blog, .type--page, .type--article { background: #2d4a4a; color: #56b6c2; }
|
|
1410
|
+
.type--font_picker { background: #3d3d2d; color: #abb2bf; }
|
|
1411
|
+
|
|
1412
|
+
.setting__value {
|
|
1413
|
+
flex: 1;
|
|
1414
|
+
min-width: 0;
|
|
1415
|
+
word-break: break-word;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
.value--string { color: var(--tdt-string); }
|
|
1419
|
+
.value--number { color: var(--tdt-number); }
|
|
1420
|
+
.value--boolean { color: var(--tdt-boolean); }
|
|
1421
|
+
.value--null { color: var(--tdt-null); font-style: italic; }
|
|
1422
|
+
.value--color {
|
|
1423
|
+
display: inline-flex;
|
|
1424
|
+
align-items: center;
|
|
1425
|
+
gap: 6px;
|
|
1426
|
+
}
|
|
1427
|
+
.color-swatch {
|
|
1428
|
+
width: 16px;
|
|
1429
|
+
height: 16px;
|
|
1430
|
+
border-radius: 3px;
|
|
1431
|
+
border: 1px solid var(--tdt-border);
|
|
1432
|
+
display: inline-block;
|
|
1433
|
+
}
|
|
1434
|
+
.value--image {
|
|
1435
|
+
display: flex;
|
|
1436
|
+
align-items: center;
|
|
1437
|
+
gap: 8px;
|
|
1438
|
+
}
|
|
1439
|
+
.image-preview {
|
|
1440
|
+
width: 32px;
|
|
1441
|
+
height: 32px;
|
|
1442
|
+
object-fit: cover;
|
|
1443
|
+
border-radius: 3px;
|
|
1444
|
+
background: var(--tdt-bg);
|
|
1445
|
+
}
|
|
1446
|
+
.value--truncated {
|
|
1447
|
+
max-width: 300px;
|
|
1448
|
+
overflow: hidden;
|
|
1449
|
+
text-overflow: ellipsis;
|
|
1450
|
+
white-space: nowrap;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
.setting__error {
|
|
1454
|
+
color: var(--tdt-danger);
|
|
1455
|
+
font-size: 10px;
|
|
1456
|
+
margin-top: 4px;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.section-card {
|
|
1460
|
+
margin-bottom: 8px;
|
|
1461
|
+
border: 1px solid var(--tdt-border);
|
|
1462
|
+
border-radius: var(--tdt-radius);
|
|
1463
|
+
overflow: hidden;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
.section-header {
|
|
1467
|
+
display: flex;
|
|
1468
|
+
align-items: center;
|
|
1469
|
+
gap: 8px;
|
|
1470
|
+
padding: 8px 12px;
|
|
1471
|
+
background: var(--tdt-bg-secondary);
|
|
1472
|
+
cursor: pointer;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
.section-header:hover {
|
|
1476
|
+
background: var(--tdt-bg-hover);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
.section-type {
|
|
1480
|
+
font-family: var(--tdt-font-mono);
|
|
1481
|
+
font-size: 11px;
|
|
1482
|
+
color: var(--tdt-accent);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
.section-id {
|
|
1486
|
+
font-size: 10px;
|
|
1487
|
+
color: var(--tdt-text-muted);
|
|
1488
|
+
font-family: var(--tdt-font-mono);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
.section-content {
|
|
1492
|
+
padding: 8px 12px;
|
|
1493
|
+
background: var(--tdt-bg);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
.empty-state {
|
|
1497
|
+
text-align: center;
|
|
1498
|
+
padding: 40px 20px;
|
|
1499
|
+
color: var(--tdt-text-muted);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
.empty-state__icon {
|
|
1503
|
+
font-size: 32px;
|
|
1504
|
+
margin-bottom: 12px;
|
|
1505
|
+
opacity: 0.5;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
.empty-state__title {
|
|
1509
|
+
font-size: 14px;
|
|
1510
|
+
font-weight: 600;
|
|
1511
|
+
color: var(--tdt-text);
|
|
1512
|
+
margin-bottom: 8px;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
.empty-state__hint {
|
|
1516
|
+
font-size: 11px;
|
|
1517
|
+
max-width: 300px;
|
|
1518
|
+
margin: 0 auto;
|
|
1519
|
+
line-height: 1.5;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
.no-results {
|
|
1523
|
+
padding: 20px;
|
|
1524
|
+
text-align: center;
|
|
1525
|
+
color: var(--tdt-text-muted);
|
|
1526
|
+
font-size: 12px;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
.export-modal {
|
|
1530
|
+
position: fixed;
|
|
1531
|
+
inset: 0;
|
|
1532
|
+
background: rgba(0,0,0,0.7);
|
|
1533
|
+
display: flex;
|
|
1534
|
+
align-items: center;
|
|
1535
|
+
justify-content: center;
|
|
1536
|
+
z-index: 10000;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
.modal-content {
|
|
1540
|
+
background: var(--tdt-bg);
|
|
1541
|
+
border: 1px solid var(--tdt-border);
|
|
1542
|
+
border-radius: var(--tdt-radius);
|
|
1543
|
+
padding: 16px;
|
|
1544
|
+
max-width: 500px;
|
|
1545
|
+
width: 90%;
|
|
1546
|
+
max-height: 80vh;
|
|
1547
|
+
overflow: auto;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
.modal-header {
|
|
1551
|
+
display: flex;
|
|
1552
|
+
align-items: center;
|
|
1553
|
+
justify-content: space-between;
|
|
1554
|
+
margin-bottom: 12px;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
.modal-title {
|
|
1558
|
+
font-weight: 600;
|
|
1559
|
+
font-size: 14px;
|
|
1560
|
+
color: var(--tdt-text);
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
.modal-close {
|
|
1564
|
+
background: transparent;
|
|
1565
|
+
border: none;
|
|
1566
|
+
color: var(--tdt-text-muted);
|
|
1567
|
+
cursor: pointer;
|
|
1568
|
+
font-size: 18px;
|
|
1569
|
+
padding: 4px;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
.modal-close:hover {
|
|
1573
|
+
color: var(--tdt-text);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
.modal-textarea {
|
|
1577
|
+
width: 100%;
|
|
1578
|
+
height: 200px;
|
|
1579
|
+
padding: 12px;
|
|
1580
|
+
background: var(--tdt-bg-secondary);
|
|
1581
|
+
border: 1px solid var(--tdt-border);
|
|
1582
|
+
border-radius: var(--tdt-radius);
|
|
1583
|
+
color: var(--tdt-text);
|
|
1584
|
+
font-family: var(--tdt-font-mono);
|
|
1585
|
+
font-size: 11px;
|
|
1586
|
+
resize: vertical;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
.modal-textarea:focus {
|
|
1590
|
+
outline: none;
|
|
1591
|
+
border-color: var(--tdt-accent);
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.modal-actions {
|
|
1595
|
+
display: flex;
|
|
1596
|
+
gap: 8px;
|
|
1597
|
+
margin-top: 12px;
|
|
1598
|
+
justify-content: flex-end;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
.validation-list {
|
|
1602
|
+
margin-top: 8px;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
.validation-item {
|
|
1606
|
+
display: flex;
|
|
1607
|
+
align-items: flex-start;
|
|
1608
|
+
gap: 8px;
|
|
1609
|
+
padding: 8px;
|
|
1610
|
+
background: rgba(231, 76, 60, 0.05);
|
|
1611
|
+
border: 1px solid rgba(231, 76, 60, 0.2);
|
|
1612
|
+
border-radius: var(--tdt-radius);
|
|
1613
|
+
margin-bottom: 6px;
|
|
1614
|
+
font-size: 11px;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
.validation-item__icon {
|
|
1618
|
+
color: var(--tdt-danger);
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
.validation-item__path {
|
|
1622
|
+
font-family: var(--tdt-font-mono);
|
|
1623
|
+
color: var(--tdt-key);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
.validation-item__message {
|
|
1627
|
+
color: var(--tdt-text-muted);
|
|
1628
|
+
}
|
|
1629
|
+
`]),customElements.define("tdt-settings-panel",yt);class _t extends rt{constructor(){super(),this.isCollapsed=!1,this.activeTab="objects",this.context=null,this.cart=null,this._unsubscribeCart=null}connectedCallback(){super.connectedCallback(),this._init(),this._bindKeyboard(),this._restoreState()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeCart&&this._unsubscribeCart(),ht.stopPolling(),ut.destroy(),document.removeEventListener("keydown",this._handleKeydown)}_init(){this.context=ct.parse(),this.context?(ht.interceptAjax(),ht.startPolling(3e3),ht.fetch().then(t=>{t&&ht.setCart(t)}),this._unsubscribeCart=ht.subscribe(t=>{this.cart=t}),ut.init()):console.warn("[Theme Devtools] No context available")}_bindKeyboard(){this._handleKeydown=t=>{(t.metaKey||t.ctrlKey)&&t.shiftKey&&"D"===t.key&&(t.preventDefault(),this._toggleCollapse())},document.addEventListener("keydown",this._handleKeydown)}_restoreState(){"true"===localStorage.getItem("theme-devtools-collapsed")&&(this.isCollapsed=!0)}_toggleCollapse(){this.isCollapsed=!this.isCollapsed,localStorage.setItem("theme-devtools-collapsed",this.isCollapsed)}_setTab(t){this.activeTab=t}_close(){this.remove()}_formatMoney(t){return null==t?"—":`$${(t/100).toFixed(2)}`}render(){var t,e,s,i,a,o,n,r;if(!this.context)return I``;const{meta:l,objects:d,metafields:c,settings:p,sectionSettings:h}=this.context;return I`
|
|
1630
|
+
<div class="dock ${this.isCollapsed?"dock--collapsed":""}">
|
|
1631
|
+
<div class="dock__handle" @click=${this._toggleCollapse}>
|
|
1632
|
+
<div class="dock__title">Theme Devtools</div>
|
|
1633
|
+
<div class="dock__controls">
|
|
1634
|
+
<button class="dock__btn" @click=${t=>{t.stopPropagation(),this._toggleCollapse()}}>
|
|
1635
|
+
${this.isCollapsed?"▲":"▼"}
|
|
1636
|
+
</button>
|
|
1637
|
+
<button class="dock__btn" @click=${t=>{t.stopPropagation(),this._close()}}>×</button>
|
|
1638
|
+
</div>
|
|
1639
|
+
</div>
|
|
1640
|
+
|
|
1641
|
+
<div class="header">
|
|
1642
|
+
<span class="badge badge--${(null==(t=l.theme)?void 0:t.role)||"unknown"}">
|
|
1643
|
+
${(null==(e=l.theme)?void 0:e.role)||"Unknown"}
|
|
1644
|
+
</span>
|
|
1645
|
+
<span class="header__template">
|
|
1646
|
+
${(null==(s=l.template)?void 0:s.name)||"Unknown"}${(null==(i=l.template)?void 0:i.suffix)?`.${l.template.suffix}`:""}
|
|
1647
|
+
</span>
|
|
1648
|
+
<span class="header__page-type">${(null==(a=l.request)?void 0:a.page_type)||"—"}</span>
|
|
1649
|
+
${(null==(o=l.request)?void 0:o.design_mode)?I`<span class="badge badge--design">Design Mode</span>`:""}
|
|
1650
|
+
<span class="header__cart">
|
|
1651
|
+
🛒 ${(null==(n=this.cart)?void 0:n.item_count)||0} items • ${this._formatMoney(null==(r=this.cart)?void 0:r.total_price)}
|
|
1652
|
+
</span>
|
|
1653
|
+
</div>
|
|
1654
|
+
|
|
1655
|
+
<div class="tabs">
|
|
1656
|
+
${[{id:"objects",label:"Objects",icon:"📦"},{id:"metafields",label:"Metafields",icon:"🏷️"},{id:"settings",label:"Settings",icon:"🎨"},{id:"sections",label:"Sections",icon:"📐"},{id:"cart",label:"Cart",icon:"🛒"},{id:"info",label:"Info",icon:"ℹ️"}].map(t=>I`
|
|
1657
|
+
<button
|
|
1658
|
+
class="tab ${this.activeTab===t.id?"tab--active":""}"
|
|
1659
|
+
@click=${()=>this._setTab(t.id)}
|
|
1660
|
+
>
|
|
1661
|
+
${t.icon} ${t.label}
|
|
1662
|
+
</button>
|
|
1663
|
+
`)}
|
|
1664
|
+
</div>
|
|
1665
|
+
|
|
1666
|
+
<div class="content">
|
|
1667
|
+
<tdt-objects-panel
|
|
1668
|
+
class="panel ${"objects"===this.activeTab?"panel--active":""}"
|
|
1669
|
+
.objects=${d}
|
|
1670
|
+
></tdt-objects-panel>
|
|
1671
|
+
|
|
1672
|
+
<tdt-metafields-panel
|
|
1673
|
+
class="panel ${"metafields"===this.activeTab?"panel--active":""}"
|
|
1674
|
+
.metafields=${c}
|
|
1675
|
+
></tdt-metafields-panel>
|
|
1676
|
+
|
|
1677
|
+
<tdt-settings-panel
|
|
1678
|
+
class="panel ${"settings"===this.activeTab?"panel--active":""}"
|
|
1679
|
+
.settings=${p}
|
|
1680
|
+
.sectionSettings=${h}
|
|
1681
|
+
></tdt-settings-panel>
|
|
1682
|
+
|
|
1683
|
+
<tdt-sections-panel
|
|
1684
|
+
class="panel ${"sections"===this.activeTab?"panel--active":""}"
|
|
1685
|
+
></tdt-sections-panel>
|
|
1686
|
+
|
|
1687
|
+
<tdt-cart-panel
|
|
1688
|
+
class="panel ${"cart"===this.activeTab?"panel--active":""}"
|
|
1689
|
+
.cart=${this.cart}
|
|
1690
|
+
></tdt-cart-panel>
|
|
1691
|
+
|
|
1692
|
+
<tdt-info-panel
|
|
1693
|
+
class="panel ${"info"===this.activeTab?"panel--active":""}"
|
|
1694
|
+
.meta=${l}
|
|
1695
|
+
></tdt-info-panel>
|
|
1696
|
+
</div>
|
|
1697
|
+
</div>
|
|
1698
|
+
`}}__publicField(_t,"properties",{isCollapsed:{type:Boolean,state:!0},activeTab:{type:String,state:!0},context:{type:Object,state:!0},cart:{type:Object,state:!0}}),__publicField(_t,"styles",[dt,n`
|
|
1699
|
+
.dock {
|
|
1700
|
+
position: fixed;
|
|
1701
|
+
bottom: 0;
|
|
1702
|
+
left: 0;
|
|
1703
|
+
right: 0;
|
|
1704
|
+
height: 60vh;
|
|
1705
|
+
background: var(--tdt-bg);
|
|
1706
|
+
border-top: 1px solid var(--tdt-border);
|
|
1707
|
+
display: flex;
|
|
1708
|
+
flex-direction: column;
|
|
1709
|
+
z-index: 2147483647;
|
|
1710
|
+
transition: transform 0.2s ease;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
.dock--collapsed {
|
|
1714
|
+
transform: translateY(calc(100% - 32px));
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
.dock__handle {
|
|
1718
|
+
height: 32px;
|
|
1719
|
+
background: var(--tdt-bg-secondary);
|
|
1720
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
1721
|
+
display: flex;
|
|
1722
|
+
align-items: center;
|
|
1723
|
+
justify-content: space-between;
|
|
1724
|
+
padding: 0 12px;
|
|
1725
|
+
cursor: pointer;
|
|
1726
|
+
user-select: none;
|
|
1727
|
+
flex-shrink: 0;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
.dock__title {
|
|
1731
|
+
font-weight: 600;
|
|
1732
|
+
font-size: 11px;
|
|
1733
|
+
text-transform: uppercase;
|
|
1734
|
+
letter-spacing: 0.5px;
|
|
1735
|
+
color: var(--tdt-text-muted);
|
|
1736
|
+
display: flex;
|
|
1737
|
+
align-items: center;
|
|
1738
|
+
gap: 6px;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
.dock__title::before {
|
|
1742
|
+
content: '◆';
|
|
1743
|
+
color: var(--tdt-accent);
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.dock__controls {
|
|
1747
|
+
display: flex;
|
|
1748
|
+
gap: 8px;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
.dock__btn {
|
|
1752
|
+
background: transparent;
|
|
1753
|
+
border: none;
|
|
1754
|
+
color: var(--tdt-text-muted);
|
|
1755
|
+
cursor: pointer;
|
|
1756
|
+
padding: 4px 8px;
|
|
1757
|
+
font-size: 14px;
|
|
1758
|
+
border-radius: var(--tdt-radius);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
.dock__btn:hover {
|
|
1762
|
+
background: var(--tdt-bg-hover);
|
|
1763
|
+
color: var(--tdt-text);
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
.header {
|
|
1767
|
+
display: flex;
|
|
1768
|
+
align-items: center;
|
|
1769
|
+
gap: 12px;
|
|
1770
|
+
padding: 8px 12px;
|
|
1771
|
+
background: var(--tdt-bg-secondary);
|
|
1772
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
1773
|
+
flex-wrap: wrap;
|
|
1774
|
+
flex-shrink: 0;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
.header__template {
|
|
1778
|
+
font-weight: 600;
|
|
1779
|
+
color: var(--tdt-text);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
.header__page-type {
|
|
1783
|
+
color: var(--tdt-text-muted);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.header__cart {
|
|
1787
|
+
margin-left: auto;
|
|
1788
|
+
color: var(--tdt-text-muted);
|
|
1789
|
+
font-size: 11px;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
.tabs {
|
|
1793
|
+
display: flex;
|
|
1794
|
+
background: var(--tdt-bg-secondary);
|
|
1795
|
+
border-bottom: 1px solid var(--tdt-border);
|
|
1796
|
+
flex-shrink: 0;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
.tab {
|
|
1800
|
+
background: transparent;
|
|
1801
|
+
border: none;
|
|
1802
|
+
color: var(--tdt-text-muted);
|
|
1803
|
+
padding: 8px 16px;
|
|
1804
|
+
font-size: 11px;
|
|
1805
|
+
font-family: var(--tdt-font);
|
|
1806
|
+
cursor: pointer;
|
|
1807
|
+
border-bottom: 2px solid transparent;
|
|
1808
|
+
transition: all 0.15s ease;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
.tab:hover {
|
|
1812
|
+
color: var(--tdt-text);
|
|
1813
|
+
background: var(--tdt-bg-hover);
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
.tab--active {
|
|
1817
|
+
color: var(--tdt-accent);
|
|
1818
|
+
border-bottom-color: var(--tdt-accent);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
.content {
|
|
1822
|
+
flex: 1;
|
|
1823
|
+
overflow: hidden;
|
|
1824
|
+
display: flex;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
.panel {
|
|
1828
|
+
flex: 1;
|
|
1829
|
+
overflow: auto;
|
|
1830
|
+
display: none;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
.panel--active {
|
|
1834
|
+
display: block;
|
|
1835
|
+
}
|
|
1836
|
+
`]),customElements.define("theme-devtools",_t);function $t(){const t=document.getElementById("__THEME_DEVTOOLS_ROOT__");if(!t)return void console.warn("[Theme Devtools] Root element not found");const e=document.createElement("theme-devtools");t.appendChild(e),window.__THEME_DEVTOOLS__=e}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",$t):$t()}();
|