@lightspeed/crane-api 1.0.2 → 1.1.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/CHANGELOG.md +7 -0
- package/README.md +113 -6
- package/dist/index.d.mts +1725 -478
- package/dist/index.d.ts +1725 -478
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as ae,ref as O,computed as o,reactive as E,createSSRApp as re}from"vue";import{renderToString as ie}from"vue/server-renderer";const p={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function le(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function ue(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function se(e){if("pageUrl"in e)return e.pageUrl;switch(ue(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}function ce(e){if("categoryId"in e)return e.categoryId}const y=(e,t,n)=>{if(!e||t)return;const{type:a,link:r,email:i,phone:l}=e,v=se(e),c=ce(e);switch(a){case p.HYPER_LINK:if(r)return()=>window.open(r,"_blank");break;case p.GO_TO_STORE:case p.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case p.GO_TO_CATEGORY:case p.GO_TO_CATEGORY_LINK:const s=n?.find(u=>u.id===c)?.url;return s===void 0?()=>window.open("/404","_self"):()=>window.open(s,"_self");case p.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case p.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case p.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const u=le(e);document.getElementById(`tile-${u}`)?.scrollIntoView()};break;case p.GO_TO_PAGE:if(v)return()=>window.open(v,"_self");break;default:console.error(`Unknown type of ActionLink: ${a}`)}},R=new Map;function d(){const e=(r,i,l,v,c,s,u)=>{R.set(r._uid,{context:O(i),content:O(l),design:O(v),defaults:O(c),site:O(s?.site??{}),category:O(s?.category),storeData:O(s?.storeData),globalDesign:O(u)})},t=(r,i,l,v,c,s)=>{const u=R.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=v,u.site.value=c.site??{},u.category.value=c.category,u.globalDesign.value=s,u.storeData.value=c.storeData)},n=ae()?.appContext.app._uid??-1,a=R.get(n);return{init:e,update:t,context:a?.context,content:a?.content,design:a?.design,defaults:a?.defaults,site:a?.site,category:a?.category,storeData:a?.storeData,globalDesign:a?.globalDesign}}function ve(e){return"title"in e&&"type"in e}function de(e,t,n,a){const r=o(()=>{const b=e.value[t];if(b!==void 0){if(ve(b))return b;throw new Error(`Element ${t} is not action link`)}}),i=o(()=>r.value?.title),l=o(()=>r.value?.type),v=o(()=>r.value?.link),c=o(()=>r.value?.email),s=o(()=>r.value?.phone),u=o(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),g=o(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),T=o(()=>r.value?.pageUrl),m=o(()=>!!i.value),I=o(()=>!!v.value),oe=y(r.value,n,a);return E({title:i,type:l,link:v,email:c,phone:s,tileDivId:u,pageId:g,pageUrl:T,hasTitle:m,hasLink:I,performAction:oe})}function A(e,t){const n=d(),a=o(()=>!!n.site?.value?.isPreviewMode),r=o(()=>n.category?.value?.categories??[]),i=o(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return de(i,e,a.value,r.value)}function G({content:e,elementName:t,errorMessage:n,validatorFn:a}){return o(()=>{const r=e.value?.[t];if(r!==void 0){if(a(r))return r;throw new Error(n)}})}function ge(e){return typeof e=="object"&&e!==null&&"categories"in e}function Ee(e){return o(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function Te(e){return e!==void 0}function fe(e){return!!e?.trim()}function pe({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:fe(t)?t:e}function Oe(e,t){return Te(e)&&t}function N({itemId:e,id:t,alt:n,name:a,nameTranslated:r,customName:i,enabled:l,productsCount:v,url:c,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,selectionType:T}){return{itemId:e||t.toString(),id:t,alt:n,name:pe({name:a,customName:i,selectionType:T}),nameTranslated:r,label:a,enabled:l,url:c,productsCount:v,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,showCategory:Oe(t,l)}}function me(e){const t=d(),n=o(()=>t.content.value),a=G({content:n,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:ge}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.categories.selectionType??"ROOT"),l=o(()=>r.value?.categories??[]),v=o(()=>a.value?.categories?.categoryIds??[]),c=o(()=>{const g=Ee(l);return i.value==="MANUAL"?a.value?.categories?.items?.map(T=>{const m=g.value[T.id];return N({...T,...m,selectionType:i.value})})??[]:r?.value?.categories.map(T=>N({...T,selectionType:i.value}))??[]}),s=o(()=>a.value!==void 0),u=o(()=>c.value!==void 0&&c.value.length>0);return E({categories:c,categoryIds:v,hasContent:s,hasCategories:u})}function Ie(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function L(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function D(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Le(a,e)}function Le(e,t){const n=o(()=>{const s=e.value[t];if(s!==void 0){if(Ie(s))return s;throw new Error(`Element ${t} is not image`)}}),a=o(()=>n.value===void 0?"":d().context.value.imageBuckets?.[n.value?.bucket]),r=o(()=>n.value!==void 0),i=o(()=>L(n.value?.set?.["cropped-webp-100x200"]?.url,a.value)),l=o(()=>L(n.value?.set?.["cropped-webp-1000x2000"]?.url,a.value)),v=o(()=>L(n.value?.set?.["webp-200x200"]?.url,a.value)),c=o(()=>L(n.value?.set?.["webp-2000x2000"]?.url,a.value));return E({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:v,highResolutionDesktopImage:c})}function h(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return _e(a,e)}function _e(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),a=o(()=>n.value!==void 0&&n.value.length>0),r=o(()=>n.value);return E({hasContent:a,value:r})}function w(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Ce(a,e)}function Ce(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return E({hasContent:a,value:r})}function M(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return be(a,e)}function be(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return E({hasContent:a,value:r})}function Re(e){return"enabled"in e}function B(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Se(a,e)}function Se(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(Re(i))return i;throw new Error(`Element ${t} is not toggle`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value?.enabled);return E({hasContent:a,value:r})}var U=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(U||{});function ye(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}function Ae(e){const t=d(),n=o(()=>{const i=t.content.value[e];if(i!==void 0){if(ye(i))return i;throw new Error(`Element ${e} is not of DECK type`)}}),a=o(()=>n.value!==void 0&&n.value.cards.length>0),r=o(()=>n.value?.cards);return E({hasContent:a,cards:r,getReactiveRef:Ge})}function Ge(e,t,n){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const a=e.settings[n];if(a===void 0)return a;switch(t){case"TEXTAREA":return M(n,e.settings);case"INPUTBOX":return h(n,e.settings);case"SELECTBOX":return w(n,e.settings);case"IMAGE":return D(n,e.settings);case"TOGGLE":return B(n,e.settings);case"BUTTON":return A(n,e.settings);default:return}}function Ne(e){return"type"in e&&("text"in e||"image"in e)}function _(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function De(){const e=d(),t=o(()=>{const l=e.content.value.logo;if(l!==void 0){if(Ne(l))return l;throw new Error("Element logo is not LOGO")}}),n=o(()=>t.value?.type),a=o(()=>t.value?.text),r=o(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=o(()=>({lowResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:_(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:_(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return E({type:n,text:a,image:i})}function he(e){return e!==null&&"items"in e}function P(e){const t=d(),n=o(()=>{const l=t.content.value[e];if(l!==void 0){if(he(l))return l;throw new Error(`Element ${e} is not an menu`)}}),a=o(()=>!!t.site?.value?.isPreviewMode),r=o(()=>n.value!==void 0),i=o(()=>n.value?.items?n.value.items.map(l=>({...l,performAction:y(l,a.value)})):[]);return E({hasContent:r,items:i})}const we="menu";function Me(){return P(we)}function Be(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function Ue(e){const t=d(),n=o(()=>t.content.value),a=G({content:n,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:Be}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.products?.selectionType??"MANUAL"),l=o(()=>a.value?.products?.productIds??[]),v=o(()=>a.value?.product?.id),c=o(()=>a.value?.categoryId?parseInt(a.value.categoryId,10):void 0),s=o(()=>{if(l.value&&c.value&&i.value==="CATEGORY")return r?.value?.products.filter(I=>I?.defaultCategoryId===c.value)??[];if(typeof c.value=="number"&&c.value===0&&i.value==="CATEGORY")return r?.value?.products??[];const m=v.value?[v.value]:l.value??[];return r?.value?.products.filter(I=>m.includes(I.id))??[]}),u=o(()=>r?.value?.categories.filter(m=>m.id===c?.value)??[]),g=o(()=>a.value!==void 0),T=o(()=>s.value!==void 0&&s.value.length>0);return E({products:s,categories:u,categoryId:c,hasContent:g,hasProducts:T})}function Pe(){return globalThis.craneSharedTranslation??{}}function ke(){const e=d(),t=o(()=>e.site?.value),n=o(()=>Pe()),a=o(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=a.value,v=i[l]?.[r];if(v!==void 0)return v;if(l!=="en"){const c=i.en?.[r];if(c!==void 0)return c}return r},currentLanguageCode:a}}function k(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);if(n!==void 0)return e.fontFamily?e.fontFamily[n].replaceAll("_"," "):void 0}function C(e,t,n){return t?k(e,t):k(e,n)}function x(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function S(e,t,n){return t?x(e,t):x(e,n)}function K(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function f(e,t,n){return t?K(e,t):K(e,n)}function xe(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:f(e,t?.color,n?.color)}}function Ke(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:f(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:f(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:f(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),a=o(()=>n.value?.background);return E({background:a})}function $e(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:C(g,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.appearance),r=o(()=>n.value?.font),i=o(()=>n.value?.size),l=o(()=>n.value?.style),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return E({appearance:a,font:r,size:i,style:l,color:v,visible:c})}function ze(e){const t=d(),n=o(()=>{const i=t.design.value[e],l=t.defaults.value[e],v=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:f(v,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:f(v,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:f(v,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),a=o(()=>n.value?.overlay),r=o(()=>n.value?.visible);return E({overlay:a,visible:r})}function Xe(){const e=d(),t=o(()=>e.design.value.layout),n=o(()=>t.value);return E({layout:n})}function Fe(){const e=d();return o(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,a=e.globalDesign.value;return{font:C(a,t?.font,n?.font),size:S(a,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:f(a,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:xe(a,t?.frame,n?.frame)}})}function Ye(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),a=o(()=>n.value?.value);return E({value:a})}function We(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{font:C(g,s?.font,u?.font),size:S(g,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return E({font:a,size:r,bold:i,italic:l,color:v,visible:c})}function Ve(e){const t=d(),n=o(()=>{const u=t.design.value[e],g=t.defaults.value[e],T=t.globalDesign.value;return{font:C(T,u?.font,g?.font),size:S(T,u?.size,g?.size),bold:u?.bold??g?.bold,italic:u?.italic??g?.italic,color:f(T,u?.color,g?.color),visible:u?.visible??g?.visible??!1,whiteSpace:"pre-wrap"}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible),s=o(()=>n.value?.whiteSpace);return E({font:a,size:r,bold:i,italic:l,color:v,visible:c,whiteSpace:s})}function He(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),a=o(()=>n.value?.enabled);return E({enabled:a})}function $(e){return{app:re(e)}}function je(e,t){return{init:()=>{const{app:n}=$(e);return t?.init?.(n),{mount:(a,r)=>{d().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign),t?.mount?.(n,a,r),n.mount(a)},update:a=>{d().update(n,a.data.content,a.data.design,a.data.defaults,a.data.externalContent,a.context.globalDesign),t?.update?.(n,a)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function Je(){return globalThis.window.instantsite}function qe(e,t){return{init:()=>{const{app:n}=$(e);return t?.init?.(n),{render:async(a,r)=>(d().init(n,a,r.content,r.design,r.defaults,r.externalContent,a.globalDesign),t?.render?.(n,a,r),{html:await ie(n,{context:a}),state:{context:a,data:r}})}}}}var z=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(z||{}),X=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e.NONE="NONE",e))(X||{}),F=(e=>(e.SOLID="SOLID",e.OUTLINE="OUTLINE",e.TEXT="TEXT",e))(F||{}),Y=(e=>(e.SMALL="SMALL",e.MEDIUM="MEDIUM",e.LARGE="LARGE",e))(Y||{}),W=(e=>(e.ROUND_CORNER="ROUND_CORNER",e.RECTANGLE="RECTANGLE",e.PILL="PILL",e))(W||{}),V=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e))(V||{}),H=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(H||{}),j=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(j||{}),J=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e))(J||{}),q=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(q||{}),Qe=(e=>(e.TEXTAREA="TEXTAREA",e.INPUTBOX="INPUTBOX",e.SELECTBOX="SELECTBOX",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.BUTTON="BUTTON",e.DECK="DECK",e.MENU="MENU",e.NAVIGATION_MENU="NAVIGATION_MENU",e.LOGO="LOGO",e.INFO="INFO",e.DIVIDER="DIVIDER",e))(Qe||{}),Q=(e=>(e.TEXT="TEXT",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e.BACKGROUND="BACKGROUND",e.COLOR_PICKER="COLOR_PICKER",e.LOGO="LOGO",e.DIVIDER="DIVIDER",e))(Q||{}),Z=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(Z||{}),ee=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(ee||{}),te=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(te||{}),ne=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(ne||{});const Ze={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},et={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},tt={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},nt={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};export{q as ActionLinkTypeEnum,V as BackgroundStyleEnum,F as ButtonAppearanceEnum,W as ButtonShapeEnum,Y as ButtonSizeEnum,z as ButtonTypeEnum,et as CatalogLayoutSlot,tt as CategoryLayoutSlot,J as ConfigTypeEnum,Q as DesignEditorType,U as EditorTypes,te as ImageSet,ne as InstantsiteJsEvent,X as OverlayTypeEnum,j as PluginTypeEnum,nt as ProductLayoutSlot,H as SectionTypeEnum,Ze as TemplateCategoriesList,Z as TemplatePageEnum,ee as ValidationTypeEnum,je as createVueClientApp,qe as createVueServerApp,Ke as useBackgroundElementDesign,A as useButtonElementContent,$e as useButtonElementDesign,me as useCategorySelectorElementContent,Ae as useDeckElementContent,D as useImageElementContent,ze as useImageElementDesign,h as useInputboxElementContent,Je as useInstantsiteJsApi,Xe as useLayoutElementDesign,De as useLogoElementContent,Fe as useLogoElementDesign,P as useMenuElementContent,Me as useNavigationMenuElementContent,Ue as useProductSelectorElementContent,w as useSelectboxElementContent,Ye as useSelectboxElementDesign,We as useTextElementDesign,M as useTextareaElementContent,Ve as useTextareaElementDesign,B as useToggleElementContent,He as useToggleElementDesign,ke as useTranslation,d as useVueBaseProps};
|
|
1
|
+
import{createSSRApp as re,getCurrentInstance as ie,ref as O,computed as o,reactive as T}from"vue";import{renderToString as le}from"vue/server-renderer";function y(e){return{app:re(e)}}const R=new Map;function d(){const e=(r,i,l,v,c,s,u)=>{R.set(r._uid,{context:O(i),content:O(l),design:O(v),defaults:O(c),site:O(s?.site??{}),category:O(s?.category),storeData:O(s?.storeData),globalDesign:O(u)})},t=(r,i,l,v,c,s)=>{const u=R.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=v,u.site.value=c.site??{},u.category.value=c.category,u.globalDesign.value=s,u.storeData.value=c.storeData)},n=ie()?.appContext.app._uid??-1,a=R.get(n);return{init:e,update:t,context:a?.context,content:a?.content,design:a?.design,defaults:a?.defaults,site:a?.site,category:a?.category,storeData:a?.storeData,globalDesign:a?.globalDesign}}function ue(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{mount:(a,r)=>{d().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign),t?.mount?.(n,a,r),n.mount(a)},update:a=>{d().update(n,a.data.content,a.data.design,a.data.defaults,a.data.externalContent,a.context.globalDesign),t?.update?.(n,a)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function se(){return globalThis.window.instantsite}function ce(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{render:async(a,r)=>(d().init(n,a,r.content,r.design,r.defaults,r.externalContent,a.globalDesign),t?.render?.(n,a,r),{html:await le(n,{context:a}),state:{context:a,data:r}})}}}}var A=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(A||{}),G=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e.NONE="NONE",e))(G||{}),D=(e=>(e.SOLID="SOLID",e.OUTLINE="OUTLINE",e.TEXT="TEXT",e))(D||{}),N=(e=>(e.SMALL="SMALL",e.MEDIUM="MEDIUM",e.LARGE="LARGE",e))(N||{}),h=(e=>(e.ROUND_CORNER="ROUND_CORNER",e.RECTANGLE="RECTANGLE",e.PILL="PILL",e))(h||{}),w=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e))(w||{}),M=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(M||{}),B=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(B||{}),U=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e))(U||{}),P=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(P||{}),ve=(e=>(e.TEXTAREA="TEXTAREA",e.INPUTBOX="INPUTBOX",e.SELECTBOX="SELECTBOX",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.BUTTON="BUTTON",e.DECK="DECK",e.MENU="MENU",e.NAVIGATION_MENU="NAVIGATION_MENU",e.LOGO="LOGO",e.INFO="INFO",e.DIVIDER="DIVIDER",e))(ve||{}),x=(e=>(e.TEXT="TEXT",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e.BACKGROUND="BACKGROUND",e.COLOR_PICKER="COLOR_PICKER",e.LOGO="LOGO",e.DIVIDER="DIVIDER",e))(x||{}),k=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(k||{}),K=(e=>(e.HOME="home",e.CATALOG="catalog",e.CATEGORY="category",e.PRODUCT="product",e))(K||{}),$=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))($||{}),z=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(z||{}),X=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(X||{});const de={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},ge={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Te={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Ee={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},p={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function fe(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function pe(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function Oe(e){if("pageUrl"in e)return e.pageUrl;switch(pe(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}function me(e){if("categoryId"in e)return e.categoryId}const Y=(e,t,n)=>{if(!e||t)return;const{type:a,link:r,email:i,phone:l}=e,v=Oe(e),c=me(e);switch(a){case p.HYPER_LINK:if(r)return()=>window.open(r,"_blank");break;case p.GO_TO_STORE:case p.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case p.GO_TO_CATEGORY:case p.GO_TO_CATEGORY_LINK:const s=n?.find(u=>u.id===c)?.url;return s===void 0?()=>window.open("/404","_self"):()=>window.open(s,"_self");case p.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case p.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case p.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const u=fe(e);document.getElementById(`tile-${u}`)?.scrollIntoView()};break;case p.GO_TO_PAGE:if(v)return()=>window.open(v,"_self");break;default:console.error(`Unknown type of ActionLink: ${a}`)}};function Ie(e){return"title"in e&&"type"in e}function Le(e,t,n,a){const r=o(()=>{const b=e.value[t];if(b!==void 0){if(Ie(b))return b;throw new Error(`Element ${t} is not action link`)}}),i=o(()=>r.value?.title),l=o(()=>r.value?.type),v=o(()=>r.value?.link),c=o(()=>r.value?.email),s=o(()=>r.value?.phone),u=o(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),g=o(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),E=o(()=>r.value?.pageUrl),m=o(()=>!!i.value),I=o(()=>!!v.value),ae=Y(r.value,n,a);return T({title:i,type:l,link:v,email:c,phone:s,tileDivId:u,pageId:g,pageUrl:E,hasTitle:m,hasLink:I,performAction:ae})}function F(e,t){const n=d(),a=o(()=>!!n.site?.value?.isPreviewMode),r=o(()=>n.category?.value?.categories??[]),i=o(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return Le(i,e,a.value,r.value)}function W({content:e,elementName:t,errorMessage:n,validatorFn:a}){return o(()=>{const r=e.value?.[t];if(r!==void 0){if(a(r))return r;throw new Error(n)}})}function _e(e){return typeof e=="object"&&e!==null&&"categories"in e}function Ce(e){return o(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function be(e){return e!==void 0}function Re(e){return!!e?.trim()}function Se({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:Re(t)?t:e}function ye(e,t){return be(e)&&t}function H({itemId:e,id:t,alt:n,name:a,nameTranslated:r,customName:i,enabled:l,productsCount:v,url:c,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,selectionType:E}){return{itemId:e||t.toString(),id:t,alt:n,name:Se({name:a,customName:i,selectionType:E}),nameTranslated:r,label:a,enabled:l,url:c,productsCount:v,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,showCategory:ye(t,l)}}function Ae(e){const t=d(),n=o(()=>t.content.value),a=W({content:n,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:_e}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.categories.selectionType??"ROOT"),l=o(()=>r.value?.categories??[]),v=o(()=>a.value?.categories?.categoryIds??[]),c=o(()=>{const g=Ce(l);return i.value==="MANUAL"?a.value?.categories?.items?.map(E=>{const m=g.value[E.id];return H({...E,...m,selectionType:i.value})})??[]:r?.value?.categories.map(E=>H({...E,selectionType:i.value}))??[]}),s=o(()=>a.value!==void 0),u=o(()=>c.value!==void 0&&c.value.length>0);return T({categories:c,categoryIds:v,hasContent:s,hasCategories:u})}function Ge(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function L(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function De(e,t){const n=o(()=>{const s=e.value[t];if(s!==void 0){if(Ge(s))return s;throw new Error(`Element ${t} is not image`)}}),a=o(()=>n.value===void 0?"":d().context.value.imageBuckets?.[n.value?.bucket]),r=o(()=>n.value!==void 0),i=o(()=>L(n.value?.set?.["cropped-webp-100x200"]?.url,a.value)),l=o(()=>L(n.value?.set?.["cropped-webp-1000x2000"]?.url,a.value)),v=o(()=>L(n.value?.set?.["webp-200x200"]?.url,a.value)),c=o(()=>L(n.value?.set?.["webp-2000x2000"]?.url,a.value));return T({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:v,highResolutionDesktopImage:c})}function V(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return De(a,e)}function Ne(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),a=o(()=>n.value!==void 0&&n.value.length>0),r=o(()=>n.value);return T({hasContent:a,value:r})}function j(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Ne(a,e)}function he(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function J(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return he(a,e)}function we(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return we(a,e)}function Me(e){return"enabled"in e}function Be(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(Me(i))return i;throw new Error(`Element ${t} is not toggle`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value?.enabled);return T({hasContent:a,value:r})}function Q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Be(a,e)}function Ue(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}var Z=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(Z||{});function Pe(e,t,n){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const a=e.settings[n];if(a===void 0)return a;switch(t){case"TEXTAREA":return q(n,e.settings);case"INPUTBOX":return j(n,e.settings);case"SELECTBOX":return J(n,e.settings);case"IMAGE":return V(n,e.settings);case"TOGGLE":return Q(n,e.settings);case"BUTTON":return F(n,e.settings);default:return}}function xe(e){const t=d(),n=o(()=>{const i=t.content.value[e];if(i!==void 0){if(Ue(i))return i;throw new Error(`Element ${e} is not of DECK type`)}}),a=o(()=>n.value!==void 0&&n.value.cards.length>0),r=o(()=>n.value?.cards);return T({hasContent:a,cards:r,getReactiveRef:Pe})}function ke(e){return"type"in e&&("text"in e||"image"in e)}function _(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function Ke(){const e=d(),t=o(()=>{const l=e.content.value.logo;if(l!==void 0){if(ke(l))return l;throw new Error("Element logo is not LOGO")}}),n=o(()=>t.value?.type),a=o(()=>t.value?.text),r=o(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=o(()=>({lowResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:_(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:_(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return T({type:n,text:a,image:i})}function $e(e){return e!==null&&"items"in e}function ee(e){const t=d(),n=o(()=>{const l=t.content.value[e];if(l!==void 0){if($e(l))return l;throw new Error(`Element ${e} is not an menu`)}}),a=o(()=>!!t.site?.value?.isPreviewMode),r=o(()=>n.value!==void 0),i=o(()=>n.value?.items?n.value.items.map(l=>({...l,performAction:Y(l,a.value)})):[]);return T({hasContent:r,items:i})}const ze="menu";function Xe(){return ee(ze)}function Ye(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function Fe(e){const t=d(),n=o(()=>t.content.value),a=W({content:n,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:Ye}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.products?.selectionType??"MANUAL"),l=o(()=>a.value?.products?.productIds??[]),v=o(()=>a.value?.product?.id),c=o(()=>a.value?.categoryId?parseInt(a.value.categoryId,10):void 0),s=o(()=>{if(l.value&&c.value&&i.value==="CATEGORY")return r?.value?.products.filter(I=>I?.defaultCategoryId===c.value)??[];if(typeof c.value=="number"&&c.value===0&&i.value==="CATEGORY")return r?.value?.products??[];const m=v.value?[v.value]:l.value??[];return r?.value?.products.filter(I=>m.includes(I.id))??[]}),u=o(()=>r?.value?.categories.filter(m=>m.id===c?.value)??[]),g=o(()=>a.value!==void 0),E=o(()=>s.value!==void 0&&s.value.length>0);return T({products:s,categories:u,categoryId:c,hasContent:g,hasProducts:E})}function We(){return globalThis.craneSharedTranslation??{}}function He(){const e=d(),t=o(()=>e.site?.value),n=o(()=>We()),a=o(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=a.value,v=i[l]?.[r];if(v!==void 0)return v;if(l!=="en"){const c=i.en?.[r];if(c!==void 0)return c}return r},currentLanguageCode:a}}function te(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);if(n!==void 0)return e.fontFamily?e.fontFamily[n].replaceAll("_"," "):void 0}function C(e,t,n){return t?te(e,t):te(e,n)}function ne(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function S(e,t,n){return t?ne(e,t):ne(e,n)}function oe(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function f(e,t,n){return t?oe(e,t):oe(e,n)}function Ve(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:f(e,t?.color,n?.color)}}function je(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:f(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:f(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:f(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),a=o(()=>n.value?.background);return T({background:a})}function Je(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:C(g,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.appearance),r=o(()=>n.value?.font),i=o(()=>n.value?.size),l=o(()=>n.value?.style),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return T({appearance:a,font:r,size:i,style:l,color:v,visible:c})}function qe(e){const t=d(),n=o(()=>{const i=t.design.value[e],l=t.defaults.value[e],v=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:f(v,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:f(v,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:f(v,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),a=o(()=>n.value?.overlay),r=o(()=>n.value?.visible);return T({overlay:a,visible:r})}function Qe(){const e=d(),t=o(()=>e.design.value.layout),n=o(()=>t.value);return T({layout:n})}function Ze(){const e=d();return o(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,a=e.globalDesign.value;return{font:C(a,t?.font,n?.font),size:S(a,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:f(a,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:Ve(a,t?.frame,n?.frame)}})}function et(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),a=o(()=>n.value?.value);return T({value:a})}function tt(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{font:C(g,s?.font,u?.font),size:S(g,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return T({font:a,size:r,bold:i,italic:l,color:v,visible:c})}function nt(e){const t=d(),n=o(()=>{const u=t.design.value[e],g=t.defaults.value[e],E=t.globalDesign.value;return{font:C(E,u?.font,g?.font),size:S(E,u?.size,g?.size),bold:u?.bold??g?.bold,italic:u?.italic??g?.italic,color:f(E,u?.color,g?.color),visible:u?.visible??g?.visible??!1,whiteSpace:"pre-wrap"}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible),s=o(()=>n.value?.whiteSpace);return T({font:a,size:r,bold:i,italic:l,color:v,visible:c,whiteSpace:s})}function ot(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),a=o(()=>n.value?.enabled);return T({enabled:a})}export{P as ActionLinkTypeEnum,w as BackgroundStyleEnum,D as ButtonAppearanceEnum,h as ButtonShapeEnum,N as ButtonSizeEnum,A as ButtonTypeEnum,ge as CatalogLayoutSlot,Te as CategoryLayoutSlot,U as ConfigTypeEnum,x as DesignEditorType,Z as EditorTypes,z as ImageSet,X as InstantsiteJsEvent,G as OverlayTypeEnum,B as PluginTypeEnum,Ee as ProductLayoutSlot,K as ReservedTemplatePageNameEnum,M as SectionTypeEnum,de as TemplateCategoriesList,k as TemplatePageEnum,$ as ValidationTypeEnum,ue as createVueClientApp,ce as createVueServerApp,je as useBackgroundElementDesign,F as useButtonElementContent,Je as useButtonElementDesign,Ae as useCategorySelectorElementContent,xe as useDeckElementContent,V as useImageElementContent,qe as useImageElementDesign,j as useInputboxElementContent,se as useInstantsiteJsApi,Qe as useLayoutElementDesign,Ke as useLogoElementContent,Ze as useLogoElementDesign,ee as useMenuElementContent,Xe as useNavigationMenuElementContent,Fe as useProductSelectorElementContent,J as useSelectboxElementContent,et as useSelectboxElementDesign,tt as useTextElementDesign,q as useTextareaElementContent,nt as useTextareaElementDesign,Q as useToggleElementContent,ot as useToggleElementDesign,He as useTranslation,d as useVueBaseProps};
|