@myop/vue 0.0.30 → 0.0.32
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.d.ts +1 -38
- package/dist/index.js +308 -319
- package/dist/index.umd.cjs +8 -8
- package/package.json +4 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(d,
|
|
1
|
+
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(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"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d["@myop/vue"]={},d.Vue,d.host,d.helpers))})(this,(function(d,s,V,g){"use strict";const Je=["innerHTML"],he=s.defineComponent({__name:"MyopLoader",props:{opacity:{default:1},fadeDuration:{default:200}},setup(e){const t=e,n=s.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)),i=s.computed(()=>{const a=n.default;if(!a)return!1;const u=a();return o(u)}),r=s.computed(()=>({...V.containerStyleObject,opacity:t.opacity,transition:`opacity ${t.fadeDuration}ms ease-out`})),l=s.computed(()=>({...V.loaderStyleObject,opacity:t.opacity,transition:`opacity ${t.fadeDuration}ms ease-out`})),c=V.getMyopLogoHtml();return(a,u)=>i.value?(s.openBlock(),s.createElementBlock("div",{key:0,style:s.normalizeStyle(r.value)},[s.renderSlot(a.$slots,"default")],4)):(s.openBlock(),s.createElementBlock("div",{key:1,style:s.normalizeStyle(l.value),innerHTML:s.unref(c)},null,12,Je))}}),We=["innerHTML"],ye=s.defineComponent({__name:"MyopFallback",setup(e){const t=s.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=s.computed(()=>{const c=t.default;if(!c)return!1;const a=c();return n(a)}),i={position:"absolute",top:"0",left:"0",right:"0",bottom:"0"},r={...V.fallbackStyleObject},l=V.getMyopLogoHtml();return(c,a)=>o.value?(s.openBlock(),s.createElementBlock("div",{key:0,style:i},[s.renderSlot(c.$slots,"default")])):(s.openBlock(),s.createElementBlock("div",{key:1,style:r,innerHTML:s.unref(l)},null,8,We))}}),qe=s.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=s.useSlots(),i=f=>!f||f.length===0?!1:f.some(p=>typeof p.children=="string"?p.children.trim()!=="":Array.isArray(p.children)?i(p.children):!!(p.type&&typeof p.type!="symbol"||p.children)),r=s.computed(()=>{const f=o.loader;if(!f)return!1;const p=f();return i(p)});s.computed(()=>{const f=o.fallback;if(!f)return!1;const p=f();return i(p)});const l=e,c=n,a=s.ref(null),u=s.shallowRef(null),m=l.componentId?g.isPreloaded(l.componentId):!1,_=s.ref(!m),D=s.ref(1),w=s.ref(!1),R=s.ref(!1),F=s.ref(void 0),ze=s.ref({fillWidth:!1,fillHeight:!1}),fe=s.ref(!1),Y=s.ref(null);let A=null;const pe=()=>{D.value=0,setTimeout(()=>{_.value=!1},l.fadeDuration)},de=f=>{console.error("[MyopComponent] Error:",f),pe(),w.value=!0,c("error",f)},me=async f=>{var O,Q,je;fe.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){de("No component configuration provided");return}const Bt=y.preview===!0?!0:void 0,Jt=f.componentConfig?JSON.parse(JSON.stringify(f.componentConfig)):await g.getCloudRepository().fetchComponentV2(y.componentId,y.environment,Bt);if(!a.value){de("Container element not found");return}const Wt=s.markRaw({data:y.data,_environment:{props:y}}),Le=await V.hostSDK.loadComponent(Jt,a.value,Wt);if(p){Le.dispose();return}if(u.value=s.markRaw(Le),await u.value.initiated(),p){(O=u.value)==null||O.dispose();return}if(await new Promise(X=>requestAnimationFrame(X)),p||!u.value||u.value.markedForDisposed){u.value&&!u.value.markedForDisposed&&u.value.dispose();return}R.value=!0;const H=(Q=u.value)==null?void 0:Q.sizeMeta,ve=(H==null?void 0:H.width)==="100%",Ue=(H==null?void 0:H.height)==="100%";ze.value={fillWidth:ve,fillHeight:Ue},(!(l.autoSize??!0)||ve&&Ue)&&pe(),(je=u.value)!=null&&je.props&&(u.value.props.myop_cta_handler=(X,Be)=>{l.on&&l.on(X,Be),c("cta",X,Be)}),c("load",u.value)}catch(y){p||de((y==null?void 0:y.message)||"Unknown error")}finally{if(fe.value=!1,Y.value!==null&&!p){const y=Y.value;Y.value=null,await me(y)}}return()=>{p=!0}},Lt=()=>{var p;if(!R.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,pe())}})};s.watch(()=>l.componentId,async(f,p)=>{f!==p&&(R.value=!1,w.value=!1,_.value=!0,D.value=1,u.value&&(u.value.dispose(),u.value=null),A&&(A(),A=null),fe.value?Y.value={...l}:await me(l))}),s.watch(()=>l.data,f=>{var p;if(R.value&&f!==void 0&&u.value){const O=(p=u.value.props)==null?void 0:p.myop_init_interface;if(O){const Q=JSON.parse(JSON.stringify(f));O(Q)}}},{deep:!0}),s.watch(()=>R.value,f=>{f&&Lt()}),s.onMounted(async()=>{(l.componentId||l.componentConfig)&&await me(l)}),s.onUnmounted(()=>{A&&A(),u.value&&u.value.dispose()});const G=s.computed(()=>_.value?50:void 0),xe=s.computed(()=>!(l.autoSize??!0)||!R.value||ze.value.fillHeight),vt=s.computed(()=>{var f,p;return xe.value?{position:"relative",width:"100%",height:"100%",minHeight:G.value?`${G.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:G.value?`${G.value}px`:void 0}}),Ut=s.computed(()=>{var f;return xe.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:R}),(f,p)=>(s.openBlock(),s.createElementBlock("div",{style:s.normalizeStyle(vt.value)},[s.createElementVNode("div",{ref_key:"myopContainer",ref:a,style:s.normalizeStyle(Ut.value)},null,4),_.value&&r.value?(s.openBlock(),s.createBlock(he,{key:0,opacity:D.value,"fade-duration":e.fadeDuration},{default:s.withCtx(()=>[s.renderSlot(f.$slots,"loader")]),_:3},8,["opacity","fade-duration"])):s.createCommentVNode("",!0),w.value?(s.openBlock(),s.createBlock(ye,{key:1},{default:s.withCtx(()=>[s.renderSlot(f.$slots,"fallback")]),_:3})):s.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 Ke=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const ge=()=>{},Ye=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Z=Object.assign,C=Array.isArray,b=e=>typeof e=="function",S=e=>typeof e=="string",Ge=e=>typeof e=="symbol",P=e=>e!==null&&typeof e=="object",Qe=e=>(P(e)||b(e))&&b(e.then)&&b(e.catch),_e=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Xe=_e(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ze=_e(e=>e?`on${Xe(e)}`:"");let Ce;const x=()=>Ce||(Ce=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ee(e){if(C(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],i=S(o)?ot(o):ee(o);if(i)for(const r in i)t[r]=i[r]}return t}else if(S(e)||P(e))return e}const et=/;(?![^(]*\))/g,tt=/:([^]+)/,nt=/\/\*[^]*?\*\//g;function ot(e){const t={};return e.replace(nt,"").split(et).forEach(n=>{if(n){const o=n.split(tt);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function te(e){let t="";if(S(e))t=e;else if(C(e))for(let n=0;n<e.length;n++){const o=te(e[n]);o&&(t+=o+" ")}else if(P(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(Ge));function ne(e){return e?!!e.__v_raw:!1}function j(e){const t=e&&e.__v_raw;return t?j(t):e}function be(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
|
|
14
|
-
`),
|
|
15
|
-
`,...
|
|
16
|
-
`],...
|
|
17
|
-
Component that was made reactive: `,e)),
|
|
13
|
+
**/const I=[];function rt(e){I.push(e)}function it(){I.pop()}let oe=!1;function N(e,...t){if(oe)return;oe=!0;const n=I.length?I[I.length-1].component:null,o=n&&n.appContext.config.warnHandler,i=st();if(o)L(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,i.map(({vnode:r})=>`at <${He(n,r.type)}>`).join(`
|
|
14
|
+
`),i]);else{const r=[`[Vue warn]: ${e}`,...t];i.length&&r.push(`
|
|
15
|
+
`,...lt(i)),console.warn(...r)}oe=!1}function st(){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 lt(e){const t=[];return e.forEach((n,o)=>{t.push(...o===0?[]:[`
|
|
16
|
+
`],...at(n))}),t}function at({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=e.component?e.component.parent==null:!1,i=` at <${He(e.component,e.type,o)}`,r=">"+n;return e.props?[i,...ct(e.props),r]:[i+r]}function ct(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(o=>{t.push(...Ee(o,e[o]))}),n.length>3&&t.push(" ..."),t}function Ee(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}`]:be(t)?(t=Ee(e,j(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):b(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=j(t),n?t:[`${e}=`,t])}const re={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 L(e,t,n,o){try{return o?e(...o):e()}catch(i){ie(i,t,n)}}function Se(e,t,n,o){if(b(e)){const i=L(e,t,n,o);return i&&Qe(i)&&i.catch(r=>{ie(r,t,n)}),i}if(C(e)){const i=[];for(let r=0;r<e.length;r++)i.push(Se(e[r],t,n,o));return i}else process.env.NODE_ENV!=="production"&&N(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`)}function ie(e,t,n,o=!0){const i=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:l}=t&&t.appContext.config||Ke;if(t){let c=t.parent;const a=t.proxy,u=process.env.NODE_ENV!=="production"?re[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const m=c.ec;if(m){for(let _=0;_<m.length;_++)if(m[_](e,a,u)===!1)return}c=c.parent}if(r){L(r,null,10,[e,a,u]);return}}ut(e,n,i,o,l)}function ut(e,t,n,o=!0,i=!1){if(process.env.NODE_ENV!=="production"){const r=re[t];if(n&&rt(n),N(`Unhandled error${r?` during execution of ${r}`:""}`),n&&it(),o)throw e;console.error(e)}else{if(i)throw e;console.error(e)}}const h=[];let E=-1;const T=[];let k=null,$=0;const ft=Promise.resolve();let se=null;const pt=100;function dt(e){let t=E+1,n=h.length;for(;t<n;){const o=t+n>>>1,i=h[o],r=z(i);r<e||r===e&&i.flags&2?t=o+1:n=o}return t}function mt(e){if(!(e.flags&1)){const t=z(e),n=h[h.length-1];!n||!(e.flags&2)&&t>=z(n)?h.push(e):h.splice(dt(t),0,e),e.flags|=1,Ne()}}function Ne(){se||(se=ft.then(ke))}function ht(e){C(e)?T.push(...e):k&&e.id===-1?k.splice($+1,0,e):e.flags&1||(T.push(e),e.flags|=1),Ne()}function yt(e){if(T.length){const t=[...new Set(T)].sort((n,o)=>z(n)-z(o));if(T.length=0,k){k.push(...t);return}for(k=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),$=0;$<k.length;$++){const n=k[$];process.env.NODE_ENV!=="production"&&we(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}k=null,$=0}}const z=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=>we(e,n):ge;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),L(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,yt(e),se=null,(h.length||T.length)&&ke(e)}}function we(e,t){const n=e.get(t)||0;if(n>pt){const o=t.i,i=o&&Ae(o.type);return ie(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. 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 le=new Map;process.env.NODE_ENV!=="production"&&(x().__VUE_HMR_RUNTIME__={createRecord:ae(gt),rerender:ae(_t),reload:ae(Ct)});const v=new Map;function gt(e,t){return v.has(e)?!1:(v.set(e,{initialDef:U(t),instances:new Set}),!0)}function U(e){return Pe(e)?e.__vccOpts:e}function _t(e,t){const n=v.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(o=>{t&&(o.render=t,U(o.type).render=t),o.renderCache=[],o.job.flags&8||o.update()}))}function Ct(e,t){const n=v.get(e);if(!n)return;t=U(t),Oe(n.initialDef,t);const o=[...n.instances];for(let i=0;i<o.length;i++){const r=o[i],l=U(r.type);let c=le.get(l);c||(l!==n.initialDef&&Oe(l,t),le.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?mt(()=>{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)}ht(()=>{le.clear()})}function Oe(e,t){Z(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function ae(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,B=[];function Ve(e,t){var n,o;M=e,M?(M.enabled=!0,B.forEach(({event:i,args:r})=>M.emit(i,...r)),B=[]):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=>{Ve(r,t)}),setTimeout(()=>{M||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,B=[])},3e3)):B=[]}let J=null,bt=null;const Et=e=>e.__isTeleport;function Ie(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ie(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}x().requestIdleCallback,x().cancelIdleCallback;function St(e,t,n=K,o=!1){if(n){const i=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...l)=>{const c=Pt(n),a=Se(t,n,e,l);return c(),a});return o?i.unshift(r):i.push(r),r}else if(process.env.NODE_ENV!=="production"){const i=Ze(re[e].replace(/ hook$/,""));N(`${i} 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 Nt=(e=>(t,n=K)=>{(!Me||e==="sp")&&St(e,(...o)=>t(...o),n)})("u"),kt=Symbol.for("v-ndc"),wt={};process.env.NODE_ENV!=="production"&&(wt.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 Ot={},De=e=>Object.getPrototypeOf(e)===Ot,Vt=e=>e.__isSuspense,Re=Symbol.for("v-fgt"),It=Symbol.for("v-txt"),Dt=Symbol.for("v-cmt");function Rt(e){return e?e.__v_isVNode===!0:!1}const Ft=(...e)=>Te(...e),Fe=({key:e})=>e??null,W=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?S(e)||be(e)||b(e)?{i:J,r:e,k:t,f:!!n}:e:null);function Tt(e,t=null,n=null,o=0,i=null,r=e===Re?0:1,l=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Fe(t),ref:t&&W(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:i,dynamicChildren:null,appContext:null,ctx:J};return c?(ce(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 $t=process.env.NODE_ENV!=="production"?Ft:Te;function Te(e,t=null,n=null,o=0,i=null,r=!1){if((!e||e===kt)&&(process.env.NODE_ENV!=="production"&&!e&&N(`Invalid vnode type when creating vnode: ${e}.`),e=Dt),Rt(e)){const c=q(e,t,!0);return n&&ce(c,n),c.patchFlag=-2,c}if(Pe(e)&&(e=e.__vccOpts),t){t=Mt(t);let{class:c,style:a}=t;c&&!S(c)&&(t.class=te(c)),P(a)&&(ne(a)&&!C(a)&&(a=Z({},a)),t.style=ee(a))}const l=S(e)?1:Vt(e)?128:Et(e)?64:P(e)?4:b(e)?2:0;return process.env.NODE_ENV!=="production"&&l&4&&ne(e)&&(e=j(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)),Tt(e,t,n,o,i,l,r,!0)}function Mt(e){return e?ne(e)||De(e)?Z({},e):e:null}function q(e,t,n=!1,o=!1){const{props:i,ref:r,patchFlag:l,children:c,transition:a}=e,u=t?Ht(i||{},t):i,m={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Fe(u),ref:t&&t.ref?n&&r?C(r)?r.concat(W(t)):[r,W(t)]:W(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&l===-1&&C(c)?c.map($e):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Re?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&&q(e.ssContent),ssFallback:e.ssFallback&&q(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&o&&Ie(m,a.clone(m)),m}function $e(e){const t=q(e);return C(e.children)&&(t.children=e.children.map($e)),t}function At(e=" ",t=0){return $t(It,null,e,t)}function ce(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(C(t))n=16;else if(typeof t=="object")if(o&65){const i=t.default;i&&(i._c&&(i._d=!1),ce(e,i()),i._c&&(i._d=!0));return}else n=32,!t._&&!De(t)&&(t._ctx=J);else b(t)?(t={default:t,_ctx:J},n=32):(t=String(t),o&64?(n=16,t=[At(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ht(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const i in o)if(i==="class")t.class!==o.class&&(t.class=te([t.class,o.class]));else if(i==="style")t.style=ee([t.style,o.style]);else if(Ye(i)){const r=t[i],l=o[i];l&&r!==l&&!(C(r)&&r.includes(l))&&(t[i]=r?[].concat(r,l):l)}else i!==""&&(t[i]=o[i])}return t}let K=null,ue;{const e=x(),t=(n,o)=>{let i;return(i=e[n])||(i=e[n]=[]),i.push(o),r=>{i.length>1?i.forEach(l=>l(r)):i[0](r)}};ue=t("__VUE_INSTANCE_SETTERS__",n=>K=n),t("__VUE_SSR_SETTERS__",n=>Me=n)}const Pt=e=>{const t=K;return ue(e),e.scope.on(),()=>{e.scope.off(),ue(t)}};let Me=!1;process.env.NODE_ENV;const zt=/(?:^|[-_])\w/g,xt=e=>e.replace(zt,t=>t.toUpperCase()).replace(/[-_]/g,"");function Ae(e,t=!0){return b(e)?e.displayName||e.name:e.name||t&&e.__name}function He(e,t,n=!1){let o=Ae(t);if(!o&&t.__file){const i=t.__file.match(/([^/\\]+)\.\w+$/);i&&(o=i[1])}if(!o&&e){const i=r=>{for(const l in r)if(r[l]===t)return l};o=i(e.components)||e.parent&&i(e.parent.type.components)||i(e.appContext.components)}return o?xt(o):n?"App":"Anonymous"}function Pe(e){return b(e)&&"__vccOpts"in e}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;const jt=s.defineComponent({inheritAttrs:!0,__name:"MyopVueComponent",props:{flowId:{},componentId:{},onReady:{type:Function}},setup(e,{expose:t}){const n=e,o=s.useAttrs(),i=s.useSlots(),r=s.ref(null),l=s.ref(!0),c=s.ref(null),a=s.ref(null),u=s.getCurrentInstance(),m=s.ref(null);Nt(()=>{a&&a.value&&a.value(o)}),s.onMounted(async()=>{if(r.value){const D=await g.CloudRepository.Main.fetchComponent(n.componentId,n.flowId);c.value=await V.hostSDK.loadComponent(D,r==null?void 0:r.value,{_environment:{props:o,slots:i,context:u==null?void 0:u.appContext,vueContainerRef:r,defineUpdater:w=>{a.value=w},defineInnerVueComponentRef:w=>{m.value=w.value}}}),l.value=!1,n.onReady&&n.onReady(c.value,m.value)}});const _=s.reactive({});return t(_),s.watchEffect(()=>{Object.assign(_,m.value)}),(D,w)=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createElementVNode("div",s.mergeProps(s.unref(o),{ref_key:"myopContainer",ref:r}),null,16),l.value?s.renderSlot(D.$slots,"loading",{key:0}):s.createCommentVNode("",!0)],64))}});Object.defineProperty(d,"enableLocalDev",{enumerable:!0,get:()=>g.enableLocalDev}),Object.defineProperty(d,"getCloudRepository",{enumerable:!0,get:()=>g.getCloudRepository}),Object.defineProperty(d,"getPreloadedParams",{enumerable:!0,get:()=>g.getPreloadedParams}),Object.defineProperty(d,"isPreloaded",{enumerable:!0,get:()=>g.isPreloaded}),Object.defineProperty(d,"preloadComponents",{enumerable:!0,get:()=>g.preloadComponents}),Object.defineProperty(d,"setCloudRepository",{enumerable:!0,get:()=>g.setCloudRepository}),Object.defineProperty(d,"setCloudRepositoryUrl",{enumerable:!0,get:()=>g.setCloudRepositoryUrl}),Object.defineProperty(d,"setEnvironment",{enumerable:!0,get:()=>g.setEnvironment}),d.MyopComponent=qe,d.MyopContainer=jt,d.MyopFallback=ye,d.MyopLoader=he,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.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "vite",
|
|
23
23
|
"build": "vite build && vue-tsc --emitDeclarationOnly",
|
|
24
|
+
"test": "vitest run",
|
|
24
25
|
"preview": "vite preview",
|
|
25
26
|
"release": "npm publish --access public"
|
|
26
27
|
},
|
|
@@ -29,13 +30,14 @@
|
|
|
29
30
|
"vue": "^3.5.13"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@myop/sdk": "^0.3.
|
|
33
|
+
"@myop/sdk": "^0.3.19",
|
|
33
34
|
"@types/node": "^22.14.0",
|
|
34
35
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
35
36
|
"@vue/tsconfig": "^0.7.0",
|
|
36
37
|
"prettier": "^3.5.3",
|
|
37
38
|
"typescript": "~5.7.2",
|
|
38
39
|
"vite": "^6.2.0",
|
|
40
|
+
"vitest": "^4.0.18",
|
|
39
41
|
"vue-tsc": "^2.2.4"
|
|
40
42
|
},
|
|
41
43
|
"keywords": [
|