@next-bricks/vb-experiment 1.3.18 → 1.3.19
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/bricks.json +3 -3
- package/dist/chunks/{1563.e386a37f.js → 1563.f975c5ed.js} +2 -2
- package/dist/chunks/{1563.e386a37f.js.map → 1563.f975c5ed.js.map} +1 -1
- package/dist/chunks/246.edb40dcb.js +2 -0
- package/dist/chunks/{246.3c1287e4.js.map → 246.edb40dcb.js.map} +1 -1
- package/dist/chunks/{3171.bee73fe6.js → 3171.95cc1b7d.js} +2 -2
- package/dist/chunks/{3171.bee73fe6.js.map → 3171.95cc1b7d.js.map} +1 -1
- package/dist/chunks/{3483.c5ce1021.js → 3483.023fac95.js} +3 -3
- package/dist/chunks/{3483.c5ce1021.js.map → 3483.023fac95.js.map} +1 -1
- package/dist/chunks/{4212.c9d10eb9.js → 4212.0034ca30.js} +2 -2
- package/dist/chunks/{4212.c9d10eb9.js.map → 4212.0034ca30.js.map} +1 -1
- package/dist/chunks/4765.c8d6b7c7.js +2 -0
- package/dist/chunks/{7146.a8c80bcf.js.map → 4765.c8d6b7c7.js.map} +1 -1
- package/dist/chunks/{4837.05a838ee.js → 4837.208ae445.js} +2 -2
- package/dist/chunks/{7218.b5820c83.js.map → 4837.208ae445.js.map} +1 -1
- package/dist/chunks/{5552.96d83691.js → 5552.7cd1c4db.js} +2 -2
- package/dist/chunks/{5552.96d83691.js.map → 5552.7cd1c4db.js.map} +1 -1
- package/dist/chunks/{6746.1bd8aaa8.js → 6746.c32f150c.js} +4 -4
- package/dist/chunks/6746.c32f150c.js.map +1 -0
- package/dist/chunks/7146.fae544eb.js +2 -0
- package/dist/chunks/{4765.3a3c2ed3.js.map → 7146.fae544eb.js.map} +1 -1
- package/dist/chunks/{7218.b5820c83.js → 7218.00131d23.js} +2 -2
- package/dist/chunks/{4837.05a838ee.js.map → 7218.00131d23.js.map} +1 -1
- package/dist/chunks/948.7f8e7e72.js +3 -0
- package/dist/chunks/948.7f8e7e72.js.map +1 -0
- package/dist/chunks/{app-playground.12d062e1.js → app-playground.bbfe9735.js} +2 -2
- package/dist/chunks/{app-playground.12d062e1.js.map → app-playground.bbfe9735.js.map} +1 -1
- package/dist/chunks/{app-preview.12cdd3e2.js → app-preview.9d068eec.js} +2 -2
- package/dist/chunks/{app-preview.12cdd3e2.js.map → app-preview.9d068eec.js.map} +1 -1
- package/dist/chunks/export-as-source-files.3cabf001.js +2 -0
- package/dist/chunks/{export-as-source-files.5accf195.js.map → export-as-source-files.3cabf001.js.map} +1 -1
- package/dist/chunks/export-widgets.b6325df8.js +2 -0
- package/dist/chunks/{export-widgets.1562a8ae.js.map → export-widgets.b6325df8.js.map} +1 -1
- package/dist/chunks/main.a0f77374.js +2 -0
- package/dist/chunks/{main.4a8e170f.js.map → main.a0f77374.js.map} +1 -1
- package/dist/chunks/tsx-playground.7cc3ac8d.js +2 -0
- package/dist/chunks/{tsx-playground.c67c0906.js.map → tsx-playground.7cc3ac8d.js.map} +1 -1
- package/dist/index.da2f4f76.js +2 -0
- package/dist/index.da2f4f76.js.map +1 -0
- package/dist/manifest.json +15 -15
- package/package.json +5 -3
- package/dist/chunks/246.3c1287e4.js +0 -2
- package/dist/chunks/4765.3a3c2ed3.js +0 -2
- package/dist/chunks/6746.1bd8aaa8.js.map +0 -1
- package/dist/chunks/7146.a8c80bcf.js +0 -2
- package/dist/chunks/948.1b677be1.js +0 -3
- package/dist/chunks/948.1b677be1.js.map +0 -1
- package/dist/chunks/export-as-source-files.5accf195.js +0 -2
- package/dist/chunks/export-widgets.1562a8ae.js +0 -2
- package/dist/chunks/main.4a8e170f.js +0 -2
- package/dist/chunks/tsx-playground.c67c0906.js +0 -2
- package/dist/index.d90bf964.js +0 -2
- package/dist/index.d90bf964.js.map +0 -1
- /package/dist/chunks/{3483.c5ce1021.js.LICENSE.txt → 3483.023fac95.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{6746.1bd8aaa8.js.LICENSE.txt → 6746.c32f150c.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{948.1b677be1.js.LICENSE.txt → 948.7f8e7e72.js.LICENSE.txt} +0 -0
package/dist/bricks.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"vb-experiment.export-as-source-files",
|
|
5
5
|
"vb-experiment.export-widgets",
|
|
6
6
|
"vb-experiment.tsx-playground",
|
|
7
|
-
"vb-experiment.app-
|
|
8
|
-
"vb-experiment.app-
|
|
7
|
+
"vb-experiment.app-preview",
|
|
8
|
+
"vb-experiment.app-playground"
|
|
9
9
|
],
|
|
10
10
|
"elements": [],
|
|
11
11
|
"processors": [],
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"vb-experiment.app-preview"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
|
-
"filePath": "bricks/vb-experiment/dist/index.
|
|
18
|
+
"filePath": "bricks/vb-experiment/dist/index.da2f4f76.js"
|
|
19
19
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[]).push([[1563],{1563:(e,t,n)=>{var r=n(7019),a=n(2461),s=n.n(a),o=n(5060),i=n(2408),c=n(1914),l=n(3242),u=n(77),d=n(4437),p=n(6337),f=n(1672),m=n(743),h=n(7577),x=n(2582),b=n(535),v=n(4215),w=n(1330),y=n(3812),g=n(1259),A=n(1895),k=n(6414),E=n(7585),_=n(6357),j=n(7837);async function S(e){let{typescript:t,semi:n=!0,printWidth:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await(0,i.GP)(e,{parser:t?"babel-ts":"babel",plugins:[c,l],semi:n,printWidth:r,trailingComma:"es5"})}async function C(e,t,n){for(const r of e){const e=[...n,r.name];if("folder"===r.type){const n=t.folder(r.name);await C(r.items,n,e)}else t.file(`${r.name}.js${"routes"===r.nodeType||"bricks"===r.nodeType||"template"===r.nodeType?"x":""}`,await S((0,f.c)(r.node,r.nodeType,e)))}}function L(e){for(const[t,n]of Object.entries(e))switch(t){case"items":if(Array.isArray(n))for(const e of n)M(e);break;case"type":"main"===n&&delete e[t];break;case"if":break;case"i18n":0===Object.keys(n).length&&delete e[t];break;default:null!==n&&!1!==n||delete e[t]}}function M(e){for(const[t,n]of Object.entries(e))switch(t){case"children":Array.isArray(n)&&n.length>0&&M(n);break;case"if":break;case"activeExcludes":case"activeIncludes":Array.isArray(n)&&0===n.length&&delete e[t];break;default:null!==n&&!1!==n||delete e[t]}}customElements.define("vb-experiment.export-as-source-files",(0,r.createProviderClass)((async function(e){var t,n,r,a,i,c;let{projectDetail:l,storyboard:M}=e;const N=new(s()),W=N.folder("project"),$=W.folder("src"),P={extracts:[],namePool:new Map},T=(0,d.WM)(M.routes,[],P),R={id:l.appId,name:l.name,homepage:l.appSetting.homepage,layoutType:l.appSetting.layoutType,theme:l.appSetting.theme,noAuthGuard:l.appSetting.noAuthGuard,locales:l.appSetting.locales,defaultConfig:JSON.parse(l.appSetting.defaultConfig||"{}"),menuIcon:JSON.parse(l.appSetting.icon||"null"),standaloneMode:!0};$.file("app.js",await S(`export default ${JSON.stringify(R,null,2)};`));const I=null!==(t=M.meta)&&void 0!==t?t:{},B=null!==(n=I.customTemplates)&&void 0!==n?n:[],O=null!==(r=I.functions)&&void 0!==r?r:[],F=null!==(a=I.menus)&&void 0!==a?a:[],H=null!==(i=I.contracts)&&void 0!==i?i:[],J=null!==(c=I.i18n)&&void 0!==c?c:{};delete I.customTemplates,delete I.functions,delete I.menus,delete I.contracts,delete I.i18n,delete I.workflows,delete I.mocks,delete I.userGroups;const D=(0,d.pA)(B,["components"],P);P.extracts.push({name:"index",path:["components"],node:D,nodeType:"others"});const z=(0,p._)(P.extracts);$.file("index.js",h),$.file("routes.jsx",await S((0,f.c)(T,"routes",["routes.jsx"])));const U=$.folder("resources"),G=U.folder("functions"),V=[],q=[];for(const e of O){if("index"===e.name)throw new Error('Unexpected function name: "index"');const t=new Set;let{code:n}=(0,u.transform)(e.source,{filename:"expr."+(e.typescript?"ts":"js"),plugins:[...e.typescript?["syntax-typescript"]:[],_.A,[j.A,{imports:t}]]});const r=t.has("FN");r&&t.delete("FN");const a=[];t.size>0&&a.push(`import { ${[...t].join(", ")} } from "next-jsx/runtime";`),r&&a.push('import FN from "./index.js";'),a.length>0&&(n=`${a.join("\n")}\n\n${n}`),G.file(`${e.name}.${e.typescript?"ts":"js"}`,n),q.push(`import ${e.name} from "./${e.name}.js";`),V.push(e.name)}G.file("index.js",await S(`${q.join("\n")}\n\nconst FN = { ${V.join(",")} };\n\nexport default FN;`));const X=U.folder("menus"),Z=[],Y=[];for(const e of F){if(L(e),"index"===e.menuId)throw new Error('Unexpected menu id: "index"');const t=`${e.menuId}.js`;X.file(t,await S((0,f.c)(e,"menu",["resources","menus",t])));let n=e.menuId.replace(/^\d+|[^\w]+/g,"_");E.bB.has(n)&&(n=`${n}__2`),Y.push(`import ${n} from "./${t}";`),Z.push(n)}X.file("index.js",await S(`${Y.join("\n")}\n\nexport default [${Z.join(",")}]`));const K=U.folder("contracts"),Q=[],ee=new Set;for(const e of H){const t=e.name.replace(/^\d+|[^\w]+/g,"_");let n=2,r=t;for(;ee.has(r)||E.bB.has(r)||"index"===r;)r=`${t}_${n++}`;ee.add(r),K.file(`${r}.js`,await S(`export default ${JSON.stringify(e)};`)),Q.push(`import ${r} from "./${r}.js";`)}K.file("index.js",await S(`${Q.join("\n")}\n\nexport default [${[...ee].join(",")}]`)),U.folder("i18n").file("index.js",await S(`export default ${JSON.stringify(J)};`)),U.file("meta.js",await S(`export default ${JSON.stringify(I,null,2)};`)),U.file("index.js",m),await C(z,$,[]),W.folder("mock-micro-apps").folder(l.appId).file(".gitignore","*\n!.gitignore"),W.file(".editorconfig",x),W.file(".gitignore",b),W.file("dev.config.mjs",w),W.file("declarations.d.ts",v),W.file("jsconfig.json",y),W.file("next-jsx.config.js",g.replaceAll("__APP_ID__",l.appId)),W.file("package.json",A.replaceAll("__APP_ID__",l.appId)),W.file("README.md",k.replaceAll("__PROJECT_NAME__",l.name).replaceAll("__PROJECT_HOMEPAGE__",l.appSetting.homepage));const te=await N.generateAsync({type:"blob"});(0,o.saveAs)(te,"project.zip")}))),customElements.define("vb-experiment.export-widgets",(0,r.createProviderClass)((async function(e){let{name:t,files:n}=e;const r=new Map,a=new(s()),i=a.folder("widgets").folder(t);for(const{path:e,content:t}of n){const n=e.split("/"),a=n.pop();let s=i,o=1;for(const e of n){const t=n.slice(0,o).join("/"),a=r.get(t);a?s=a:(s=s.folder(e),r.set(t,s)),o++}s.file(a,t)}const c=await a.generateAsync({type:"blob"});(0,o.saveAs)(c,`${t}.zip`)})));var N=n(4635),W=n(918),$=n(6902),P=n(5536),T=n(6121),R=n(829),I=n(2740),B=n(8769),O=n.n(B),F=n(870),H=n(348),J=n(981),D=n(709),z=n(563),U=n(4612),G=n(1493),V=n(689),q=n(1258),X=n(3705),Z=n(6330),Y=n(8228),K=n(2612),Q=n(3221);function ee(e,t){return{brick:"div",properties:{style:t.expanded?{background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(10px)",borderRadius:"16px",padding:"24px"}:{background:"var(--elevo-component-background)",backdropFilter:"var(--elevo-component-backdrop-filter)",borderRadius:"var(--elevo-border-radius)",padding:"16px"}},children:e}}function te(){return te=(0,Z.A)((0,q.A)().mark((function e(t,n){var r,a,s,o,i,c,l,u,d,p,f,m;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.entry){e.next=1;break}throw new Error("No entry module found in the view.");case 1:return o={usedHelpers:new Set,app:t,convertedModules:new Map},i=[],c=[],e.next=2,Promise.all(Array.from(t.modules.values()).map(function(){var e=(0,Z.A)((0,q.A)().mark((function e(t){var r,l,u,d,p,f,m,h;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=1,(0,Y.A)(t,o,n);case 1:r=e.sent,t===a&&(s=r),l=0,u=[].concat((0,X.A)(r.internals),(0,X.A)(r.namedExports.values()),[r.defaultExport]);case 2:if(!(l<u.length)){e.next=8;break}if(d=u[l]){e.next=3;break}return e.abrupt("continue",7);case 3:p=d.raw,f=d.promise,h=null==p?void 0:p.type,e.next="function"===h?4:"template"===h?5:7;break;case 4:return i.push(p.function),e.abrupt("continue",7);case 5:return e.next=6,f;case 6:return m=e.sent,c.push({name:(0,Q.$)(m.name,n.rootId),bricks:m.bricks,state:m.context}),e.abrupt("continue",7);case 7:l++,e.next=2;break;case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:if(null!==(r=s)&&void 0!==r&&r.defaultExport){e.next=3;break}throw new Error("No view found in the entry module.");case 3:return l=Array.from(o.usedHelpers).map((function(e){var t=(0,K.m)().get(e);if(!t)throw new Error("Helper function ".concat(e," not found"));return{name:e,source:t,typescript:!0}})),e.next=4,s.defaultExport.promise;case 4:return u=e.sent,d=u.title,p=u.bricks,f=u.context,m=function(){return p.every((function(e){return["eo-form","eo-descriptions","eo-button"].includes(e.brick)}))},e.abrupt("return",{title:d,brick:n.withoutWrapper?p:{brick:"eo-content-layout",children:m()?[ee(p,n)]:p},context:[].concat((0,X.A)(f),(0,X.A)(n.withContexts?Object.entries(n.withContexts).map((function(e){var t=(0,V.A)(e,2);return{name:t[0],value:t[1]}})):[])),functions:[].concat(i,(0,X.A)(l)),templates:c});case 5:case"end":return e.stop()}}),e)}))),te.apply(this,arguments)}n(4419);var ne=n(2591),re=n.n(ne),ae=n(1740),se=n.n(ae),oe=n(8128),ie=n.n(oe),ce=n(855),le=n.n(ce),ue=n(3051),de=n.n(ue),pe=n(3656),fe=n.n(pe),me=n(8957),he={};he.styleTagTransform=fe(),he.setAttributes=le(),he.insert=ie().bind(null,"head"),he.domAPI=se(),he.insertStyleElement=de(),re()(me.A,he);const xe=me.A&&me.A.locals?me.A.locals:void 0;var be=n(7695);let ve,we;function ye(){return ve||(ve=(async()=>{const e=(0,be.LV)((we||(we=new Worker(new URL(n.p+n.u(4212),n.b))),we));return await new e})()),ve}var ge;let Ae,ke,Ee,_e,je,Se,Ce,Le,Me,Ne,We,$e,Pe,Te,Re;const Ie=O().lazy((async()=>({default:await(0,D.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),Be=[{filePath:"/node_modules/next-tsx/components.d.ts",content:G.replaceAll("export interface","interface")},{filePath:"/node_modules/next-tsx/package.json",content:JSON.stringify({name:"next-tsx",types:"./index.d.ts"})},{filePath:"/node_modules/next-tsx/index.d.ts",content:U}],{defineElement:Oe,property:Fe,event:He}=(0,F.createDecorators)();let Je;var De=new WeakMap,ze=new WeakMap,Ue=new WeakMap,Ge=new WeakMap,Ve=new WeakMap,qe=new WeakMap,Xe=new WeakSet,Ze=new WeakMap;class Ye extends J.ReactNextElement{constructor(){super(...arguments),(0,N.A)(this,Xe),(0,W.A)(this,De,ke(this)),(0,W.A)(this,ze,(Ee(this),_e(this))),(0,W.A)(this,Ue,(je(this),Se(this))),(0,W.A)(this,Ge,(Ce(this),Le(this))),(0,W.A)(this,Ve,(Me(this),Ne(this))),(0,W.A)(this,qe,(We(this),$e(this))),(0,W.A)(this,Ze,(Re(this),e=>{var t;null===(t=(0,P.A)(Xe,this,Pe))||void 0===t||t.emit(e)}))}get source(){return(0,R.A)(De,this)}set source(e){(0,T.A)(De,this,e)}get extraLibs(){return(0,R.A)(ze,this)}set extraLibs(e){(0,T.A)(ze,this,e)}get viewLibs(){return(0,R.A)(Ue,this)}set viewLibs(e){(0,T.A)(Ue,this,e)}get withoutWrapper(){return(0,R.A)(Ge,this)}set withoutWrapper(e){(0,T.A)(Ge,this,e)}get allowAnyBricks(){return(0,R.A)(Ve,this)}set allowAnyBricks(e){(0,T.A)(Ve,this,e)}render(){return O().createElement(Qe,{source:this.source,extraLibs:this.extraLibs,viewLibs:this.viewLibs,withoutWrapper:this.withoutWrapper,allowAnyBricks:this.allowAnyBricks,onChange:(0,R.A)(Ze,this)})}}function Ke(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Qe(e){let{source:t,extraLibs:n,withoutWrapper:r,allowAnyBricks:a,viewLibs:s,onChange:o}=e;const[i,c]=(0,B.useState)(null!=t?t:""),l=(0,B.useDeferredValue)(i),[u,d]=(0,B.useState)(),[p,f]=(0,B.useState)(),m=(0,B.useMemo)((()=>[...Be,...null!=n?n:[],...null!=s?s:[]]),[n,s]),h=(0,B.useCallback)((e=>{c(e.detail),o(e.detail)}),[o]);(0,B.useEffect)((()=>{let e=!1;return async function(){const t=await ye();if(e)return;const n=await t.parseView(l,{libs:s});if(e)return;f(n);const r=n.errors.filter((e=>!!e.node));r.length>0?d(r.map((e=>({message:e.message,severity:Ke(e.severity),startLineNumber:e.node.loc.start.line,startColumn:e.node.loc.start.column+1,endLineNumber:e.node.loc.end.line,endColumn:e.node.loc.end.column+1})))):d(void 0)}(),()=>{e=!0}}),[l]);const x=(0,B.useMemo)((()=>(0,z.uniqueId)()),[]),b=(0,B.useRef)(null),v=(0,B.useRef)(null);return(0,B.useEffect)((()=>{const e=b.current;if(!e)return;const t=function(e){const t=document.createElement("div");return t.dataset.rootId=e,t.style.position="absolute",t.style.width=t.style.height="0",document.body.append(t),t}(x),n=(0,H.unstable_createRoot)(e,{portal:t,supportsUseChildren:!0});return v.current=n,()=>{n.unmount(),t.remove(),v.current=null}}),[x]),(0,B.useEffect)((()=>{let e=!1;return(async()=>{if(!p)return;let t;try{var n;if(t=await function(e,t){return te.apply(this,arguments)}(p,{rootId:x,expanded:!0,withoutWrapper:r,allowAnyBricks:a}),e)return;const{brick:s,context:o,functions:i,templates:c}=null!=t?t:{};await(null===(n=v.current)||void 0===n?void 0:n.render(null!=s?s:[],{context:o,functions:i,templates:c}))}catch(e){var s;console.error("Failed to render view:",e),null===(s=v.current)||void 0===s||s.render({brick:customElements.get("easyops-default-error")?"easyops-default-error":"div",properties:{errorTitle:"解析失败",dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},children:[{brick:"div",properties:{textContent:(0,H.httpErrorToString)(e)}}]})}})(),()=>{e=!0}}),[x,p,r,a]),O().createElement("div",{className:xe.container},O().createElement("div",{className:xe.editor},O().createElement(B.Suspense,{fallback:"Loading..."},O().createElement(Ie,{value:t,onCodeChange:h,language:"typescript",uri:"file:///View.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:m,extraMarkers:u,"data-override-theme":"dark-v2"}))),O().createElement("div",{className:xe.preview},O().createElement("div",{"data-root-id":x,ref:b})))}ge=Ye,({e:[ke,Ee,_e,je,Se,Ce,Le,Me,Ne,We,$e,Pe,Te,Re],c:[Je,Ae]}=(0,I.A)(ge,[Oe("vb-experiment.tsx-playground",{shadowOptions:!1})],[[Fe({attribute:!1}),1,"source"],[Fe({attribute:!1}),1,"extraLibs"],[Fe({attribute:!1}),1,"viewLibs"],[Fe({type:Boolean}),1,"withoutWrapper"],[Fe({type:Boolean}),1,"allowAnyBricks"],[He({type:"change"}),1,"change",e=>(0,R.A)(qe,e),(e,t)=>(0,T.A)(qe,e,t)]],0,(e=>Ze.has((0,$.A)(e))),J.ReactNextElement)),Ae();var et,tt=n(4504);let nt,rt,at;const{defineElement:st,property:ot}=(0,F.createDecorators)();let it;var ct=new WeakMap;class lt extends J.ReactNextElement{constructor(){super(...arguments),(0,W.A)(this,ct,rt(this)),at(this)}get storyboard(){return(0,R.A)(ct,this)}set storyboard(e){(0,T.A)(ct,this,e)}render(){return O().createElement(ut,{storyboard:this.storyboard})}}function ut(e){let{storyboard:t}=e;const n=(0,B.useRef)(null),[r,a]=(0,B.useState)(null),s=(0,B.useCallback)((()=>{const e=()=>{var t;const r=null===(t=n.current)||void 0===t||null===(t=t.contentWindow)||void 0===t?void 0:t._preview_only_appPreviewer;r?a(r):setTimeout(e,100)};e()}),[]),o=(0,B.useRef)(null);return(0,B.useEffect)((()=>{if(!r||!t)return;const e={id:"lab-app-preview",name:"Lab: App Preview",homepage:"/lab-app-preview",standaloneMode:!0,noPlaceholders:!0};if(o.current){let n=!1;return o.current.then((()=>{n||(r.update(e.id,{...t,app:e}),r.reload())})),()=>{n=!0}}o.current=r.setup({brickPackages:H.__secret_internals.getBrickPackages(),storyboards:[{...t,app:e}]},e.homepage)}),[r,t]),O().createElement("div",{className:"container"},O().createElement("iframe",{ref:n,src:`${(0,H.getBasePath)()}lab/?_experimental_app_preview_=1`,loading:"lazy",onLoad:s}))}et=lt,({e:[rt,at],c:[it,nt]}=(0,I.A)(et,[st("vb-experiment.app-preview",{styleTexts:[tt.A]})],[[ot({attribute:!1}),1,"storyboard"]],0,void 0,J.ReactNextElement)),nt();var dt=n(3310),pt=n(8291),ft=n(9978),mt=n(2025);function ht(){return ht=(0,Z.A)((0,q.A)().mark((function e(t,n){var r,a,s,o,i,c,l,u,d,p,f,m,h,x,b,v,w,y,g,A,k,E,_,j,S,C,L,M;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.entry,a=t.modules,r){e.next=1;break}throw new Error("No entry module found in the app.");case 1:if(s=r.render){e.next=2;break}throw new Error("No render call found in the entry module.");case 2:if(1===(o=s.children).length){e.next=3;break}throw new Error("Expects exactly one root component in the render call, but got ".concat(o.length,"."));case 3:if(i=o[0],(0,pt.dN)(i,"Routes")){e.next=4;break}throw new Error('The root component must be <Routes> from "'.concat(ft.FJ,'".'));case 4:return c={usedHelpers:new Set,app:t,convertedModules:new Map},l=(0,Y.A)(r,c,n),c.convertedModules.set(r.filePath,l),e.next=5,(0,mt.k)(i.children,c,r,n);case 5:u=e.sent,d=[],p=[],f=(0,dt.A)(a);try{for(f.s();!(m=f.n()).done;)h=(0,V.A)(m.value,2),x=h[0],b=h[1],c.convertedModules.has(x)||(v=(0,Y.A)(b,c,n),c.convertedModules.set(x,v))}catch(e){f.e(e)}finally{f.f()}w=(0,dt.A)(c.convertedModules.values()),e.prev=6,w.s();case 7:if((y=w.n()).done){e.next=15;break}if(!(g=y.value)){e.next=14;break}A=0,k=[].concat((0,X.A)(g.internals),(0,X.A)(g.namedExports.values()),[g.defaultExport]);case 8:if(!(A<k.length)){e.next=14;break}if(E=k[A]){e.next=9;break}return e.abrupt("continue",13);case 9:_=E.raw,j=E.promise,L=null==_?void 0:_.type,e.next="function"===L?10:"template"===L?11:13;break;case 10:return d.push(_.function),e.abrupt("continue",13);case 11:return e.next=12,j;case 12:return S=e.sent,p.push({name:(0,Q.v)(S.name),bricks:S.bricks,state:S.context,proxy:S.proxy}),e.abrupt("continue",13);case 13:A++,e.next=8;break;case 14:e.next=7;break;case 15:e.next=17;break;case 16:e.prev=16,M=e.catch(6),w.e(M);case 17:return e.prev=17,w.f(),e.finish(17);case 18:return C=Array.from(c.usedHelpers).map((function(e){var t=(0,K.m)().get(e);if(!t)throw new Error("Helper function ".concat(e," not found"));return{name:e,source:t,typescript:!0}})),e.abrupt("return",{routes:u,functions:[].concat(d,(0,X.A)(C)),templates:p,constants:Object.fromEntries(t.constants)});case 19:case"end":return e.stop()}}),e,null,[[6,16,17,18]])}))),ht.apply(this,arguments)}var xt=n(4373),bt={};bt.styleTagTransform=fe(),bt.setAttributes=le(),bt.insert=ie().bind(null,"head"),bt.domAPI=se(),bt.insertStyleElement=de(),re()(xt.A,bt);const vt=xt.A&&xt.A.locals?xt.A.locals:void 0;var wt;let yt,gt,At,kt,Et,_t,jt,St,Ct;const Lt=O().lazy((async()=>({default:await(0,D.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),Mt=(0,J.wrapBrick)("vb-experiment.app-preview"),Nt=[{filePath:"/node_modules/next-tsx/components.d.ts",content:G.replaceAll("export interface","interface")},{filePath:"/node_modules/next-tsx/package.json",content:JSON.stringify({name:"next-tsx",types:"./index.d.ts"})},{filePath:"/node_modules/next-tsx/index.d.ts",content:U}],{defineElement:Wt,property:$t,event:Pt}=(0,F.createDecorators)();let Tt;var Rt=new WeakMap,It=new WeakMap,Bt=new WeakMap,Ot=new WeakSet,Ft=new WeakMap;class Ht extends J.ReactNextElement{constructor(){super(...arguments),(0,N.A)(this,Ot),(0,W.A)(this,Rt,gt(this)),(0,W.A)(this,It,(At(this),kt(this))),(0,W.A)(this,Bt,(Et(this),_t(this))),(0,W.A)(this,Ft,(Ct(this),e=>{var t;null===(t=(0,P.A)(Ot,this,jt))||void 0===t||t.emit(e)}))}get source(){return(0,R.A)(Rt,this)}set source(e){(0,T.A)(Rt,this,e)}get extraLibs(){return(0,R.A)(It,this)}set extraLibs(e){(0,T.A)(It,this,e)}render(){return O().createElement(Dt,{source:this.source,extraLibs:this.extraLibs,onChange:(0,R.A)(Ft,this)})}}function Jt(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Dt(e){let{source:t,extraLibs:n,onChange:r}=e;const[a,s]=(0,B.useState)(null!=t?t:""),o=(0,B.useDeferredValue)(a),[i,c]=(0,B.useState)(),[l,u]=(0,B.useState)(),d=(0,B.useMemo)((()=>[...Nt,...null!=n?n:[]]),[n]),p=(0,B.useCallback)((e=>{s(e.detail),r(e.detail)}),[r]);(0,B.useEffect)((()=>{let e=!1;return async function(){const t=await ye();if(e)return;const n=await t.parseApp([{filePath:"/index.tsx",content:o}]);if(e)return;u(n);const r=n.errors.filter((e=>!!e.node));r.length>0?c(r.map((e=>({message:e.message,severity:Jt(e.severity),startLineNumber:e.node.loc.start.line,startColumn:e.node.loc.start.column+1,endLineNumber:e.node.loc.end.line,endColumn:e.node.loc.end.column+1})))):c(void 0)}(),()=>{e=!0}}),[o]);const f=(0,B.useMemo)((()=>(0,z.uniqueId)()),[]),[m,h]=(0,B.useState)();return(0,B.useEffect)((()=>{let e=!1;return(async()=>{if(!l)return;let t;try{if(t=await function(e,t){return ht.apply(this,arguments)}(l,{rootId:f,expanded:!0}),e)return;const n={routes:t.routes,meta:{functions:t.functions,customTemplates:t.templates}};h(n)}catch(e){console.error("Failed to render app:",e)}})(),()=>{e=!0}}),[f,l]),O().createElement("div",{className:vt.container},O().createElement("div",{className:vt.editor},O().createElement(B.Suspense,{fallback:"Loading..."},O().createElement(Lt,{value:t,onCodeChange:p,language:"typescript",uri:"file:///index.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:d,extraMarkers:i,"data-override-theme":"dark-v2"}))),O().createElement("div",{className:vt.preview},O().createElement(Mt,{storyboard:m})))}wt=Ht,({e:[gt,At,kt,Et,_t,jt,St,Ct],c:[Tt,yt]}=(0,I.A)(wt,[Wt("vb-experiment.app-playground",{shadowOptions:!1})],[[$t({attribute:!1}),1,"source"],[$t({attribute:!1}),1,"extraLibs"],[Pt({type:"change"}),1,"change",e=>(0,R.A)(Bt,e),(e,t)=>(0,T.A)(Bt,e,t)]],0,(e=>Ft.has((0,$.A)(e))),J.ReactNextElement)),yt()},4373:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,".container--AW813tLb{display:flex;height:100%}.editor--B5m74LRR,\n.preview--THWZoCIv{flex:1;min-width:0}.preview--THWZoCIv{padding:0;height:100%}",""]),o.locals={container:"container--AW813tLb",editor:"editor--B5m74LRR",preview:"preview--THWZoCIv"};const i=o},4504:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,":host{display:block;height:100%}:host([hidden]){display:none}*{box-sizing:border-box}.container,\niframe{width:100%;height:100%;border-radius:4px}iframe{display:block;border:none;margin:0;padding:0;transform-origin:0% 0%;-webkit-user-select:none;user-select:none}",""]);const i=o.toString()},8957:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,".container--M22i1CYq{display:flex;height:100%}.editor--kF8SUoBP,\n.preview--gu5OlS2X{flex:1;min-width:0}.preview--gu5OlS2X{padding:1em;overflow:auto}",""]),o.locals={container:"container--M22i1CYq",editor:"editor--kF8SUoBP",preview:"preview--gu5OlS2X"};const i=o}}]);
|
|
2
|
-
//# sourceMappingURL=1563.
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[]).push([[1563],{1563:(e,t,n)=>{var r=n(410),a=n(2461),s=n.n(a),o=n(5060),i=n(2408),c=n(1914),l=n(3242),u=n(77),d=n(4437),p=n(6337),f=n(1672),m=n(743),h=n(7577),x=n(2582),b=n(535),v=n(4215),w=n(1330),y=n(3812),g=n(1259),A=n(1895),k=n(6414),E=n(7585),_=n(6357),j=n(7837);async function S(e){let{typescript:t,semi:n=!0,printWidth:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await(0,i.GP)(e,{parser:t?"babel-ts":"babel",plugins:[c,l],semi:n,printWidth:r,trailingComma:"es5"})}async function C(e,t,n){for(const r of e){const e=[...n,r.name];if("folder"===r.type){const n=t.folder(r.name);await C(r.items,n,e)}else t.file(`${r.name}.js${"routes"===r.nodeType||"bricks"===r.nodeType||"template"===r.nodeType?"x":""}`,await S((0,f.c)(r.node,r.nodeType,e)))}}function L(e){for(const[t,n]of Object.entries(e))switch(t){case"items":if(Array.isArray(n))for(const e of n)M(e);break;case"type":"main"===n&&delete e[t];break;case"if":break;case"i18n":0===Object.keys(n).length&&delete e[t];break;default:null!==n&&!1!==n||delete e[t]}}function M(e){for(const[t,n]of Object.entries(e))switch(t){case"children":Array.isArray(n)&&n.length>0&&M(n);break;case"if":break;case"activeExcludes":case"activeIncludes":Array.isArray(n)&&0===n.length&&delete e[t];break;default:null!==n&&!1!==n||delete e[t]}}customElements.define("vb-experiment.export-as-source-files",(0,r.createProviderClass)((async function(e){var t,n,r,a,i,c;let{projectDetail:l,storyboard:M}=e;const N=new(s()),W=N.folder("project"),$=W.folder("src"),P={extracts:[],namePool:new Map},T=(0,d.WM)(M.routes,[],P),R={id:l.appId,name:l.name,homepage:l.appSetting.homepage,layoutType:l.appSetting.layoutType,theme:l.appSetting.theme,noAuthGuard:l.appSetting.noAuthGuard,locales:l.appSetting.locales,defaultConfig:JSON.parse(l.appSetting.defaultConfig||"{}"),menuIcon:JSON.parse(l.appSetting.icon||"null"),standaloneMode:!0};$.file("app.js",await S(`export default ${JSON.stringify(R,null,2)};`));const I=null!==(t=M.meta)&&void 0!==t?t:{},B=null!==(n=I.customTemplates)&&void 0!==n?n:[],O=null!==(r=I.functions)&&void 0!==r?r:[],F=null!==(a=I.menus)&&void 0!==a?a:[],H=null!==(i=I.contracts)&&void 0!==i?i:[],J=null!==(c=I.i18n)&&void 0!==c?c:{};delete I.customTemplates,delete I.functions,delete I.menus,delete I.contracts,delete I.i18n,delete I.workflows,delete I.mocks,delete I.userGroups;const D=(0,d.pA)(B,["components"],P);P.extracts.push({name:"index",path:["components"],node:D,nodeType:"others"});const z=(0,p._)(P.extracts);$.file("index.js",h),$.file("routes.jsx",await S((0,f.c)(T,"routes",["routes.jsx"])));const U=$.folder("resources"),G=U.folder("functions"),V=[],q=[];for(const e of O){if("index"===e.name)throw new Error('Unexpected function name: "index"');const t=new Set;let{code:n}=(0,u.transform)(e.source,{filename:"expr."+(e.typescript?"ts":"js"),plugins:[...e.typescript?["syntax-typescript"]:[],_.A,[j.A,{imports:t}]]});const r=t.has("FN");r&&t.delete("FN");const a=[];t.size>0&&a.push(`import { ${[...t].join(", ")} } from "next-jsx/runtime";`),r&&a.push('import FN from "./index.js";'),a.length>0&&(n=`${a.join("\n")}\n\n${n}`),G.file(`${e.name}.${e.typescript?"ts":"js"}`,n),q.push(`import ${e.name} from "./${e.name}.js";`),V.push(e.name)}G.file("index.js",await S(`${q.join("\n")}\n\nconst FN = { ${V.join(",")} };\n\nexport default FN;`));const X=U.folder("menus"),Z=[],Y=[];for(const e of F){if(L(e),"index"===e.menuId)throw new Error('Unexpected menu id: "index"');const t=`${e.menuId}.js`;X.file(t,await S((0,f.c)(e,"menu",["resources","menus",t])));let n=e.menuId.replace(/^\d+|[^\w]+/g,"_");E.bB.has(n)&&(n=`${n}__2`),Y.push(`import ${n} from "./${t}";`),Z.push(n)}X.file("index.js",await S(`${Y.join("\n")}\n\nexport default [${Z.join(",")}]`));const K=U.folder("contracts"),Q=[],ee=new Set;for(const e of H){const t=e.name.replace(/^\d+|[^\w]+/g,"_");let n=2,r=t;for(;ee.has(r)||E.bB.has(r)||"index"===r;)r=`${t}_${n++}`;ee.add(r),K.file(`${r}.js`,await S(`export default ${JSON.stringify(e)};`)),Q.push(`import ${r} from "./${r}.js";`)}K.file("index.js",await S(`${Q.join("\n")}\n\nexport default [${[...ee].join(",")}]`)),U.folder("i18n").file("index.js",await S(`export default ${JSON.stringify(J)};`)),U.file("meta.js",await S(`export default ${JSON.stringify(I,null,2)};`)),U.file("index.js",m),await C(z,$,[]),W.folder("mock-micro-apps").folder(l.appId).file(".gitignore","*\n!.gitignore"),W.file(".editorconfig",x),W.file(".gitignore",b),W.file("dev.config.mjs",w),W.file("declarations.d.ts",v),W.file("jsconfig.json",y),W.file("next-jsx.config.js",g.replaceAll("__APP_ID__",l.appId)),W.file("package.json",A.replaceAll("__APP_ID__",l.appId)),W.file("README.md",k.replaceAll("__PROJECT_NAME__",l.name).replaceAll("__PROJECT_HOMEPAGE__",l.appSetting.homepage));const te=await N.generateAsync({type:"blob"});(0,o.saveAs)(te,"project.zip")}))),customElements.define("vb-experiment.export-widgets",(0,r.createProviderClass)((async function(e){let{name:t,files:n}=e;const r=new Map,a=new(s()),i=a.folder("widgets").folder(t);for(const{path:e,content:t}of n){const n=e.split("/"),a=n.pop();let s=i,o=1;for(const e of n){const t=n.slice(0,o).join("/"),a=r.get(t);a?s=a:(s=s.folder(e),r.set(t,s)),o++}s.file(a,t)}const c=await a.generateAsync({type:"blob"});(0,o.saveAs)(c,`${t}.zip`)})));var N=n(4635),W=n(918),$=n(6902),P=n(5536),T=n(6121),R=n(829),I=n(2740),B=n(8769),O=n.n(B),F=n(870),H=n(128),J=n(981),D=n(8796),z=n(563),U=n(4612),G=n(1493),V=n(689),q=n(1258),X=n(3705),Z=n(6330),Y=n(8228),K=n(2612),Q=n(3221);function ee(e,t){return{brick:"div",properties:{style:t.expanded?{background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(10px)",borderRadius:"16px",padding:"24px"}:{background:"var(--elevo-component-background)",backdropFilter:"var(--elevo-component-backdrop-filter)",borderRadius:"var(--elevo-border-radius)",padding:"16px"}},children:e}}function te(){return te=(0,Z.A)((0,q.A)().mark((function e(t,n){var r,a,s,o,i,c,l,u,d,p,f,m;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.entry){e.next=1;break}throw new Error("No entry module found in the view.");case 1:return o={usedHelpers:new Set,app:t,convertedModules:new Map},i=[],c=[],e.next=2,Promise.all(Array.from(t.modules.values()).map(function(){var e=(0,Z.A)((0,q.A)().mark((function e(t){var r,l,u,d,p,f,m,h;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=1,(0,Y.A)(t,o,n);case 1:r=e.sent,t===a&&(s=r),l=0,u=[].concat((0,X.A)(r.internals),(0,X.A)(r.namedExports.values()),[r.defaultExport]);case 2:if(!(l<u.length)){e.next=8;break}if(d=u[l]){e.next=3;break}return e.abrupt("continue",7);case 3:p=d.raw,f=d.promise,h=null==p?void 0:p.type,e.next="function"===h?4:"template"===h?5:7;break;case 4:return i.push(p.function),e.abrupt("continue",7);case 5:return e.next=6,f;case 6:return m=e.sent,c.push({name:(0,Q.$)(m.name,n.rootId),bricks:m.bricks,state:m.context}),e.abrupt("continue",7);case 7:l++,e.next=2;break;case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:if(null!==(r=s)&&void 0!==r&&r.defaultExport){e.next=3;break}throw new Error("No view found in the entry module.");case 3:return l=Array.from(o.usedHelpers).map((function(e){var t=(0,K.m)().get(e);if(!t)throw new Error("Helper function ".concat(e," not found"));return{name:e,source:t,typescript:!0}})),e.next=4,s.defaultExport.promise;case 4:return u=e.sent,d=u.title,p=u.bricks,f=u.context,m=function(){return p.every((function(e){return["eo-form","eo-descriptions","eo-button"].includes(e.brick)}))},e.abrupt("return",{title:d,brick:n.withoutWrapper?p:{brick:"eo-content-layout",children:m()?[ee(p,n)]:p},context:[].concat((0,X.A)(f),(0,X.A)(n.withContexts?Object.entries(n.withContexts).map((function(e){var t=(0,V.A)(e,2);return{name:t[0],value:t[1]}})):[])),functions:[].concat(i,(0,X.A)(l)),templates:c});case 5:case"end":return e.stop()}}),e)}))),te.apply(this,arguments)}n(4419);var ne=n(2591),re=n.n(ne),ae=n(1740),se=n.n(ae),oe=n(8128),ie=n.n(oe),ce=n(855),le=n.n(ce),ue=n(3051),de=n.n(ue),pe=n(3656),fe=n.n(pe),me=n(8957),he={};he.styleTagTransform=fe(),he.setAttributes=le(),he.insert=ie().bind(null,"head"),he.domAPI=se(),he.insertStyleElement=de(),re()(me.A,he);const xe=me.A&&me.A.locals?me.A.locals:void 0;var be=n(7695);let ve,we;function ye(){return ve||(ve=(async()=>{const e=(0,be.LV)((we||(we=new Worker(new URL(n.p+n.u(4212),n.b))),we));return await new e})()),ve}var ge;let Ae,ke,Ee,_e,je,Se,Ce,Le,Me,Ne,We,$e,Pe,Te,Re;const Ie=O().lazy((async()=>({default:await(0,D.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),Be=[{filePath:"/node_modules/next-tsx/components.d.ts",content:G.replaceAll("export interface","interface")},{filePath:"/node_modules/next-tsx/package.json",content:JSON.stringify({name:"next-tsx",types:"./index.d.ts"})},{filePath:"/node_modules/next-tsx/index.d.ts",content:U}],{defineElement:Oe,property:Fe,event:He}=(0,F.createDecorators)();let Je;var De=new WeakMap,ze=new WeakMap,Ue=new WeakMap,Ge=new WeakMap,Ve=new WeakMap,qe=new WeakMap,Xe=new WeakSet,Ze=new WeakMap;class Ye extends J.ReactNextElement{constructor(){super(...arguments),(0,N.A)(this,Xe),(0,W.A)(this,De,ke(this)),(0,W.A)(this,ze,(Ee(this),_e(this))),(0,W.A)(this,Ue,(je(this),Se(this))),(0,W.A)(this,Ge,(Ce(this),Le(this))),(0,W.A)(this,Ve,(Me(this),Ne(this))),(0,W.A)(this,qe,(We(this),$e(this))),(0,W.A)(this,Ze,(Re(this),e=>{var t;null===(t=(0,P.A)(Xe,this,Pe))||void 0===t||t.emit(e)}))}get source(){return(0,R.A)(De,this)}set source(e){(0,T.A)(De,this,e)}get extraLibs(){return(0,R.A)(ze,this)}set extraLibs(e){(0,T.A)(ze,this,e)}get viewLibs(){return(0,R.A)(Ue,this)}set viewLibs(e){(0,T.A)(Ue,this,e)}get withoutWrapper(){return(0,R.A)(Ge,this)}set withoutWrapper(e){(0,T.A)(Ge,this,e)}get allowAnyBricks(){return(0,R.A)(Ve,this)}set allowAnyBricks(e){(0,T.A)(Ve,this,e)}render(){return O().createElement(Qe,{source:this.source,extraLibs:this.extraLibs,viewLibs:this.viewLibs,withoutWrapper:this.withoutWrapper,allowAnyBricks:this.allowAnyBricks,onChange:(0,R.A)(Ze,this)})}}function Ke(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Qe(e){let{source:t,extraLibs:n,withoutWrapper:r,allowAnyBricks:a,viewLibs:s,onChange:o}=e;const[i,c]=(0,B.useState)(null!=t?t:""),l=(0,B.useDeferredValue)(i),[u,d]=(0,B.useState)(),[p,f]=(0,B.useState)(),m=(0,B.useMemo)((()=>[...Be,...null!=n?n:[],...null!=s?s:[]]),[n,s]),h=(0,B.useCallback)((e=>{c(e.detail),o(e.detail)}),[o]);(0,B.useEffect)((()=>{let e=!1;return async function(){const t=await ye();if(e)return;const n=await t.parseView(l,{libs:s});if(e)return;f(n);const r=n.errors.filter((e=>!!e.node));r.length>0?d(r.map((e=>({message:e.message,severity:Ke(e.severity),startLineNumber:e.node.loc.start.line,startColumn:e.node.loc.start.column+1,endLineNumber:e.node.loc.end.line,endColumn:e.node.loc.end.column+1})))):d(void 0)}(),()=>{e=!0}}),[l]);const x=(0,B.useMemo)((()=>(0,z.uniqueId)()),[]),b=(0,B.useRef)(null),v=(0,B.useRef)(null);return(0,B.useEffect)((()=>{const e=b.current;if(!e)return;const t=function(e){const t=document.createElement("div");return t.dataset.rootId=e,t.style.position="absolute",t.style.width=t.style.height="0",document.body.append(t),t}(x),n=(0,H.unstable_createRoot)(e,{portal:t,supportsUseChildren:!0});return v.current=n,()=>{n.unmount(),t.remove(),v.current=null}}),[x]),(0,B.useEffect)((()=>{let e=!1;return(async()=>{if(!p)return;let t;try{var n;if(t=await function(e,t){return te.apply(this,arguments)}(p,{rootId:x,expanded:!0,withoutWrapper:r,allowAnyBricks:a}),e)return;const{brick:s,context:o,functions:i,templates:c}=null!=t?t:{};await(null===(n=v.current)||void 0===n?void 0:n.render(null!=s?s:[],{context:o,functions:i,templates:c}))}catch(e){var s;console.error("Failed to render view:",e),null===(s=v.current)||void 0===s||s.render({brick:customElements.get("easyops-default-error")?"easyops-default-error":"div",properties:{errorTitle:"解析失败",dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},children:[{brick:"div",properties:{textContent:(0,H.httpErrorToString)(e)}}]})}})(),()=>{e=!0}}),[x,p,r,a]),O().createElement("div",{className:xe.container},O().createElement("div",{className:xe.editor},O().createElement(B.Suspense,{fallback:"Loading..."},O().createElement(Ie,{value:t,onCodeChange:h,language:"typescript",uri:"file:///View.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:m,extraMarkers:u,"data-override-theme":"dark-v2"}))),O().createElement("div",{className:xe.preview},O().createElement("div",{"data-root-id":x,ref:b})))}ge=Ye,({e:[ke,Ee,_e,je,Se,Ce,Le,Me,Ne,We,$e,Pe,Te,Re],c:[Je,Ae]}=(0,I.A)(ge,[Oe("vb-experiment.tsx-playground",{shadowOptions:!1})],[[Fe({attribute:!1}),1,"source"],[Fe({attribute:!1}),1,"extraLibs"],[Fe({attribute:!1}),1,"viewLibs"],[Fe({type:Boolean}),1,"withoutWrapper"],[Fe({type:Boolean}),1,"allowAnyBricks"],[He({type:"change"}),1,"change",e=>(0,R.A)(qe,e),(e,t)=>(0,T.A)(qe,e,t)]],0,(e=>Ze.has((0,$.A)(e))),J.ReactNextElement)),Ae();var et,tt=n(4504);let nt,rt,at;const{defineElement:st,property:ot}=(0,F.createDecorators)();let it;var ct=new WeakMap;class lt extends J.ReactNextElement{constructor(){super(...arguments),(0,W.A)(this,ct,rt(this)),at(this)}get storyboard(){return(0,R.A)(ct,this)}set storyboard(e){(0,T.A)(ct,this,e)}render(){return O().createElement(ut,{storyboard:this.storyboard})}}function ut(e){let{storyboard:t}=e;const n=(0,B.useRef)(null),[r,a]=(0,B.useState)(null),s=(0,B.useCallback)((()=>{const e=()=>{var t;const r=null===(t=n.current)||void 0===t||null===(t=t.contentWindow)||void 0===t?void 0:t._preview_only_appPreviewer;r?a(r):setTimeout(e,100)};e()}),[]),o=(0,B.useRef)(null);return(0,B.useEffect)((()=>{if(!r||!t)return;const e={id:"lab-app-preview",name:"Lab: App Preview",homepage:"/lab-app-preview",standaloneMode:!0,noPlaceholders:!0};if(o.current){let n=!1;return o.current.then((()=>{n||(r.update(e.id,{...t,app:e}),r.reload())})),()=>{n=!0}}o.current=r.setup({brickPackages:H.__secret_internals.getBrickPackages(),storyboards:[{...t,app:e}]},e.homepage)}),[r,t]),O().createElement("div",{className:"container"},O().createElement("iframe",{ref:n,src:`${(0,H.getBasePath)()}lab/?_experimental_app_preview_=1`,loading:"lazy",onLoad:s}))}et=lt,({e:[rt,at],c:[it,nt]}=(0,I.A)(et,[st("vb-experiment.app-preview",{styleTexts:[tt.A]})],[[ot({attribute:!1}),1,"storyboard"]],0,void 0,J.ReactNextElement)),nt();var dt=n(3310),pt=n(8291),ft=n(9978),mt=n(2025);function ht(){return ht=(0,Z.A)((0,q.A)().mark((function e(t,n){var r,a,s,o,i,c,l,u,d,p,f,m,h,x,b,v,w,y,g,A,k,E,_,j,S,C,L,M;return(0,q.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.entry,a=t.modules,r){e.next=1;break}throw new Error("No entry module found in the app.");case 1:if(s=r.render){e.next=2;break}throw new Error("No render call found in the entry module.");case 2:if(1===(o=s.children).length){e.next=3;break}throw new Error("Expects exactly one root component in the render call, but got ".concat(o.length,"."));case 3:if(i=o[0],(0,pt.dN)(i,"Routes")){e.next=4;break}throw new Error('The root component must be <Routes> from "'.concat(ft.FJ,'".'));case 4:return c={usedHelpers:new Set,app:t,convertedModules:new Map},l=(0,Y.A)(r,c,n),c.convertedModules.set(r.filePath,l),e.next=5,(0,mt.k)(i.children,c,r,n);case 5:u=e.sent,d=[],p=[],f=(0,dt.A)(a);try{for(f.s();!(m=f.n()).done;)h=(0,V.A)(m.value,2),x=h[0],b=h[1],c.convertedModules.has(x)||(v=(0,Y.A)(b,c,n),c.convertedModules.set(x,v))}catch(e){f.e(e)}finally{f.f()}w=(0,dt.A)(c.convertedModules.values()),e.prev=6,w.s();case 7:if((y=w.n()).done){e.next=15;break}if(!(g=y.value)){e.next=14;break}A=0,k=[].concat((0,X.A)(g.internals),(0,X.A)(g.namedExports.values()),[g.defaultExport]);case 8:if(!(A<k.length)){e.next=14;break}if(E=k[A]){e.next=9;break}return e.abrupt("continue",13);case 9:_=E.raw,j=E.promise,L=null==_?void 0:_.type,e.next="function"===L?10:"template"===L?11:13;break;case 10:return d.push(_.function),e.abrupt("continue",13);case 11:return e.next=12,j;case 12:return S=e.sent,p.push({name:(0,Q.v)(S.name),bricks:S.bricks,state:S.context,proxy:S.proxy}),e.abrupt("continue",13);case 13:A++,e.next=8;break;case 14:e.next=7;break;case 15:e.next=17;break;case 16:e.prev=16,M=e.catch(6),w.e(M);case 17:return e.prev=17,w.f(),e.finish(17);case 18:return C=Array.from(c.usedHelpers).map((function(e){var t=(0,K.m)().get(e);if(!t)throw new Error("Helper function ".concat(e," not found"));return{name:e,source:t,typescript:!0}})),e.abrupt("return",{routes:u,functions:[].concat(d,(0,X.A)(C)),templates:p,constants:Object.fromEntries(t.constants)});case 19:case"end":return e.stop()}}),e,null,[[6,16,17,18]])}))),ht.apply(this,arguments)}var xt=n(4373),bt={};bt.styleTagTransform=fe(),bt.setAttributes=le(),bt.insert=ie().bind(null,"head"),bt.domAPI=se(),bt.insertStyleElement=de(),re()(xt.A,bt);const vt=xt.A&&xt.A.locals?xt.A.locals:void 0;var wt;let yt,gt,At,kt,Et,_t,jt,St,Ct;const Lt=O().lazy((async()=>({default:await(0,D.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),Mt=(0,J.wrapBrick)("vb-experiment.app-preview"),Nt=[{filePath:"/node_modules/next-tsx/components.d.ts",content:G.replaceAll("export interface","interface")},{filePath:"/node_modules/next-tsx/package.json",content:JSON.stringify({name:"next-tsx",types:"./index.d.ts"})},{filePath:"/node_modules/next-tsx/index.d.ts",content:U}],{defineElement:Wt,property:$t,event:Pt}=(0,F.createDecorators)();let Tt;var Rt=new WeakMap,It=new WeakMap,Bt=new WeakMap,Ot=new WeakSet,Ft=new WeakMap;class Ht extends J.ReactNextElement{constructor(){super(...arguments),(0,N.A)(this,Ot),(0,W.A)(this,Rt,gt(this)),(0,W.A)(this,It,(At(this),kt(this))),(0,W.A)(this,Bt,(Et(this),_t(this))),(0,W.A)(this,Ft,(Ct(this),e=>{var t;null===(t=(0,P.A)(Ot,this,jt))||void 0===t||t.emit(e)}))}get source(){return(0,R.A)(Rt,this)}set source(e){(0,T.A)(Rt,this,e)}get extraLibs(){return(0,R.A)(It,this)}set extraLibs(e){(0,T.A)(It,this,e)}render(){return O().createElement(Dt,{source:this.source,extraLibs:this.extraLibs,onChange:(0,R.A)(Ft,this)})}}function Jt(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Dt(e){let{source:t,extraLibs:n,onChange:r}=e;const[a,s]=(0,B.useState)(null!=t?t:""),o=(0,B.useDeferredValue)(a),[i,c]=(0,B.useState)(),[l,u]=(0,B.useState)(),d=(0,B.useMemo)((()=>[...Nt,...null!=n?n:[]]),[n]),p=(0,B.useCallback)((e=>{s(e.detail),r(e.detail)}),[r]);(0,B.useEffect)((()=>{let e=!1;return async function(){const t=await ye();if(e)return;const n=await t.parseApp([{filePath:"/index.tsx",content:o}]);if(e)return;u(n);const r=n.errors.filter((e=>!!e.node));r.length>0?c(r.map((e=>({message:e.message,severity:Jt(e.severity),startLineNumber:e.node.loc.start.line,startColumn:e.node.loc.start.column+1,endLineNumber:e.node.loc.end.line,endColumn:e.node.loc.end.column+1})))):c(void 0)}(),()=>{e=!0}}),[o]);const f=(0,B.useMemo)((()=>(0,z.uniqueId)()),[]),[m,h]=(0,B.useState)();return(0,B.useEffect)((()=>{let e=!1;return(async()=>{if(!l)return;let t;try{if(t=await function(e,t){return ht.apply(this,arguments)}(l,{rootId:f,expanded:!0}),e)return;const n={routes:t.routes,meta:{functions:t.functions,customTemplates:t.templates}};h(n)}catch(e){console.error("Failed to render app:",e)}})(),()=>{e=!0}}),[f,l]),O().createElement("div",{className:vt.container},O().createElement("div",{className:vt.editor},O().createElement(B.Suspense,{fallback:"Loading..."},O().createElement(Lt,{value:t,onCodeChange:p,language:"typescript",uri:"file:///index.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:d,extraMarkers:i,"data-override-theme":"dark-v2"}))),O().createElement("div",{className:vt.preview},O().createElement(Mt,{storyboard:m})))}wt=Ht,({e:[gt,At,kt,Et,_t,jt,St,Ct],c:[Tt,yt]}=(0,I.A)(wt,[Wt("vb-experiment.app-playground",{shadowOptions:!1})],[[$t({attribute:!1}),1,"source"],[$t({attribute:!1}),1,"extraLibs"],[Pt({type:"change"}),1,"change",e=>(0,R.A)(Bt,e),(e,t)=>(0,T.A)(Bt,e,t)]],0,(e=>Ft.has((0,$.A)(e))),J.ReactNextElement)),yt()},4373:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,".container--AW813tLb{display:flex;height:100%}.editor--B5m74LRR,\n.preview--THWZoCIv{flex:1;min-width:0}.preview--THWZoCIv{padding:0;height:100%}",""]),o.locals={container:"container--AW813tLb",editor:"editor--B5m74LRR",preview:"preview--THWZoCIv"};const i=o},4504:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,":host{display:block;height:100%}:host([hidden]){display:none}*{box-sizing:border-box}.container,\niframe{width:100%;height:100%;border-radius:4px}iframe{display:block;border:none;margin:0;padding:0;transform-origin:0% 0%;-webkit-user-select:none;user-select:none}",""]);const i=o.toString()},8957:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(6758),a=n.n(r),s=n(935),o=n.n(s)()(a());o.push([e.id,".container--M22i1CYq{display:flex;height:100%}.editor--kF8SUoBP,\n.preview--gu5OlS2X{flex:1;min-width:0}.preview--gu5OlS2X{padding:1em;overflow:auto}",""]),o.locals={container:"container--M22i1CYq",editor:"editor--kF8SUoBP",preview:"preview--gu5OlS2X"};const i=o}}]);
|
|
2
|
+
//# sourceMappingURL=1563.f975c5ed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/1563.e386a37f.js","mappings":"mYA8RAA,eAAeC,EACbC,GAEiB,IADjB,WAAEC,EAAU,KAAEC,GAAO,EAAI,WAAEC,GAA6BC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,EAE5D,aAAaG,EAAAA,EAAAA,IAAOP,EAAQ,CAC1BQ,OAAQP,EAAa,WAAa,QAClCQ,QAAS,CAACC,EAAqBC,GAC/BT,OACAC,aACAS,cAAe,OAEnB,CAEAd,eAAee,EACbC,EACAC,EACAC,GAEA,IAAK,MAAMC,KAAQH,EAAO,CACxB,MAAMI,EAAY,IAAIF,EAAMC,EAAKE,MACjC,GAAkB,WAAdF,EAAKG,KAAmB,CAC1B,MAAMC,EAAcN,EAAOA,OAAOE,EAAKE,YACjCN,EAAwBI,EAAKH,MAAOO,EAAaH,EACzD,MACEH,EAAOO,KACL,GAAGL,EAAKE,UACY,WAAlBF,EA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AA8D,GAAA7D,MAAAC,EAAAA,EAAAA,GAAAqE,GAAA,CA5BAnM,GAAc,+BAAgC,CAE7C+H,eAAe,KACf,EAGC9H,GAAS,CAAE+H,WAAW,IAAQ,aAG9B/H,GAAS,CAAE+H,WAAW,IAAQ,gBAG9B9H,GAAM,CAAE/N,KAAM,WAAW,WAAA+V,IAAA9F,EAAAA,EAAAA,GAAA5B,GAAA0H,GAAA,CAAAA,EAAA7F,KAAAC,EAAAA,EAAAA,GAAA9B,GAAA0H,EAAA7F,KAAA,GAAA8F,GAAArH,GAAArJ,KAAA2Q,EAAAA,EAAAA,GAAAD,KARAnH,EAAAA,mBAAgB6G,I,kECjFxCuE,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,oJACyC,KAElFwX,EAAwBrN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S,kECVIqN,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,0QAC+H,KAExK,QAAewX,EAAwBE,U,kECLnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,wJAC6C,KAEtFwX,EAAwBrN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S","sources":["webpack:///./src/data-providers/export-as-source-files.ts","webpack:///./src/data-providers/export-widgets.ts","webpack:///../../node_modules/@next-tsx/converter/dist/esm/withBox.js","webpack:///../../node_modules/@next-tsx/converter/dist/esm/modules/convertView.js","webpack:///./src/tsx-playground/styles.module.css?e933","webpack:///./src/tsx-playground/workers/tsxParser.ts","webpack:///./src/tsx-playground/index.tsx","webpack:///./src/tsx-playground/createPortal.ts","webpack:///./src/app-preview/index.tsx","webpack:///../../node_modules/@next-tsx/converter/dist/esm/modules/convertApp.js","webpack:///./src/app-playground/styles.module.css?1659","webpack:///./src/app-playground/index.tsx","webpack:///./src/app-playground/styles.module.css","webpack:///./src/app-preview/styles.shadow.css","webpack:///./src/tsx-playground/styles.module.css"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport type { Storyboard, MicroApp, StoryboardMeta } from \"@next-core/types\";\nimport { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\nimport { format } from \"prettier/standalone\";\nimport * as prettierPluginBabel from \"prettier/plugins/babel\";\nimport * as prettierPluginEstree from \"prettier/plugins/estree\";\nimport { transform } from \"@babel/standalone\";\nimport {\n ExtractState,\n extractRoutes,\n extractTemplates,\n} from \"./utils/extract.js\";\nimport {\n SourceFileOrFolder,\n buildFileStructure,\n} from \"./utils/buildFileStructure.js\";\nimport { generate } from \"./utils/generators/generate.js\";\nimport srcResourcesIndexJs from \"./raws/src/resources/index.js.txt\";\nimport srcIndexJs from \"./raws/src/index.js.txt\";\nimport editorConfig from \"./raws/.editorconfig.txt\";\nimport gitIgnore from \"./raws/.gitignore.txt\";\nimport declarationsDTs from \"./raws/declarations.d.ts.txt\";\nimport devConfigMjs from \"./raws/dev.config.mjs.txt\";\nimport jsconfigJson from \"./raws/jsconfig.json.txt\";\nimport nextJsxConfigJs from \"./raws/next-jsx.config.js.txt\";\nimport packageJson from \"./raws/package.json.txt\";\nimport readmeMd from \"./raws/README.md.txt\";\nimport { JS_RESERVED_WORDS } from \"./utils/constants.js\";\nimport TransformStoryboardFunction from \"./utils/plugins/storyboard-function.js\";\nimport SmartImports from \"./utils/plugins/smart-imports.js\";\n\nexport interface StoryboardAssemblyResult {\n storyboard: Storyboard;\n\n projectDetail: {\n appId: string;\n name: string;\n appSetting: Pick<\n MicroApp,\n \"homepage\" | \"theme\" | \"locales\" | \"noAuthGuard\"\n > & {\n layoutType?: string;\n defaultConfig?: string;\n icon?: string;\n };\n brickNextVersion?: number;\n };\n}\n\nexport async function exportAsSourceFiles({\n projectDetail,\n storyboard,\n}: StoryboardAssemblyResult): Promise<void> {\n const zip = new JSZip();\n const project = zip.folder(\"project\")!;\n const src = project.folder(\"src\")!;\n\n const extractState: ExtractState = {\n extracts: [],\n namePool: new Map(),\n };\n const extractedRoutes = extractRoutes(storyboard.routes, [], extractState);\n\n const app: MicroApp & { layoutType?: string } = {\n id: projectDetail.appId,\n name: projectDetail.name,\n homepage: projectDetail.appSetting.homepage,\n layoutType: projectDetail.appSetting.layoutType,\n theme: projectDetail.appSetting.theme,\n noAuthGuard: projectDetail.appSetting.noAuthGuard,\n locales: projectDetail.appSetting.locales,\n defaultConfig: JSON.parse(projectDetail.appSetting.defaultConfig || \"{}\"),\n menuIcon: JSON.parse(projectDetail.appSetting.icon || \"null\"),\n standaloneMode: true,\n };\n src.file(\n \"app.js\",\n await formatJs(`export default ${JSON.stringify(app, null, 2)};`)\n );\n\n const meta = (storyboard.meta ?? {}) as StoryboardMeta & {\n workflows?: unknown;\n userGroups?: unknown;\n };\n const customTemplates = meta.customTemplates ?? [];\n const functions = meta.functions ?? [];\n const menus = meta.menus ?? [];\n const contracts = meta.contracts ?? [];\n const i18n = meta.i18n ?? {};\n delete meta.customTemplates;\n delete meta.functions;\n delete meta.menus;\n delete meta.contracts;\n delete meta.i18n;\n delete meta.workflows;\n delete meta.mocks;\n delete meta.userGroups;\n\n const extractedTemplates = extractTemplates(\n customTemplates,\n [\"components\"],\n extractState\n );\n extractState.extracts.push({\n name: \"index\",\n path: [\"components\"],\n node: extractedTemplates,\n nodeType: \"others\",\n });\n\n const fileStructure = buildFileStructure(extractState.extracts);\n\n src.file(\"index.js\", srcIndexJs);\n\n src.file(\n \"routes.jsx\",\n await formatJs(generate(extractedRoutes, \"routes\", [\"routes.jsx\"]))\n );\n\n const resources = src.folder(\"resources\")!;\n\n // Functions\n const fnDir = resources.folder(\"functions\")!;\n const fnNames: string[] = [];\n const fnImports: string[] = [];\n for (const fn of functions) {\n if (fn.name === \"index\") {\n throw new Error('Unexpected function name: \"index\"');\n }\n\n // Prepend with `export default` for functions\n const inferredImports = new Set<string>();\n let { code } = transform(fn.source, {\n filename: `expr.${fn.typescript ? \"ts\" : \"js\"}`,\n plugins: [\n ...(fn.typescript ? [\"syntax-typescript\"] : []),\n TransformStoryboardFunction,\n [\n SmartImports,\n {\n imports: inferredImports,\n },\n ],\n ],\n }) as { code: string };\n const hasFN = inferredImports.has(\"FN\");\n if (hasFN) {\n inferredImports.delete(\"FN\");\n }\n const importStrings: string[] = [];\n if (inferredImports.size > 0) {\n importStrings.push(\n `import { ${[...inferredImports].join(\", \")} } from \"next-jsx/runtime\";`\n );\n }\n if (hasFN) {\n importStrings.push(`import FN from \"./index.js\";`);\n }\n if (importStrings.length > 0) {\n code = `${importStrings.join(\"\\n\")}\\n\\n${code}`;\n }\n\n fnDir.file(`${fn.name}.${fn.typescript ? \"ts\" : \"js\"}`, code);\n fnImports.push(`import ${fn.name} from \"./${fn.name}.js\";`);\n fnNames.push(fn.name);\n }\n fnDir.file(\n \"index.js\",\n await formatJs(\n `${fnImports.join(\"\\n\")}\\n\\nconst FN = { ${fnNames.join(\n \",\"\n )} };\\n\\nexport default FN;`\n )\n );\n\n // Menus\n const menusDir = resources.folder(\"menus\")!;\n const menuNames: string[] = [];\n const menuImports: string[] = [];\n for (const menu of menus) {\n cleanMenu(menu);\n if (menu.menuId === \"index\") {\n throw new Error('Unexpected menu id: \"index\"');\n }\n const filename = `${menu.menuId}.js`;\n menusDir.file(\n filename,\n await formatJs(generate(menu, \"menu\", [\"resources\", \"menus\", filename]))\n );\n let name = menu.menuId.replace(/^\\d+|[^\\w]+/g, \"_\");\n if (JS_RESERVED_WORDS.has(name)) {\n name = `${name}__2`;\n }\n menuImports.push(`import ${name} from \"./${filename}\";`);\n menuNames.push(name);\n }\n menusDir.file(\n \"index.js\",\n await formatJs(\n `${menuImports.join(\"\\n\")}\\n\\nexport default [${menuNames.join(\",\")}]`\n )\n );\n\n // Contracts\n const contractsDir = resources.folder(\"contracts\")!;\n const contractImports: string[] = [];\n const contractNames = new Set<string>();\n for (const contract of contracts) {\n const baseName = contract.name.replace(/^\\d+|[^\\w]+/g, \"_\");\n let counter = 2;\n let varName = baseName;\n while (\n contractNames.has(varName) ||\n JS_RESERVED_WORDS.has(varName) ||\n varName === \"index\"\n ) {\n varName = `${baseName}_${counter++}`;\n }\n contractNames.add(varName);\n\n contractsDir.file(\n `${varName}.js`,\n await formatJs(`export default ${JSON.stringify(contract)};`)\n );\n contractImports.push(`import ${varName} from \"./${varName}.js\";`);\n }\n contractsDir.file(\n \"index.js\",\n await formatJs(\n `${contractImports.join(\"\\n\")}\\n\\nexport default [${[\n ...contractNames,\n ].join(\",\")}]`\n )\n );\n\n resources\n .folder(\"i18n\")!\n .file(\n \"index.js\",\n await formatJs(`export default ${JSON.stringify(i18n)};`)\n );\n resources.file(\n \"meta.js\",\n await formatJs(`export default ${JSON.stringify(meta, null, 2)};`)\n );\n resources.file(\"index.js\", srcResourcesIndexJs);\n\n await generateByFileStructure(fileStructure, src, []);\n\n const appDir = project\n .folder(\"mock-micro-apps\")!\n .folder(projectDetail.appId)!;\n appDir.file(\".gitignore\", \"*\\n!.gitignore\");\n\n project.file(\".editorconfig\", editorConfig);\n project.file(\".gitignore\", gitIgnore);\n project.file(\"dev.config.mjs\", devConfigMjs);\n project.file(\"declarations.d.ts\", declarationsDTs);\n project.file(\"jsconfig.json\", jsconfigJson);\n project.file(\n \"next-jsx.config.js\",\n nextJsxConfigJs.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"package.json\",\n packageJson.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"README.md\",\n readmeMd\n .replaceAll(\"__PROJECT_NAME__\", projectDetail.name)\n .replaceAll(\"__PROJECT_HOMEPAGE__\", projectDetail.appSetting.homepage)\n );\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, \"project.zip\");\n}\n\ninterface FormatJsOptions {\n typescript?: boolean;\n semi?: boolean;\n printWidth?: number;\n}\n\nasync function formatJs(\n source: string,\n { typescript, semi = true, printWidth }: FormatJsOptions = {}\n): Promise<string> {\n return await format(source, {\n parser: typescript ? \"babel-ts\" : \"babel\",\n plugins: [prettierPluginBabel, prettierPluginEstree as any],\n semi,\n printWidth,\n trailingComma: \"es5\",\n });\n}\n\nasync function generateByFileStructure(\n items: SourceFileOrFolder[],\n folder: JSZip,\n path: string[]\n) {\n for (const item of items) {\n const childPath = [...path, item.name];\n if (item.type === \"folder\") {\n const childFolder = folder.folder(item.name)!;\n await generateByFileStructure(item.items, childFolder, childPath);\n } else {\n folder.file(\n `${item.name}.js${\n item.nodeType === \"routes\" ||\n item.nodeType === \"bricks\" ||\n item.nodeType === \"template\"\n ? \"x\"\n : \"\"\n }`,\n await formatJs(generate(item.node, item.nodeType, childPath))\n );\n }\n }\n}\n\nfunction cleanMenu(menu: Record<string, any>) {\n for (const [key, value] of Object.entries(menu)) {\n switch (key) {\n case \"items\":\n if (Array.isArray(value)) {\n for (const item of value) {\n cleanMenuItem(item);\n }\n }\n break;\n case \"type\":\n if (value === \"main\") {\n delete menu[key];\n }\n break;\n case \"if\":\n break;\n case \"i18n\":\n if (Object.keys(value).length === 0) {\n delete menu[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menu[key];\n }\n }\n }\n}\n\nfunction cleanMenuItem(menuItem: Record<string, any>) {\n for (const [key, value] of Object.entries(menuItem)) {\n switch (key) {\n case \"children\":\n if (Array.isArray(value) && value.length > 0) {\n cleanMenuItem(value);\n }\n break;\n case \"if\":\n break;\n case \"activeExcludes\":\n case \"activeIncludes\":\n if (Array.isArray(value) && value.length === 0) {\n delete menuItem[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menuItem[key];\n }\n }\n }\n}\n\ncustomElements.define(\n \"vb-experiment.export-as-source-files\",\n createProviderClass(exportAsSourceFiles)\n);\n","import { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\n\ninterface ExportWidgetsParams {\n name: string;\n files: FileInfo[];\n}\n\ninterface FileInfo {\n path: string;\n content: string;\n}\n\nexport async function exportWidgets({\n name,\n files,\n}: ExportWidgetsParams): Promise<void> {\n const fs = new Map<string, JSZip>();\n const zip = new JSZip();\n const widgets = zip.folder(\"widgets\")!;\n const project = widgets.folder(name)!;\n\n for (const { path, content } of files) {\n const segments = path.split(\"/\");\n const filename = segments.pop()!;\n let handle = project;\n let i = 1;\n for (const segment of segments) {\n const current = segments.slice(0, i).join(\"/\");\n const found = fs.get(current);\n if (found) {\n handle = found;\n } else {\n handle = handle.folder(segment)!;\n fs.set(current, handle);\n }\n i++;\n }\n handle.file(filename, content);\n }\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, `${name}.zip`);\n}\n\ncustomElements.define(\n \"vb-experiment.export-widgets\",\n createProviderClass(exportWidgets)\n);\n","export function withBox(children, options) {\n return {\n brick: \"div\",\n properties: {\n style: options.expanded ? {\n background: \"rgba(255, 255, 255, 0.9)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"16px\",\n padding: \"24px\"\n } : {\n background: \"var(--elevo-component-background)\",\n backdropFilter: \"var(--elevo-component-backdrop-filter)\",\n borderRadius: \"var(--elevo-border-radius)\",\n padding: \"16px\"\n }\n },\n children: children\n };\n}\n//# sourceMappingURL=withBox.js.map","import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _regeneratorRuntime from \"@babel/runtime/helpers/regeneratorRuntime\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport convertModule from \"./convertModule.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nimport { getViewTplName } from \"./getTplName.js\";\nimport { withBox } from \"../withBox.js\";\nexport function convertView(_x, _x2) {\n return _convertView.apply(this, arguments);\n}\nfunction _convertView() {\n _convertView = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(view, options) {\n var _convertedEntry;\n var entry, convertedEntry, state, functions, templates, helpers, _ref2, title, bricks, context, needBox;\n return _regeneratorRuntime().wrap(function (_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n entry = view.entry;\n if (entry) {\n _context2.next = 1;\n break;\n }\n throw new Error(\"No entry module found in the view.\");\n case 1:\n state = {\n usedHelpers: new Set(),\n app: view,\n convertedModules: new Map()\n };\n functions = [];\n templates = [];\n _context2.next = 2;\n return Promise.all(Array.from(view.modules.values()).map(/*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(mod) {\n var converted, _i, _arr, part, raw, promise, _part, _t;\n return _regeneratorRuntime().wrap(function (_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!mod) {\n _context.next = 8;\n break;\n }\n _context.next = 1;\n return convertModule(mod, state, options);\n case 1:\n converted = _context.sent;\n if (mod === entry) {\n convertedEntry = converted;\n }\n _i = 0, _arr = [].concat(_toConsumableArray(converted.internals), _toConsumableArray(converted.namedExports.values()), [converted.defaultExport]);\n case 2:\n if (!(_i < _arr.length)) {\n _context.next = 8;\n break;\n }\n part = _arr[_i];\n if (part) {\n _context.next = 3;\n break;\n }\n return _context.abrupt(\"continue\", 7);\n case 3:\n raw = part.raw, promise = part.promise;\n _t = raw === null || raw === void 0 ? void 0 : raw.type;\n _context.next = _t === \"function\" ? 4 : _t === \"template\" ? 5 : 7;\n break;\n case 4:\n functions.push(raw[\"function\"]);\n return _context.abrupt(\"continue\", 7);\n case 5:\n _context.next = 6;\n return promise;\n case 6:\n _part = _context.sent;\n templates.push({\n name: getViewTplName(_part.name, options.rootId),\n bricks: _part.bricks,\n state: _part.context\n });\n return _context.abrupt(\"continue\", 7);\n case 7:\n _i++;\n _context.next = 2;\n break;\n case 8:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x3) {\n return _ref.apply(this, arguments);\n };\n }()));\n case 2:\n if ((_convertedEntry = convertedEntry) !== null && _convertedEntry !== void 0 && _convertedEntry.defaultExport) {\n _context2.next = 3;\n break;\n }\n throw new Error(\"No view found in the entry module.\");\n case 3:\n helpers = Array.from(state.usedHelpers).map(function (name) {\n var source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(\"Helper function \".concat(name, \" not found\"));\n }\n return {\n name: name,\n source: source,\n typescript: true\n };\n });\n _context2.next = 4;\n return convertedEntry.defaultExport.promise;\n case 4:\n _ref2 = _context2.sent;\n title = _ref2.title;\n bricks = _ref2.bricks;\n context = _ref2.context;\n needBox = function needBox() {\n return bricks.every(function (brick) {\n return [\"eo-form\", \"eo-descriptions\", \"eo-button\"].includes(brick.brick);\n });\n };\n return _context2.abrupt(\"return\", {\n title: title,\n brick: options.withoutWrapper ? bricks : {\n brick: \"eo-content-layout\",\n children: needBox() ? [withBox(bricks, options)] : bricks\n },\n context: [].concat(_toConsumableArray(context), _toConsumableArray(options.withContexts ? Object.entries(options.withContexts).map(function (_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n name = _ref4[0],\n value = _ref4[1];\n return {\n name: name,\n value: value\n };\n }) : [])),\n functions: [].concat(functions, _toConsumableArray(helpers)),\n templates: templates\n });\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _convertView.apply(this, arguments);\n}\n//# sourceMappingURL=convertView.js.map","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","// istanbul ignore file\nimport type { ParsedApp, ParseOptions, SourceFile } from \"@next-tsx/parser\";\nimport { wrap } from \"comlink\";\n\nexport interface RemoteTsxParserWorker {\n parseView(source: string, options?: ParseOptions): Promise<ParsedApp>;\n parseApp(files: SourceFile[]): Promise<ParsedApp>;\n}\n\nlet remoteWorkerPromise: Promise<RemoteTsxParserWorker> | undefined;\n\nlet worker: Worker | undefined;\n\nexport function getRemoteTsxParserWorker() {\n if (!remoteWorkerPromise) {\n remoteWorkerPromise = (async () => {\n const Remote = wrap<{ new (): RemoteTsxParserWorker }>(getWorker());\n return await new Remote();\n })();\n }\n return remoteWorkerPromise;\n}\n\nfunction getWorker() {\n if (!worker) {\n worker = new Worker(new URL(\"./tsxParser.worker.ts\", import.meta.url));\n }\n return worker;\n}\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { httpErrorToString, unstable_createRoot } from \"@next-core/runtime\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-tsx/core/index.d.ts?raw\";\nimport componentsDefinition from \"@next-tsx/converter/lib/components.d.ts?raw\";\nimport { convertView, type ConvertResult } from \"@next-tsx/converter\";\nimport type { ParsedApp, SourceFile } from \"@next-tsx/parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"./workers/tsxParser.js\";\nimport { createPortal } from \"./createPortal.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface TsxPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n viewLibs?: SourceFile[];\n withoutWrapper?: boolean;\n allowAnyBricks?: boolean;\n}\n\n/**\n * 构件 `vb-experiment.tsx-playground`\n */\nexport\n@defineElement(\"vb-experiment.tsx-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass TsxPlayground extends ReactNextElement implements TsxPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @property({ attribute: false })\n accessor viewLibs: SourceFile[] | undefined;\n\n @property({ type: Boolean })\n accessor withoutWrapper: boolean | undefined;\n\n @property({ type: Boolean })\n accessor allowAnyBricks: boolean | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <TsxPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n viewLibs={this.viewLibs}\n withoutWrapper={this.withoutWrapper}\n allowAnyBricks={this.allowAnyBricks}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface TsxPlaygroundComponentProps extends TsxPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction TsxPlaygroundComponent({\n source,\n extraLibs,\n withoutWrapper,\n allowAnyBricks,\n viewLibs,\n onChange,\n}: TsxPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [view, setView] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? []), ...(viewLibs ?? [])],\n [extraLibs, viewLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseView(deferredCode, { libs: viewLibs });\n if (ignore) {\n return;\n }\n setView(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n const ref = useRef<HTMLDivElement>(null);\n const rootRef = useRef<Awaited<\n ReturnType<typeof unstable_createRoot>\n > | null>(null);\n\n useEffect(() => {\n const container = ref.current;\n if (!container) {\n return;\n }\n const portal = createPortal(rootId);\n const root = unstable_createRoot(container, {\n portal,\n supportsUseChildren: true,\n } as any);\n rootRef.current = root;\n\n return () => {\n root.unmount();\n portal.remove();\n rootRef.current = null;\n };\n }, [rootId]);\n\n // const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!view) {\n return;\n }\n // setLoading(true);\n let convertedView: ConvertResult | undefined;\n try {\n convertedView = await convertView(view, {\n rootId,\n expanded: true,\n withoutWrapper,\n allowAnyBricks,\n });\n if (ignore) {\n return;\n }\n const { brick, context, functions, templates } = convertedView ?? {};\n await rootRef.current?.render(brick ?? [], {\n context,\n functions,\n templates,\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render view:\", error);\n rootRef.current?.render({\n brick: customElements.get(\"easyops-default-error\")\n ? \"easyops-default-error\"\n : \"div\",\n properties: {\n errorTitle: \"解析失败\",\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n children: [\n {\n brick: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n },\n ],\n });\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, view, withoutWrapper, allowAnyBricks]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///View.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <div data-root-id={rootId} ref={ref} />\n </div>\n </div>\n );\n}\n","export function createPortal(rootId: string) {\n const portal = document.createElement(\"div\");\n portal.dataset.rootId = rootId;\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { __secret_internals, getBasePath } from \"@next-core/runtime\";\nimport type { BootstrapData, MicroApp, Storyboard } from \"@next-core/types\";\nimport \"@next-core/theme\";\nimport styleText from \"./styles.shadow.css\";\n\nconst { defineElement, property } = createDecorators();\n\nexport interface AppPreviewProps {\n storyboard?: Storyboard;\n}\n\n/**\n * 构件 `vb-experiment.app-preview`\n */\nexport\n@defineElement(\"vb-experiment.app-preview\", {\n styleTexts: [styleText],\n})\nclass AppPreview extends ReactNextElement {\n @property({ attribute: false })\n accessor storyboard: Storyboard | undefined;\n\n render() {\n return <AppPreviewComponent storyboard={this.storyboard} />;\n }\n}\n\ninterface PreviewWindow extends Window {\n _preview_only_appPreviewer?: AppPreviewer;\n}\n\ninterface AppPreviewer {\n setup(data: BootstrapData, url: string): Promise<void>;\n update(appId: string, storyboard: Partial<Storyboard>): void;\n reload(): void;\n push(url: string): void;\n replace(url: string): void;\n goBack(): void;\n goForward(): void;\n}\n\nfunction AppPreviewComponent({ storyboard }: AppPreviewProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const [appPreviewer, setAppPreviewer] = useState<AppPreviewer | null>(null);\n\n const handleIframeLoad = useCallback(() => {\n const check = () => {\n const previewer = (iframeRef.current?.contentWindow as PreviewWindow)\n ?._preview_only_appPreviewer;\n if (previewer) {\n setAppPreviewer(previewer);\n } else {\n setTimeout(check, 100);\n }\n };\n check();\n }, []);\n\n const setupRef = useRef<Promise<void> | null>(null);\n\n useEffect(() => {\n if (!appPreviewer || !storyboard) {\n return;\n }\n\n const app = {\n id: \"lab-app-preview\",\n name: \"Lab: App Preview\",\n homepage: \"/lab-app-preview\",\n standaloneMode: true,\n noPlaceholders: true,\n } as MicroApp;\n\n if (setupRef.current) {\n let ignore = false;\n setupRef.current.then(() => {\n if (ignore) {\n return;\n }\n appPreviewer.update(app.id, { ...storyboard, app });\n appPreviewer.reload();\n });\n return () => {\n ignore = true;\n };\n } else {\n setupRef.current = appPreviewer.setup(\n {\n brickPackages: (__secret_internals as any).getBrickPackages(),\n storyboards: [\n {\n ...storyboard,\n app,\n },\n ],\n },\n app.homepage\n );\n }\n }, [appPreviewer, storyboard]);\n\n return (\n <div className=\"container\">\n <iframe\n ref={iframeRef}\n src={`${getBasePath()}lab/?_experimental_app_preview_=1`}\n loading=\"lazy\"\n onLoad={handleIframeLoad}\n />\n </div>\n );\n}\n","import _regeneratorRuntime from \"@babel/runtime/helpers/regeneratorRuntime\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _createForOfIteratorHelper from \"@babel/runtime/helpers/createForOfIteratorHelper\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { MODULE_SOURCE, isOfficialComponent } from \"@next-tsx/parser\";\nimport convertModule from \"./convertModule.js\";\nimport { getAppTplName } from \"./getTplName.js\";\nimport { convertRoutes } from \"./convertRoutes.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nexport function convertApp(_x, _x2) {\n return _convertApp.apply(this, arguments);\n}\nfunction _convertApp() {\n _convertApp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(app, options) {\n var entry, modules, render, children, routesComponent, state, convertingEntry, routes, functions, templates, _iterator, _step, _step$value, filePath, mod, convertedMod, _iterator2, _step2, _mod, _i, _arr, part, raw, promise, _part, helpers, _t, _t2;\n return _regeneratorRuntime().wrap(function (_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n entry = app.entry, modules = app.modules;\n if (entry) {\n _context.next = 1;\n break;\n }\n throw new Error(\"No entry module found in the app.\");\n case 1:\n render = entry.render;\n if (render) {\n _context.next = 2;\n break;\n }\n throw new Error(\"No render call found in the entry module.\");\n case 2:\n children = render.children;\n if (!(children.length !== 1)) {\n _context.next = 3;\n break;\n }\n throw new Error(\"Expects exactly one root component in the render call, but got \".concat(children.length, \".\"));\n case 3:\n routesComponent = children[0];\n if (isOfficialComponent(routesComponent, \"Routes\")) {\n _context.next = 4;\n break;\n }\n throw new Error(\"The root component must be <Routes> from \\\"\".concat(MODULE_SOURCE, \"\\\".\"));\n case 4:\n state = {\n usedHelpers: new Set(),\n app: app,\n convertedModules: new Map()\n };\n convertingEntry = convertModule(entry, state, options);\n state.convertedModules.set(entry.filePath, convertingEntry);\n _context.next = 5;\n return convertRoutes(routesComponent.children, state, entry, options);\n case 5:\n routes = _context.sent;\n functions = [];\n templates = []; // Some modules are not converted after routes being converted,\n // such as functions.\n _iterator = _createForOfIteratorHelper(modules);\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n _step$value = _slicedToArray(_step.value, 2), filePath = _step$value[0], mod = _step$value[1];\n if (!state.convertedModules.has(filePath)) {\n convertedMod = convertModule(mod, state, options);\n state.convertedModules.set(filePath, convertedMod);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n _iterator2 = _createForOfIteratorHelper(state.convertedModules.values());\n _context.prev = 6;\n _iterator2.s();\n case 7:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 15;\n break;\n }\n _mod = _step2.value;\n if (!_mod) {\n _context.next = 14;\n break;\n }\n _i = 0, _arr = [].concat(_toConsumableArray(_mod.internals), _toConsumableArray(_mod.namedExports.values()), [_mod.defaultExport]);\n case 8:\n if (!(_i < _arr.length)) {\n _context.next = 14;\n break;\n }\n part = _arr[_i];\n if (part) {\n _context.next = 9;\n break;\n }\n return _context.abrupt(\"continue\", 13);\n case 9:\n raw = part.raw, promise = part.promise;\n _t = raw === null || raw === void 0 ? void 0 : raw.type;\n _context.next = _t === \"function\" ? 10 : _t === \"template\" ? 11 : 13;\n break;\n case 10:\n functions.push(raw[\"function\"]);\n return _context.abrupt(\"continue\", 13);\n case 11:\n _context.next = 12;\n return promise;\n case 12:\n _part = _context.sent;\n templates.push({\n name: getAppTplName(_part.name),\n bricks: _part.bricks,\n state: _part.context,\n proxy: _part.proxy\n });\n return _context.abrupt(\"continue\", 13);\n case 13:\n _i++;\n _context.next = 8;\n break;\n case 14:\n _context.next = 7;\n break;\n case 15:\n _context.next = 17;\n break;\n case 16:\n _context.prev = 16;\n _t2 = _context[\"catch\"](6);\n _iterator2.e(_t2);\n case 17:\n _context.prev = 17;\n _iterator2.f();\n return _context.finish(17);\n case 18:\n helpers = Array.from(state.usedHelpers).map(function (name) {\n var source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(\"Helper function \".concat(name, \" not found\"));\n }\n return {\n name: name,\n source: source,\n typescript: true\n };\n });\n return _context.abrupt(\"return\", {\n routes: routes,\n functions: [].concat(functions, _toConsumableArray(helpers)),\n templates: templates,\n constants: Object.fromEntries(app.constants)\n });\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[6, 16, 17, 18]]);\n }));\n return _convertApp.apply(this, arguments);\n}\n//# sourceMappingURL=convertApp.js.map","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement, wrapBrick } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport type { Storyboard } from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-tsx/core/index.d.ts?raw\";\nimport componentsDefinition from \"@next-tsx/converter/lib/components.d.ts?raw\";\nimport { convertApp, type ConvertedApp } from \"@next-tsx/converter\";\nimport type { ParsedApp } from \"@next-tsx/parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"../tsx-playground/workers/tsxParser.js\";\nimport type { AppPreview, AppPreviewProps } from \"../app-preview/index.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst WrappedAppPreview = wrapBrick<AppPreview, AppPreviewProps>(\n \"vb-experiment.app-preview\"\n);\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface AppPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n}\n\n/**\n * 构件 `vb-experiment.app-playground`\n */\nexport\n@defineElement(\"vb-experiment.app-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass AppPlayground extends ReactNextElement implements AppPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <AppPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface AppPlaygroundComponentProps extends AppPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction AppPlaygroundComponent({\n source,\n extraLibs,\n onChange,\n}: AppPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [app, setApp] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? [])],\n [extraLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseApp([\n {\n filePath: \"/index.tsx\",\n content: deferredCode,\n },\n ]);\n if (ignore) {\n return;\n }\n setApp(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n\n // const [loading, setLoading] = useState(true);\n\n const [storyboard, setStoryboard] = useState<Storyboard | undefined>();\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!app) {\n return;\n }\n // setLoading(true);\n let convertedApp: ConvertedApp | undefined;\n try {\n convertedApp = await convertApp(app, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n const storyboard = {\n routes: convertedApp.routes,\n meta: {\n functions: convertedApp.functions,\n customTemplates: convertedApp.templates,\n },\n } as Partial<Storyboard> as Storyboard;\n setStoryboard(storyboard);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render app:\", error);\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, app]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///index.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <WrappedAppPreview storyboard={storyboard} />\n </div>\n </div>\n );\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--AW813tLb{display:flex;height:100%}.editor--B5m74LRR,\n.preview--THWZoCIv{flex:1;min-width:0}.preview--THWZoCIv{padding:0;height:100%}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--AW813tLb`,\n\t\"editor\": `editor--B5m74LRR`,\n\t\"preview\": `preview--THWZoCIv`\n};\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block;height:100%}:host([hidden]){display:none}*{box-sizing:border-box}.container,\niframe{width:100%;height:100%;border-radius:4px}iframe{display:block;border:none;margin:0;padding:0;transform-origin:0% 0%;-webkit-user-select:none;user-select:none}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--M22i1CYq{display:flex;height:100%}.editor--kF8SUoBP,\n.preview--gu5OlS2X{flex:1;min-width:0}.preview--gu5OlS2X{padding:1em;overflow:auto}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--M22i1CYq`,\n\t\"editor\": `editor--kF8SUoBP`,\n\t\"preview\": `preview--gu5OlS2X`\n};\nexport default ___CSS_LOADER_EXPORT___;\n"],"names":["async","formatJs","source","typescript","semi","printWidth","arguments","length","undefined","format","parser","plugins","prettierPluginBabel","prettierPluginEstree","trailingComma","generateByFileStructure","items","folder","path","item","childPath","name","type","childFolder","file","nodeType","generate","node","cleanMenu","menu","key","value","Object","entries","Array","isArray","cleanMenuItem","keys","menuItem","customElements","define","createProviderClass","_ref","_storyboard$meta","_meta$customTemplates","_meta$functions","_meta$menus","_meta$contracts","_meta$i18n","projectDetail","storyboard","zip","JSZip","project","src","extractState","extracts","namePool","Map","extractedRoutes","extractRoutes","routes","app","id","appId","homepage","appSetting","layoutType","theme","noAuthGuard","locales","defaultConfig","JSON","parse","menuIcon","icon","standaloneMode","stringify","meta","customTemplates","functions","menus","contracts","i18n","workflows","mocks","userGroups","extractedTemplates","extractTemplates","push","fileStructure","buildFileStructure","srcIndexJs","resources","fnDir","fnNames","fnImports","fn","Error","inferredImports","Set","code","transform","filename","TransformStoryboardFunction","SmartImports","imports","hasFN","has","delete","importStrings","size","join","menusDir","menuNames","menuImports","menuId","replace","JS_RESERVED_WORDS","contractsDir","contractImports","contractNames","contract","baseName","counter","varName","add","srcResourcesIndexJs","editorConfig","gitIgnore","devConfigMjs","declarationsDTs","jsconfigJson","nextJsxConfigJs","replaceAll","packageJson","readmeMd","blob","generateAsync","saveAs","files","fs","content","segments","split","pop","handle","i","segment","current","slice","found","get","set","withBox","children","options","brick","properties","style","expanded","background","backdropFilter","borderRadius","padding","_convertView","mark","_callee2","view","_convertedEntry","entry","convertedEntry","state","templates","helpers","_ref2","title","bricks","context","needBox","wrap","_context2","prev","next","usedHelpers","convertedModules","Promise","all","from","modules","values","map","_callee","mod","converted","_i","_arr","part","raw","promise","_part","_t","_context","convertModule","sent","concat","internals","namedExports","defaultExport","abrupt","rootId","stop","_x3","apply","this","every","includes","withoutWrapper","withContexts","_ref3","_ref4","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","remoteWorkerPromise","worker","getRemoteTsxParserWorker","Remote","Worker","URL","AsyncWrappedCodeEditor","React","default","asyncWrapBrick","onCodeChange","BUILTIN_LIBS","filePath","componentsDefinition","types","nextTsxDefinition","defineElement","property","event","createDecorators","_TsxPlayground","_A","WeakMap","_B","_C","_D","_E","_F","_TsxPlayground_brand","WeakSet","_handleChange","TsxPlayground","ReactNextElement","constructor","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_source","_init_extra_source","_init_extraLibs","_init_extra_extraLibs","_init_viewLibs","_init_extra_viewLibs","_init_withoutWrapper","_init_extra_withoutWrapper","_init_allowAnyBricks","_init_extra_allowAnyBricks","_init_change","_init_extra_change","_classPrivateGetter2","_classPrivateGetter","_get_change","emit","_classPrivateFieldGet","v","_classPrivateFieldSet","extraLibs","viewLibs","allowAnyBricks","render","TsxPlaygroundComponent","onChange","convertSeverity","severity","setCode","useState","deferredCode","useDeferredValue","markers","setMarkers","setView","allLibs","useMemo","handleCodeChange","useCallback","e","detail","useEffect","ignore","result","parseView","libs","withNodeErrors","errors","filter","err","error","message","startLineNumber","loc","start","line","startColumn","column","endLineNumber","end","endColumn","uniqueId","ref","useRef","rootRef","container","portal","document","createElement","dataset","position","width","height","body","append","createPortal","root","unstable_createRoot","supportsUseChildren","unmount","remove","convertedView","_rootRef$current","_x","_x2","convertView","_rootRef$current2","console","errorTitle","errorBoundary","color","textContent","httpErrorToString","className","styles","editor","Suspense","fallback","language","uri","automaticLayout","extraMarkers","preview","_TsxPlayground2","_set_change","c","_initClass","_applyDecs","shadowOptions","attribute","Boolean","o","_","_checkInRHS","_AppPreview","AppPreview","_init_storyboard","_init_extra_storyboard","AppPreviewComponent","iframeRef","appPreviewer","setAppPreviewer","handleIframeLoad","check","_iframeRef$current","previewer","contentWindow","_preview_only_appPreviewer","setTimeout","setupRef","noPlaceholders","then","update","reload","setup","brickPackages","__secret_internals","getBrickPackages","storyboards","getBasePath","loading","onLoad","_AppPreview2","styleTexts","styleText","_convertApp","routesComponent","convertingEntry","_iterator","_step","_step$value","convertedMod","_iterator2","_step2","_mod","_t2","convertRoutes","s","n","done","f","proxy","finish","constants","fromEntries","WrappedAppPreview","wrapBrick","_AppPlayground","_AppPlayground_brand","AppPlayground","AppPlaygroundComponent","setApp","parseApp","setStoryboard","convertedApp","convertApp","_AppPlayground2","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"chunks/1563.f975c5ed.js","mappings":"kYA8RAA,eAAeC,EACbC,GAEiB,IADjB,WAAEC,EAAU,KAAEC,GAAO,EAAI,WAAEC,GAA6BC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,EAE5D,aAAaG,EAAAA,EAAAA,IAAOP,EAAQ,CAC1BQ,OAAQP,EAAa,WAAa,QAClCQ,QAAS,CAACC,EAAqBC,GAC/BT,OACAC,aACAS,cAAe,OAEnB,CAEAd,eAAee,EACbC,EACAC,EACAC,GAEA,IAAK,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UAAWe,EACXkE,aAAcrE,EACd,sBAAoB,cAI1B5D,IAAAA,cAAA,OAAKyH,UAAWC,GAAOQ,SACrBlI,IAAAA,cAACiM,GAAiB,CAACzX,WAAYA,KAIvC,CApJCoY,GAAAP,KAAAlI,GAAAtC,GAAAC,GAAAC,GAAAC,GAAAO,GAAAI,GAAAyF,GAAA5F,IAAA6F,GAAA8D,GAAA7D,MAAAC,EAAAA,EAAAA,GAAAqE,GAAA,CA5BAnM,GAAc,+BAAgC,CAE7C+H,eAAe,KACf,EAGC9H,GAAS,CAAE+H,WAAW,IAAQ,aAG9B/H,GAAS,CAAE+H,WAAW,IAAQ,gBAG9B9H,GAAM,CAAE/N,KAAM,WAAW,WAAA+V,IAAA9F,EAAAA,EAAAA,GAAA5B,GAAA0H,GAAA,CAAAA,EAAA7F,KAAAC,EAAAA,EAAAA,GAAA9B,GAAA0H,EAAA7F,KAAA,GAAA8F,GAAArH,GAAArJ,KAAA2Q,EAAAA,EAAAA,GAAAD,KARAnH,EAAAA,mBAAgB6G,I,kECjFxCuE,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,oJACyC,KAElFwX,EAAwBrN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S,kECVIqN,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,0QAC+H,KAExK,QAAewX,EAAwBE,U,kECLnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB9V,KAAK,CAAC+V,EAAOzX,GAAI,wJAC6C,KAEtFwX,EAAwBrN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S","sources":["webpack:///./src/data-providers/export-as-source-files.ts","webpack:///./src/data-providers/export-widgets.ts","webpack:///../../node_modules/@next-tsx/converter/dist/esm/withBox.js","webpack:///../../node_modules/@next-tsx/converter/dist/esm/modules/convertView.js","webpack:///./src/tsx-playground/styles.module.css?e933","webpack:///./src/tsx-playground/workers/tsxParser.ts","webpack:///./src/tsx-playground/index.tsx","webpack:///./src/tsx-playground/createPortal.ts","webpack:///./src/app-preview/index.tsx","webpack:///../../node_modules/@next-tsx/converter/dist/esm/modules/convertApp.js","webpack:///./src/app-playground/styles.module.css?1659","webpack:///./src/app-playground/index.tsx","webpack:///./src/app-playground/styles.module.css","webpack:///./src/app-preview/styles.shadow.css","webpack:///./src/tsx-playground/styles.module.css"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport type { Storyboard, MicroApp, StoryboardMeta } from \"@next-core/types\";\nimport { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\nimport { format } from \"prettier/standalone\";\nimport * as prettierPluginBabel from \"prettier/plugins/babel\";\nimport * as prettierPluginEstree from \"prettier/plugins/estree\";\nimport { transform } from \"@babel/standalone\";\nimport {\n ExtractState,\n extractRoutes,\n extractTemplates,\n} from \"./utils/extract.js\";\nimport {\n SourceFileOrFolder,\n buildFileStructure,\n} from \"./utils/buildFileStructure.js\";\nimport { generate } from \"./utils/generators/generate.js\";\nimport srcResourcesIndexJs from \"./raws/src/resources/index.js.txt\";\nimport srcIndexJs from \"./raws/src/index.js.txt\";\nimport editorConfig from \"./raws/.editorconfig.txt\";\nimport gitIgnore from \"./raws/.gitignore.txt\";\nimport declarationsDTs from \"./raws/declarations.d.ts.txt\";\nimport devConfigMjs from \"./raws/dev.config.mjs.txt\";\nimport jsconfigJson from \"./raws/jsconfig.json.txt\";\nimport nextJsxConfigJs from \"./raws/next-jsx.config.js.txt\";\nimport packageJson from \"./raws/package.json.txt\";\nimport readmeMd from \"./raws/README.md.txt\";\nimport { JS_RESERVED_WORDS } from \"./utils/constants.js\";\nimport TransformStoryboardFunction from \"./utils/plugins/storyboard-function.js\";\nimport SmartImports from \"./utils/plugins/smart-imports.js\";\n\nexport interface StoryboardAssemblyResult {\n storyboard: Storyboard;\n\n projectDetail: {\n appId: string;\n name: string;\n appSetting: Pick<\n MicroApp,\n \"homepage\" | \"theme\" | \"locales\" | \"noAuthGuard\"\n > & {\n layoutType?: string;\n defaultConfig?: string;\n icon?: string;\n };\n brickNextVersion?: number;\n };\n}\n\nexport async function exportAsSourceFiles({\n projectDetail,\n storyboard,\n}: StoryboardAssemblyResult): Promise<void> {\n const zip = new JSZip();\n const project = zip.folder(\"project\")!;\n const src = project.folder(\"src\")!;\n\n const extractState: ExtractState = {\n extracts: [],\n namePool: new Map(),\n };\n const extractedRoutes = extractRoutes(storyboard.routes, [], extractState);\n\n const app: MicroApp & { layoutType?: string } = {\n id: projectDetail.appId,\n name: projectDetail.name,\n homepage: projectDetail.appSetting.homepage,\n layoutType: projectDetail.appSetting.layoutType,\n theme: projectDetail.appSetting.theme,\n noAuthGuard: projectDetail.appSetting.noAuthGuard,\n locales: projectDetail.appSetting.locales,\n defaultConfig: JSON.parse(projectDetail.appSetting.defaultConfig || \"{}\"),\n menuIcon: JSON.parse(projectDetail.appSetting.icon || \"null\"),\n standaloneMode: true,\n };\n src.file(\n \"app.js\",\n await formatJs(`export default ${JSON.stringify(app, null, 2)};`)\n );\n\n const meta = (storyboard.meta ?? {}) as StoryboardMeta & {\n workflows?: unknown;\n userGroups?: unknown;\n };\n const customTemplates = meta.customTemplates ?? [];\n const functions = meta.functions ?? [];\n const menus = meta.menus ?? [];\n const contracts = meta.contracts ?? [];\n const i18n = meta.i18n ?? {};\n delete meta.customTemplates;\n delete meta.functions;\n delete meta.menus;\n delete meta.contracts;\n delete meta.i18n;\n delete meta.workflows;\n delete meta.mocks;\n delete meta.userGroups;\n\n const extractedTemplates = extractTemplates(\n customTemplates,\n [\"components\"],\n extractState\n );\n extractState.extracts.push({\n name: \"index\",\n path: [\"components\"],\n node: extractedTemplates,\n nodeType: \"others\",\n });\n\n const fileStructure = buildFileStructure(extractState.extracts);\n\n src.file(\"index.js\", srcIndexJs);\n\n src.file(\n \"routes.jsx\",\n await formatJs(generate(extractedRoutes, \"routes\", [\"routes.jsx\"]))\n );\n\n const resources = src.folder(\"resources\")!;\n\n // Functions\n const fnDir = resources.folder(\"functions\")!;\n const fnNames: string[] = [];\n const fnImports: string[] = [];\n for (const fn of functions) {\n if (fn.name === \"index\") {\n throw new Error('Unexpected function name: \"index\"');\n }\n\n // Prepend with `export default` for functions\n const inferredImports = new Set<string>();\n let { code } = transform(fn.source, {\n filename: `expr.${fn.typescript ? \"ts\" : \"js\"}`,\n plugins: [\n ...(fn.typescript ? [\"syntax-typescript\"] : []),\n TransformStoryboardFunction,\n [\n SmartImports,\n {\n imports: inferredImports,\n },\n ],\n ],\n }) as { code: string };\n const hasFN = inferredImports.has(\"FN\");\n if (hasFN) {\n inferredImports.delete(\"FN\");\n }\n const importStrings: string[] = [];\n if (inferredImports.size > 0) {\n importStrings.push(\n `import { ${[...inferredImports].join(\", \")} } from \"next-jsx/runtime\";`\n );\n }\n if (hasFN) {\n importStrings.push(`import FN from \"./index.js\";`);\n }\n if (importStrings.length > 0) {\n code = `${importStrings.join(\"\\n\")}\\n\\n${code}`;\n }\n\n fnDir.file(`${fn.name}.${fn.typescript ? \"ts\" : \"js\"}`, code);\n fnImports.push(`import ${fn.name} from \"./${fn.name}.js\";`);\n fnNames.push(fn.name);\n }\n fnDir.file(\n \"index.js\",\n await formatJs(\n `${fnImports.join(\"\\n\")}\\n\\nconst FN = { ${fnNames.join(\n \",\"\n )} };\\n\\nexport default FN;`\n )\n );\n\n // Menus\n const menusDir = resources.folder(\"menus\")!;\n const menuNames: string[] = [];\n const menuImports: string[] = [];\n for (const menu of menus) {\n cleanMenu(menu);\n if (menu.menuId === \"index\") {\n throw new Error('Unexpected menu id: \"index\"');\n }\n const filename = `${menu.menuId}.js`;\n menusDir.file(\n filename,\n await formatJs(generate(menu, \"menu\", [\"resources\", \"menus\", filename]))\n );\n let name = menu.menuId.replace(/^\\d+|[^\\w]+/g, \"_\");\n if (JS_RESERVED_WORDS.has(name)) {\n name = `${name}__2`;\n }\n menuImports.push(`import ${name} from \"./${filename}\";`);\n menuNames.push(name);\n }\n menusDir.file(\n \"index.js\",\n await formatJs(\n `${menuImports.join(\"\\n\")}\\n\\nexport default [${menuNames.join(\",\")}]`\n )\n );\n\n // Contracts\n const contractsDir = resources.folder(\"contracts\")!;\n const contractImports: string[] = [];\n const contractNames = new Set<string>();\n for (const contract of contracts) {\n const baseName = contract.name.replace(/^\\d+|[^\\w]+/g, \"_\");\n let counter = 2;\n let varName = baseName;\n while (\n contractNames.has(varName) ||\n JS_RESERVED_WORDS.has(varName) ||\n varName === \"index\"\n ) {\n varName = `${baseName}_${counter++}`;\n }\n contractNames.add(varName);\n\n contractsDir.file(\n `${varName}.js`,\n await formatJs(`export default ${JSON.stringify(contract)};`)\n );\n contractImports.push(`import ${varName} from \"./${varName}.js\";`);\n }\n contractsDir.file(\n \"index.js\",\n await formatJs(\n `${contractImports.join(\"\\n\")}\\n\\nexport default [${[\n ...contractNames,\n ].join(\",\")}]`\n )\n );\n\n resources\n .folder(\"i18n\")!\n .file(\n \"index.js\",\n await formatJs(`export default ${JSON.stringify(i18n)};`)\n );\n resources.file(\n \"meta.js\",\n await formatJs(`export default ${JSON.stringify(meta, null, 2)};`)\n );\n resources.file(\"index.js\", srcResourcesIndexJs);\n\n await generateByFileStructure(fileStructure, src, []);\n\n const appDir = project\n .folder(\"mock-micro-apps\")!\n .folder(projectDetail.appId)!;\n appDir.file(\".gitignore\", \"*\\n!.gitignore\");\n\n project.file(\".editorconfig\", editorConfig);\n project.file(\".gitignore\", gitIgnore);\n project.file(\"dev.config.mjs\", devConfigMjs);\n project.file(\"declarations.d.ts\", declarationsDTs);\n project.file(\"jsconfig.json\", jsconfigJson);\n project.file(\n \"next-jsx.config.js\",\n nextJsxConfigJs.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"package.json\",\n packageJson.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"README.md\",\n readmeMd\n .replaceAll(\"__PROJECT_NAME__\", projectDetail.name)\n .replaceAll(\"__PROJECT_HOMEPAGE__\", projectDetail.appSetting.homepage)\n );\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, \"project.zip\");\n}\n\ninterface FormatJsOptions {\n typescript?: boolean;\n semi?: boolean;\n printWidth?: number;\n}\n\nasync function formatJs(\n source: string,\n { typescript, semi = true, printWidth }: FormatJsOptions = {}\n): Promise<string> {\n return await format(source, {\n parser: typescript ? \"babel-ts\" : \"babel\",\n plugins: [prettierPluginBabel, prettierPluginEstree as any],\n semi,\n printWidth,\n trailingComma: \"es5\",\n });\n}\n\nasync function generateByFileStructure(\n items: SourceFileOrFolder[],\n folder: JSZip,\n path: string[]\n) {\n for (const item of items) {\n const childPath = [...path, item.name];\n if (item.type === \"folder\") {\n const childFolder = folder.folder(item.name)!;\n await generateByFileStructure(item.items, childFolder, childPath);\n } else {\n folder.file(\n `${item.name}.js${\n item.nodeType === \"routes\" ||\n item.nodeType === \"bricks\" ||\n item.nodeType === \"template\"\n ? \"x\"\n : \"\"\n }`,\n await formatJs(generate(item.node, item.nodeType, childPath))\n );\n }\n }\n}\n\nfunction cleanMenu(menu: Record<string, any>) {\n for (const [key, value] of Object.entries(menu)) {\n switch (key) {\n case \"items\":\n if (Array.isArray(value)) {\n for (const item of value) {\n cleanMenuItem(item);\n }\n }\n break;\n case \"type\":\n if (value === \"main\") {\n delete menu[key];\n }\n break;\n case \"if\":\n break;\n case \"i18n\":\n if (Object.keys(value).length === 0) {\n delete menu[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menu[key];\n }\n }\n }\n}\n\nfunction cleanMenuItem(menuItem: Record<string, any>) {\n for (const [key, value] of Object.entries(menuItem)) {\n switch (key) {\n case \"children\":\n if (Array.isArray(value) && value.length > 0) {\n cleanMenuItem(value);\n }\n break;\n case \"if\":\n break;\n case \"activeExcludes\":\n case \"activeIncludes\":\n if (Array.isArray(value) && value.length === 0) {\n delete menuItem[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menuItem[key];\n }\n }\n }\n}\n\ncustomElements.define(\n \"vb-experiment.export-as-source-files\",\n createProviderClass(exportAsSourceFiles)\n);\n","import { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\n\ninterface ExportWidgetsParams {\n name: string;\n files: FileInfo[];\n}\n\ninterface FileInfo {\n path: string;\n content: string;\n}\n\nexport async function exportWidgets({\n name,\n files,\n}: ExportWidgetsParams): Promise<void> {\n const fs = new Map<string, JSZip>();\n const zip = new JSZip();\n const widgets = zip.folder(\"widgets\")!;\n const project = widgets.folder(name)!;\n\n for (const { path, content } of files) {\n const segments = path.split(\"/\");\n const filename = segments.pop()!;\n let handle = project;\n let i = 1;\n for (const segment of segments) {\n const current = segments.slice(0, i).join(\"/\");\n const found = fs.get(current);\n if (found) {\n handle = found;\n } else {\n handle = handle.folder(segment)!;\n fs.set(current, handle);\n }\n i++;\n }\n handle.file(filename, content);\n }\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, `${name}.zip`);\n}\n\ncustomElements.define(\n \"vb-experiment.export-widgets\",\n createProviderClass(exportWidgets)\n);\n","export function withBox(children, options) {\n return {\n brick: \"div\",\n properties: {\n style: options.expanded ? {\n background: \"rgba(255, 255, 255, 0.9)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"16px\",\n padding: \"24px\"\n } : {\n background: \"var(--elevo-component-background)\",\n backdropFilter: \"var(--elevo-component-backdrop-filter)\",\n borderRadius: \"var(--elevo-border-radius)\",\n padding: \"16px\"\n }\n },\n children: children\n };\n}\n//# sourceMappingURL=withBox.js.map","import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _regeneratorRuntime from \"@babel/runtime/helpers/regeneratorRuntime\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport convertModule from \"./convertModule.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nimport { getViewTplName } from \"./getTplName.js\";\nimport { withBox } from \"../withBox.js\";\nexport function convertView(_x, _x2) {\n return _convertView.apply(this, arguments);\n}\nfunction _convertView() {\n _convertView = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(view, options) {\n var _convertedEntry;\n var entry, convertedEntry, state, functions, templates, helpers, _ref2, title, bricks, context, needBox;\n return _regeneratorRuntime().wrap(function (_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n entry = view.entry;\n if (entry) {\n _context2.next = 1;\n break;\n }\n throw new Error(\"No entry module found in the view.\");\n case 1:\n state = {\n usedHelpers: new Set(),\n app: view,\n convertedModules: new Map()\n };\n functions = [];\n templates = [];\n _context2.next = 2;\n return Promise.all(Array.from(view.modules.values()).map(/*#__PURE__*/function () {\n var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(mod) {\n var converted, _i, _arr, part, raw, promise, _part, _t;\n return _regeneratorRuntime().wrap(function (_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!mod) {\n _context.next = 8;\n break;\n }\n _context.next = 1;\n return convertModule(mod, state, options);\n case 1:\n converted = _context.sent;\n if (mod === entry) {\n convertedEntry = converted;\n }\n _i = 0, _arr = [].concat(_toConsumableArray(converted.internals), _toConsumableArray(converted.namedExports.values()), [converted.defaultExport]);\n case 2:\n if (!(_i < _arr.length)) {\n _context.next = 8;\n break;\n }\n part = _arr[_i];\n if (part) {\n _context.next = 3;\n break;\n }\n return _context.abrupt(\"continue\", 7);\n case 3:\n raw = part.raw, promise = part.promise;\n _t = raw === null || raw === void 0 ? void 0 : raw.type;\n _context.next = _t === \"function\" ? 4 : _t === \"template\" ? 5 : 7;\n break;\n case 4:\n functions.push(raw[\"function\"]);\n return _context.abrupt(\"continue\", 7);\n case 5:\n _context.next = 6;\n return promise;\n case 6:\n _part = _context.sent;\n templates.push({\n name: getViewTplName(_part.name, options.rootId),\n bricks: _part.bricks,\n state: _part.context\n });\n return _context.abrupt(\"continue\", 7);\n case 7:\n _i++;\n _context.next = 2;\n break;\n case 8:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x3) {\n return _ref.apply(this, arguments);\n };\n }()));\n case 2:\n if ((_convertedEntry = convertedEntry) !== null && _convertedEntry !== void 0 && _convertedEntry.defaultExport) {\n _context2.next = 3;\n break;\n }\n throw new Error(\"No view found in the entry module.\");\n case 3:\n helpers = Array.from(state.usedHelpers).map(function (name) {\n var source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(\"Helper function \".concat(name, \" not found\"));\n }\n return {\n name: name,\n source: source,\n typescript: true\n };\n });\n _context2.next = 4;\n return convertedEntry.defaultExport.promise;\n case 4:\n _ref2 = _context2.sent;\n title = _ref2.title;\n bricks = _ref2.bricks;\n context = _ref2.context;\n needBox = function needBox() {\n return bricks.every(function (brick) {\n return [\"eo-form\", \"eo-descriptions\", \"eo-button\"].includes(brick.brick);\n });\n };\n return _context2.abrupt(\"return\", {\n title: title,\n brick: options.withoutWrapper ? bricks : {\n brick: \"eo-content-layout\",\n children: needBox() ? [withBox(bricks, options)] : bricks\n },\n context: [].concat(_toConsumableArray(context), _toConsumableArray(options.withContexts ? Object.entries(options.withContexts).map(function (_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n name = _ref4[0],\n value = _ref4[1];\n return {\n name: name,\n value: value\n };\n }) : [])),\n functions: [].concat(functions, _toConsumableArray(helpers)),\n templates: templates\n });\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _convertView.apply(this, arguments);\n}\n//# sourceMappingURL=convertView.js.map","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","// istanbul ignore file\nimport type { ParsedApp, ParseOptions, SourceFile } from \"@next-tsx/parser\";\nimport { wrap } from \"comlink\";\n\nexport interface RemoteTsxParserWorker {\n parseView(source: string, options?: ParseOptions): Promise<ParsedApp>;\n parseApp(files: SourceFile[]): Promise<ParsedApp>;\n}\n\nlet remoteWorkerPromise: Promise<RemoteTsxParserWorker> | undefined;\n\nlet worker: Worker | undefined;\n\nexport function getRemoteTsxParserWorker() {\n if (!remoteWorkerPromise) {\n remoteWorkerPromise = (async () => {\n const Remote = wrap<{ new (): RemoteTsxParserWorker }>(getWorker());\n return await new Remote();\n })();\n }\n return remoteWorkerPromise;\n}\n\nfunction getWorker() {\n if (!worker) {\n worker = new Worker(new URL(\"./tsxParser.worker.ts\", import.meta.url));\n }\n return worker;\n}\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { httpErrorToString, unstable_createRoot } from \"@next-core/runtime\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-tsx/core/index.d.ts?raw\";\nimport componentsDefinition from \"@next-tsx/converter/lib/components.d.ts?raw\";\nimport { convertView, type ConvertResult } from \"@next-tsx/converter\";\nimport type { ParsedApp, SourceFile } from \"@next-tsx/parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"./workers/tsxParser.js\";\nimport { createPortal } from \"./createPortal.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface TsxPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n viewLibs?: SourceFile[];\n withoutWrapper?: boolean;\n allowAnyBricks?: boolean;\n}\n\n/**\n * 构件 `vb-experiment.tsx-playground`\n */\nexport\n@defineElement(\"vb-experiment.tsx-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass TsxPlayground extends ReactNextElement implements TsxPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @property({ attribute: false })\n accessor viewLibs: SourceFile[] | undefined;\n\n @property({ type: Boolean })\n accessor withoutWrapper: boolean | undefined;\n\n @property({ type: Boolean })\n accessor allowAnyBricks: boolean | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <TsxPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n viewLibs={this.viewLibs}\n withoutWrapper={this.withoutWrapper}\n allowAnyBricks={this.allowAnyBricks}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface TsxPlaygroundComponentProps extends TsxPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction TsxPlaygroundComponent({\n source,\n extraLibs,\n withoutWrapper,\n allowAnyBricks,\n viewLibs,\n onChange,\n}: TsxPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [view, setView] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? []), ...(viewLibs ?? [])],\n [extraLibs, viewLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseView(deferredCode, { libs: viewLibs });\n if (ignore) {\n return;\n }\n setView(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n const ref = useRef<HTMLDivElement>(null);\n const rootRef = useRef<Awaited<\n ReturnType<typeof unstable_createRoot>\n > | null>(null);\n\n useEffect(() => {\n const container = ref.current;\n if (!container) {\n return;\n }\n const portal = createPortal(rootId);\n const root = unstable_createRoot(container, {\n portal,\n supportsUseChildren: true,\n } as any);\n rootRef.current = root;\n\n return () => {\n root.unmount();\n portal.remove();\n rootRef.current = null;\n };\n }, [rootId]);\n\n // const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!view) {\n return;\n }\n // setLoading(true);\n let convertedView: ConvertResult | undefined;\n try {\n convertedView = await convertView(view, {\n rootId,\n expanded: true,\n withoutWrapper,\n allowAnyBricks,\n });\n if (ignore) {\n return;\n }\n const { brick, context, functions, templates } = convertedView ?? {};\n await rootRef.current?.render(brick ?? [], {\n context,\n functions,\n templates,\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render view:\", error);\n rootRef.current?.render({\n brick: customElements.get(\"easyops-default-error\")\n ? \"easyops-default-error\"\n : \"div\",\n properties: {\n errorTitle: \"解析失败\",\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n children: [\n {\n brick: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n },\n ],\n });\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, view, withoutWrapper, allowAnyBricks]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///View.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <div data-root-id={rootId} ref={ref} />\n </div>\n </div>\n );\n}\n","export function createPortal(rootId: string) {\n const portal = document.createElement(\"div\");\n portal.dataset.rootId = rootId;\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { __secret_internals, getBasePath } from \"@next-core/runtime\";\nimport type { BootstrapData, MicroApp, Storyboard } from \"@next-core/types\";\nimport \"@next-core/theme\";\nimport styleText from \"./styles.shadow.css\";\n\nconst { defineElement, property } = createDecorators();\n\nexport interface AppPreviewProps {\n storyboard?: Storyboard;\n}\n\n/**\n * 构件 `vb-experiment.app-preview`\n */\nexport\n@defineElement(\"vb-experiment.app-preview\", {\n styleTexts: [styleText],\n})\nclass AppPreview extends ReactNextElement {\n @property({ attribute: false })\n accessor storyboard: Storyboard | undefined;\n\n render() {\n return <AppPreviewComponent storyboard={this.storyboard} />;\n }\n}\n\ninterface PreviewWindow extends Window {\n _preview_only_appPreviewer?: AppPreviewer;\n}\n\ninterface AppPreviewer {\n setup(data: BootstrapData, url: string): Promise<void>;\n update(appId: string, storyboard: Partial<Storyboard>): void;\n reload(): void;\n push(url: string): void;\n replace(url: string): void;\n goBack(): void;\n goForward(): void;\n}\n\nfunction AppPreviewComponent({ storyboard }: AppPreviewProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const [appPreviewer, setAppPreviewer] = useState<AppPreviewer | null>(null);\n\n const handleIframeLoad = useCallback(() => {\n const check = () => {\n const previewer = (iframeRef.current?.contentWindow as PreviewWindow)\n ?._preview_only_appPreviewer;\n if (previewer) {\n setAppPreviewer(previewer);\n } else {\n setTimeout(check, 100);\n }\n };\n check();\n }, []);\n\n const setupRef = useRef<Promise<void> | null>(null);\n\n useEffect(() => {\n if (!appPreviewer || !storyboard) {\n return;\n }\n\n const app = {\n id: \"lab-app-preview\",\n name: \"Lab: App Preview\",\n homepage: \"/lab-app-preview\",\n standaloneMode: true,\n noPlaceholders: true,\n } as MicroApp;\n\n if (setupRef.current) {\n let ignore = false;\n setupRef.current.then(() => {\n if (ignore) {\n return;\n }\n appPreviewer.update(app.id, { ...storyboard, app });\n appPreviewer.reload();\n });\n return () => {\n ignore = true;\n };\n } else {\n setupRef.current = appPreviewer.setup(\n {\n brickPackages: (__secret_internals as any).getBrickPackages(),\n storyboards: [\n {\n ...storyboard,\n app,\n },\n ],\n },\n app.homepage\n );\n }\n }, [appPreviewer, storyboard]);\n\n return (\n <div className=\"container\">\n <iframe\n ref={iframeRef}\n src={`${getBasePath()}lab/?_experimental_app_preview_=1`}\n loading=\"lazy\"\n onLoad={handleIframeLoad}\n />\n </div>\n );\n}\n","import _regeneratorRuntime from \"@babel/runtime/helpers/regeneratorRuntime\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _createForOfIteratorHelper from \"@babel/runtime/helpers/createForOfIteratorHelper\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { MODULE_SOURCE, isOfficialComponent } from \"@next-tsx/parser\";\nimport convertModule from \"./convertModule.js\";\nimport { getAppTplName } from \"./getTplName.js\";\nimport { convertRoutes } from \"./convertRoutes.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nexport function convertApp(_x, _x2) {\n return _convertApp.apply(this, arguments);\n}\nfunction _convertApp() {\n _convertApp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(app, options) {\n var entry, modules, render, children, routesComponent, state, convertingEntry, routes, functions, templates, _iterator, _step, _step$value, filePath, mod, convertedMod, _iterator2, _step2, _mod, _i, _arr, part, raw, promise, _part, helpers, _t, _t2;\n return _regeneratorRuntime().wrap(function (_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n entry = app.entry, modules = app.modules;\n if (entry) {\n _context.next = 1;\n break;\n }\n throw new Error(\"No entry module found in the app.\");\n case 1:\n render = entry.render;\n if (render) {\n _context.next = 2;\n break;\n }\n throw new Error(\"No render call found in the entry module.\");\n case 2:\n children = render.children;\n if (!(children.length !== 1)) {\n _context.next = 3;\n break;\n }\n throw new Error(\"Expects exactly one root component in the render call, but got \".concat(children.length, \".\"));\n case 3:\n routesComponent = children[0];\n if (isOfficialComponent(routesComponent, \"Routes\")) {\n _context.next = 4;\n break;\n }\n throw new Error(\"The root component must be <Routes> from \\\"\".concat(MODULE_SOURCE, \"\\\".\"));\n case 4:\n state = {\n usedHelpers: new Set(),\n app: app,\n convertedModules: new Map()\n };\n convertingEntry = convertModule(entry, state, options);\n state.convertedModules.set(entry.filePath, convertingEntry);\n _context.next = 5;\n return convertRoutes(routesComponent.children, state, entry, options);\n case 5:\n routes = _context.sent;\n functions = [];\n templates = []; // Some modules are not converted after routes being converted,\n // such as functions.\n _iterator = _createForOfIteratorHelper(modules);\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n _step$value = _slicedToArray(_step.value, 2), filePath = _step$value[0], mod = _step$value[1];\n if (!state.convertedModules.has(filePath)) {\n convertedMod = convertModule(mod, state, options);\n state.convertedModules.set(filePath, convertedMod);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n _iterator2 = _createForOfIteratorHelper(state.convertedModules.values());\n _context.prev = 6;\n _iterator2.s();\n case 7:\n if ((_step2 = _iterator2.n()).done) {\n _context.next = 15;\n break;\n }\n _mod = _step2.value;\n if (!_mod) {\n _context.next = 14;\n break;\n }\n _i = 0, _arr = [].concat(_toConsumableArray(_mod.internals), _toConsumableArray(_mod.namedExports.values()), [_mod.defaultExport]);\n case 8:\n if (!(_i < _arr.length)) {\n _context.next = 14;\n break;\n }\n part = _arr[_i];\n if (part) {\n _context.next = 9;\n break;\n }\n return _context.abrupt(\"continue\", 13);\n case 9:\n raw = part.raw, promise = part.promise;\n _t = raw === null || raw === void 0 ? void 0 : raw.type;\n _context.next = _t === \"function\" ? 10 : _t === \"template\" ? 11 : 13;\n break;\n case 10:\n functions.push(raw[\"function\"]);\n return _context.abrupt(\"continue\", 13);\n case 11:\n _context.next = 12;\n return promise;\n case 12:\n _part = _context.sent;\n templates.push({\n name: getAppTplName(_part.name),\n bricks: _part.bricks,\n state: _part.context,\n proxy: _part.proxy\n });\n return _context.abrupt(\"continue\", 13);\n case 13:\n _i++;\n _context.next = 8;\n break;\n case 14:\n _context.next = 7;\n break;\n case 15:\n _context.next = 17;\n break;\n case 16:\n _context.prev = 16;\n _t2 = _context[\"catch\"](6);\n _iterator2.e(_t2);\n case 17:\n _context.prev = 17;\n _iterator2.f();\n return _context.finish(17);\n case 18:\n helpers = Array.from(state.usedHelpers).map(function (name) {\n var source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(\"Helper function \".concat(name, \" not found\"));\n }\n return {\n name: name,\n source: source,\n typescript: true\n };\n });\n return _context.abrupt(\"return\", {\n routes: routes,\n functions: [].concat(functions, _toConsumableArray(helpers)),\n templates: templates,\n constants: Object.fromEntries(app.constants)\n });\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[6, 16, 17, 18]]);\n }));\n return _convertApp.apply(this, arguments);\n}\n//# sourceMappingURL=convertApp.js.map","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement, wrapBrick } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport type { Storyboard } from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-tsx/core/index.d.ts?raw\";\nimport componentsDefinition from \"@next-tsx/converter/lib/components.d.ts?raw\";\nimport { convertApp, type ConvertedApp } from \"@next-tsx/converter\";\nimport type { ParsedApp } from \"@next-tsx/parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"../tsx-playground/workers/tsxParser.js\";\nimport type { AppPreview, AppPreviewProps } from \"../app-preview/index.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst WrappedAppPreview = wrapBrick<AppPreview, AppPreviewProps>(\n \"vb-experiment.app-preview\"\n);\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface AppPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n}\n\n/**\n * 构件 `vb-experiment.app-playground`\n */\nexport\n@defineElement(\"vb-experiment.app-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass AppPlayground extends ReactNextElement implements AppPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <AppPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface AppPlaygroundComponentProps extends AppPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction AppPlaygroundComponent({\n source,\n extraLibs,\n onChange,\n}: AppPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [app, setApp] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? [])],\n [extraLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseApp([\n {\n filePath: \"/index.tsx\",\n content: deferredCode,\n },\n ]);\n if (ignore) {\n return;\n }\n setApp(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n\n // const [loading, setLoading] = useState(true);\n\n const [storyboard, setStoryboard] = useState<Storyboard | undefined>();\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!app) {\n return;\n }\n // setLoading(true);\n let convertedApp: ConvertedApp | undefined;\n try {\n convertedApp = await convertApp(app, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n const storyboard = {\n routes: convertedApp.routes,\n meta: {\n functions: convertedApp.functions,\n customTemplates: convertedApp.templates,\n },\n } as Partial<Storyboard> as Storyboard;\n setStoryboard(storyboard);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render app:\", error);\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, app]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///index.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <WrappedAppPreview storyboard={storyboard} />\n </div>\n </div>\n );\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--AW813tLb{display:flex;height:100%}.editor--B5m74LRR,\n.preview--THWZoCIv{flex:1;min-width:0}.preview--THWZoCIv{padding:0;height:100%}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--AW813tLb`,\n\t\"editor\": `editor--B5m74LRR`,\n\t\"preview\": `preview--THWZoCIv`\n};\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block;height:100%}:host([hidden]){display:none}*{box-sizing:border-box}.container,\niframe{width:100%;height:100%;border-radius:4px}iframe{display:block;border:none;margin:0;padding:0;transform-origin:0% 0%;-webkit-user-select:none;user-select:none}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--M22i1CYq{display:flex;height:100%}.editor--kF8SUoBP,\n.preview--gu5OlS2X{flex:1;min-width:0}.preview--gu5OlS2X{padding:1em;overflow:auto}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--M22i1CYq`,\n\t\"editor\": `editor--kF8SUoBP`,\n\t\"preview\": `preview--gu5OlS2X`\n};\nexport default ___CSS_LOADER_EXPORT___;\n"],"names":["async","formatJs","source","typescript","semi","printWidth","arguments","length","undefined","format","parser","plugins","prettierPluginBabel","prettierPluginEstree","trailingComma","generateByFileStructure","items","folder","path","item","childPath","name","type","childFolder","file","nodeType","generate","node","cleanMenu","menu","key","value","Object","entries","Array","isArray","cleanMenuItem","keys","menuItem","customElements","define","createProviderClass","_ref","_storyboard$meta","_meta$customTemplates","_meta$functions","_meta$menus","_meta$contracts","_meta$i18n","projectDetail","storyboard","zip","JSZip","project","src","extractState","extracts","namePool","Map","extractedRoutes","extractRoutes","routes","app","id","appId","homepage","appSetting","layoutType","theme","noAuthGuard","locales","defaultConfig","JSON","parse","menuIcon","icon","standaloneMode","stringify","meta","customTemplates","functions","menus","contracts","i18n","workflows","mocks","userGroups","extractedTemplates","extractTemplates","push","fileStructure","buildFileStructure","srcIndexJs","resources","fnDir","fnNames","fnImports","fn","Error","inferredImports","Set","code","transform","filename","TransformStoryboardFunction","SmartImports","imports","hasFN","has","delete","importStrings","size","join","menusDir","menuNames","menuImports","menuId","replace","JS_RESERVED_WORDS","contractsDir","contractImports","contractNames","contract","baseName","counter","varName","add","srcResourcesIndexJs","editorConfig","gitIgnore","devConfigMjs","declarationsDTs","jsconfigJson","nextJsxConfigJs","replaceAll","packageJson","readmeMd","blob","generateAsync","saveAs","files","fs","content","segments","split","pop","handle","i","segment","current","slice","found","get","set","withBox","children","options","brick","properties","style","expanded","background","backdropFilter","borderRadius","padding","_convertView","mark","_callee2","view","_convertedEntry","entry","convertedEntry","state","templates","helpers","_ref2","title","bricks","context","needBox","wrap","_context2","prev","next","usedHelpers","convertedModules","Promise","all","from","modules","values","map","_callee","mod","converted","_i","_arr","part","raw","promise","_part","_t","_context","convertModule","sent","concat","internals","namedExports","defaultExport","abrupt","rootId","stop","_x3","apply","this","every","includes","withoutWrapper","withContexts","_ref3","_ref4","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","remoteWorkerPromise","worker","getRemoteTsxParserWorker","Remote","Worker","URL","AsyncWrappedCodeEditor","React","default","asyncWrapBrick","onCodeChange","BUILTIN_LIBS","filePath","componentsDefinition","types","nextTsxDefinition","defineElement","property","event","createDecorators","_TsxPlayground","_A","WeakMap","_B","_C","_D","_E","_F","_TsxPlayground_brand","WeakSet","_handleChange","TsxPlayground","ReactNextElement","constructor","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_source","_init_extra_source","_init_extraLibs","_init_extra_extraLibs","_init_viewLibs","_init_extra_viewLibs","_init_withoutWrapper","_init_extra_withoutWrapper","_init_allowAnyBricks","_init_extra_allowAnyBricks","_init_change","_init_extra_change","_classPrivateGetter2","_classPrivateGetter","_get_change","emit","_classPrivateFieldGet","v","_classPrivateFieldSet","extraLibs","viewLibs","allowAnyBricks","render","TsxPlaygroundComponent","onChange","convertSeverity","severity","setCode","useState","deferredCode","useDeferredValue","markers","setMarkers","setView","allLibs","useMemo","handleCodeChange","useCallback","e","detail","useEffect","ignore","result","parseView","libs","withNodeErrors","errors","filter","err","error","message","startLineNumber","loc","start","line","startColumn","column","endLineNumber","end","endColumn","uniqueId","ref","useRef","rootRef","container","portal","document","createElement","dataset","position","width","height","body","append","createPortal","root","unstable_createRoot","supportsUseChildren","unmount","remove","convertedView","_rootRef$current","_x","_x2","convertView","_rootRef$current2","console","errorTitle","errorBoundary","color","textContent","httpErrorToString","className","styles","editor","Suspense","fallback","language","uri","automaticLayout","extraMarkers","preview","_TsxPlayground2","_set_change","c","_initClass","_applyDecs","shadowOptions","attribute","Boolean","o","_","_checkInRHS","_AppPreview","AppPreview","_init_storyboard","_init_extra_storyboard","AppPreviewComponent","iframeRef","appPreviewer","setAppPreviewer","handleIframeLoad","check","_iframeRef$current","previewer","contentWindow","_preview_only_appPreviewer","setTimeout","setupRef","noPlaceholders","then","update","reload","setup","brickPackages","__secret_internals","getBrickPackages","storyboards","getBasePath","loading","onLoad","_AppPreview2","styleTexts","styleText","_convertApp","routesComponent","convertingEntry","_iterator","_step","_step$value","convertedMod","_iterator2","_step2","_mod","_t2","convertRoutes","s","n","done","f","proxy","finish","constants","fromEntries","WrappedAppPreview","wrapBrick","_AppPlayground","_AppPlayground_brand","AppPlayground","AppPlaygroundComponent","setApp","parseApp","setStoryboard","convertedApp","convertApp","_AppPlayground2","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|