@chamn/engine 0.3.9 → 0.3.11
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.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -162,7 +162,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
162
162
|
*
|
|
163
163
|
* This source code is licensed under the MIT license found in the
|
|
164
164
|
* LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/var vk;function Ese(){if(vk)return Un;vk=1;function e(a){var s="https://react.dev/errors/"+a;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+a+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(a){var s=a,l=a;if(a.alternate)for(;s.return;)s=s.return;else{a=s;do s=a,s.flags&4098&&(l=s.return),a=s.return;while(a)}return s.tag===3?l:null}function n(a){if(t(a)!==a)throw Error(e(188))}function r(a){var s=a.alternate;if(!s){if(s=t(a),s===null)throw Error(e(188));return s!==a?null:a}for(var l=a,c=s;;){var u=l.return;if(u===null)break;var d=u.alternate;if(d===null){if(c=u.return,c!==null){l=c;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===l)return n(u),a;if(d===c)return n(u),s;d=d.sibling}throw Error(e(188))}if(l.return!==c.return)l=u,c=d;else{for(var f=!1,h=u.child;h;){if(h===l){f=!0,l=u,c=d;break}if(h===c){f=!0,c=u,l=d;break}h=h.sibling}if(!f){for(h=d.child;h;){if(h===l){f=!0,l=d,c=u;break}if(h===c){f=!0,c=d,l=u;break}h=h.sibling}if(!f)throw Error(e(189))}}if(l.alternate!==c)throw Error(e(190))}if(l.tag!==3)throw Error(e(188));return l.stateNode.current===l?a:s}function o(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a;for(a=a.child;a!==null;){if(s=o(a),s!==null)return s;a=a.sibling}return null}function i(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a;for(a=a.child;a!==null;){if(a.tag!==4&&(s=i(a),s!==null))return s;a=a.sibling}return null}return Un.doesFiberContain=function(a,s){for(var l=a.alternate;s!==null;){if(s===a||s===l)return!0;s=s.return}return!1},Un.findCurrentFiberUsingSlowPath=r,Un.findCurrentHostFiber=function(a){return a=r(a),a!==null?o(a):null},Un.findCurrentHostFiberWithNoPortals=function(a){return a=r(a),a!==null?i(a):null},Un.getContainerFromFiber=function(a){return a.tag===3?a.stateNode.containerInfo:null},Un.getNearestMountedFiber=t,Un.getSuspenseInstanceFromFiber=function(a){if(a.tag===13){var s=a.memoizedState;if(s===null&&(a=a.alternate,a!==null&&(s=a.memoizedState)),s!==null)return s.dehydrated}return null},Un.isFiberMounted=function(a){return t(a)===a},Un.isFiberSuspenseAndTimedOut=function(a){var s=a.memoizedState;return a.tag===13&&s!==null&&s.dehydrated===null},Un.isMounted=function(a){return(a=a._reactInternals)?t(a)===a:!1},Un}var yk;function kse(){return yk||(yk=1,mk.exports=Ese()),mk.exports}var Ose=kse();function Nse(e){return e._reactInternals}function Rse(e){const t=Nse(e);if(t===void 0){if(typeof e.render=="function")throw new Error("Unable to find node on an unmounted component.");{const r=Object.keys(e).join(",");throw new Error(`Argument appears to not be a ReactComponent. Keys: ${r}`)}}const n=Ose.findCurrentHostFiber(t);return n===null?null:n.stateNode}function Tse(e){return Rse(e)}class Ase{constructor(){ge(this,"instanceMap",new Map)}get(t){return this.instanceMap.get(t)}add(t,n){const r=this.instanceMap.get(t);r?r.push(n):this.instanceMap.set(t,[n])}remove(t,n){const r=this.instanceMap.get(t);if(n!==void 0&&Array.isArray(r)){const o=r.filter(i=>i!==n);this.instanceMap.set(t,o)}else this.instanceMap.delete(t)}destroy(){this.instanceMap.clear()}}const Pse=e=>{const{node:t}=e,n=v.useMemo(()=>{const s=t.isContainer();return Es(s)?s:{placeholder:"Drag the component to place it",width:"100%",height:"100%",style:{}}},[e.node]),{placeholder:r,height:o,width:i,style:a}=n;return v.createElement("div",{style:{margin:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(200,200,200,0.1)",border:"1px solid rgba(0,0,0,0.1)",borderRadius:"2px",fontSize:"14px",color:"gray",cursor:"default",minHeight:"50px",width:i,height:o,...a}},r)};class NOe extends v.Component{constructor(t){super(t),ge(this,"instanceManager",new Ase),ge(this,"renderRef"),ge(this,"dropPlaceholder",Pse),ge(this,"_components",{}),ge(this,"onGetComponent",(n,r)=>{var o,i;const a=this;let s=n;const l=(i=(o=r.material)==null?void 0:o.value.advanceCustom)==null?void 0:i.wrapComponent;l&&(s=l(n,{node:r,ctx:window.__C_ENGINE_DESIGNER_PLUGIN_CTX__}));class c extends v.Component{constructor(){super(...arguments),ge(this,"_DESIGN_BOX",!0),ge(this,"_NODE_MODEL",r),ge(this,"_NODE_ID",r.id),ge(this,"_UNIQUE_ID",`${r.id}_${ao()}`),ge(this,"_STATUS"),ge(this,"_design_target_component"),ge(this,"_dom")}componentDidMount(){a.instanceManager.add(r.id,this)}getTargetComponentRef(){return this._design_target_component}componentWillUnmount(){this._STATUS="DESTROY",a.instanceManager.remove(r.id,this)}getDom(){var d,f;return((f=(d=r.material)==null?void 0:d.value.advanceCustom)==null?void 0:f.autoGetDom)??!0?Tse(this):this._dom}render(){var d,f,h,p;const{children:g=[],onlyRenderChild:m,...y}=this.props;let b=g;if(ts(g)||(b=[g]),!b.filter(Boolean).length&&(r.isContainer()||r.value.componentName===As.ROOT_CONTAINER)){const S=(f=(d=r.material)==null?void 0:d.value.advanceCustom)==null?void 0:f.dropPlaceholder;b.push(v.createElement(S||a.dropPlaceholder,{node:r}))}return m?b:((p=(h=r.material)==null?void 0:h.value.advanceCustom)==null?void 0:p.autoGetDom)??!0?v.createElement(s,y,...b):v.createElement(s,{...y,$SET_DOM:S=>{this._dom=S}},...b)}}return v.forwardRef(function(u,d){return v.createElement(_se,{node:r,targetComponent:c},v.createElement(c,{ref:d,...u}))})}),this._components=Object.assign(this._components,this.props.components),this.renderRef=v.createRef(),t.dropPlaceholder&&(this.dropPlaceholder=t.dropPlaceholder)}updateComponents(t={}){this._components=Object.assign(this._components,t),this.forceUpdate()}componentDidMount(){var t,n;window.__CHAMN_RENDER_MODE="DESIGN",this.updateComponents(this.props.components),(n=(t=this.props).onMount)==null||n.call(t,this)}getPageModel(){var t;return(t=this.renderRef.current)==null?void 0:t.state.pageModel}rerender(t){var n;return(n=this.renderRef.current)==null?void 0:n.rerender(t)}getInstancesById(t,n){let r=[...this.instanceManager.get(t)||[]];return n!==void 0&&(r=r.filter(o=>n===(o==null?void 0:o._UNIQUE_ID))),r}getInstanceByDom(t){const n=d$(t);if(!n)return null;const r=f$(n);return(r==null?void 0:r.stateNode)||null}getDomsById(t,n){const r=this.getInstancesById(t),o=[];return r==null||r.forEach(i=>{var a;if((i==null?void 0:i._STATUS)==="DESTROY")return;const s=i.getDom();if(s&&!(s instanceof Text))if(n){const l=Array.from(((a=s.querySelectorAll)==null?void 0:a.call(s,n))||[]);o.push(...l)}else o.push(s)}),o}getDomRectById(t,n){return this.getDomsById(t,n).map(r=>r==null?void 0:r.getBoundingClientRect()).filter(Boolean)}render(){const{props:t,onGetComponent:n}=this,{render:r,...o}=t;return r&&(r.ref.current=this),v.createElement(Cse,{onGetComponent:n,...o,components:this._components,processNodeConfigHook:(i,a)=>{var s,l;if(a.nodeType!=="NODE")return i;const{props:c,condition:u}=i;let d={...c};const f=((s=a.value.configure)==null?void 0:s.devState)||{},h=(l=a.material)==null?void 0:l.value.fixedProps;if(h!==void 0){if(Es(h))d={...d,...h};else if(typeof h=="function"){const g=h(d);d={...d,...g}}}let p=u;return f.condition===!1&&(p=f.condition),{props:Xee(d,f.props||{}),condition:p}},ref:this.renderRef})}}const d$=e=>{if(!e)return null;const t=Object.keys(e).find(n=>n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber$"))||"";return t?e[t]:d$(e.parentElement)},f$=e=>{var t;return e?(t=e==null?void 0:e.stateNode)!=null&&t._DESIGN_BOX?e:f$(e.return):null};var _b={exports:{}},Mse=_b.exports,bk;function jse(){return bk||(bk=1,function(e,t){(function(n,r){e.exports=r()})(Mse,function(){var n=function(){},r={},o={},i={};function a(f,h){f=f.push?f:[f];var p=[],g=f.length,m=g,y,b,S,x;for(y=function(_,k){k.length&&p.push(_),m--,m||h(p)};g--;){if(b=f[g],S=o[b],S){y(b,S);continue}x=i[b]=i[b]||[],x.push(y)}}function s(f,h){if(f){var p=i[f];if(o[f]=h,!!p)for(;p.length;)p[0](f,h),p.splice(0,1)}}function l(f,h){f.call&&(f={success:f}),h.length?(f.error||n)(h):(f.success||n)(f)}function c(f,h,p,g){var m=document,y=p.async,b=(p.numRetries||0)+1,S=p.before||n,x=f.replace(/[\?|#].*$/,""),_=f.replace(/^(css|img|module|nomodule)!/,""),k,O,C;if(g=g||0,/(^css!|\.css$)/.test(x))C=m.createElement("link"),C.rel="stylesheet",C.href=_,k="hideFocus"in C,k&&C.relList&&(k=0,C.rel="preload",C.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(x))C=m.createElement("img"),C.src=_;else if(C=m.createElement("script"),C.src=_,C.async=y===void 0?!0:y,O="noModule"in C,/^module!/.test(x)){if(!O)return h(f,"l");C.type="module"}else if(/^nomodule!/.test(x)&&O)return h(f,"l");C.onload=C.onerror=C.onbeforeload=function(E){var N=E.type[0];if(k)try{C.sheet.cssText.length||(N="e")}catch(R){R.code!=18&&(N="e")}if(N=="e"){if(g+=1,g<b)return c(f,h,p,g)}else if(C.rel=="preload"&&C.as=="style")return C.rel="stylesheet";h(f,N,E.defaultPrevented)},S(f,C)!==!1&&m.head.appendChild(C)}function u(f,h,p){f=f.push?f:[f];var g=f.length,m=g,y=[],b,S;for(b=function(x,_,k){if(_=="e"&&y.push(x),_=="b")if(k)y.push(x);else return;g--,g||h(y)},S=0;S<m;S++)c(f[S],b,p)}function d(f,h,p){var g,m;if(h&&h.trim&&(g=h),m=(g?p:h)||{},g){if(g in r)throw"LoadJS";r[g]=!0}function y(b,S){u(f,function(x){l(m,x),b&&l({success:b,error:S},x),s(g,x)},m)}if(m.returnPromise)return new Promise(y);y()}return d.ready=function(f,h){return a(f,function(p){l(h,p)}),d},d.done=function(f){s(f,[])},d.reset=function(){r={},o={},i={}},d.isDefined=function(f){return f in r},d})}(_b)),_b.exports}var Ise=jse();const xk=sse(Ise);class $se{constructor(t,n){ge(this,"assets"),ge(this,"loadStatus"),ge(this,"win",window),ge(this,"_onSuccessList",[]),ge(this,"_onErrorList",[]),this.assets=JSON.parse(JSON.stringify(t||[])),this.loadStatus="INIT",n!=null&&n.window&&(this.win=n.window)}load(t){const n=this.assets||[],r=[];for(let o=0;o<n.length;o++){const i=n[o];i.id||(i.id=ao()),r.push(i.id);const a=i.resources.map(s=>s.src);a.length&&xk(a,i.id,{async:(t==null?void 0:t.async)??!1,before:(s,l)=>(this.win.document.body.appendChild(l),!1)})}return new Promise((o,i)=>{if(n.length===0){this._onSuccessList.forEach(a=>a()),o("");return}xk.ready(r,{success:()=>{this._onSuccessList.forEach(a=>a()),o("")},error:a=>{this._onErrorList.forEach(s=>s(a)),i(a)}})})}onSuccess(t){return this._onSuccessList.push(t),this}onError(t){return this._onErrorList.push(t),this}}const h$=async({iframe:e})=>{const t=e.getWindow();t&&(t.React=window.React,t.ReactDOM=window.ReactDOM,t.ReactDOMClient=window.ReactDOMClient)},p$=e=>async({iframe:n,assets:r,page:o,pageModel:i,ready:a,renderJSUrl:s})=>{await n.injectJS(s||"");const l=n.getWindow(),c=n.getDocument(),u=l.React,d=l.ReactDOMClient,f=l.CRender,h=o||(i==null?void 0:i.export());if(!h){console.log("page schema is empty");return}const p=j1([...r,...h.assets||[]]);new f.AssetLoader(p,{window:n.getWindow()}).onSuccess(()=>{const m=v5(p,l),y=y5(m),b=rte(m,h.thirdLibs||[]),S=u==null?void 0:u.createElement(f.DesignRender,{adapter:f==null?void 0:f.ReactAdapter,page:o,pageModel:i,components:{...y,...e.components||{}},$$context:{thirdLibs:b},onMount:x=>{a(x)},...(e==null?void 0:e.renderProps)||{}});d.createRoot(c.getElementById("app")).render(S)}).onError(()=>{console.log("资源加载出错")}).load()},Mn={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},wk={silent:{level:-1},fatal:{level:Mn.fatal},error:{level:Mn.error},warn:{level:Mn.warn},log:{level:Mn.log},info:{level:Mn.info},success:{level:Mn.success},fail:{level:Mn.fail},ready:{level:Mn.info},start:{level:Mn.info},box:{level:Mn.info},debug:{level:Mn.debug},trace:{level:Mn.trace},verbose:{level:Mn.verbose}};function Bp(e){return e!==null&&typeof e=="object"}function Eb(e,t,n=".",r){if(!Bp(t))return Eb(e,{},n);const o=Object.assign({},t);for(const i in e){if(i==="__proto__"||i==="constructor")continue;const a=e[i];a!=null&&(Array.isArray(a)&&Array.isArray(o[i])?o[i]=[...a,...o[i]]:Bp(a)&&Bp(o[i])?o[i]=Eb(a,o[i],(n?`${n}.`:"")+i.toString()):o[i]=a)}return o}function Lse(e){return(...t)=>t.reduce((n,r)=>Eb(n,r,""),{})}const Dse=Lse();function zse(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fse(e){return!(!zse(e)||!e.message&&!e.args||e.stack)}let Vp=!1;const Sk=[];class nn{constructor(t={}){const n=t.types||wk;this.options=Dse({...t,defaults:{...t.defaults},level:Hp(t.level,n),reporters:[...t.reporters||[]]},{types:wk,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in n){const o={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(o),this[r].raw=this._wrapLogFn(o,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(t){this.options.level=Hp(t,this.options.types,this.options.level)}prompt(t,n){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(t,n)}create(t){const n=new nn({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(t){return this.create({...this.options,defaults:{...this.options.defaults,...t}})}withTag(t){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+t:t})}addReporter(t){return this.options.reporters.push(t),this}removeReporter(t){if(t){const n=this.options.reporters.indexOf(t);if(n>=0)return this.options.reporters.splice(n,1)}else this.options.reporters.splice(0);return this}setReporters(t){return this.options.reporters=Array.isArray(t)?t:[t],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const t in this.options.types)console["__"+t]||(console["__"+t]=console[t]),console[t]=this[t].raw}restoreConsole(){for(const t in this.options.types)console["__"+t]&&(console[t]=console["__"+t],delete console["__"+t])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(t,n){t&&(t.__write||(t.__write=t.write),t.write=r=>{this[n].raw(String(r).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}pauseLogs(){Vp=!0}resumeLogs(){Vp=!1;const t=Sk.splice(0);for(const n of t)n[0]._logFn(n[1],n[2])}mockTypes(t){const n=t||this.options.mockFn;if(this._mockFn=n,typeof n=="function")for(const r in this.options.types)this[r]=n(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(t,n){return(...r)=>{if(Vp){Sk.push([this,t,r,n]);return}return this._logFn(t,r,n)}}_logFn(t,n,r){if((t.level||0)>this.level)return!1;const o={date:new Date,args:[],...t,level:Hp(t.level,this.options.types)};!r&&n.length===1&&Fse(n[0])?Object.assign(o,n[0]):o.args=[...n],o.message&&(o.args.unshift(o.message),delete o.message),o.additional&&(Array.isArray(o.additional)||(o.additional=o.additional.split(`
|
|
165
|
+
*/var vk;function Ese(){if(vk)return Un;vk=1;function e(a){var s="https://react.dev/errors/"+a;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+a+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(a){var s=a,l=a;if(a.alternate)for(;s.return;)s=s.return;else{a=s;do s=a,s.flags&4098&&(l=s.return),a=s.return;while(a)}return s.tag===3?l:null}function n(a){if(t(a)!==a)throw Error(e(188))}function r(a){var s=a.alternate;if(!s){if(s=t(a),s===null)throw Error(e(188));return s!==a?null:a}for(var l=a,c=s;;){var u=l.return;if(u===null)break;var d=u.alternate;if(d===null){if(c=u.return,c!==null){l=c;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===l)return n(u),a;if(d===c)return n(u),s;d=d.sibling}throw Error(e(188))}if(l.return!==c.return)l=u,c=d;else{for(var f=!1,h=u.child;h;){if(h===l){f=!0,l=u,c=d;break}if(h===c){f=!0,c=u,l=d;break}h=h.sibling}if(!f){for(h=d.child;h;){if(h===l){f=!0,l=d,c=u;break}if(h===c){f=!0,c=d,l=u;break}h=h.sibling}if(!f)throw Error(e(189))}}if(l.alternate!==c)throw Error(e(190))}if(l.tag!==3)throw Error(e(188));return l.stateNode.current===l?a:s}function o(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a;for(a=a.child;a!==null;){if(s=o(a),s!==null)return s;a=a.sibling}return null}function i(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a;for(a=a.child;a!==null;){if(a.tag!==4&&(s=i(a),s!==null))return s;a=a.sibling}return null}return Un.doesFiberContain=function(a,s){for(var l=a.alternate;s!==null;){if(s===a||s===l)return!0;s=s.return}return!1},Un.findCurrentFiberUsingSlowPath=r,Un.findCurrentHostFiber=function(a){return a=r(a),a!==null?o(a):null},Un.findCurrentHostFiberWithNoPortals=function(a){return a=r(a),a!==null?i(a):null},Un.getContainerFromFiber=function(a){return a.tag===3?a.stateNode.containerInfo:null},Un.getNearestMountedFiber=t,Un.getSuspenseInstanceFromFiber=function(a){if(a.tag===13){var s=a.memoizedState;if(s===null&&(a=a.alternate,a!==null&&(s=a.memoizedState)),s!==null)return s.dehydrated}return null},Un.isFiberMounted=function(a){return t(a)===a},Un.isFiberSuspenseAndTimedOut=function(a){var s=a.memoizedState;return a.tag===13&&s!==null&&s.dehydrated===null},Un.isMounted=function(a){return(a=a._reactInternals)?t(a)===a:!1},Un}var yk;function kse(){return yk||(yk=1,mk.exports=Ese()),mk.exports}var Ose=kse();function Nse(e){return e._reactInternals}function Rse(e){const t=Nse(e);if(t===void 0){if(typeof e.render=="function")throw new Error("Unable to find node on an unmounted component.");{const r=Object.keys(e).join(",");throw new Error(`Argument appears to not be a ReactComponent. Keys: ${r}`)}}const n=Ose.findCurrentHostFiber(t);return n===null?null:n.stateNode}function Tse(e){return Rse(e)}class Ase{constructor(){ge(this,"instanceMap",new Map)}get(t){return this.instanceMap.get(t)}add(t,n){const r=this.instanceMap.get(t);r?r.push(n):this.instanceMap.set(t,[n])}remove(t,n){const r=this.instanceMap.get(t);if(n!==void 0&&Array.isArray(r)){const o=r.filter(i=>i!==n);this.instanceMap.set(t,o)}else this.instanceMap.delete(t)}destroy(){this.instanceMap.clear()}}const Pse=e=>{const{node:t}=e,n=v.useMemo(()=>{const s=t.isContainer();return Es(s)?s:{placeholder:"Drag the component to place it",width:"100%",height:"100%",style:{}}},[e.node]),{placeholder:r,height:o,width:i,style:a}=n;return v.createElement("div",{style:{margin:0,padding:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(200,200,200,0.1)",border:"1px solid rgba(0,0,0,0.1)",borderRadius:"2px",fontSize:"14px",color:"gray",cursor:"default",minHeight:"50px",width:i,height:o,boxSizing:"border-box",...a}},r)};class NOe extends v.Component{constructor(t){super(t),ge(this,"instanceManager",new Ase),ge(this,"renderRef"),ge(this,"dropPlaceholder",Pse),ge(this,"_components",{}),ge(this,"onGetComponent",(n,r)=>{var o,i;const a=this;let s=n;const l=(i=(o=r.material)==null?void 0:o.value.advanceCustom)==null?void 0:i.wrapComponent;l&&(s=l(n,{node:r,ctx:window.__C_ENGINE_DESIGNER_PLUGIN_CTX__}));class c extends v.Component{constructor(){super(...arguments),ge(this,"_DESIGN_BOX",!0),ge(this,"_NODE_MODEL",r),ge(this,"_NODE_ID",r.id),ge(this,"_UNIQUE_ID",`${r.id}_${ao()}`),ge(this,"_STATUS"),ge(this,"_design_target_component"),ge(this,"_dom")}componentDidMount(){a.instanceManager.add(r.id,this)}getTargetComponentRef(){return this._design_target_component}componentWillUnmount(){this._STATUS="DESTROY",a.instanceManager.remove(r.id,this)}getDom(){var d,f;return((f=(d=r.material)==null?void 0:d.value.advanceCustom)==null?void 0:f.autoGetDom)??!0?Tse(this):this._dom}render(){var d,f,h,p;const{children:g=[],onlyRenderChild:m,...y}=this.props;let b=g;if(ts(g)||(b=[g]),!b.filter(Boolean).length&&(r.isContainer()||r.value.componentName===As.ROOT_CONTAINER)){const S=(f=(d=r.material)==null?void 0:d.value.advanceCustom)==null?void 0:f.dropPlaceholder;b.push(v.createElement(S||a.dropPlaceholder,{node:r}))}return m?b:((p=(h=r.material)==null?void 0:h.value.advanceCustom)==null?void 0:p.autoGetDom)??!0?v.createElement(s,y,...b):v.createElement(s,{...y,$SET_DOM:S=>{this._dom=S}},...b)}}return v.forwardRef(function(u,d){return v.createElement(_se,{node:r,targetComponent:c},v.createElement(c,{ref:d,...u}))})}),this._components=Object.assign(this._components,this.props.components),this.renderRef=v.createRef(),t.dropPlaceholder&&(this.dropPlaceholder=t.dropPlaceholder)}updateComponents(t={}){this._components=Object.assign(this._components,t),this.forceUpdate()}componentDidMount(){var t,n;window.__CHAMN_RENDER_MODE="DESIGN",this.updateComponents(this.props.components),(n=(t=this.props).onMount)==null||n.call(t,this)}getPageModel(){var t;return(t=this.renderRef.current)==null?void 0:t.state.pageModel}rerender(t){var n;return(n=this.renderRef.current)==null?void 0:n.rerender(t)}getInstancesById(t,n){let r=[...this.instanceManager.get(t)||[]];return n!==void 0&&(r=r.filter(o=>n===(o==null?void 0:o._UNIQUE_ID))),r}getInstanceByDom(t){const n=d$(t);if(!n)return null;const r=f$(n);return(r==null?void 0:r.stateNode)||null}getDomsById(t,n){const r=this.getInstancesById(t),o=[];return r==null||r.forEach(i=>{var a;if((i==null?void 0:i._STATUS)==="DESTROY")return;const s=i.getDom();if(s&&!(s instanceof Text))if(n){const l=Array.from(((a=s.querySelectorAll)==null?void 0:a.call(s,n))||[]);o.push(...l)}else o.push(s)}),o}getDomRectById(t,n){return this.getDomsById(t,n).map(r=>r==null?void 0:r.getBoundingClientRect()).filter(Boolean)}render(){const{props:t,onGetComponent:n}=this,{render:r,...o}=t;return r&&(r.ref.current=this),v.createElement(Cse,{onGetComponent:n,...o,components:this._components,processNodeConfigHook:(i,a)=>{var s,l;if(a.nodeType!=="NODE")return i;const{props:c,condition:u}=i;let d={...c};const f=((s=a.value.configure)==null?void 0:s.devState)||{},h=(l=a.material)==null?void 0:l.value.fixedProps;if(h!==void 0){if(Es(h))d={...d,...h};else if(typeof h=="function"){const g=h(d);d={...d,...g}}}let p=u;return f.condition===!1&&(p=f.condition),{props:Xee(d,f.props||{}),condition:p}},ref:this.renderRef})}}const d$=e=>{if(!e)return null;const t=Object.keys(e).find(n=>n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber$"))||"";return t?e[t]:d$(e.parentElement)},f$=e=>{var t;return e?(t=e==null?void 0:e.stateNode)!=null&&t._DESIGN_BOX?e:f$(e.return):null};var _b={exports:{}},Mse=_b.exports,bk;function jse(){return bk||(bk=1,function(e,t){(function(n,r){e.exports=r()})(Mse,function(){var n=function(){},r={},o={},i={};function a(f,h){f=f.push?f:[f];var p=[],g=f.length,m=g,y,b,S,x;for(y=function(_,k){k.length&&p.push(_),m--,m||h(p)};g--;){if(b=f[g],S=o[b],S){y(b,S);continue}x=i[b]=i[b]||[],x.push(y)}}function s(f,h){if(f){var p=i[f];if(o[f]=h,!!p)for(;p.length;)p[0](f,h),p.splice(0,1)}}function l(f,h){f.call&&(f={success:f}),h.length?(f.error||n)(h):(f.success||n)(f)}function c(f,h,p,g){var m=document,y=p.async,b=(p.numRetries||0)+1,S=p.before||n,x=f.replace(/[\?|#].*$/,""),_=f.replace(/^(css|img|module|nomodule)!/,""),k,O,C;if(g=g||0,/(^css!|\.css$)/.test(x))C=m.createElement("link"),C.rel="stylesheet",C.href=_,k="hideFocus"in C,k&&C.relList&&(k=0,C.rel="preload",C.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(x))C=m.createElement("img"),C.src=_;else if(C=m.createElement("script"),C.src=_,C.async=y===void 0?!0:y,O="noModule"in C,/^module!/.test(x)){if(!O)return h(f,"l");C.type="module"}else if(/^nomodule!/.test(x)&&O)return h(f,"l");C.onload=C.onerror=C.onbeforeload=function(E){var N=E.type[0];if(k)try{C.sheet.cssText.length||(N="e")}catch(R){R.code!=18&&(N="e")}if(N=="e"){if(g+=1,g<b)return c(f,h,p,g)}else if(C.rel=="preload"&&C.as=="style")return C.rel="stylesheet";h(f,N,E.defaultPrevented)},S(f,C)!==!1&&m.head.appendChild(C)}function u(f,h,p){f=f.push?f:[f];var g=f.length,m=g,y=[],b,S;for(b=function(x,_,k){if(_=="e"&&y.push(x),_=="b")if(k)y.push(x);else return;g--,g||h(y)},S=0;S<m;S++)c(f[S],b,p)}function d(f,h,p){var g,m;if(h&&h.trim&&(g=h),m=(g?p:h)||{},g){if(g in r)throw"LoadJS";r[g]=!0}function y(b,S){u(f,function(x){l(m,x),b&&l({success:b,error:S},x),s(g,x)},m)}if(m.returnPromise)return new Promise(y);y()}return d.ready=function(f,h){return a(f,function(p){l(h,p)}),d},d.done=function(f){s(f,[])},d.reset=function(){r={},o={},i={}},d.isDefined=function(f){return f in r},d})}(_b)),_b.exports}var Ise=jse();const xk=sse(Ise);class $se{constructor(t,n){ge(this,"assets"),ge(this,"loadStatus"),ge(this,"win",window),ge(this,"_onSuccessList",[]),ge(this,"_onErrorList",[]),this.assets=JSON.parse(JSON.stringify(t||[])),this.loadStatus="INIT",n!=null&&n.window&&(this.win=n.window)}load(t){const n=this.assets||[],r=[];for(let o=0;o<n.length;o++){const i=n[o];i.id||(i.id=ao()),r.push(i.id);const a=i.resources.map(s=>s.src);a.length&&xk(a,i.id,{async:(t==null?void 0:t.async)??!1,before:(s,l)=>(this.win.document.body.appendChild(l),!1)})}return new Promise((o,i)=>{if(n.length===0){this._onSuccessList.forEach(a=>a()),o("");return}xk.ready(r,{success:()=>{this._onSuccessList.forEach(a=>a()),o("")},error:a=>{this._onErrorList.forEach(s=>s(a)),i(a)}})})}onSuccess(t){return this._onSuccessList.push(t),this}onError(t){return this._onErrorList.push(t),this}}const h$=async({iframe:e})=>{const t=e.getWindow();t&&(t.React=window.React,t.ReactDOM=window.ReactDOM,t.ReactDOMClient=window.ReactDOMClient)},p$=e=>async({iframe:n,assets:r,page:o,pageModel:i,ready:a,renderJSUrl:s})=>{await n.injectJS(s||"");const l=n.getWindow(),c=n.getDocument(),u=l.React,d=l.ReactDOMClient,f=l.CRender,h=o||(i==null?void 0:i.export());if(!h){console.log("page schema is empty");return}const p=j1([...r,...h.assets||[]]);new f.AssetLoader(p,{window:n.getWindow()}).onSuccess(()=>{const m=v5(p,l),y=y5(m),b=rte(m,h.thirdLibs||[]),S=u==null?void 0:u.createElement(f.DesignRender,{adapter:f==null?void 0:f.ReactAdapter,page:o,pageModel:i,components:{...y,...e.components||{}},$$context:{thirdLibs:b},onMount:x=>{a(x)},...(e==null?void 0:e.renderProps)||{}});d.createRoot(c.getElementById("app")).render(S)}).onError(()=>{console.log("资源加载出错")}).load()},Mn={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},wk={silent:{level:-1},fatal:{level:Mn.fatal},error:{level:Mn.error},warn:{level:Mn.warn},log:{level:Mn.log},info:{level:Mn.info},success:{level:Mn.success},fail:{level:Mn.fail},ready:{level:Mn.info},start:{level:Mn.info},box:{level:Mn.info},debug:{level:Mn.debug},trace:{level:Mn.trace},verbose:{level:Mn.verbose}};function Bp(e){return e!==null&&typeof e=="object"}function Eb(e,t,n=".",r){if(!Bp(t))return Eb(e,{},n);const o=Object.assign({},t);for(const i in e){if(i==="__proto__"||i==="constructor")continue;const a=e[i];a!=null&&(Array.isArray(a)&&Array.isArray(o[i])?o[i]=[...a,...o[i]]:Bp(a)&&Bp(o[i])?o[i]=Eb(a,o[i],(n?`${n}.`:"")+i.toString()):o[i]=a)}return o}function Lse(e){return(...t)=>t.reduce((n,r)=>Eb(n,r,""),{})}const Dse=Lse();function zse(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fse(e){return!(!zse(e)||!e.message&&!e.args||e.stack)}let Vp=!1;const Sk=[];class nn{constructor(t={}){const n=t.types||wk;this.options=Dse({...t,defaults:{...t.defaults},level:Hp(t.level,n),reporters:[...t.reporters||[]]},{types:wk,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in n){const o={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(o),this[r].raw=this._wrapLogFn(o,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(t){this.options.level=Hp(t,this.options.types,this.options.level)}prompt(t,n){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(t,n)}create(t){const n=new nn({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(t){return this.create({...this.options,defaults:{...this.options.defaults,...t}})}withTag(t){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+t:t})}addReporter(t){return this.options.reporters.push(t),this}removeReporter(t){if(t){const n=this.options.reporters.indexOf(t);if(n>=0)return this.options.reporters.splice(n,1)}else this.options.reporters.splice(0);return this}setReporters(t){return this.options.reporters=Array.isArray(t)?t:[t],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const t in this.options.types)console["__"+t]||(console["__"+t]=console[t]),console[t]=this[t].raw}restoreConsole(){for(const t in this.options.types)console["__"+t]&&(console[t]=console["__"+t],delete console["__"+t])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(t,n){t&&(t.__write||(t.__write=t.write),t.write=r=>{this[n].raw(String(r).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}pauseLogs(){Vp=!0}resumeLogs(){Vp=!1;const t=Sk.splice(0);for(const n of t)n[0]._logFn(n[1],n[2])}mockTypes(t){const n=t||this.options.mockFn;if(this._mockFn=n,typeof n=="function")for(const r in this.options.types)this[r]=n(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(t,n){return(...r)=>{if(Vp){Sk.push([this,t,r,n]);return}return this._logFn(t,r,n)}}_logFn(t,n,r){if((t.level||0)>this.level)return!1;const o={date:new Date,args:[],...t,level:Hp(t.level,this.options.types)};!r&&n.length===1&&Fse(n[0])?Object.assign(o,n[0]):o.args=[...n],o.message&&(o.args.unshift(o.message),delete o.message),o.additional&&(Array.isArray(o.additional)||(o.additional=o.additional.split(`
|
|
166
166
|
`)),o.args.push(`
|
|
167
167
|
`+o.additional.join(`
|
|
168
168
|
`)),delete o.additional),o.type=typeof o.type=="string"?o.type.toLowerCase():"log",o.tag=typeof o.tag=="string"?o.tag:"";const i=(s=!1)=>{const l=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&l>0){const c=[...this._lastLog.object.args];l>1&&c.push(`(repeated ${l} times)`),this._log({...this._lastLog.object,args:c}),this._lastLog.count=1}s&&(this._lastLog.object=o,this._log(o))};clearTimeout(this._lastLog.timeout);const a=this._lastLog.time&&o.date?o.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=o.date,a<this.options.throttle)try{const s=JSON.stringify([o.type,o.tag,o.args]),l=this._lastLog.serialized===s;if(this._lastLog.serialized=s,l&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(t){for(const n of this.options.reporters)n.log(t,{options:this.options})}}function Hp(e,t={},n=3){return e===void 0?n:typeof e=="number"?e:t[e]&&t[e].level!==void 0?t[e].level:n}nn.prototype.add=nn.prototype.addReporter;nn.prototype.remove=nn.prototype.removeReporter;nn.prototype.clear=nn.prototype.removeReporter;nn.prototype.withScope=nn.prototype.withTag;nn.prototype.mock=nn.prototype.mockTypes;nn.prototype.pause=nn.prototype.pauseLogs;nn.prototype.resume=nn.prototype.resumeLogs;function Bse(e={}){return new nn(e)}class Vse{constructor(t){this.options={...t},this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}_getLogFn(t){return t<1?console.__error||console.error:t===1?console.__warn||console.warn:console.__log||console.log}log(t){const n=this._getLogFn(t.level),r=t.type==="log"?"":t.type,o=t.tag||"",a=`
|
|
@@ -406,5 +406,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
406
406
|
ctx.font = "48px serif";
|
|
407
407
|
ctx.fillText("Hello Canvas", 10, 50);
|
|
408
408
|
}
|
|
409
|
-
`}}}}]},{title:"HTML 标签",componentName:"CNativeTag",props:[{name:"htmlTag",title:"标签名",valueType:"string",setters:[{componentName:"SelectSetter",props:{options:fe.HTMl_TAGS.map(e=>({name:e,value:e}))}}]},xo],isContainer:!0,groupName:"原子组件",snippets:[{title:"HTML",snapshotText:"HTML",category:"基础组件",schema:{props:{htmlTag:"div"}}}]}];E8.forEach(e=>{e.events=hOe});const gOe=E8.map(e=>({...e,npm:{name:e.componentName,package:_8,version:C8}})),mOe=[...gOe,...pOe];class k8 extends v.Component{constructor(n){super(n);Z(this,"currentSelectNode");Z(this,"pluginManager");Z(this,"workbenchRef",v.createRef());Z(this,"pageSchema");Z(this,"pageModel");Z(this,"material");Z(this,"emitter");Z(this,"assetsPackageListManager");Z(this,"workbenchConfig",{});Z(this,"_oldHiddenWidgetConfig");Z(this,"updatePage",n=>{this.pageModel.updatePage(n)});Z(this,"updateMaterials",async(n,r,o)=>{const i=await this.pluginManager.get("Designer"),a=i==null?void 0:i.export;this.pluginManager.assetsPackageListManager.setList(r),this.pageModel.assetPackagesList=this.pluginManager.assetsPackageListManager.getList();const s=a==null?void 0:a.getDesignerWindow();if(!s){console.warn("subWin not exits");return}await new $se(r,s).load();const c=v5(r,s);let u=y5(c);o!=null&&o.formatComponents&&(u=o.formatComponents(u)),a==null||a.updateRenderComponents(u),this.pageModel.materialsModel.addMaterials(n),this.emitter.emit("updateMaterials")});Z(this,"refresh",async()=>{this.pageModel.reloadPage(this.pageModel.export("design"))});Z(this,"getWorkbench",()=>this.workbenchRef.current);this.pageSchema=n.schema,this.material=n.material,this.currentSelectNode=null,window.__CHAMELEON_ENG__=this,this.assetsPackageListManager=new HI(n.assetPackagesList||[]),this.workbenchConfig=n.workbenchConfig||{};try{this.pageModel=new fe.CPage(this.pageSchema,{materials:this.material||[],assetPackagesList:n.assetPackagesList||[]})}catch(r){console.error(r),this.pageModel=new fe.CPage(fe.EmptyPage)}this.emitter=Od()}updateCurrentSelectNode(n){this.currentSelectNode=n,this.emitter.emit("onSelectNodeChange",{node:n})}async componentDidMount(){var i,a,s,l,c,u;window.__C_ENGINE__=this;const n=this.props.plugins,r=new w$({engine:this,getWorkbench:()=>this.workbenchRef.current,emitter:this.emitter,pageModel:this.pageModel,i18n:Ud,assetsPackageListManager:this.assetsPackageListManager});this.pluginManager=r,r.customPlugin("Designer",d=>(d.ctx.config.beforeInitRender=h$,d.ctx.config.customRender=p$({components:this.props.components||{},renderProps:this.props.renderProps||{}}),d.ctx.config.components=this.props.components,d)),(a=(i=this.props).beforePluginRun)==null||a.call(i,{pluginManager:this.pluginManager});const o=n.map(d=>this.pluginManager.add(d));(l=(s=this.props).onMount)==null||l.call(s,{pluginManager:this.pluginManager,engine:this}),await Promise.all(o),this.pageModel.emitter.on("onReloadPage",()=>{var f;if(console.log("🚀 ~ Engine ~ this.pageModel.emitter.on ~ onReloadPage:"),!this.currentSelectNode)return;const d=this.pageModel.getNode((f=this.currentSelectNode)==null?void 0:f.id);d&&this.updateCurrentSelectNode(d)}),(u=(c=this.props).onReady)==null||u.call(c,{pluginManager:this.pluginManager,engine:this})}getActiveNode(){var r;if(!((r=this.currentSelectNode)!=null&&r.id))return null;const n=this.pageModel.getNode(this.currentSelectNode.id)??null;return this.currentSelectNode=n,n}getI18n(){return Ud}async preview(){var i,a;const n=(i=this.workbenchRef.current)==null?void 0:i.getHiddenWidgetConfig();this._oldHiddenWidgetConfig=n,(a=this.workbenchRef.current)==null||a.hiddenWidget({hiddenLeftPanel:!0,hiddenRightPanel:!0,hiddenTopBar:!0,canvasFull:!0});const r=await this.pluginManager.get("Designer"),o=r==null?void 0:r.export;o==null||o.setPreviewMode()}async existPreview(){var o;(o=this.workbenchRef.current)==null||o.hiddenWidget({...this._oldHiddenWidgetConfig||{},canvasFull:!1});const n=await this.pluginManager.get("Designer"),r=n==null?void 0:n.export;r==null||r.setEditMode()}hiddenWidget(n){var r;(r=this.workbenchRef.current)==null||r.hiddenWidget(n||{})}render(){return w.jsx("div",{className:Le([Gse.engineContainer,this.props.className]),style:this.props.style,children:w.jsx(m$,{ref:this.workbenchRef,emitter:this.emitter,...this.workbenchConfig})})}}Z(k8,"version","0.3.
|
|
409
|
+
`}}}}]},{title:"HTML 标签",componentName:"CNativeTag",props:[{name:"htmlTag",title:"标签名",valueType:"string",setters:[{componentName:"SelectSetter",props:{options:fe.HTMl_TAGS.map(e=>({name:e,value:e}))}}]},xo],isContainer:!0,groupName:"原子组件",snippets:[{title:"HTML",snapshotText:"HTML",category:"基础组件",schema:{props:{htmlTag:"div"}}}]}];E8.forEach(e=>{e.events=hOe});const gOe=E8.map(e=>({...e,npm:{name:e.componentName,package:_8,version:C8}})),mOe=[...gOe,...pOe];class k8 extends v.Component{constructor(n){super(n);Z(this,"currentSelectNode");Z(this,"pluginManager");Z(this,"workbenchRef",v.createRef());Z(this,"pageSchema");Z(this,"pageModel");Z(this,"material");Z(this,"emitter");Z(this,"assetsPackageListManager");Z(this,"workbenchConfig",{});Z(this,"_oldHiddenWidgetConfig");Z(this,"updatePage",n=>{this.pageModel.updatePage(n)});Z(this,"updateMaterials",async(n,r,o)=>{const i=await this.pluginManager.get("Designer"),a=i==null?void 0:i.export;this.pluginManager.assetsPackageListManager.setList(r),this.pageModel.assetPackagesList=this.pluginManager.assetsPackageListManager.getList();const s=a==null?void 0:a.getDesignerWindow();if(!s){console.warn("subWin not exits");return}await new $se(r,s).load();const c=v5(r,s);let u=y5(c);o!=null&&o.formatComponents&&(u=o.formatComponents(u)),a==null||a.updateRenderComponents(u),this.pageModel.materialsModel.addMaterials(n),this.emitter.emit("updateMaterials")});Z(this,"refresh",async()=>{this.pageModel.reloadPage(this.pageModel.export("design"))});Z(this,"getWorkbench",()=>this.workbenchRef.current);this.pageSchema=n.schema,this.material=n.material,this.currentSelectNode=null,window.__CHAMELEON_ENG__=this,this.assetsPackageListManager=new HI(n.assetPackagesList||[]),this.workbenchConfig=n.workbenchConfig||{};try{this.pageModel=new fe.CPage(this.pageSchema,{materials:this.material||[],assetPackagesList:n.assetPackagesList||[]})}catch(r){console.error(r),this.pageModel=new fe.CPage(fe.EmptyPage)}this.emitter=Od()}updateCurrentSelectNode(n){this.currentSelectNode=n,this.emitter.emit("onSelectNodeChange",{node:n})}async componentDidMount(){var i,a,s,l,c,u;window.__C_ENGINE__=this;const n=this.props.plugins,r=new w$({engine:this,getWorkbench:()=>this.workbenchRef.current,emitter:this.emitter,pageModel:this.pageModel,i18n:Ud,assetsPackageListManager:this.assetsPackageListManager});this.pluginManager=r,r.customPlugin("Designer",d=>(d.ctx.config.beforeInitRender=h$,d.ctx.config.customRender=p$({components:this.props.components||{},renderProps:this.props.renderProps||{}}),d.ctx.config.components=this.props.components,d)),(a=(i=this.props).beforePluginRun)==null||a.call(i,{pluginManager:this.pluginManager});const o=n.map(d=>this.pluginManager.add(d));(l=(s=this.props).onMount)==null||l.call(s,{pluginManager:this.pluginManager,engine:this}),await Promise.all(o),this.pageModel.emitter.on("onReloadPage",()=>{var f;if(console.log("🚀 ~ Engine ~ this.pageModel.emitter.on ~ onReloadPage:"),!this.currentSelectNode)return;const d=this.pageModel.getNode((f=this.currentSelectNode)==null?void 0:f.id);d&&this.updateCurrentSelectNode(d)}),(u=(c=this.props).onReady)==null||u.call(c,{pluginManager:this.pluginManager,engine:this})}getActiveNode(){var r;if(!((r=this.currentSelectNode)!=null&&r.id))return null;const n=this.pageModel.getNode(this.currentSelectNode.id)??null;return this.currentSelectNode=n,n}getI18n(){return Ud}async preview(){var i,a;const n=(i=this.workbenchRef.current)==null?void 0:i.getHiddenWidgetConfig();this._oldHiddenWidgetConfig=n,(a=this.workbenchRef.current)==null||a.hiddenWidget({hiddenLeftPanel:!0,hiddenRightPanel:!0,hiddenTopBar:!0,canvasFull:!0});const r=await this.pluginManager.get("Designer"),o=r==null?void 0:r.export;o==null||o.setPreviewMode()}async existPreview(){var o;(o=this.workbenchRef.current)==null||o.hiddenWidget({...this._oldHiddenWidgetConfig||{},canvasFull:!1});const n=await this.pluginManager.get("Designer"),r=n==null?void 0:n.export;r==null||r.setEditMode()}hiddenWidget(n){var r;(r=this.workbenchRef.current)==null||r.hiddenWidget(n||{})}render(){return w.jsx("div",{className:Le([Gse.engineContainer,this.props.className]),style:this.props.style,children:w.jsx(m$,{ref:this.workbenchRef,emitter:this.emitter,...this.workbenchConfig})})}}Z(k8,"version","0.3.11");exports.AdvancePanel=TS;exports.AdvancePanelConfig=AS;exports.AssetsPackageListManager=HI;exports.BUILD_IN_SETTER_MAP=Oo;exports.CSSEditor=b8;exports.CSSPropertiesEditor=Ux;exports.CSSPropertiesVariableBindEditor=s6;exports.ClassNameEditor=l6;exports.ComponentLibPlugin=Ac;exports.ComponentStatePanel=NS;exports.ComponentStatePanelConfig=RS;exports.CustomSchemaForm=Wc;exports.DEFAULT_PLUGIN_LIST=w8;exports.DEFAULT_PLUGIN_NAME_MAP=S8;exports.DesignerPlugin=Pc;exports.DesignerSizer=fOe;exports.DisplaySourceSchema=x8;exports.Engine=k8;exports.GlobalStatePanelPlugin=Jc;exports.HistoryPlugin=Qc;exports.HotkeysPlugin=Zc;exports.InnerComponentMeta=mOe;exports.LOGGER=ur;exports.MonacoEditor=$s;exports.OutlineTreePlugin=Mc;exports.PLUGIN_NAME=oi;exports.PluginManager=w$;exports.PropertyPanelConfig=OS;exports.RightPanelPlugin=Xc;exports.SetterSwitcher=Ah;exports.VisualPanelPlus=qS;exports.VisualPanelPlusConfig=US;exports.Workbench=m$;exports.beforeInitRender=h$;exports.defaultPropertyOptions=kd;exports.ensureKeyExist=Rc;exports.formatCSSTextProperty=FI;exports.formatCssToNodeVal=BI;exports.formatNodeValToEditor=VI;exports.formatStyleProperty=rb;exports.getColorFromStr=ob;exports.getDefaultRender=p$;exports.getUniqueAssetsList=j1;exports.parseBoxShadowString=fd;exports.plugins=dOe;exports.registerCustomSetter=ED;exports.sageJSONParse=g$;exports.styleArr2Obj=LI;exports.styleList2Text=zI;exports.styleObjToArr=DI;exports.waitReactUpdate=no;Object.keys(Qr).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>Qr[e]})});
|
|
410
410
|
//# sourceMappingURL=index.cjs.map
|