@lightspeed/crane 1.1.2 → 1.2.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/bin/crane.js +0 -1
- package/dist/app.d.mts +20 -2
- package/dist/app.d.ts +20 -2
- package/dist/app.mjs +1 -1
- package/dist/cli.mjs +10 -23
- package/package.json +10 -5
- package/template/footers/example-footer/ExampleFooter.vue +6 -1
- package/template/footers/example-footer/assets/cart.svg +19 -0
- package/template/footers/example-footer/component/LegalLinks.vue +2 -2
- package/template/footers/example-footer/component/MadeWith.vue +23 -0
- package/template/footers/example-footer/component/ReportAbuse.vue +4 -3
- package/template/footers/example-footer/showcases/1.ts +1 -1
- package/template/headers/example-header/ExampleHeader.vue +17 -2
- package/template/headers/example-header/component/Account.vue +4 -4
- package/template/headers/example-header/component/Cart.vue +14 -33
- package/template/headers/example-header/settings/content.ts +1 -9
- package/template/headers/example-header/settings/design.ts +1 -23
- package/template/package.json +1 -1
- package/template/reference/sections/about-us/AboutUs.vue +73 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers_preview.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team_preview.jpg +0 -0
- package/template/reference/sections/about-us/client.ts +6 -0
- package/template/reference/sections/about-us/component/Image.vue +94 -0
- package/template/reference/sections/about-us/component/Stats.vue +155 -0
- package/template/reference/sections/about-us/component/Title.vue +32 -0
- package/template/reference/sections/about-us/server.ts +6 -0
- package/template/reference/sections/about-us/settings/content.ts +64 -0
- package/template/reference/sections/about-us/settings/design.ts +74 -0
- package/template/reference/sections/about-us/settings/layout.ts +12 -0
- package/template/reference/sections/about-us/settings/translations.ts +151 -0
- package/template/reference/sections/about-us/showcases/1.ts +155 -0
- package/template/reference/sections/about-us/showcases/2.ts +143 -0
- package/template/reference/sections/about-us/showcases/translations.ts +259 -0
- package/template/reference/sections/about-us/type.ts +5 -0
- package/template/reference/sections/about-us/util/visibility-provider.ts +27 -0
- package/template/reference/sections/intro-slider/IntroSlider.vue +77 -0
- package/template/reference/sections/intro-slider/assets/bike_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_1_preview.png +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_2_preview.png +0 -0
- package/template/reference/sections/intro-slider/client.ts +5 -0
- package/template/reference/sections/intro-slider/component/Slider.vue +235 -0
- package/template/reference/sections/intro-slider/component/Title.vue +106 -0
- package/template/reference/sections/intro-slider/entity/color.ts +4 -0
- package/template/reference/sections/intro-slider/server.ts +5 -0
- package/template/reference/sections/intro-slider/settings/content.ts +43 -0
- package/template/reference/sections/intro-slider/settings/design.ts +88 -0
- package/template/reference/sections/intro-slider/settings/layout.ts +12 -0
- package/template/reference/sections/intro-slider/settings/translations.ts +53 -0
- package/template/reference/sections/intro-slider/showcases/1.ts +275 -0
- package/template/reference/sections/intro-slider/showcases/2.ts +271 -0
- package/template/reference/sections/intro-slider/showcases/translations.ts +88 -0
- package/template/reference/sections/intro-slider/type.ts +5 -0
- package/template/reference/sections/tag-lines/TagLines.vue +158 -0
- package/template/reference/sections/tag-lines/assets/explore_our_holiday_gift_guide.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/folding_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/hybrid_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/mountain_and_road_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/shop_chelsea_boots.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/sweater_weather.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/client.ts +5 -0
- package/template/reference/sections/tag-lines/component/HighlightedText.vue +50 -0
- package/template/reference/sections/tag-lines/component/SectionImage.vue +78 -0
- package/template/reference/sections/tag-lines/component/Title.vue +51 -0
- package/template/reference/sections/tag-lines/composables/highlighted-text-image-list.ts +34 -0
- package/template/reference/sections/tag-lines/server.ts +5 -0
- package/template/reference/sections/tag-lines/settings/content.ts +37 -0
- package/template/reference/sections/tag-lines/settings/design.ts +81 -0
- package/template/reference/sections/tag-lines/settings/layout.ts +12 -0
- package/template/reference/sections/tag-lines/settings/translations.ts +61 -0
- package/template/reference/sections/tag-lines/showcases/1.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/2.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/translations.ts +49 -0
- package/template/reference/sections/tag-lines/type.ts +5 -0
- package/template/reference/shared/components/Button.vue +151 -0
- package/template/reference/shared/components/SectionWrapper.vue +26 -0
- package/template/reference/shared/components/Tagline.vue +45 -0
- package/template/reference/shared/utils/color.ts +16 -0
- package/template/reference/shared/utils/styles.ts +12 -0
- package/template/reference/templates/assets/reference_template_apparel_cover_image.jpg +0 -0
- package/template/reference/templates/assets/reference_template_bike_cover_image.jpg +0 -0
- package/template/reference/templates/reference-template-apparel.ts +44 -0
- package/template/reference/templates/reference-template-bike.ts +44 -0
- package/template/sections/example-section/ExampleSection.vue +21 -24
- package/template/sections/example-section/assets/arrow.svg +3 -0
- package/template/sections/example-section/assets/bike_accessories_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_accessories_low.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_low.jpg +0 -0
- package/template/sections/example-section/assets/custom_section_showcase_3_preview.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_high.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_low.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_high.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_low.jpg +0 -0
- package/template/sections/example-section/component/button/Button.vue +87 -0
- package/template/sections/example-section/component/selectbox/Selectbox.vue +45 -0
- package/template/sections/example-section/component/toggle/Toggle.vue +110 -0
- package/template/sections/example-section/settings/content.ts +45 -0
- package/template/sections/example-section/settings/translations.ts +87 -7
- package/template/sections/example-section/showcases/1.ts +43 -0
- package/template/sections/example-section/showcases/2.ts +43 -0
- package/template/sections/example-section/showcases/3.ts +241 -0
- package/template/sections/example-section/showcases/translations.ts +205 -1
- package/template/shared/{LanguageSelector.vue → components/LanguageSelector.vue} +5 -5
- package/template/shared/components/SectionWrapper.vue +26 -0
- package/template/shared/utils.ts +28 -0
- package/template/templates/template.ts +2 -1
- package/types.d.ts +96 -70
package/bin/crane.js
CHANGED
package/dist/app.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ interface VueBaseProps<CONTENT, DESIGN> {
|
|
|
27
27
|
readonly content: Ref<CONTENT>;
|
|
28
28
|
readonly design: Ref<DESIGN>;
|
|
29
29
|
readonly defaults: Ref<Record<string, unknown>>;
|
|
30
|
-
readonly
|
|
30
|
+
readonly site: Ref<SiteContent>;
|
|
31
31
|
}
|
|
32
32
|
declare function useVueBaseProps<CONTENT, DESIGN>(): VueBaseProps<CONTENT, DESIGN>;
|
|
33
33
|
|
|
@@ -51,14 +51,26 @@ declare function useTextareaElementContent<CONTENT>(elementName: string, externa
|
|
|
51
51
|
|
|
52
52
|
interface ButtonContent {
|
|
53
53
|
title: string;
|
|
54
|
-
|
|
54
|
+
type: ActionLinkType;
|
|
55
|
+
link?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
phone?: string;
|
|
58
|
+
tileDivId?: string;
|
|
59
|
+
pageId?: string;
|
|
60
|
+
pageUrl?: string;
|
|
55
61
|
hasTitle: boolean;
|
|
56
62
|
hasLink: boolean;
|
|
57
63
|
performAction: () => void;
|
|
58
64
|
}
|
|
59
65
|
declare function useButtonElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>): {
|
|
60
66
|
title: string | undefined;
|
|
67
|
+
type: ActionLinkType | undefined;
|
|
61
68
|
link: string | undefined;
|
|
69
|
+
email: string | undefined;
|
|
70
|
+
phone: string | undefined;
|
|
71
|
+
tileDivId: string | null;
|
|
72
|
+
pageId: string | undefined;
|
|
73
|
+
pageUrl: string | undefined;
|
|
62
74
|
hasTitle: boolean;
|
|
63
75
|
hasLink: boolean;
|
|
64
76
|
performAction: (() => void) | undefined;
|
|
@@ -158,7 +170,13 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
158
170
|
value: string | undefined;
|
|
159
171
|
} | {
|
|
160
172
|
title: string | undefined;
|
|
173
|
+
type: ActionLinkType | undefined;
|
|
161
174
|
link: string | undefined;
|
|
175
|
+
email: string | undefined;
|
|
176
|
+
phone: string | undefined;
|
|
177
|
+
tileDivId: string | null;
|
|
178
|
+
pageId: string | undefined;
|
|
179
|
+
pageUrl: string | undefined;
|
|
162
180
|
hasTitle: boolean;
|
|
163
181
|
hasLink: boolean;
|
|
164
182
|
performAction: (() => void) | undefined;
|
package/dist/app.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface VueBaseProps<CONTENT, DESIGN> {
|
|
|
27
27
|
readonly content: Ref<CONTENT>;
|
|
28
28
|
readonly design: Ref<DESIGN>;
|
|
29
29
|
readonly defaults: Ref<Record<string, unknown>>;
|
|
30
|
-
readonly
|
|
30
|
+
readonly site: Ref<SiteContent>;
|
|
31
31
|
}
|
|
32
32
|
declare function useVueBaseProps<CONTENT, DESIGN>(): VueBaseProps<CONTENT, DESIGN>;
|
|
33
33
|
|
|
@@ -51,14 +51,26 @@ declare function useTextareaElementContent<CONTENT>(elementName: string, externa
|
|
|
51
51
|
|
|
52
52
|
interface ButtonContent {
|
|
53
53
|
title: string;
|
|
54
|
-
|
|
54
|
+
type: ActionLinkType;
|
|
55
|
+
link?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
phone?: string;
|
|
58
|
+
tileDivId?: string;
|
|
59
|
+
pageId?: string;
|
|
60
|
+
pageUrl?: string;
|
|
55
61
|
hasTitle: boolean;
|
|
56
62
|
hasLink: boolean;
|
|
57
63
|
performAction: () => void;
|
|
58
64
|
}
|
|
59
65
|
declare function useButtonElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>): {
|
|
60
66
|
title: string | undefined;
|
|
67
|
+
type: ActionLinkType | undefined;
|
|
61
68
|
link: string | undefined;
|
|
69
|
+
email: string | undefined;
|
|
70
|
+
phone: string | undefined;
|
|
71
|
+
tileDivId: string | null;
|
|
72
|
+
pageId: string | undefined;
|
|
73
|
+
pageUrl: string | undefined;
|
|
62
74
|
hasTitle: boolean;
|
|
63
75
|
hasLink: boolean;
|
|
64
76
|
performAction: (() => void) | undefined;
|
|
@@ -158,7 +170,13 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
158
170
|
value: string | undefined;
|
|
159
171
|
} | {
|
|
160
172
|
title: string | undefined;
|
|
173
|
+
type: ActionLinkType | undefined;
|
|
161
174
|
link: string | undefined;
|
|
175
|
+
email: string | undefined;
|
|
176
|
+
phone: string | undefined;
|
|
177
|
+
tileDivId: string | null;
|
|
178
|
+
pageId: string | undefined;
|
|
179
|
+
pageUrl: string | undefined;
|
|
162
180
|
hasTitle: boolean;
|
|
163
181
|
hasLink: boolean;
|
|
164
182
|
performAction: (() => void) | undefined;
|
package/dist/app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as z,ref as m,computed as r,reactive as d,createSSRApp as $}from"vue";import{renderToString as D}from"vue/server-renderer";const x=new Map;function s(){const e=(i,l,a,v,f,u)=>{x.set(i._uid,{context:m(l),content:m(a),design:m(v),defaults:m(f),externalContent:m(u)})},n=(i,l,a,v,f)=>{const u=x.get(i._uid);u!==void 0&&(u.content.value=l,u.design.value=a,u.defaults.value=v,u.externalContent.value=f)},t=z()?.appContext.app._uid??-1,o=x.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,externalContent:o?.externalContent}}function _(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return N(o,e)}function N(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not inputbox`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}function h(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return B(o,e)}function B(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not textarea`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}const b={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"};function M(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function K(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function P(e){if("pageUrl"in e)return e.pageUrl;switch(K(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const y=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:i,phone:l}=e,a=P(e);switch(t){case b.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case b.GO_TO_STORE:case b.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case b.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case b.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case b.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=M(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case b.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function U(e){return"title"in e&&"type"in e}function O(e,n){const t=s(),o=r(()=>!!t.externalContent?.value?.isPreviewMode),i=r(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return X(i,e,o.value)}function X(e,n,t){const o=r(()=>{const u=e.value[n];if(u!==void 0){if(U(u))return u;throw new Error(`Element ${n} is not action link`)}}),i=r(()=>o.value?.title),l=r(()=>o.value?.link),a=r(()=>!!i.value),v=r(()=>!!l.value),f=y(o.value,t);return d({title:i,link:l,hasTitle:a,hasLink:v,performAction:f})}function F(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function E(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function L(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return V(o,e)}function V(e,n){const t=r(()=>{const u=e.value[n];if(u!==void 0){if(F(u))return u;throw new Error(`Element ${n} is not image`)}}),o=r(()=>t.value===void 0?"":s().context.value.imageBuckets?.[t.value?.bucket]),i=r(()=>t.value!==void 0),l=r(()=>E(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=r(()=>E(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=r(()=>E(t.value?.set?.["webp-200x200"]?.url,o.value)),f=r(()=>E(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:i,lowResolutionMobileImage:l,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:f})}function H(e){return"enabled"in e}function k(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return W(o,e)}function W(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(H(l))return l;throw new Error(`Element ${n} is not toggle`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value?.enabled);return d({hasContent:o,value:i})}function R(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return Y(o,e)}function Y(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not selectbox`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}function j(e){return e!==null&&"items"in e}function A(e){const n=s(),t=r(()=>{const a=n.content.value[e];if(a!==void 0){if(j(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=r(()=>!!n.externalContent?.value?.isPreviewMode),i=r(()=>t.value!==void 0),l=r(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:y(a,o.value)})):[]);return d({hasContent:i,items:l})}const J="menu";function q(){return A(J)}var G=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(G||{});function Q(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function Z(e){const n=s(),t=r(()=>{const l=n.content.value[e];if(l!==void 0){if(Q(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),o=r(()=>t.value!==void 0&&t.value.cards.length>0),i=r(()=>t.value?.cards);return d({hasContent:o,cards:i,getReactiveRef:ee})}function ee(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return h(t,e.settings);case"INPUTBOX":return _(t,e.settings);case"SELECTBOX":return R(t,e.settings);case"IMAGE":return L(t,e.settings);case"TOGGLE":return k(t,e.settings);case"BUTTON":return O(t,e.settings);default:return}}function te(e){return"type"in e&&("text"in e||"image"in e)}function w(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function ne(){const e=s(),n=r(()=>{const a=e.content.value.logo;if(a!==void 0){if(te(a))return a;throw new Error("Element logo is not LOGO")}}),t=r(()=>n.value?.type),o=r(()=>n.value?.text),i=r(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),l=r(()=>({lowResolutionMobileImage:w(n.value?.image?.set?.["cropped-webp-100x200"]?.url,i.value),highResolutionMobileImage:w(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,i.value),lowResolutionDesktopImage:w(n.value?.image?.set?.["webp-200x200"]?.url,i.value),highResolutionDesktopImage:w(n.value?.image?.set?.["webp-2000x2000"]?.url,i.value)}));return d({type:t,text:o,image:l})}function T(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily[t]}function I(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize[t]}function p(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color[t]}function oe(e){const n=s(),t=r(()=>{const u=n.design.value[e],c=n.defaults.value[e],g=n.context.value.globalDesign;return{font:u?.font?.replaceAll("_"," ")??T(g,c?.font),size:u?.size??I(g,c?.size),bold:u?.bold??c?.bold,italic:u?.italic??c?.italic,color:u?.color??p(g,c?.color),visible:u?.visible??c?.visible??!1}}),o=r(()=>t.value?.font),i=r(()=>t.value?.size),l=r(()=>t.value?.bold),a=r(()=>t.value?.italic),v=r(()=>t.value?.color),f=r(()=>t.value?.visible);return d({font:o,size:i,bold:l,italic:a,color:v,visible:f})}function re(e){const n=s(),t=r(()=>{const c=n.design.value[e],g=n.defaults.value[e],C=n.context.value.globalDesign;return{font:c?.font?.replaceAll("_"," ")??T(C,g?.font),size:c?.size??I(C,g?.size),bold:c?.bold??g?.bold,italic:c?.italic??g?.italic,color:c?.color??p(C,g?.color),visible:c?.visible??g?.visible??!1,whiteSpace:"pre-wrap"}}),o=r(()=>t.value?.font),i=r(()=>t.value?.size),l=r(()=>t.value?.bold),a=r(()=>t.value?.italic),v=r(()=>t.value?.color),f=r(()=>t.value?.visible),u=r(()=>t.value?.whiteSpace);return d({font:o,size:i,bold:l,italic:a,color:v,visible:f,whiteSpace:u})}function ie(e){const n=s(),t=r(()=>{const u=n.design.value[e],c=n.defaults.value[e],g=n.context.value.globalDesign;return{appearance:u?.appearance??c?.appearance,font:u?.font??T(g,c?.font),size:u?.size??c?.size,style:u?.style??c?.style,color:u?.color??p(g,c?.color),visible:u?.visible??c?.visible??!1}}),o=r(()=>t.value?.appearance),i=r(()=>t.value?.font),l=r(()=>t.value?.size),a=r(()=>t.value?.style),v=r(()=>t.value?.color),f=r(()=>t.value?.visible);return d({appearance:o,font:i,size:l,style:a,color:v,visible:f})}function le(e){const n=s(),t=r(()=>{const l=n.design.value[e],a=n.defaults.value[e],v=n.context.value.globalDesign;return{overlay:{type:l?.overlay?.type??a?.overlay?.type,solid:{color:l?.overlay?.solid?.color??p(v,a?.overlay?.solid?.color)},gradient:{fromColor:l?.overlay?.gradient?.fromColor??p(v,a?.overlay?.gradient?.fromColor),toColor:l?.overlay?.gradient?.toColor??p(v,a?.overlay?.gradient?.toColor)}},visible:l?.visible??a?.visible??!1}}),o=r(()=>t.value?.overlay),i=r(()=>t.value?.visible);return d({overlay:o,visible:i})}function ae(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e];return{enabled:i?.enabled??l?.enabled}}),o=r(()=>t.value?.enabled);return d({enabled:o})}function ue(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e];return{value:i?.value??l?.value}}),o=r(()=>t.value?.value);return d({value:o})}function se(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e],a=n.context.value.globalDesign;return{background:{type:i?.background?.type??l?.background?.type,solid:{color:i?.background?.solid?.color??p(a,l?.background?.solid?.color)},gradient:{fromColor:i?.background?.gradient?.fromColor??p(a,l?.background?.gradient?.fromColor),toColor:i?.background?.gradient?.toColor??p(a,l?.background?.gradient?.toColor)}}}}),o=r(()=>t.value?.background);return d({background:o})}function ce(){const e=s(),n=r(()=>e.design.value.layout),t=r(()=>n.value);return d({layout:t})}function ve(e,n){return{visible:n?.visible??!1,width:n?.width??1,color:p(e,n?.color)}}function de(){const e=s();return r(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.context.value.globalDesign;return{font:n?.font?.replaceAll("_"," ")??T(o,t?.font),size:n?.size??I(o,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:n?.color??p(o,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:n?.frame??ve(o,t?.frame)}})}function S(e){return{app:$(e)}}function fe(e,n){return{init:()=>{const{app:t}=S(e);return n?.init?.(t),{render:async(o,i)=>(s().init(t,o,i.content,i.design,i.defaults,i.externalContent),n?.render?.(t,o,i),{html:await D(t,{context:o}),state:{context:o,data:i}})}}}}function ge(e,n){return{init:()=>{const{app:t}=S(e);return n?.init?.(t),{mount:(o,i)=>{s().init(t,i.context,i.data.content,i.data.design,i.data.defaults,i.data.externalContent),n?.mount?.(t,o,i),t.mount(o)},update:o=>{s().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function pe(){return globalThis.window.instantsite}export{G as EditorTypes,ge as createVueClientApp,fe as createVueServerApp,se as useBackgroundElementDesign,O as useButtonElementContent,ie as useButtonElementDesign,Z as useDeckElementContent,L as useImageElementContent,le as useImageElementDesign,_ as useInputboxElementContent,pe as useInstantsiteJsApi,ce as useLayoutElementDesign,ne as useLogoElementContent,de as useLogoElementDesign,A as useMenuElementContent,q as useNavigationMenuElementContent,R as useSelectboxElementContent,ue as useSelectboxElementDesign,oe as useTextElementDesign,h as useTextareaElementContent,re as useTextareaElementDesign,k as useToggleElementContent,ae as useToggleElementDesign,s as useVueBaseProps};
|
|
1
|
+
import{getCurrentInstance as N,ref as E,computed as i,reactive as d,createSSRApp as B}from"vue";import{renderToString as M}from"vue/server-renderer";const y=new Map;function s(){const e=(r,l,a,v,g,u)=>{y.set(r._uid,{context:E(l),content:E(a),design:E(v),defaults:E(g),site:E(u?.site??{})})},n=(r,l,a,v,g)=>{const u=y.get(r._uid);u!==void 0&&(u.content.value=l,u.design.value=a,u.defaults.value=v,u.site.value=g.site??{})},t=N()?.appContext.app._uid??-1,o=y.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site}}function O(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return K(o,e)}function K(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not inputbox`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}function C(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return P(o,e)}function P(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not textarea`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}const b={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"};function U(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function X(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function F(e){if("pageUrl"in e)return e.pageUrl;switch(X(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const x=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:r,phone:l}=e,a=F(e);switch(t){case b.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case b.GO_TO_STORE:case b.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case b.MAIL_LINK:if(r)return()=>window.open(`mailto:${r}`,"_self");break;case b.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case b.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=U(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case b.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function V(e){return"title"in e&&"type"in e}function H(e,n,t){const o=i(()=>{const _=e.value[n];if(_!==void 0){if(V(_))return _;throw new Error(`Element ${n} is not action link`)}}),r=i(()=>o.value?.title),l=i(()=>o.value?.type),a=i(()=>o.value?.link),v=i(()=>o.value?.email),g=i(()=>o.value?.phone),u=i(()=>o.value?.tileId?`tile-${o.value?.tileId}`:null),c=i(()=>o.value?.type==="GO_TO_STORE_LINK"?"products":o.value?.pageId),f=i(()=>o.value?.pageUrl),m=i(()=>!!r.value),$=i(()=>!!a.value),D=x(o.value,t);return d({title:r,type:l,link:a,email:v,phone:g,tileDivId:u,pageId:c,pageUrl:f,hasTitle:m,hasLink:$,performAction:D})}function L(e,n){const t=s(),o=i(()=>!!t.site?.value?.isPreviewMode),r=i(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return H(r,e,o.value)}function W(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function w(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function k(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return Y(o,e)}function Y(e,n){const t=i(()=>{const u=e.value[n];if(u!==void 0){if(W(u))return u;throw new Error(`Element ${n} is not image`)}}),o=i(()=>t.value===void 0?"":s().context.value.imageBuckets?.[t.value?.bucket]),r=i(()=>t.value!==void 0),l=i(()=>w(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=i(()=>w(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=i(()=>w(t.value?.set?.["webp-200x200"]?.url,o.value)),g=i(()=>w(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:r,lowResolutionMobileImage:l,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:g})}function j(e){return"enabled"in e}function R(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return J(o,e)}function J(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(j(l))return l;throw new Error(`Element ${n} is not toggle`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value?.enabled);return d({hasContent:o,value:r})}function A(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return q(o,e)}function q(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not selectbox`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}function Q(e){return e!==null&&"items"in e}function G(e){const n=s(),t=i(()=>{const a=n.content.value[e];if(a!==void 0){if(Q(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=i(()=>!!n.site?.value?.isPreviewMode),r=i(()=>t.value!==void 0),l=i(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:x(a,o.value)})):[]);return d({hasContent:r,items:l})}const Z="menu";function ee(){return G(Z)}var S=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(S||{});function te(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function ne(e){const n=s(),t=i(()=>{const l=n.content.value[e];if(l!==void 0){if(te(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),o=i(()=>t.value!==void 0&&t.value.cards.length>0),r=i(()=>t.value?.cards);return d({hasContent:o,cards:r,getReactiveRef:oe})}function oe(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return C(t,e.settings);case"INPUTBOX":return O(t,e.settings);case"SELECTBOX":return A(t,e.settings);case"IMAGE":return k(t,e.settings);case"TOGGLE":return R(t,e.settings);case"BUTTON":return L(t,e.settings);default:return}}function ie(e){return"type"in e&&("text"in e||"image"in e)}function T(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function re(){const e=s(),n=i(()=>{const a=e.content.value.logo;if(a!==void 0){if(ie(a))return a;throw new Error("Element logo is not LOGO")}}),t=i(()=>n.value?.type),o=i(()=>n.value?.text),r=i(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),l=i(()=>({lowResolutionMobileImage:T(n.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:T(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:T(n.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:T(n.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return d({type:t,text:o,image:l})}function I(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily[t]}function h(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize[t]}function p(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color[t]}function le(e){const n=s(),t=i(()=>{const u=n.design.value[e],c=n.defaults.value[e],f=n.context.value.globalDesign;return{font:u?.font?.replaceAll("_"," ")??I(f,c?.font),size:u?.size??h(f,c?.size),bold:u?.bold??c?.bold,italic:u?.italic??c?.italic,color:u?.color??p(f,c?.color),visible:u?.visible??c?.visible??!1}}),o=i(()=>t.value?.font),r=i(()=>t.value?.size),l=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({font:o,size:r,bold:l,italic:a,color:v,visible:g})}function ae(e){const n=s(),t=i(()=>{const c=n.design.value[e],f=n.defaults.value[e],m=n.context.value.globalDesign;return{font:c?.font?.replaceAll("_"," ")??I(m,f?.font),size:c?.size??h(m,f?.size),bold:c?.bold??f?.bold,italic:c?.italic??f?.italic,color:c?.color??p(m,f?.color),visible:c?.visible??f?.visible??!1,whiteSpace:"pre-wrap"}}),o=i(()=>t.value?.font),r=i(()=>t.value?.size),l=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible),u=i(()=>t.value?.whiteSpace);return d({font:o,size:r,bold:l,italic:a,color:v,visible:g,whiteSpace:u})}function ue(e){const n=s(),t=i(()=>{const u=n.design.value[e],c=n.defaults.value[e],f=n.context.value.globalDesign;return{appearance:u?.appearance??c?.appearance,font:u?.font??I(f,c?.font),size:u?.size??c?.size,style:u?.style??c?.style,color:u?.color??p(f,c?.color),visible:u?.visible??c?.visible??!1}}),o=i(()=>t.value?.appearance),r=i(()=>t.value?.font),l=i(()=>t.value?.size),a=i(()=>t.value?.style),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({appearance:o,font:r,size:l,style:a,color:v,visible:g})}function se(e){const n=s(),t=i(()=>{const l=n.design.value[e],a=n.defaults.value[e],v=n.context.value.globalDesign;return{overlay:{type:l?.overlay?.type??a?.overlay?.type,solid:{color:l?.overlay?.solid?.color??p(v,a?.overlay?.solid?.color)},gradient:{fromColor:l?.overlay?.gradient?.fromColor??p(v,a?.overlay?.gradient?.fromColor),toColor:l?.overlay?.gradient?.toColor??p(v,a?.overlay?.gradient?.toColor)}},visible:l?.visible??a?.visible??!1}}),o=i(()=>t.value?.overlay),r=i(()=>t.value?.visible);return d({overlay:o,visible:r})}function ce(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e];return{enabled:r?.enabled??l?.enabled}}),o=i(()=>t.value?.enabled);return d({enabled:o})}function ve(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e];return{value:r?.value??l?.value}}),o=i(()=>t.value?.value);return d({value:o})}function de(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e],a=n.context.value.globalDesign;return{background:{type:r?.background?.type??l?.background?.type,solid:{color:r?.background?.solid?.color??p(a,l?.background?.solid?.color)},gradient:{fromColor:r?.background?.gradient?.fromColor??p(a,l?.background?.gradient?.fromColor),toColor:r?.background?.gradient?.toColor??p(a,l?.background?.gradient?.toColor)}}}}),o=i(()=>t.value?.background);return d({background:o})}function fe(){const e=s(),n=i(()=>e.design.value.layout),t=i(()=>n.value);return d({layout:t})}function ge(e,n){return{visible:n?.visible??!1,width:n?.width??1,color:p(e,n?.color)}}function pe(){const e=s();return i(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.context.value.globalDesign;return{font:n?.font?.replaceAll("_"," ")??I(o,t?.font),size:n?.size??h(o,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:n?.color??p(o,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:n?.frame??ge(o,t?.frame)}})}function z(e){return{app:B(e)}}function be(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{render:async(o,r)=>(s().init(t,o,r.content,r.design,r.defaults,r.externalContent),n?.render?.(t,o,r),{html:await M(t,{context:o}),state:{context:o,data:r}})}}}}function me(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{mount:(o,r)=>{s().init(t,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent),n?.mount?.(t,o,r),t.mount(o)},update:o=>{s().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function Ee(){return globalThis.window.instantsite}export{S as EditorTypes,me as createVueClientApp,be as createVueServerApp,de as useBackgroundElementDesign,L as useButtonElementContent,ue as useButtonElementDesign,ne as useDeckElementContent,k as useImageElementContent,se as useImageElementDesign,O as useInputboxElementContent,Ee as useInstantsiteJsApi,fe as useLayoutElementDesign,re as useLogoElementContent,pe as useLogoElementDesign,G as useMenuElementContent,ee as useNavigationMenuElementContent,A as useSelectboxElementContent,ve as useSelectboxElementDesign,le as useTextElementDesign,C as useTextareaElementContent,ae as useTextareaElementDesign,R as useToggleElementContent,ce as useToggleElementDesign,s as useVueBaseProps};
|