mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-05 19:41:40 +08:00
2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
var Ce=Object.defineProperty;var Z=Object.getOwnPropertySymbols;var je=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var q=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))je.call(t,n)&&q(e,n,t[n]);if(Z)for(var n of Z(t))Ee.call(t,n)&&q(e,n,t[n]);return e};import{n as A,t as Me}from"./vueComponentNormalizer.e7d45796.js";var ke=function(e){return Object.prototype.toString.call(e)};function ee(e){return typeof e=="function"&&/native code/.test(e.toString())}var Ae=typeof Symbol!="undefined"&&ee(Symbol)&&typeof Reflect!="undefined"&&ee(Reflect.ownKeys),x=function(e){return e};function p(e,t,n){var r=n.get,i=n.set;Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:r||x,set:i||x})}function le(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function S(e,t){return Object.hasOwnProperty.call(e,t)}function k(e){return Array.isArray(e)}function ve(e){return e!==null&&typeof e=="object"}function h(e){return ke(e)==="[object Object]"}function m(e){return typeof e=="function"}var G=void 0;try{var b=require("vue");b&&te(b)?G=b:b&&"default"in b&&te(b.default)&&(G=b.default)}catch{}var Q=null,D=null,de="__composition_api_installed__";function te(e){return e&&m(e)&&e.name==="Vue"}function Pe(e){return S(e,de)}function C(){return Q}function Ne(){var e=Q||G;return e}function Te(e){Q=e,Object.defineProperty(e,de,{configurable:!0,writable:!0,value:!0})}function K(e){D=e}function Fe(){return D}function y(){return D?I(D):null}var B=new WeakMap;function I(e){if(B.has(e))return B.get(e);var t={proxy:e,update:e.$forceUpdate,uid:e._uid,emit:e.$emit.bind(e),parent:null,root:null},n=["data","props","attrs","refs","vnode","slots"];return n.forEach(function(r){p(t,r,{get:function(){return e["$"+r]}})}),p(t,"isMounted",{get:function(){return e._isMounted}}),p(t,"isUnmounted",{get:function(){return e._isDestroyed}}),p(t,"isDeactivated",{get:function(){return e._inactive}}),p(t,"emitted",{get:function(){return e._events}}),B.set(e,t),e.$parent&&(t.parent=I(e.$parent)),e.$root&&(t.root=I(e.$root)),t}function _e(e){var t=y();return t==null?void 0:t.proxy}function H(e,t){t===void 0&&(t={});var n=e.config.silent;e.config.silent=!0;var r=new e(t);return e.config.silent=n,r}function De(e){var t=C();return t&&e instanceof t}function Ke(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(!!e.$scopedSlots[t])return e.$scopedSlots[t].apply(e,n)}}function He(e,t){var n;if(!e)n={};else{if(e._normalized)return e._normalized;n={};for(var r in e)e[r]&&r[0]!=="$"&&(n[r]=!0)}for(var r in t)r in n||(n[r]=!0);return n}var U,We=function(){if(!U){var e=H(C(),{computed:{value:function(){return 0}}}),t=e._computedWatchers.value.constructor,n=e._data.__ob__.dep.constructor;U={Watcher:t,Dep:n},e.$destroy()}return U};function pe(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,u=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)u.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return u}function Ue(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}var M="composition-api.refKey",ne=new WeakMap,ze=new WeakMap,ge=function(){function e(t){var n=t.get,r=t.set;p(this,"value",{get:n,set:r})}return e}();function V(e,t){var n=new ge(e),r=Object.seal(n);return ze.set(r,!0),r}function re(e){var t;if(g(e))return e;var n=X((t={},t[M]=e,t));return V({get:function(){return n[M]},set:function(r){return n[M]=r}})}function g(e){return e instanceof ge}function Le(e){if(!h(e))return e;var t={};for(var n in e)t[n]=Ge(e,n);return t}function Ge(e,t){var n=e[t];return g(n)?n:V({get:function(){return e[t]},set:function(r){return e[t]=r}})}function O(e){var t;return Boolean(e&&S(e,"__ob__")&&typeof e.__ob__=="object"&&((t=e.__ob__)===null||t===void 0?void 0:t.__raw__))}function E(e){var t;return Boolean(e&&S(e,"__ob__")&&typeof e.__ob__=="object"&&!(!((t=e.__ob__)===null||t===void 0)&&t.__raw__))}function J(e){if(!(!h(e)||O(e)||k(e)||g(e)||De(e)||ne.has(e))){ne.set(e,!0);for(var t=Object.keys(e),n=0;n<t.length;n++)Ie(e,t[n])}}function Ie(e,t,n){if(t!=="__ob__"&&!O(e[t])){var r,i,u=Object.getOwnPropertyDescriptor(e,t);if(u){if(u.configurable===!1)return;r=u.get,i=u.set,(!r||i)&&arguments.length===2&&(n=e[t])}J(n),p(e,t,{get:function(){var a=r?r.call(e):n;return t!==M&&g(a)?a.value:a},set:function(a){if(!(r&&!i)){var c=r?r.call(e):n;t!==M&&g(c)&&!g(a)?c.value=a:i?i.call(e,a):n=a,J(a)}}})}}function ye(e){var t=Ne(),n;if(t.observable)n=t.observable(e);else{var r=H(t,{data:{$$state:e}});n=r._data.$$state}return S(n,"__ob__")||me(n),n}function me(e,t){var n,r;if(t===void 0&&(t=new Set),!t.has(e)){le(e,"__ob__",Je(e)),t.add(e);try{for(var i=pe(Object.keys(e)),u=i.next();!u.done;u=i.next()){var o=u.value,a=e[o];!(h(a)||k(a))||O(a)||!Object.isExtensible(a)||me(a,t)}}catch(c){n={error:c}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}function Je(e){return e===void 0&&(e={}),{value:e,dep:{notify:x,depend:x,addSub:x,removeSub:x}}}function Qe(){return ye({}).__ob__}function X(e){if(!ve(e)||!(h(e)||k(e))||O(e)||!Object.isExtensible(e))return e;var t=ye(e);return J(t),t}var Ve=function(e){return"on"+(e[0].toUpperCase()+e.slice(1))};function he(e){return function(t){var n=_e(Ve(e));return n&&Xe(C(),n,e,t)}}function Xe(e,t,n,r){var i=t.$options,u=e.config.optionMergeStrategies[n],o=Ye(t,r);return i[n]=u(i[n],o),o}function Ye(e,t){return function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var u=(n=y())===null||n===void 0?void 0:n.proxy;K(e);try{return t.apply(void 0,Ue([],Be(r)))}finally{K(u)}}}var Ze=he("mounted"),qe=he("destroyed");function R(e){var t,n=(t=y())===null||t===void 0?void 0:t.proxy,r,i;m(e)?r=e:(r=e.get,i=e.set);var u,o;if(n&&!n.$isServer){var a=We(),c=a.Watcher,v=a.Dep,f;o=function(){return f||(f=new c(n,r,x,{lazy:!0})),f.dirty&&f.evaluate(),v.target&&f.depend(),f.value},u=function(d){i&&i(d)}}else{var s=H(C(),{computed:{$$state:{get:r,set:i}}});n&&n.$on("hook:destroyed",function(){return s.$destroy()}),o=function(){return s.$$state},u=function(d){s.$$state=d}}return V({get:o,set:u})}var $e={};function et(e,t){for(var n=t;n;){if(n._provided&&S(n._provided,e))return n._provided[e];n=n.$parent}return $e}function tt(e,t){var n=_e();if(!!n){if(!n._provided){var r={};p(n,"_provided",{get:function(){return r},set:function(i){return Object.assign(r,i)}})}n._provided[e]=t}}function be(e,t,n){var r;n===void 0&&(n=!1);var i=(r=y())===null||r===void 0?void 0:r.proxy;if(!!i){if(!e)return t;var u=et(e,i);return u!==$e?u:n&&m(t)?t():t}}var F,ie=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=(t=y())===null||t===void 0?void 0:t.proxy;return i?i.$createElement.apply(i,n):(F||(F=H(C()).$createElement),F.apply(F,n))};function nt(e,t,n){var r=e.__composition_api_state__=e.__composition_api_state__||{};r[t]=n}function rt(e,t){return(e.__composition_api_state__||{})[t]}var w={set:nt,get:rt};function it(e,t,n){var r=e.$options.props;!(t in e)&&!(r&&S(r,t))&&(g(n)?p(e,t,{get:function(){return n.value},set:function(i){n.value=i}}):p(e,t,{get:function(){return E(n)&&n.__ob__.dep.depend(),n},set:function(i){n=i}}))}function z(e){var t=w.get(e,"rawBindings")||{};if(!(!t||!Object.keys(t).length)){for(var n=e.$refs,r=w.get(e,"refs")||[],i=0;i<r.length;i++){var u=r[i],o=t[u];!n[u]&&o&&g(o)&&(o.value=null)}for(var a=Object.keys(n),c=[],i=0;i<a.length;i++){var u=a[i],o=t[u];n[u]&&o&&g(o)&&(o.value=n[u],c.push(u))}w.set(e,"refs",c)}}function oe(e,t){var n=e.$options._parentVnode;if(!!n){for(var r=w.get(e,"slots")||[],i=He(n.data.scopedSlots,e.$slots),u=0;u<r.length;u++){var o=r[u];i[o]||delete t[o]}for(var a=Object.keys(i),u=0;u<a.length;u++){var o=a[u];t[o]||(t[o]=Ke(e,o))}w.set(e,"slots",a)}}function L(e,t,n){var r=Fe();K(e);try{return t(e)}catch(i){if(n)n(i);else throw i}finally{K(r)}}function ot(e){e.mixin({beforeCreate:t,mounted:function(){z(this)},updated:function(){var o;z(this),!((o=this.$vnode)===null||o===void 0)&&o.context&&z(this.$vnode.context)}});function t(){var o=this,a=o.$options,c=a.setup,v=a.render;if(v&&(a.render=function(){for(var s=this,d=[],_=0;_<arguments.length;_++)d[_]=arguments[_];return L(o,function(){return v.apply(s,d)})}),!!c&&!!m(c)){var f=a.data;a.data=function(){return n(o,o.$props),m(f)?f.call(o,o):f||{}}}}function n(o,a){a===void 0&&(a={});var c=o.$options.setup,v=u(o);le(a,"__ob__",Qe()),oe(o,v.slots);var f;if(L(o,function(){f=c(a,v)}),!!f){if(m(f)){var s=f;o.$options.render=function(){return oe(o,v.slots),L(o,function(){return s()})};return}else if(h(f)){E(f)&&(f=Le(f)),w.set(o,"rawBindings",f);var d=f;Object.keys(d).forEach(function(_){var l=d[_];if(!g(l))if(E(l))k(l)&&(l=re(l));else if(m(l)){var $=l;l=l.bind(o),Object.keys($).forEach(function(P){l[P]=$[P]})}else ve(l)?i(l)&&r(l):l=re(l);it(o,_,l)});return}}}function r(o,a){if(a===void 0&&(a=new Set),!a.has(o)&&!(!h(o)||g(o)||E(o)||O(o))){var c=C(),v=c.util.defineReactive;Object.keys(o).forEach(function(f){var s=o[f];v(o,f,s),s&&(a.add(s),r(s,a))})}}function i(o,a){return a===void 0&&(a=new Map),a.has(o)?a.get(o):(a.set(o,!1),k(o)&&E(o)?(a.set(o,!0),!0):!h(o)||O(o)?!1:Object.keys(o).some(function(c){return i(o[c],a)}))}function u(o){var a={slots:{}},c=["root","parent","refs","listeners","isServer","ssrContext"],v=["attrs"],f=["emit"];return c.forEach(function(s){var d="$"+s;p(a,s,{get:function(){return o[d]},set:function(){}})}),v.forEach(function(s){var d="$"+s;p(a,s,{get:function(){var _,l,$=X({}),P=o[d],Oe=function(T){p($,T,{get:function(){return o[d][T]}})};try{for(var N=pe(Object.keys(P)),j=N.next();!j.done;j=N.next()){var Re=j.value;Oe(Re)}}catch(T){_={error:T}}finally{try{j&&!j.done&&(l=N.return)&&l.call(N)}finally{if(_)throw _.error}}return $},set:function(){}})}),f.forEach(function(s){var d="$"+s;p(a,s,{get:function(){return function(){for(var _=[],l=0;l<arguments.length;l++)_[l]=arguments[l];var $=o[d];$.apply(o,_)}}})}),a}}function xe(e,t){if(!e)return t;if(!t)return e;for(var n,r,i,u=Ae?Reflect.ownKeys(e):Object.keys(e),o=0;o<u.length;o++)n=u[o],n!=="__ob__"&&(r=t[n],i=e[n],S(t,n)?r!==i&&h(r)&&!g(r)&&h(i)&&!g(i)&&xe(i,r):t[n]=i);return t}function at(e){Pe(e)||(e.config.optionMergeStrategies.setup=function(t,n){return function(i,u){return xe(m(t)?t(i,u)||{}:void 0,m(n)?n(i,u)||{}:void 0)}},Te(e),ot(e))}var ut={install:function(e){return at(e)}};typeof window!="undefined"&&window.Vue&&window.Vue.use(ut);var Y=e=>{var i,u;const t=be("app"),n=(i=t==null?void 0:t.page)==null?void 0:i.getNode(e.config.id),r=(u=y())==null?void 0:u.proxy;return n==null||n.emit("created",r),Ze(()=>{n==null||n.emit("mounted",r)}),qe(()=>{n==null||n.emit("destroy",r)}),t},ct={name:"magic-ui-page",props:{config:{type:Object,defautl:()=>({})}},setup(e){e.config&&Y(e)}},ft=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("magic-ui-container",{staticClass:"magic-ui-page",attrs:{config:e.config}},[e._t("default")],2)},st=[];const ae={};var lt=A(ct,ft,st,!1,vt,null,null,null);function vt(e){for(let t in ae)this[t]=ae[t]}var dt=function(){return lt.exports}(),Se=()=>{var t;const e=(t=y())==null?void 0:t.proxy;return{show:()=>{e.$set(e.config.style,"display","initial")},hide:()=>{e.$set(e.config.style,"display","none")}}},_t={name:"magic-ui-component",props:{config:{type:Object,default:()=>({})}},setup(e){var r;const t=(r=y())==null?void 0:r.proxy,n=Y(e);return tt("hoc",t),W({tagName:R(()=>`magic-ui-${Me(e.config.type)}`),style:R(()=>n==null?void 0:n.transformStyle(e.config.style||{})),display:()=>{var u;const i=(u=e.config)==null?void 0:u.display;return typeof i=="function"?i(n):i!==!1}},Se())}},pt=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.display()?n(e.tagName,{tag:"component",class:"magic-ui-component"+(e.config.className?" "+e.config.className:""),style:e.style,attrs:{id:e.config.id,config:e.config}}):e._e()},gt=[];const ue={};var yt=A(_t,pt,gt,!1,mt,null,null,null);function mt(e){for(let t in ue)this[t]=ue[t]}var we=function(){return yt.exports}(),ht={name:"magic-ui-container",components:{"magic-ui-component":we},props:{config:{type:Object,default:()=>({})}},setup(e){const t=Y(e);return W({style:R(()=>t==null?void 0:t.transformStyle(e.config.style||{})),display:()=>{var r;const n=(r=e.config)==null?void 0:r.display;return typeof n=="function"?n(t):n!==!1}},Se())}},$t=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.display()?n("div",{class:"magic-ui-container"+(e.config.className?" "+e.config.className:""),style:e.style,attrs:{id:e.config.id}},[e._t("default"),e._l(e.config.items,function(r){return n("magic-ui-component",{key:r.id,attrs:{config:r}})})],2):e._e()},bt=[];const ce={};var xt=A(ht,$t,bt,!1,St,null,null,null);function St(e){for(let t in ce)this[t]=ce[t]}var wt=function(){return xt.exports}(),Ot={name:"magic-ui-button",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var a;const t=(a=y())==null?void 0:a.proxy,n=X([]),r=R(()=>[typeof e.config.preAction=="function"?e.config.preAction:()=>!0,...n,typeof e.config.postAction=="function"?e.config.postAction:()=>!0]);function i(c){n.push(c)}async function u(){for(const c of r.value)if(typeof c=="function"&&await c(t,{model:e.model})===!1)break}const o=R(()=>{var c,v,f;return{type:"text",text:((c=e.config)==null?void 0:c.text)||"",disabledText:((v=e.config)==null?void 0:v.disabledText)||"",html:((f=e.config)==null?void 0:f.html)||""}});return{pushAction:i,clickHandler:u,textConfig:o}}},Rt=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("button",{staticClass:"magic-ui-button",on:{click:e.clickHandler}},[e._t("default",function(){return[n("magic-ui-text",{attrs:{config:e.textConfig}})]})],2)},Ct=[];const fe={};var jt=A(Ot,Rt,Ct,!1,Et,null,null,null);function Et(e){for(let t in fe)this[t]=fe[t]}var Mt=function(){return jt.exports}(),kt={name:"magic-ui-text",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})},vars:{type:Object,default:()=>({})}},setup(e){var i;const t=(i=y())==null?void 0:i.proxy,n=be("hoc");return{displayText:R(()=>{var a,c;let u=((a=e.config)==null?void 0:a.text)||"";const{vars:o}=e;if((n==null?void 0:n.disabled)&&((c=e.config)==null?void 0:c.disabledText)&&(u=e.config.disabledText),typeof u=="function")return u.bind(t)(t,{model:e.model});if(Object.prototype.toString.call(o)==="[object Object]"){let v=u;return Object.entries(o).forEach(([f,s])=>{v=v.replace(new RegExp(`{{${f}}}`,"g"),s)}),v}return u||""})}},render(){var t,n,r,i;const e=(t=this.config)!=null&&t.multiple?"magic-ui-text":"magic-ui-text magic-ui-text--single-line";return typeof((n=this.$slots)==null?void 0:n.default)=="function"?ie("span",{class:e},[((i=(r=this.$slots)==null?void 0:r.default)==null?void 0:i.call(r))||""]):ie("span",{class:e,domProps:{innerHTML:this.displayText}})}};let At,Pt;const se={};var Nt=A(kt,At,Pt,!1,Tt,null,null,null);function Tt(e){for(let t in se)this[t]=se[t]}var Ft=function(){return Nt.exports}();const Dt={page:dt,container:wt,button:Mt,text:Ft,component:we},Kt={},Ht={components:Dt,plugins:Kt};window.magicPresetComponents=Ht;export{Ht as e};
|