@blocklet/pages-kit-inner-components 0.0.8 → 0.0.9
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/lib/cjs/setting.js +4 -4
- package/lib/cjs/uploader.js +1 -0
- package/lib/{components-DsmhMXRy.mjs → components-Bo3_pN-Y.mjs} +6 -6
- package/lib/{draft-data-Bs6uEYy4.mjs → draft-data-ByCPsDRp.mjs} +1 -1
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +2 -2
- package/lib/es/resources.js +2 -2
- package/lib/es/setting.js +382 -450
- package/lib/es/site-state.js +2 -2
- package/lib/es/uploader.js +81 -0
- package/lib/{home-Cn3Pji4Z.mjs → home-Cy0eoqJw.mjs} +8 -8
- package/lib/{publish-button-C-CnCCa5.mjs → publish-button-B63RIwA3.mjs} +2 -2
- package/lib/{site-state-CUnFMunr.mjs → site-state-7Hsu0igk.mjs} +1 -1
- package/lib/{state-C6rI6VKx.mjs → state-CETtldI3.mjs} +5 -5
- package/package.json +1 -1
package/lib/cjs/setting.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ye=Object.create;var de=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var ke=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var we=(t,s,l,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of Ie(s))!Be.call(t,o)&&o!==l&&de(t,o,{get:()=>s[o],enumerable:!(i=Se(s,o))||i.enumerable});return t};var Ce=(t,s,l)=>(l=t!=null?ye(ke(t)):{},we(s||!t||!t.__esModule?de(l,"default",{value:t,enumerable:!0}):l,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("../state-CfaAw7fr.js"),r=require("@mui/material"),k=require("react"),Te=require("@arcblock/ux/lib/Empty"),q=require("@arcblock/ux/lib/Locale/context"),De=require("@arcblock/ux/lib/Theme"),Re=require("@emotion/css"),Z=require("ahooks"),Pe=require("gradient-parser");require("lodash/without");const Ve=require("tinycolor2"),D=require("@mui/material/colors"),O=require("./uploader.js"),ze=require("@iconify-icon/react"),xe=require("react-use"),me=require("@blocklet/code-editor"),je=require("@blocklet/pages-kit/components"),ee=require("@mui/base"),N=require("@mui/icons-material"),G=require("@syncedstore/core"),_=require("lodash"),A=require("material-ui-popup-state/hooks"),Ae=require("react-error-boundary"),Fe=require("lodash/sortBy"),L=require("react-dnd"),Q=t=>t&&t.__esModule?t:{default:t},Oe=Q(Te),pe=Q(Pe),qe=Q(Ve),_e=Q(Fe);D.red[300],D.pink[300],D.purple[300],D.indigo[300],D.blue[300],D.cyan[300],D.teal[300],D.green[300],D.lime[300],D.yellow[300],D.amber[300],D.orange[300],D.brown[300],D.grey[300],D.blueGrey[300];const Ee=k.forwardRef(function({showMarkdown:s,markdown:l,onMarkdownChange:i,showUploader:o,value:d,meta:u,onChange:a,...g},b){const[p,f]=k.useState("");k.useEffect(()=>{f(d||"")},[d,f]);const j=async()=>{if(p!==d){const n=C.getImageAbsoluteUrl(p);if(!n){a(p,void 0);return}const c=await O.getImageSize(n).catch(()=>O.getVideoSize(n)).catch(()=>{});a(p,{...c,filename:p})}};xe.useDebounce(()=>{p!==d&&a(p)},300,[p]),k.useImperativeHandle(b,()=>({submit:j}));const m={};return o&&(m.InputProps={sx:{pr:0},endAdornment:e.jsx(r.InputAdornment,{position:"end",sx:{mx:.5},children:e.jsx(O.UploaderButton,{onChange:async({response:n})=>{var y;const c=(y=n==null?void 0:n.data)==null?void 0:y.filename,h=C.getImageAbsoluteUrl(c)||"";let v={};h&&(v=await O.getImageSize(h).catch(()=>O.getVideoSize(h)).catch(()=>{})),a(c,{...v,filename:c})}})})}),e.jsx(r.TextField,{size:"small",fullWidth:!0,...g,label:e.jsxs(r.Stack,{direction:"row",spacing:1,alignItems:"center",children:[g.label,s&&e.jsxs(e.Fragment,{children:[" (",e.jsx(r.FormControlLabel,{checked:l,label:e.jsx(r.Box,{component:ze.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:e.jsx(r.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(n,c)=>i==null?void 0:i(c)}),")"]})]}),InputLabelProps:{shrink:!0,...g.InputLabelProps},value:p,onChange:n=>f(n.target.value),...m,onKeyDown:n=>{n.keyCode!==229&&n.key==="Enter"&&j()}})}),Ne=k.lazy(()=>import("react-best-gradient-color-picker"));function We(t){try{const l=pe.default.parse(t).map(o=>{const d=o.colorStops.map(u=>{if(u.type!=="rgba"){const a=qe.default(u.value).toRgb();return{...u,value:[a.r,a.g,a.b,a.a],type:"rgba"}}return u});return{...o,colorStops:d}});return pe.default.stringify(l)}catch{return C.isColorString(t)?t:""}}function Me({color:t,sx:s={},...l}){C.isColorString(t);const i={};return C.isGradient(t)?i.backgroundImage=t:i.backgroundColor=t,e.jsx(r.Box,{sx:{...s,width:"100%",paddingBottom:"100%",cursor:"pointer",transition:"opacity 0.2s",border:"1px solid #ccc",borderRadius:.5,"&:hover":{opacity:.75},...i},...l})}const Ue=k.forwardRef(function({onSave:s},l){const i=Z.useReactive({value:""}),{t:o}=q.useLocaleContext(),d={};i.value?C.isGradient(i.value)?d.backgroundImage=i.value:d.backgroundColor=i.value:d.border="1px solid #ccc";const[u,{setFalse:a,setTrue:g}]=Z.useBoolean(!1),b=k.useCallback(()=>{a()},[a]),p=()=>{s({value:i.value},b)};return k.useImperativeHandle(l,()=>({open({value:f}={value:""}){i.value=f,g()},close(){b()}})),e.jsxs(r.Dialog,{open:u,onClose:b,hideBackdrop:!0,children:[e.jsx(r.DialogTitle,{children:o("maker.configBackground")}),e.jsx(r.DialogContent,{sx:{width:600},children:e.jsxs(r.Box,{width:"100%",display:"flex",children:[e.jsx(r.Box,{flex:1,mr:1,sx:d,children:!i.value&&e.jsx(Oe.default,{children:o("error.notConfig")})}),e.jsx(k.Suspense,{children:e.jsx(Ne,{width:200,height:200,value:We(i.value),onChange:f=>{i.value=f},hidePresets:!0,hideAdvancedSliders:!0,hideColorGuide:!0,hideInputType:!0})})]})}),e.jsxs(r.DialogActions,{children:[e.jsx(r.Button,{variant:"outlined",size:"small",onClick:b,children:o("common.cancel")}),e.jsx(r.Button,{variant:"contained",size:"small",onClick:p,children:o("maker.save")})]})]})});De.styled(r.Box)`
|
|
2
2
|
.color-item {
|
|
3
3
|
position: relative;
|
|
4
4
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
top: 0;
|
|
19
19
|
right: 0;
|
|
20
20
|
}
|
|
21
|
-
`;function Ze({value:t,onChange:s,...n}){const i=k.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(Ge,{...n,value:t,onChange:s,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(Qe,{color:t??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var o;(o=i.current)==null||o.open({value:t??""})}})})}}),e.jsx(Xe,{ref:i,onSave:({value:o},u)=>{s(o),u()}})]})}function Le({disabled:t,list:s,renderItem:n,...i}){const o=k.useRef(null),u=k.useId(),d=X.useUpdate(),a=Me.default(Object.entries(s),m=>m[1].index).map(m=>m[0]),g=k.useRef(a),b=k.useCallback(m=>{g.current=m,d()},[d]),p=k.useCallback(({index:m},{index:l})=>{const c=[...g.current];c.splice(l,0,...c.splice(m,1)),b(c)},[b]);k.useEffect(()=>{b(a)},[a.join("-")]);const[{isOver:f},j]=Z.useDrop({accept:u,collect:m=>({isOver:m.isOver()}),canDrop:()=>!t,drop:()=>{var c;const m=()=>{g.current.forEach((h,v)=>{const y=s[h];y&&(y.index=v)})},l=(c=K.getYjsValue(s))==null?void 0:c.doc;l?l.transact(()=>{m()}):m()}});return k.useEffect(()=>{f||b(a)},[f]),j(o),e.jsx(r.Box,{...i,ref:o,className:ze.cx(f&&"isDragging"),children:g.current.map((m,l)=>e.jsx(et,{type:u,disabled:t,id:m,index:l,itemIndex:c=>g.current.indexOf(c),move:p,children:c=>{const h=s[m];return h?n(h.data,l,c):null}},m))})}function et({disabled:t,id:s,index:n,type:i,children:o,itemIndex:u,move:d}){const a=k.useRef(),[{isDragging:g},b,p]=Z.useDrag({type:i,item:()=>({id:s}),canDrag:()=>!t,collect:j=>({isDragging:j.isDragging()})}),[,f]=Z.useDrop({accept:i,canDrop:()=>!t,hover(j,m){var I;if(!a.current)return;const l=u(j.id),c=n;if(l===c)return;const h=(I=a.current)==null?void 0:I.getBoundingClientRect(),v=(h.bottom-h.top)/2,x=m.getClientOffset().y-h.top;l<c&&x<v||l>c&&x>v||d({id:j.id,index:l},{id:s,index:n})}});return typeof o=="function"?o({isDragging:g,drag:b,drop:j=>(a.current=j,f(j)),preview:p}):(b(f(p(a))),e.jsx(r.Box,{ref:a,children:o}))}function tt({drop:t,preview:s,drag:n,disabled:i,isDragging:o,children:u,onDelete:d,actions:a}){const{t:g}=O.useLocaleContext();return e.jsx(r.Box,{ref:t,sx:{":hover .hover-visible":{maxHeight:"100%"}},children:e.jsxs(r.Box,{sx:{position:"relative"},children:[e.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:1,bgcolor:o?"action.hover":"background.paper",opacity:.9999},children:u}),!i&&e.jsx(r.Box,{className:"hover-visible",sx:{maxHeight:0,overflow:"hidden",position:"absolute",right:2,top:2},children:e.jsxs(r.Stack,{direction:"row",sx:{bgcolor:b=>r.alpha(b.palette.grey[300],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[a,d&&e.jsx(r.Tooltip,{title:g("delete"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:d,children:e.jsx(_.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),e.jsx(r.Tooltip,{title:g("dragSort"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{ref:n,children:e.jsx(_.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function rt({label:t,value:s,onChange:n}){const[i,o]=k.useState(!1);return e.jsxs(r.Stack,{gap:1,children:[e.jsx(r.TextField,{label:t,size:"small",value:s,onChange:u=>n==null?void 0:n(u.target.value),InputProps:{endAdornment:e.jsx(re,{onChange:({response:u})=>{var a;const d=(a=u==null?void 0:u.data)==null?void 0:a.filename;d&&(n==null||n(d))}})}}),s&&e.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:C.getImageAbsoluteUrl(s),alt:t,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>o(!0)}),e.jsx(r.Dialog,{open:i,onClose:()=>o(!1),children:e.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:C.getImageAbsoluteUrl(s),alt:t})})]})}function st({componentId:t}){const{state:{components:s}}=C.useStore(),n=s[t],i=n==null?void 0:n.data;return i?e.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:e.jsx(r.Box,{p:2,children:e.jsx(_e.ErrorBoundary,{FallbackComponent:C.ErrorView,resetKeys:[t],children:e.jsx(it,{value:i})})})}):null}function it({value:t}){var d,a,g;const{t:s}=O.useLocaleContext(),{localState:{currentLocale:n},state:{config:{defaultLocale:i}}}=C.useStore(),o=K.getYjsValue(t).doc,u=C.useAllComponents();return e.jsx(r.Stack,{height:"100%",children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(ye,{config:t}),e.jsx(Ie,{config:t,currentLocale:n,defaultLocale:i,allComponents:u,onUpdateConfig:b=>{o.transact(()=>{b(t)})}}),e.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("renderer")}),e.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((d=t.renderer)==null?void 0:d.type)||"react-component",onChange:b=>{o.transact(()=>{const p=b.target.value;t.renderer??(t.renderer={type:p}),t.renderer.type=p})},children:[e.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),e.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((a=t.renderer)==null?void 0:a.type)==="component"?e.jsx(at,{value:t}):((g=t.renderer)==null?void 0:g.type)==="react-component"?e.jsx(ct,{value:t}):null]})})}function ye({config:t}){const{t:s}=O.useLocaleContext();return e.jsx(ve,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),e.jsx(r.TextField,{label:s("name"),size:"small",value:t.name||"",onChange:n=>t.name=n.target.value}),e.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:t.description||"",onChange:n=>t.description=n.target.value}),e.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:t.tags??[],onChange:(n,i)=>t.tags=i,renderInput:n=>e.jsx(r.TextField,{label:s("tags"),...n})}),e.jsx(rt,{label:s("previewImage"),value:t.previewImage||"",onChange:n=>t.previewImage=n})]})})}function Ie({config:t,currentLocale:s,defaultLocale:n,allComponents:i,onUpdateConfig:o,useI18nEditor:u=!0}){var p,f,j,m,l,c,h,v,y;const{t:d}=O.useLocaleContext(),a=z.usePopupState({variant:"dialog"}),g=t.properties&&q.sortBy(Object.values(t.properties),"index"),b=k.useCallback(x=>{o(I=>{var w,R,P;I.properties??(I.properties={}),(w=I.properties).customSettings??(w.customSettings={index:0,data:{id:"customSettings",key:"customSettings",type:"custom-settings",locales:{[s]:{defaultValue:{}}}}}),(R=I.properties.customSettings.data).locales??(R.locales={}),(P=I.properties.customSettings.data.locales)[s]??(P[s]={}),I.properties.customSettings.data.locales[s].defaultValue=x})},[s,o]);return e.jsx(ve,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[e.jsx(r.Typography,{variant:"subtitle1",children:d("properties")}),e.jsx(r.Box,{flex:1}),e.jsx(r.Button,{onClick:()=>{o(x=>{var w;const I=C.nextId();x.properties??(x.properties={}),(w=x.properties)[I]??(w[I]={index:(g==null?void 0:g.length)||0,data:{id:I}})})},startIcon:e.jsx(_.AddRounded,{}),children:d("addObject",{object:d("property")})}),u&&e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...z.bindTrigger(a),children:e.jsx(_.TranslateRounded,{fontSize:"small"})})]}),t.properties&&e.jsx(Le,{component:r.Stack,gap:2,list:t.properties,renderItem:(x,I,w)=>{var R,P,A,E,W,N;return x.type==="custom-settings"?null:e.jsxs(r.Stack,{gap:1,bgcolor:"background.paper",children:[e.jsx(tt,{preview:w.preview,drop:w.drop,drag:w.drag,isDragging:w.isDragging,onDelete:()=>{o(B=>{if(B.properties){const S=Object.entries(B.properties).sort(([,V],[,U])=>V.index-U.index);delete B.properties[x.id],S.filter(([V])=>V!==x.id).forEach(([,V],U)=>{V.index=U})}})},children:e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(r.TextField,{label:d("key"),size:"small",sx:{flex:1},value:x.key||"",onChange:B=>{o(F=>{const S=F.properties[x.id].data;S.key=B.target.value.trim()})}}),e.jsx(r.TextField,{label:d("label"),size:"small",sx:{flex:1},value:(((P=(R=x.locales)==null?void 0:R[s])==null?void 0:P.name)??((E=(A=x.locales)==null?void 0:A[n])==null?void 0:E.name))||"",onChange:B=>{o(F=>{var T;const S=F.properties[x.id].data;S.locales??(S.locales={}),(T=S.locales)[s]??(T[s]={}),S.locales[s].name=B.target.value})}}),e.jsxs(r.TextField,{label:d("type"),size:"small",select:!0,sx:{flex:1},value:x.type==="string"&&x.multiline?"multiline":x.type||"string",onChange:B=>{o(F=>{const S=F.properties[x.id].data;if(S.locales)for(const V of Object.keys(S.locales))S.locales[V].defaultValue=void 0;const T=B.target.value;T==="multiline"?(S.type="string",S.multiline=!0):(typeof S.multiline<"u"&&delete S.multiline,S.type=T)})},children:[e.jsx(r.MenuItem,{value:"string",children:"Text"}),e.jsx(r.MenuItem,{value:"multiline",children:"Text (Multiline)"}),e.jsx(r.MenuItem,{value:"number",children:"Number"}),e.jsx(r.MenuItem,{value:"decimal",children:"Decimal"}),e.jsx(r.MenuItem,{value:"boolean",children:"Boolean"}),e.jsx(r.MenuItem,{value:"color",children:"Color"}),e.jsx(r.MenuItem,{value:"url",children:"URL (Upload)"}),e.jsx(r.MenuItem,{value:"json",children:"JSON"}),e.jsx(r.MenuItem,{value:"yaml",children:"YAML"}),e.jsx(r.MenuItem,{value:"component",children:"Component"}),e.jsx(r.MenuItem,{value:"custom",children:"Custom (Render by a Component)"})]})]})}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(Y,{allComponents:i,defaultLocale:n,component:t,property:x,label:d("defaultValue"),size:"small",fullWidth:!0,value:(N=(W=x.locales)==null?void 0:W[s])==null?void 0:N.defaultValue,onChange:B=>{o(F=>{var T;const S=F.properties[x.id].data;S.locales??(S.locales={}),(T=S.locales)[s]??(T[s]={}),S.locales[s].defaultValue=B})}}),x.type==="custom"?e.jsx(r.Box,{children:e.jsx(nt,{property:x,allComponents:i})}):null]})]},x.id)}}),((p=i==null?void 0:i[t.id])==null?void 0:p.data)&&e.jsx(r.Box,{sx:{width:"100%"},children:e.jsx(fe.CustomComponentRenderer,{componentId:t.id,renderType:"setting",locale:s,properties:{},dev:{mode:"draft",components:i,defaultLocale:n},props:{value:((l=(m=(j=(f=t.properties)==null?void 0:f.customSettings)==null?void 0:j.data.locales)==null?void 0:m[s])==null?void 0:l.defaultValue)??((y=(v=(h=(c=t.properties)==null?void 0:c.customSettings)==null?void 0:h.data.locales)==null?void 0:v[n])==null?void 0:y.defaultValue)??null,onChange:b}})}),u&&e.jsx(Se,{...z.bindDialog(a),component:t})]})})}function nt({property:t,allComponents:s}){const n=z.usePopupState({variant:"popper"});return e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},...z.bindTrigger(n),children:e.jsx(_.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...z.bindPopper(n),children:e.jsx(te.ClickAwayListener,{onClickAway:n.close,children:e.jsx(r.Paper,{children:e.jsx(r.Box,{width:500,p:2,children:e.jsx(Q,{value:t.componentId,onChange:(i,o)=>t.componentId=o,allComponents:s})})})})})]})}function ot({value:t,valueImmutable:s,onChange:n,defaultLocale:i,allComponents:o}){var g;const u=z.usePopupState({variant:"popper"}),{locale:d}=O.useLocaleContext(),a=typeof(t==null?void 0:t.componentId)=="string"?(g=o[t.componentId])==null?void 0:g.data:void 0;return a?e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},disabled:!a,...z.bindTrigger(u),children:e.jsx(_.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...z.bindPopper(u),sx:{zIndex:1e3},children:e.jsx(te.ClickAwayListener,{onClickAway:u.close,children:e.jsx(r.Paper,{children:e.jsxs(r.Box,{width:500,p:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:"Parameters"}),e.jsx(r.Stack,{gap:1,children:(a==null?void 0:a.properties)&&q.sortBy(Object.values(a.properties),"index").map(({data:b})=>{var p,f,j,m,l,c,h,v;return e.jsx(r.Box,{children:e.jsx(Y,{allComponents:o,defaultLocale:i,size:"small",fullWidth:!0,component:a,property:b,valueImmutable:q.isNil((f=(p=t.properties)==null?void 0:p[b.id])==null?void 0:f.value),value:((m=(j=t.properties)==null?void 0:j[b.id])==null?void 0:m.value)??((c=(l=b.locales)==null?void 0:l[d])==null?void 0:c.defaultValue)??((v=(h=b.locales)==null?void 0:h[i])==null?void 0:v.defaultValue),onChange:y=>{if(s){const x=JSON.parse(JSON.stringify(t));n==null||n({...x,properties:{...x.properties,[b.id]:{value:y}}})}else K.getYjsValue(a).doc.transact(()=>{t.properties??(t.properties={}),t.properties[b.id]={value:y}})}})},b.id)})})]})})})})]}):null}function Se({type:t="properties",component:s,...n}){var f,j,m;const{t:i}=O.useLocaleContext(),{state:{components:o,supportedLocales:u,config:{defaultLocale:d}}}=C.useStore(),a=C.useAllComponents(),g=K.getYjsValue(s).doc,b=t==="properties"?s.properties:t==="parameters"&&((f=s.renderer)==null?void 0:f.type)==="component"?(j=o[s.renderer.componentId])==null?void 0:j.data.properties:void 0,p=((m=s.renderer)==null?void 0:m.type)==="component"?s:void 0;return e.jsxs(r.Dialog,{...n,fullWidth:!0,maxWidth:"lg",children:[e.jsx(r.DialogTitle,{children:i("i18nEditorTitle")}),e.jsx(r.DialogContent,{children:b&&e.jsx(r.Stack,{children:e.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[e.jsx(r.TableHead,{children:e.jsx(r.TableRow,{children:u.map(({locale:l,name:c})=>e.jsxs(r.TableCell,{children:[c,d===l&&e.jsx(_.StarRounded,{sx:{fontSize:12,color:"text.secondary"}})]},l))})}),e.jsx(r.TableBody,{children:q.sortBy(Object.values(b),"index").map(({data:l})=>e.jsx(r.TableRow,{children:u.map(({locale:c})=>{var h,v,y,x,I,w,R,P,A,E,W,N,B,F,S,T,V,U,G,J,se,ie,ne,oe,le,ce;return e.jsx(r.TableCell,{children:e.jsx(r.Stack,{gap:1,children:t==="properties"?e.jsxs(e.Fragment,{children:[e.jsx(r.TextField,{size:"small",label:"Key",value:l.key||"",onChange:M=>{g.transact(()=>{l.key=M.target.value.trim()})}}),e.jsx(r.TextField,{size:"small",label:i("label"),value:(((v=(h=l.locales)==null?void 0:h[c])==null?void 0:v.name)??((x=(y=l.locales)==null?void 0:y[d])==null?void 0:x.name))||"",onChange:M=>{g.transact(()=>{var H;l.locales??(l.locales={}),(H=l.locales)[c]??(H[c]={}),l.locales[c].name=M.target.value})}}),e.jsx(r.Box,{children:e.jsx(Y,{allComponents:a,defaultLocale:d,component:s,property:l,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:q.isNil((w=(I=l.locales)==null?void 0:I[c])==null?void 0:w.defaultValue),value:((P=(R=l.locales)==null?void 0:R[c])==null?void 0:P.defaultValue)??((E=(A=l.locales)==null?void 0:A[d])==null?void 0:E.defaultValue),onChange:M=>{g.transact(()=>{var H;l.locales??(l.locales={}),(H=l.locales)[c]??(H[c]={}),l.locales[c].defaultValue=M})}})})]}):t==="parameters"&&p?e.jsx(r.Box,{children:e.jsx(Y,{allComponents:a,defaultLocale:d,component:s,property:l,size:"small",fullWidth:!0,valueImmutable:q.isNil((F=(B=(N=(W=p.renderer.properties)==null?void 0:W[l.id])==null?void 0:N.locales)==null?void 0:B[c])==null?void 0:F.value),value:((U=(V=(T=(S=p.renderer.properties)==null?void 0:S[l.id])==null?void 0:T.locales)==null?void 0:V[c])==null?void 0:U.value)??((ie=(se=(J=(G=p.renderer.properties)==null?void 0:G[l.id])==null?void 0:J.locales)==null?void 0:se[d])==null?void 0:ie.value)??((oe=(ne=l.locales)==null?void 0:ne[c])==null?void 0:oe.defaultValue)??((ce=(le=l.locales)==null?void 0:le[d])==null?void 0:ce.defaultValue),onChange:M=>{g.transact(()=>{var H,ae,ue,de,pe;(H=p.renderer).properties??(H.properties={}),(ae=p.renderer.properties)[ue=l.id]??(ae[ue]={}),(de=p.renderer.properties[l.id]).locales??(de.locales={}),(pe=p.renderer.properties[l.id].locales)[c]??(pe[c]={}),p.renderer.properties[l.id].locales[c].value=M})}})}):null},l.id)},c)})},l.id))})]})})}),e.jsx(r.DialogActions,{children:e.jsx(r.Button,{onClick:l=>{var c;return(c=n.onClose)==null?void 0:c.call(n,l,"escapeKeyDown")},children:i("close")})})]})}function Y({component:t,property:s,value:n,onChange:i,valueImmutable:o,defaultLocale:u,allComponents:d,...a}){var f,j,m,l,c;const{locale:g}=O.useLocaleContext(),b=k.useRef(null),p=a.label||((j=(f=s.locales)==null?void 0:f[g])==null?void 0:j.name)||((l=(m=s.locales)==null?void 0:m[u])==null?void 0:l.name)||s.key||s.id;if(s.type==="number")return e.jsx(lt,{...a,label:p,NumberProps:{value:["number","string"].includes(typeof n)?n:null,onChange:(h,v)=>i==null?void 0:i(v)}});if(s.type==="custom-settings")return null;if(s.type==="decimal")return e.jsx(r.TextField,{...a,label:p,type:"text",value:n??"",onChange:h=>{const v=h.target.value;if(v===""||v==="-"){i==null||i(v);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(v)){let x=v;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(x)&&(x=Number(x)),i==null||i(x)}}});if(s.type==="boolean")return e.jsx(r.FormControlLabel,{label:p,labelPlacement:"start",control:e.jsx(r.Switch,{checked:n===!0,onChange:(h,v)=>i==null?void 0:i(v)})});if(s.type==="color")return e.jsx(Ze,{label:p,value:n,onChange:h=>{i==null||i(h)}});if(s.type==="json"||s.type==="yaml")return e.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[e.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:p}),e.jsx(ge.CodeEditor,{keyId:s.id,locale:g,language:s.type==="yaml"?"yaml":"json",value:typeof n=="string"?n:"",onChange:h=>i==null?void 0:i(h),onUpload:h=>{b.current=h}},s.id),e.jsx(r.Box,{component:"fieldset",sx:{pointerEvents:"none",position:"absolute",left:0,top:-5,width:"100%",height:"100%",border:1,borderColor:"rgba(0, 0, 0, 0.23)",borderRadius:1,px:1,py:0},children:e.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:e.jsx(r.Box,{component:"span",sx:{opacity:0},children:a.label})})})]});if(s.type==="custom"){const h=(c=d[s.componentId])==null?void 0:c.data;return h?e.jsx(r.Box,{width:"100%",children:e.jsx(fe.CustomComponentRenderer,{componentId:h.id,props:{label:p,value:n,onChange:i},locale:g,dev:{mode:"draft",components:d,defaultLocale:u}})}):e.jsx(r.TextField,{...a,label:p,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return e.jsxs(r.Stack,{width:"100%",direction:"row",gap:1,children:[e.jsx(r.Box,{flex:1,children:e.jsx(Q,{allComponents:d,label:p,value:n==null?void 0:n.componentId,onChange:(h,v)=>{o||!n?i==null||i({...n&&JSON.parse(JSON.stringify(n)),componentId:v}):typeof n=="object"&&(n.componentId=v)}})}),e.jsx(r.Box,{children:e.jsx(ot,{value:n,valueImmutable:o,onChange:i,defaultLocale:u,allComponents:d})})]});if(!s.type||["string","url"].includes(s.type)){const h=s.type==="string"?s.multiline:void 0,v=s.type==="url"?n==null?void 0:n.url:n;return e.jsx(r.TextField,{...a,label:p,value:typeof v=="string"?v:"",multiline:h,minRows:h?2:void 0,maxRows:h?10:void 0,onChange:y=>i==null?void 0:i(s.type==="url"?{...n,url:y.target.value,mediaKitUrl:y.target.value}:y.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:e.jsxs(r.InputAdornment,{position:"end",children:[e.jsx(re,{onChange:async({response:y})=>{var R,P,A;const x=((R=y==null?void 0:y.data)==null?void 0:R.url)||((P=y==null?void 0:y.data)==null?void 0:P.fileUrl);let I;x&&(I=await ee(x).catch(()=>L(x)).catch(()=>{}));let w=((A=y==null?void 0:y.data)==null?void 0:A.filename)||"";w&&(w=`mediakit://${w}`),i==null||i({url:x,mediaKitUrl:w,width:I==null?void 0:I.naturalWidth,height:I==null?void 0:I.naturalHeight})}}),e.jsx(r.Tooltip,{title:"If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.",children:e.jsx(_.InfoRounded,{sx:{cursor:"default"},fontSize:"small"})})]})}:void 0})}return console.error("Unsupported property type",s.type),null}function lt({NumberProps:t,...s}){const{getInputProps:n}=te.unstable_useNumberInput(t),i=n();return e.jsx(r.TextField,{...s,inputProps:i})}const ke=`import React from '@blocklet/pages-kit/builtin/react'
|
|
21
|
+
`;function He({value:t,onChange:s,...l}){const i=k.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{...l,value:t,onChange:s,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(Me,{color:t??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var o;(o=i.current)==null||o.open({value:t??""})}})})}}),e.jsx(Ue,{ref:i,onSave:({value:o},d)=>{s(o),d()}})]})}function Ye({disabled:t,list:s,renderItem:l,...i}){const o=k.useRef(null),d=k.useId(),u=Z.useUpdate(),a=_e.default(Object.entries(s),m=>m[1].index).map(m=>m[0]),g=k.useRef(a),b=k.useCallback(m=>{g.current=m,u()},[u]),p=k.useCallback(({index:m},{index:n})=>{const c=[...g.current];c.splice(n,0,...c.splice(m,1)),b(c)},[b]);k.useEffect(()=>{b(a)},[a.join("-")]);const[{isOver:f},j]=L.useDrop({accept:d,collect:m=>({isOver:m.isOver()}),canDrop:()=>!t,drop:()=>{var c;const m=()=>{g.current.forEach((h,v)=>{const y=s[h];y&&(y.index=v)})},n=(c=G.getYjsValue(s))==null?void 0:c.doc;n?n.transact(()=>{m()}):m()}});return k.useEffect(()=>{f||b(a)},[f]),j(o),e.jsx(r.Box,{...i,ref:o,className:Re.cx(f&&"isDragging"),children:g.current.map((m,n)=>e.jsx(Ke,{type:d,disabled:t,id:m,index:n,itemIndex:c=>g.current.indexOf(c),move:p,children:c=>{const h=s[m];return h?l(h.data,n,c):null}},m))})}function Ke({disabled:t,id:s,index:l,type:i,children:o,itemIndex:d,move:u}){const a=k.useRef(),[{isDragging:g},b,p]=L.useDrag({type:i,item:()=>({id:s}),canDrag:()=>!t,collect:j=>({isDragging:j.isDragging()})}),[,f]=L.useDrop({accept:i,canDrop:()=>!t,hover(j,m){var S;if(!a.current)return;const n=d(j.id),c=l;if(n===c)return;const h=(S=a.current)==null?void 0:S.getBoundingClientRect(),v=(h.bottom-h.top)/2,x=m.getClientOffset().y-h.top;n<c&&x<v||n>c&&x>v||u({id:j.id,index:n},{id:s,index:l})}});return typeof o=="function"?o({isDragging:g,drag:b,drop:j=>(a.current=j,f(j)),preview:p}):(b(f(p(a))),e.jsx(r.Box,{ref:a,children:o}))}function Ge({drop:t,preview:s,drag:l,disabled:i,isDragging:o,children:d,onDelete:u,actions:a}){const{t:g}=q.useLocaleContext();return e.jsx(r.Box,{ref:t,sx:{":hover .hover-visible":{maxHeight:"100%"}},children:e.jsxs(r.Box,{sx:{position:"relative"},children:[e.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:1,bgcolor:o?"action.hover":"background.paper",opacity:.9999},children:d}),!i&&e.jsx(r.Box,{className:"hover-visible",sx:{maxHeight:0,overflow:"hidden",position:"absolute",right:2,top:2},children:e.jsxs(r.Stack,{direction:"row",sx:{bgcolor:b=>r.alpha(b.palette.grey[300],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[a,u&&e.jsx(r.Tooltip,{title:g("delete"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:u,children:e.jsx(N.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),e.jsx(r.Tooltip,{title:g("dragSort"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{ref:l,children:e.jsx(N.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function Je({label:t,value:s,onChange:l}){const[i,o]=k.useState(!1);return e.jsxs(r.Stack,{gap:1,children:[e.jsx(r.TextField,{label:t,size:"small",value:s,onChange:d=>l==null?void 0:l(d.target.value),InputProps:{endAdornment:e.jsx(O.UploaderButton,{onChange:({response:d})=>{var a;const u=(a=d==null?void 0:d.data)==null?void 0:a.filename;u&&(l==null||l(u))}})}}),s&&e.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:C.getImageAbsoluteUrl(s),alt:t,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>o(!0)}),e.jsx(r.Dialog,{open:i,onClose:()=>o(!1),children:e.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:C.getImageAbsoluteUrl(s),alt:t})})]})}function $e({componentId:t}){const{state:{components:s}}=C.useStore(),l=s[t],i=l==null?void 0:l.data;return i?e.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:e.jsx(r.Box,{p:2,children:e.jsx(Ae.ErrorBoundary,{FallbackComponent:C.ErrorView,resetKeys:[t],children:e.jsx(Qe,{value:i})})})}):null}function Qe({value:t}){var u,a,g;const{t:s}=q.useLocaleContext(),{localState:{currentLocale:l},state:{config:{defaultLocale:i}}}=C.useStore(),o=G.getYjsValue(t).doc,d=C.useAllComponents();return e.jsx(r.Stack,{height:"100%",children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(he,{config:t}),e.jsx(ge,{config:t,currentLocale:l,defaultLocale:i,allComponents:d,onUpdateConfig:b=>{o.transact(()=>{b(t)})}}),e.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("renderer")}),e.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((u=t.renderer)==null?void 0:u.type)||"react-component",onChange:b=>{o.transact(()=>{const p=b.target.value;t.renderer??(t.renderer={type:p}),t.renderer.type=p})},children:[e.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),e.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((a=t.renderer)==null?void 0:a.type)==="component"?e.jsx(tt,{value:t}):((g=t.renderer)==null?void 0:g.type)==="react-component"?e.jsx(et,{value:t}):null]})})}function he({config:t}){const{t:s}=q.useLocaleContext();return e.jsx(O.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),e.jsx(r.TextField,{label:s("name"),size:"small",value:t.name||"",onChange:l=>t.name=l.target.value}),e.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:t.description||"",onChange:l=>t.description=l.target.value}),e.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:t.tags??[],onChange:(l,i)=>t.tags=i,renderInput:l=>e.jsx(r.TextField,{label:s("tags"),...l})}),e.jsx(Je,{label:s("previewImage"),value:t.previewImage||"",onChange:l=>t.previewImage=l})]})})}function ge({config:t,currentLocale:s,defaultLocale:l,allComponents:i,onUpdateConfig:o,useI18nEditor:d=!0}){var p,f,j,m,n,c,h,v,y;const{t:u}=q.useLocaleContext(),a=A.usePopupState({variant:"dialog"}),g=t.properties&&_.sortBy(Object.values(t.properties),"index"),b=k.useCallback(x=>{o(S=>{var B,R,P;S.properties??(S.properties={}),(B=S.properties).customSettings??(B.customSettings={index:0,data:{id:"customSettings",key:"customSettings",type:"custom-settings",locales:{[s]:{defaultValue:{}}}}}),(R=S.properties.customSettings.data).locales??(R.locales={}),(P=S.properties.customSettings.data.locales)[s]??(P[s]={}),S.properties.customSettings.data.locales[s].defaultValue=x})},[s,o]);return e.jsx(O.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[e.jsx(r.Typography,{variant:"subtitle1",children:u("properties")}),e.jsx(r.Box,{flex:1}),e.jsx(r.Button,{onClick:()=>{o(x=>{var B;const S=C.nextId();x.properties??(x.properties={}),(B=x.properties)[S]??(B[S]={index:(g==null?void 0:g.length)||0,data:{id:S}})})},startIcon:e.jsx(N.AddRounded,{}),children:u("addObject",{object:u("property")})}),d&&e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...A.bindTrigger(a),children:e.jsx(N.TranslateRounded,{fontSize:"small"})})]}),t.properties&&e.jsx(Ye,{component:r.Stack,gap:2,list:t.properties,renderItem:(x,S,B)=>{var R,P,F,W,M,U;return x.type==="custom-settings"?null:e.jsxs(r.Stack,{gap:1,bgcolor:"background.paper",children:[e.jsx(Ge,{preview:B.preview,drop:B.drop,drag:B.drag,isDragging:B.isDragging,onDelete:()=>{o(w=>{if(w.properties){const I=Object.entries(w.properties).sort(([,z],[,E])=>z.index-E.index);delete w.properties[x.id],I.filter(([z])=>z!==x.id).forEach(([,z],E)=>{z.index=E})}})},children:e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(r.TextField,{label:u("key"),size:"small",sx:{flex:1},value:x.key||"",onChange:w=>{o(V=>{const I=V.properties[x.id].data;I.key=w.target.value.trim()})}}),e.jsx(r.TextField,{label:u("label"),size:"small",sx:{flex:1},value:(((P=(R=x.locales)==null?void 0:R[s])==null?void 0:P.name)??((W=(F=x.locales)==null?void 0:F[l])==null?void 0:W.name))||"",onChange:w=>{o(V=>{var T;const I=V.properties[x.id].data;I.locales??(I.locales={}),(T=I.locales)[s]??(T[s]={}),I.locales[s].name=w.target.value})}}),e.jsxs(r.TextField,{label:u("type"),size:"small",select:!0,sx:{flex:1},value:x.type==="string"&&x.multiline?"multiline":x.type||"string",onChange:w=>{o(V=>{const I=V.properties[x.id].data;if(I.locales)for(const z of Object.keys(I.locales))I.locales[z].defaultValue=void 0;const T=w.target.value;T==="multiline"?(I.type="string",I.multiline=!0):(typeof I.multiline<"u"&&delete I.multiline,I.type=T)})},children:[e.jsx(r.MenuItem,{value:"string",children:"Text"}),e.jsx(r.MenuItem,{value:"multiline",children:"Text (Multiline)"}),e.jsx(r.MenuItem,{value:"number",children:"Number"}),e.jsx(r.MenuItem,{value:"decimal",children:"Decimal"}),e.jsx(r.MenuItem,{value:"boolean",children:"Boolean"}),e.jsx(r.MenuItem,{value:"color",children:"Color"}),e.jsx(r.MenuItem,{value:"url",children:"URL (Upload)"}),e.jsx(r.MenuItem,{value:"json",children:"JSON"}),e.jsx(r.MenuItem,{value:"yaml",children:"YAML"}),e.jsx(r.MenuItem,{value:"component",children:"Component"}),e.jsx(r.MenuItem,{value:"custom",children:"Custom (Render by a Component)"})]})]})}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(K,{allComponents:i,defaultLocale:l,component:t,property:x,label:u("defaultValue"),size:"small",fullWidth:!0,value:(U=(M=x.locales)==null?void 0:M[s])==null?void 0:U.defaultValue,onChange:w=>{o(V=>{var T;const I=V.properties[x.id].data;I.locales??(I.locales={}),(T=I.locales)[s]??(T[s]={}),I.locales[s].defaultValue=w})}}),x.type==="custom"?e.jsx(r.Box,{children:e.jsx(Xe,{property:x,allComponents:i})}):null]})]},x.id)}}),((p=i==null?void 0:i[t.id])==null?void 0:p.data)&&e.jsx(r.Box,{sx:{width:"100%"},children:e.jsx(je.CustomComponentRenderer,{componentId:t.id,renderType:"setting",locale:s,properties:{},dev:{mode:"draft",components:i,defaultLocale:l},props:{value:((n=(m=(j=(f=t.properties)==null?void 0:f.customSettings)==null?void 0:j.data.locales)==null?void 0:m[s])==null?void 0:n.defaultValue)??((y=(v=(h=(c=t.properties)==null?void 0:c.customSettings)==null?void 0:h.data.locales)==null?void 0:v[l])==null?void 0:y.defaultValue)??null,onChange:b}})}),d&&e.jsx(fe,{...A.bindDialog(a),component:t})]})})}function Xe({property:t,allComponents:s}){const l=A.usePopupState({variant:"popper"});return e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},...A.bindTrigger(l),children:e.jsx(N.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...A.bindPopper(l),children:e.jsx(ee.ClickAwayListener,{onClickAway:l.close,children:e.jsx(r.Paper,{children:e.jsx(r.Box,{width:500,p:2,children:e.jsx(X,{value:t.componentId,onChange:(i,o)=>t.componentId=o,allComponents:s})})})})})]})}function Ze({value:t,valueImmutable:s,onChange:l,defaultLocale:i,allComponents:o}){var g;const d=A.usePopupState({variant:"popper"}),{locale:u}=q.useLocaleContext(),a=typeof(t==null?void 0:t.componentId)=="string"?(g=o[t.componentId])==null?void 0:g.data:void 0;return a?e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},disabled:!a,...A.bindTrigger(d),children:e.jsx(N.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...A.bindPopper(d),sx:{zIndex:1e3},children:e.jsx(ee.ClickAwayListener,{onClickAway:d.close,children:e.jsx(r.Paper,{children:e.jsxs(r.Box,{width:500,p:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:"Parameters"}),e.jsx(r.Stack,{gap:1,children:(a==null?void 0:a.properties)&&_.sortBy(Object.values(a.properties),"index").map(({data:b})=>{var p,f,j,m,n,c,h,v;return e.jsx(r.Box,{children:e.jsx(K,{allComponents:o,defaultLocale:i,size:"small",fullWidth:!0,component:a,property:b,valueImmutable:_.isNil((f=(p=t.properties)==null?void 0:p[b.id])==null?void 0:f.value),value:((m=(j=t.properties)==null?void 0:j[b.id])==null?void 0:m.value)??((c=(n=b.locales)==null?void 0:n[u])==null?void 0:c.defaultValue)??((v=(h=b.locales)==null?void 0:h[i])==null?void 0:v.defaultValue),onChange:y=>{if(s){const x=JSON.parse(JSON.stringify(t));l==null||l({...x,properties:{...x.properties,[b.id]:{value:y}}})}else G.getYjsValue(a).doc.transact(()=>{t.properties??(t.properties={}),t.properties[b.id]={value:y}})}})},b.id)})})]})})})})]}):null}function fe({type:t="properties",component:s,...l}){var f,j,m;const{t:i}=q.useLocaleContext(),{state:{components:o,supportedLocales:d,config:{defaultLocale:u}}}=C.useStore(),a=C.useAllComponents(),g=G.getYjsValue(s).doc,b=t==="properties"?s.properties:t==="parameters"&&((f=s.renderer)==null?void 0:f.type)==="component"?(j=o[s.renderer.componentId])==null?void 0:j.data.properties:void 0,p=((m=s.renderer)==null?void 0:m.type)==="component"?s:void 0;return e.jsxs(r.Dialog,{...l,fullWidth:!0,maxWidth:"lg",children:[e.jsx(r.DialogTitle,{children:i("i18nEditorTitle")}),e.jsx(r.DialogContent,{children:b&&e.jsx(r.Stack,{children:e.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[e.jsx(r.TableHead,{children:e.jsx(r.TableRow,{children:d.map(({locale:n,name:c})=>e.jsxs(r.TableCell,{children:[c,u===n&&e.jsx(N.StarRounded,{sx:{fontSize:12,color:"text.secondary"}})]},n))})}),e.jsx(r.TableBody,{children:_.sortBy(Object.values(b),"index").map(({data:n})=>e.jsx(r.TableRow,{children:d.map(({locale:c})=>{var h,v,y,x,S,B,R,P,F,W,M,U,w,V,I,T,z,E,J,$,te,re,se,ie,le,ne;return e.jsx(r.TableCell,{children:e.jsx(r.Stack,{gap:1,children:t==="properties"?e.jsxs(e.Fragment,{children:[e.jsx(r.TextField,{size:"small",label:"Key",value:n.key||"",onChange:Y=>{g.transact(()=>{n.key=Y.target.value.trim()})}}),e.jsx(r.TextField,{size:"small",label:i("label"),value:(((v=(h=n.locales)==null?void 0:h[c])==null?void 0:v.name)??((x=(y=n.locales)==null?void 0:y[u])==null?void 0:x.name))||"",onChange:Y=>{g.transact(()=>{var H;n.locales??(n.locales={}),(H=n.locales)[c]??(H[c]={}),n.locales[c].name=Y.target.value})}}),e.jsx(r.Box,{children:e.jsx(K,{allComponents:a,defaultLocale:u,component:s,property:n,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:_.isNil((B=(S=n.locales)==null?void 0:S[c])==null?void 0:B.defaultValue),value:((P=(R=n.locales)==null?void 0:R[c])==null?void 0:P.defaultValue)??((W=(F=n.locales)==null?void 0:F[u])==null?void 0:W.defaultValue),onChange:Y=>{g.transact(()=>{var H;n.locales??(n.locales={}),(H=n.locales)[c]??(H[c]={}),n.locales[c].defaultValue=Y})}})})]}):t==="parameters"&&p?e.jsx(r.Box,{children:e.jsx(K,{allComponents:a,defaultLocale:u,component:s,property:n,size:"small",fullWidth:!0,valueImmutable:_.isNil((V=(w=(U=(M=p.renderer.properties)==null?void 0:M[n.id])==null?void 0:U.locales)==null?void 0:w[c])==null?void 0:V.value),value:((E=(z=(T=(I=p.renderer.properties)==null?void 0:I[n.id])==null?void 0:T.locales)==null?void 0:z[c])==null?void 0:E.value)??((re=(te=($=(J=p.renderer.properties)==null?void 0:J[n.id])==null?void 0:$.locales)==null?void 0:te[u])==null?void 0:re.value)??((ie=(se=n.locales)==null?void 0:se[c])==null?void 0:ie.defaultValue)??((ne=(le=n.locales)==null?void 0:le[u])==null?void 0:ne.defaultValue),onChange:Y=>{g.transact(()=>{var H,oe,ce,ae,ue;(H=p.renderer).properties??(H.properties={}),(oe=p.renderer.properties)[ce=n.id]??(oe[ce]={}),(ae=p.renderer.properties[n.id]).locales??(ae.locales={}),(ue=p.renderer.properties[n.id].locales)[c]??(ue[c]={}),p.renderer.properties[n.id].locales[c].value=Y})}})}):null},n.id)},c)})},n.id))})]})})}),e.jsx(r.DialogActions,{children:e.jsx(r.Button,{onClick:n=>{var c;return(c=l.onClose)==null?void 0:c.call(l,n,"escapeKeyDown")},children:i("close")})})]})}function K({component:t,property:s,value:l,onChange:i,valueImmutable:o,defaultLocale:d,allComponents:u,...a}){var f,j,m,n,c;const{locale:g}=q.useLocaleContext(),b=k.useRef(null),p=a.label||((j=(f=s.locales)==null?void 0:f[g])==null?void 0:j.name)||((n=(m=s.locales)==null?void 0:m[d])==null?void 0:n.name)||s.key||s.id;if(s.type==="number")return e.jsx(Le,{...a,label:p,NumberProps:{value:["number","string"].includes(typeof l)?l:null,onChange:(h,v)=>i==null?void 0:i(v)}});if(s.type==="custom-settings")return null;if(s.type==="decimal")return e.jsx(r.TextField,{...a,label:p,type:"text",value:l??"",onChange:h=>{const v=h.target.value;if(v===""||v==="-"){i==null||i(v);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(v)){let x=v;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(x)&&(x=Number(x)),i==null||i(x)}}});if(s.type==="boolean")return e.jsx(r.FormControlLabel,{label:p,labelPlacement:"start",control:e.jsx(r.Switch,{checked:l===!0,onChange:(h,v)=>i==null?void 0:i(v)})});if(s.type==="color")return e.jsx(He,{label:p,value:l,onChange:h=>{i==null||i(h)}});if(s.type==="json"||s.type==="yaml")return e.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[e.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:p}),e.jsx(me.CodeEditor,{keyId:s.id,locale:g,language:s.type==="yaml"?"yaml":"json",value:typeof l=="string"?l:"",onChange:h=>i==null?void 0:i(h),onUpload:h=>{b.current=h}},s.id),e.jsx(r.Box,{component:"fieldset",sx:{pointerEvents:"none",position:"absolute",left:0,top:-5,width:"100%",height:"100%",border:1,borderColor:"rgba(0, 0, 0, 0.23)",borderRadius:1,px:1,py:0},children:e.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:e.jsx(r.Box,{component:"span",sx:{opacity:0},children:a.label})})})]});if(s.type==="custom"){const h=(c=u[s.componentId])==null?void 0:c.data;return h?e.jsx(r.Box,{width:"100%",children:e.jsx(je.CustomComponentRenderer,{componentId:h.id,props:{label:p,value:l,onChange:i},locale:g,dev:{mode:"draft",components:u,defaultLocale:d}})}):e.jsx(r.TextField,{...a,label:p,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return e.jsxs(r.Stack,{width:"100%",direction:"row",gap:1,children:[e.jsx(r.Box,{flex:1,children:e.jsx(X,{allComponents:u,label:p,value:l==null?void 0:l.componentId,onChange:(h,v)=>{o||!l?i==null||i({...l&&JSON.parse(JSON.stringify(l)),componentId:v}):typeof l=="object"&&(l.componentId=v)}})}),e.jsx(r.Box,{children:e.jsx(Ze,{value:l,valueImmutable:o,onChange:i,defaultLocale:d,allComponents:u})})]});if(!s.type||["string","url"].includes(s.type)){const h=s.type==="string"?s.multiline:void 0,v=s.type==="url"?l==null?void 0:l.url:l;return e.jsx(r.TextField,{...a,label:p,value:typeof v=="string"?v:"",multiline:h,minRows:h?2:void 0,maxRows:h?10:void 0,onChange:y=>i==null?void 0:i(s.type==="url"?{...l,url:y.target.value,mediaKitUrl:y.target.value}:y.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:e.jsxs(r.InputAdornment,{position:"end",children:[e.jsx(O.UploaderButton,{onChange:async({response:y})=>{var R,P,F;const x=((R=y==null?void 0:y.data)==null?void 0:R.url)||((P=y==null?void 0:y.data)==null?void 0:P.fileUrl);let S;x&&(S=await O.getImageSize(x).catch(()=>O.getVideoSize(x)).catch(()=>{}));let B=((F=y==null?void 0:y.data)==null?void 0:F.filename)||"";B&&(B=`mediakit://${B}`),i==null||i({url:x,mediaKitUrl:B,width:S==null?void 0:S.naturalWidth,height:S==null?void 0:S.naturalHeight})}}),e.jsx(r.Tooltip,{title:"If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.",children:e.jsx(N.InfoRounded,{sx:{cursor:"default"},fontSize:"small"})})]})}:void 0})}return console.error("Unsupported property type",s.type),null}function Le({NumberProps:t,...s}){const{getInputProps:l}=ee.unstable_useNumberInput(t),i=l();return e.jsx(r.TextField,{...s,inputProps:i})}const be=`import React from '@blocklet/pages-kit/builtin/react'
|
|
22
22
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
23
23
|
|
|
24
24
|
export default function () {
|
|
@@ -27,5 +27,5 @@ export default function () {
|
|
|
27
27
|
Hello World
|
|
28
28
|
</Box>
|
|
29
29
|
)
|
|
30
|
-
}`,
|
|
31
|
-
`;function
|
|
30
|
+
}`,ve=`console.log('hello')
|
|
31
|
+
`;function et({value:t}){const{locale:s}=q.useLocaleContext(),l=xe.useUpdate(),i=G.getYjsValue(t).doc;return k.useEffect(()=>{var o;(o=t.renderer)!=null&&o.script||(i.transact(()=>{t.renderer.script=t.renderer.type==="react-component"?be:ve}),l())},[t]),e.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:e.jsx(me.CodeEditor,{keyId:t.id,locale:s,language:"typescript",value:t.renderer.script||"",onChange:o=>t.renderer.script=o,typeScriptNoValidation:!1},t.id)})}function tt({value:t}){var p,f,j;const{t:s}=q.useLocaleContext(),l=G.getYjsValue(t).doc,{state:{components:i,config:{defaultLocale:o},resources:d},localState:{currentLocale:u}}=C.useStore(),a=C.useAllComponents(),g=((p=i[t.renderer.componentId])==null?void 0:p.data)??((j=(f=d.components)==null?void 0:f[t.renderer.componentId])==null?void 0:j.component),b=A.usePopupState({variant:"dialog"});return e.jsxs(r.Stack,{gap:1,children:[e.jsx(X,{allComponents:a,excludes:[t.id],value:t.renderer.componentId,onChange:(m,n)=>t.renderer.componentId=n}),g&&e.jsxs(e.Fragment,{children:[e.jsxs(r.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle2",children:s("parameters")}),e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...A.bindTrigger(b),children:e.jsx(N.TranslateRounded,{fontSize:"small"})})]}),g.properties&&_.sortBy(Object.values(g.properties),"index").map(({data:m})=>{var n,c,h,v,y,x,S,B,R,P,F,W,M,U,w,V;return e.jsx(r.Box,{children:e.jsx(K,{allComponents:a,defaultLocale:o,component:g,property:m,fullWidth:!0,size:"small",valueImmutable:_.isNil((v=(h=(c=(n=t.renderer.properties)==null?void 0:n[m.id])==null?void 0:c.locales)==null?void 0:h[u])==null?void 0:v.value),value:((B=(S=(x=(y=t.renderer.properties)==null?void 0:y[m.id])==null?void 0:x.locales)==null?void 0:S[u])==null?void 0:B.value)??((W=(F=(P=(R=t.renderer.properties)==null?void 0:R[m.id])==null?void 0:P.locales)==null?void 0:F[o])==null?void 0:W.value)??((U=(M=m.locales)==null?void 0:M[u])==null?void 0:U.defaultValue)??((V=(w=m.locales)==null?void 0:w[o])==null?void 0:V.defaultValue),onChange:I=>{l.transact(()=>{var T,z,E,J,$;(T=t.renderer).properties??(T.properties={}),(z=t.renderer.properties)[E=m.id]??(z[E]={}),(J=t.renderer.properties[m.id]).locales??(J.locales={}),($=t.renderer.properties[m.id].locales)[u]??($[u]={}),t.renderer.properties[m.id].locales[u].value=I})}})},m.id)}),e.jsx(fe,{...A.bindDialog(b),component:t,type:"parameters"})]})]})}function X({label:t,options:s,excludes:l,value:i,onChange:o,allComponents:d,...u}){var p;const{t:a}=q.useLocaleContext(),g=s??_.sortBy(Object.values(_.omit(d,...l??[])),"index").map(f=>f.data),b=(typeof i=="string"?(p=d[i])==null?void 0:p.data:void 0)??null;return e.jsx(r.Autocomplete,{...u,size:"small",options:g,autoHighlight:!0,isOptionEqualToValue:(f,j)=>f.id===j.id,getOptionKey:f=>f.id,getOptionLabel:f=>f.name||f.id,renderInput:f=>e.jsx(r.TextField,{label:t||a("component"),...f}),value:b,onChange:(f,j)=>{var n,c,h,v,y,x;let m={};j&&(m={blockletId:(n=d[j==null?void 0:j.id])==null?void 0:n.blockletId,blockletTitle:(c=d[j==null?void 0:j.id])==null?void 0:c.blockletTitle,componentName:((v=(h=d[j==null?void 0:j.id])==null?void 0:h.data)==null?void 0:v.name)||((x=(y=d[j==null?void 0:j.id])==null?void 0:y.data)==null?void 0:x.id)}),o==null||o(f,j==null?void 0:j.id,m)}})}exports.BasicInfo=he;exports.CustomComponentAutocomplete=X;exports.CustomComponentSettings=$e;exports.DefaultReactComponentScriptTemplate=be;exports.DefaultWebComponentScriptTemplate=ve;exports.PropertiesConfig=ge;exports.PropertyValueField=K;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.create;var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var h=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of g(o))!f.call(e,t)&&t!==n&&s(e,t,{get:()=>o[t],enumerable:!(r=m(o,t))||r.enumerable});return e};var v=(e,o,n)=>(n=e!=null?p(U(e)):{},h(o||!e||!e.__esModule?s(n,"default",{value:e,enumerable:!0}):n,e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),x=require("@mui/icons-material/Upload"),w=require("@mui/material"),l=require("react"),j=e=>e&&e.__esModule?e:{default:e},P=j(x),S=l.lazy(()=>import("@blocklet/uploader/react").then(e=>({default:e.Uploader}))),d=l.createContext(null);function u(){const e=l.useContext(d);if(!e)throw new Error("useUploader must be used within an UploaderProvider");return e}function _({onChange:e}){const o=u(),n=()=>{var t;const r=(t=o==null?void 0:o.current)==null?void 0:t.getUploader();r==null||r.open(),e&&r.onceUploadSuccess((...i)=>{e(...i)})};return a.jsx(w.IconButton,{size:"small",onClick:n,children:a.jsx(P.default,{})},"uploader-trigger")}function c({children:e}){const o=l.useRef(null),n=()=>{var t;((t=o==null?void 0:o.current)==null?void 0:t.getUploader()).close()};return a.jsxs(d.Provider,{value:o,children:[e,a.jsx(l.Suspense,{children:a.jsx(S,{ref:o,popup:!0,onUploadFinish:n,coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","video/mp4","video/webm","audio/mpeg"],maxNumberOfFiles:1}}},"uploader")})]})}function b(e){return new Promise((o,n)=>{const r=document.createElement("video");r.src=e,r.onloadedmetadata=()=>{const{videoWidth:t,videoHeight:i}=r;o({naturalWidth:t,naturalHeight:i})},r.onerror=t=>n(t)})}function z(e){return new Promise((o,n)=>{const r=new Image;r.src=e,r.onload=()=>{const{naturalWidth:t,naturalHeight:i}=r;o({naturalWidth:t,naturalHeight:i})},r.onerror=t=>n(t)})}exports.UploaderButton=_;exports.UploaderContext=d;exports.UploaderProvider=c;exports.default=c;exports.getImageSize=z;exports.getVideoSize=b;exports.useUploader=u;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getComponentMountPoint as k } from "@blocklet/pages-kit/builtin/utils";
|
|
2
2
|
import { PreloadComponentScriptModule as $ } from "@blocklet/pages-kit/types";
|
|
3
|
-
import {
|
|
3
|
+
import { componentUMDName as v, RenderNestedComponent as M, mergeComponent as L } from "@blocklet/pages-kit/utils/property";
|
|
4
4
|
import { memoize as O, Sandbox as _, BuiltinModules as U } from "@blocklet/quickjs";
|
|
5
5
|
import T from "@blocklet/sdk/lib/config";
|
|
6
6
|
import { LRUCache as D } from "lru-cache";
|
|
7
7
|
import F, { Headers as B } from "node-fetch";
|
|
8
|
-
import { joinURL as E,
|
|
8
|
+
import { joinURL as E, getQuery as J, withQuery as K, parseURL as b, withHttps as G } from "ufo";
|
|
9
9
|
import Q from "@blocklet/logger";
|
|
10
10
|
import { BuiltinModules as W } from "@blocklet/pages-kit/utils/builtin";
|
|
11
11
|
import { createBuiltinModuleTransformer as V } from "@blocklet/pages-kit/utils/typescript/builtin-module-transformer";
|
|
@@ -165,7 +165,7 @@ async function Pe({
|
|
|
165
165
|
async function m() {
|
|
166
166
|
const p = await Promise.all(
|
|
167
167
|
i.map(async (u) => {
|
|
168
|
-
const h =
|
|
168
|
+
const h = v({ componentId: u.component.id }), S = a === $.ESM ? {
|
|
169
169
|
module: a,
|
|
170
170
|
script: await I(u.script, {
|
|
171
171
|
componentId: u.component.id,
|
|
@@ -271,7 +271,7 @@ function ce({
|
|
|
271
271
|
}) {
|
|
272
272
|
const c = C({ state: e, componentId: t });
|
|
273
273
|
if (!c) return null;
|
|
274
|
-
const a =
|
|
274
|
+
const a = L({
|
|
275
275
|
componentId: t,
|
|
276
276
|
getComponent: (n) => C({ state: e, componentId: n }),
|
|
277
277
|
locale: o,
|
|
@@ -343,8 +343,8 @@ export { joinURL, withQuery, getQuery, getComponentMountPoint }
|
|
|
343
343
|
},
|
|
344
344
|
getComponentMountPoint: k,
|
|
345
345
|
joinURL: E,
|
|
346
|
-
withQuery:
|
|
347
|
-
getQuery:
|
|
346
|
+
withQuery: K,
|
|
347
|
+
getQuery: J
|
|
348
348
|
},
|
|
349
349
|
functionName: "getServerSidePropsWrapper",
|
|
350
350
|
args: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { u as o, S as a, k as s, h as n } from "./state-
|
|
2
|
+
import { u as o, S as a, k as s, h as n } from "./state-CETtldI3.mjs";
|
|
3
3
|
function d({ children: t }) {
|
|
4
4
|
const r = o();
|
|
5
5
|
return /* @__PURE__ */ e(a, { url: s(r ?? ""), name: "root", waitingSynced: !0, children: /* @__PURE__ */ e(i, { children: t }) });
|
package/lib/es/components.js
CHANGED
|
@@ -6,7 +6,7 @@ import "@blocklet/sdk/lib/config";
|
|
|
6
6
|
import "lru-cache";
|
|
7
7
|
import "node-fetch";
|
|
8
8
|
import "ufo";
|
|
9
|
-
import { C as S, G as _, a as E, c as d, f as i, h as l, g as N, e as O, d as P, b as c } from "../components-
|
|
9
|
+
import { C as S, G as _, a as E, c as d, f as i, h as l, g as N, e as O, d as P, b as c } from "../components-Bo3_pN-Y.mjs";
|
|
10
10
|
export {
|
|
11
11
|
S as CUSTOM_COMPONENT_CACHE_DURATION_IN_SECONDS,
|
|
12
12
|
_ as GET_SERVER_SIDE_PROPS_TIMEOUT_IN_SECONDS,
|
package/lib/es/home.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "../state-
|
|
2
|
+
import "../state-CETtldI3.mjs";
|
|
3
3
|
import "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import "@arcblock/ux/lib/Result";
|
|
5
5
|
import "@blocklet/pages-kit/builtin/page/header";
|
|
@@ -15,7 +15,7 @@ import "react-helmet";
|
|
|
15
15
|
import "react-router-dom";
|
|
16
16
|
import "react-use";
|
|
17
17
|
import "ufo";
|
|
18
|
-
import { a as V, P as b, b as c, T as x, H as R } from "../home-
|
|
18
|
+
import { a as V, P as b, b as c, T as x, H as R } from "../home-Cy0eoqJw.mjs";
|
|
19
19
|
export {
|
|
20
20
|
V as HomeView,
|
|
21
21
|
b as PageRoutes,
|
package/lib/es/resources.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as S, i as b, g as M, C as J, R as X, S as x, t as W, a as G } from "../site-state-
|
|
2
|
-
import { l as N } from "../components-
|
|
1
|
+
import { P as S, i as b, g as M, C as J, R as X, S as x, t as W, a as G } from "../site-state-7Hsu0igk.mjs";
|
|
2
|
+
import { l as N } from "../components-Bo3_pN-Y.mjs";
|
|
3
3
|
import { AsyncLocalStorage as K } from "async_hooks";
|
|
4
4
|
import { Router as Y } from "express";
|
|
5
5
|
import d from "fs";
|