@next-bricks/vb-experiment 1.3.15 → 1.3.16
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/1469.083be8f8.js +2 -0
- package/dist/chunks/{1469.1261157a.js.map → 1469.083be8f8.js.map} +1 -1
- package/dist/chunks/{246.e9cdf4f2.js → 246.3c1287e4.js} +2 -2
- package/dist/chunks/{246.e9cdf4f2.js.map → 246.3c1287e4.js.map} +1 -1
- package/dist/chunks/{7311.f04a9cac.js → 2857.bfd7ab6b.js} +2 -2
- package/dist/chunks/{7311.f04a9cac.js.map → 2857.bfd7ab6b.js.map} +1 -1
- package/dist/chunks/{3171.3dd2f1c4.js → 3171.bee73fe6.js} +2 -2
- package/dist/chunks/{3171.3dd2f1c4.js.map → 3171.bee73fe6.js.map} +1 -1
- package/dist/chunks/{3735.61433691.js → 3735.6be3dc55.js} +4 -4
- package/dist/chunks/3735.6be3dc55.js.map +1 -0
- package/dist/chunks/{4154.d161e0c4.js → 4154.371b28c0.js} +2 -2
- package/dist/chunks/{4154.d161e0c4.js.map → 4154.371b28c0.js.map} +1 -1
- package/dist/chunks/{4765.9093ebcf.js → 4765.3a3c2ed3.js} +2 -2
- package/dist/chunks/{4765.9093ebcf.js.map → 4765.3a3c2ed3.js.map} +1 -1
- package/dist/chunks/4837.05a838ee.js +2 -0
- package/dist/chunks/{7218.9dc036f4.js.map → 4837.05a838ee.js.map} +1 -1
- package/dist/chunks/{5552.648b8e17.js → 5552.96d83691.js} +2 -2
- package/dist/chunks/{5552.648b8e17.js.map → 5552.96d83691.js.map} +1 -1
- package/dist/chunks/{7146.f95bb967.js → 7146.a8c80bcf.js} +2 -2
- package/dist/chunks/{7146.f95bb967.js.map → 7146.a8c80bcf.js.map} +1 -1
- package/dist/chunks/7218.b5820c83.js +2 -0
- package/dist/chunks/{4837.13dfbf22.js.map → 7218.b5820c83.js.map} +1 -1
- package/dist/chunks/948.1b677be1.js +3 -0
- package/dist/chunks/948.1b677be1.js.map +1 -0
- package/dist/chunks/app-playground.0745e311.js +2 -0
- package/dist/chunks/{app-playground.76926a68.js.map → app-playground.0745e311.js.map} +1 -1
- package/dist/chunks/app-preview.9fb1e8fc.js +2 -0
- package/dist/chunks/{app-preview.ca674689.js.map → app-preview.9fb1e8fc.js.map} +1 -1
- package/dist/chunks/{export-as-source-files.ce8ffd89.js → export-as-source-files.5accf195.js} +2 -2
- package/dist/chunks/{export-as-source-files.ce8ffd89.js.map → export-as-source-files.5accf195.js.map} +1 -1
- package/dist/chunks/{export-widgets.f2b4700e.js → export-widgets.1562a8ae.js} +2 -2
- package/dist/chunks/{export-widgets.f2b4700e.js.map → export-widgets.1562a8ae.js.map} +1 -1
- package/dist/chunks/main.5eb0373c.js +2 -0
- package/dist/chunks/{main.3a36657c.js.map → main.5eb0373c.js.map} +1 -1
- package/dist/chunks/tsx-playground.edb19559.js +2 -0
- package/dist/chunks/{tsx-playground.3d6f89ab.js.map → tsx-playground.edb19559.js.map} +1 -1
- package/dist/index.b762a597.js +2 -0
- package/dist/{index.837b3856.js.map → index.b762a597.js.map} +1 -1
- package/dist/manifest.json +19 -19
- package/package.json +2 -2
- package/dist/chunks/1469.1261157a.js +0 -2
- package/dist/chunks/3735.61433691.js.map +0 -1
- package/dist/chunks/4837.13dfbf22.js +0 -2
- package/dist/chunks/7218.9dc036f4.js +0 -2
- package/dist/chunks/948.9e1553ab.js +0 -3
- package/dist/chunks/948.9e1553ab.js.map +0 -1
- package/dist/chunks/app-playground.76926a68.js +0 -2
- package/dist/chunks/app-preview.ca674689.js +0 -2
- package/dist/chunks/main.3a36657c.js +0 -2
- package/dist/chunks/tsx-playground.3d6f89ab.js +0 -2
- package/dist/index.837b3856.js +0 -2
- /package/dist/chunks/{3735.61433691.js.LICENSE.txt → 3735.6be3dc55.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{948.9e1553ab.js.LICENSE.txt → 948.1b677be1.js.LICENSE.txt} +0 -0
package/dist/bricks.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"bricks": [
|
|
4
4
|
"vb-experiment.export-as-source-files",
|
|
5
5
|
"vb-experiment.export-widgets",
|
|
6
|
-
"vb-experiment.app-playground",
|
|
7
6
|
"vb-experiment.tsx-playground",
|
|
8
|
-
"vb-experiment.app-preview"
|
|
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.b762a597.js"
|
|
19
19
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[]).push([[1469],{1469:(e,t,n)=>{var r=n(7019),o=n(2461),i=n.n(o),s=n(5060),a=n(2408),l=n(1914),c=n(3242),u=n(77),d=n(4437),p=n(6337),m=n(1672),f=n(743),h=n(7577),g=n(2582),x=n(535),y=n(4215),v=n(1330),w=n(3812),b=n(1259),A=n(1895),k=n(6414),E=n(7585),_=n(6357),j=n(7837);async function N(e){let{typescript:t,semi:n=!0,printWidth:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await(0,a.GP)(e,{parser:t?"babel-ts":"babel",plugins:[l,c],semi:n,printWidth:r,trailingComma:"es5"})}async function S(e,t,n){for(const r of e){const e=[...n,r.name];if("folder"===r.type){const n=t.folder(r.name);await S(r.items,n,e)}else t.file(`${r.name}.js${"routes"===r.nodeType||"bricks"===r.nodeType||"template"===r.nodeType?"x":""}`,await N((0,m.c)(r.node,r.nodeType,e)))}}function $(e){for(const[t,n]of Object.entries(e))switch(t){case"items":if(Array.isArray(n))for(const e of n)C(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 C(e){for(const[t,n]of Object.entries(e))switch(t){case"children":Array.isArray(n)&&n.length>0&&C(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,o,a,l;let{projectDetail:c,storyboard:C}=e;const L=new(i()),T=L.folder("project"),P=T.folder("src"),M={extracts:[],namePool:new Map},R=(0,d.WM)(C.routes,[],M),W={id:c.appId,name:c.name,homepage:c.appSetting.homepage,layoutType:c.appSetting.layoutType,theme:c.appSetting.theme,noAuthGuard:c.appSetting.noAuthGuard,locales:c.appSetting.locales,defaultConfig:JSON.parse(c.appSetting.defaultConfig||"{}"),menuIcon:JSON.parse(c.appSetting.icon||"null"),standaloneMode:!0};P.file("app.js",await N(`export default ${JSON.stringify(W,null,2)};`));const I=null!==(t=C.meta)&&void 0!==t?t:{},O=null!==(n=I.customTemplates)&&void 0!==n?n:[],F=null!==(r=I.functions)&&void 0!==r?r:[],D=null!==(o=I.menus)&&void 0!==o?o:[],B=null!==(a=I.contracts)&&void 0!==a?a:[],H=null!==(l=I.i18n)&&void 0!==l?l:{};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 J=(0,d.pA)(O,["components"],M);M.extracts.push({name:"index",path:["components"],node:J,nodeType:"others"});const V=(0,p._)(M.extracts);P.file("index.js",h),P.file("routes.jsx",await N((0,m.c)(R,"routes",["routes.jsx"])));const z=P.folder("resources"),q=z.folder("functions"),G=[],U=[];for(const e of F){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 o=[];t.size>0&&o.push(`import { ${[...t].join(", ")} } from "next-jsx/runtime";`),r&&o.push('import FN from "./index.js";'),o.length>0&&(n=`${o.join("\n")}\n\n${n}`),q.file(`${e.name}.${e.typescript?"ts":"js"}`,n),U.push(`import ${e.name} from "./${e.name}.js";`),G.push(e.name)}q.file("index.js",await N(`${U.join("\n")}\n\nconst FN = { ${G.join(",")} };\n\nexport default FN;`));const X=z.folder("menus"),Z=[],Y=[];for(const e of D){if($(e),"index"===e.menuId)throw new Error('Unexpected menu id: "index"');const t=`${e.menuId}.js`;X.file(t,await N((0,m.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 N(`${Y.join("\n")}\n\nexport default [${Z.join(",")}]`));const K=z.folder("contracts"),Q=[],ee=new Set;for(const e of B){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 N(`export default ${JSON.stringify(e)};`)),Q.push(`import ${r} from "./${r}.js";`)}K.file("index.js",await N(`${Q.join("\n")}\n\nexport default [${[...ee].join(",")}]`)),z.folder("i18n").file("index.js",await N(`export default ${JSON.stringify(H)};`)),z.file("meta.js",await N(`export default ${JSON.stringify(I,null,2)};`)),z.file("index.js",f),await S(V,P,[]),T.folder("mock-micro-apps").folder(c.appId).file(".gitignore","*\n!.gitignore"),T.file(".editorconfig",g),T.file(".gitignore",x),T.file("dev.config.mjs",v),T.file("declarations.d.ts",y),T.file("jsconfig.json",w),T.file("next-jsx.config.js",b.replaceAll("__APP_ID__",c.appId)),T.file("package.json",A.replaceAll("__APP_ID__",c.appId)),T.file("README.md",k.replaceAll("__PROJECT_NAME__",c.name).replaceAll("__PROJECT_HOMEPAGE__",c.appSetting.homepage));const te=await L.generateAsync({type:"blob"});(0,s.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,o=new(i()),a=o.folder("widgets").folder(t);for(const{path:e,content:t}of n){const n=e.split("/"),o=n.pop();let i=a,s=1;for(const e of n){const t=n.slice(0,s).join("/"),o=r.get(t);o?i=o:(i=i.folder(e),r.set(t,i)),s++}i.file(o,t)}const l=await o.generateAsync({type:"blob"});(0,s.saveAs)(l,`${t}.zip`)})));var L=n(4635),T=n(918),P=n(6902),M=n(5536),R=n(6121),W=n(829),I=n(2740),O=n(8769),F=n.n(O),D=n(870),B=n(348),H=n(981),J=n(709),V=n(563),z=n(5146),q=n(2518),G=n(6806);let U;function X(e){return e.replace(/^export /m,"").replace(/^import [^\n]+\n/gm,"")}var Z=n(3808);function Y(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}}n(4419);var K=n(2591),Q=n.n(K),ee=n(1740),te=n.n(ee),ne=n(8128),re=n.n(ne),oe=n(855),ie=n.n(oe),se=n(3051),ae=n.n(se),le=n(3656),ce=n.n(le),ue=n(8957),de={};de.styleTagTransform=ce(),de.setAttributes=ie(),de.insert=re().bind(null,"head"),de.domAPI=te(),de.insertStyleElement=ae(),Q()(ue.A,de);const pe=ue.A&&ue.A.locals?ue.A.locals:void 0;var me,fe=n(1746);let he,ge,xe,ye,ve,we,be,Ae,ke;const Ee=F().lazy((async()=>({default:await(0,J.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),_e=[{filePath:"/node_modules/next-tsx/components.d.ts",content:q.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:z}],{defineElement:je,property:Ne,event:Se}=(0,D.createDecorators)();let $e;var Ce=new WeakMap,Le=new WeakMap,Te=new WeakMap,Pe=new WeakSet,Me=new WeakMap;class Re extends H.ReactNextElement{constructor(){super(...arguments),(0,L.A)(this,Pe),(0,T.A)(this,Ce,ge(this)),(0,T.A)(this,Le,(xe(this),ye(this))),(0,T.A)(this,Te,(ve(this),we(this))),(0,T.A)(this,Me,(ke(this),e=>{var t;null===(t=(0,M.A)(Pe,this,be))||void 0===t||t.emit(e)}))}get source(){return(0,W.A)(Ce,this)}set source(e){(0,R.A)(Ce,this,e)}get extraLibs(){return(0,W.A)(Le,this)}set extraLibs(e){(0,R.A)(Le,this,e)}render(){return F().createElement(Ie,{source:this.source,extraLibs:this.extraLibs,onChange:(0,W.A)(Me,this)})}}function We(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Ie(e){let{source:t,extraLibs:n,onChange:r}=e;const[o,i]=(0,O.useState)(null!=t?t:""),s=(0,O.useDeferredValue)(o),[a,l]=(0,O.useState)(),[c,u]=(0,O.useState)(),d=(0,O.useMemo)((()=>[..._e,...null!=n?n:[]]),[n]),p=(0,O.useCallback)((e=>{i(e.detail),r(e.detail)}),[r]);(0,O.useEffect)((()=>{let e=!1;return async function(){const t=await(0,fe.f)();if(e)return;const n=await t.parseView(s);if(e)return;u(n);const r=n.errors.filter((e=>!!e.node));r.length>0?l(r.map((e=>({message:e.message,severity:We(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})))):l(void 0)}(),()=>{e=!0}}),[s]);const m=(0,O.useMemo)((()=>(0,V.uniqueId)()),[]),f=(0,O.useRef)(null),h=(0,O.useRef)(null);return(0,O.useEffect)((()=>{const e=f.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}(m),n=(0,B.unstable_createRoot)(e,{portal:t,supportsUseChildren:!0});return h.current=n,()=>{n.unmount(),t.remove(),h.current=null}}),[m]),(0,O.useEffect)((()=>{let e=!1;return(async()=>{if(!c)return;let t;try{var n;if(t=await async function(e,t){const{entry:n}=e;if(!n)throw new Error("No entry module found in the view.");const r={usedHelpers:new Set,app:e},o=await(0,G.A)(n,r,t),{defaultExport:i,internals:s,namedExports:a}=o;if(!i)throw new Error("No view found in the entry module.");const l=[],c=[];for(const e of[...s,...a.values()])"function"===e.type?l.push(e.function):"template"===e.type&&c.push({name:(0,Z.$)(e.name,t.rootId),bricks:e.bricks,state:e.context});const u=Array.from(r.usedHelpers).map((e=>{const t=(U||(U=new Map([["_helper_mergeTexts",X('export function mergeTexts(\n ...items: (\n | { type: "text"; text: string }\n | { type: "expression"; value: unknown }\n )[]\n): string {\n function mergeValuesAsText(value: unknown): string {\n if (Array.isArray(value)) {\n return value.map(mergeValuesAsText).join("");\n }\n const type = typeof value;\n if (type === "string" || type === "number") {\n return String(value);\n }\n if (type === "object" && value !== null) {\n throw new Error("Can not render object as text");\n }\n return "";\n }\n\n const texts: string[] = [];\n for (const item of items) {\n if (item.type === "text") {\n texts.push(item.text.trim());\n } else {\n texts.push(mergeValuesAsText(item.value));\n }\n }\n return texts.join("");\n}\n')],["_helper_getLatestMetricValue",X('import { pipes as PIPES } from "@easyops-cn/brick-next-pipes";\n\nexport function getLatestMetricValue(\n list: Record<string, any>[] | undefined,\n {\n metric,\n precision,\n }: { metric: { id: string; unit: string }; precision?: number }\n) {\n const value = list?.findLast?.((item) => item[metric.id] != null)?.[\n metric.id\n ];\n const unit = metric.unit === "load" ? "" : metric.unit;\n return PIPES.unitFormat(value, unit, precision).join("");\n}\n')],["_helper_extractList",X("export function extractList<T = unknown>(data: T[] | { list: T[] }): T[] {\n if (Array.isArray(data)) {\n return data;\n }\n return data?.list;\n}\n")],["_helper_groupMetricData",X("export function groupMetricData(\n list: Record<string, any>[],\n groupField: string\n) {\n if (!list || !Array.isArray(list) || list.length === 0) {\n return [];\n }\n const grouped = new Map<\n string,\n { group: string; list: Record<string, any>[] }\n >();\n for (const item of list) {\n const key = item[groupField];\n let groupedList = grouped.get(key);\n if (!groupedList) {\n grouped.set(key, (groupedList = { group: key, list: [] }));\n }\n groupedList.list.push(item);\n }\n return Array.from(grouped.values());\n}\n")],["_helper_getMetricDisplayNames",X("export function getMetricDisplayNames(\n displayNameList:\n | { metric_name: string; metric_display_name: string }[]\n | undefined,\n metricNames: string[]\n): string[] {\n return metricNames.map(\n (metricName) =>\n displayNameList?.find((item) => item.metric_name === metricName)\n ?.metric_display_name ?? metricName\n );\n}\n")]])),U).get(e);if(!t)throw new Error(`Helper function ${e} not found`);return{name:e,source:t,typescript:!0}})),{title:d,bricks:p,context:m}=i;return{title:d,brick:{brick:"eo-content-layout",children:p.every((e=>["eo-form","eo-descriptions","eo-button"].includes(e.brick)))?[Y(p,t)]:p},context:[...m,...t.withContexts?Object.entries(t.withContexts).map((e=>{let[t,n]=e;return{name:t,value:n}})):[]],functions:[...l,...u],templates:c}}(c,{rootId:m,expanded:!0}),e)return;const{brick:r,context:o,functions:i,templates:s}=null!=t?t:{};await(null===(n=h.current)||void 0===n?void 0:n.render(null!=r?r:[],{context:o,functions:i,templates:s}))}catch(e){var r;console.error("Failed to render view:",e),null===(r=h.current)||void 0===r||r.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,B.httpErrorToString)(e)}}]})}})(),()=>{e=!0}}),[m,c]),F().createElement("div",{className:pe.container},F().createElement("div",{className:pe.editor},F().createElement(O.Suspense,{fallback:"Loading..."},F().createElement(Ee,{value:t,onCodeChange:p,language:"typescript",uri:"file:///view.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:d,extraMarkers:a,"data-override-theme":"dark-v2"}))),F().createElement("div",{className:pe.preview},F().createElement("div",{"data-root-id":m,ref:f})))}me=Re,({e:[ge,xe,ye,ve,we,be,Ae,ke],c:[$e,he]}=(0,I.A)(me,[je("vb-experiment.tsx-playground",{shadowOptions:!1})],[[Ne({attribute:!1}),1,"source"],[Ne({attribute:!1}),1,"extraLibs"],[Se({type:"change"}),1,"change",e=>(0,W.A)(Te,e),(e,t)=>(0,R.A)(Te,e,t)]],0,(e=>Me.has((0,P.A)(e))),H.ReactNextElement)),he();var Oe,Fe=n(4504);let De,Be,He;const{defineElement:Je,property:Ve}=(0,D.createDecorators)();let ze;var qe=new WeakMap;class Ge extends H.ReactNextElement{constructor(){super(...arguments),(0,T.A)(this,qe,Be(this)),He(this)}get storyboard(){return(0,W.A)(qe,this)}set storyboard(e){(0,R.A)(qe,this,e)}render(){return F().createElement(Ue,{storyboard:this.storyboard})}}function Ue(e){let{storyboard:t}=e;const n=(0,O.useRef)(null),[r,o]=(0,O.useState)(null),i=(0,O.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?o(r):setTimeout(e,100)};e()}),[]),s=(0,O.useRef)(null);return(0,O.useEffect)((()=>{if(!r||!t)return;const e={id:"lab-app-preview",name:"Lab: App Preview",homepage:"/lab-app-preview"};if(s.current){let n=!1;return s.current.then((()=>{n||(r.update(e.id,{...t,app:e}),r.reload())})),()=>{n=!0}}s.current=r.setup({brickPackages:B.__secret_internals.getBrickPackages(),storyboards:[{...t,app:e}]},e.homepage)}),[r,t]),F().createElement("div",{className:"container"},F().createElement("iframe",{ref:n,src:`${(0,B.getBasePath)()}lab/?_experimental_app_preview_=1`,loading:"lazy",onLoad:i}))}Oe=Ge,({e:[Be,He],c:[ze,De]}=(0,I.A)(Oe,[Je("vb-experiment.app-preview",{styleTexts:[Fe.A]})],[[Ve({attribute:!1}),1,"storyboard"]],0,void 0,H.ReactNextElement)),De();var Xe=n(2826),Ze=n(3303),Ye=n(4373),Ke={};Ke.styleTagTransform=ce(),Ke.setAttributes=ie(),Ke.insert=re().bind(null,"head"),Ke.domAPI=te(),Ke.insertStyleElement=ae(),Q()(Ye.A,Ke);const Qe=Ye.A&&Ye.A.locals?Ye.A.locals:void 0;var et;let tt,nt,rt,ot,it,st,at,lt,ct;const ut=F().lazy((async()=>({default:await(0,J.asyncWrapBrick)("vs.code-editor",{onCodeChange:"code.change"})}))),dt=(0,H.wrapBrick)("vb-experiment.app-preview"),pt=[{filePath:"/node_modules/next-tsx/components.d.ts",content:q.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:z}],{defineElement:mt,property:ft,event:ht}=(0,D.createDecorators)();let gt;var xt=new WeakMap,yt=new WeakMap,vt=new WeakMap,wt=new WeakSet,bt=new WeakMap;class At extends H.ReactNextElement{constructor(){super(...arguments),(0,L.A)(this,wt),(0,T.A)(this,xt,nt(this)),(0,T.A)(this,yt,(rt(this),ot(this))),(0,T.A)(this,vt,(it(this),st(this))),(0,T.A)(this,bt,(ct(this),e=>{var t;null===(t=(0,M.A)(wt,this,at))||void 0===t||t.emit(e)}))}get source(){return(0,W.A)(xt,this)}set source(e){(0,R.A)(xt,this,e)}get extraLibs(){return(0,W.A)(yt,this)}set extraLibs(e){(0,R.A)(yt,this,e)}render(){return F().createElement(Et,{source:this.source,extraLibs:this.extraLibs,onChange:(0,W.A)(bt,this)})}}function kt(e){switch(e){case"notice":return"Hint";case"warning":return"Warning";case"error":case"fatal":return"Error"}return e}function Et(e){let{source:t,extraLibs:n,onChange:r}=e;const[o,i]=(0,O.useState)(null!=t?t:""),s=(0,O.useDeferredValue)(o),[a,l]=(0,O.useState)(),[c,u]=(0,O.useState)(),d=(0,O.useMemo)((()=>[...pt,...null!=n?n:[]]),[n]),p=(0,O.useCallback)((e=>{i(e.detail),r(e.detail)}),[r]);(0,O.useEffect)((()=>{let e=!1;return async function(){const t=await(0,fe.f)();if(e)return;const n=await t.parseApp([{filePath:"index.tsx",content:s}]);if(e)return;u(n);const r=n.errors.filter((e=>!!e.node));r.length>0?l(r.map((e=>({message:e.message,severity:kt(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})))):l(void 0)}(),()=>{e=!0}}),[s]);const m=(0,O.useMemo)((()=>(0,V.uniqueId)()),[]),[f,h]=(0,O.useState)();return(0,O.useEffect)((()=>{let e=!1;return(async()=>{if(!c)return;let t;try{if(t=await async function(e,t){var n,r;const{entry:o}=e;if(!o)throw new Error("No entry module found in the app.");const i=o.render;if(!i)throw new Error("No render call found in the entry module.");const{children:s}=i;if(1!==s.length)throw new Error(`Expects exactly one root component in the render call, but got ${s.length}.`);const a=s[0];if(!(0,Xe.dN)(a,"Routes"))throw new Error(`The root component must be <Routes> from "${Ze.F}".`);let l;const c=new Map,u={usedHelpers:new Set,app:e},d=[],p=[];return await Promise.all(Array.from(e.modules).map((async e=>{let[n,r]=e;if(r){const e=await(0,G.A)(r,u,t);c.set(n,e),r===o&&(l=e);for(const t of[...e.internals,...e.namedExports.values()])"function"===t.type?d.push(t.function):"template"===t.type&&p.push({name:(0,Z.v)(t.name),bricks:t.bricks,state:t.context})}}))),{routes:null!==(n=null===(r=a.children)||void 0===r?void 0:r.map((e=>{if(!(0,Xe.dN)(e,"Route"))throw new Error(`All children of <Routes> must be <Route> from "${Ze.F}".`);const{path:t,component:n}=e.properties;if("string"!=typeof t||!t.startsWith("/"))throw new Error('The "path" property of <Route> must be a string starting with "/".');if(!n)throw new Error('The "component" property of <Route> is required.');const{reference:r}=n;let o;if("local"===r.type)o=[...l.internals,...l.namedExports.values()].find((e=>"function"!==e.type&&e.name&&e.name===r.name));else{const e=c.get(r.importSource);if(!e)throw new Error(`Cannot find the module "${r.importSource}" imported by the route "${t}".`);o=r.name?e.namedExports.get(r.name):e.defaultExport}if(!o)throw new Error(`Cannot find the component "${r.name}" used in the route "${t}".`);if("page"!==o.type)throw new Error(`The component "${r.name}" used in the route "${t}" must be a page component.`);return{path:`\${APP.homepage}${"/"===t?"":t}`,bricks:o.bricks,context:o.context}})))&&void 0!==n?n:[],meta:{functions:d,templates:p}}}(c,{rootId:m,expanded:!0}),e)return;h(t)}catch(e){console.error("Failed to render app:",e)}})(),()=>{e=!0}}),[m,c]),F().createElement("div",{className:Qe.container},F().createElement("div",{className:Qe.editor},F().createElement(O.Suspense,{fallback:"Loading..."},F().createElement(ut,{value:t,onCodeChange:p,language:"typescript",uri:"file:///view.tsx",automaticLayout:"fit-container",theme:"tm-vs-dark",extraLibs:d,extraMarkers:a,"data-override-theme":"dark-v2"}))),F().createElement("div",{className:Qe.preview},F().createElement(dt,{storyboard:f})))}et=At,({e:[nt,rt,ot,it,st,at,lt,ct],c:[gt,tt]}=(0,I.A)(et,[mt("vb-experiment.app-playground",{shadowOptions:!1})],[[ft({attribute:!1}),1,"source"],[ft({attribute:!1}),1,"extraLibs"],[ht({type:"change"}),1,"change",e=>(0,W.A)(vt,e),(e,t)=>(0,R.A)(vt,e,t)]],0,(e=>bt.has((0,P.A)(e))),H.ReactNextElement)),tt()},4373:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(6758),o=n.n(r),i=n(935),s=n.n(i)()(o());s.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%}",""]),s.locals={container:"container--AW813tLb",editor:"editor--B5m74LRR",preview:"preview--THWZoCIv"};const a=s},4504:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(6758),o=n.n(r),i=n(935),s=n.n(i)()(o());s.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 a=s.toString()},8957:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(6758),o=n.n(r),i=n(935),s=n.n(i)()(o());s.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}",""]),s.locals={container:"container--M22i1CYq",editor:"editor--kF8SUoBP",preview:"preview--gu5OlS2X"};const a=s}}]);
|
|
2
|
+
//# sourceMappingURL=1469.083be8f8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/1469.1261157a.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,EAAKM,UACa,WAAlBN,EAAKM,UACa,aAAlBN,EAAKM,SACD,IACA,WAEAxB,GAASyB,EAAAA,EAAAA,GAASP,EAAKQ,KAAMR,EAAKM,SAAUL,IAGxD,CACF,CAEA,SAASQ,EAAUC,GACjB,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQJ,GACxC,OAAQC,GACN,IAAK,QACH,GAAII,MAAMC,QAAQJ,GAChB,IAAK,MA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I,MAAO7B,EACP+K,aAAcqD,EACdmF,SAAS,aACTC,IAAI,mBACJC,gBAAgB,gBAChBvP,MAAM,aACNkJ,UAAWc,EACXwF,aAAc5F,EACd,sBAAoB,cAI1BlD,IAAAA,cAAA,OAAKsI,UAAWC,GAAOQ,SACrB/I,IAAAA,cAACwL,GAAiB,CAACpT,WAAYA,KAIvC,CA7ICkV,GAAA1B,KAAAlI,GAAAhC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAK,GAAA8G,GAAAlH,IAAAmH,GAAAwC,GAAAvC,MAAAC,EAAAA,EAAAA,GAAAkE,GAAA,CA5BA7M,GAAc,+BAAgC,CAE7C4I,eAAe,KACf,EAGC3I,GAAS,CAAE4I,WAAW,IAAQ,aAG9B5I,GAAS,CAAE4I,WAAW,IAAQ,gBAG9B3I,GAAM,CAAEnK,KAAM,WAAW,WAAA+S,IAAAlH,EAAAA,EAAAA,GAAApB,GAAAsI,GAAA,CAAAA,EAAAjH,KAAAC,EAAAA,EAAAA,GAAAtB,GAAAsI,EAAAjH,KAAA,GAAAkH,GAAApI,GAAAtF,KAAA2N,EAAAA,EAAAA,GAAAD,KARAlI,EAAAA,mBAAgB6H,I,kEEjFxCoE,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,oJACyC,KAElFsU,EAAwBzN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S,kECVIyN,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,0QAC+H,KAExK,QAAesU,EAAwBE,U,kECLnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,wJAC6C,KAEtFsU,EAAwBzN,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:///../../../src/helpers/index.ts","webpack:///../../src/withBox.ts","webpack:///./src/tsx-playground/styles.module.css?e933","webpack:///./src/tsx-playground/index.tsx","webpack:///./src/tsx-playground/createPortal.ts","webpack:///../../../src/modules/convertView.ts","webpack:///./src/app-preview/index.tsx","webpack:///./src/app-playground/styles.module.css?1659","webpack:///./src/app-playground/index.tsx","webpack:///../../../src/modules/convertApp.ts","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","import mergeTexts from \"../../../src/helpers/mergeTexts.ts?raw\";\nimport getLatestMetricValue from \"../../../src/helpers/getLatestMetricValue.ts?raw\";\nimport extractList from \"../../../src/helpers/extractList.ts?raw\";\nimport groupMetricData from \"../../../src/helpers/groupMetricData.ts?raw\";\nimport getMetricDisplayNames from \"../../../src/helpers/getMetricDisplayNames.ts?raw\";\n\nlet helperFunctions: Map<string, string> | undefined;\n\nexport function getHelperFunctions() {\n if (!helperFunctions) {\n helperFunctions = new Map([\n [\"_helper_mergeTexts\", fixFunctionSource(mergeTexts)],\n [\"_helper_getLatestMetricValue\", fixFunctionSource(getLatestMetricValue)],\n [\"_helper_extractList\", fixFunctionSource(extractList)],\n [\"_helper_groupMetricData\", fixFunctionSource(groupMetricData)],\n [\n \"_helper_getMetricDisplayNames\",\n fixFunctionSource(getMetricDisplayNames),\n ],\n ]);\n }\n return helperFunctions;\n}\n\nfunction fixFunctionSource(source: string): string {\n return source.replace(/^export /m, \"\").replace(/^import [^\\n]+\\n/gm, \"\");\n}\n","import { BrickConf } from \"@next-core/types\";\nimport type { ConvertOptions } from \"./interfaces.js\";\n\nexport function withBox(\n children: BrickConf[] | undefined,\n options: ConvertOptions\n): BrickConf {\n return {\n brick: \"div\",\n properties: {\n style: options.expanded\n ? {\n background: \"rgba(255, 255, 255, 0.9)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"16px\",\n padding: \"24px\",\n }\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,\n };\n}\n","\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 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-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertView, type ConvertResult } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/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}\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 @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 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 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 ?? [])],\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.parseView(deferredCode);\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, { rootId, expanded: true });\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]);\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 type {\n BrickConfInTemplate,\n CustomTemplate,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport type { ParsedApp } from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedPartOfComponent,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertResult,\n} from \"../interfaces.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nimport { getViewTplName } from \"./getTplName.js\";\nimport { withBox } from \"../withBox.js\";\n\nexport async function convertView(\n view: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertResult> {\n const { entry } = view;\n if (!entry) {\n throw new Error(\"No entry module found in the view.\");\n }\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app: view,\n };\n const convertedEntry = await convertModule(entry, state, options);\n\n const { defaultExport, internals, namedExports } = convertedEntry;\n\n if (!defaultExport) {\n throw new Error(\"No view found in the entry module.\");\n }\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n for (const part of [...internals, ...namedExports.values()]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getViewTplName(part.name!, options.rootId),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n\n const helpers = Array.from(state.usedHelpers).map<StoryboardFunction>(\n (name) => {\n const source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(`Helper function ${name} not found`);\n }\n return {\n name,\n source,\n typescript: true,\n };\n }\n );\n\n const { title, bricks, context } = defaultExport as ConvertedPartOfComponent;\n\n const needBox = bricks.every((brick) =>\n [\"eo-form\", \"eo-descriptions\", \"eo-button\"].includes(brick.brick)\n );\n\n return {\n title,\n brick: {\n brick: \"eo-content-layout\",\n children: needBox ? [withBox(bricks, options)] : bricks,\n },\n context: [\n ...context,\n ...(options.withContexts\n ? Object.entries(options.withContexts).map(([name, value]) => ({\n name,\n value,\n }))\n : []),\n ],\n functions: [...functions, ...helpers],\n templates,\n };\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: MicroApp = {\n id: \"lab-app-preview\",\n name: \"Lab: App Preview\",\n homepage: \"/lab-app-preview\",\n };\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","\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-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertApp, type ConvertedApp } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/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 [view, setView] = 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 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\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 (!view) {\n return;\n }\n // setLoading(true);\n let convertedApp: ConvertedApp | undefined;\n try {\n convertedApp = await convertApp(view, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n setStoryboard(convertedApp as Partial<Storyboard> as 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, view]);\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 <WrappedAppPreview storyboard={storyboard} />\n </div>\n </div>\n );\n}\n","import type {\n BrickConfInTemplate,\n CustomTemplate,\n RouteConf,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport {\n MODULE_SOURCE,\n type ParsedApp,\n type ComponentChild,\n type ComponentReference,\n isOfficialComponent,\n} from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedModule,\n type ConvertedPart,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertedApp,\n} from \"../interfaces.js\";\nimport { getAppTplName } from \"./getTplName.js\";\n\nexport async function convertApp(\n app: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertedApp> {\n const { entry } = app;\n if (!entry) {\n throw new Error(\"No entry module found in the app.\");\n }\n\n const render = entry.render;\n if (!render) {\n throw new Error(\"No render call found in the entry module.\");\n }\n\n const { children } = render;\n\n if (children.length !== 1) {\n throw new Error(\n `Expects exactly one root component in the render call, but got ${children.length}.`\n );\n }\n\n const routesComponent = children[0];\n if (!isOfficialComponent(routesComponent, \"Routes\")) {\n throw new Error(\n `The root component must be <Routes> from \"${MODULE_SOURCE}\".`\n );\n }\n\n let convertedEntry: ConvertedModule;\n const convertedModules = new Map<string, ConvertedModule>();\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app,\n };\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n await Promise.all(\n Array.from(app.modules).map(async ([filePath, mod]) => {\n if (mod) {\n const converted = await convertModule(mod, state, options);\n convertedModules.set(filePath, converted);\n if (mod === entry) {\n convertedEntry = converted;\n }\n for (const part of [\n ...converted.internals,\n ...converted.namedExports.values(),\n ]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getAppTplName(part.name!),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n }\n })\n );\n\n const routes: RouteConf[] =\n routesComponent.children?.map((child) => {\n if (!isOfficialComponent(child, \"Route\")) {\n throw new Error(\n `All children of <Routes> must be <Route> from \"${MODULE_SOURCE}\".`\n );\n }\n const { path, component } = child.properties;\n\n if (typeof path !== \"string\" || !path.startsWith(\"/\")) {\n throw new Error(\n `The \"path\" property of <Route> must be a string starting with \"/\".`\n );\n }\n\n if (!component) {\n throw new Error(`The \"component\" property of <Route> is required.`);\n }\n\n const { reference } = component as ComponentChild & {\n reference: ComponentReference;\n };\n let page: ConvertedPart | null | undefined;\n if (reference.type === \"local\") {\n const parts = [\n ...convertedEntry.internals,\n ...convertedEntry.namedExports.values(),\n ];\n page = parts.find(\n (p) => p.type !== \"function\" && p.name && p.name === reference.name\n );\n } else {\n const mod = convertedModules.get(reference.importSource!);\n if (!mod) {\n throw new Error(\n `Cannot find the module \"${reference.importSource}\" imported by the route \"${path}\".`\n );\n }\n page = reference.name\n ? mod.namedExports.get(reference.name)\n : mod.defaultExport;\n }\n\n if (!page) {\n throw new Error(\n `Cannot find the component \"${reference.name}\" used in the route \"${path}\".`\n );\n }\n if (page.type !== \"page\") {\n throw new Error(\n `The component \"${reference.name}\" used in the route \"${path}\" must be a page component.`\n );\n }\n\n return {\n path: `\\${APP.homepage}${path === \"/\" ? \"\" : path}`,\n bricks: page.bricks,\n context: page.context,\n };\n }) ?? [];\n\n return {\n routes,\n meta: {\n functions,\n templates,\n },\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","helperFunctions","fixFunctionSource","withBox","children","options","brick","properties","style","expanded","background","backdropFilter","borderRadius","padding","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","AsyncWrappedCodeEditor","React","default","asyncWrapBrick","onCodeChange","BUILTIN_LIBS","filePath","componentsDefinition","types","nextTsxDefinition","defineElement","property","event","createDecorators","_TsxPlayground","_A","WeakMap","_B","_C","_TsxPlayground_brand","WeakSet","_handleChange","TsxPlayground","ReactNextElement","constructor","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_source","_init_extra_source","_init_extraLibs","_init_extra_extraLibs","_init_change","_init_extra_change","_classPrivateGetter2","_classPrivateGetter","this","_get_change","emit","_classPrivateFieldGet","v","_classPrivateFieldSet","extraLibs","render","TsxPlaygroundComponent","onChange","convertSeverity","severity","setCode","useState","deferredCode","useDeferredValue","markers","setMarkers","view","setView","allLibs","useMemo","handleCodeChange","useCallback","e","detail","useEffect","ignore","worker","getRemoteTsxParserWorker","result","parseView","withNodeErrors","errors","filter","err","map","error","message","startLineNumber","loc","start","line","startColumn","column","endLineNumber","end","endColumn","rootId","uniqueId","ref","useRef","rootRef","container","portal","document","createElement","dataset","position","width","height","body","append","createPortal","root","unstable_createRoot","supportsUseChildren","unmount","remove","convertedView","_rootRef$current","entry","state","usedHelpers","convertedEntry","convertModule","defaultExport","internals","namedExports","templates","part","values","function","getViewTplName","bricks","context","helpers","from","title","every","includes","withContexts","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","o","_","_checkInRHS","_AppPreview","AppPreview","_init_storyboard","_init_extra_storyboard","AppPreviewComponent","iframeRef","appPreviewer","setAppPreviewer","handleIframeLoad","check","_iframeRef$current","previewer","contentWindow","_preview_only_appPreviewer","setTimeout","setupRef","then","update","reload","setup","brickPackages","__secret_internals","getBrickPackages","storyboards","getBasePath","loading","onLoad","_AppPreview2","styleTexts","styleText","WrappedAppPreview","wrapBrick","_AppPlayground","_AppPlayground_brand","AppPlayground","AppPlaygroundComponent","parseApp","setStoryboard","convertedApp","_routesComponent$chil","_routesComponent$chil2","routesComponent","isOfficialComponent","MODULE_SOURCE","convertedModules","Promise","all","modules","mod","converted","getAppTplName","child","component","startsWith","reference","page","find","p","importSource","convertApp","_AppPlayground2","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"chunks/1469.083be8f8.js","mappings":"mYA8RAA,eAAeC,EACbC,GAEiB,IADjB,WAAEC,EAAU,KAAEC,GAAO,EAAI,WAAEC,GAA6BC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG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EAAAA,EAAAA,GAAApB,GAAAsI,GAAA,CAAAA,EAAAjH,KAAAC,EAAAA,EAAAA,GAAAtB,GAAAsI,EAAAjH,KAAA,GAAAkH,GAAApI,GAAAtF,KAAA2N,EAAAA,EAAAA,GAAAD,KARAlI,EAAAA,mBAAgB6H,I,kEEjFxCoE,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,oJACyC,KAElFsU,EAAwBzN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S,kECVIyN,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,0QAC+H,KAExK,QAAesU,EAAwBE,U,kECLnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,wJAC6C,KAEtFsU,EAAwBzN,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:///../../../src/helpers/index.ts","webpack:///../../src/withBox.ts","webpack:///./src/tsx-playground/styles.module.css?e933","webpack:///./src/tsx-playground/index.tsx","webpack:///./src/tsx-playground/createPortal.ts","webpack:///../../../src/modules/convertView.ts","webpack:///./src/app-preview/index.tsx","webpack:///./src/app-playground/styles.module.css?1659","webpack:///./src/app-playground/index.tsx","webpack:///../../../src/modules/convertApp.ts","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","import mergeTexts from \"../../../src/helpers/mergeTexts.ts?raw\";\nimport getLatestMetricValue from \"../../../src/helpers/getLatestMetricValue.ts?raw\";\nimport extractList from \"../../../src/helpers/extractList.ts?raw\";\nimport groupMetricData from \"../../../src/helpers/groupMetricData.ts?raw\";\nimport getMetricDisplayNames from \"../../../src/helpers/getMetricDisplayNames.ts?raw\";\n\nlet helperFunctions: Map<string, string> | undefined;\n\nexport function getHelperFunctions() {\n if (!helperFunctions) {\n helperFunctions = new Map([\n [\"_helper_mergeTexts\", fixFunctionSource(mergeTexts)],\n [\"_helper_getLatestMetricValue\", fixFunctionSource(getLatestMetricValue)],\n [\"_helper_extractList\", fixFunctionSource(extractList)],\n [\"_helper_groupMetricData\", fixFunctionSource(groupMetricData)],\n [\n \"_helper_getMetricDisplayNames\",\n fixFunctionSource(getMetricDisplayNames),\n ],\n ]);\n }\n return helperFunctions;\n}\n\nfunction fixFunctionSource(source: string): string {\n return source.replace(/^export /m, \"\").replace(/^import [^\\n]+\\n/gm, \"\");\n}\n","import { BrickConf } from \"@next-core/types\";\nimport type { ConvertOptions } from \"./interfaces.js\";\n\nexport function withBox(\n children: BrickConf[] | undefined,\n options: ConvertOptions\n): BrickConf {\n return {\n brick: \"div\",\n properties: {\n style: options.expanded\n ? {\n background: \"rgba(255, 255, 255, 0.9)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"16px\",\n padding: \"24px\",\n }\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,\n };\n}\n","\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 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-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertView, type ConvertResult } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/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}\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 @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 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 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 ?? [])],\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.parseView(deferredCode);\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, { rootId, expanded: true });\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]);\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 type {\n BrickConfInTemplate,\n CustomTemplate,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport type { ParsedApp } from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedPartOfComponent,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertResult,\n} from \"../interfaces.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nimport { getViewTplName } from \"./getTplName.js\";\nimport { withBox } from \"../withBox.js\";\n\nexport async function convertView(\n view: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertResult> {\n const { entry } = view;\n if (!entry) {\n throw new Error(\"No entry module found in the view.\");\n }\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app: view,\n };\n const convertedEntry = await convertModule(entry, state, options);\n\n const { defaultExport, internals, namedExports } = convertedEntry;\n\n if (!defaultExport) {\n throw new Error(\"No view found in the entry module.\");\n }\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n for (const part of [...internals, ...namedExports.values()]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getViewTplName(part.name!, options.rootId),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n\n const helpers = Array.from(state.usedHelpers).map<StoryboardFunction>(\n (name) => {\n const source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(`Helper function ${name} not found`);\n }\n return {\n name,\n source,\n typescript: true,\n };\n }\n );\n\n const { title, bricks, context } = defaultExport as ConvertedPartOfComponent;\n\n const needBox = bricks.every((brick) =>\n [\"eo-form\", \"eo-descriptions\", \"eo-button\"].includes(brick.brick)\n );\n\n return {\n title,\n brick: {\n brick: \"eo-content-layout\",\n children: needBox ? [withBox(bricks, options)] : bricks,\n },\n context: [\n ...context,\n ...(options.withContexts\n ? Object.entries(options.withContexts).map(([name, value]) => ({\n name,\n value,\n }))\n : []),\n ],\n functions: [...functions, ...helpers],\n templates,\n };\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: MicroApp = {\n id: \"lab-app-preview\",\n name: \"Lab: App Preview\",\n homepage: \"/lab-app-preview\",\n };\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","\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-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertApp, type ConvertedApp } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/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 [view, setView] = 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 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\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 (!view) {\n return;\n }\n // setLoading(true);\n let convertedApp: ConvertedApp | undefined;\n try {\n convertedApp = await convertApp(view, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n setStoryboard(convertedApp as Partial<Storyboard> as 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, view]);\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 <WrappedAppPreview storyboard={storyboard} />\n </div>\n </div>\n );\n}\n","import type {\n BrickConfInTemplate,\n CustomTemplate,\n RouteConf,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport {\n MODULE_SOURCE,\n type ParsedApp,\n type ComponentChild,\n type ComponentReference,\n isOfficialComponent,\n} from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedModule,\n type ConvertedPart,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertedApp,\n} from \"../interfaces.js\";\nimport { getAppTplName } from \"./getTplName.js\";\n\nexport async function convertApp(\n app: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertedApp> {\n const { entry } = app;\n if (!entry) {\n throw new Error(\"No entry module found in the app.\");\n }\n\n const render = entry.render;\n if (!render) {\n throw new Error(\"No render call found in the entry module.\");\n }\n\n const { children } = render;\n\n if (children.length !== 1) {\n throw new Error(\n `Expects exactly one root component in the render call, but got ${children.length}.`\n );\n }\n\n const routesComponent = children[0];\n if (!isOfficialComponent(routesComponent, \"Routes\")) {\n throw new Error(\n `The root component must be <Routes> from \"${MODULE_SOURCE}\".`\n );\n }\n\n let convertedEntry: ConvertedModule;\n const convertedModules = new Map<string, ConvertedModule>();\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app,\n };\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n await Promise.all(\n Array.from(app.modules).map(async ([filePath, mod]) => {\n if (mod) {\n const converted = await convertModule(mod, state, options);\n convertedModules.set(filePath, converted);\n if (mod === entry) {\n convertedEntry = converted;\n }\n for (const part of [\n ...converted.internals,\n ...converted.namedExports.values(),\n ]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getAppTplName(part.name!),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n }\n })\n );\n\n const routes: RouteConf[] =\n routesComponent.children?.map((child) => {\n if (!isOfficialComponent(child, \"Route\")) {\n throw new Error(\n `All children of <Routes> must be <Route> from \"${MODULE_SOURCE}\".`\n );\n }\n const { path, component } = child.properties;\n\n if (typeof path !== \"string\" || !path.startsWith(\"/\")) {\n throw new Error(\n `The \"path\" property of <Route> must be a string starting with \"/\".`\n );\n }\n\n if (!component) {\n throw new Error(`The \"component\" property of <Route> is required.`);\n }\n\n const { reference } = component as ComponentChild & {\n reference: ComponentReference;\n };\n let page: ConvertedPart | null | undefined;\n if (reference.type === \"local\") {\n const parts = [\n ...convertedEntry.internals,\n ...convertedEntry.namedExports.values(),\n ];\n page = parts.find(\n (p) => p.type !== \"function\" && p.name && p.name === reference.name\n );\n } else {\n const mod = convertedModules.get(reference.importSource!);\n if (!mod) {\n throw new Error(\n `Cannot find the module \"${reference.importSource}\" imported by the route \"${path}\".`\n );\n }\n page = reference.name\n ? mod.namedExports.get(reference.name)\n : mod.defaultExport;\n }\n\n if (!page) {\n throw new Error(\n `Cannot find the component \"${reference.name}\" used in the route \"${path}\".`\n );\n }\n if (page.type !== \"page\") {\n throw new Error(\n `The component \"${reference.name}\" used in the route \"${path}\" must be a page component.`\n );\n }\n\n return {\n path: `\\${APP.homepage}${path === \"/\" ? \"\" : path}`,\n bricks: page.bricks,\n context: page.context,\n };\n }) ?? [];\n\n return {\n routes,\n meta: {\n functions,\n templates,\n },\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","helperFunctions","fixFunctionSource","withBox","children","options","brick","properties","style","expanded","background","backdropFilter","borderRadius","padding","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","AsyncWrappedCodeEditor","React","default","asyncWrapBrick","onCodeChange","BUILTIN_LIBS","filePath","componentsDefinition","types","nextTsxDefinition","defineElement","property","event","createDecorators","_TsxPlayground","_A","WeakMap","_B","_C","_TsxPlayground_brand","WeakSet","_handleChange","TsxPlayground","ReactNextElement","constructor","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_source","_init_extra_source","_init_extraLibs","_init_extra_extraLibs","_init_change","_init_extra_change","_classPrivateGetter2","_classPrivateGetter","this","_get_change","emit","_classPrivateFieldGet","v","_classPrivateFieldSet","extraLibs","render","TsxPlaygroundComponent","onChange","convertSeverity","severity","setCode","useState","deferredCode","useDeferredValue","markers","setMarkers","view","setView","allLibs","useMemo","handleCodeChange","useCallback","e","detail","useEffect","ignore","worker","getRemoteTsxParserWorker","result","parseView","withNodeErrors","errors","filter","err","map","error","message","startLineNumber","loc","start","line","startColumn","column","endLineNumber","end","endColumn","rootId","uniqueId","ref","useRef","rootRef","container","portal","document","createElement","dataset","position","width","height","body","append","createPortal","root","unstable_createRoot","supportsUseChildren","unmount","remove","convertedView","_rootRef$current","entry","state","usedHelpers","convertedEntry","convertModule","defaultExport","internals","namedExports","templates","part","values","function","getViewTplName","bricks","context","helpers","from","title","every","includes","withContexts","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","o","_","_checkInRHS","_AppPreview","AppPreview","_init_storyboard","_init_extra_storyboard","AppPreviewComponent","iframeRef","appPreviewer","setAppPreviewer","handleIframeLoad","check","_iframeRef$current","previewer","contentWindow","_preview_only_appPreviewer","setTimeout","setupRef","then","update","reload","setup","brickPackages","__secret_internals","getBrickPackages","storyboards","getBasePath","loading","onLoad","_AppPreview2","styleTexts","styleText","WrappedAppPreview","wrapBrick","_AppPlayground","_AppPlayground_brand","AppPlayground","AppPlaygroundComponent","parseApp","setStoryboard","convertedApp","_routesComponent$chil","_routesComponent$chil2","routesComponent","isOfficialComponent","MODULE_SOURCE","convertedModules","Promise","all","modules","mod","converted","getAppTplName","child","component","startsWith","reference","page","find","p","importSource","convertApp","_AppPlayground2","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[]).push([[246],{535:e=>{"use strict";e.exports="node_modules\n/dist\n/temp\n"},743:e=>{"use strict";e.exports='import functions from "./functions/index.js";\nimport menus from "./menus/index.js";\nimport contracts from "./contracts/index.js";\nimport i18n from "./i18n/index.js";\nimport meta from "./meta.js";\n\nexport default {\n functions,\n menus,\n contracts,\n i18n,\n meta,\n};\n'},1259:e=>{"use strict";e.exports='export default {\n appId: "__APP_ID__"\n};\n'},1330:e=>{"use strict";e.exports='// @ts-check\n/** @typedef {import("express").RequestHandler} Mock */\n/** @typedef {{ featureFlags?: Record<string, boolean>; misc?: Record<string, unknown>; [k: string]: unknown; }} Settings */\n/** @type {{ brickFolders?: string[]; mocks?: Mock[]; settings?: Settings }} */\nexport default {\n brickFolders: [\n "./bricks",\n ],\n // NOTE: Uncomment these lines below to enable local mocks:\n // mocks: [\n // (req, res, next) => {\n // switch (`${req.method} ${req.path}`) {\n // case "GET /api/auth/login":\n // res.send({\n // code: 0,\n // data: {\n // loggedIn: true,\n // username: "mock_user",\n // },\n // });\n // return;\n // }\n //\n // next();\n // }\n // ],\n}\n'},1672:(e,n,t)=>{"use strict";t.d(n,{c:()=>A});var r=t(8135),s=t(7585);function o(e,n,t){let r=e.get(n);r||(r=new Set,e.set(n,r)),r.add(t)}function i(e){return[...e].sort(((e,n)=>Number(e[0].startsWith("."))-Number(n[0].startsWith(".")))).map((e=>{let[n,t]=e;const r=[...t];return 1===r.length&&r[0].startsWith(s.jC)?`import ${r[0].substring(s.jC.length)} from "${n}";`:`import { ${r.join(", ")} } from "${n}";`}))}var a=t(9936),c=t(4437),l=t(77);const p="transform-pipeline-operator-minimal";(0,l.registerPlugin)(p,(()=>({name:p,inherits:l.availablePlugins["syntax-pipeline-operator"],visitor:{BinaryExpression(e){const{node:n}=e,{operator:t,left:s,right:o}=n;if("|>"!==t)return;const i=r.callExpression(o,[s]);e.replaceWith(i)}}})));const u=p;var f=t(7837);function d(e,n,t){if(/^\s*<%[~=]?\s/.test(e)&&/\s%>\s*$/.test(e))try{let s="";const i=e.replace(/^\s*<%([~=])?\s|\s%>\s*$/g,((e,n)=>(n&&(s=n),"")));let a="="===s;const c="~"===s,p=new Set;let d,m=(0,l.transform)(`(${i})`,{ast:!0,code:!1,plugins:[[u,{proposal:"minimal"}],[f.A,{imports:p}]]}).ast.program.body[0].expression;"SequenceExpression"!==m.type||(d=m.expressions[0],"StringLiteral"!==d.type)||"track context"!==d.value&&"track state"!==d.value||a||(a=!0,m=m.expressions.length>2?r.sequenceExpression(m.expressions.slice(1)):m.expressions[1]),!a||p.has("STATE")||p.has("CTX")||(a=!1);for(const e of p)if("FN"===e){const e=["resources","functions","index.js"];let r=0;for(let n=0;n<e.length&&n<t.length&&(r=n,t[n]===e[n]);n++);o(n,`${1===t.length?".":new Array(t.length-1-r).fill("..").join("/")}/${e.slice(r).join("/")}`,"default:FN")}else o(n,"next-jsx/runtime",e);return c&&(o(n,"next-jsx/runtime","recursive"),m=r.callExpression(r.identifier("recursive"),[m])),a&&(o(n,"next-jsx/runtime","bind"),m=r.callExpression(r.identifier("bind"),[m])),m}catch(n){console.warn("Parse expression failed:",e,n)}return null}function m(e,n,t,s,o){var i;return null!==(i=x(e,n,t,s,o))&&void 0!==i?i:r.nullLiteral()}function x(e,n,t,s,o){if(s&&"useBrick"===o){if(Array.isArray(e))return b(e,n,t);if((0,a.isObject)(e))return v(e,n,t)}if(Array.isArray(e))return r.arrayExpression(e.map((e=>x(e,n,t,s))));if("function"==typeof e)return null;if((0,a.isObject)(e))return r.objectExpression(Object.entries(e).map((e=>{let[o,i]=e;const a=x(i,n,t,s,o);return null!==a?r.objectProperty(r.stringLiteral(o),a):null})).filter(Boolean));if("string"==typeof e){const s=d(e,n,t);return null!=s?s:r.stringLiteral(e)}return"number"==typeof e?r.numericLiteral(e):"boolean"==typeof e?r.booleanLiteral(e):null===e?r.nullLiteral():null}function g(e,n,t,s,o,i){const l=[],p=[];for(const[s,i]of Object.entries(e))void 0!==i&&(/^[_$a-zA-Z][$\w]*$/.test(s)?l.push([s,i]):p.push(r.objectProperty(r.stringLiteral(o?`${o}:${s}`:s),m(i,n,t))));const u=(s?l.sort((f=s,function(e,n){return f.indexOf(n[0])-f.indexOf(e[0])})):l).map((e=>{let[s,l]=e;const p=function(e,n,t,s,o){if("string"==typeof e){const s=d(e,n,t);if(s)return r.jsxExpressionContainer(s);const o=r.stringLiteral(e);return e.includes(c.j4)||JSON.stringify(e).includes("\\")?r.jsxExpressionContainer(o):o}if(!0===e)return null;if(o&&"useBrick"===s){if(Array.isArray(e))return y(b(e,n,t));if((0,a.isObject)(e))return y(v(e,n,t))}const i=m(e,n,t,o);return r.jsxExpressionContainer(i)}(l,n,t,s,i);return r.jsxAttribute(o?r.jsxNamespacedName(r.jsxIdentifier(o),r.jsxIdentifier(s)):r.jsxIdentifier(s),p)}));var f;return p.length>0&&u.push(r.jsxSpreadAttribute(r.objectExpression(p))),u}function y(e){return"StringLiteral"!==e.type?r.jsxExpressionContainer(e):e}function h(e,n,t){o(n,"next-jsx","Route");const{children:i,slot:a,_isRoute:c,...l}=e,p=null!=i?i:[],u=""===a?void 0:a,f=0===p.length;return r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("Route"),g({...l,slot:u},n,t,s.O7),f),f?null:r.jsxClosingElement(r.jsxIdentifier("Route")),p.map((e=>h(e,n,t))),f)}function j(e){return"StringLiteral"===e.type?r.jsxExpressionContainer(e):e}function b(e,n,t){const s=e.map((e=>v(e,n,t)));return 1===s.length?s[0]:r.jsxFragment(r.jsxOpeningFragment(),r.jsxClosingFragment(),s.map(j))}function v(e,n,t){if("string"==typeof e)return r.stringLiteral(e);if(e.template)return function(e,n,t){o(n,"next-jsx","LegacyTemplate");const{children:s,...i}=e;return r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("LegacyTemplate"),g(i,n,t),!0),null,[],!0)}(e,n,t);const{brick:s,children:i,properties:a,events:c,lifeCycle:l,if:p,portal:u,ref:f,slot:d,...m}=e;if("string"==typeof s){let x,y,b=!0;switch(s){case":forEach":case":if":case":switch":x=`${s[1].toUpperCase()}${s.substring(2)}`,o(n,"next-jsx",x);break;default:b=!1,x=s.replaceAll(".","_")}b&&(y=m.dataSource,delete m.dataSource);const E=""===d?void 0:d,k=null!=a?a:{},{textContent:A,children:w,events:O,lifeCycle:$,if:P,ref:S,id:C,slot:T,...I}=k,R="string"==typeof A,F=0===i.length&&!R;i.length>0&&R&&console.warn("Invalid brick: mix slotted children and textContent:",e);const L=r.jsxOpeningElement(r.jsxIdentifier(x),[...g({if:!0===p?void 0:p,slot:E,ref:f,id:C,...b?{value:y}:null},n,t),...g(I,n,t,void 0,void 0,!0),...g({events:c,lifeCycle:l,portal:u},n,t),...g({children:w,events:O,lifeCycle:$,if:P,ref:S},n,t,void 0,"prop"),...g(m,n,t,void 0,"conf")],F),N=F?null:r.jsxClosingElement(r.jsxIdentifier(x));let M;return M=F?[]:i.length>0?i.map((e=>"string"!=typeof e&&e._isRoute?h(e,n,t):j(v(e,n,t)))):[_(A,n,t)],r.jsxElement(L,N,M,F)}throw new Error(`Unexpected brick node: ${JSON.stringify(e)}`)}function _(e,n,t){const s=d(e,n,t);return s?r.jsxExpressionContainer(s):/[{}<>]|&(?:[a-zA-Z0-9]+|#\d+|#x[\da-fA-F]+);/.test(e)?r.jsxExpressionContainer(r.stringLiteral(e)):r.jsxText(e)}function E(e,n){const t=r.exportDefaultDeclaration(e),{code:o}=(0,l.transformFromAst)(r.program([t],void 0,"module"),void 0,{generatorOpts:{jsescOption:{minimal:!0}},cloneInputAst:!1}),a=function(e){const n=new Set;for(const t of e.values())for(const e of t)n.add(e.startsWith(s.jC)?e.substring(s.jC.length):/\s+as\s+/.test(e)?e.split(/\s+as\s+/)[1]:e);return n}(n),p=i(n),u=o.replace(c.dC,((e,n)=>{const t=n.split("/"),r=t[t.length-1],o=("context"===r&&3===t.length&&"views"===t[0]?`${t[t.length-2]}_${r}`:r).replaceAll("-","_").replace(/^(\d)/,"_$1");let i=2,c=o;for(;a.has(c)||s.bB.has(c);)c=`${o}_${i++}`;return a.add(c),p.push(`import ${c} from "./${n}.js";`),c}));return p.length>0?`${p.join("\n")}\n\n${u}`:o}function k(e){return`export default ${JSON.stringify(e)};`}function A(e,n,t){switch(n){case"routes":return function(e,n){const t=new Map;return E(r.jsxFragment(r.jsxOpeningFragment(),r.jsxClosingFragment(),e.map((e=>h(e,t,n)))),t)}(e,t);case"bricks":return function(e,n){const t=new Map;return E(Array.isArray(e)?b(e,t,n):v(e,t,n),t)}(e,t);case"template":return function(e,n){const t=new Map;o(t,"next-jsx","Component");const{bricks:s,name:i,state:a,proxy:c}=e;return E(r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("Component"),g({name:i,state:a,proxy:c},t,n)),r.jsxClosingElement(r.jsxIdentifier("Component")),(null!=s?s:[]).map((e=>j(v(e,t,n))))),t)}(e,t);case"context":case"menu":return function(e,n){const t=new Map,s=r.exportDefaultDeclaration(m(e,t,n)),o=r.program([s],void 0,"module"),a=i(t),c=(0,l.transformFromAst)(o,void 0,{generatorOpts:{jsescOption:{minimal:!0}},cloneInputAst:!1}).code;return a.length>0?`${a.join("\n")}\n\n${c}`:c}(e,t);case"plain":return k(e);case"others":return function(e){let n=k(e);const t=new Set,r=[];return n=n.replace(c.dC,((e,n)=>{const s=n.split("/"),o=s[s.length-1].replaceAll("-","_").replace(/^(\d)/,"_$1");let i=2,a=o;for(;t.has(a);)a=`${o}_${i++}`;return t.add(a),r.push(`import ${a} from "./${n}.js";`),a})),r.length>0&&(n=`${r.join("\n")}\n\n${n}`),n}(e);default:throw new Error(`Unknown node type: ${n}`)}}},1895:e=>{"use strict";e.exports='{\n "name": "__APP_ID__",\n "private": true,\n "type": "module",\n "scripts": {\n "dev": "run-p start serve",\n "start": "next-jsx-start",\n "serve": "brick-container-serve --local-micro-apps=\\"__APP_ID__\\" --live-reload"\n },\n "engines": {\n "node": ">=16"\n },\n "devDependencies": {\n "@next-core/brick-container": "^3.6.2",\n "@next-core/types": "^1.6.0",\n "next-jsx": "^0.1.5",\n "npm-run-all": "^4.1.5",\n "csstype": "^3.1.2"\n }\n}\n'},1897:e=>{function n(e){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}n.keys=()=>[],n.resolve=n,n.id=1897,e.exports=n},2582:e=>{"use strict";e.exports="root = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n"},3812:e=>{"use strict";e.exports='{\n "compilerOptions": {\n "moduleResolution": "Node16",\n "module": "Node16"\n },\n "include": ["./src", "./declarations.d.ts"]\n}\n'},4215:e=>{"use strict";e.exports='declare namespace JSX {\n interface IntrinsicElements {\n "basic-bricks_general-button": BrickProps & {\n buttonName?: string;\n buttonType?: string;\n };\n\n "basic-bricks_micro-view": BrickProps & {\n pageTitle?: string;\n };\n\n "forms_general-input": FormItemProps;\n "forms_general-select": FormItemProps;\n "forms_general-textarea": FormItemProps;\n "forms_general-checkbox": FormItemProps;\n "forms_general-radio": FormItemProps;\n "forms_general-switch": FormItemProps;\n }\n\n interface BrickProps {\n // HTML properties:\n id?: string;\n slot?: string;\n title?: string;\n className?: string;\n style?: import("csstype").Properties;\n\n // Brick configurations:\n ref?: string;\n if?: unknown;\n portal?: unknown;\n events?: import("@next-core/types").BrickEventsMap;\n lifeCycle?: import("@next-core/types").BrickLifeCycle;\n\n // JSX\n children?: any;\n }\n\n interface FormItemProps extends BrickProps {\n name?: string;\n label?: string;\n placeholder?: string;\n value?: unknown\n }\n}\n'},4437:(e,n,t)=>{"use strict";t.d(n,{WM:()=>c,dC:()=>i,j4:()=>o,pA:()=>l});var r=t(9936);const s={properties:["ref","refProperty","extraOneWayRefs","refTransform","mergeType","mergeMethod","mergeArgs","mergeProperty","asVariable"],slots:["ref","refSlot","refPosition"],events:["ref","refEvent"],methods:["ref","refMethod"]},o=`--${Math.floor(1e16*Math.random()).toString(36)}--:`,i=new RegExp(`"${o}((?:[-\\w]+/)*[-\\w]+)"`,"g");function a(e,n){return`${o}${e}${e?"/":""}${n}`}function c(e,n,t){return e.map((e=>function(e,n,t){const r=[...n,"views"],s=u("route",e.alias,r,t.namePool);let o;f(t.namePool,[...r,s],s),function(e){delete e.alias,delete e.iid,delete e.deviceOwner,delete e.analyticsData,""===e.menu&&delete e.menu,j(e,["redirect","exact"]),"bricks"===e.type&&delete e.type}(e);const i=[...r,s];if("redirect"===e.type)o=e;else if("routes"===e.type){const{routes:r,...s}=e;o={...s,children:c(r,n,t)}}else{const{bricks:n,...r}=e,c=m(n,i,t);t.extracts.push({name:s,path:i,node:c,nodeType:"bricks"}),o={...r,view:a(`views/${s}`,s)}}const l=p("context",e.context,s,i,t);return{...o,context:l}}(e,n,t)))}function l(e,n,t){return e.map((e=>function(e,n,t){if(!e.name.startsWith("tpl-"))throw new Error(`Invalid template name: "${e.name}"`);const o=e.name.substring(4),i=[...n,o],c=m(e.bricks,i,t),l=p("state",e.state,o,i,t),f=function(e,n,t){if((0,r.isObject)(e)&&Object.keys(e).length>0){const o=u("proxy","proxy",n,t.namePool);return function(e){for(const[n,t]of Object.entries(e))switch(n){case"properties":case"events":case"slots":case"methods":if((0,r.isObject)(t))for(const[e,o]of Object.entries(t))if((0,r.isObject)(o)){const r=Object.keys(o);for(const e of r)s[n].includes(e)||delete o[e];0===r.length&&delete t[e]}break;default:delete e[n]}}(e),t.extracts.push({name:o,path:n,node:e,nodeType:"plain"}),a("",o)}return e}(e.proxy,i,t);return t.extracts.push({name:o,path:i,node:{...e,bricks:c,state:l,proxy:f},nodeType:"template"}),a(o,o)}(e,n,t)))}function p(e,n,t,r,s){if(Array.isArray(n)&&n.length>0){for(const e of n)h(e);const o=u(e,e,r,s.namePool);return s.extracts.push({name:o,path:r,node:n,nodeType:"context"}),a("context"===e?`views/${t}`:"",o)}}function u(e,n,t,r){let s=null==n?void 0:n.toLowerCase();"index"==s&&(s=`${s}_2`);const o=d(r,t),i="route"!==e||"string"==typeof s&&/^[-\w]+$/.test(s)&&"index"!==s;if(!i||o.has(s)){const n=i?s:e;let t,r=2;for(;o.has(t=`${n}_${r}`);)r++;s=t}return o.add(s),s}function f(e,n,t){d(e,n).add(t)}function d(e,n){const t=n.join("/");let r=e.get(t);return r||e.set(t,r=new Set),r}function m(e,n,t){return Array.isArray(e)?e.map((e=>x(e,n,t))):e}function x(e,n,t){let s;"string"==typeof e.alias&&/^<[-\w]+>$/.test(e.alias)&&"<index>"!==e.alias&&(s=e.alias.slice(1,-1)),function(e){if("string"==typeof e.properties){const n=`The \`properties\` of brick cannot be a string, received: "${e.properties}"`;throw console.error(`${n}. Check your brick:`,e),new Error(n)}delete e.alias,delete e.iid,delete e.deviceOwner,delete e.uuid,e.events&&0===Object.keys(e.events).length&&delete e.events,e.lifeCycle&&0===Object.keys(e.lifeCycle).length&&delete e.lifeCycle,j(e,["bg","portal"])}(e),s&&(s=u("brick",s,n,t.namePool),f(t.namePool,[...n,s],s));const{slots:o,...i}=e,l=[],p=[...n,...s?[s]:[]];if((0,r.isObject)(o))for(const[e,r]of Object.entries(o))if("routes"===r.type){var d;const s=c((null!==(d=r.routes)&&void 0!==d?d:[]).map((n=>({...n,_isRoute:!0,slot:e}))),n,t);l.push(...s)}else{var x;const n=m((null!==(x=r.bricks)&&void 0!==x?x:[]).map((n=>({...n,slot:e}))),p,t);l.push(...n)}return(0,r.isObject)(i.properties)&&!Array.isArray(i.properties)&&(i.properties=g(i.properties,p,t)),i.children=l,s?(t.extracts.push({name:s,node:i,path:[...n,s],nodeType:"bricks"}),a(s,s)):i}function g(e,n,t){return Object.fromEntries(Object.entries(e).map((e=>{let[r,s]=e;return[r,y(s,r,n,t)]})))}function y(e,n,t,s){return"useBrick"===n?Array.isArray(e)?m(e,t,s):(0,r.isObject)(e)?x(e,t,s):e:Array.isArray(e)?e.map(((e,n)=>y(e,n,t,s))):(0,r.isObject)(e)?g(e,t,s):e}function h(e){delete e.path,delete e.relatedId,delete e.doc}function j(e,n){for(const t of n)e[t]||delete e[t]}},6337:(e,n,t)=>{"use strict";function r(e){const n=[];for(const t of e)s(t,n);return n}function s(e,n){let{name:t,path:r,node:s,nodeType:o}=e,i=n;for(const e of r){const n=i.find((n=>n.name===e&&"folder"===n.type));if(n){i=n.items;continue}const t={type:"folder",name:e,items:[]};i.push(t),i=t.items}const a={type:"file",name:t,node:s,nodeType:o};i.push(a)}t.d(n,{_:()=>r})},6357:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});var r=t(8135),s=t(77);const o="transform-storyboard-function";(0,s.registerPlugin)(o,(()=>({name:o,visitor:{FunctionDeclaration(e){"Program"===e.parent.type&&e.replaceWith(r.exportDefaultDeclaration(e.node))},TSDeclareFunction(e){"Program"===e.parent.type&&e.replaceWith(r.exportDefaultDeclaration(e.node))}}})));const i=o},6414:e=>{"use strict";e.exports="# __PROJECT_NAME__\n\n## 准备\n\n```bash\nyarn\n```\n\n## 开发\n\n打开两个终端,分别运行 `yarn start` 和 `yarn serve`。\n\n然后浏览器打开 http://localhost:8081__PROJECT_HOMEPAGE__\n\n提示:\n- 运行 `yarn serve` 时按需使用 `--subdir` 和 `--server` 等参数。\n- 也可以选择只使用一个终端运行 `yarn dev`,此时需要把 `yarn serve` 相关的参数定义在 `package.json` 文件中。\n\n## 离线开发\n\n修改 `dev.config.mjs`,取消注释 `mock` 一节的代码,参考对 `GET /api/auth/login` 接口,对其他远端接口进行 mock。\n"},7577:e=>{"use strict";e.exports='import app from "./app.js";\nimport routes from "./routes.js";\nimport components from "./components/index.js";\nimport resources from "./resources/index.js";\n\nexport default {\n app,\n routes,\n components,\n resources,\n};\n'},7585:(e,n,t)=>{"use strict";t.d(n,{O7:()=>r,bB:()=>o,jC:()=>s});const r=["context","exact","path","slot"],s="default:",o=new Set(["break","case","catch","class","continue","const","constructor","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","get","if","import","in","instanceof","let","new","null","return","set","static","super","switch","symbol","this","throw","true","try","typeof","undefined","var","void","while","with","yield","async","await","of"])},7837:(e,n,t)=>{"use strict";t.d(n,{A:()=>i}),t(8135);var r=t(77);t(9936);const s=new Set(["_","location","moment","ANCHOR","APP","BASE_URL","CTX","DATA","EVENT","FLAGS","FN","HASH","I18N_TEXT","I18N","IMG","INSTALLED_APPS","ITEM","INDEX","SIZE","LOCAL_STORAGE","MEDIA","MISC","PARAMS","PATH_NAME","PATH","PERMISSIONS","PIPES","PROCESSORS","QUERY_ARRAY","QUERY","SESSION_STORAGE","STATE","SYS","THEME","TAG_URL","SAFE_TAG_URL"]),o="smart-imports";(0,r.registerPlugin)(o,((e,n)=>({name:o,visitor:{Identifier(e){const{node:t,scope:r,key:o,parent:i}=e,{name:a}=t;!r.hasGlobal(a)||"undefined"===a||"key"===o&&"ObjectProperty"===i.type&&!i.computed||"property"===o&&"MemberExpression"===i.type&&!i.computed||s.has(a)&&(null==n||n.imports.add(a))}}})));const i=o}}]);
|
|
2
|
-
//# sourceMappingURL=246.
|
|
1
|
+
(globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[]).push([[246],{535:e=>{"use strict";e.exports="node_modules\n/dist\n/temp\n"},743:e=>{"use strict";e.exports='import functions from "./functions/index.js";\nimport menus from "./menus/index.js";\nimport contracts from "./contracts/index.js";\nimport i18n from "./i18n/index.js";\nimport meta from "./meta.js";\n\nexport default {\n functions,\n menus,\n contracts,\n i18n,\n meta,\n};\n'},1259:e=>{"use strict";e.exports='export default {\n appId: "__APP_ID__"\n};\n'},1330:e=>{"use strict";e.exports='// @ts-check\n/** @typedef {import("express").RequestHandler} Mock */\n/** @typedef {{ featureFlags?: Record<string, boolean>; misc?: Record<string, unknown>; [k: string]: unknown; }} Settings */\n/** @type {{ brickFolders?: string[]; mocks?: Mock[]; settings?: Settings }} */\nexport default {\n brickFolders: [\n "./bricks",\n ],\n // NOTE: Uncomment these lines below to enable local mocks:\n // mocks: [\n // (req, res, next) => {\n // switch (`${req.method} ${req.path}`) {\n // case "GET /api/auth/login":\n // res.send({\n // code: 0,\n // data: {\n // loggedIn: true,\n // username: "mock_user",\n // },\n // });\n // return;\n // }\n //\n // next();\n // }\n // ],\n}\n'},1672:(e,n,t)=>{"use strict";t.d(n,{c:()=>A});var r=t(8135),s=t(7585);function o(e,n,t){let r=e.get(n);r||(r=new Set,e.set(n,r)),r.add(t)}function i(e){return[...e].sort(((e,n)=>Number(e[0].startsWith("."))-Number(n[0].startsWith(".")))).map((e=>{let[n,t]=e;const r=[...t];return 1===r.length&&r[0].startsWith(s.jC)?`import ${r[0].substring(s.jC.length)} from "${n}";`:`import { ${r.join(", ")} } from "${n}";`}))}var a=t(7019),c=t(4437),l=t(77);const p="transform-pipeline-operator-minimal";(0,l.registerPlugin)(p,(()=>({name:p,inherits:l.availablePlugins["syntax-pipeline-operator"],visitor:{BinaryExpression(e){const{node:n}=e,{operator:t,left:s,right:o}=n;if("|>"!==t)return;const i=r.callExpression(o,[s]);e.replaceWith(i)}}})));const u=p;var f=t(7837);function d(e,n,t){if(/^\s*<%[~=]?\s/.test(e)&&/\s%>\s*$/.test(e))try{let s="";const i=e.replace(/^\s*<%([~=])?\s|\s%>\s*$/g,((e,n)=>(n&&(s=n),"")));let a="="===s;const c="~"===s,p=new Set;let d,m=(0,l.transform)(`(${i})`,{ast:!0,code:!1,plugins:[[u,{proposal:"minimal"}],[f.A,{imports:p}]]}).ast.program.body[0].expression;"SequenceExpression"!==m.type||(d=m.expressions[0],"StringLiteral"!==d.type)||"track context"!==d.value&&"track state"!==d.value||a||(a=!0,m=m.expressions.length>2?r.sequenceExpression(m.expressions.slice(1)):m.expressions[1]),!a||p.has("STATE")||p.has("CTX")||(a=!1);for(const e of p)if("FN"===e){const e=["resources","functions","index.js"];let r=0;for(let n=0;n<e.length&&n<t.length&&(r=n,t[n]===e[n]);n++);o(n,`${1===t.length?".":new Array(t.length-1-r).fill("..").join("/")}/${e.slice(r).join("/")}`,"default:FN")}else o(n,"next-jsx/runtime",e);return c&&(o(n,"next-jsx/runtime","recursive"),m=r.callExpression(r.identifier("recursive"),[m])),a&&(o(n,"next-jsx/runtime","bind"),m=r.callExpression(r.identifier("bind"),[m])),m}catch(n){console.warn("Parse expression failed:",e,n)}return null}function m(e,n,t,s,o){var i;return null!==(i=x(e,n,t,s,o))&&void 0!==i?i:r.nullLiteral()}function x(e,n,t,s,o){if(s&&"useBrick"===o){if(Array.isArray(e))return b(e,n,t);if((0,a.isObject)(e))return v(e,n,t)}if(Array.isArray(e))return r.arrayExpression(e.map((e=>x(e,n,t,s))));if("function"==typeof e)return null;if((0,a.isObject)(e))return r.objectExpression(Object.entries(e).map((e=>{let[o,i]=e;const a=x(i,n,t,s,o);return null!==a?r.objectProperty(r.stringLiteral(o),a):null})).filter(Boolean));if("string"==typeof e){const s=d(e,n,t);return null!=s?s:r.stringLiteral(e)}return"number"==typeof e?r.numericLiteral(e):"boolean"==typeof e?r.booleanLiteral(e):null===e?r.nullLiteral():null}function g(e,n,t,s,o,i){const l=[],p=[];for(const[s,i]of Object.entries(e))void 0!==i&&(/^[_$a-zA-Z][$\w]*$/.test(s)?l.push([s,i]):p.push(r.objectProperty(r.stringLiteral(o?`${o}:${s}`:s),m(i,n,t))));const u=(s?l.sort((f=s,function(e,n){return f.indexOf(n[0])-f.indexOf(e[0])})):l).map((e=>{let[s,l]=e;const p=function(e,n,t,s,o){if("string"==typeof e){const s=d(e,n,t);if(s)return r.jsxExpressionContainer(s);const o=r.stringLiteral(e);return e.includes(c.j4)||JSON.stringify(e).includes("\\")?r.jsxExpressionContainer(o):o}if(!0===e)return null;if(o&&"useBrick"===s){if(Array.isArray(e))return y(b(e,n,t));if((0,a.isObject)(e))return y(v(e,n,t))}const i=m(e,n,t,o);return r.jsxExpressionContainer(i)}(l,n,t,s,i);return r.jsxAttribute(o?r.jsxNamespacedName(r.jsxIdentifier(o),r.jsxIdentifier(s)):r.jsxIdentifier(s),p)}));var f;return p.length>0&&u.push(r.jsxSpreadAttribute(r.objectExpression(p))),u}function y(e){return"StringLiteral"!==e.type?r.jsxExpressionContainer(e):e}function h(e,n,t){o(n,"next-jsx","Route");const{children:i,slot:a,_isRoute:c,...l}=e,p=null!=i?i:[],u=""===a?void 0:a,f=0===p.length;return r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("Route"),g({...l,slot:u},n,t,s.O7),f),f?null:r.jsxClosingElement(r.jsxIdentifier("Route")),p.map((e=>h(e,n,t))),f)}function j(e){return"StringLiteral"===e.type?r.jsxExpressionContainer(e):e}function b(e,n,t){const s=e.map((e=>v(e,n,t)));return 1===s.length?s[0]:r.jsxFragment(r.jsxOpeningFragment(),r.jsxClosingFragment(),s.map(j))}function v(e,n,t){if("string"==typeof e)return r.stringLiteral(e);if(e.template)return function(e,n,t){o(n,"next-jsx","LegacyTemplate");const{children:s,...i}=e;return r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("LegacyTemplate"),g(i,n,t),!0),null,[],!0)}(e,n,t);const{brick:s,children:i,properties:a,events:c,lifeCycle:l,if:p,portal:u,ref:f,slot:d,...m}=e;if("string"==typeof s){let x,y,b=!0;switch(s){case":forEach":case":if":case":switch":x=`${s[1].toUpperCase()}${s.substring(2)}`,o(n,"next-jsx",x);break;default:b=!1,x=s.replaceAll(".","_")}b&&(y=m.dataSource,delete m.dataSource);const E=""===d?void 0:d,k=null!=a?a:{},{textContent:A,children:w,events:O,lifeCycle:$,if:P,ref:S,id:C,slot:T,...I}=k,R="string"==typeof A,F=0===i.length&&!R;i.length>0&&R&&console.warn("Invalid brick: mix slotted children and textContent:",e);const L=r.jsxOpeningElement(r.jsxIdentifier(x),[...g({if:!0===p?void 0:p,slot:E,ref:f,id:C,...b?{value:y}:null},n,t),...g(I,n,t,void 0,void 0,!0),...g({events:c,lifeCycle:l,portal:u},n,t),...g({children:w,events:O,lifeCycle:$,if:P,ref:S},n,t,void 0,"prop"),...g(m,n,t,void 0,"conf")],F),N=F?null:r.jsxClosingElement(r.jsxIdentifier(x));let M;return M=F?[]:i.length>0?i.map((e=>"string"!=typeof e&&e._isRoute?h(e,n,t):j(v(e,n,t)))):[_(A,n,t)],r.jsxElement(L,N,M,F)}throw new Error(`Unexpected brick node: ${JSON.stringify(e)}`)}function _(e,n,t){const s=d(e,n,t);return s?r.jsxExpressionContainer(s):/[{}<>]|&(?:[a-zA-Z0-9]+|#\d+|#x[\da-fA-F]+);/.test(e)?r.jsxExpressionContainer(r.stringLiteral(e)):r.jsxText(e)}function E(e,n){const t=r.exportDefaultDeclaration(e),{code:o}=(0,l.transformFromAst)(r.program([t],void 0,"module"),void 0,{generatorOpts:{jsescOption:{minimal:!0}},cloneInputAst:!1}),a=function(e){const n=new Set;for(const t of e.values())for(const e of t)n.add(e.startsWith(s.jC)?e.substring(s.jC.length):/\s+as\s+/.test(e)?e.split(/\s+as\s+/)[1]:e);return n}(n),p=i(n),u=o.replace(c.dC,((e,n)=>{const t=n.split("/"),r=t[t.length-1],o=("context"===r&&3===t.length&&"views"===t[0]?`${t[t.length-2]}_${r}`:r).replaceAll("-","_").replace(/^(\d)/,"_$1");let i=2,c=o;for(;a.has(c)||s.bB.has(c);)c=`${o}_${i++}`;return a.add(c),p.push(`import ${c} from "./${n}.js";`),c}));return p.length>0?`${p.join("\n")}\n\n${u}`:o}function k(e){return`export default ${JSON.stringify(e)};`}function A(e,n,t){switch(n){case"routes":return function(e,n){const t=new Map;return E(r.jsxFragment(r.jsxOpeningFragment(),r.jsxClosingFragment(),e.map((e=>h(e,t,n)))),t)}(e,t);case"bricks":return function(e,n){const t=new Map;return E(Array.isArray(e)?b(e,t,n):v(e,t,n),t)}(e,t);case"template":return function(e,n){const t=new Map;o(t,"next-jsx","Component");const{bricks:s,name:i,state:a,proxy:c}=e;return E(r.jsxElement(r.jsxOpeningElement(r.jsxIdentifier("Component"),g({name:i,state:a,proxy:c},t,n)),r.jsxClosingElement(r.jsxIdentifier("Component")),(null!=s?s:[]).map((e=>j(v(e,t,n))))),t)}(e,t);case"context":case"menu":return function(e,n){const t=new Map,s=r.exportDefaultDeclaration(m(e,t,n)),o=r.program([s],void 0,"module"),a=i(t),c=(0,l.transformFromAst)(o,void 0,{generatorOpts:{jsescOption:{minimal:!0}},cloneInputAst:!1}).code;return a.length>0?`${a.join("\n")}\n\n${c}`:c}(e,t);case"plain":return k(e);case"others":return function(e){let n=k(e);const t=new Set,r=[];return n=n.replace(c.dC,((e,n)=>{const s=n.split("/"),o=s[s.length-1].replaceAll("-","_").replace(/^(\d)/,"_$1");let i=2,a=o;for(;t.has(a);)a=`${o}_${i++}`;return t.add(a),r.push(`import ${a} from "./${n}.js";`),a})),r.length>0&&(n=`${r.join("\n")}\n\n${n}`),n}(e);default:throw new Error(`Unknown node type: ${n}`)}}},1895:e=>{"use strict";e.exports='{\n "name": "__APP_ID__",\n "private": true,\n "type": "module",\n "scripts": {\n "dev": "run-p start serve",\n "start": "next-jsx-start",\n "serve": "brick-container-serve --local-micro-apps=\\"__APP_ID__\\" --live-reload"\n },\n "engines": {\n "node": ">=16"\n },\n "devDependencies": {\n "@next-core/brick-container": "^3.6.2",\n "@next-core/types": "^1.6.0",\n "next-jsx": "^0.1.5",\n "npm-run-all": "^4.1.5",\n "csstype": "^3.1.2"\n }\n}\n'},1897:e=>{function n(e){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}n.keys=()=>[],n.resolve=n,n.id=1897,e.exports=n},2582:e=>{"use strict";e.exports="root = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n"},3812:e=>{"use strict";e.exports='{\n "compilerOptions": {\n "moduleResolution": "Node16",\n "module": "Node16"\n },\n "include": ["./src", "./declarations.d.ts"]\n}\n'},4215:e=>{"use strict";e.exports='declare namespace JSX {\n interface IntrinsicElements {\n "basic-bricks_general-button": BrickProps & {\n buttonName?: string;\n buttonType?: string;\n };\n\n "basic-bricks_micro-view": BrickProps & {\n pageTitle?: string;\n };\n\n "forms_general-input": FormItemProps;\n "forms_general-select": FormItemProps;\n "forms_general-textarea": FormItemProps;\n "forms_general-checkbox": FormItemProps;\n "forms_general-radio": FormItemProps;\n "forms_general-switch": FormItemProps;\n }\n\n interface BrickProps {\n // HTML properties:\n id?: string;\n slot?: string;\n title?: string;\n className?: string;\n style?: import("csstype").Properties;\n\n // Brick configurations:\n ref?: string;\n if?: unknown;\n portal?: unknown;\n events?: import("@next-core/types").BrickEventsMap;\n lifeCycle?: import("@next-core/types").BrickLifeCycle;\n\n // JSX\n children?: any;\n }\n\n interface FormItemProps extends BrickProps {\n name?: string;\n label?: string;\n placeholder?: string;\n value?: unknown\n }\n}\n'},4437:(e,n,t)=>{"use strict";t.d(n,{WM:()=>c,dC:()=>i,j4:()=>o,pA:()=>l});var r=t(7019);const s={properties:["ref","refProperty","extraOneWayRefs","refTransform","mergeType","mergeMethod","mergeArgs","mergeProperty","asVariable"],slots:["ref","refSlot","refPosition"],events:["ref","refEvent"],methods:["ref","refMethod"]},o=`--${Math.floor(1e16*Math.random()).toString(36)}--:`,i=new RegExp(`"${o}((?:[-\\w]+/)*[-\\w]+)"`,"g");function a(e,n){return`${o}${e}${e?"/":""}${n}`}function c(e,n,t){return e.map((e=>function(e,n,t){const r=[...n,"views"],s=u("route",e.alias,r,t.namePool);let o;f(t.namePool,[...r,s],s),function(e){delete e.alias,delete e.iid,delete e.deviceOwner,delete e.analyticsData,""===e.menu&&delete e.menu,j(e,["redirect","exact"]),"bricks"===e.type&&delete e.type}(e);const i=[...r,s];if("redirect"===e.type)o=e;else if("routes"===e.type){const{routes:r,...s}=e;o={...s,children:c(r,n,t)}}else{const{bricks:n,...r}=e,c=m(n,i,t);t.extracts.push({name:s,path:i,node:c,nodeType:"bricks"}),o={...r,view:a(`views/${s}`,s)}}const l=p("context",e.context,s,i,t);return{...o,context:l}}(e,n,t)))}function l(e,n,t){return e.map((e=>function(e,n,t){if(!e.name.startsWith("tpl-"))throw new Error(`Invalid template name: "${e.name}"`);const o=e.name.substring(4),i=[...n,o],c=m(e.bricks,i,t),l=p("state",e.state,o,i,t),f=function(e,n,t){if((0,r.isObject)(e)&&Object.keys(e).length>0){const o=u("proxy","proxy",n,t.namePool);return function(e){for(const[n,t]of Object.entries(e))switch(n){case"properties":case"events":case"slots":case"methods":if((0,r.isObject)(t))for(const[e,o]of Object.entries(t))if((0,r.isObject)(o)){const r=Object.keys(o);for(const e of r)s[n].includes(e)||delete o[e];0===r.length&&delete t[e]}break;default:delete e[n]}}(e),t.extracts.push({name:o,path:n,node:e,nodeType:"plain"}),a("",o)}return e}(e.proxy,i,t);return t.extracts.push({name:o,path:i,node:{...e,bricks:c,state:l,proxy:f},nodeType:"template"}),a(o,o)}(e,n,t)))}function p(e,n,t,r,s){if(Array.isArray(n)&&n.length>0){for(const e of n)h(e);const o=u(e,e,r,s.namePool);return s.extracts.push({name:o,path:r,node:n,nodeType:"context"}),a("context"===e?`views/${t}`:"",o)}}function u(e,n,t,r){let s=null==n?void 0:n.toLowerCase();"index"==s&&(s=`${s}_2`);const o=d(r,t),i="route"!==e||"string"==typeof s&&/^[-\w]+$/.test(s)&&"index"!==s;if(!i||o.has(s)){const n=i?s:e;let t,r=2;for(;o.has(t=`${n}_${r}`);)r++;s=t}return o.add(s),s}function f(e,n,t){d(e,n).add(t)}function d(e,n){const t=n.join("/");let r=e.get(t);return r||e.set(t,r=new Set),r}function m(e,n,t){return Array.isArray(e)?e.map((e=>x(e,n,t))):e}function x(e,n,t){let s;"string"==typeof e.alias&&/^<[-\w]+>$/.test(e.alias)&&"<index>"!==e.alias&&(s=e.alias.slice(1,-1)),function(e){if("string"==typeof e.properties){const n=`The \`properties\` of brick cannot be a string, received: "${e.properties}"`;throw console.error(`${n}. Check your brick:`,e),new Error(n)}delete e.alias,delete e.iid,delete e.deviceOwner,delete e.uuid,e.events&&0===Object.keys(e.events).length&&delete e.events,e.lifeCycle&&0===Object.keys(e.lifeCycle).length&&delete e.lifeCycle,j(e,["bg","portal"])}(e),s&&(s=u("brick",s,n,t.namePool),f(t.namePool,[...n,s],s));const{slots:o,...i}=e,l=[],p=[...n,...s?[s]:[]];if((0,r.isObject)(o))for(const[e,r]of Object.entries(o))if("routes"===r.type){var d;const s=c((null!==(d=r.routes)&&void 0!==d?d:[]).map((n=>({...n,_isRoute:!0,slot:e}))),n,t);l.push(...s)}else{var x;const n=m((null!==(x=r.bricks)&&void 0!==x?x:[]).map((n=>({...n,slot:e}))),p,t);l.push(...n)}return(0,r.isObject)(i.properties)&&!Array.isArray(i.properties)&&(i.properties=g(i.properties,p,t)),i.children=l,s?(t.extracts.push({name:s,node:i,path:[...n,s],nodeType:"bricks"}),a(s,s)):i}function g(e,n,t){return Object.fromEntries(Object.entries(e).map((e=>{let[r,s]=e;return[r,y(s,r,n,t)]})))}function y(e,n,t,s){return"useBrick"===n?Array.isArray(e)?m(e,t,s):(0,r.isObject)(e)?x(e,t,s):e:Array.isArray(e)?e.map(((e,n)=>y(e,n,t,s))):(0,r.isObject)(e)?g(e,t,s):e}function h(e){delete e.path,delete e.relatedId,delete e.doc}function j(e,n){for(const t of n)e[t]||delete e[t]}},6337:(e,n,t)=>{"use strict";function r(e){const n=[];for(const t of e)s(t,n);return n}function s(e,n){let{name:t,path:r,node:s,nodeType:o}=e,i=n;for(const e of r){const n=i.find((n=>n.name===e&&"folder"===n.type));if(n){i=n.items;continue}const t={type:"folder",name:e,items:[]};i.push(t),i=t.items}const a={type:"file",name:t,node:s,nodeType:o};i.push(a)}t.d(n,{_:()=>r})},6357:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});var r=t(8135),s=t(77);const o="transform-storyboard-function";(0,s.registerPlugin)(o,(()=>({name:o,visitor:{FunctionDeclaration(e){"Program"===e.parent.type&&e.replaceWith(r.exportDefaultDeclaration(e.node))},TSDeclareFunction(e){"Program"===e.parent.type&&e.replaceWith(r.exportDefaultDeclaration(e.node))}}})));const i=o},6414:e=>{"use strict";e.exports="# __PROJECT_NAME__\n\n## 准备\n\n```bash\nyarn\n```\n\n## 开发\n\n打开两个终端,分别运行 `yarn start` 和 `yarn serve`。\n\n然后浏览器打开 http://localhost:8081__PROJECT_HOMEPAGE__\n\n提示:\n- 运行 `yarn serve` 时按需使用 `--subdir` 和 `--server` 等参数。\n- 也可以选择只使用一个终端运行 `yarn dev`,此时需要把 `yarn serve` 相关的参数定义在 `package.json` 文件中。\n\n## 离线开发\n\n修改 `dev.config.mjs`,取消注释 `mock` 一节的代码,参考对 `GET /api/auth/login` 接口,对其他远端接口进行 mock。\n"},7577:e=>{"use strict";e.exports='import app from "./app.js";\nimport routes from "./routes.js";\nimport components from "./components/index.js";\nimport resources from "./resources/index.js";\n\nexport default {\n app,\n routes,\n components,\n resources,\n};\n'},7585:(e,n,t)=>{"use strict";t.d(n,{O7:()=>r,bB:()=>o,jC:()=>s});const r=["context","exact","path","slot"],s="default:",o=new Set(["break","case","catch","class","continue","const","constructor","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","get","if","import","in","instanceof","let","new","null","return","set","static","super","switch","symbol","this","throw","true","try","typeof","undefined","var","void","while","with","yield","async","await","of"])},7837:(e,n,t)=>{"use strict";t.d(n,{A:()=>i}),t(8135);var r=t(77);t(7019);const s=new Set(["_","location","moment","ANCHOR","APP","BASE_URL","CTX","DATA","EVENT","FLAGS","FN","HASH","I18N_TEXT","I18N","IMG","INSTALLED_APPS","ITEM","INDEX","SIZE","LOCAL_STORAGE","MEDIA","MISC","PARAMS","PATH_NAME","PATH","PERMISSIONS","PIPES","PROCESSORS","QUERY_ARRAY","QUERY","SESSION_STORAGE","STATE","SYS","THEME","TAG_URL","SAFE_TAG_URL"]),o="smart-imports";(0,r.registerPlugin)(o,((e,n)=>({name:o,visitor:{Identifier(e){const{node:t,scope:r,key:o,parent:i}=e,{name:a}=t;!r.hasGlobal(a)||"undefined"===a||"key"===o&&"ObjectProperty"===i.type&&!i.computed||"property"===o&&"MemberExpression"===i.type&&!i.computed||s.has(a)&&(null==n||n.imports.add(a))}}})));const i=o}}]);
|
|
2
|
+
//# sourceMappingURL=246.3c1287e4.js.map
|