@bluepic/embed 0.2.32 → 0.2.35
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/bluepic-embed.iife.js +2 -2
- package/dist/bluepic-embed.iife.js.map +1 -1
- package/dist/bluepic-embed.umd.js +2 -2
- package/dist/bluepic-embed.umd.js.map +1 -1
- package/dist/embed/embed.d.ts +2 -0
- package/dist/main.cjs +2 -2
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +11 -12
- package/dist/main.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -550,7 +550,7 @@ list should be an Array.`),I.length===0)return new w(0);if(I.length===1)return I
|
|
|
550
550
|
box-sizing: border-box;
|
|
551
551
|
}
|
|
552
552
|
`,document.head.appendChild(t),this.element.innerHTML=`
|
|
553
|
-
<div id="${this.id}" class="bluepic-app-wrapper" style="position: relative;
|
|
553
|
+
<div id="${this.id}" class="bluepic-app-wrapper" style="position: relative; height: ${this.displayMode.value==="stack"?"auto":"100%"};">
|
|
554
554
|
<div v-if="templateId && (!isAsync || baseSerial)" style="display: flex; flex-direction: column;" :style="{ height: displayMode === 'stack' ? 'auto' : '100%' }">
|
|
555
555
|
<bluepic-embedded-editor
|
|
556
556
|
v-if="templateId"
|
|
@@ -580,5 +580,5 @@ list should be an Array.`),I.length===0)return new w(0);if(I.length===1)return I
|
|
|
580
580
|
</div>
|
|
581
581
|
|
|
582
582
|
</div>
|
|
583
|
-
`;const o=this;i.nextTick(()=>{i.createApp({components:{BluepicEmbeddedEditor:ah,BluepicSpinner:Bs},setup(){const r={async handleUpload({blob:a,context:l,width:d,height:c,name:p,onProgress:f}){const{variants:m,filename:x,id:v}=await PS(o.embedApiBaseUrl.value,o.templateId.value,l,a,p,(b,w)=>{f(b/w)}),h=m.find(b=>DS(b).variant==="public");if(!h)throw new Error("No public variant");return{width:d,height:c,key:v,name:x,src:h}}};return i.watch([o.displayMode],()=>{var a;o.element.style.boxSizing===""&&(o.element.style.boxSizing="border-box"),((a=o.displayMode)==null?void 0:a.value)!=="stack"&&(o.element.style.height===""&&(o.element.style.height="100vh"),o.element.style.padding===""&&(o.element.style.padding="10px"))},{immediate:!0}),{bridge:r,editorRef:o.editorRef,embedProject:o.embedProject,allowPanAndZoom:o.allowPanAndZoom,templateId:o.templateId,baseSerial:o.baseSerial,basePreview:o.basePreview,embedApiBaseUrl:o.embedApiBaseUrl,cloudflarePagesHostname:o.cloudflarePagesHostname,data:o.data,serial:o.serial,ready:o.ready,displayMode:o.displayMode,bxCoreVersion:o.bxCoreVersion,bxThemeStyleVars:o.bxThemeStyleVars,darkmode:i.computed(()=>Tt(o.bxThemeStyleVars.value["editor-view-background-color"]).isDark()),stripeEnv:o.stripeEnv,handleExportAction:a=>{const l=new CustomEvent("handle-export-action",{detail:a});o.dispatchEvent(l)},beforeExport:a=>{const l=new CustomEvent("before-export",{detail:a});o.dispatchEvent(l)},afterExport:a=>{const l=new CustomEvent("after-export",{detail:a});o.dispatchEvent(l)},isAsync:o.isAsync}}}).mount(`#${this.id}`)})}setVariable(t,o){this.data.value||(this.data.value={}),this.data.value[t]=o}setData(t,o=!1){o?this.data.value=t:this.data.value={...this.data.value,...t}}getTransform(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.transform}setTransform(t,o,r,a){var l;(l=this.editorRef.value)!=null&&l.bluepicLiveTemplateRef&&(this.editorRef.value.bluepicLiveTemplateRef.transform={scale:t,x:o,y:r,rotate:a})}applyTransform(t,o,r,a){var l,d,c;(c=(d=(l=this.editorRef.value)==null?void 0:l.bluepicLiveTemplateRef)==null?void 0:d.zoompinchRef)==null||c.applyTransform(t,o,r,a)}isMultiFrame(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.isMultiFrame}getCenteredFrame(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.closestFrame}centerFrame(t,o){var r,a;(a=(r=this.editorRef.value)==null?void 0:r.bluepicLiveTemplateRef)==null||a.applyTranformBasedOnFrame(t,o)}isReady(){return this.ready.value}}async function zS(e,n,t,o,r,a){let l=0;for(;l<o;){try{return await(await fetch(`${e}/api/public/project?${new URLSearchParams({hostname:n,slug:t,env:a})}`,{method:"GET"})).json()}catch(d){if(console.error(`❌ Fehler bei Versuch ${l+1}:`,d),l<o-1)console.log(`⏳ Warte ${r}ms vor erneutem Versuch...`),await new Promise(c=>setTimeout(c,r));else throw console.error(`🚨 Maximalanzahl von ${o} Versuchen erreicht. Abbruch.`),d}l++}throw new Error("Unbekannter Fehler in getPublicConfigWithRetries")}const Gh=async()=>{const e=document.querySelectorAll(".bluepic-embed[data-embed-project-id]");for(const n of e){const t=n.getAttribute("data-embed-project-id"),o=n.getAttribute("data-template-id")
|
|
583
|
+
`;const o=this;i.nextTick(()=>{i.createApp({components:{BluepicEmbeddedEditor:ah,BluepicSpinner:Bs},setup(){const r={async handleUpload({blob:a,context:l,width:d,height:c,name:p,onProgress:f}){const{variants:m,filename:x,id:v}=await PS(o.embedApiBaseUrl.value,o.templateId.value,l,a,p,(b,w)=>{f(b/w)}),h=m.find(b=>DS(b).variant==="public");if(!h)throw new Error("No public variant");return{width:d,height:c,key:v,name:x,src:h}}};return i.watch([o.displayMode],()=>{var a;o.element.style.boxSizing===""&&(o.element.style.boxSizing="border-box"),((a=o.displayMode)==null?void 0:a.value)!=="stack"&&(o.element.style.height===""&&(o.element.style.height="100vh"),o.element.style.padding===""&&(o.element.style.padding="10px"))},{immediate:!0}),{bridge:r,editorRef:o.editorRef,embedProject:o.embedProject,allowPanAndZoom:o.allowPanAndZoom,templateId:o.templateId,baseSerial:o.baseSerial,basePreview:o.basePreview,embedApiBaseUrl:o.embedApiBaseUrl,cloudflarePagesHostname:o.cloudflarePagesHostname,data:o.data,serial:o.serial,ready:o.ready,displayMode:o.displayMode,bxCoreVersion:o.bxCoreVersion,bxThemeStyleVars:o.bxThemeStyleVars,darkmode:i.computed(()=>Tt(o.bxThemeStyleVars.value["editor-view-background-color"]).isDark()),stripeEnv:o.stripeEnv,handleExportAction:a=>{const l=new CustomEvent("handle-export-action",{detail:a});o.dispatchEvent(l)},beforeExport:a=>{const l=new CustomEvent("before-export",{detail:a});o.dispatchEvent(l)},afterExport:a=>{const l=new CustomEvent("after-export",{detail:a});o.dispatchEvent(l)},isAsync:o.isAsync}}}).mount(`#${this.id}`)})}setVariable(t,o){this.data.value||(this.data.value={}),this.data.value[t]=o}setData(t,o=!1){o?this.data.value=t:this.data.value={...this.data.value,...t}}getTransform(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.transform}setTransform(t,o,r,a){var l;(l=this.editorRef.value)!=null&&l.bluepicLiveTemplateRef&&(this.editorRef.value.bluepicLiveTemplateRef.transform={scale:t,x:o,y:r,rotate:a})}applyTransform(t,o,r,a){var l,d,c;(c=(d=(l=this.editorRef.value)==null?void 0:l.bluepicLiveTemplateRef)==null?void 0:d.zoompinchRef)==null||c.applyTransform(t,o,r,a)}isMultiFrame(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.isMultiFrame}getCenteredFrame(){var t,o;return(o=(t=this.editorRef.value)==null?void 0:t.bluepicLiveTemplateRef)==null?void 0:o.closestFrame}centerFrame(t,o){var r,a;(a=(r=this.editorRef.value)==null?void 0:r.bluepicLiveTemplateRef)==null||a.applyTranformBasedOnFrame(t,o)}isReady(){return this.ready.value}}async function zS(e,n,t,o,r,a){let l=0;for(;l<o;){try{return await(await fetch(`${e}/api/public/project?${new URLSearchParams({hostname:n,slug:t,env:a})}`,{method:"GET"})).json()}catch(d){if(console.error(`❌ Fehler bei Versuch ${l+1}:`,d),l<o-1)console.log(`⏳ Warte ${r}ms vor erneutem Versuch...`),await new Promise(c=>setTimeout(c,r));else throw console.error(`🚨 Maximalanzahl von ${o} Versuchen erreicht. Abbruch.`),d}l++}throw new Error("Unbekannter Fehler in getPublicConfigWithRetries")}const Gh=async()=>{const e=document.querySelectorAll(".bluepic-embed[data-embed-project-id]");for(const n of e){const t=n.getAttribute("data-embed-project-id"),o=n.getAttribute("data-template-id"),r=n.getAttribute("data-stripe-env"),a=n.getAttribute("data-init-data"),l=n.getAttribute("data-embed-api-base-url")??void 0,d=n.getAttribute("data-cloudflare-pages-hostname")??void 0,c=n.getAttribute("data-display-mode"),p=n.getAttribute("data-allow-pan-and-zoom"),f=n.getAttribute("data-bx-core-version")??void 0,m=a?JSON.parse(a):void 0,x=p==="true",v=c==="mobile"?"mobile":c==="stack"?"stack":"auto",h=n.getAttribute("data-branding")==="false";new V1(n,o,t,{initData:m,displayMode:v,allowPanAndZoom:x,embedApiBaseUrl:l,cloudflarePagesHostname:d,bxCoreVersion:f,branding:h,theme:"auto",stripeEnv:r==="dev"?"dev":"prod"})}};window.addEventListener("load",Gh),window.BluepicEmbed=V1;const FS={class:"user-info"},jS={class:"user-content"},US={key:0,class:"user-name"},ZS={key:1,class:"user-email"},WS={class:"actions"},HS=ye(i.defineComponent({__name:"UserInfo",props:{user:{},showSettings:{type:Boolean,default:!1}},emits:["logout","settings"],setup(e,{emit:n}){const t=n;return(o,r)=>(i.openBlock(),i.createElementBlock("div",FS,[i.createElementVNode("main",null,[i.createVNode(hh,{user:e.user,width:40,height:40},null,8,["user"]),i.createElementVNode("div",jS,[e.user.name?(i.openBlock(),i.createElementBlock("div",US,i.toDisplayString(e.user.name),1)):i.createCommentVNode("",!0),e.user.email?(i.openBlock(),i.createElementBlock("div",ZS,i.toDisplayString(e.user.email),1)):i.createCommentVNode("",!0)])]),i.createElementVNode("footer",null,[i.createElementVNode("div",WS,[e.showSettings?(i.openBlock(),i.createBlock(Te,{key:0,size:"medium",onClick:r[0]||(r[0]=a=>t("settings"))},{icon:i.withCtx(()=>[i.createVNode(be,null,{default:i.withCtx(()=>[i.createVNode(i.unref(w4))]),_:1})]),default:i.withCtx(()=>[r[2]||(r[2]=i.createTextVNode(" Settings ",-1))]),_:1})):i.createCommentVNode("",!0),i.createVNode(Te,{size:"medium",onClick:r[1]||(r[1]=a=>t("logout"))},{icon:i.withCtx(()=>[i.createVNode(be,null,{default:i.withCtx(()=>[i.createVNode(i.unref(o4))]),_:1})]),default:i.withCtx(()=>[r[3]||(r[3]=i.createTextVNode(" Logout ",-1))]),_:1})])])]))}}),[["__scopeId","data-v-6e871f40"]]),GS={class:"category-tabs"},qS={class:"tabs-wrapper"},XS=["onClick"],YS=ye(i.defineComponent({__name:"Tabs",props:i.mergeModels({tabs:{}},{activeTab:{required:!0},activeTabModifiers:{}}),emits:i.mergeModels(["click:category"],["update:activeTab"]),setup(e,{emit:n}){const t=n,o=i.useModel(e,"activeTab");function r(a){o.value=a,t("click:category",a)}return(a,l)=>(i.openBlock(),i.createElementBlock("div",GS,[i.createElementVNode("div",qS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.tabs,d=>(i.openBlock(),i.createElementBlock("button",{key:d,class:i.normalizeClass({active:d===o.value}),onClick:c=>r(d)},[i.createElementVNode("span",null,i.toDisplayString(d),1)],10,XS))),128))])]))}}),[["__scopeId","data-v-212d7f66"]]),D1=["A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A10"],qh={w:841,h:1189};function KS(){const e=[{w:qh.w,h:qh.h}];for(let t=1;t<=10;t++){const o=e[t-1],r=Math.round(o.h/2),a=o.w,l=r<=a?{w:r,h:a}:{w:a,h:r};e.push(l)}const n={};return D1.forEach((t,o)=>n[t]=e[o]),n}const Xh=KS(),Yh=25.4;function Kh(e){return e/Yh}function Jh(e,n){return e*n}function Qh(e,n){return e/n*Yh}function JS(e,n){const t=Xh[e],o=Kh(t.w),r=Kh(t.h),a=Jh(o,n),l=Jh(r,n);return{widthPx:Math.round(a),heightPx:Math.round(l),widthPxExact:a,heightPxExact:l,aspect:t.h/t.w,sizeMm:{w:t.w,h:t.h}}}function QS(e,n,t,o=2){const r=e>n,[a,l]=e<=n?[e,n]:[n,e],d=Qh(a,t),c=Qh(l,t);let p=null;for(const v of D1){const h=Xh[v],b=d-h.w,w=c-h.h;if(Math.abs(b)<=o&&Math.abs(w)<=o){const L=Math.abs(b)+Math.abs(w);(!p||L<p.score)&&(p={level:v,score:L,delta:{dw:b,dh:w},iso:h})}}if(!p)return null;const f=c/d,x=Math.abs(f/Math.SQRT2-1);return{level:p.level,matchedOrientation:r?"landscape":"portrait",measuredMm:{w:d,h:c},isoMm:{w:p.iso.w,h:p.iso.h},deltaMm:p.delta,aspectError:x}}const e0="bluepic-app-wrapper",br=`.${e0}`;return window.bluepicPopupProvider=new _b,ae.AdjustImage=iu,ae.BluepicBatchEditor=SE,ae.BluepicEmbed=V1,ae.BluepicEmbedded=im,ae.BluepicEmbeddedEditor=ah,ae.BluepicFieldComponents=To,ae.BluepicLiveTemplate=ur,ae.BluepicLogo=b1,ae.BluepicSpinner=Bs,ae.BxAvatar=k1,ae.BxButton=Te,ae.BxCard=jr,ae.BxCheckbox=Ts,ae.BxColorPicker=KE,ae.BxDropdown=Ki,ae.BxEmbedThemeDarkmode=Cl,ae.BxEmbedThemeLightmode=kl,ae.BxFields=Bu,ae.BxIcon=be,ae.BxInput=Qr,ae.BxList=l2,ae.BxListItem=c2,ae.BxMenu=n2,ae.BxPopover=Jr,ae.BxPopup=ki,ae.BxRadio=rS,ae.BxRadioGroup=nS,ae.BxSelect=Yi,ae.BxSlider=ya,ae.BxSpin=Vr,ae.BxSwitch=ME,ae.BxTab=tS,ae.BxTabs=sh,ae.BxTag=fh,ae.BxTooltip=bs,ae.BxUserMenu=qE,ae.CSS_COLOR_NAMES=w1,ae.CircularProgress=Ia,ae.CollectionFieldPopup=Tu,ae.DIN_LEVELS=D1,ae.GLOBAL_APP_WRAPPER_CLASS=e0,ae.GLOBAL_APP_WRAPPER_SELECTOR=br,ae.MapboxMap=_u,ae.SlidesNavigation=Ku,ae.Tabs=YS,ae.UserAvatar=hh,ae.UserInfo=HS,ae.applyColorMatricesToImage=fS,ae.applyColorMatrix=hS,ae.applyColorMatrixToColor=vh,ae.convertDeprecatedField=Xs,ae.cropImage=_E,ae.cropToVisibleBBox=xh,ae.cyrb53=uh,ae.cyrb53ToHex=dh,ae.dinPixels=JS,ae.flattenFieldTable=xf,ae.flattenFields=bf,ae.getDefaultValueForFieldModel=yf,ae.getFieldDescription=Bo,ae.getFieldsDescription=qs,ae.getInitials=mh,ae.getTemplateLiveUrl=Tf,ae.getTemplatePreviewUrl=Ks,ae.getTemplateSerialUrl=Ys,ae.getThemeStyle=yl,ae.getVisibleBBox=bh,ae.groupFeatureByLinebreaks=cs,ae.hslToRgb=y1,ae.identifyDin=QS,ae.initEmbeds=Gh,ae.isDark=ch,ae.modelField=Yv,ae.normalizeAdjust=P2,ae.normalizeCrop=D2,ae.optimizePreviewUrl=Ca,ae.rasterize=mS,ae.realizeField=Eu,ae.renderFieldIcon=wa,ae.renderSVG=gh,ae.rgba=C1,ae.stringToHslColor=ph,ae.stringifyField=Jv,ae.ungroupFeaturesDividedByLinebreaks=Ec,ae.useFields=Lu,ae.useMobileFields=wf,ae.usePopup=$4,ae.useTheme=Wh,ae.useUpload=Or,ae.waitUntil=V2,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"}),ae}({},Vue);
|
|
584
584
|
//# sourceMappingURL=bluepic-embed.iife.js.map
|