UNPKG

@jiess/core

Version:

基于javascript的配置式渲染库,同时支持vue2,vue3和react

1 lines 1.93 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JiessEnv=t():e.JiessEnv=t()}(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>i});const n="JiessForceUpdate";!function(e={},t="toString"){if("function"==typeof e[t]){if("string"==typeof t){const n=new RegExp(t,"g");return(e[t]+"").replace(n,"")}e[t]}}(),new WeakMap;const o=(...e)=>{};var r;((((()=>{let e})(),()=>{let e=0;return function(t,n=100){let o=(new Date).getTime();o-e>n&&t(),e=o}})(),()=>{let e=!0;return function(t,n=100){e&&(e=!1,setTimeout((()=>{e=!0,t()}),n))}})(),()=>{let e=0;return function(t,n=100){let o=(new Date).getTime();o-e>n&&(e=o,t())}})(),function(e){e.React="react",e.Vue2="vue2",e.Vue3="vue3"}(r||(r={}));const s="vue3";class i{jiess;env=s;constructor(e,t){this.jiess=e,this.initRender(),this.env=e.$env=s,e.JiessComponent=e=>{const{is:n,setup:o,children:r,...s}=e,i={is:n,setup:o,jiessEnv:this};return this.createElement(t(i).start(s,r))}}initRender(){const{$render:e}=this.jiess;"function"==typeof e&&(this.jiess.h=(...t)=>e.call(this,...t))}createElement(e,t,n){const{useDirectives:o,...r}=t||{},{withDirectives:s,h:i}=this.jiess;return"function"==typeof o?s(i(e,r,n),o()):i(e,r,n)}createVNode({key:e},t){const{NativeComponent:n}=t(this);return this.createElement(n,{key:e})}component(e,t){let r=o;return{inheritAttrs:!0,data:()=>({[n]:!1}),created(){e.frame=this,e.frameProps=this.$props,r=t()},beforeMount(){r("beforeMount")},mounted(){r("mounted")},beforeUpdate(){r("beforeUpdate")},updated(){r("updated")},beforeUnmount(){r("beforeUnmount")},render(){return this[n],e.ctx._buildVNodeTree()},methods:{forceUpdate(){this[n]=!this[n]}}}}}return t.default})()));