@bluepic/embed 0.1.66 → 0.1.67
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/lib/bluepic-embed.es.js +23 -4
- package/lib/bluepic-embed.umd.js +14 -3
- package/package.json +1 -1
package/lib/bluepic-embed.es.js
CHANGED
|
@@ -100054,9 +100054,20 @@ class BluepicEmbed extends EventTarget {
|
|
|
100054
100054
|
#${c} .fade-spinner-leave-to {
|
|
100055
100055
|
opacity: 0;
|
|
100056
100056
|
}
|
|
100057
|
+
#${c} {
|
|
100058
|
+
> div {
|
|
100059
|
+
border: 1px solid var(--bluepic-app-border-color);
|
|
100060
|
+
overflow: hidden;
|
|
100061
|
+
border-radius: var(--bluepic-app-border-radius);
|
|
100062
|
+
margin: 30px auto;
|
|
100063
|
+
box-sizing: border-box;
|
|
100064
|
+
max-width: calc(100vw - 40px);
|
|
100065
|
+
max-height: calc(100vh - 40px);
|
|
100066
|
+
}
|
|
100067
|
+
}
|
|
100057
100068
|
`, document.head.appendChild(ie), this.element.innerHTML = `
|
|
100058
|
-
<div id="${c}" class="bluepic-app-wrapper" style="
|
|
100059
|
-
<div v-if="templateId" style="height: 100
|
|
100069
|
+
<div id="${c}" class="bluepic-app-wrapper" style="position: relative;" :style="">
|
|
100070
|
+
<div v-if="templateId" :style="{ height: embedProject?.config.layout === 'stack' ? 'auto' : 'calc(100% - 40px)', '--bluepic-app-border-color': borderColor, '--bluepic-app-border-radius': borderRadius }">
|
|
100060
100071
|
<bluepic-embedded-editor
|
|
100061
100072
|
v-if="templateId"
|
|
100062
100073
|
ref="editorRef"
|
|
@@ -100123,9 +100134,10 @@ class BluepicEmbed extends EventTarget {
|
|
|
100123
100134
|
const Ze = Color(Me?.config.backgroundColor).isDark();
|
|
100124
100135
|
we.bxThemeStyleVars = useTheme(`#${c}`, Ze), we.bxThemeStyleVars.value["editor-view-background-color"] = Me?.config.backgroundColor;
|
|
100125
100136
|
}
|
|
100126
|
-
}), {
|
|
100137
|
+
}), console.log(we.embedProject.value?.config.layout === "stack"), {
|
|
100127
100138
|
bridge: $e,
|
|
100128
100139
|
editorRef: we.editorRef,
|
|
100140
|
+
embedProject: we.embedProject,
|
|
100129
100141
|
allowPanAndZoom: we.allowPanAndZoom,
|
|
100130
100142
|
templateId: we.templateId,
|
|
100131
100143
|
studioResourcesBaseUrl: we.studioResourcesBaseUrl,
|
|
@@ -100135,7 +100147,14 @@ class BluepicEmbed extends EventTarget {
|
|
|
100135
100147
|
ready: we.ready,
|
|
100136
100148
|
displayMode: we.displayMode,
|
|
100137
100149
|
bxCoreVersion: we.bxCoreVersion,
|
|
100138
|
-
publishedSlug: we.publishedSlug
|
|
100150
|
+
publishedSlug: we.publishedSlug,
|
|
100151
|
+
bxThemeStyleVars: we.bxThemeStyleVars,
|
|
100152
|
+
darkmode: computed(() => Color(we.bxThemeStyleVars.value["editor-view-background-color"]).isDark()),
|
|
100153
|
+
borderRadius: computed(() => (we.embedProject.value?.config.layout === "stack", "10px")),
|
|
100154
|
+
borderColor: computed(() => {
|
|
100155
|
+
const Me = Color(we.bxThemeStyleVars.value["editor-view-background-color"]);
|
|
100156
|
+
return Me.isDark() ? Me.lighten(0.8).hex() : Me.darken(0.1).hex();
|
|
100157
|
+
})
|
|
100139
100158
|
};
|
|
100140
100159
|
}
|
|
100141
100160
|
}).mount(`#${c}`);
|
package/lib/bluepic-embed.umd.js
CHANGED
|
@@ -2941,9 +2941,20 @@ list should be an Array.`),ri.length===0)return new Nr(0);if(ri.length===1)retur
|
|
|
2941
2941
|
#${c} .fade-spinner-leave-to {
|
|
2942
2942
|
opacity: 0;
|
|
2943
2943
|
}
|
|
2944
|
+
#${c} {
|
|
2945
|
+
> div {
|
|
2946
|
+
border: 1px solid var(--bluepic-app-border-color);
|
|
2947
|
+
overflow: hidden;
|
|
2948
|
+
border-radius: var(--bluepic-app-border-radius);
|
|
2949
|
+
margin: 30px auto;
|
|
2950
|
+
box-sizing: border-box;
|
|
2951
|
+
max-width: calc(100vw - 40px);
|
|
2952
|
+
max-height: calc(100vh - 40px);
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2944
2955
|
`,document.head.appendChild(ie),this.element.innerHTML=`
|
|
2945
|
-
<div id="${c}" class="bluepic-app-wrapper" style="
|
|
2946
|
-
<div v-if="templateId" style="height: 100
|
|
2956
|
+
<div id="${c}" class="bluepic-app-wrapper" style="position: relative;" :style="">
|
|
2957
|
+
<div v-if="templateId" :style="{ height: embedProject?.config.layout === 'stack' ? 'auto' : 'calc(100% - 40px)', '--bluepic-app-border-color': borderColor, '--bluepic-app-border-radius': borderRadius }">
|
|
2947
2958
|
<bluepic-embedded-editor
|
|
2948
2959
|
v-if="templateId"
|
|
2949
2960
|
ref="editorRef"
|
|
@@ -2971,4 +2982,4 @@ list should be an Array.`),ri.length===0)return new Nr(0);if(ri.length===1)retur
|
|
|
2971
2982
|
</transition>
|
|
2972
2983
|
|
|
2973
2984
|
</div>
|
|
2974
|
-
`;const we=this;vue.nextTick(()=>{vue.createApp({components:{BluepicEmbeddedEditor,BluepicSpinner},setup(){const Pe={async handleUpload({blob:Me,context:Ze,width:ne,height:rr,name:pr,onProgress:or}){const{variants:_r,filename:kr,id:Ir}=await uploadImage("https://embed-api-v2.bluepic.workers.dev",we.templateId.value,Ze,Me,pr,($r,Nr)=>{or($r/Nr)}),Lr=_r.find($r=>parseCloudflareImagesDeliveryUrl($r).variant==="public");if(!Lr)throw new Error("No public variant");return{width:ne,height:rr,key:Ir,name:kr,src:Lr}}};return vue.watch(we.embedProject,Me=>{if(Me?.config.customStyle)we.bxThemeStyleVars=useTheme(`#${c}`),we.bxThemeStyleVars.value=Me?.config.customStyle;else{const Ze=Color(Me?.config.backgroundColor).isDark();we.bxThemeStyleVars=useTheme(`#${c}`,Ze),we.bxThemeStyleVars.value["editor-view-background-color"]=Me?.config.backgroundColor}}),{bridge:Pe,editorRef:we.editorRef,allowPanAndZoom:we.allowPanAndZoom,templateId:we.templateId,studioResourcesBaseUrl:we.studioResourcesBaseUrl,cloudflarePagesHostname:we.cloudflarePagesHostname,data:we.data,serial:we.serial,ready:we.ready,displayMode:we.displayMode,bxCoreVersion:we.bxCoreVersion,publishedSlug:we.publishedSlug}}}).mount(`#${c}`)})}setVariable(c,ie){this.data.value||(this.data.value={}),this.data.value[c]=ie}setData(c,ie=!1){if(ie)this.data.value=c;else{this.data.value||(this.data.value={});for(const we in c)this.setVariable(we,c[we])}}}async function getProjectWithRetries(m,c,ie,we,Pe){let Me=0;for(;Me<ie;){try{console.log(`\u{1F504} Versuch ${Me+1}/${ie}: Hole Public Config...`);const Ze=await fetch(`https://embed-api-v2.bluepic.workers.dev/api/public/project?${new URLSearchParams({hostname:m,slug:c,env:Pe})}`,{method:"GET"});return console.log(`\u2705 Erfolgreich nach ${Me+1} Versuchen`),await Ze.json()}catch(Ze){if(console.error(`\u274C Fehler bei Versuch ${Me+1}:`,Ze),Me<ie-1)console.log(`\u23F3 Warte ${we}ms vor erneutem Versuch...`),await new Promise(ne=>setTimeout(ne,we));else throw console.error(`\u{1F6A8} Maximalanzahl von ${ie} Versuchen erreicht. Abbruch.`),Ze}Me++}throw new Error("Unbekannter Fehler in getPublicConfigWithRetries")}window.addEventListener("load",async()=>{const m=document.querySelectorAll(".bluepic-embed");console.log("Auto-BluepicEmbed elements",m);for(const c of m){const ie=c.getAttribute("data-embed-project-id"),we=c.getAttribute("data-template-id");c.getAttribute("data-stripe-env");const Pe=c.getAttribute("data-init-data"),Me=c.getAttribute("data-studio-resources-base-url")??void 0,Ze=c.getAttribute("data-cloudflare-pages-hostname")??void 0,ne=c.getAttribute("data-display-mode"),rr=c.getAttribute("data-allow-pan-and-zoom"),pr=c.getAttribute("data-bx-core-version")??void 0,or=c.getAttribute("data-published-slug")??void 0,_r=Pe?JSON.parse(Pe):void 0,kr=rr==="true",Ir=ne==="mobile"?"mobile":ne==="stack"?"stack":"auto",Lr=c.getAttribute("data-branding")==="false",$r=new BluepicEmbed(c,we,ie,{initData:_r,displayMode:Ir,allowPanAndZoom:kr,studioResourcesBaseUrl:Me,cloudflarePagesHostname:Ze,bxCoreVersion:pr,publishedSlug:or,branding:Lr});console.log("!",c,$r)}});const GLOBAL_APP_WRAPPER_CLASS="bluepic-app-wrapper",GLOBAL_APP_WRAPPER_SELECTOR=`.${GLOBAL_APP_WRAPPER_CLASS}`;window.bluepicPopupProvider=new BluepicPopupProvider,exports.AdjustImage=AdjustImage,exports.BluepicBatchEditor=BluepicBatchEditor,exports.BluepicEmbed=BluepicEmbed,exports.BluepicEmbedded=BluepicEmbedded,exports.BluepicEmbeddedEditor=BluepicEmbeddedEditor,exports.BluepicFieldComponents=BluepciFieldComponents,exports.BluepicSpinner=BluepicSpinner,exports.BxAvatar=BxAvatar,exports.BxButton=BxButton,exports.BxCard=BxCard,exports.BxCheckbox=BxCheckbox,exports.BxColorPicker=BxColorPicker,exports.BxDropdown=BxDropdown,exports.BxEmbedThemeDarkmode=BxEmbedThemeDarkmode,exports.BxEmbedThemeLightmode=BxEmbedThemeLightmode,exports.BxFields=_sfc_main$p,exports.BxIcon=BxIcon,exports.BxInput=BxInput,exports.BxList=BxList,exports.BxListItem=BxListItem,exports.BxMenu=BxMenu,exports.BxPopover=BxPopover,exports.BxPopup=_sfc_main$17,exports.BxRadio=BxRadio,exports.BxRadioGroup=BxRadioGroup,exports.BxSelect=BxSelect,exports.BxSlider=BxSlider,exports.BxSpin=BxSpin,exports.BxSwitch=BxSwitch,exports.BxTab=BxTab,exports.BxTabs=BxTabs,exports.BxTag=BxTag,exports.BxTooltip=BxTooltip,exports.BxUserMenu=BxUserMenu,exports.GLOBAL_APP_WRAPPER_CLASS=GLOBAL_APP_WRAPPER_CLASS,exports.GLOBAL_APP_WRAPPER_SELECTOR=GLOBAL_APP_WRAPPER_SELECTOR,exports.MapboxMap=MapboxMap,exports.SlidesNavigation=SlidesNavigation,exports.applyColorMatricesToImage=applyColorMatricesToImage,exports.applyColorMatrix=applyColorMatrix,exports.applyColorMatrixToColor=applyColorMatrixToColor,exports.convertDeprecatedField=convertDeprecatedField,exports.createMessage=createMessage,exports.createPopup=createPopup,exports.cropImage=cropImage,exports.cropToVisibleBBox=cropToVisibleBBox,exports.getDefaultValueForFieldModel=getDefaultValueForFieldModel,exports.getTemplateLiveUrl=getTemplateLiveUrl,exports.getTemplateSerialUrl=getTemplateSerialUrl,exports.getThemeStyle=getThemeStyle,exports.getVisibleBBox=getVisibleBBox,exports.groupFeatureByLinebreaks=groupFeatureByLinebreaks$1,exports.normalizeAdjust=normalizeAdjust,exports.normalizeCrop=normalizeCrop,exports.rasterize=rasterize,exports.realizeField=realizeField,exports.renderFieldIcon=renderFieldIcon,exports.renderSVG=renderSVG,exports.stringifyField=stringifyField,exports.ungroupFeaturesDividedByLinebreaks=ungroupFeaturesDividedByLinebreaks,exports.useTheme=useTheme,exports.waitUntil=waitUntil,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2985
|
+
`;const we=this;vue.nextTick(()=>{vue.createApp({components:{BluepicEmbeddedEditor,BluepicSpinner},setup(){const Pe={async handleUpload({blob:Me,context:Ze,width:ne,height:rr,name:pr,onProgress:or}){const{variants:_r,filename:kr,id:Ir}=await uploadImage("https://embed-api-v2.bluepic.workers.dev",we.templateId.value,Ze,Me,pr,($r,Nr)=>{or($r/Nr)}),Lr=_r.find($r=>parseCloudflareImagesDeliveryUrl($r).variant==="public");if(!Lr)throw new Error("No public variant");return{width:ne,height:rr,key:Ir,name:kr,src:Lr}}};return vue.watch(we.embedProject,Me=>{if(Me?.config.customStyle)we.bxThemeStyleVars=useTheme(`#${c}`),we.bxThemeStyleVars.value=Me?.config.customStyle;else{const Ze=Color(Me?.config.backgroundColor).isDark();we.bxThemeStyleVars=useTheme(`#${c}`,Ze),we.bxThemeStyleVars.value["editor-view-background-color"]=Me?.config.backgroundColor}}),console.log(we.embedProject.value?.config.layout==="stack"),{bridge:Pe,editorRef:we.editorRef,embedProject:we.embedProject,allowPanAndZoom:we.allowPanAndZoom,templateId:we.templateId,studioResourcesBaseUrl:we.studioResourcesBaseUrl,cloudflarePagesHostname:we.cloudflarePagesHostname,data:we.data,serial:we.serial,ready:we.ready,displayMode:we.displayMode,bxCoreVersion:we.bxCoreVersion,publishedSlug:we.publishedSlug,bxThemeStyleVars:we.bxThemeStyleVars,darkmode:vue.computed(()=>Color(we.bxThemeStyleVars.value["editor-view-background-color"]).isDark()),borderRadius:vue.computed(()=>(we.embedProject.value?.config.layout==="stack","10px")),borderColor:vue.computed(()=>{const Me=Color(we.bxThemeStyleVars.value["editor-view-background-color"]);return Me.isDark()?Me.lighten(.8).hex():Me.darken(.1).hex()})}}}).mount(`#${c}`)})}setVariable(c,ie){this.data.value||(this.data.value={}),this.data.value[c]=ie}setData(c,ie=!1){if(ie)this.data.value=c;else{this.data.value||(this.data.value={});for(const we in c)this.setVariable(we,c[we])}}}async function getProjectWithRetries(m,c,ie,we,Pe){let Me=0;for(;Me<ie;){try{console.log(`\u{1F504} Versuch ${Me+1}/${ie}: Hole Public Config...`);const Ze=await fetch(`https://embed-api-v2.bluepic.workers.dev/api/public/project?${new URLSearchParams({hostname:m,slug:c,env:Pe})}`,{method:"GET"});return console.log(`\u2705 Erfolgreich nach ${Me+1} Versuchen`),await Ze.json()}catch(Ze){if(console.error(`\u274C Fehler bei Versuch ${Me+1}:`,Ze),Me<ie-1)console.log(`\u23F3 Warte ${we}ms vor erneutem Versuch...`),await new Promise(ne=>setTimeout(ne,we));else throw console.error(`\u{1F6A8} Maximalanzahl von ${ie} Versuchen erreicht. Abbruch.`),Ze}Me++}throw new Error("Unbekannter Fehler in getPublicConfigWithRetries")}window.addEventListener("load",async()=>{const m=document.querySelectorAll(".bluepic-embed");console.log("Auto-BluepicEmbed elements",m);for(const c of m){const ie=c.getAttribute("data-embed-project-id"),we=c.getAttribute("data-template-id");c.getAttribute("data-stripe-env");const Pe=c.getAttribute("data-init-data"),Me=c.getAttribute("data-studio-resources-base-url")??void 0,Ze=c.getAttribute("data-cloudflare-pages-hostname")??void 0,ne=c.getAttribute("data-display-mode"),rr=c.getAttribute("data-allow-pan-and-zoom"),pr=c.getAttribute("data-bx-core-version")??void 0,or=c.getAttribute("data-published-slug")??void 0,_r=Pe?JSON.parse(Pe):void 0,kr=rr==="true",Ir=ne==="mobile"?"mobile":ne==="stack"?"stack":"auto",Lr=c.getAttribute("data-branding")==="false",$r=new BluepicEmbed(c,we,ie,{initData:_r,displayMode:Ir,allowPanAndZoom:kr,studioResourcesBaseUrl:Me,cloudflarePagesHostname:Ze,bxCoreVersion:pr,publishedSlug:or,branding:Lr});console.log("!",c,$r)}});const GLOBAL_APP_WRAPPER_CLASS="bluepic-app-wrapper",GLOBAL_APP_WRAPPER_SELECTOR=`.${GLOBAL_APP_WRAPPER_CLASS}`;window.bluepicPopupProvider=new BluepicPopupProvider,exports.AdjustImage=AdjustImage,exports.BluepicBatchEditor=BluepicBatchEditor,exports.BluepicEmbed=BluepicEmbed,exports.BluepicEmbedded=BluepicEmbedded,exports.BluepicEmbeddedEditor=BluepicEmbeddedEditor,exports.BluepicFieldComponents=BluepciFieldComponents,exports.BluepicSpinner=BluepicSpinner,exports.BxAvatar=BxAvatar,exports.BxButton=BxButton,exports.BxCard=BxCard,exports.BxCheckbox=BxCheckbox,exports.BxColorPicker=BxColorPicker,exports.BxDropdown=BxDropdown,exports.BxEmbedThemeDarkmode=BxEmbedThemeDarkmode,exports.BxEmbedThemeLightmode=BxEmbedThemeLightmode,exports.BxFields=_sfc_main$p,exports.BxIcon=BxIcon,exports.BxInput=BxInput,exports.BxList=BxList,exports.BxListItem=BxListItem,exports.BxMenu=BxMenu,exports.BxPopover=BxPopover,exports.BxPopup=_sfc_main$17,exports.BxRadio=BxRadio,exports.BxRadioGroup=BxRadioGroup,exports.BxSelect=BxSelect,exports.BxSlider=BxSlider,exports.BxSpin=BxSpin,exports.BxSwitch=BxSwitch,exports.BxTab=BxTab,exports.BxTabs=BxTabs,exports.BxTag=BxTag,exports.BxTooltip=BxTooltip,exports.BxUserMenu=BxUserMenu,exports.GLOBAL_APP_WRAPPER_CLASS=GLOBAL_APP_WRAPPER_CLASS,exports.GLOBAL_APP_WRAPPER_SELECTOR=GLOBAL_APP_WRAPPER_SELECTOR,exports.MapboxMap=MapboxMap,exports.SlidesNavigation=SlidesNavigation,exports.applyColorMatricesToImage=applyColorMatricesToImage,exports.applyColorMatrix=applyColorMatrix,exports.applyColorMatrixToColor=applyColorMatrixToColor,exports.convertDeprecatedField=convertDeprecatedField,exports.createMessage=createMessage,exports.createPopup=createPopup,exports.cropImage=cropImage,exports.cropToVisibleBBox=cropToVisibleBBox,exports.getDefaultValueForFieldModel=getDefaultValueForFieldModel,exports.getTemplateLiveUrl=getTemplateLiveUrl,exports.getTemplateSerialUrl=getTemplateSerialUrl,exports.getThemeStyle=getThemeStyle,exports.getVisibleBBox=getVisibleBBox,exports.groupFeatureByLinebreaks=groupFeatureByLinebreaks$1,exports.normalizeAdjust=normalizeAdjust,exports.normalizeCrop=normalizeCrop,exports.rasterize=rasterize,exports.realizeField=realizeField,exports.renderFieldIcon=renderFieldIcon,exports.renderSVG=renderSVG,exports.stringifyField=stringifyField,exports.ungroupFeaturesDividedByLinebreaks=ungroupFeaturesDividedByLinebreaks,exports.useTheme=useTheme,exports.waitUntil=waitUntil,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|