@lightspeed/crane 0.0.1-beta.23 → 0.0.1-beta.24
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/dist/app.mjs +1 -1
- package/dist/cli.mjs +7 -5
- package/package.json +3 -1
- package/template/package.json +1 -1
- package/template/sections/block-example/assets/showcase_preview_1.png +0 -0
- package/template/sections/block-example/assets/showcase_preview_2.png +0 -0
- package/template/sections/block-example/settings/design.ts +9 -0
- package/template/sections/block-example/showcases/1.ts +88 -0
- package/template/sections/block-example/showcases/2.ts +88 -0
- package/template/sections/block-example/showcases/translations.ts +23 -0
- package/template/templates/template.ts +158 -0
- package/types.d.ts +9 -2
- package/template/templates/template.json +0 -159
package/dist/app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as k,ref as b,computed as o,reactive as d,createSSRApp as E}from"vue";import{renderToString as C}from"vue/server-renderer";const m=new Map;function c(){const n=(r,a,i,u,g)=>{m.set(r._uid,{context:b(a),content:b(i),design:b(u),defaults:b(g)})},t=(r,a,i)=>{const u=m.get(r._uid);u!==void 0&&(u.content.value=a,u.design.value=i)},e=k()?.appContext.app._uid??-1,l=m.get(e);return{init:n,update:t,context:l?.context,content:l?.content,design:l?.design,defaults:l?.defaults}}function x(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(typeof a=="string")return a;throw new Error(`Element ${n} is not inputbox`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value);return d({hasContent:l,value:r})}function h(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(typeof a=="string")return a;throw new Error(`Element ${n} is not textarea`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value);return d({hasContent:l,value:r})}function I(n){return"title"in n&&"type"in n}function $(n){const t=c(),e=o(()=>{const u=t.content.value[n];if(u!==void 0){if(I(u))return u;throw new Error(`Element ${n} is not action link`)}}),l=o(()=>e.value?.title),r=o(()=>e.value?.link),a=o(()=>!!l.value),i=o(()=>!!r.value);return d({title:l,link:r,hasTitle:a,hasLink:i,performAction:()=>{if(e.value!==void 0)switch(e.value.
|
|
1
|
+
import{getCurrentInstance as k,ref as b,computed as o,reactive as d,createSSRApp as E}from"vue";import{renderToString as C}from"vue/server-renderer";const m=new Map;function c(){const n=(r,a,i,u,g)=>{m.set(r._uid,{context:b(a),content:b(i),design:b(u),defaults:b(g)})},t=(r,a,i)=>{const u=m.get(r._uid);u!==void 0&&(u.content.value=a,u.design.value=i)},e=k()?.appContext.app._uid??-1,l=m.get(e);return{init:n,update:t,context:l?.context,content:l?.content,design:l?.design,defaults:l?.defaults}}function x(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(typeof a=="string")return a;throw new Error(`Element ${n} is not inputbox`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value);return d({hasContent:l,value:r})}function h(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(typeof a=="string")return a;throw new Error(`Element ${n} is not textarea`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value);return d({hasContent:l,value:r})}function I(n){return"title"in n&&"type"in n}function $(n){const t=c(),e=o(()=>{const u=t.content.value[n];if(u!==void 0){if(I(u))return u;throw new Error(`Element ${n} is not action link`)}}),l=o(()=>e.value?.title),r=o(()=>e.value?.link),a=o(()=>!!l.value),i=o(()=>!!r.value);return d({title:l,link:r,hasTitle:a,hasLink:i,performAction:()=>{if(e.value!==void 0)switch(e.value.buttonType){case"HYPER_LINK":e.value.link&&window.open(e.value.link,"_blank");break;case"GO_TO_STORE_LINK":window.open("/products");break;case"MAIL_LINK":e.value.email&&window.open(`mailto:${e.value.email}`,"_self");break;case"TEL_LINK":e.value.phone&&window.open(`tel:${e.value.phone}`,"_self");break;case"SCROLL_TO_TILE":{if(typeof document>"u")return;const u=e.value.tileId;document.getElementById(`tile-${u}`)?.scrollIntoView();break}default:throw new Error("Unknown ButtonType: ")}}})}function T(n){return"bucket"in n&&"borderInfo"in n&&"set"in n}function _(n){const t=c(),e=o(()=>{const s=t.content.value[n];if(s!==void 0){if(T(s))return s;throw new Error(`Element ${n} is not image`)}}),l=o(()=>e.value===void 0?"":t.context.value.imageBuckets?.[e.value?.bucket]),r=o(()=>e.value!==void 0),a=o(()=>`${l.value}/${e.value?.set?.["cropped-webp-100x200"]?.url}`),i=o(()=>`${l.value}/${e.value?.set?.["cropped-webp-1000x2000"]?.url}`),u=o(()=>`${l.value}/${e.value?.set?.["webp-200x200"]?.url}`),g=o(()=>`${l.value}/${e.value?.set?.["webp-2000x2000"]?.url}`);return d({hasContent:r,lowResolutionMobileImage:a,highResolutionMobileImage:i,lowResolutionDesktopImage:u,highResolutionDesktopImage:g})}function z(n){return"enabled"in n}function D(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(z(a))return a;throw new Error(`Element ${n} is not toggle`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value?.enabled);return d({hasContent:l,value:r})}function L(n){const t=c(),e=o(()=>{const a=t.content.value[n];if(a!==void 0){if(typeof a=="string")return a;throw new Error(`Element ${n} is not selectbox`)}}),l=o(()=>e.value!==void 0),r=o(()=>e.value);return d({hasContent:l,value:r})}function y(n,t){if(t===void 0)return;if(!t.startsWith("global."))return t;const e=t.split(".").at(2);if(e!==void 0)return n.fontFamily[e]}function S(n,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const e=t.split(".").at(2);if(e!==void 0)return n.textSize[e]}function f(n,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const e=t.split(".").at(2);if(e!==void 0)return n.color[e]}function R(n){const t=c(),e=o(()=>{const s=t.design.value[n],v=t.defaults.value[n],p=t.context.value.globalDesign;return{font:s?.font??y(p,v?.font),size:s?.size??S(p,v?.size),bold:s?.bold??v?.bold,italic:s?.italic??v?.italic,color:s?.color??f(p,v?.color),visible:s?.visible??v?.visible??!1}}),l=o(()=>e.value?.font),r=o(()=>e.value?.size),a=o(()=>e.value?.bold),i=o(()=>e.value?.italic),u=o(()=>e.value?.color),g=o(()=>e.value?.visible);return d({font:l,size:r,bold:a,italic:i,color:u,visible:g})}function B(n){const t=c(),e=o(()=>{const s=t.design.value[n],v=t.defaults.value[n],p=t.context.value.globalDesign;return{appearance:s?.appearance??v?.appearance,font:s?.font??y(p,v?.font),size:s?.size??v?.size,style:s?.style??v?.style,color:s?.color??f(p,v?.color),visible:s?.visible??v?.visible??!1}}),l=o(()=>e.value?.appearance),r=o(()=>e.value?.font),a=o(()=>e.value?.size),i=o(()=>e.value?.style),u=o(()=>e.value?.color),g=o(()=>e.value?.visible);return d({appearance:l,font:r,size:a,style:i,color:u,visible:g})}function A(n){const t=c(),e=o(()=>{const a=t.design.value[n],i=t.defaults.value[n],u=t.context.value.globalDesign;return{overlay:{type:a?.overlay?.type??i?.overlay?.type,solid:{color:a?.overlay?.solid?.color??f(u,i?.overlay?.solid?.color)},gradient:{fromColor:a?.overlay?.gradient?.fromColor??f(u,i?.overlay?.gradient?.fromColor),toColor:a?.overlay?.gradient?.toColor??f(u,i?.overlay?.gradient?.toColor)}},visible:a?.visible??i?.visible??!1}}),l=o(()=>e.value?.overlay),r=o(()=>e.value?.visible);return d({overlay:l,visible:r})}function O(n){const t=c(),e=o(()=>{const r=t.design.value[n],a=t.defaults.value[n];return{enabled:r?.enabled??a?.enabled}}),l=o(()=>e.value?.enabled);return d({enabled:l})}function G(n){const t=c(),e=o(()=>{const r=t.design.value[n],a=t.defaults.value[n];return{value:r?.value??a?.value}}),l=o(()=>e.value?.value);return d({value:l})}function K(n){const t=c(),e=o(()=>{const r=t.design.value[n],a=t.defaults.value[n],i=t.context.value.globalDesign;return{background:{type:r?.background?.type??a?.background?.type,solid:{color:r?.background?.solid?.color??f(i,a?.background?.solid?.color)},gradient:{fromColor:r?.background?.gradient?.fromColor??f(i,a?.background?.gradient?.fromColor),toColor:r?.background?.gradient?.toColor??f(i,a?.background?.gradient?.toColor)}}}}),l=o(()=>e.value?.background);return d({background:l})}function w(n){return{app:E(n)}}function M(n,t){return{init:()=>{const{app:e}=w(n);return t?.init?.(e),{render:async(l,r)=>(c().init(e,l,r.content,r.design,r.defaults),t?.render?.(e,l,r),{html:await C(e,{context:l}),state:{context:l,data:r}})}}}}function N(n,t){return{init:()=>{const{app:e}=w(n);return t?.init?.(e),{mount:(l,r)=>{c().init(e,r.context,r.data.content,r.data.design,r.data.defaults),t?.mount?.(e,l,r),e.mount(l)},update:l=>{c().update(e,l.data.content,l.data.design),t?.update?.(e,l)},unmount:()=>{t?.unmount?.(e),e.unmount()}}}}}export{N as createVueClientApp,M as createVueServerApp,K as useBackgroundElementDesign,$ as useButtonElementContent,B as useButtonElementDesign,_ as useImageElementContent,A as useImageElementDesign,x as useInputboxElementContent,L as useSelectboxElementContent,G as useSelectboxElementDesign,R as useTextElementDesign,h as useTextareaElementContent,D as useToggleElementContent,O as useToggleElementDesign,c as useVueBaseProps};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),f.info(`App ${t} created`)}catch(e){f.error(`Error while creating app: ${e.message}`)}}async function X(t){try{const e=t,n=process.cwd(),o=l.join(n,"sections",e);a.existsSync(o)||a.mkdirSync(o);const r=l.resolve(v(import.meta.url),"../..","template/sections/block-example");a.readdirSync(r).forEach(async s=>j(o,r,s)),f.info(`Block ${t} created`)}catch(e){f.error(`Error while creating block: ${e.message}`)}}async function J(t){try{const e=process.cwd(),n=l.join(e,"templates"),o={"template.json":`${t}.json`};a.existsSync(n)||a.mkdirSync(n);const r=l.resolve(v(import.meta.url),"../..","template/templates");a.readdirSync(r).forEach(async s=>j(n,r,s,o)),f.info(`Template descriptor file [${t}.json] has been created`)}catch(e){f.error(`Error while creating template descriptors: ${e.message}`)}}function T(){const t=process.env.npm_lifecycle_event;return B({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${t}.json"`}})}function W(t,e){return{plugins:[k(),$(),T(),G({vue:"EcVue"})],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/${t}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:i(process.cwd(),e),output:{validate:!0,entryFileNames:"js/[name].js",chunkFileNames:"js/[name].js",assetFileNames:"assets/[name].[ext]"}}}}}function H(t,e){return{plugins:[k(),$()],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},ssr:{noExternal:!0},build:{ssr:!0,outDir:`./dist/${t}`,emptyOutDir:!0,rollupOptions:{external:[...S,...S.map(n=>`node:${n}`)],preserveEntrySignatures:"strict",input:i(process.cwd(),e),output:{validate:!0,entryFileNames:"js/[name].js"}}}}}function O(t,e){return{plugins:[$(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/${t}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:i(process.cwd(),e),output:{validate:!0,entryFileNames:"js/settings/[name].mjs"}}}}}async function V(){const t=await d("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(t.map(async e=>{const n=U(e).split(F).pop()??"default",o=await d(`**/${n}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await d(`**/${n}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),s=await d(`**/${n}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await d(`**/${n}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:n,serverEntrypoint:e,clientEntrypoint:o.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:s.at(0),translationsEntrypoint:p.at(0)}}))}async function Z(){try{const t=await V();for(const e of t){const{name:n,serverEntrypoint:o,clientEntrypoint:r,contentSettingsEntrypoint:s,designSettingsEntrypoint:p,translationsEntrypoint:u}=e;await g({configFile:!1,...E(H(n,o))}),r!==void 0&&await g({configFile:!1,...E(W(n,r))}),s!==void 0&&await g({configFile:!1,...E(O(n,s))}),p!==void 0&&await g({configFile:!1,...E(O(n,p))}),u!==void 0&&await g({configFile:!1,...E(O(n,u))})}f.info("Build successful. For deploy run: npm run deploy")}catch(t){f.error(`Error while building: ${t.message}`)}}function R(t){if(t!==void 0)return t.startsWith("global.")?{type:"GLOBAL_FONT",font:t}:{type:"PRESET_FONT",font:t}}function y(t){if(t===void 0)return;if(t.startsWith("global."))return{type:"GLOBAL_COLOR",raw:t};const e=P(t);return{type:"STRUCTURED_COLOR",raw:t,hex:e.toHex8String(),hsl:e.toHsl(),rgba:e.toRgb(),auto:!1}}function q(t){if(t!==void 0)return typeof t=="string"&&t.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:t}:{type:"NUMERIC_TEXT_SIZE",size:t}}const Q={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Y(t){switch(t){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${t}. Right options: ${Object.keys(Q)}`)}}function tt(t){const e=t.style,n=t.color,o=Array.isArray(n)?n:[n,n];return t.background={type:Y(e),solid:{color:y(o.at(0))},gradient:{fromColor:y(o.at(0)),toColor:y(o.at(1))}},t.style=void 0,t.color=void 0,t}const et={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function nt(t){switch(t){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${t}. Right options: ${Object.keys(et)}`)}}const ot={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function rt(t){switch(t){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${t}. Right options: ${Object.keys(ot)}`)}}const st={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function it(t){switch(t){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${t}. Right options: ${Object.keys(st)}`)}}function at(t){const e=t.appearance;e!==void 0&&(t.appearance=nt(e));const n=t.size;n!==void 0&&(t.size=rt(n));const o=t.shape;o!==void 0&&(t.style=it(o),t.shape=void 0);const r=t.font;t.font=R(r);const s=t.color;return t.color=y(s),t}const ct={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function pt(t){switch(t){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${t}. Right options: ${Object.keys(ct)}`)}}function lt(t){const e=t.overlay,n=t.color,o=Array.isArray(n)?n:[n,n];return t.overlay={type:pt(e),solid:{color:y(o.at(0))},gradient:{fromColor:y(o.at(0)),toColor:y(o.at(1))}},t.color=void 0,t}function ut(t){const e=t.font;t.font=R(e);const n=t.color;t.color=y(n);const o=t.size;return t.size=q(o),t}function dt(t){Object.keys(t).forEach(e=>{const n=t[e],o=n.type;switch(o){case"TEXT":{n.defaults=ut(n.defaults);break}case"BUTTON":{n.defaults=at(n.defaults);break}case"IMAGE":{n.defaults=lt(n.defaults);break}case"BACKGROUND":{n.defaults=tt(n.defaults);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${o}`)}})}const ft="https://blockbuster.ecwid.com";async function mt(){const t=await C(i(c.cwd(),"crane.config.json")),e=JSON.parse(t.toString());return{appClientId:e.app_client_id,appSecretKey:btoa(e.app_secret_key)}}async function yt(){const t=await C(i(c.cwd(),"package.json")),e=JSON.parse(t.toString()),n=M(e.version,"patch");return e.version=n,x(i(c.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import Te from"cac";import p from"node:fs";import u from"node:path";import{fileURLToPath as C}from"node:url";import{red as we,yellow as Oe,green as je}from"kolorist";import{resolve as r,parse as G,dirname as ve,sep as Ce}from"path";import{rename as Le,unlink as De,existsSync as L,writeFileSync as Ne,createReadStream as O}from"fs";import{glob as l}from"glob";import{build as y,defineConfig as g}from"vite";import{builtinModules as _}from"module";import R from"@vitejs/plugin-vue";import b from"vite-tsconfig-paths";import Ae from"vite-plugin-checker";import{viteExternalsPlugin as Se}from"vite-plugin-externals";import Ie from"ajv/dist/2020.js";import ke from"ajv-formats";import{readFile as B}from"fs/promises";import Ge from"axios";import{inc as _e}from"semver";import*as c from"process";import Re from"tinycolor2";function P(e,t){p.statSync(e).isDirectory()?(p.mkdirSync(t,{recursive:!0}),p.readdirSync(e).forEach(o=>{const s=u.resolve(e,o),i=u.resolve(t,o);P(s,i)})):p.copyFileSync(e,t)}function D(e,t,o,s){const i=u.join(e,s?.[o]??o);P(u.join(t,o),i)}const m={error:e=>console.log(we(e)),warn:e=>console.log(Oe(e)),info:e=>console.log(je(e))};async function Be(e){try{const t=e,o=process.cwd(),s=u.join(o,t),i=["templates"],n={_gitignore:".gitignore"};p.existsSync(s)||p.mkdirSync(s);const a=u.resolve(C(import.meta.url),"../..","template");p.readdirSync(a).filter(f=>f!=="package.json").filter(f=>!i.includes(f)).forEach(async f=>D(s,a,f,n));const d=JSON.parse(p.readFileSync(u.join(a,"package.json"),"utf-8"));d.name=e;const E=u.join(s,"package.json");p.writeFileSync(E,`${JSON.stringify(d,null,2)}
|
|
2
|
+
`),m.info(`App ${e} created`)}catch(t){m.error(`Error while creating app: ${t.message}`)}}async function Pe(e){try{const t=e,o=process.cwd(),s=u.join(o,"sections",t);p.existsSync(s)||p.mkdirSync(s);const i=u.resolve(C(import.meta.url),"../..","template/sections/block-example");p.readdirSync(i).forEach(async n=>D(s,i,n)),m.info(`Block ${e} created`)}catch(t){m.error(`Error while creating block: ${t.message}`)}}async function Ue(e){try{const t=process.cwd(),o=u.join(t,"templates"),s={"template.ts":`${e}.ts`};p.existsSync(o)||p.mkdirSync(o);const i=u.resolve(C(import.meta.url),"../..","template/templates");p.readdirSync(i).forEach(async n=>D(o,i,n,s)),m.info(`Template descriptor file [${e}.ts] has been created`)}catch(t){m.error(`Error while creating template descriptors: ${t.message}`)}}function T(){const e=process.env.npm_lifecycle_event;return Ae({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})}function xe(e,t){return{plugins:[R(),b(),T(),Se({vue:"EcVue"})],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js",chunkFileNames:"js/[name].js",assetFileNames:"assets/[name].[ext]"}}}}}function Xe(e,t){return{plugins:[R(),b()],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},ssr:{noExternal:!0},build:{ssr:!0,outDir:`./dist/sections/${e}`,emptyOutDir:!0,rollupOptions:{external:[..._,..._.map(o=>`node:${o}`)],preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js"}}}}}function N(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/settings/[name].mjs"}}}}}function Fe(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:"./dist/template",emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),e),output:{validate:!0,entryFileNames:`js/[name]${t}.mjs`}}}}}function U(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/showcases/[name].mjs"}}}}}function qe(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,assetFileNames:"assets/[name].[ext]"}}}}}const x="https://json-schema.org/draft/2020-12/schema",X="https://lightspeedhq.com/template.schema.json",F="Custom Template",q="A custom template enclosing the necessary custom and default blocks",M="object",z={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},url:{type:"object",properties:{demo_website:{description:"URL to the demo website",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"},cover_image:{description:"URL to the cover image",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"}},required:["demo_website","cover_image"]}},required:["name","description","url"]},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},K=["metadata","sections"],Me={$schema:x,$id:X,title:F,description:q,type:M,properties:z,required:K},J={__proto__:null,$id:X,$schema:x,default:Me,description:q,properties:z,required:K,title:F,type:M},V="https://json-schema.org/draft/2020-12/schema",W="https://lightspeedhq.com/template-default.schema.json",H="Default Section",Z="Default section for a Custom Template",Q="object",Y={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"}},required:["type","id"],additionalProperties:!1}},ze={$schema:V,$id:W,title:H,description:Z,type:Q,$defs:Y},Ke={__proto__:null,$defs:Y,$id:W,$schema:V,default:ze,description:Z,title:H,type:Q},ee="https://json-schema.org/draft/2020-12/schema",te="https://lightspeedhq.com/template-custom.schema.json",oe="Custom Section",se="Custom section for a Custom Template",ie="object",ne={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string"},content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}}]}},minProperties:1}},required:["type","id"],additionalProperties:!1}},Je={$schema:ee,$id:te,title:oe,description:se,type:ie,$defs:ne},Ve={__proto__:null,$defs:ne,$id:te,$schema:ee,default:Je,description:se,title:oe,type:ie},re="https://json-schema.org/draft/2020-12/schema",ae="https://lightspeedhq.com/template-custom-content.schema.json",ce="Custom Section :: Content Configuration",pe="Content tab configuration of a Custom Section for a Custom Template",le="object",de={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"},options:{description:"Individual options of the content configuration element",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1}},required:["type","label","placeholder","options"],additionalProperties:!1}},We={$schema:re,$id:ae,title:ce,description:pe,type:le,$defs:de},He={__proto__:null,$defs:de,$id:ae,$schema:re,default:We,description:pe,title:ce,type:le},ue="https://json-schema.org/draft/2020-12/schema",fe="https://lightspeedhq.com/template-custom-design.schema.json",me="Custom Section :: Design Configuration",ye="Design tab configuration of a Custom Section for a Custom Template",ge="object",he={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the text",type:"string"},colors:{description:"Color options for the text",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},sizes:{description:"Size options for the text",type:"array",items:{type:"integer",minimum:0,exclusiveMaximum:50},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the text",type:"object",properties:{font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","bold","italic","color"],additionalProperties:!1}},required:["type","label","colors","sizes","defaults"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the button",type:"string"},colors:{description:"Color options for the button",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the button",type:"object",properties:{font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","appearance","shape","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the image",type:"string"},colors:{description:"Color options for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the image",type:"object",properties:{overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]},color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["overlay","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the toggle",type:"string"},description:{description:"Description of the toggle",type:"string"},defaults:{description:"Default values for the toggle",type:"object",properties:{enabled:{description:"Default enabled status for the toggle",type:"boolean"}},required:["enabled"],additionalProperties:!1}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the checkbox",type:"string"},placeholder:{description:"Placeholder of the checkbox",type:"string"},description:{description:"Description of the checkbox",type:"string"},options:{description:"Individual options of the checkbox",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1},defaults:{description:"Default values for the checkbox",type:"object",properties:{value:{description:"Default option for the checkbox",type:"string"}},required:["value"],additionalProperties:!1}},required:["type","label","placeholder","description","options","defaults"],additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the background",type:"string"},colors:{description:"Color options for the background",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the background",type:"object",properties:{style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]},color:{description:"Default color style for the background",type:"string"}},required:["style","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1}},Ze={$schema:ue,$id:fe,title:me,description:ye,type:ge,$defs:he},Qe={__proto__:null,$defs:he,$id:fe,$schema:ue,default:Ze,description:ye,title:me,type:ge},w="_temp";async function Ye(){const e=await l("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=ve(t).split(Ce).pop()??"default",s=await l(`**/${o}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await l(`**/${o}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),n=await l(`**/${o}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await l(`**/${o}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await l(`**/${o}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**","translations.{js,ts}"]}),E=await l(`**/${o}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await l(`**/${o}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:o,serverEntrypoint:t,clientEntrypoint:s.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:n.at(0),settingsTranslationsEntrypoint:a.at(0),showcasesEntrypoints:d,showcasesTranslationsEntrypoint:E.at(0),assetsEntrypoints:f}}))}async function et(){return{entryPoints:await l("**/templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]})}}async function A(e,t){try{return(await import(r(process.cwd(),t?`${e}${w}.mjs`:`${e}.mjs`))).default}catch{throw new Error(`File [${e}${w}.mjs] is either invalid or undefined`)}}async function tt(){let e=new Ie({allErrors:!0,schemas:[J,Ke,Ve,He,Qe]});return ke(e),e.compile(J)}async function ot(e,t,o,s){if(e(t)&&s===void 0)new Promise(i=>{Le(`${o}${w}.mjs`,`${o}.mjs`,function(n){n&&i(n)})});else throw new Promise(i=>{De(`${o}${w}.mjs`,function(n){n&&i(n)})}),new Error(`Invalid file [${G(o).name}].
|
|
3
|
+
Note: Errors regarding failingKeyword: "then" can sometimes be false negatives. Please focus on fixing other errors first!
|
|
4
|
+
Errors: ${JSON.stringify([...e.errors??[],...s??[]],null,2)}`)}async function st(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0&&o.id!=="header"&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a default `header`"}),s===e.sections.length-1&&o.id!=="footer"&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a default `footer`"}),o.type==="custom")if(!L(`dist/sections/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined"});else{if(o.content!==void 0)if(!L(`dist/sections/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const i=await A(`dist/sections/${o.id}/js/settings/content`,!1),n=new Set(Object.keys(i));Object.keys(o.content).every(a=>n.has(a))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor"})}if(o.design!==void 0)if(!L(`dist/sections/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const i=await A(`dist/sections/${o.id}/js/settings/design`,!1),n=new Set(Object.keys(i));Object.keys(o.design).every(a=>n.has(a))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor"})}}}return t.length===0?void 0:t}async function it(){try{const e=await Ye();for(const s of e){const{name:i,serverEntrypoint:n,clientEntrypoint:a,contentSettingsEntrypoint:d,designSettingsEntrypoint:E,settingsTranslationsEntrypoint:f,showcasesEntrypoints:S,showcaseTranslationsEntrypoint:I,assetsEntrypoints:k}=s;if(await y({configFile:!1,...g(Xe(i,n))}),a!==void 0&&await y({configFile:!1,...g(xe(i,a))}),d!==void 0&&await y({configFile:!1,...g(N(i,d))}),E!==void 0&&await y({configFile:!1,...g(N(i,E))}),f!==void 0&&await y({configFile:!1,...g(N(i,f))}),S!==void 0)for(const v of S)await y({configFile:!1,...g(U(i,v))});if(I!==void 0&&await y({configFile:!1,...g(U(i,I))}),k!==void 0)for(const v of k)await y({configFile:!1,...g(qe(i,v))})}const t=await tt(),o=await et();for(const s of o.entryPoints){await y({configFile:!1,...g(Fe(s,w))});const i=`dist/template/js/${G(s).name}`,n=await A(i,!0);await ot(t,n,i,await st(n))}m.info("Build successful. For deploy run: npm run deploy")}catch(e){m.error(`Error while building: ${e.message}`)}}function $e(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function h(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Re(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function nt(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:e}}const rt={COLOR:"COLOR",GRADIENT:"GRADIENT"};function at(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(rt)}`)}}function ct(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:at(t),solid:{color:h(s.at(0))},gradient:{fromColor:h(s.at(0)),toColor:h(s.at(1))}},e.style=void 0,e.color=void 0,e}const pt={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function lt(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(pt)}`)}}const dt={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function ut(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(dt)}`)}}const ft={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function mt(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(ft)}`)}}function yt(e){const t=e.appearance;t!==void 0&&(e.appearance=lt(t));const o=e.size;o!==void 0&&(e.size=ut(o));const s=e.shape;s!==void 0&&(e.style=mt(s),e.shape=void 0);const i=e.font;e.font=$e(i);const n=e.color;return e.color=h(n),e}const gt={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function ht(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(gt)}`)}}function $t(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:ht(t),solid:{color:h(s.at(0))},gradient:{fromColor:h(s.at(0)),toColor:h(s.at(1))}},e.color=void 0,e}function Et(e){const t=e.font;e.font=$e(t);const o=e.color;e.color=h(o);const s=e.size;return e.size=nt(s),e}function bt(e){const t=e.color;return e.color=h(t),e}function Tt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ee(s,o.defaults)})}function wt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ee(s,o)})}function Ee(e,t){switch(e){case"TEXT":{Et(t);break}case"BUTTON":{yt(t);break}case"IMAGE":{$t(t);break}case"BACKGROUND":{ct(t);break}case"COLOR_PICKER":{bt(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}const Ot="https://blockbuster.ecwid.com";async function jt(){const e=await B(r(c.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function vt(){const e=await B(r(c.cwd(),"package.json")),t=JSON.parse(e.toString()),o=_e(t.version,"patch");return t.version=o,Ne(r(c.cwd(),"package.json"),`${JSON.stringify(t,null,2)}
|
|
5
|
+
`),t.version}async function Ct(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/content.mjs`))).default;return j(o,t),o}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Lt(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/design.mjs`))).default;return Tt(o),j(o,t),o}catch(o){const s=o;throw new Error(`Design settings is invalid or undefined. Error ${s.stack}`)}}async function Dt(e,t){try{const o=await l("*.mjs",{cwd:r(c.cwd(),`dist/sections/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(o.map(async s=>{const i=(await import(r(c.cwd(),`dist/sections/${e}/js/showcases/${s}`))).default;return wt(i.design),j(i,t),i}))}catch(o){throw new Error(`Showcases is invalid or undefined. Error ${o}`)}}async function Nt(e){return await be(`dist/sections/${e}/js/settings/translations.mjs`)}async function At(e){return await be(`dist/sections/${e}/js/showcases/translations.mjs`)}async function be(e){const t=(await import(r(c.cwd(),e))).default;return It(t)}function j(e,t){if(e&&typeof e=="object"){const o=e;for(let s in o){const i=o[s];typeof i=="string"&&i.startsWith("$")&&(o[s]=St(t,i)),typeof i=="object"&&j(i,t)}}}function St(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function It(e){const t={};for(let o in e){const s=e[o];for(let i in s){const n=t[i],a=s[i];if(n===void 0){const d={};d[o]=a,t[i]=d}else n[o]=a}}return t}async function kt(){const e=await l("*/",{cwd:r(c.cwd(),"dist/sections/")});return Promise.all(e.map(async t=>{const o=await Nt(t),s=await At(t),i=await Ct(t,o),n=await Lt(t,o),a=await Dt(t,s);return{id:t,name:{en:t},contentEditors:i,designEditors:n,showcases:a}}))}async function Gt(e,t,o,s){const i=(await l("server.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`)})).at(0);i!==void 0&&await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/js/server.js`))},{params:{appClientId:t.appClientId,type:"server_js",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function _t(e,t,o,s){(await l("*.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`),ignore:"**/server.js"})).forEach(async i=>{await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/js/${i}`))},{params:{appClientId:t.appClientId,type:"client_js",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Rt(e,t,o,s){(await l("*",{cwd:r(c.cwd(),`dist/sections/${s}/assets/`)})).forEach(async i=>{await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/assets/${i}`))},{params:{appClientId:t.appClientId,type:"assets",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Bt(e,t,o){(await l("package.json")).at(0)!==void 0&&await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),"package.json"))},{params:{appClientId:t.appClientId,type:"dependencies",version:o},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function Pt(e,t,o,s){for(const i of s)await Gt(e,t,o,i.id),await _t(e,t,o,i.id),await Rt(e,t,o,i.id),await Bt(e,t,o)}async function Ut(e,t,o,s){await e.post("/api/v1/app/manifest",{version:o,name:"Custom Block App",blocks:s},{params:{appClientId:t.appClientId},headers:{Authorization:`Bearer ${t.appSecretKey}`}})}async function xt(e){try{const t=e??Ot,o=Ge.create({baseURL:t}),s=await jt(),i=await vt(),n=await kt();await Pt(o,s,i,n),await Ut(o,s,i,n);const a=n.map(d=>d.id);m.info(`Deploy to ${t} successful
|
|
6
|
+
Current app version: ${i}
|
|
7
|
+
Deployed blocks: ${a.join(", ")}`)}catch(t){m.error(`Error while deploying: ${t.message}`)}}const Xt="0.0.1-beta.24",$=Te("crane");function Ft(){$.command("create-app <appName>","Create app with custom blocks").action(Be),$.command("create-block <blockName>","Create custom block").action(Pe),$.command("create-template <templateName>","Create custom template descriptor").action(Ue),$.command("build","Build app with custom blocks").action(it),$.command("deploy","Deploy app with custom blocks").option("--url <url>","Custom deploy url").action(e=>xt(e.url)),$.help(),$.version(Xt),$.parse()}try{Ft()}catch{$.outputHelp(),process.exit(1)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed/crane",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "bin/crane.js",
|
|
6
6
|
"main": "./dist/app.mjs",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@lightspeed/eslint-config-crane": "0.0.1-beta.2",
|
|
38
38
|
"@vitejs/plugin-vue": "^4.1.0",
|
|
39
|
+
"ajv": "^8.12.0",
|
|
40
|
+
"ajv-formats": "^2.1.1",
|
|
39
41
|
"axios": "^1.4.0",
|
|
40
42
|
"cac": "^6.7.14",
|
|
41
43
|
"eslint": "~8.15.0",
|
package/template/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -82,4 +82,13 @@ export default {
|
|
|
82
82
|
color: 'global.color.background',
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
|
+
color: {
|
|
86
|
+
type: 'COLOR_PICKER',
|
|
87
|
+
label: '$label.colorpicker.label',
|
|
88
|
+
description: '$label.colorpicker.description',
|
|
89
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
90
|
+
defaults: {
|
|
91
|
+
color: 'global.color.background',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
85
94
|
} as const;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
showcaseId: '1',
|
|
3
|
+
previewImage: {
|
|
4
|
+
set: {
|
|
5
|
+
ORIGINAL: {
|
|
6
|
+
url: 'showcase_preview_1.png',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
blockName: '$label.showcase_1.blockName',
|
|
11
|
+
content: {
|
|
12
|
+
inputbox: {
|
|
13
|
+
type: 'INPUTBOX',
|
|
14
|
+
text: '$label.showcase_1.inputbox.text',
|
|
15
|
+
},
|
|
16
|
+
textarea: {
|
|
17
|
+
type: 'TEXTAREA',
|
|
18
|
+
text: '$label.showcase_1.textarea.text',
|
|
19
|
+
},
|
|
20
|
+
button: {
|
|
21
|
+
type: 'BUTTON',
|
|
22
|
+
title: '$label.showcase_1.button.title',
|
|
23
|
+
buttonType: 'MAIL_LINK',
|
|
24
|
+
email: 'from@showcase.one.com',
|
|
25
|
+
},
|
|
26
|
+
image: {
|
|
27
|
+
type: 'IMAGE',
|
|
28
|
+
imageData: {
|
|
29
|
+
set: {
|
|
30
|
+
ORIGINAL: {
|
|
31
|
+
url: 'showcase_preview_1.png',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
borderInfo: {},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
toggle: {
|
|
38
|
+
type: 'TOGGLE',
|
|
39
|
+
enabled: true,
|
|
40
|
+
},
|
|
41
|
+
selectbox: {
|
|
42
|
+
type: 'SELECTBOX',
|
|
43
|
+
value: 'one',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
design: {
|
|
47
|
+
inputbox: {
|
|
48
|
+
type: 'TEXT',
|
|
49
|
+
font: 'global.fontFamily.body',
|
|
50
|
+
size: 18,
|
|
51
|
+
bold: true,
|
|
52
|
+
italic: false,
|
|
53
|
+
color: '#333',
|
|
54
|
+
visible: false,
|
|
55
|
+
},
|
|
56
|
+
button: {
|
|
57
|
+
type: 'BUTTON',
|
|
58
|
+
font: 'global.fontFamily.body',
|
|
59
|
+
size: 'MEDIUM',
|
|
60
|
+
appearance: 'OUTLINE',
|
|
61
|
+
shape: 'PILL',
|
|
62
|
+
color: '#333',
|
|
63
|
+
visible: false,
|
|
64
|
+
},
|
|
65
|
+
background: {
|
|
66
|
+
type: 'BACKGROUND',
|
|
67
|
+
style: 'COLOR',
|
|
68
|
+
color: 'global.color.background',
|
|
69
|
+
},
|
|
70
|
+
image: {
|
|
71
|
+
type: 'IMAGE',
|
|
72
|
+
overlay: 'COLOR',
|
|
73
|
+
color: '#333',
|
|
74
|
+
},
|
|
75
|
+
toggle: {
|
|
76
|
+
type: 'TOGGLE',
|
|
77
|
+
enabled: true,
|
|
78
|
+
},
|
|
79
|
+
color: {
|
|
80
|
+
type: 'COLOR_PICKER',
|
|
81
|
+
color: 'global.color.background',
|
|
82
|
+
},
|
|
83
|
+
selectbox: {
|
|
84
|
+
type: 'SELECTBOX',
|
|
85
|
+
value: 'one',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
} as const;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
showcaseId: '2',
|
|
3
|
+
previewImage: {
|
|
4
|
+
set: {
|
|
5
|
+
ORIGINAL: {
|
|
6
|
+
url: 'showcase_preview_1.png',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
blockName: '$label.showcase_2.blockName',
|
|
11
|
+
content: {
|
|
12
|
+
inputbox: {
|
|
13
|
+
type: 'INPUTBOX',
|
|
14
|
+
text: '$label.showcase_2.inputbox.text',
|
|
15
|
+
},
|
|
16
|
+
textarea: {
|
|
17
|
+
type: 'TEXTAREA',
|
|
18
|
+
text: '$label.showcase_2.textarea.text',
|
|
19
|
+
},
|
|
20
|
+
button: {
|
|
21
|
+
type: 'BUTTON',
|
|
22
|
+
title: '$label.showcase_2.button.title',
|
|
23
|
+
buttonType: 'MAIL_LINK',
|
|
24
|
+
email: 'from@showcase.two.com',
|
|
25
|
+
},
|
|
26
|
+
image: {
|
|
27
|
+
type: 'IMAGE',
|
|
28
|
+
imageData: {
|
|
29
|
+
set: {
|
|
30
|
+
ORIGINAL: {
|
|
31
|
+
url: 'showcase_preview_2.png',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
borderInfo: {},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
toggle: {
|
|
38
|
+
type: 'TOGGLE',
|
|
39
|
+
enabled: false,
|
|
40
|
+
},
|
|
41
|
+
selectbox: {
|
|
42
|
+
type: 'SELECTBOX',
|
|
43
|
+
value: 'two',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
design: {
|
|
47
|
+
inputbox: {
|
|
48
|
+
type: 'TEXT',
|
|
49
|
+
font: 'global.fontFamily.body',
|
|
50
|
+
size: 18,
|
|
51
|
+
bold: true,
|
|
52
|
+
italic: false,
|
|
53
|
+
color: '#333',
|
|
54
|
+
visible: false,
|
|
55
|
+
},
|
|
56
|
+
button: {
|
|
57
|
+
type: 'BUTTON',
|
|
58
|
+
font: 'global.fontFamily.body',
|
|
59
|
+
size: 'MEDIUM',
|
|
60
|
+
appearance: 'OUTLINE',
|
|
61
|
+
shape: 'PILL',
|
|
62
|
+
color: '#333',
|
|
63
|
+
visible: false,
|
|
64
|
+
},
|
|
65
|
+
background: {
|
|
66
|
+
type: 'BACKGROUND',
|
|
67
|
+
style: 'COLOR',
|
|
68
|
+
color: 'global.color.background',
|
|
69
|
+
},
|
|
70
|
+
image: {
|
|
71
|
+
type: 'IMAGE',
|
|
72
|
+
overlay: 'COLOR',
|
|
73
|
+
color: '#333',
|
|
74
|
+
},
|
|
75
|
+
toggle: {
|
|
76
|
+
type: 'TOGGLE',
|
|
77
|
+
enabled: true,
|
|
78
|
+
},
|
|
79
|
+
color: {
|
|
80
|
+
type: 'COLOR_PICKER',
|
|
81
|
+
color: 'global.color.background',
|
|
82
|
+
},
|
|
83
|
+
selectbox: {
|
|
84
|
+
type: 'SELECTBOX',
|
|
85
|
+
value: 'one',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
} as const;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
en: {
|
|
3
|
+
'$label.showcase_1.blockName': 'Name of block 1',
|
|
4
|
+
'$label.showcase_1.inputbox.text': 'Input text 1',
|
|
5
|
+
'$label.showcase_1.textarea.text': 'Textarea 1',
|
|
6
|
+
'$label.showcase_1.button.title': 'Button 1',
|
|
7
|
+
'$label.showcase_2.blockName': 'Name of block 2',
|
|
8
|
+
'$label.showcase_2.inputbox.text': 'Input text 2',
|
|
9
|
+
'$label.showcase_2.textarea.text': 'Textarea 2',
|
|
10
|
+
'$label.showcase_2.button.title': 'Button 2',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
ru: {
|
|
14
|
+
'$label.showcase_1.blockName': 'Имя блока 1',
|
|
15
|
+
'$label.showcase_1.inputbox.text': 'Введите текст 1',
|
|
16
|
+
'$label.showcase_1.textarea.text': 'Многострочный текст 1',
|
|
17
|
+
'$label.showcase_1.button.title': 'Кнопка 1',
|
|
18
|
+
'$label.showcase_2.blockName': 'Имя блока 2',
|
|
19
|
+
'$label.showcase_2.inputbox.text': 'Введите текст 2',
|
|
20
|
+
'$label.showcase_2.textarea.text': 'Многострочный текст 2',
|
|
21
|
+
'$label.showcase_2.button.title': 'Кнопка 2',
|
|
22
|
+
},
|
|
23
|
+
} as const;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
metadata: {
|
|
3
|
+
name: 'Example Template :: Standard Preset',
|
|
4
|
+
description: 'Standard Preset for the Example template',
|
|
5
|
+
url: {
|
|
6
|
+
demo_website: 'https://www.example.com',
|
|
7
|
+
cover_image: 'https://www.example.com/cover.jpg'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
sections: [
|
|
11
|
+
{
|
|
12
|
+
type: 'default',
|
|
13
|
+
id: 'header'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'default',
|
|
17
|
+
id: 'slider_001'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'custom',
|
|
21
|
+
id: 'block-example'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'custom',
|
|
25
|
+
id: 'block-example',
|
|
26
|
+
content: {
|
|
27
|
+
inputbox: {
|
|
28
|
+
type: 'INPUTBOX',
|
|
29
|
+
label: '$label.example.label',
|
|
30
|
+
placeholder: '$label.example.placeholder'
|
|
31
|
+
},
|
|
32
|
+
textarea: {
|
|
33
|
+
type: 'TEXTAREA',
|
|
34
|
+
label: '$label.example.label',
|
|
35
|
+
placeholder: '$label.example.placeholder'
|
|
36
|
+
},
|
|
37
|
+
button: {
|
|
38
|
+
type: 'BUTTON',
|
|
39
|
+
label: '$label.example.label'
|
|
40
|
+
},
|
|
41
|
+
image: {
|
|
42
|
+
type: 'IMAGE',
|
|
43
|
+
label: '$label.example.label'
|
|
44
|
+
},
|
|
45
|
+
toggle: {
|
|
46
|
+
type: 'TOGGLE',
|
|
47
|
+
label: '$label.example.label',
|
|
48
|
+
description: '$label.example.description'
|
|
49
|
+
},
|
|
50
|
+
selectbox: {
|
|
51
|
+
type: 'SELECTBOX',
|
|
52
|
+
label: '$label.example.label',
|
|
53
|
+
placeholder: '$label.example.placeholder',
|
|
54
|
+
description: '$label.example.description',
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
value: 'one',
|
|
58
|
+
label: '$label.example.one.label'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: 'two',
|
|
62
|
+
label: '$label.example.two.label'
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
design: {
|
|
68
|
+
inputbox: {
|
|
69
|
+
type: 'TEXT',
|
|
70
|
+
label: '$label.example.label',
|
|
71
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
72
|
+
sizes: [12, 13, 14, 15, 16, 17, 18, 20],
|
|
73
|
+
defaults: {
|
|
74
|
+
font: 'global.fontFamily.body',
|
|
75
|
+
size: 18,
|
|
76
|
+
bold: true,
|
|
77
|
+
italic: false,
|
|
78
|
+
color: '#333'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
textarea: {
|
|
82
|
+
type: 'TEXT',
|
|
83
|
+
label: '$label.example.label',
|
|
84
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
85
|
+
sizes: [12, 13, 14, 15, 16, 17, 18, 20],
|
|
86
|
+
defaults: {
|
|
87
|
+
font: 'global.fontFamily.body',
|
|
88
|
+
size: 16,
|
|
89
|
+
bold: false,
|
|
90
|
+
italic: true,
|
|
91
|
+
color: '#333'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
button: {
|
|
95
|
+
type: 'BUTTON',
|
|
96
|
+
label: '$label.example.label',
|
|
97
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
98
|
+
defaults: {
|
|
99
|
+
font: 'global.fontFamily.body',
|
|
100
|
+
size: 'MEDIUM',
|
|
101
|
+
appearance: 'OUTLINE',
|
|
102
|
+
shape: 'PILL',
|
|
103
|
+
color: '#333'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
image: {
|
|
107
|
+
type: 'IMAGE',
|
|
108
|
+
label: '$label.example.label',
|
|
109
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
110
|
+
defaults: {
|
|
111
|
+
overlay: 'COLOR',
|
|
112
|
+
color: '#333'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
toggle: {
|
|
116
|
+
type: 'TOGGLE',
|
|
117
|
+
label: '$label.example.label',
|
|
118
|
+
description: '$label.example.description',
|
|
119
|
+
defaults: {
|
|
120
|
+
enabled: true
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
selectbox: {
|
|
124
|
+
type: 'SELECTBOX',
|
|
125
|
+
label: '$label.example.label',
|
|
126
|
+
placeholder: '$label.example.placeholder',
|
|
127
|
+
description: '$label.example.description',
|
|
128
|
+
options: [
|
|
129
|
+
{
|
|
130
|
+
value: 'one',
|
|
131
|
+
label: '$label.example.one.label'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
value: 'two',
|
|
135
|
+
label: '$label.example.two.label'
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
defaults: {
|
|
139
|
+
value: 'two'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
background: {
|
|
143
|
+
type: 'BACKGROUND',
|
|
144
|
+
label: '$label.example.label',
|
|
145
|
+
colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
|
|
146
|
+
defaults: {
|
|
147
|
+
style: 'COLOR',
|
|
148
|
+
color: 'global.color.background'
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'default',
|
|
155
|
+
id: 'footer'
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ type ButtonType =
|
|
|
16
16
|
|
|
17
17
|
interface ButtonContentData {
|
|
18
18
|
readonly title: string;
|
|
19
|
-
readonly
|
|
19
|
+
readonly buttonType: ButtonType;
|
|
20
20
|
readonly link?: string;
|
|
21
21
|
readonly email?: string;
|
|
22
22
|
readonly phone?: string;
|
|
@@ -235,6 +235,7 @@ type MapEditorDesignTypes = {
|
|
|
235
235
|
readonly TOGGLE: string;
|
|
236
236
|
readonly SELECTBOX: string;
|
|
237
237
|
readonly BACKGROUND: string;
|
|
238
|
+
readonly COLOR_PICKER: string;
|
|
238
239
|
};
|
|
239
240
|
|
|
240
241
|
interface TextDesignEditor {
|
|
@@ -273,13 +274,19 @@ interface BackgroundDesignEditor {
|
|
|
273
274
|
defaults: Record<string, unknown>;
|
|
274
275
|
}
|
|
275
276
|
|
|
277
|
+
interface ColorPickerDesignEditor {
|
|
278
|
+
readonly type: 'COLOR_PICKER';
|
|
279
|
+
defaults: Record<string, unknown>;
|
|
280
|
+
}
|
|
281
|
+
|
|
276
282
|
type DesignEditor =
|
|
277
283
|
TextDesignEditor
|
|
278
284
|
| ButtonDesignEditor
|
|
279
285
|
| ImageDesignEditor
|
|
280
286
|
| ToggleDesignEditor
|
|
281
287
|
| SelectboxDesignEditor
|
|
282
|
-
| BackgroundDesignEditor
|
|
288
|
+
| BackgroundDesignEditor
|
|
289
|
+
| ColorPickerDesignEditor;
|
|
283
290
|
|
|
284
291
|
type InferDesignType<T extends Record<string, DesignEditor>> = {
|
|
285
292
|
readonly [P in keyof T]: MapEditorDesignTypes[T[P]['type']]
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "template.schema.json",
|
|
3
|
-
"metadata": {
|
|
4
|
-
"name": "Example Template :: Standard Preset",
|
|
5
|
-
"description": "Standard Preset for the Example template",
|
|
6
|
-
"url": {
|
|
7
|
-
"demo_website": "https://www.example.com",
|
|
8
|
-
"cover_image": "https://www.example.com/cover.jpg"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"sections": [
|
|
12
|
-
{
|
|
13
|
-
"type": "default",
|
|
14
|
-
"id": "header"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "default",
|
|
18
|
-
"id": "slider_001"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"type": "custom",
|
|
22
|
-
"id": "example-block"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"type": "custom",
|
|
26
|
-
"id": "example-block",
|
|
27
|
-
"content": {
|
|
28
|
-
"inputbox": {
|
|
29
|
-
"type": "INPUTBOX",
|
|
30
|
-
"label": "$label.example.label",
|
|
31
|
-
"placeholder": "$label.example.placeholder"
|
|
32
|
-
},
|
|
33
|
-
"textarea": {
|
|
34
|
-
"type": "TEXTAREA",
|
|
35
|
-
"label": "$label.example.label",
|
|
36
|
-
"placeholder": "$label.example.placeholder"
|
|
37
|
-
},
|
|
38
|
-
"button": {
|
|
39
|
-
"type": "BUTTON",
|
|
40
|
-
"label": "$label.example.label"
|
|
41
|
-
},
|
|
42
|
-
"image": {
|
|
43
|
-
"type": "IMAGE",
|
|
44
|
-
"label": "$label.example.label"
|
|
45
|
-
},
|
|
46
|
-
"toggle": {
|
|
47
|
-
"type": "TOGGLE",
|
|
48
|
-
"label": "$label.example.label",
|
|
49
|
-
"description": "$label.example.description"
|
|
50
|
-
},
|
|
51
|
-
"selectBox": {
|
|
52
|
-
"type": "SELECTBOX",
|
|
53
|
-
"label": "$label.example.label",
|
|
54
|
-
"placeholder": "$label.example.placeholder",
|
|
55
|
-
"description": "$label.example.description",
|
|
56
|
-
"options": [
|
|
57
|
-
{
|
|
58
|
-
"value": "one",
|
|
59
|
-
"label": "$label.example.one.label"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"value": "two",
|
|
63
|
-
"label": "$label.example.two.label"
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"design": {
|
|
69
|
-
"inputbox": {
|
|
70
|
-
"type": "TEXT",
|
|
71
|
-
"label": "$label.example.label",
|
|
72
|
-
"colors": ["#FFFFFF66", "#0000004D", "#00000099", "#64C7FF66", "#F9947266", "#C794CD66", "#FFD17466"],
|
|
73
|
-
"sizes": [12, 13, 14, 15, 16, 17, 18, 20],
|
|
74
|
-
"defaults": {
|
|
75
|
-
"font": "global.fontFamily.body",
|
|
76
|
-
"size": 18,
|
|
77
|
-
"bold": true,
|
|
78
|
-
"italic": false,
|
|
79
|
-
"color": "#333"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"textarea": {
|
|
83
|
-
"type": "TEXT",
|
|
84
|
-
"label": "$label.example.label",
|
|
85
|
-
"colors": ["#FFFFFF66", "#0000004D", "#00000099", "#64C7FF66", "#F9947266", "#C794CD66", "#FFD17466"],
|
|
86
|
-
"sizes": [12, 13, 14, 15, 16, 17, 18, 20],
|
|
87
|
-
"defaults": {
|
|
88
|
-
"font": "global.fontFamily.body",
|
|
89
|
-
"size": 16,
|
|
90
|
-
"bold": false,
|
|
91
|
-
"italic": true,
|
|
92
|
-
"color": "#333"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"button": {
|
|
96
|
-
"type": "BUTTON",
|
|
97
|
-
"label": "$label.example.label",
|
|
98
|
-
"colors": ["#FFFFFF66", "#0000004D", "#00000099", "#64C7FF66", "#F9947266", "#C794CD66", "#FFD17466"],
|
|
99
|
-
"defaults": {
|
|
100
|
-
"font": "global.fontFamily.body",
|
|
101
|
-
"size": "MEDIUM",
|
|
102
|
-
"appearance": "OUTLINE",
|
|
103
|
-
"shape": "PILL",
|
|
104
|
-
"color": "#333"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"image": {
|
|
108
|
-
"type": "IMAGE",
|
|
109
|
-
"label": "$label.example.label",
|
|
110
|
-
"colors": ["#FFFFFF66", "#0000004D", "#00000099", "#64C7FF66", "#F9947266", "#C794CD66", "#FFD17466"],
|
|
111
|
-
"defaults": {
|
|
112
|
-
"overlay": "COLOR",
|
|
113
|
-
"color": "#333"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"toggle": {
|
|
117
|
-
"type": "TOGGLE",
|
|
118
|
-
"label": "$label.example.label",
|
|
119
|
-
"description": "$label.example.description",
|
|
120
|
-
"defaults": {
|
|
121
|
-
"enabled": true
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"selectbox": {
|
|
125
|
-
"type": "SELECTBOX",
|
|
126
|
-
"label": "$label.example.label",
|
|
127
|
-
"placeholder": "$label.example.placeholder",
|
|
128
|
-
"description": "$label.example.description",
|
|
129
|
-
"options": [
|
|
130
|
-
{
|
|
131
|
-
"value": "one",
|
|
132
|
-
"label": "$label.example.one.label"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"value": "two",
|
|
136
|
-
"label": "$label.example.two.label"
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
"defaults": {
|
|
140
|
-
"value": "two"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
"background": {
|
|
144
|
-
"type": "BACKGROUND",
|
|
145
|
-
"label": "$label.example.label",
|
|
146
|
-
"colors": ["#FFFFFF66", "#0000004D", "#00000099", "#64C7FF66", "#F9947266", "#C794CD66", "#FFD17466"],
|
|
147
|
-
"defaults": {
|
|
148
|
-
"style": "COLOR",
|
|
149
|
-
"color": "global.color.background"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"type": "default",
|
|
156
|
-
"id": "footer"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|