@myop/vue 0.0.29 → 0.0.30
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/index.js +357 -348
- package/dist/index.umd.cjs +7 -7
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("@myop/sdk/host"),require("@myop/sdk/helpers")):typeof define=="function"&&define.amd?define(["exports","vue","@myop/sdk/host","@myop/sdk/helpers"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d["@myop/vue"]={},d.Vue,d.host,d.helpers))})(this,(function(d,i,V,P){"use strict";const
|
|
1
|
+
(function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("@myop/sdk/host"),require("@myop/sdk/helpers")):typeof define=="function"&&define.amd?define(["exports","vue","@myop/sdk/host","@myop/sdk/helpers"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d["@myop/vue"]={},d.Vue,d.host,d.helpers))})(this,(function(d,i,V,P){"use strict";const Ke=["innerHTML"],ye=i.defineComponent({__name:"MyopLoader",props:{opacity:{default:1},fadeDuration:{default:200}},setup(e){const t=e,n=i.useSlots(),o=a=>!a||a.length===0?!1:a.some(u=>typeof u.children=="string"?u.children.trim()!=="":Array.isArray(u.children)?o(u.children):!!(u.type&&typeof u.type!="symbol"||u.children)),s=i.computed(()=>{const a=n.default;if(!a)return!1;const u=a();return o(u)}),r=i.computed(()=>({...V.containerStyleObject,opacity:t.opacity,transition:`opacity ${t.fadeDuration}ms ease-out`})),l=i.computed(()=>({...V.loaderStyleObject,opacity:t.opacity,transition:`opacity ${t.fadeDuration}ms ease-out`})),c=V.getMyopLogoHtml();return(a,u)=>s.value?(i.openBlock(),i.createElementBlock("div",{key:0,style:i.normalizeStyle(r.value)},[i.renderSlot(a.$slots,"default")],4)):(i.openBlock(),i.createElementBlock("div",{key:1,style:i.normalizeStyle(l.value),innerHTML:i.unref(c)},null,12,Ke))}}),Ye=["innerHTML"],ge=i.defineComponent({__name:"MyopFallback",setup(e){const t=i.useSlots(),n=c=>!c||c.length===0?!1:c.some(a=>typeof a.children=="string"?a.children.trim()!=="":Array.isArray(a.children)?n(a.children):!!(a.type&&typeof a.type!="symbol"||a.children)),o=i.computed(()=>{const c=t.default;if(!c)return!1;const a=c();return n(a)}),s={position:"absolute",top:"0",left:"0",right:"0",bottom:"0"},r={...V.fallbackStyleObject},l=V.getMyopLogoHtml();return(c,a)=>o.value?(i.openBlock(),i.createElementBlock("div",{key:0,style:s},[i.renderSlot(c.$slots,"default")])):(i.openBlock(),i.createElementBlock("div",{key:1,style:r,innerHTML:i.unref(l)},null,8,Ye))}}),Ge=i.defineComponent({name:"MyopComponent",__name:"MyopComponent",props:{componentId:{},componentConfig:{},data:{},fadeDuration:{default:200},autoSize:{type:Boolean,default:!0},environment:{},preview:{type:Boolean},on:{}},emits:["load","error","sizeChange","cta"],setup(e,{expose:t,emit:n}){const o=i.useSlots(),s=f=>!f||f.length===0?!1:f.some(p=>typeof p.children=="string"?p.children.trim()!=="":Array.isArray(p.children)?s(p.children):!!(p.type&&typeof p.type!="symbol"||p.children)),r=i.computed(()=>{const f=o.loader;if(!f)return!1;const p=f();return s(p)});i.computed(()=>{const f=o.fallback;if(!f)return!1;const p=f();return s(p)});const l=e,c=n,a=i.ref(null),u=i.shallowRef(null),m=l.componentId?Le(l.componentId):!1,g=i.ref(!m),R=i.ref(1),k=i.ref(!1),D=i.ref(!1),F=i.ref(void 0),ve=i.ref({fillWidth:!1,fillHeight:!1}),pe=i.ref(!1),G=i.ref(null);let A=null;const de=()=>{R.value=0,setTimeout(()=>{g.value=!1},l.fadeDuration)},me=f=>{console.error("[MyopComponent] Error:",f),de(),k.value=!0,c("error",f)},he=async f=>{var O,X,Ue;pe.value=!0;let p=!1;try{const y=JSON.parse(JSON.stringify({componentId:f.componentId,data:f.data,environment:f.environment,preview:f.preview,autoSize:f.autoSize}));if(!y.componentId&&!f.componentConfig){me("No component configuration provided");return}const Zt=y.preview===!0?!0:void 0,en=f.componentConfig?JSON.parse(JSON.stringify(f.componentConfig)):await Pe().fetchComponentV2(y.componentId,y.environment,Zt);if(!a.value){me("Container element not found");return}const tn=i.markRaw({data:y.data,_environment:{props:y}}),Be=await V.hostSDK.loadComponent(en,a.value,tn);if(p){Be.dispose();return}if(u.value=i.markRaw(Be),await u.value.initiated(),p){(O=u.value)==null||O.dispose();return}if(await new Promise(Z=>requestAnimationFrame(Z)),p||!u.value||u.value.markedForDisposed){u.value&&!u.value.markedForDisposed&&u.value.dispose();return}D.value=!0;const H=(X=u.value)==null?void 0:X.sizeMeta,Je=(H==null?void 0:H.width)==="100%",We=(H==null?void 0:H.height)==="100%";ve.value={fillWidth:Je,fillHeight:We},(!(l.autoSize??!0)||Je&&We)&&de(),(Ue=u.value)!=null&&Ue.props&&(u.value.props.myop_cta_handler=(Z,qe)=>{l.on&&l.on(Z,qe),c("cta",Z,qe)}),c("load",u.value)}catch(y){p||me((y==null?void 0:y.message)||"Unknown error")}finally{if(pe.value=!1,G.value!==null&&!p){const y=G.value;G.value=null,await he(y)}}return()=>{p=!0}},Gt=()=>{var p;if(!D.value||!((p=u.value)!=null&&p.observeAutoSize))return;let f=!0;A=u.value.observeAutoSize({explicitWidth:void 0,explicitHeight:void 0,forceAutoSize:l.autoSize??!0,loaderMinHeight:50,onSizeChange:O=>{c("sizeChange",O),F.value=O,f&&(f=!1,de())}})};i.watch(()=>l.componentId,async(f,p)=>{f!==p&&(D.value=!1,k.value=!1,g.value=!0,R.value=1,u.value&&(u.value.dispose(),u.value=null),A&&(A(),A=null),pe.value?G.value={...l}:await he(l))}),i.watch(()=>l.data,f=>{var p;if(D.value&&f!==void 0&&u.value){const O=(p=u.value.props)==null?void 0:p.myop_init_interface;if(O){const X=JSON.parse(JSON.stringify(f));O(X)}}},{deep:!0}),i.watch(()=>D.value,f=>{f&&Gt()}),i.onMounted(async()=>{(l.componentId||l.componentConfig)&&await he(l)}),i.onUnmounted(()=>{A&&A(),u.value&&u.value.dispose()});const Q=i.computed(()=>g.value?50:void 0),je=i.computed(()=>!(l.autoSize??!0)||!D.value||ve.value.fillHeight),Qt=i.computed(()=>{var f,p;return je.value?{position:"relative",width:"100%",height:"100%",minHeight:Q.value?`${Q.value}px`:void 0}:{position:"relative",width:(f=F.value)!=null&&f.autoSizingWidth?`${F.value.width}px`:"100%",height:(p=F.value)!=null&&p.height?`${F.value.height}px`:void 0,minHeight:Q.value?`${Q.value}px`:void 0}}),Xt=i.computed(()=>{var f;return je.value?{position:"absolute",inset:"0"}:{width:"100%",height:(f=F.value)!=null&&f.height?`${F.value.height}px`:void 0}});return t({myopComponent:u,isLoaded:D}),(f,p)=>(i.openBlock(),i.createElementBlock("div",{style:i.normalizeStyle(Qt.value)},[i.createElementVNode("div",{ref_key:"myopContainer",ref:a,style:i.normalizeStyle(Xt.value)},null,4),g.value&&r.value?(i.openBlock(),i.createBlock(ye,{key:0,opacity:R.value,"fade-duration":e.fadeDuration},{default:i.withCtx(()=>[i.renderSlot(f.$slots,"loader")]),_:3},8,["opacity","fade-duration"])):i.createCommentVNode("",!0),k.value?(i.openBlock(),i.createBlock(ge,{key:1},{default:i.withCtx(()=>[i.renderSlot(f.$slots,"fallback")]),_:3})):i.createCommentVNode("",!0)],4))}});/**
|
|
2
2
|
* @vue/shared v3.5.27
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**/const
|
|
5
|
+
**/const Qe=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const _e=()=>{},Xe=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ee=Object.assign,_=Array.isArray,C=e=>typeof e=="function",S=e=>typeof e=="string",Ze=e=>typeof e=="symbol",z=e=>e!==null&&typeof e=="object",et=e=>(z(e)||C(e))&&C(e.then)&&C(e.catch),Ce=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},tt=Ce(e=>e.charAt(0).toUpperCase()+e.slice(1)),nt=Ce(e=>e?`on${tt(e)}`:"");let Ee;const L=()=>Ee||(Ee=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function te(e){if(_(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],s=S(o)?it(o):te(o);if(s)for(const r in s)t[r]=s[r]}return t}else if(S(e)||z(e))return e}const ot=/;(?![^(]*\))/g,rt=/:([^]+)/,st=/\/\*[^]*?\*\//g;function it(e){const t={};return e.replace(st,"").split(ot).forEach(n=>{if(n){const o=n.split(rt);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function ne(e){let t="";if(S(e))t=e;else if(_(e))for(let n=0;n<e.length;n++){const o=ne(e[n]);o&&(t+=o+" ")}else if(z(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}/**
|
|
6
6
|
* @vue/reactivity v3.5.27
|
|
7
7
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
8
|
* @license MIT
|
|
9
|
-
**/process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV,new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(
|
|
9
|
+
**/process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV,new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ze));function oe(e){return e?!!e.__v_raw:!1}function v(e){const t=e&&e.__v_raw;return t?v(t):e}function Se(e){return e?e.__v_isRef===!0:!1}/**
|
|
10
10
|
* @vue/runtime-core v3.5.27
|
|
11
11
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
12
|
* @license MIT
|
|
13
|
-
**/const I=[];function
|
|
13
|
+
**/const I=[];function lt(e){I.push(e)}function at(){I.pop()}let re=!1;function N(e,...t){if(re)return;re=!0;const n=I.length?I[I.length-1].component:null,o=n&&n.appContext.config.warnHandler,s=ct();if(o)j(o,n,11,[e+t.map(r=>{var l,c;return(c=(l=r.toString)==null?void 0:l.call(r))!=null?c:JSON.stringify(r)}).join(""),n&&n.proxy,s.map(({vnode:r})=>`at <${ze(n,r.type)}>`).join(`
|
|
14
14
|
`),s]);else{const r=[`[Vue warn]: ${e}`,...t];s.length&&r.push(`
|
|
15
|
-
`,...
|
|
16
|
-
`],...
|
|
17
|
-
Component that was made reactive: `,e)),
|
|
15
|
+
`,...ut(s)),console.warn(...r)}re=!1}function ct(){let e=I[I.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const o=e.component&&e.component.parent;e=o&&o.vnode}return t}function ut(e){const t=[];return e.forEach((n,o)=>{t.push(...o===0?[]:[`
|
|
16
|
+
`],...ft(n))}),t}function ft({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=e.component?e.component.parent==null:!1,s=` at <${ze(e.component,e.type,o)}`,r=">"+n;return e.props?[s,...pt(e.props),r]:[s+r]}function pt(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(o=>{t.push(...Ne(o,e[o]))}),n.length>3&&t.push(" ..."),t}function Ne(e,t,n){return S(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Se(t)?(t=Ne(e,v(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):C(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=v(t),n?t:[`${e}=`,t])}const se={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function j(e,t,n,o){try{return o?e(...o):e()}catch(s){ie(s,t,n)}}function be(e,t,n,o){if(C(e)){const s=j(e,t,n,o);return s&&et(s)&&s.catch(r=>{ie(r,t,n)}),s}if(_(e)){const s=[];for(let r=0;r<e.length;r++)s.push(be(e[r],t,n,o));return s}else process.env.NODE_ENV!=="production"&&N(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`)}function ie(e,t,n,o=!0){const s=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:l}=t&&t.appContext.config||Qe;if(t){let c=t.parent;const a=t.proxy,u=process.env.NODE_ENV!=="production"?se[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const m=c.ec;if(m){for(let g=0;g<m.length;g++)if(m[g](e,a,u)===!1)return}c=c.parent}if(r){j(r,null,10,[e,a,u]);return}}dt(e,n,s,o,l)}function dt(e,t,n,o=!0,s=!1){if(process.env.NODE_ENV!=="production"){const r=se[t];if(n&<(n),N(`Unhandled error${r?` during execution of ${r}`:""}`),n&&at(),o)throw e;console.error(e)}else{if(s)throw e;console.error(e)}}const h=[];let E=-1;const T=[];let b=null,$=0;const mt=Promise.resolve();let le=null;const ht=100;function yt(e){let t=E+1,n=h.length;for(;t<n;){const o=t+n>>>1,s=h[o],r=x(s);r<e||r===e&&s.flags&2?t=o+1:n=o}return t}function gt(e){if(!(e.flags&1)){const t=x(e),n=h[h.length-1];!n||!(e.flags&2)&&t>=x(n)?h.push(e):h.splice(yt(t),0,e),e.flags|=1,we()}}function we(){le||(le=mt.then(ke))}function _t(e){_(e)?T.push(...e):b&&e.id===-1?b.splice($+1,0,e):e.flags&1||(T.push(e),e.flags|=1),we()}function Ct(e){if(T.length){const t=[...new Set(T)].sort((n,o)=>x(n)-x(o));if(T.length=0,b){b.push(...t);return}for(b=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),$=0;$<b.length;$++){const n=b[$];process.env.NODE_ENV!=="production"&&Oe(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}b=null,$=0}}const x=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ke(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?n=>Oe(e,n):_e;try{for(E=0;E<h.length;E++){const n=h[E];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&t(n))continue;n.flags&4&&(n.flags&=-2),j(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;E<h.length;E++){const n=h[E];n&&(n.flags&=-2)}E=-1,h.length=0,Ct(e),le=null,(h.length||T.length)&&ke(e)}}function Oe(e,t){const n=e.get(t)||0;if(n>ht){const o=t.i,s=o&&He(o.type);return ie(`Maximum recursive updates exceeded${s?` in component <${s}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}const ae=new Map;process.env.NODE_ENV!=="production"&&(L().__VUE_HMR_RUNTIME__={createRecord:ce(Et),rerender:ce(St),reload:ce(Nt)});const U=new Map;function Et(e,t){return U.has(e)?!1:(U.set(e,{initialDef:B(t),instances:new Set}),!0)}function B(e){return xe(e)?e.__vccOpts:e}function St(e,t){const n=U.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(o=>{t&&(o.render=t,B(o.type).render=t),o.renderCache=[],o.job.flags&8||o.update()}))}function Nt(e,t){const n=U.get(e);if(!n)return;t=B(t),Ve(n.initialDef,t);const o=[...n.instances];for(let s=0;s<o.length;s++){const r=o[s],l=B(r.type);let c=ae.get(l);c||(l!==n.initialDef&&Ve(l,t),ae.set(l,c=new Set)),c.add(r),r.appContext.propsCache.delete(r.type),r.appContext.emitsCache.delete(r.type),r.appContext.optionsCache.delete(r.type),r.ceReload?(c.add(r),r.ceReload(t.styles),c.delete(r)):r.parent?gt(()=>{r.job.flags&8||(r.parent.update(),c.delete(r))}):r.appContext.reload?r.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),r.root.ce&&r!==r.root&&r.root.ce._removeChildStyle(l)}_t(()=>{ae.clear()})}function Ve(e,t){ee(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function ce(e){return(t,n)=>{try{return e(t,n)}catch(o){console.error(o),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let M,J=[];function Ie(e,t){var n,o;M=e,M?(M.enabled=!0,J.forEach(({event:s,args:r})=>M.emit(s,...r)),J=[]):typeof window<"u"&&window.HTMLElement&&!((o=(n=window.navigator)==null?void 0:n.userAgent)!=null&&o.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(r=>{Ie(r,t)}),setTimeout(()=>{M||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,J=[])},3e3)):J=[]}let W=null,bt=null;const wt=e=>e.__isTeleport;function Re(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Re(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}L().requestIdleCallback,L().cancelIdleCallback;function kt(e,t,n=Y,o=!1){if(n){const s=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...l)=>{const c=Lt(n),a=be(t,n,e,l);return c(),a});return o?s.unshift(r):s.push(r),r}else if(process.env.NODE_ENV!=="production"){const s=nt(se[e].replace(/ hook$/,""));N(`${s} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const Ot=(e=>(t,n=Y)=>{(!Ae||e==="sp")&&kt(e,(...o)=>t(...o),n)})("u"),Vt=Symbol.for("v-ndc"),It={};process.env.NODE_ENV!=="production"&&(It.ownKeys=e=>(N("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));const Rt={},De=e=>Object.getPrototypeOf(e)===Rt,Dt=e=>e.__isSuspense,Fe=Symbol.for("v-fgt"),Ft=Symbol.for("v-txt"),Tt=Symbol.for("v-cmt");function $t(e){return e?e.__v_isVNode===!0:!1}const Mt=(...e)=>$e(...e),Te=({key:e})=>e??null,q=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?S(e)||Se(e)||C(e)?{i:W,r:e,k:t,f:!!n}:e:null);function At(e,t=null,n=null,o=0,s=null,r=e===Fe?0:1,l=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Te(t),ref:t&&q(t),scopeId:bt,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:o,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:W};return c?(ue(a,n),r&128&&e.normalize(a)):n&&(a.shapeFlag|=S(n)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&N("VNode created with invalid key (NaN). VNode type:",a.type),a}const Ht=process.env.NODE_ENV!=="production"?Mt:$e;function $e(e,t=null,n=null,o=0,s=null,r=!1){if((!e||e===Vt)&&(process.env.NODE_ENV!=="production"&&!e&&N(`Invalid vnode type when creating vnode: ${e}.`),e=Tt),$t(e)){const c=K(e,t,!0);return n&&ue(c,n),c.patchFlag=-2,c}if(xe(e)&&(e=e.__vccOpts),t){t=zt(t);let{class:c,style:a}=t;c&&!S(c)&&(t.class=ne(c)),z(a)&&(oe(a)&&!_(a)&&(a=ee({},a)),t.style=te(a))}const l=S(e)?1:Dt(e)?128:wt(e)?64:z(e)?4:C(e)?2:0;return process.env.NODE_ENV!=="production"&&l&4&&oe(e)&&(e=v(e),N("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
17
|
+
Component that was made reactive: `,e)),At(e,t,n,o,s,l,r,!0)}function zt(e){return e?oe(e)||De(e)?ee({},e):e:null}function K(e,t,n=!1,o=!1){const{props:s,ref:r,patchFlag:l,children:c,transition:a}=e,u=t?Pt(s||{},t):s,m={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Te(u),ref:t&&t.ref?n&&r?_(r)?r.concat(q(t)):[r,q(t)]:q(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&l===-1&&_(c)?c.map(Me):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Fe?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&K(e.ssContent),ssFallback:e.ssFallback&&K(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&o&&Re(m,a.clone(m)),m}function Me(e){const t=K(e);return _(e.children)&&(t.children=e.children.map(Me)),t}function xt(e=" ",t=0){return Ht(Ft,null,e,t)}function ue(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(_(t))n=16;else if(typeof t=="object")if(o&65){const s=t.default;s&&(s._c&&(s._d=!1),ue(e,s()),s._c&&(s._d=!0));return}else n=32,!t._&&!De(t)&&(t._ctx=W);else C(t)?(t={default:t,_ctx:W},n=32):(t=String(t),o&64?(n=16,t=[xt(t)]):n=8);e.children=t,e.shapeFlag|=n}function Pt(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const s in o)if(s==="class")t.class!==o.class&&(t.class=ne([t.class,o.class]));else if(s==="style")t.style=te([t.style,o.style]);else if(Xe(s)){const r=t[s],l=o[s];l&&r!==l&&!(_(r)&&r.includes(l))&&(t[s]=r?[].concat(r,l):l)}else s!==""&&(t[s]=o[s])}return t}let Y=null,fe;{const e=L(),t=(n,o)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(o),r=>{s.length>1?s.forEach(l=>l(r)):s[0](r)}};fe=t("__VUE_INSTANCE_SETTERS__",n=>Y=n),t("__VUE_SSR_SETTERS__",n=>Ae=n)}const Lt=e=>{const t=Y;return fe(e),e.scope.on(),()=>{e.scope.off(),fe(t)}};let Ae=!1;process.env.NODE_ENV;const vt=/(?:^|[-_])\w/g,jt=e=>e.replace(vt,t=>t.toUpperCase()).replace(/[-_]/g,"");function He(e,t=!0){return C(e)?e.displayName||e.name:e.name||t&&e.__name}function ze(e,t,n=!1){let o=He(t);if(!o&&t.__file){const s=t.__file.match(/([^/\\]+)\.\w+$/);s&&(o=s[1])}if(!o&&e){const s=r=>{for(const l in r)if(r[l]===t)return l};o=s(e.components)||e.parent&&s(e.parent.type.components)||s(e.appContext.components)}return o?jt(o):n?"App":"Anonymous"}function xe(e){return C(e)&&"__vccOpts"in e}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;const Ut=i.defineComponent({inheritAttrs:!0,__name:"MyopVueComponent",props:{flowId:{},componentId:{},onReady:{type:Function}},setup(e,{expose:t}){const n=e,o=i.useAttrs(),s=i.useSlots(),r=i.ref(null),l=i.ref(!0),c=i.ref(null),a=i.ref(null),u=i.getCurrentInstance(),m=i.ref(null);Ot(()=>{a&&a.value&&a.value(o)}),i.onMounted(async()=>{if(r.value){const R=await P.CloudRepository.Main.fetchComponent(n.componentId,n.flowId);c.value=await V.hostSDK.loadComponent(R,r==null?void 0:r.value,{_environment:{props:o,slots:s,context:u==null?void 0:u.appContext,vueContainerRef:r,defineUpdater:k=>{a.value=k},defineInnerVueComponentRef:k=>{m.value=k.value}}}),l.value=!1,n.onReady&&n.onReady(c.value,m.value)}});const g=i.reactive({});return t(g),i.watchEffect(()=>{Object.assign(g,m.value)}),(R,k)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",i.mergeProps(i.unref(o),{ref_key:"myopContainer",ref:r}),null,16),l.value?i.renderSlot(R.$slots,"loading",{key:0}):i.createCommentVNode("",!0)],64))}});let w=P.CloudRepository.Main;const Pe=()=>w,Le=(e,t,n)=>w.isPreloaded(e,t,n),Bt=e=>w.getPreloadedParams(e),Jt=()=>{w=new P.CloudRepository("http://localhost:9292")},Wt=e=>{w=new P.CloudRepository(e)},qt=e=>{w=e},Kt=e=>{w.setEnvironment(e)},Yt=async(e,t,n)=>Promise.allSettled(e.map(o=>w.fetchComponentV2(o,t,n)));d.MyopComponent=Ge,d.MyopContainer=Ut,d.MyopFallback=ge,d.MyopLoader=ye,d.enableLocalDev=Jt,d.getCloudRepository=Pe,d.getPreloadedParams=Bt,d.isPreloaded=Le,d.preloadComponents=Yt,d.setCloudRepository=qt,d.setCloudRepositoryUrl=Wt,d.setEnvironment=Kt,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myop/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vue": "^3.5.13"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@myop/sdk": "^0.3.
|
|
32
|
+
"@myop/sdk": "^0.3.18",
|
|
33
33
|
"@types/node": "^22.14.0",
|
|
34
34
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
35
35
|
"@vue/tsconfig": "^0.7.0",
|