diff --git a/.gitignore b/.gitignore index 9cc677c..3d8d777 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ test-results #IntelliJ IDE .idea +.shopify diff --git a/.vscode/settings.json b/.vscode/settings.json index 8dfa7ac..da816dc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,12 @@ "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "files.associations": { + "**/*.min.js": "plaintext" + }, + "[plaintext]": { + "editor.formatOnSave": false + }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, diff --git a/components/block-buy-buttons/setup/sections/block-buy-buttons.liquid b/components/block-buy-buttons/setup/sections/block-buy-buttons.liquid deleted file mode 100644 index cfd5947..0000000 --- a/components/block-buy-buttons/setup/sections/block-buy-buttons.liquid +++ /dev/null @@ -1,35 +0,0 @@ -{%- liquid - for block in section.blocks - case block.type - when 'buy_buttons' - render 'block-buy-buttons', block: block - endcase - endfor --%} - - - -{% schema %} -{ - "name": "t:labels.product", - "settings": [], - "blocks": [ - { - "type": "buy_buttons", - "name": "t:labels.buy_buttons", - "limit": 1, - "settings": [ - { - "type": "checkbox", - "id": "show_dynamic_checkout", - "label": "t:actions.show_dynamic_checkout", - "info": "t:info.lets_customers_checkout_familiar", - "default": true - } - ] - } - ] -} -{% endschema %} diff --git a/components/block-buy-buttons/setup/templates/product.block-buy-buttons.json b/components/block-buy-buttons/setup/templates/product.block-buy-buttons.json deleted file mode 100644 index a32c022..0000000 --- a/components/block-buy-buttons/setup/templates/product.block-buy-buttons.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "sections": { - "block_buy_buttons": { - "type": "block-buy-buttons", - "blocks": { - "buy_buttons_1": { - "type": "buy_buttons", - "settings": { - "show_dynamic_checkout": true - } - } - }, - "block_order": ["buy_buttons_1"] - } - }, - "order": ["block_buy_buttons"] -} diff --git a/components/block-price/setup/sections/block-price.liquid b/components/block-price/setup/sections/block-price.liquid deleted file mode 100644 index 78b2ee2..0000000 --- a/components/block-price/setup/sections/block-price.liquid +++ /dev/null @@ -1,22 +0,0 @@ -{%- liquid - for block in section.blocks - case block.type - when 'price' - render 'block-price', block: block - endcase - endfor --%} - -{% schema %} -{ - "name": "t:labels.product", - "settings": [], - "blocks": [ - { - "type": "price", - "name": "t:labels.price", - "limit": 1 - } - ] -} -{% endschema %} diff --git a/components/block-price/setup/templates/product.block-price.json b/components/block-price/setup/templates/product.block-price.json deleted file mode 100644 index e71c218..0000000 --- a/components/block-price/setup/templates/product.block-price.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "sections": { - "block_price": { - "type": "block-price", - "blocks": { - "price_1": { - "type": "price" - } - }, - "block_order": ["price_1"] - } - }, - "order": ["block_price"] -} diff --git a/components/block-product-description/block-product-description.liquid b/components/block-product-description/block-product-description.liquid deleted file mode 100644 index 30af0ba..0000000 --- a/components/block-product-description/block-product-description.liquid +++ /dev/null @@ -1,18 +0,0 @@ -{%- comment -%} - Renders the product description - - Accepts: - - block {block} - Block object - - product {product} - Product object - - Usage: - {% render 'block-product-description', block: block %} -{%- endcomment -%} - -{% liquid - assign product = product | default: section.settings.product -%} - -
- {%- render 'product-description', product: product -%} -
diff --git a/components/block-product-description/setup/sections/block-description.liquid b/components/block-product-description/setup/sections/block-description.liquid deleted file mode 100644 index 440bc62..0000000 --- a/components/block-product-description/setup/sections/block-description.liquid +++ /dev/null @@ -1,22 +0,0 @@ -{%- liquid - for block in section.blocks - case block.type - when 'description' - render 'block-product-description', block: block - endcase - endfor --%} - -{% schema %} -{ - "name": "t:labels.product", - "settings": [], - "blocks": [ - { - "type": "description", - "name": "t:labels.description", - "settings": [] - } - ] -} -{% endschema %} diff --git a/components/block-product-description/setup/templates/product.block-description.json b/components/block-product-description/setup/templates/product.block-description.json deleted file mode 100644 index 73d4ea0..0000000 --- a/components/block-product-description/setup/templates/product.block-description.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "sections": { - "block_description": { - "type": "block-description", - "blocks": { - "description_1": { - "type": "description" - } - }, - "block_order": ["description_1"] - } - }, - "order": ["block_description"] -} diff --git a/components/block-title/setup/sections/block-title.liquid b/components/block-title/setup/sections/block-title.liquid deleted file mode 100644 index 44ec8d7..0000000 --- a/components/block-title/setup/sections/block-title.liquid +++ /dev/null @@ -1,45 +0,0 @@ -{%- liquid - assign current_variant = product.selected_or_first_available_variant - for block in section.blocks - case block.type - when 'title' - render 'block-title', block: block - endcase - endfor --%} - - - -{% schema %} -{ - "name": "t:labels.product", - "settings": [], - "blocks": [ - { - "type": "title", - "name": "t:labels.title", - "limit": 1, - "settings": [ - { - "type": "checkbox", - "id": "vendor_enable", - "label": "t:actions.show_vendor" - }, - { - "type": "checkbox", - "id": "sku_enable", - "label": "t:actions.show_sku" - } - ] - } - ] -} -{% endschema %} diff --git a/components/block-title/setup/templates/product.block-title.json b/components/block-title/setup/templates/product.block-title.json deleted file mode 100644 index ada8baa..0000000 --- a/components/block-title/setup/templates/product.block-title.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "sections": { - "block_title": { - "type": "block-title", - "blocks": { - "title_1": { - "type": "title", - "settings": { - "vendor_enable": true, - "sku_enable": true - } - } - }, - "block_order": ["title_1"] - } - }, - "order": ["block_title"] -} diff --git a/components/block-variant-picker/assets/component.block-variant-picker.css b/components/block-variant-picker/assets/component.block-variant-picker.css deleted file mode 100644 index 6a0bc97..0000000 --- a/components/block-variant-picker/assets/component.block-variant-picker.css +++ /dev/null @@ -1,4 +0,0 @@ -.block-variant-picker { - display: grid; - gap: var(--size-6); -} diff --git a/components/block-variant-picker/setup/sections/block-variant-picker.liquid b/components/block-variant-picker/setup/sections/block-variant-picker.liquid deleted file mode 100644 index 61ef341..0000000 --- a/components/block-variant-picker/setup/sections/block-variant-picker.liquid +++ /dev/null @@ -1,39 +0,0 @@ -{%- liquid - for block in section.blocks - case block.type - when 'variant_picker' - render 'block-variant-picker', block: block - endcase - endfor --%} - -{% schema %} -{ - "name": "t:labels.product", - "settings": [], - "blocks": [ - { - "type": "variant_picker", - "name": "Variant picker", - "settings": [ - { - "type": "select", - "id": "picker_type", - "label": "t:labels.type", - "options": [ - { - "value": "button", - "label": "t:labels.buttons" - }, - { - "value": "dropdown", - "label": "t:labels.dropdown" - } - ], - "default": "button" - } - ] - } - ] -} -{% endschema %} diff --git a/components/block-variant-picker/setup/templates/product.block-variant-picker.json b/components/block-variant-picker/setup/templates/product.block-variant-picker.json deleted file mode 100644 index 7b01501..0000000 --- a/components/block-variant-picker/setup/templates/product.block-variant-picker.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "sections": { - "variant_picker": { - "type": "block-variant-picker", - "blocks": { - "variant_picker_1": { - "type": "variant_picker", - "settings": {} - }, - "variant_picker_2": { - "type": "variant_picker", - "disabled": true, - "settings": { - "picker_type": "dropdown" - } - } - }, - "block_order": ["variant_picker_1", "variant_picker_2"] - } - }, - "order": ["variant_picker"] -} diff --git a/components/es-module-shims/assets/vendor.es-module-shims.min.js b/components/es-module-shims/assets/vendor.es-module-shims.min.js new file mode 100644 index 0000000..09a941a --- /dev/null +++ b/components/es-module-shims/assets/vendor.es-module-shims.min.js @@ -0,0 +1,2 @@ +(function(){const e=typeof window!=="undefined";const t=typeof document!=="undefined";const noop=()=>{};const r=t?document.querySelector("script[type=esms-options]"):void 0;const s=r?JSON.parse(r.innerHTML):{};Object.assign(s,self.esmsInitOptions||{});let n=!t||!!s.shimMode;const a=globalHook(n&&s.onimport);const i=globalHook(n&&s.resolve);let c=s.fetch?globalHook(s.fetch):fetch;const f=s.meta?globalHook(n&&s.meta):noop;const ne=s.mapOverrides;let oe=s.nonce;if(!oe&&t){const e=document.querySelector("script[nonce]");e&&(oe=e.nonce||e.getAttribute("nonce"))}const ce=globalHook(s.onerror||noop);const le=s.onpolyfill?globalHook(s.onpolyfill):()=>{console.log("%c^^ Module TypeError above is polyfilled and can be ignored ^^","font-weight:900;color:#391")};const{revokeBlobURLs:ue,noLoadEventRetriggers:de,enforceIntegrity:pe}=s;function globalHook(e){return typeof e==="string"?self[e]:e}const he=Array.isArray(s.polyfillEnable)?s.polyfillEnable:[];const me=he.includes("css-modules");const be=he.includes("json-modules");const ke=!navigator.userAgentData&&!!navigator.userAgent.match(/Edge\/\d+\.\d+/);const we=t?document.baseURI:`${location.protocol}//${location.host}${location.pathname.includes("/")?location.pathname.slice(0,location.pathname.lastIndexOf("/")+1):location.pathname}`;const createBlob=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t}));let{skip:ge}=s;if(Array.isArray(ge)){const e=ge.map((e=>new URL(e,we).href));ge=t=>e.some((e=>e[e.length-1]==="/"&&t.startsWith(e)||t===e))}else if(typeof ge==="string"){const e=new RegExp(ge);ge=t=>e.test(t)}else ge instanceof RegExp&&(ge=e=>ge.test(e));const eoop=e=>setTimeout((()=>{throw e}));const throwError=t=>{(self.reportError||e&&window.safari&&console.error||eoop)(t),void ce(t)};function fromParent(e){return e?` imported from ${e}`:""}let ve=false;function setImportMapSrcOrLazy(){ve=true}if(!n)if(document.querySelectorAll("script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]").length)n=true;else{let e=false;for(const t of document.querySelectorAll("script[type=module],script[type=importmap]"))if(e){if(t.type==="importmap"&&e){ve=true;break}}else t.type!=="module"||t.ep||(e=true)}const ye=/\\/g;function asURL(e){try{if(e.indexOf(":")!==-1)return new URL(e).href}catch(e){}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||asURL(e)||resolveIfNotPlainOrUrl("./"+e,t)}function resolveIfNotPlainOrUrl(e,t){const r=t.indexOf("#"),s=t.indexOf("?");r+s>-2&&(t=t.slice(0,r===-1?s:s===-1||s>r?r:s));e.indexOf("\\")!==-1&&(e=e.replace(ye,"/"));if(e[0]==="/"&&e[1]==="/")return t.slice(0,t.indexOf(":")+1)+e;if(e[0]==="."&&(e[1]==="/"||e[1]==="."&&(e[2]==="/"||e.length===2&&(e+="/"))||e.length===1&&(e+="/"))||e[0]==="/"){const r=t.slice(0,t.indexOf(":")+1);if(r==="blob:")throw new TypeError(`Failed to resolve module specifier "${e}". Invalid relative url or base scheme isn't hierarchical.`);let s;if(t[r.length+1]==="/")if(r!=="file:"){s=t.slice(r.length+2);s=s.slice(s.indexOf("/")+1)}else s=t.slice(8);else s=t.slice(r.length+(t[r.length]==="/"));if(e[0]==="/")return t.slice(0,t.length-s.length-1)+e;const n=s.slice(0,s.lastIndexOf("/")+1)+e;const a=[];let i=-1;for(let e=0;e "${e[a]}" does not resolve`)}}let $e=!t&&(0,eval)("u=>import(u)");let Se;const Oe=t&&new Promise((e=>{const t=Object.assign(document.createElement("script"),{src:createBlob("self._d=u=>import(u)"),ep:true});t.setAttribute("nonce",oe);t.addEventListener("load",(()=>{if(!(Se=!!($e=self._d))){let e;window.addEventListener("error",(t=>e=t));$e=(t,r)=>new Promise(((s,n)=>{const a=Object.assign(document.createElement("script"),{type:"module",src:createBlob(`import*as m from'${t}';self._esmsi=m`)});e=void 0;a.ep=true;oe&&a.setAttribute("nonce",oe);a.addEventListener("error",cb);a.addEventListener("load",cb);function cb(i){document.head.removeChild(a);if(self._esmsi){s(self._esmsi,we);self._esmsi=void 0}else{n(!(i instanceof Event)&&i||e&&e.error||new Error(`Error loading ${r&&r.errUrl||t} (${a.src}).`));e=void 0}}document.head.appendChild(a)}))}document.head.removeChild(t);delete self._d;e()}));document.head.appendChild(t)}));let Le=false;let xe=false;const Ae=t&&HTMLScriptElement.supports;let Ce=Ae&&Ae.name==="supports"&&Ae("importmap");let Ue=Se;const Ee="import.meta";const Pe='import"x"assert{type:"css"}';const Ie='import"x"assert{type:"json"}';let Me=Promise.resolve(Oe).then((()=>{if(Se)return t?new Promise((e=>{const t=document.createElement("iframe");t.style.display="none";t.setAttribute("nonce",oe);function cb({data:r}){const s=Array.isArray(r)&&r[0]==="esms";if(s){Ce=r[1];Ue=r[2];xe=r[3];Le=r[4];e();document.head.removeChild(t);window.removeEventListener("message",cb,false)}}window.addEventListener("message",cb,false);const r=` diff --git a/components/product.block.buy-buttons/setup/sections/block-buy-buttons.liquid b/components/product.block.buy-buttons/setup/sections/block-buy-buttons.liquid new file mode 100644 index 0000000..5859387 --- /dev/null +++ b/components/product.block.buy-buttons/setup/sections/block-buy-buttons.liquid @@ -0,0 +1,5 @@ +{%- render 'product.block.buy-buttons' -%} + + diff --git a/components/product.block.buy-buttons/setup/templates/product.block-buy-buttons.json b/components/product.block.buy-buttons/setup/templates/product.block-buy-buttons.json new file mode 100644 index 0000000..6936097 --- /dev/null +++ b/components/product.block.buy-buttons/setup/templates/product.block-buy-buttons.json @@ -0,0 +1,8 @@ +{ + "sections": { + "block_buy_buttons": { + "type": "block-buy-buttons" + } + }, + "order": ["block_buy_buttons"] +} diff --git a/components/block-buy-buttons/test/block-buy-buttons.spec.js b/components/product.block.buy-buttons/test/block-buy-buttons.spec.js similarity index 100% rename from components/block-buy-buttons/test/block-buy-buttons.spec.js rename to components/product.block.buy-buttons/test/block-buy-buttons.spec.js diff --git a/components/product-description/product-description.liquid b/components/product.block.description/product.block.description.liquid similarity index 80% rename from components/product-description/product-description.liquid rename to components/product.block.description/product.block.description.liquid index 2153791..c4c9a00 100644 --- a/components/product-description/product-description.liquid +++ b/components/product.block.description/product.block.description.liquid @@ -5,10 +5,12 @@ - product {product} - Product object Usage: - {% render 'product-description' %} + {% render 'product.block.description' %} {% endcomment %} {%- liquid + assign product = product | default: block.settings.product | default: section.settings.product + capture description render 't-with-fallback', key: 'info.placeholder_product_description', fallback: 'This area is used to describe your product’s details. Tell customers about the look, feel, and style of your product. Add details on color, materials used, sizing, and where it was made.' endcapture diff --git a/components/product.block.description/setup/sections/block-description.liquid b/components/product.block.description/setup/sections/block-description.liquid new file mode 100644 index 0000000..eb46c9e --- /dev/null +++ b/components/product.block.description/setup/sections/block-description.liquid @@ -0,0 +1 @@ +{%- render 'product.block.description' -%} diff --git a/components/product.block.description/setup/templates/product.block-description.json b/components/product.block.description/setup/templates/product.block-description.json new file mode 100644 index 0000000..52db59d --- /dev/null +++ b/components/product.block.description/setup/templates/product.block-description.json @@ -0,0 +1,8 @@ +{ + "sections": { + "block_description": { + "type": "block-description" + } + }, + "order": ["block_description"] +} diff --git a/components/product-media-gallery/assets/component.product-media-gallery.css b/components/product.block.media-gallery/assets/product.block.media-gallery.css similarity index 100% rename from components/product-media-gallery/assets/component.product-media-gallery.css rename to components/product.block.media-gallery/assets/product.block.media-gallery.css diff --git a/components/product-media-gallery/assets/component.product-media-gallery.js b/components/product.block.media-gallery/assets/product.block.media-gallery.js similarity index 100% rename from components/product-media-gallery/assets/component.product-media-gallery.js rename to components/product.block.media-gallery/assets/product.block.media-gallery.js diff --git a/components/product-media-gallery/product-media-gallery.liquid b/components/product.block.media-gallery/product.block.media-gallery.liquid similarity index 91% rename from components/product-media-gallery/product-media-gallery.liquid rename to components/product.block.media-gallery/product.block.media-gallery.liquid index 23c07ca..0ca7d1f 100644 --- a/components/product-media-gallery/product-media-gallery.liquid +++ b/components/product.block.media-gallery/product.block.media-gallery.liquid @@ -8,7 +8,7 @@ {% render 'product-media-gallery' %} {%- endcomment -%} -{%- render 'stylesheet', name: 'component.product-media-gallery.css' -%} +{%- render 'stylesheet', name: 'product.block.media-gallery.css' -%} {%- liquid assign default_media = product.selected_or_first_available_variant.featured_media | default: product.featured_media @@ -43,5 +43,5 @@ diff --git a/components/block-price/assets/component.block-price.css b/components/product.block.price/assets/product.block.price.css similarity index 100% rename from components/block-price/assets/component.block-price.css rename to components/product.block.price/assets/product.block.price.css diff --git a/components/block-price/assets/component.block-price.js b/components/product.block.price/assets/product.block.price.js similarity index 100% rename from components/block-price/assets/component.block-price.js rename to components/product.block.price/assets/product.block.price.js diff --git a/components/block-price/block-price.liquid b/components/product.block.price/product.block.price.liquid similarity index 95% rename from components/block-price/block-price.liquid rename to components/product.block.price/product.block.price.liquid index 11959a5..9c6fb54 100644 --- a/components/block-price/block-price.liquid +++ b/components/product.block.price/product.block.price.liquid @@ -9,10 +9,10 @@ - product_save_type {'dollar'|'percent'} - Savings display style Usage: - {% render 'block-price' block: block %} + {% render 'product.block.price' %} {%- endcomment -%} -{% render 'stylesheet', name: 'component.block-price.css' %} +{% render 'stylesheet', name: 'product.block.price.css' %} {%- liquid assign use_variant = use_variant | default: true @@ -34,7 +34,7 @@ endif -%} - + {% render 't-with-fallback', key: 'labels.price', fallback: 'Price' %} @@ -109,5 +109,5 @@ diff --git a/components/product.block.price/setup/sections/block-price.liquid b/components/product.block.price/setup/sections/block-price.liquid new file mode 100644 index 0000000..ab45796 --- /dev/null +++ b/components/product.block.price/setup/sections/block-price.liquid @@ -0,0 +1 @@ +{%- render 'product.block.price' -%} diff --git a/components/product.block.price/setup/templates/product.block-price.json b/components/product.block.price/setup/templates/product.block-price.json new file mode 100644 index 0000000..76325cd --- /dev/null +++ b/components/product.block.price/setup/templates/product.block-price.json @@ -0,0 +1,8 @@ +{ + "sections": { + "block_price": { + "type": "block-price" + } + }, + "order": ["block_price"] +} diff --git a/components/block-price/setup/test/block-price.spec.js b/components/product.block.price/setup/test/block-price.spec.js similarity index 100% rename from components/block-price/setup/test/block-price.spec.js rename to components/product.block.price/setup/test/block-price.spec.js diff --git a/components/block-title/assets/component.block-title.css b/components/product.block.title/assets/product.block.title.css similarity index 100% rename from components/block-title/assets/component.block-title.css rename to components/product.block.title/assets/product.block.title.css diff --git a/components/variant-sku/assets/component.variant-sku.js b/components/product.block.title/assets/product.block.title.sku.js similarity index 100% rename from components/variant-sku/assets/component.variant-sku.js rename to components/product.block.title/assets/product.block.title.sku.js diff --git a/components/block-title/block-title.liquid b/components/product.block.title/product.block.title.liquid similarity index 84% rename from components/block-title/block-title.liquid rename to components/product.block.title/product.block.title.liquid index 4014a35..532b7fe 100644 --- a/components/block-title/block-title.liquid +++ b/components/product.block.title/product.block.title.liquid @@ -8,10 +8,10 @@ - vendor_enable {boolean} - Show or hide the vendor Usage: - {% render 'block-title', block: block %} + {% render 'product.block.title' %} {%- endcomment -%} -{% render 'stylesheet', name: 'component.block-title.css' %} +{% render 'stylesheet', name: 'product.block.title.css' %} {%- liquid capture title_default @@ -27,7 +27,7 @@ assign vendor_url = collection_for_vendor.url | default: vendor_url_default -%} -
+

{{- title -}}

@@ -42,7 +42,7 @@ {%- if sku_enable -%}
- {%- render 'variant-sku' -%} + {%- render 'product.block.title.sku' -%}
{%- endif -%}
diff --git a/components/product.block.title/setup/sections/block-title.liquid b/components/product.block.title/setup/sections/block-title.liquid new file mode 100644 index 0000000..74c891b --- /dev/null +++ b/components/product.block.title/setup/sections/block-title.liquid @@ -0,0 +1,13 @@ +{% assign current_variant = product.selected_or_first_available_variant %} + +{% render 'product.block.title' %} + + diff --git a/components/product.block.title/setup/templates/product.block-title.json b/components/product.block.title/setup/templates/product.block-title.json new file mode 100644 index 0000000..81bb32b --- /dev/null +++ b/components/product.block.title/setup/templates/product.block-title.json @@ -0,0 +1,8 @@ +{ + "sections": { + "block_title": { + "type": "block-title" + } + }, + "order": ["block_title"] +} diff --git a/components/variant-sku/variant-sku.liquid b/components/product.block.title/snippets/product.block.title.sku.liquid similarity index 92% rename from components/variant-sku/variant-sku.liquid rename to components/product.block.title/snippets/product.block.title.sku.liquid index e7bef86..d90c7be 100644 --- a/components/variant-sku/variant-sku.liquid +++ b/components/product.block.title/snippets/product.block.title.sku.liquid @@ -19,5 +19,5 @@ diff --git a/components/block-title/test/block-title.spec.js b/components/product.block.title/test/block-title.spec.js similarity index 100% rename from components/block-title/test/block-title.spec.js rename to components/product.block.title/test/block-title.spec.js diff --git a/components/variant-button/assets/component.variant-button.css b/components/product.block.variant-picker/assets/product.block.variant-picker.css similarity index 95% rename from components/variant-button/assets/component.variant-button.css rename to components/product.block.variant-picker/assets/product.block.variant-picker.css index f7204c3..bcdc5d1 100644 --- a/components/variant-button/assets/component.variant-button.css +++ b/components/product.block.variant-picker/assets/product.block.variant-picker.css @@ -1,3 +1,8 @@ +.block-variant-picker { + display: grid; + gap: var(--size-6); +} + .variant-button { --label-bottom-margin: var(--size-3); diff --git a/components/block-variant-picker/assets/component.block-variant-picker.js b/components/product.block.variant-picker/assets/product.block.variant-picker.js similarity index 100% rename from components/block-variant-picker/assets/component.block-variant-picker.js rename to components/product.block.variant-picker/assets/product.block.variant-picker.js diff --git a/components/block-variant-picker/block-variant-picker.liquid b/components/product.block.variant-picker/product.block.variant-picker.liquid similarity index 65% rename from components/block-variant-picker/block-variant-picker.liquid rename to components/product.block.variant-picker/product.block.variant-picker.liquid index f93398f..21dfa95 100644 --- a/components/block-variant-picker/block-variant-picker.liquid +++ b/components/product.block.variant-picker/product.block.variant-picker.liquid @@ -2,18 +2,18 @@ Renders product variant-picker Accepts: - - block {block} - Block object - product {product} - Product object - update_url {boolean} - Whether to update the URL when the variant is changed Usage: - {% render 'block-variant-picker', block: block %} + {% render 'product.block.variant-picker' %} {%- endcomment -%} -{% render 'stylesheet', name: 'component.block-variant-picker.css' %} +{% render 'stylesheet', name: 'product.block.variant-picker.css' %} {%- liquid assign update_url = update_url | default: true, allow_false: true + assign picker_type = picker_type | default: block.settings.picker_type | default: 'button' -%} {%- unless product.has_only_default_variant -%} @@ -23,14 +23,13 @@ section-id="{{ section.id }}" url="{{ product.url }}" update-url="{{ update_url }}" - {{ block.shopify_attributes }} > {%- liquid for option in product.options_with_values - if block.settings.picker_type == 'button' - render 'variant-button', option: option + if picker_type == 'button' + render 'product.block.variant-picker.button', option: option else - render 'variant-dropdown', option: option + render 'product.block.variant-picker.dropdown', option: option endif endfor -%} @@ -41,6 +40,6 @@ {%- endunless -%} diff --git a/components/product.block.variant-picker/setup/sections/block-variant-picker-dropdown.liquid b/components/product.block.variant-picker/setup/sections/block-variant-picker-dropdown.liquid new file mode 100644 index 0000000..84bd1ad --- /dev/null +++ b/components/product.block.variant-picker/setup/sections/block-variant-picker-dropdown.liquid @@ -0,0 +1 @@ +{%- render 'product.block.variant-picker', picker_type: 'dropdown' -%} diff --git a/components/product.block.variant-picker/setup/sections/block-variant-picker.liquid b/components/product.block.variant-picker/setup/sections/block-variant-picker.liquid new file mode 100644 index 0000000..9c4d892 --- /dev/null +++ b/components/product.block.variant-picker/setup/sections/block-variant-picker.liquid @@ -0,0 +1 @@ +{%- render 'product.block.variant-picker' -%} diff --git a/components/product.block.variant-picker/setup/templates/product.block-variant-picker.json b/components/product.block.variant-picker/setup/templates/product.block-variant-picker.json new file mode 100644 index 0000000..b4a670d --- /dev/null +++ b/components/product.block.variant-picker/setup/templates/product.block-variant-picker.json @@ -0,0 +1,12 @@ +{ + "sections": { + "variant_picker_1": { + "type": "block-variant-picker" + }, + "variant_picker_2": { + "type": "block-variant-picker-dropdown", + "disabled": true + } + }, + "order": ["variant_picker_1", "variant_picker_2"] +} diff --git a/components/variant-button/variant-button.liquid b/components/product.block.variant-picker/snippets/product.block.variant-picker.button.liquid similarity index 96% rename from components/variant-button/variant-button.liquid rename to components/product.block.variant-picker/snippets/product.block.variant-picker.button.liquid index c9d3a68..dbf1538 100644 --- a/components/variant-button/variant-button.liquid +++ b/components/product.block.variant-picker/snippets/product.block.variant-picker.button.liquid @@ -12,7 +12,7 @@ {%- endfor -%} {% endcomment %} -{%- render 'stylesheet', name: 'component.variant-button.css' -%} +{%- render 'stylesheet', name: 'product.block.variant-picker.button.css' -%} {%- liquid assign variants_available_arr = product.variants | map: 'available' diff --git a/components/variant-dropdown/variant-dropdown.liquid b/components/product.block.variant-picker/snippets/product.block.variant-picker.dropdown.liquid similarity index 100% rename from components/variant-dropdown/variant-dropdown.liquid rename to components/product.block.variant-picker/snippets/product.block.variant-picker.dropdown.liquid diff --git a/components/block-variant-picker/test/block-variant-picker.spec.js b/components/product.block.variant-picker/test/block-variant-picker.spec.js similarity index 100% rename from components/block-variant-picker/test/block-variant-picker.spec.js rename to components/product.block.variant-picker/test/block-variant-picker.spec.js diff --git a/components/section-main-product/assets/component.section-main-product.css b/components/product.section.main/assets/component.section-main-product.css similarity index 100% rename from components/section-main-product/assets/component.section-main-product.css rename to components/product.section.main/assets/component.section-main-product.css diff --git a/components/section-main-product/section-main-product.liquid b/components/product.section.main/product.section.main.liquid similarity index 74% rename from components/section-main-product/section-main-product.liquid rename to components/product.section.main/product.section.main.liquid index b607456..52f5cc8 100644 --- a/components/section-main-product/section-main-product.liquid +++ b/components/product.section.main/product.section.main.liquid @@ -8,16 +8,7 @@ Usage: {% liquid capture blocks - for block in section.blocks - case block.type - when 'title' - render 'block-title', block: block - when 'variant_picker' - render 'block-variant-picker', block: block - when 'buy_buttons' - render 'block-buy-buttons', block: block - endcase - endfor + content_for: 'blocks' endcapture render 'main-product', slot_product_blocks: blocks @@ -40,7 +31,7 @@ {%- if slot_product_gallery != blank -%} {{ slot_product_gallery }} {%- else -%} - {%- render 'product-media-gallery' -%} + {%- render 'product.block.media-gallery' -%} {%- endif -%}
diff --git a/components/product.section.main/setup/blocks/_product-buy-buttons.liquid b/components/product.section.main/setup/blocks/_product-buy-buttons.liquid new file mode 100644 index 0000000..1403e93 --- /dev/null +++ b/components/product.section.main/setup/blocks/_product-buy-buttons.liquid @@ -0,0 +1,17 @@ +{% render 'product.block.buy-buttons' %} + +{% schema %} + { + "name": "t:labels.buy_buttons", + "settings": [ + { + "type": "checkbox", + "id": "show_dynamic_checkout", + "label": "t:actions.show_dynamic_checkout", + "default": true, + "info": "t:info.lets_customers_checkout_familiar" + } + ] + } +{% endschema %} + diff --git a/components/product.section.main/setup/blocks/_product-description.liquid b/components/product.section.main/setup/blocks/_product-description.liquid new file mode 100644 index 0000000..67c645c --- /dev/null +++ b/components/product.section.main/setup/blocks/_product-description.liquid @@ -0,0 +1,7 @@ +{%- render 'product.block.description', product: product -%} + +{% schema %} + { + "name": "t:labels.description" + } +{% endschema %} \ No newline at end of file diff --git a/components/product.section.main/setup/blocks/_product-price.liquid b/components/product.section.main/setup/blocks/_product-price.liquid new file mode 100644 index 0000000..4f6b74a --- /dev/null +++ b/components/product.section.main/setup/blocks/_product-price.liquid @@ -0,0 +1,7 @@ +{% render 'product.block.price' %} + +{% schema %} + { + "name": "t:labels.price" + } +{% endschema %} \ No newline at end of file diff --git a/components/product.section.main/setup/blocks/_product-title.liquid b/components/product.section.main/setup/blocks/_product-title.liquid new file mode 100644 index 0000000..8d81d15 --- /dev/null +++ b/components/product.section.main/setup/blocks/_product-title.liquid @@ -0,0 +1,20 @@ +{% render 'product.block.title' %} + +{% schema %} + { + "name": "t:labels.title", + "settings": [ + { + "type": "checkbox", + "id": "vendor_enable", + "label": "t:actions.show_vendor" + }, + { + "type": "checkbox", + "id": "sku_enable", + "label": "t:actions.show_sku", + "default": true + } + ] + } +{% endschema %} \ No newline at end of file diff --git a/components/product.section.main/setup/blocks/_product-variant-picker.liquid b/components/product.section.main/setup/blocks/_product-variant-picker.liquid new file mode 100644 index 0000000..11bc98b --- /dev/null +++ b/components/product.section.main/setup/blocks/_product-variant-picker.liquid @@ -0,0 +1,25 @@ +{% render 'product.block.variant-picker' %} + +{% schema %} + { + "name": "Variant picker", + "settings": [ + { + "type": "select", + "id": "picker_type", + "label": "t:labels.type", + "options": [ + { + "value": "button", + "label": "t:labels.buttons" + }, + { + "value": "dropdown", + "label": "t:labels.dropdown" + } + ], + "default": "button" + } + ] + } +{% endschema %} \ No newline at end of file diff --git a/components/product.section.main/setup/sections/main-product.liquid b/components/product.section.main/setup/sections/main-product.liquid new file mode 100644 index 0000000..603b501 --- /dev/null +++ b/components/product.section.main/setup/sections/main-product.liquid @@ -0,0 +1,47 @@ +{%- liquid + capture blocks + content_for 'blocks' + endcapture + + render 'section-main-product', slot_product_blocks: blocks +-%} + +{% schema %} +{ + "name": "t:labels.product", + "settings": [ + { + "type": "header", + "content": "t:labels.media" + }, + { + "type": "paragraph", + "content": "t:info.learn_more_media_types" + }, + { + "type": "select", + "id": "image_position", + "label": "t:labels.position", + "options": [ + { + "value": "left", + "label": "t:labels.alignments.left" + }, + { + "value": "right", + "label": "t:labels.alignments.right" + } + ], + "default": "left" + } + ], + "blocks": [ + { "type": "@app" }, + { "type": "_product-buy-buttons" }, + { "type": "_product-description" }, + { "type": "_product-price" }, + { "type": "_product-title" }, + { "type": "_product-variant-picker" } + ] +} +{% endschema %} diff --git a/components/section-main-product/setup/templates/product.section-main-product.json b/components/product.section.main/setup/templates/product.section-main-product.json similarity index 100% rename from components/section-main-product/setup/templates/product.section-main-product.json rename to components/product.section.main/setup/templates/product.section-main-product.json diff --git a/components/section-main-product/setup/sections/main-product.liquid b/components/section-main-product/setup/sections/main-product.liquid deleted file mode 100644 index bb868b0..0000000 --- a/components/section-main-product/setup/sections/main-product.liquid +++ /dev/null @@ -1,126 +0,0 @@ -{%- liquid - capture blocks - for block in section.blocks - case block.type - when '@app' - render block - when 'description' - render 'block-product-description', block: block - when 'variant_picker' - render 'block-variant-picker', block: block - when 'buy_buttons' - render 'block-buy-buttons', block: block - when 'title' - render 'block-title', block: block - when 'price' - render 'block-price', block: block - endcase - endfor - endcapture - - render 'section-main-product', slot_product_blocks: blocks --%} - -{% schema %} -{ - "name": "t:labels.product", - "settings": [ - { - "type": "header", - "content": "t:labels.media" - }, - { - "type": "paragraph", - "content": "t:info.learn_more_media_types" - }, - { - "type": "select", - "id": "image_position", - "label": "t:labels.position", - "options": [ - { - "value": "left", - "label": "t:labels.alignments.left" - }, - { - "value": "right", - "label": "t:labels.alignments.right" - } - ], - "default": "left" - } - ], - "blocks": [ - { - "type": "@app" - }, - { - "type": "title", - "name": "t:labels.title", - "limit": 1, - "settings": [ - { - "type": "inline_richtext", - "id": "vendor_enable", - "label": "t:actions.show_vendor", - "default": "{{ product.vendor }}" - }, - { - "type": "checkbox", - "id": "sku_enable", - "label": "t:actions.show_sku", - "default": true - } - ] - }, - { - "type": "price", - "name": "t:labels.price", - "limit": 1 - }, - { - "type": "description", - "name": "t:labels.description", - "limit": 1, - "settings": [] - }, - { - "type": "variant_picker", - "name": "Variant picker", - "limit": 1, - "settings": [ - { - "type": "select", - "id": "picker_type", - "label": "t:labels.type", - "options": [ - { - "value": "button", - "label": "t:labels.buttons" - }, - { - "value": "dropdown", - "label": "t:labels.dropdown" - } - ], - "default": "button" - } - ] - }, - { - "type": "buy_buttons", - "name": "t:labels.buy_buttons", - "limit": 1, - "settings": [ - { - "type": "checkbox", - "id": "show_dynamic_checkout", - "label": "t:actions.show_dynamic_checkout", - "default": true, - "info": "t:info.lets_customers_checkout_familiar" - } - ] - } - ] -} -{% endschema %} diff --git a/components/styles-tokens/styles-tokens.liquid b/components/styles-tokens/styles-tokens.liquid index e54d4d7..7101814 100644 --- a/components/styles-tokens/styles-tokens.liquid +++ b/components/styles-tokens/styles-tokens.liquid @@ -1,8 +1,9 @@ {%- comment -%} - Renders the list of CSS token variables + Renders the list of CSS variables. Typically, this is referenced inside of a + theme's layout file. Usage: - {% render 'css-variables' %} + {% render 'styles-tokens' %} {%- endcomment -%} {%- style -%} diff --git a/components/variant-button/setup/sections/variant-button.liquid b/components/variant-button/setup/sections/variant-button.liquid deleted file mode 100644 index 754fd91..0000000 --- a/components/variant-button/setup/sections/variant-button.liquid +++ /dev/null @@ -1,11 +0,0 @@ -{%- liquid - for option in product.options_with_values - render 'variant-button', option: option - endfor --%} - -{% schema %} -{ - "name": "t:labels.product" -} -{% endschema %} diff --git a/components/variant-button/setup/templates/product.variant-button.json b/components/variant-button/setup/templates/product.variant-button.json deleted file mode 100644 index 5d28b98..0000000 --- a/components/variant-button/setup/templates/product.variant-button.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "sections": { - "variant_button": { - "type": "variant-button" - } - }, - "order": ["variant_button"] -} diff --git a/components/variant-dropdown/setup/sections/variant-dropdown.liquid b/components/variant-dropdown/setup/sections/variant-dropdown.liquid deleted file mode 100644 index 1e47161..0000000 --- a/components/variant-dropdown/setup/sections/variant-dropdown.liquid +++ /dev/null @@ -1,11 +0,0 @@ -{%- liquid - for option in product.options_with_values - render 'variant-dropdown', option: option - endfor --%} - -{% schema %} -{ - "name": "t:labels.product" -} -{% endschema %} diff --git a/components/variant-dropdown/setup/templates/product.variant-dropdown.json b/components/variant-dropdown/setup/templates/product.variant-dropdown.json deleted file mode 100644 index 8cd9fe7..0000000 --- a/components/variant-dropdown/setup/templates/product.variant-dropdown.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "sections": { - "variant_dropdown": { - "type": "variant-dropdown" - } - }, - "order": ["variant_dropdown"] -} diff --git a/components/variant-sku/setup/sections/variant-sku.liquid b/components/variant-sku/setup/sections/variant-sku.liquid deleted file mode 100644 index e96d675..0000000 --- a/components/variant-sku/setup/sections/variant-sku.liquid +++ /dev/null @@ -1,7 +0,0 @@ -{%- render 'variant-sku' -%} - -{% schema %} -{ - "name": "t:labels.product" -} -{% endschema %} diff --git a/components/variant-sku/setup/templates/product.variant-sku.json b/components/variant-sku/setup/templates/product.variant-sku.json deleted file mode 100644 index 0bdad6d..0000000 --- a/components/variant-sku/setup/templates/product.variant-sku.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "sections": { - "variant_sku": { - "type": "variant-sku" - } - }, - "order": ["variant_sku"] -} diff --git a/jsconfig.json b/jsconfig.json index acc8ba7..cb6c8eb 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -7,5 +7,5 @@ "*": ["scripts/*"], } }, - "include": ["scripts", "components"] + "include": ["scripts", "components", "components/is-land/assets/vendor.is-land.min.js"] }