@blocklet/pages-kit-inner-components 0.4.158 → 0.4.159
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/add-component.js +1 -1
- package/lib/cjs/chunks/{array-CRb2HQOz.js → array-5NwrYcJ5.js} +1 -1
- package/lib/cjs/chunks/{config-string-CN-vvf1B.js → config-string-DV4-1k4s.js} +1 -1
- package/lib/cjs/chunks/{draft-data-DPemVsYf.js → draft-data-QlwpWm4f.js} +1 -1
- package/lib/cjs/chunks/{home-C9XNYTJ6.js → home-WKpO7IF-.js} +5 -5
- package/lib/cjs/chunks/{publish-button-D_fgYKpB.js → publish-button-ImPoBEP5.js} +1 -1
- package/lib/cjs/chunks/{state-tJl9YPbn.js → state-DytLDIZR.js} +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-MChdTfwz.js → array-BAy40Bak.js} +1 -1
- package/lib/es/chunks/{config-string-ivAnKlqs.js → config-string-SEFT7xVe.js} +1 -1
- package/lib/es/chunks/{draft-data-ClUGStC_.js → draft-data-B7-JQvuO.js} +1 -1
- package/lib/es/chunks/{home-DLCpie9E.js → home-DOrhBil-.js} +49 -49
- package/lib/es/chunks/{publish-button-Dur9W9gN.js → publish-button-CxEaqAku.js} +3 -3
- package/lib/es/chunks/{state-bs1ORWYm.js → state-C_CbKF7g.js} +24 -24
- package/lib/es/home.js +3 -3
- package/lib/es/setting.js +2 -2
- package/package.json +3 -3
package/lib/cjs/add-component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var TI=Object.create;var gI=Object.defineProperty;var WI=Object.getOwnPropertyDescriptor;var xI=Object.getOwnPropertyNames;var YI=Object.getPrototypeOf,rI=Object.prototype.hasOwnProperty;var hI=(C,s,w,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of xI(s))!rI.call(C,o)&&o!==w&&gI(C,o,{get:()=>s[o],enumerable:!(i=WI(s,o))||i.enumerable});return C};var ZI=(C,s,w)=>(w=C!=null?TI(YI(C)):{},hI(s||!C||!C.__esModule?gI(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-
|
|
1
|
+
"use strict";var TI=Object.create;var gI=Object.defineProperty;var WI=Object.getOwnPropertyDescriptor;var xI=Object.getOwnPropertyNames;var YI=Object.getPrototypeOf,rI=Object.prototype.hasOwnProperty;var hI=(C,s,w,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of xI(s))!rI.call(C,o)&&o!==w&&gI(C,o,{get:()=>s[o],enumerable:!(i=WI(s,o))||i.enumerable});return C};var ZI=(C,s,w)=>(w=C!=null?TI(YI(C)):{},hI(s||!C||!C.__esModule?gI(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-DytLDIZR.js"),QI=require("@arcblock/ux/lib/Empty"),T=require("@arcblock/ux/lib/Locale/context"),p=require("@iconify-icon/react"),kI=require("@mui/icons-material/Check"),A=require("@mui/material"),u=require("ahooks"),m=require("react"),h=require("./chunks/array-5NwrYcJ5.js"),G=require("@arcblock/ux/lib/Theme");require("@blocklet/pages-kit/builtin/color-picker");require("@blocklet/pages-kit/utils/style");const RI=require("@emotion/css");require("lodash/without");const X=require("@mui/material/colors"),f=require("./chunks/config-string-DV4-1k4s.js"),pI=require("lodash/cloneDeep"),r=require("@mui/icons-material"),AI=require("react-dnd");require("@arcblock/ux/lib/Tabs");require("lodash/pick");const UI=require("@mui/lab"),a=require("immer"),fI=require("./theme.js"),_=require("react-use"),mI=require("@arcblock/ux/lib/Toast"),GI=require("@mui/material/Tooltip"),VI=require("@mui/icons-material/KeyboardArrowLeft"),vI=require("@mui/material/Box"),_I=require("@mui/material/DialogTitle"),PI=require("@mui/material/IconButton"),qI=require("@mui/material/Dialog"),$I=require("@mui/material/useMediaQuery"),SI=require("@emotion/react"),IC=require("@mui/material/Alert"),CC=require("@mui/material/AlertTitle"),gC=require("react-error-boundary"),AC=require("ufo"),iC=require("@emotion/styled"),sC=require("@mui/material/Typography"),oC=require("joi"),P=require("@blocklet/ai-kit/api"),wC=require("@blocklet/js-sdk"),BI=require("@mui/x-date-pickers"),MC=require("@mui/x-date-pickers/AdapterDayjs"),LC=require("@mui/x-date-pickers/LocalizationProvider"),iI=require("circular-natal-horoscope-js/dist"),jC=require("dayjs"),JC=require("dayjs/plugin/timezone"),OC=require("dayjs/plugin/utc"),mC=require("fast-deep-equal"),SC=require("lodash/isNil"),BC=require("tz-lookup"),yC=require("@mui/icons-material/CheckCircleOutline"),DC=require("lodash/uniq"),eC=require("lodash/get"),bC=require("lodash/set"),NC=require("@blocklet/pages-kit/components"),F=C=>C&&C.__esModule?C:{default:C},yI=F(QI),KC=F(kI),DI=F(m),dC=F(pI),eI=F(mI),cC=F(GI),q=F(VI),Y=F(vI),$=F(_I),II=F(PI),zC=F(qI),FC=F($I),aC=F(IC),lC=F(CC),Q=F(iC),sI=F(sC),E=F(oC),Z=F(jC),tC=F(JC),HC=F(OC),EC=F(mC),uC=F(SC),bI=F(BC),nC=F(yC),oI=F(DC),XC=F(eC),TC=F(bC);X.red[300],X.pink[300],X.purple[300],X.indigo[300],X.blue[300],X.cyan[300],X.teal[300],X.green[300],X.lime[300],X.yellow[300],X.amber[300],X.orange[300],X.brown[300],X.grey[300],X.blueGrey[300];G.styled(A.Box)`
|
|
2
2
|
.color-item {
|
|
3
3
|
position: relative;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var kt=Object.create;var ot=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var Bt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of St(e))!Ct.call(t,n)&&n!==r&&ot(t,n,{get:()=>e[n],enumerable:!(i=$t(e,n))||i.enumerable});return t};var Pt=(t,e,r)=>(r=t!=null?kt(Nt(t)):{},Bt(e||!t||!t.__esModule?ot(r,"default",{value:t,enumerable:!0}):r,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const x=require("@mui/material"),f=require("react"),It=require("lodash/keyBy"),j=require("./state-
|
|
1
|
+
"use strict";var kt=Object.create;var ot=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var Bt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of St(e))!Ct.call(t,n)&&n!==r&&ot(t,n,{get:()=>e[n],enumerable:!(i=$t(e,n))||i.enumerable});return t};var Pt=(t,e,r)=>(r=t!=null?kt(Nt(t)):{},Bt(e||!t||!t.__esModule?ot(r,"default",{value:t,enumerable:!0}):r,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const x=require("@mui/material"),f=require("react"),It=require("lodash/keyBy"),j=require("./state-DytLDIZR.js"),F=require("@blocklet/ai-runtime/components"),Rt=require("@mui/utils"),Wt=require("lodash/pick"),Tt=require("react-error-boundary"),zt=require("@blocklet/pages-kit/builtin/markdown/markdown-renderer"),mt=require("@blocklet/pages-kit/contexts/color"),g=require("@emotion/css"),Et=require("react-syntax-highlighter/dist/esm/styles/prism"),k=require("@arcblock/ux/lib/Theme"),qt=require("@arcblock/react-hooks/lib/useBrowser"),Lt=require("@arcblock/ux/lib/Colors"),J=require("@blocklet/pages-kit/components"),nt=require("@blocklet/pages-kit/utils/style"),At=require("@mui/material/useMediaQuery"),Ot=require("lodash/omit"),pt=require("@iconify-icon/react"),Ut=require("@arcblock/ux/lib/Screenshot"),G=require("react-router-dom"),Ft=require("@arcblock/ux/lib/Button"),Dt=require("is-uri"),D=require("pathe"),W=require("ufo"),Mt=require("@blocklet/embed/message"),Vt=require("ahooks"),Ht=require("lodash/isEqual"),Yt=require("@blocklet/embed/react"),Jt=require("react-twitter-embed"),rt=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},Gt=$(f),V=$(It),K=$(Wt),Kt=$(zt),Xt=$(qt),it=$(Lt),xt=$(At),N=$(Ot),Qt=$(Ut),Zt=$(Ft),H=$(Dt),te=$(Ht),ht="{{CUSTOM_VALUE}}",ee=[{title:"None",value:"none",sx:{py:0}},{title:"Small",value:"small",sx:{py:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{py:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{py:{xs:7.5,md:10,lg:12.5,xl:15}}}],oe=[{title:"None",value:"none",sx:{py:0}},{title:"Small",value:"small",sx:{py:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{py:{xs:5,md:7,lg:7,xl:9}}},{title:"Large",value:"large",sx:{py:{xs:6,md:9,lg:9,xl:11}}}],ne=[{title:"None",value:"none",sx:{px:0}},{title:"Small",value:"small",sx:{px:{xs:2,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{px:{xs:2.5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{px:{xs:2.5,md:10,lg:12.5,xl:15}}}],M=(t,e,r)=>{const i=t.breakpoints.values[r];return`${e}${i?` (${i}px)`:""}`},re=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:t=>M(t,"Small","sm"),value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:t=>M(t,"Normal","md"),value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:t=>M(t,"Large","lg"),value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:t=>M(t,"Extra Large","xl"),value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:ht,width:"100%",mx:"auto"}}],ie=V.default(ee,"value"),se=V.default(oe,"value"),ae=V.default(ne,"value"),le=V.default(re,"value"),ce=new Map([["baseSectionPaddingY",ie],["maxWidth",le],["paddingY",se],["paddingX",ae]]);function ft(t){var l;const{type:e,value:r,format:i="sx",defaultValue:n=null}=t,s=ce.get(e);if(!s)return n;const d=r.startsWith("custom:"),a=d?"custom":r;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const c=s[a][i];if(d){const u=r.replace("custom:","");try{return JSON.parse(JSON.stringify(c||{}).replaceAll(ht,u))}catch{}}return c}return n}const gt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function de(){return f.useContext(gt)}function ue({page:t,children:e,defaultLocale:r="en",currentLocale:i}){const n=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var c;if(!n)return{};const l=i||r;return((c=n.locales)==null?void 0:c[l])??{}},[n,r,i]),d=f.useCallback((l="sx")=>{const c=s();return!c||!c.style?{}:Object.entries(c.style||{}).reduce((m,[h,p])=>{if(!p)return m;const y=`${h}Custom`;c.style[y];const w=ft({type:h,value:p,format:l});return w?{...m,...w}:m},{})},[s]),a=f.useMemo(()=>({page:n,getPageMeta:s,getPageMetaStyle:d}),[n,s,d]);return o.jsx(gt.Provider,{value:a,children:e})}function R({actions:t,center:e,className:r,align:i}){return t&&(t!=null&&t.length)?o.jsx(x.Box,{className:g.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(e||i==="center")&&"justify-center",!e&&i==="right"&&"justify-end",!e&&i==="left"&&"justify-start",r),sx:{alignItems:"center"},children:t}):null}const me="section",pe=x.styled(x.Box)`
|
|
2
2
|
overflow: hidden;
|
|
3
3
|
|
|
4
4
|
.section__title {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),s=require("@blocklet/pages-kit/builtin/uploader"),h=require("@iconify-icon/react"),n=require("@mui/material"),l=require("react"),q=require("react-use"),I=require("./state-
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),s=require("@blocklet/pages-kit/builtin/uploader"),h=require("@iconify-icon/react"),n=require("@mui/material"),l=require("react"),q=require("react-use"),I=require("./state-DytLDIZR.js"),v=l.forwardRef(function({showMarkdown:S,markdown:j,onMarkdownChange:o,showUploader:p,value:c,meta:A,onChange:a,...u},z){const[t,m]=l.useState("");l.useEffect(()=>{m(c||"")},[c,m]);const f=async()=>{if(t!==c){const e=I.getImageAbsoluteUrl(t);if(!e){a(t,void 0);return}const r=await s.getImageSize(e).catch(()=>s.getVideoSize(e)).catch(()=>{});a(t,{...r,filename:t})}};q.useDebounce(()=>{t!==c&&a(t)},300,[t]),l.useImperativeHandle(z,()=>({submit:f}));const g={};return p&&(g.InputProps={sx:{pr:0},endAdornment:i.jsx(n.InputAdornment,{position:"end",sx:{mx:.5},children:i.jsx(s.UploaderButton,{onChange:async({response:e})=>{var b;const r=(b=e==null?void 0:e.data)==null?void 0:b.filename,d=I.getImageAbsoluteUrl(r)||"";let x={};d&&(x=await s.getImageSize(d).catch(()=>s.getVideoSize(d)).catch(()=>{})),a(r,{...x,filename:r})}})})}),i.jsx(n.TextField,{size:"small",fullWidth:!0,...u,label:i.jsxs(n.Stack,{direction:"row",spacing:1,alignItems:"center",children:[u.label,S&&i.jsxs(i.Fragment,{children:[" (",i.jsx(n.FormControlLabel,{checked:j,label:i.jsx(n.Box,{component:h.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:i.jsx(n.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(e,r)=>o==null?void 0:o(r)}),")"]})]}),InputLabelProps:{shrink:!0,...u.InputLabelProps},value:t,onChange:e=>m(e.target.value),...g,onKeyDown:e=>{e.keyCode!==229&&e.key==="Enter"&&f()}})});exports.ConfigString=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-DytLDIZR.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),E=require("./state-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),E=require("./state-DytLDIZR.js"),X=require("@arcblock/ux/lib/Locale/context"),ce=require("@arcblock/ux/lib/Result"),le=require("@blocklet/pages-kit/builtin/page/header"),ue=require("@blocklet/pages-kit/contexts/color"),Y=require("@blocklet/pages-kit/utils/data-source"),de=require("@blocklet/pages-kit/utils/route"),pe=require("@blocklet/ui-react/lib/Header"),J=require("@emotion/css"),N=require("@emotion/react"),ge=require("@emotion/styled"),b=require("@mui/material"),G=require("ahooks"),me=require("isomorphic-dompurify"),fe=require("lodash/cloneDeep"),he=require("lodash/isEmpty"),xe=require("lodash/isEqual"),m=require("react"),je=require("react-helmet"),P=require("react-router-dom"),Z=require("react-use"),M=require("ufo"),I=require("./array-5NwrYcJ5.js"),W=require("@arcblock/ux/lib/Theme"),ye=require("@blocklet/ui-react/lib/Footer");require("webfontloader");const be=require("@arcblock/did-connect/lib/Session"),R=t=>t&&t.__esModule?t:{default:t},ee=R(ce),ve=R(pe),te=R(ge),we=R(me),V=R(fe),Pe=R(he),ne=R(xe),Se=R(ye),ke=W.styled(Se.default,{shouldForwardProp:t=>!!t})`
|
|
2
2
|
& > div > .MuiContainer-root {
|
|
3
3
|
max-width: unset;
|
|
4
4
|
}
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
font-family: ${c};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`})}const{SessionProvider:Ue,SessionContext:Ee,SessionConsumer:Ae,withSession:Ne}=be.createAuthServiceSessionContext();function $(){return m.useContext(Ee)}function Ie(...t){var s;const{session:o}=$();return t.includes((s=o.user)==null?void 0:s.role)}function Be(...t){var r;const{session:o}=$(),s=Ie(...t);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!o.user:s}function Te(){const[t]=P.useSearchParams(),{session:o}=$(),s=Be("owner","admin","pagesEditor","member"),r=m.useMemo(()=>{const n=t.get("mode");return I.STATE_MODES.includes(n)?n:"production"},[t]),c=r==="production"?r:o.user?s?r:"production":null;return c?e.jsx(se,{mode:c}):null}function se({mode:t}){if(t!=="draft"){const o=window.__PAGE_STATE__;return o?e.jsx(A,{mode:t,state:o}):e.jsx(De,{mode:t,children:({state:s})=>e.jsx(A,{mode:t,state:s})})}return e.jsx(Le,{children:({state:o})=>e.jsx(A,{mode:t,state:o})})}const Le=m.lazy(()=>Promise.resolve().then(()=>require("./draft-data-
|
|
29
|
+
`})}const{SessionProvider:Ue,SessionContext:Ee,SessionConsumer:Ae,withSession:Ne}=be.createAuthServiceSessionContext();function $(){return m.useContext(Ee)}function Ie(...t){var s;const{session:o}=$();return t.includes((s=o.user)==null?void 0:s.role)}function Be(...t){var r;const{session:o}=$(),s=Ie(...t);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!o.user:s}function Te(){const[t]=P.useSearchParams(),{session:o}=$(),s=Be("owner","admin","pagesEditor","member"),r=m.useMemo(()=>{const n=t.get("mode");return I.STATE_MODES.includes(n)?n:"production"},[t]),c=r==="production"?r:o.user?s?r:"production":null;return c?e.jsx(se,{mode:c}):null}function se({mode:t}){if(t!=="draft"){const o=window.__PAGE_STATE__;return o?e.jsx(A,{mode:t,state:o}):e.jsx(De,{mode:t,children:({state:s})=>e.jsx(A,{mode:t,state:s})})}return e.jsx(Le,{children:({state:o})=>e.jsx(A,{mode:t,state:o})})}const Le=m.lazy(()=>Promise.resolve().then(()=>require("./draft-data-QlwpWm4f.js")));function De({mode:t,children:o}){const s=document.querySelector('meta[property="pages:version"]'),r=s==null?void 0:s.content,c=E.useProjectId(),n=m.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const l=localStorage.getItem(E.getProjectPageVersionKey(c??""));return Number(l)?Number(l):new Date().getTime()}return Number(r)},[r]),{loading:g,value:a}=Z.useAsync(()=>I.getPages({mode:t,version:n}),[t,n]);return g?e.jsx(oe,{}):a?o({state:a}):null}function A({mode:t,state:o}){const{t:s,locale:r}=X.useLocaleContext(),[c]=P.useSearchParams(),n=c.get("hiddenBadge")==="true",g=c.get("showPublish")==="true",{pageIds:a,pages:l,routeIds:f,routes:u,supportedLocales:d,config:{defaultLocale:j},resources:v}=o,w=E.getAllComponents(o),y=m.useMemo(()=>d!=null&&d.some(p=>p.locale===r)?r:void 0,[r,d]),h=Object.values(u).find(p=>(p==null?void 0:p.path)==="/")?void 0:Object.values(l)[0],H=m.useMemo(()=>a.map(p=>{const i=l[p];return i&&{id:i.id,path:M.joinURL("/",y||"",i.slug,t!=="production"?`?mode=${t}`:"")}}).filter(I.nonNullable),[a,l,y,t]),C=([...p])=>(t!=="production"&&g&&p.unshift(e.jsx(m.Suspense,{fallback:e.jsx("div",{}),children:e.jsx(Oe,{mode:"production",state:o})})),p);return e.jsxs(I.Provider,{value:{pages:H},children:[e.jsxs(P.Routes,{children:[h&&e.jsx(P.Route,{index:!0,element:e.jsx(P.Navigate,{to:M.joinURL("/",y||"",h.slug)})}),f==null?void 0:f.map(p=>{var B,T,L,S;const i=u==null?void 0:u[p];if(!i||!i.displayTemplateId)return null;const q=l[i.displayTemplateId];if(!q)return null;let _=[];if(i.params&&i.params.length>0){const x=de.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});_=x==null?void 0:x.map(k=>{var D,F,K,Q;const U=k.paramOptionIds.join("-");return e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",k.path),element:e.jsx(z,{mode:t,components:w,page:q,locale:y,defaultLocale:j,headerAddons:C,state:o,pageData:(Q=(K=(F=(D=i.dataSource)==null?void 0:D.pathDataMappings)==null?void 0:F[U])==null?void 0:K.dataCache)==null?void 0:Q[y||j||"en"]})},U)})}return _.push(e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",i.path),element:e.jsx(z,{mode:t,components:w,page:q,locale:y,defaultLocale:j,headerAddons:C,state:o,pageData:(S=(L=(T=(B=i.dataSource)==null?void 0:B.pathDataMappings)==null?void 0:T[i.id])==null?void 0:L.dataCache)==null?void 0:S[y||j||"en"]})},i.id)),_}),a.map(p=>{const i=l[p];return i?e.jsx(P.Route,{path:M.joinURL(":projectIdOrSlug?",i.slug),element:e.jsx(O,{mode:t,components:w,page:i,locale:y,defaultLocale:j,headerAddons:C})},i.id):null}),v.pages&&Object.values(v.pages).map(({blockletId:p,page:i})=>e.jsx(P.Route,{path:M.joinURL("/",`@${p}`,i.slug),element:e.jsx(O,{mode:t,components:w,page:i,locale:y,defaultLocale:j,headerAddons:C})},i.id)),e.jsx(P.Route,{path:"*",element:e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(ee.default,{status:404,extra:e.jsx(ie,{href:"/",children:s("common.back")})})})})]}),t!=="production"&&!n&&e.jsx(Ce,{sx:{bgcolor:"info.light"},children:t}),e.jsx(Me,{})]})}function z({mode:t,pageData:o,components:s,page:r,locale:c,defaultLocale:n,headerAddons:g,state:a}){const l=G.useReactive({page:null});m.useEffect(()=>{const u=r||null;u?l.page=V.default(u):l.page=null},[r,l]);const f=m.useRef();return m.useEffect(()=>{ne.default(o,f.current)||o&&l.page&&(Y.setPageDataSource(l.page,a,c,o),f.current=V.default(o))},[l.page,o,c,a]),l.page?e.jsx(O,{mode:t,components:s,page:l.page,locale:c,defaultLocale:n,headerAddons:g}):null}function Fe({mode:t,state:o,path:s,pageData:r}){const{t:c,locale:n}=X.useLocaleContext(),{pages:g,supportedLocales:a,config:{defaultLocale:l},resources:f}=o,u=Object.values(g).find(h=>(h==null?void 0:h.slug)===s),d=Object.values(f.pages||{}).find(h=>h.page.slug===s),j=m.useMemo(()=>a!=null&&a.some(h=>h.locale===n)?n:void 0,[n,a]),v=G.useReactive({page:null});m.useEffect(()=>{const h=u||(d==null?void 0:d.page)||null;h?v.page=V.default(h):v.page=null},[u,d]);const w=m.useRef();if(m.useEffect(()=>{ne.default(r,w.current)||r&&v.page&&(Y.setPageDataSource(v.page,o,j,r),w.current=V.default(r))},[{}]),!u&&!(d!=null&&d.page))return e.jsx(b.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(ee.default,{style:{background:"inherit"},status:404,extra:e.jsx(ie,{href:"/",children:c("common.back")})})});const y=E.getAllComponents(o);return v.page?e.jsx(O,{mode:t,components:y,page:v.page,locale:j,defaultLocale:l}):null}function O({mode:t,components:o,page:s,locale:r,defaultLocale:c,headerAddons:n}){var H,C,p,i,q,_,B,T,L;const g=ue.useColorConvert(),a=((H=s.locales)==null?void 0:H[r])??((C=s.locales)==null?void 0:C[c])??{},l=a.title||((p=window.blocklet)==null?void 0:p.appName),f=a.description||((i=window.blocklet)==null?void 0:i.appDescription),u=E.autoResizeImage(E.getImageAbsoluteUrl(a.image),540),{logo:d,brand:j,description:v,...w}=le.useHeaderState(),y=m.useMemo(()=>S=>{var k;let x=(n==null?void 0:n(S))??S;return x=((k=w.addons)==null?void 0:k.call(w,x))??x,x},[w.addons,n]),h=(q=a.header)!=null&&q.translucent?ae:re;return e.jsxs(I.PageProvider,{page:s,defaultLocale:c,currentLocale:r,children:[e.jsx(N.Global,{styles:N.css`
|
|
30
30
|
body {
|
|
31
|
-
background-color: ${
|
|
31
|
+
background-color: ${g(!a.backgroundColor||a.backgroundColor==="transparent"?"background.default":a.backgroundColor)} !important;
|
|
32
32
|
}
|
|
33
|
-
`}),e.jsx(h,{hideNavMenu:!!((_=a.header)!=null&&_.hideNavMenus),translucentTextColor:(B=a.header)==null?void 0:B.translucentTextColor,...
|
|
33
|
+
`}),e.jsx(h,{hideNavMenu:!!((_=a.header)!=null&&_.hideNavMenus),translucentTextColor:(B=a.header)==null?void 0:B.translucentTextColor,...d?{logo:d}:{},...j?{brand:j}:{},...v?{description:v}:{},className:J.cx(((T=a.header)==null?void 0:T.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),e.jsx(P.ScrollRestoration,{}),e.jsxs(je.Helmet,{children:[e.jsx("title",{children:l}),e.jsx("meta",{name:"og:title",content:l}),e.jsx("meta",{name:"og:description",content:f}),e.jsx("meta",{name:"og:image",content:u}),e.jsx("meta",{name:"twitter:image:src",content:u}),e.jsx("meta",{name:"twitter:image",content:u}),e.jsx("meta",{property:"twitter:description",content:f}),e.jsx("meta",{property:"twitter:title",content:l}),e.jsx("meta",{name:"description",content:f})]}),e.jsx(b.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:s.sectionIds.map(S=>{var D,F;const x=s.sections[S];if(!x||x.visibility==="hidden")return null;const k=(D=x.locales)==null?void 0:D[r],U=((F=x.locales)==null?void 0:F[c])??{};return e.jsx(I.BlockRenderer,{id:S,type:x.component,mode:t,section:x,config:{...Pe.default(k)?U:k,locale:r,dev:t==="draft"?{mode:t,components:o,defaultLocale:c}:{mode:t}}},S)})}),!((L=a.footer)!=null&&L.hidden)&&e.jsx(Re,{})]})}const Oe=m.lazy(()=>Promise.resolve().then(()=>require("./publish-button-ImPoBEP5.js"))),re=te.default(ve.default)`
|
|
34
34
|
&.sticky {
|
|
35
35
|
position: sticky;
|
|
36
36
|
top: 0;
|
|
37
37
|
}
|
|
38
|
-
`;function He({logo:t}){const[o,s]=m.useState(),r=b.useMediaQuery(n=>n.breakpoints.down("sm")),{value:c}=Z.useAsync(()=>{var a,l;const n=new URL(r?((a=window==null?void 0:window.blocklet)==null?void 0:a.appLogo)||"/.well-known/service/blocklet/logo":((l=window==null?void 0:window.blocklet)==null?void 0:l.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const
|
|
38
|
+
`;function He({logo:t}){const[o,s]=m.useState(),r=b.useMediaQuery(n=>n.breakpoints.down("sm")),{value:c}=Z.useAsync(()=>{var a,l;const n=new URL(r?((a=window==null?void 0:window.blocklet)==null?void 0:a.appLogo)||"/.well-known/service/blocklet/logo":((l=window==null?void 0:window.blocklet)==null?void 0:l.appLogoRect)||"/.well-known/service/blocklet/logo-rect",window.location.origin);n.searchParams.delete("imageFilter"),n.searchParams.delete("f");const g=n.toString();return new Promise(f=>{fetch(g).then(u=>{const d=u.headers.get("content-type");d!=null&&d.includes("svg")&&u.text().then(j=>{s(j),f(null)}),f(u.url)})})},[r]);if(t)return t;if(o)return e.jsx(b.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:we.default.sanitize(o)}});if(c){const n=new URL(c);n.searchParams.set("imageFilter","convert"),n.searchParams.set("f","png"),n.searchParams.set("h","80");const g=n.toString();return e.jsx("img",{src:g,alt:"logo"})}return null}function ae({logo:t,translucentTextColor:o,...s}){const{top:r=0}=G.useScroll(()=>document.getElementById("app"))||{},c=b.useTheme();let n=Math.min(r/800,1),g="";return n>.1?(n=Math.max(n,.6),g=b.alpha(c.palette.text.primary,n)):g=o||"#EEEEEE",e.jsx(re,{logo:e.jsx(He,{logo:t}),...s,className:J.cx(n<=.7&&"reverse-color"),style:{backgroundColor:b.alpha(c.palette.background.default,n),"--logo-invert":n<=.7?1-n/6:1-n},sx:{backdropFilter:n>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${g} !important`}},"& .navmenu--horizontal":{bgcolor:"transparent !important"},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:g}}})}const ie=te.default(b.Button)``;exports.Home=Te;exports.HomeView=se;exports.Loading=oe;exports.PageRoutes=A;exports.PageView=O;exports.PageViewByPath=Fe;exports.PageViewWithDataSource=z;exports.TranslucentHeader=ae;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("./state-tJl9YPbn.js"),$=require("@arcblock/ux/lib/Locale/context"),ee=require("@arcblock/ux/lib/Toast"),te=require("@blocklet/pages-kit/utils/route"),P=require("@mui/icons-material"),J=require("@mui/lab"),s=require("@mui/material"),se=require("immer"),ne=require("lodash/difference"),l=require("react"),ie=require("react-use"),re=require("./home-C9XNYTJ6.js"),U=require("./array-CRb2HQOz.js"),G=r=>r&&r.__esModule?r:{default:r},W=G(ee),H=G(ne);function oe(r){const[j,k]=l.useState(!1);return e.jsx(J.LoadingButton,{...r,loading:r.loading||j,onClick:u=>{var b;const p=(b=r.onClick)==null?void 0:b.call(r,u);p instanceof Promise&&(k(!0),p.finally(()=>{k(!1)}))}})}const ae=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function le(){const[r,j]=l.useState(),k=l.useMemo(()=>r?e.jsx(s.Dialog,{...r}):null,[r]),u=l.useCallback(()=>{j(void 0)},[]),p=l.useCallback(({title:b,content:d,cancelText:S="Cancel",okText:f="Ok",onOk:g,onClose:c,okIcon:O,okColor:w="primary",cancelColor:y="primary",DialogContentProps:A,form:M,...z})=>{j({...z,open:!0,children:e.jsxs("form",{onSubmit:R=>R.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{u(),c==null||c()},children:e.jsx(ae,{})})]}),d&&e.jsx(s.DialogContent,{...A,sx:{mt:-3,...A==null?void 0:A.sx},children:e.jsx(s.Box,{pt:3,children:d})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:c??u,children:S}),e.jsx(oe,{variant:"contained",color:w||"primary",startIcon:O,loadingPosition:O?"start":"center",onClick:async()=>{await(g==null?void 0:g()),u()},type:"submit",children:f})]})]}),onClose:c??u})},[u]);return{dialog:k,showDialog:p,closeDialog:u}}const ce=l.forwardRef(({mode:r,state:j},k)=>{const{t:u}=$.useLocaleContext(),[p,b]=l.useState(!1),{dialog:d,showDialog:S}=le(),f=F.useProjectId(),g=l.useCallback(O=>{let w=[];S({title:u("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(P.Warning,{}),children:u("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(de,{state:j,toMode:r,onChange:y=>w=y,defaultRouteIds:O})})]}),okText:u("maker.publish"),cancelText:u("common.cancel"),onOk:async()=>{if((w==null?void 0:w.length)===0){const y=u("maker.publishSelectPagesMessage");throw W.default.error(y),new Error(y)}localStorage.setItem(F.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await U.publishPages({mode:r,routes:w}),W.default.success(u("maker.publishSuccessMessage"))}catch(y){throw W.default.error(y.message),y}finally{b(!1)}}})},[r,j,u,f,S]);l.useImperativeHandle(k,()=>({openPublishDialog:g}));const c=l.useCallback(()=>{g()},[g]);return e.jsxs(e.Fragment,{children:[e.jsx(J.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:c,loading:p,disabled:p,children:u("maker.publishToProduction")}),d]})});function ue({routePathInfo:r,checked:j,onClick:k,route:u}){var d,S,f,g,c;const{t:p}=$.useLocaleContext(),b=!((d=r.routeMetaData)!=null&&d.publishedAt)||((S=r.routeMetaData)==null?void 0:S.updatedAt)&&new Date((f=r.routeMetaData)==null?void 0:f.updatedAt)>new Date((g=r.routeMetaData)==null?void 0:g.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{display:"flex",alignItems:"center",sx:{minWidth:"auto"},children:[b&&e.jsx(s.Box,{mr:.35,className:"visible",color:"warning.main",sx:{display:"flex",alignItems:"center"},title:p("maker.pages.needPublish"),children:e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!((c=r.routeMetaData)!=null&&c.isPublic)||!u.isPublic)&&e.jsx(s.Box,{className:"visible",color:"warning.main",children:e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:k,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:j,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:r.path,primaryTypographyProps:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}})]})})}function de({state:r,toMode:j,onChange:k,defaultRouteIds:u}){const{t:p,locale:b}=$.useLocaleContext(),[d,S]=l.useState(!1),[f,g]=l.useState(()=>u?Object.fromEntries(u.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[c,O]=l.useState({}),[w,y]=l.useState(()=>u?Object.fromEntries(u.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[A,M]=l.useState({}),{loading:z,error:R,value:x}=ie.useAsync(()=>U.getPages({mode:j}),[j]);if(R)throw R;const T=l.useMemo(()=>r.routeIds||[],[r]),I=l.useMemo(()=>(x==null?void 0:x.pageIds)||[],[x]),D=l.useMemo(()=>!T||!r.routes?[]:JSON.parse(JSON.stringify(T)).sort((o,i)=>{var h,m;const n=(h=r.routes)==null?void 0:h[o],a=(m=r.routes)==null?void 0:m[i];return n!=null&&n.publishedAt&&new Date(n.publishedAt).getTime()<new Date(n.updatedAt).getTime()?-1:a!=null&&a.publishedAt&&new Date(a.publishedAt).getTime()<new Date(a.updatedAt).getTime()?1:new Date((n==null?void 0:n.updatedAt)??"").getTime()-new Date((a==null?void 0:a.updatedAt)??"").getTime()}),[r,T]),q=l.useMemo(()=>{if(!D)return[];if(!c)return D;const t=[...D].filter(o=>!c[o]);return Object.values(c).forEach(o=>{o.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,c]),L=l.useMemo(()=>!x||!I||!q?[]:H.default(I,q),[q,x,I]),C=l.useMemo(()=>T?[...T].concat(L):L,[T,L]),_=l.useCallback(()=>{const t={};D==null||D.forEach(o=>{var n;const i=(n=r.routes)==null?void 0:n[o];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const a=te.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});a.length>0&&(t[i.id]=a)}}),O(t)},[D,r.routes]);l.useEffect(()=>{_()},[_]),l.useEffect(()=>{M(t=>{const o={...t};return Object.keys(c).forEach(i=>{var n;c[i]&&((n=c[i])==null?void 0:n.length)>0&&o[i]===void 0&&(o[i]=!0)}),o})},[c]);const K=l.useRef(!0);l.useEffect(()=>{y(t=>{const o={...t};return Object.keys(c).length===0||(Object.keys(c).forEach(i=>{const n=c[i]||[],a=d||!!f[i];n.forEach(h=>{const m=`${i}-${h.paramOptionIds.join("-")}`;K.current?o[m]=a||t[m]||!1:o[m]=a})}),K.current=!1),o})},[f,c,d]);const Q=(t,o)=>{o.stopPropagation(),M(i=>{const n={...i};return n[t]=!n[t],n})},N=l.useCallback(t=>{g(o=>{const i=se.produce(o,n=>{d?(Object.assign(n,Object.fromEntries(C.map(a=>[a,!0]))),delete n[t]):n[t]?(delete n[t],L.includes(t)&&(T||[]).filter(a=>{var h,m;return((h=r.pages[a])==null?void 0:h.slug)===((m=x==null?void 0:x.pages[t])==null?void 0:m.slug)}).forEach(a=>{delete n[a]})):(n[t]=!0,T&&T.includes(t)&&L.filter(a=>{var h,m;return((h=x==null?void 0:x.pages[a])==null?void 0:h.slug)===((m=r.pages[t])==null?void 0:m.slug)}).forEach(a=>{n[a]=!0}))});return S(H.default(C,Object.keys(i)).length===0),i})},[d,C,L,r,x,T]),X=l.useCallback((t,o)=>{const i=`${t}-${o.paramOptionIds.join("-")}`;y(n=>{var m;const a={...n};a[i]=!a[i];const h=((m=c[t])==null?void 0:m.every(B=>a[`${t}-${B.paramOptionIds.join("-")}`]))??!1;return g(B=>{if(h&&!B[t])return{...B,[t]:!0};if(!h&&B[t]){const v={...B};return delete v[t],v}return B}),a})},[c]),Y=l.useCallback(()=>{S(t=>(t&&g({}),!t))},[]);return l.useEffect(()=>{const t=d?C:Object.keys(f),o=Object.entries(w).filter(([,n])=>n).map(([n])=>n).filter(n=>n!==void 0),i=Array.from(new Set([...t,...o]));k(d?null:i)},[d,f,w,C,k]),z?e.jsx(re.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Y,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:p("common.all")})]})}),D.map(t=>{var B,v;const o=(B=r.routes)==null?void 0:B[t];if(!o)return null;const i=!1,n=c&&c[t]&&((v=c[t])==null?void 0:v.length)>0,a=A[t]!==!1,h=c[t]||[],m=!o.publishedAt||o.updatedAt&&new Date(o.updatedAt).getTime()>new Date(o.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[m&&e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!o.isPublic&&e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,n&&e.jsx(s.Box,{onClick:E=>Q(t,E),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:a?e.jsx(P.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(P.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})}),n&&e.jsx(s.Collapse,{in:a,children:e.jsx(s.Box,{children:h.map(E=>{const V=`${t}-${E.paramOptionIds.join("-")}`,Z=w[V]||!1;return e.jsx(ue,{routePathInfo:E,checked:d||Z,onClick:()=>X(t,E),route:o},V)})})})]},t)}),L.map(t=>{var i,n;const o=x==null?void 0:x.pages[t];return o?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.slug,secondary:(n=(i=o.locales)==null?void 0:i[b])==null?void 0:n.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},t):null})]})}exports.default=ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("./state-DytLDIZR.js"),$=require("@arcblock/ux/lib/Locale/context"),ee=require("@arcblock/ux/lib/Toast"),te=require("@blocklet/pages-kit/utils/route"),P=require("@mui/icons-material"),J=require("@mui/lab"),s=require("@mui/material"),se=require("immer"),ne=require("lodash/difference"),l=require("react"),ie=require("react-use"),re=require("./home-WKpO7IF-.js"),U=require("./array-5NwrYcJ5.js"),G=r=>r&&r.__esModule?r:{default:r},W=G(ee),H=G(ne);function oe(r){const[j,k]=l.useState(!1);return e.jsx(J.LoadingButton,{...r,loading:r.loading||j,onClick:u=>{var b;const p=(b=r.onClick)==null?void 0:b.call(r,u);p instanceof Promise&&(k(!0),p.finally(()=>{k(!1)}))}})}const ae=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function le(){const[r,j]=l.useState(),k=l.useMemo(()=>r?e.jsx(s.Dialog,{...r}):null,[r]),u=l.useCallback(()=>{j(void 0)},[]),p=l.useCallback(({title:b,content:d,cancelText:S="Cancel",okText:f="Ok",onOk:g,onClose:c,okIcon:O,okColor:w="primary",cancelColor:y="primary",DialogContentProps:A,form:M,...z})=>{j({...z,open:!0,children:e.jsxs("form",{onSubmit:R=>R.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{u(),c==null||c()},children:e.jsx(ae,{})})]}),d&&e.jsx(s.DialogContent,{...A,sx:{mt:-3,...A==null?void 0:A.sx},children:e.jsx(s.Box,{pt:3,children:d})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:c??u,children:S}),e.jsx(oe,{variant:"contained",color:w||"primary",startIcon:O,loadingPosition:O?"start":"center",onClick:async()=>{await(g==null?void 0:g()),u()},type:"submit",children:f})]})]}),onClose:c??u})},[u]);return{dialog:k,showDialog:p,closeDialog:u}}const ce=l.forwardRef(({mode:r,state:j},k)=>{const{t:u}=$.useLocaleContext(),[p,b]=l.useState(!1),{dialog:d,showDialog:S}=le(),f=F.useProjectId(),g=l.useCallback(O=>{let w=[];S({title:u("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(P.Warning,{}),children:u("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(de,{state:j,toMode:r,onChange:y=>w=y,defaultRouteIds:O})})]}),okText:u("maker.publish"),cancelText:u("common.cancel"),onOk:async()=>{if((w==null?void 0:w.length)===0){const y=u("maker.publishSelectPagesMessage");throw W.default.error(y),new Error(y)}localStorage.setItem(F.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await U.publishPages({mode:r,routes:w}),W.default.success(u("maker.publishSuccessMessage"))}catch(y){throw W.default.error(y.message),y}finally{b(!1)}}})},[r,j,u,f,S]);l.useImperativeHandle(k,()=>({openPublishDialog:g}));const c=l.useCallback(()=>{g()},[g]);return e.jsxs(e.Fragment,{children:[e.jsx(J.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:c,loading:p,disabled:p,children:u("maker.publishToProduction")}),d]})});function ue({routePathInfo:r,checked:j,onClick:k,route:u}){var d,S,f,g,c;const{t:p}=$.useLocaleContext(),b=!((d=r.routeMetaData)!=null&&d.publishedAt)||((S=r.routeMetaData)==null?void 0:S.updatedAt)&&new Date((f=r.routeMetaData)==null?void 0:f.updatedAt)>new Date((g=r.routeMetaData)==null?void 0:g.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{display:"flex",alignItems:"center",sx:{minWidth:"auto"},children:[b&&e.jsx(s.Box,{mr:.35,className:"visible",color:"warning.main",sx:{display:"flex",alignItems:"center"},title:p("maker.pages.needPublish"),children:e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!((c=r.routeMetaData)!=null&&c.isPublic)||!u.isPublic)&&e.jsx(s.Box,{className:"visible",color:"warning.main",children:e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:k,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:j,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:r.path,primaryTypographyProps:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}})]})})}function de({state:r,toMode:j,onChange:k,defaultRouteIds:u}){const{t:p,locale:b}=$.useLocaleContext(),[d,S]=l.useState(!1),[f,g]=l.useState(()=>u?Object.fromEntries(u.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[c,O]=l.useState({}),[w,y]=l.useState(()=>u?Object.fromEntries(u.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[A,M]=l.useState({}),{loading:z,error:R,value:x}=ie.useAsync(()=>U.getPages({mode:j}),[j]);if(R)throw R;const T=l.useMemo(()=>r.routeIds||[],[r]),I=l.useMemo(()=>(x==null?void 0:x.pageIds)||[],[x]),D=l.useMemo(()=>!T||!r.routes?[]:JSON.parse(JSON.stringify(T)).sort((o,i)=>{var h,m;const n=(h=r.routes)==null?void 0:h[o],a=(m=r.routes)==null?void 0:m[i];return n!=null&&n.publishedAt&&new Date(n.publishedAt).getTime()<new Date(n.updatedAt).getTime()?-1:a!=null&&a.publishedAt&&new Date(a.publishedAt).getTime()<new Date(a.updatedAt).getTime()?1:new Date((n==null?void 0:n.updatedAt)??"").getTime()-new Date((a==null?void 0:a.updatedAt)??"").getTime()}),[r,T]),q=l.useMemo(()=>{if(!D)return[];if(!c)return D;const t=[...D].filter(o=>!c[o]);return Object.values(c).forEach(o=>{o.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[D,c]),L=l.useMemo(()=>!x||!I||!q?[]:H.default(I,q),[q,x,I]),C=l.useMemo(()=>T?[...T].concat(L):L,[T,L]),_=l.useCallback(()=>{const t={};D==null||D.forEach(o=>{var n;const i=(n=r.routes)==null?void 0:n[o];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const a=te.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});a.length>0&&(t[i.id]=a)}}),O(t)},[D,r.routes]);l.useEffect(()=>{_()},[_]),l.useEffect(()=>{M(t=>{const o={...t};return Object.keys(c).forEach(i=>{var n;c[i]&&((n=c[i])==null?void 0:n.length)>0&&o[i]===void 0&&(o[i]=!0)}),o})},[c]);const K=l.useRef(!0);l.useEffect(()=>{y(t=>{const o={...t};return Object.keys(c).length===0||(Object.keys(c).forEach(i=>{const n=c[i]||[],a=d||!!f[i];n.forEach(h=>{const m=`${i}-${h.paramOptionIds.join("-")}`;K.current?o[m]=a||t[m]||!1:o[m]=a})}),K.current=!1),o})},[f,c,d]);const Q=(t,o)=>{o.stopPropagation(),M(i=>{const n={...i};return n[t]=!n[t],n})},N=l.useCallback(t=>{g(o=>{const i=se.produce(o,n=>{d?(Object.assign(n,Object.fromEntries(C.map(a=>[a,!0]))),delete n[t]):n[t]?(delete n[t],L.includes(t)&&(T||[]).filter(a=>{var h,m;return((h=r.pages[a])==null?void 0:h.slug)===((m=x==null?void 0:x.pages[t])==null?void 0:m.slug)}).forEach(a=>{delete n[a]})):(n[t]=!0,T&&T.includes(t)&&L.filter(a=>{var h,m;return((h=x==null?void 0:x.pages[a])==null?void 0:h.slug)===((m=r.pages[t])==null?void 0:m.slug)}).forEach(a=>{n[a]=!0}))});return S(H.default(C,Object.keys(i)).length===0),i})},[d,C,L,r,x,T]),X=l.useCallback((t,o)=>{const i=`${t}-${o.paramOptionIds.join("-")}`;y(n=>{var m;const a={...n};a[i]=!a[i];const h=((m=c[t])==null?void 0:m.every(B=>a[`${t}-${B.paramOptionIds.join("-")}`]))??!1;return g(B=>{if(h&&!B[t])return{...B,[t]:!0};if(!h&&B[t]){const v={...B};return delete v[t],v}return B}),a})},[c]),Y=l.useCallback(()=>{S(t=>(t&&g({}),!t))},[]);return l.useEffect(()=>{const t=d?C:Object.keys(f),o=Object.entries(w).filter(([,n])=>n).map(([n])=>n).filter(n=>n!==void 0),i=Array.from(new Set([...t,...o]));k(d?null:i)},[d,f,w,C,k]),z?e.jsx(re.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Y,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:p("common.all")})]})}),D.map(t=>{var B,v;const o=(B=r.routes)==null?void 0:B[t];if(!o)return null;const i=!1,n=c&&c[t]&&((v=c[t])==null?void 0:v.length)>0,a=A[t]!==!1,h=c[t]||[],m=!o.publishedAt||o.updatedAt&&new Date(o.updatedAt).getTime()>new Date(o.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[m&&e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(P.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!o.isPublic&&e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(P.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,n&&e.jsx(s.Box,{onClick:E=>Q(t,E),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:a?e.jsx(P.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(P.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})}),n&&e.jsx(s.Collapse,{in:a,children:e.jsx(s.Box,{children:h.map(E=>{const V=`${t}-${E.paramOptionIds.join("-")}`,Z=w[V]||!1;return e.jsx(ue,{routePathInfo:E,checked:d||Z,onClick:()=>X(t,E),route:o},V)})})})]},t)}),L.map(t=>{var i,n;const o=x==null?void 0:x.pages[t];return o?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.slug,secondary:(n=(i=o.locales)==null?void 0:i[b])==null?void 0:n.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},t):null})]})}exports.default=ce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const _=require("react/jsx-runtime"),$=require("@mui/material"),h=require("ufo"),Z=require("@blocklet/js-sdk"),H=require("lodash/isEmpty"),ee=require("yaml"),te=require("@arcblock/ux/lib/Locale/context"),N=require("@syncedstore/core"),ne=require("@syncedstore/react"),oe=require("ahooks"),C=require("immer"),re=require("js-cookie"),se=require("lodash/debounce"),ce=require("nanoid"),d=require("react"),V=require("react-router-dom"),ie=require("y-indexeddb"),ae=require("y-websocket"),de=require("yjs");require("@blocklet/pages-kit/types");const E=t=>t&&t.__esModule?t:{default:t};function ue(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const S=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,S.get?S:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const le=E(H),fe=ue(ee),me=E(N),Se=E(re),W=E(se),pe=t=>{const n=blocklet==null?void 0:blocklet.componentMountPoints.find(i=>i.name===t);return n?n.mountPoint:"/"};function z(){const{pathname:t}=window.location,n=t.match(/\/admin\/(maker|previewer)\/([^/]+)/),i=n==null?void 0:n[2],S=window.__PROJECT_ID__;if(!i&&!S)throw new Error("Unable to get projectId from pathname");return i||S}function we(t){return`${t}:pages:version`}function Pe(t,n){return n==="yaml"?le.default(t)?"":fe.stringify(t,{indent:2}):n==="json"?JSON.parse(JSON.stringify(t||{})):n==="array"?JSON.parse(JSON.stringify(t||[])):t}function Ie({error:t}){return _.jsx($.Box,{children:_.jsx($.Alert,{severity:"error",children:t.message})})}var G;const k=((G=window.blocklet)==null?void 0:G.prefix)||"/",L=Z.createAxios({timeout:200*1e3}),ge=window.location.protocol==="https:"?"wss":"ws",je=t=>h.joinURL(`${ge}://${window.location.hostname}`,k,`api/${t}/ws/pages`),ye="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";var F;(F=blocklet==null?void 0:blocklet.componentMountPoints.find(t=>t.did===ye))!=null&&F.mountPoint||h.joinURL(k,"/image-bin");function Ce(t){return t&&!/^(https?:\/\/|\/)/.test(t)?window.location.origin+h.joinURL(k,"uploads",t):t}const he=window.innerWidth<=750;function be(t,n,i){if(!t||/\.gif/.test(t))return t;const S=(he?n/1.5:n)*(i==="quality"?1.5:1);return ve(t,{imageFilter:"resize",w:S,f:"webp"})}function ve(t,n){return!t||!n?t:h.withQuery(t,n)}async function xe(t){return L.get(`/api/projects/${t}`).then(n=>n.data)}async function Oe(t){return L.post(`/api/projects/${t.id}/update`,t).then(n=>n.data)}const Ee=500,x=ce.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",16),J=d.createContext(null);function _e({url:t,name:n,children:i,waitingSynced:S}){const[g,P]=d.useState(!1),{locale:j}=te.useLocaleContext(),p=R(),e=`${p}:MakerLocalState`,o=`${p}:${n}`,[r,s]=oe.useLocalStorageState(e,{defaultValue:{},listenStorageChange:!0}),c=d.useRef(r);c.current=r;const a=d.useMemo(()=>me.default({dataSourceIds:[],dataSources:{},pages:{},pageIds:[],routes:{},routeIds:[],components:{},supportedLocales:[],config:{},resources:{}}),[]),u=d.useMemo(()=>N.getYjsDoc(a),[a]);d.useMemo(()=>new ie.IndexeddbPersistence(o,u),[o,u]);const w=d.useMemo(()=>new ae.WebsocketProvider(t,o,u,{params:{token:Se.default.get("login_token")},resyncInterval:5*60*1e3}),[t,o,u]),b=d.useCallback(()=>{w&&(w.disconnect(),w.connect())},[w]),y=d.useMemo(()=>new de.UndoManager([u.getArray("pageIds"),u.getMap("pages"),u.getArray("supportedLocales"),u.getMap("config")],{doc:u}),[u]),[v,O]=d.useState(null),[A,M]=d.useState(!1),[q,D]=d.useState(void 0),T=d.useCallback(async()=>{if(p){M(!0);try{const l=await xe(p);O(l)}catch(l){console.error("Failed to fetch project:",l)}finally{M(!1)}}},[p]),U=d.useCallback(async(l,f)=>{var I;if(D(void 0),!!p){f!=null&&f.optimisticUpdate&&v&&O(m=>({...m,...l}));try{const m=await Oe({...l});O(m)}catch(m){console.error("Failed to update project:",m),f!=null&&f.optimisticUpdate&&O(v),D((I=m==null?void 0:m.response)==null?void 0:I.data)}}},[p,v]);d.useEffect(()=>{p&&T()},[p,T]);const Y=d.useMemo(()=>({doc:u,state:a,localState:{...r,currentLocale:j},setLocalState:l=>s(typeof l=="function"?f=>l(f??{}):l),undoManager:y,projectState:{project:v,isLoadingProject:A,error:q},updateProject:U,forceSync:b}),[u,a,JSON.stringify(r),s,y,v,A,U,q,j,b]);return d.useEffect(()=>{y.on("stack-item-added",({stackItem:l})=>{const{currentPageId:f,currentLocale:I,pages:m}=c.current;l.meta.set("localState",{currentPageId:f,currentLocale:I,pages:m})}),y.on("stack-item-popped",({stackItem:l})=>{const f=l.meta.get("localState");f&&s(I=>({...I,...f}))})},[y,s]),d.useEffect(()=>{w.awareness.setLocalState(r)},[w,r]),d.useEffect(()=>{w.once("synced",()=>P(!0));const l=()=>{s(m=>({...m,networkStatus:void 0}))},f=()=>{s(m=>({...m,networkStatus:"offline"}))},I=W.default(({status:m})=>{m==="connected"?l():m==="disconnected"&&f()},Ee);return w.on("status",I),window.addEventListener("online",l),window.addEventListener("offline",f),()=>{w.off("status",I),window.removeEventListener("online",l),window.removeEventListener("offline",f)}},[w,s]),S&&!g?null:_.jsx(J.Provider,{value:Y,children:i})}const B=()=>{const t=d.useContext(J);if(!t)throw new Error("Context is null");const n=ne.useSyncedStore(t.state),{setLocalState:i,localState:S}=t,g=V.useNavigate(),P=R(),j=d.useMemo(()=>({setCurrentSectionId:(e,o)=>{var r,s;e===S.currentPageId&&o===((s=(r=S.pages)==null?void 0:r[e])==null?void 0:s.currentSectionId)||(g(h.joinURL("/admin/maker",P??"","pages",e)),i(c=>C.produce(c,a=>{var u;a.currentPageId=e,a.currentComponentId=void 0,a.customComponentPreviewerProperties={},o!==void 0&&(a.pages??(a.pages={}),(u=a.pages)[e]??(u[e]={}),a.pages[e].currentSectionId=o??void 0),o?window.sessionStorage.setItem("iframe_show_id",`"${o}"`):window.sessionStorage.removeItem("iframe_show_id")})))},setCurrentComponentId:e=>{e!==S.currentComponentId&&(g(h.joinURL("/admin/maker",P??"","components",e)),i(o=>C.produce(o,r=>{r.currentPageId=void 0,r.currentComponentId=e,r.customComponentPreviewerProperties={}})))},setCurrentRouteId:({routeId:e,dynamicParams:o})=>{i(r=>C.produce(r,s=>{s.currentRouteId=e,s.currentDynamicParams=o}))},setCustomComponentPreviewerProperties:(()=>{const e={},o=W.default(()=>{i(r=>C.produce(r,s=>{s.customComponentPreviewerProperties={...s==null?void 0:s.customComponentPreviewerProperties,...e},Object.keys(e).forEach(c=>delete e[c])}))},5);return r=>{Object.assign(e,r),o()}})(),setRouteGenerateProcess:e=>{i(o=>C.produce(o,r=>{e?r.routeGenerateProcess={...r.routeGenerateProcess,...e}:r.routeGenerateProcess={}}))},resetRouteGenerateProcess:()=>{i(e=>C.produce(e,o=>{o.routeGenerateProcess={progress:"complete"}}))},setCurrentThemeMode:e=>{i(o=>C.produce(o,r=>{r.currentThemeMode=e}))}}),[i,g,P]),p=d.useMemo(()=>({addPage:(e,o)=>{var c,a,u,w,b,y;const r=(e==null?void 0:e.id)??x(),s={...e,id:r,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),slug:(e==null?void 0:e.slug)??`/${r}`,sections:(e==null?void 0:e.sections)??{},sectionIds:(e==null?void 0:e.sectionIds)??[],isPublic:(e==null?void 0:e.isPublic)??!0,templateConfig:(e==null?void 0:e.templateConfig)??{isTemplate:((c=e==null?void 0:e.templateConfig)==null?void 0:c.isTemplate)??!0,displayTemplateId:((a=e==null?void 0:e.templateConfig)==null?void 0:a.displayTemplateId)??void 0,dataSourceIds:((u=e==null?void 0:e.templateConfig)==null?void 0:u.dataSourceIds)??void 0,dataSourceParameters:((w=e==null?void 0:e.templateConfig)==null?void 0:w.dataSourceParameters)??{},enabledGenerate:((b=e==null?void 0:e.templateConfig)==null?void 0:b.enabledGenerate)??!1,agentId:((y=e==null?void 0:e.templateConfig)==null?void 0:y.agentId)??void 0}};return t.doc.transact(()=>{n.pages[s.id]=s,n.pageIds.splice(o??n.pageIds.length,0,s.id)}),s},addRoute:(e,o)=>{const r=(e==null?void 0:e.id)??x(),s={...e,id:r,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),path:(e==null?void 0:e.path)??`/${r}`,handler:(e==null?void 0:e.handler)??"Pages Kit",isPublic:(e==null?void 0:e.isPublic)??!0,params:(e==null?void 0:e.params)??[],enabledGenerate:(e==null?void 0:e.enabledGenerate)??!1,displayTemplateId:(e==null?void 0:e.displayTemplateId)??void 0,dataSource:(e==null?void 0:e.dataSource)??{}};return t.doc.transact(()=>{n.routes??(n.routes={}),n.routeIds??(n.routeIds=[]),n.routes[s.id]=s,n.routeIds.splice(o??n.routeIds.length,0,s.id)}),s},deleteRoute:e=>{var r;if(!e)return;const o=(r=n.routeIds)==null?void 0:r.indexOf(e);o!==void 0&&o!==-1&&t.doc.transact(()=>{var s,c;(s=n.routeIds)==null||s.splice(o,1),(c=n.routes)==null||delete c[e]})},deletePage:e=>{const o=n.pageIds.indexOf(e);o!==-1&&t.doc.transact(()=>{n.pageIds.splice(o,1),delete n.pages[e]})},movePage:(e,o)=>{const{pageIds:r}=n,s=r.indexOf(e);s>=0&&r.splice(o,0,...r.splice(s,1))},addSection:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const c={...o,id:o.id??x(),isTemplateSection:o.isTemplateSection??!0,llmConfig:o.llmConfig??{}};return t.doc.transact(()=>{s.sections[c.id]=c,s.sectionIds.splice(r??s.sectionIds.length,0,c.id)}),c},deleteSection:(e,o)=>{const r=n.pages[e];if(!r)throw new Error(`Page ${e} is not exists`);const s=r.sectionIds.indexOf(o);s!==-1&&t.doc.transact(()=>{r.sectionIds.splice(s,1),delete r.sections[o]})},toggleSectionVisibility:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const c=s.sections[o];c&&(c.visibility=r)},moveSection:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const{sectionIds:c}=s,a=c.indexOf(o);a>=0&&c.splice(r,0,...c.splice(a,1))},addDataSource:e=>{const o=e.id??x(),r={...e??{},id:o,createdAt:new Date().toISOString()};return t.doc.transact(()=>{n.dataSourceIds??(n.dataSourceIds=[]),n.dataSources??(n.dataSources={}),n.dataSourceIds.push(o),n.dataSources[o]=r}),n.dataSources[o]},deleteDataSource:e=>{const o=n.dataSourceIds.indexOf(e);o!==-1&&t.doc.transact(()=>{n.dataSourceIds.splice(o,1),delete n.dataSources[e]})}}),[n,t.doc]);return{...t,state:n,actions:p,localActions:j,get currentPage(){const{localState:{currentPageId:e}}=t;return e?n.pages[e]:void 0},get currentSection(){var s,c,a;const{localState:{currentPageId:e,...o}}=t;if(!e)return;const r=(c=(s=o.pages)==null?void 0:s[e])==null?void 0:c.currentSectionId;if(r)return(a=n.pages[e])==null?void 0:a.sections[r]},get currentRoute(){var o;const{localState:{currentRouteId:e}}=t;return e?(o=n.routes)==null?void 0:o[e]:void 0}}},R=()=>{const{projectId:t}=V.useParams();return t??z()??""};function K(t){var S,g;const{resources:n}=t;if(!n.components)return{};const i={};return(g=(S=window==null?void 0:window.blocklet)==null?void 0:S.componentMountPoints)==null||g.forEach(P=>{i[P.did]=P}),Object.fromEntries(Object.entries(n.components).map(([P,{blockletId:j,component:p}])=>{var e;return[P,{data:p,blockletId:j,blockletTitle:((e=i[j])==null?void 0:e.title)||j}]}))}function Q(t){const{components:n}=t;return n||{}}function X(t){return{...K(t),...Q(t)}}const ke=()=>X(B().state);exports.ErrorView=Ie;exports.StoreProvider=_e;exports.api=L;exports.autoResizeImage=be;exports.getAllComponents=X;exports.getCustomComponents=Q;exports.getImageAbsoluteUrl=Ce;exports.getMountPoint=pe;exports.getProjectIdFromPathnameOrWindow=z;exports.getProjectPageVersionKey=we;exports.getResourceComponents=K;exports.getWssURL=je;exports.nextId=x;exports.transformValue=Pe;exports.useAllComponents=ke;exports.useProjectId=R;exports.useStore=B;
|
|
1
|
+
"use strict";const _=require("react/jsx-runtime"),$=require("@mui/material"),h=require("ufo"),Z=require("@blocklet/js-sdk"),H=require("lodash/isEmpty"),ee=require("yaml"),te=require("@arcblock/ux/lib/Locale/context"),N=require("@syncedstore/core"),ne=require("@syncedstore/react"),oe=require("ahooks"),C=require("immer"),re=require("js-cookie"),se=require("lodash/debounce"),ce=require("nanoid"),d=require("react"),V=require("react-router-dom"),ie=require("y-indexeddb"),ae=require("y-websocket"),de=require("yjs");require("@blocklet/pages-kit/types");const E=t=>t&&t.__esModule?t:{default:t};function ue(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const S=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,S.get?S:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const le=E(H),fe=ue(ee),me=E(N),Se=E(re),W=E(se),pe=t=>{const n=blocklet==null?void 0:blocklet.componentMountPoints.find(i=>i.name===t);return n?n.mountPoint:"/"};function z(){const{pathname:t}=window.location,n=t.match(/\/admin\/(maker|previewer)\/([^/]+)/),i=n==null?void 0:n[2],S=window.__PROJECT_ID__;if(!i&&!S)throw new Error("Unable to get projectId from pathname");return i||S}function we(t){return`${t}:pages:version`}function Pe(t,n){return n==="yaml"?le.default(t)?"":fe.stringify(t,{indent:2}):n==="json"?JSON.parse(JSON.stringify(t||{})):n==="array"?JSON.parse(JSON.stringify(t||[])):t}function Ie({error:t}){return _.jsx($.Box,{children:_.jsx($.Alert,{severity:"error",children:t.message})})}var G;const k=((G=window.blocklet)==null?void 0:G.prefix)||"/",L=Z.createAxios({timeout:200*1e3}),ge=window.location.protocol==="https:"?"wss":"ws",je=t=>h.joinURL(`${ge}://${window.location.hostname}`,k,`api/${t}/ws/pages`),ye="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";var F;(F=blocklet==null?void 0:blocklet.componentMountPoints.find(t=>t.did===ye))!=null&&F.mountPoint||h.joinURL(k,"/image-bin");function Ce(t){return t&&!/^(https?:\/\/|\/)/.test(t)?window.location.origin+h.joinURL(k,"uploads",t):t}const he=window.innerWidth<=750;function be(t,n,i){if(!t||/\.gif/.test(t))return t;const S=(he?n/1.5:n)*(i==="quality"?1.5:1);return ve(t,{imageFilter:"resize",w:S,f:"webp"})}function ve(t,n){return!t||!n?t:h.withQuery(t,n)}async function xe(t){return L.get(`/api/projects/${t}`).then(n=>n.data)}async function Oe(t){return L.post(`/api/projects/${t.id}/update`,t).then(n=>n.data)}const Ee=500,x=ce.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",16),J=d.createContext(null);function _e({url:t,name:n,children:i,waitingSynced:S}){const[g,P]=d.useState(!1),{locale:j}=te.useLocaleContext(),p=R(),e=`${p}:MakerLocalState`,o=`${p}:${n}`,[r,s]=oe.useLocalStorageState(e,{defaultValue:{},listenStorageChange:!0}),c=d.useRef(r);c.current=r;const a=d.useMemo(()=>me.default({dataSourceIds:[],dataSources:{},pages:{},pageIds:[],routes:{},routeIds:[],components:{},supportedLocales:[],config:{},resources:{}}),[]),u=d.useMemo(()=>N.getYjsDoc(a),[a]);d.useMemo(()=>new ie.IndexeddbPersistence(o,u),[o,u]);const w=d.useMemo(()=>new ae.WebsocketProvider(t,o,u,{params:{token:Se.default.get("login_token")},resyncInterval:5*60*1e3}),[t,o,u]),b=d.useCallback(()=>{w&&(w.disconnect(),w.connect())},[w]),y=d.useMemo(()=>new de.UndoManager([u.getArray("pageIds"),u.getMap("pages"),u.getArray("supportedLocales"),u.getMap("config")],{doc:u}),[u]),[v,O]=d.useState(null),[A,M]=d.useState(!1),[q,D]=d.useState(void 0),T=d.useCallback(async()=>{if(p){M(!0);try{const l=await xe(p);O(l)}catch(l){console.error("Failed to fetch project:",l)}finally{M(!1)}}},[p]),U=d.useCallback(async(l,f)=>{var I;if(D(void 0),!!p){f!=null&&f.optimisticUpdate&&v&&O(m=>({...m,...l}));try{const m=await Oe({...l});O(m)}catch(m){console.error("Failed to update project:",m),f!=null&&f.optimisticUpdate&&O(v),D((I=m==null?void 0:m.response)==null?void 0:I.data)}}},[p,v]);d.useEffect(()=>{p&&T()},[p,T]);const Y=d.useMemo(()=>({doc:u,state:a,localState:{...r,currentLocale:j},setLocalState:l=>s(typeof l=="function"?f=>l(f??{}):l),undoManager:y,projectState:{project:v,isLoadingProject:A,error:q},updateProject:U,forceSync:b}),[u,a,JSON.stringify(r),s,y,v,A,U,q,j,b]);return d.useEffect(()=>{y.on("stack-item-added",({stackItem:l})=>{const{currentPageId:f,currentLocale:I,pages:m}=c.current;l.meta.set("localState",{currentPageId:f,currentLocale:I,pages:m})}),y.on("stack-item-popped",({stackItem:l})=>{const f=l.meta.get("localState");f&&s(I=>({...I,...f}))})},[y,s]),d.useEffect(()=>{w.awareness.setLocalState(r)},[w,r]),d.useEffect(()=>{w.once("synced",()=>P(!0));const l=()=>{s(m=>({...m,networkStatus:void 0}))},f=()=>{s(m=>({...m,networkStatus:"offline"}))},I=W.default(({status:m})=>{m==="connected"?l():m==="disconnected"&&f()},Ee);return w.on("status",I),window.addEventListener("online",l),window.addEventListener("offline",f),()=>{w.off("status",I),window.removeEventListener("online",l),window.removeEventListener("offline",f)}},[w,s]),S&&!g?null:_.jsx(J.Provider,{value:Y,children:i})}const B=()=>{const t=d.useContext(J);if(!t)throw new Error("Context is null");const n=ne.useSyncedStore(t.state),{setLocalState:i,localState:S}=t,g=V.useNavigate(),P=R(),j=d.useMemo(()=>({setCurrentSectionId:(e,o)=>{var r,s;e===S.currentPageId&&o===((s=(r=S.pages)==null?void 0:r[e])==null?void 0:s.currentSectionId)||(g(h.joinURL("/admin/maker",P??"","pages",e)),i(c=>C.produce(c,a=>{var u;a.currentPageId=e,a.currentComponentId=void 0,a.customComponentPreviewerProperties={},o!==void 0&&(a.pages??(a.pages={}),(u=a.pages)[e]??(u[e]={}),a.pages[e].currentSectionId=o??void 0),o?window.sessionStorage.setItem("iframe_show_id",`"${o}"`):window.sessionStorage.removeItem("iframe_show_id")})))},setCurrentComponentId:e=>{e!==S.currentComponentId&&(g(h.joinURL("/admin/maker",P??"","components",e)),i(o=>C.produce(o,r=>{r.currentComponentId=e,r.customComponentPreviewerProperties={}})))},setCurrentRouteId:({routeId:e,dynamicParams:o})=>{i(r=>C.produce(r,s=>{s.currentRouteId=e,s.currentDynamicParams=o}))},setCustomComponentPreviewerProperties:(()=>{const e={},o=W.default(()=>{i(r=>C.produce(r,s=>{s.customComponentPreviewerProperties={...s==null?void 0:s.customComponentPreviewerProperties,...e},Object.keys(e).forEach(c=>delete e[c])}))},5);return r=>{Object.assign(e,r),o()}})(),setRouteGenerateProcess:e=>{i(o=>C.produce(o,r=>{e?r.routeGenerateProcess={...r.routeGenerateProcess,...e}:r.routeGenerateProcess={}}))},resetRouteGenerateProcess:()=>{i(e=>C.produce(e,o=>{o.routeGenerateProcess={progress:"complete"}}))},setCurrentThemeMode:e=>{i(o=>C.produce(o,r=>{r.currentThemeMode=e}))}}),[i,g,P]),p=d.useMemo(()=>({addPage:(e,o)=>{var c,a,u,w,b,y;const r=(e==null?void 0:e.id)??x(),s={...e,id:r,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),slug:(e==null?void 0:e.slug)??`/${r}`,sections:(e==null?void 0:e.sections)??{},sectionIds:(e==null?void 0:e.sectionIds)??[],isPublic:(e==null?void 0:e.isPublic)??!0,templateConfig:(e==null?void 0:e.templateConfig)??{isTemplate:((c=e==null?void 0:e.templateConfig)==null?void 0:c.isTemplate)??!0,displayTemplateId:((a=e==null?void 0:e.templateConfig)==null?void 0:a.displayTemplateId)??void 0,dataSourceIds:((u=e==null?void 0:e.templateConfig)==null?void 0:u.dataSourceIds)??void 0,dataSourceParameters:((w=e==null?void 0:e.templateConfig)==null?void 0:w.dataSourceParameters)??{},enabledGenerate:((b=e==null?void 0:e.templateConfig)==null?void 0:b.enabledGenerate)??!1,agentId:((y=e==null?void 0:e.templateConfig)==null?void 0:y.agentId)??void 0}};return t.doc.transact(()=>{n.pages[s.id]=s,n.pageIds.splice(o??n.pageIds.length,0,s.id)}),s},addRoute:(e,o)=>{const r=(e==null?void 0:e.id)??x(),s={...e,id:r,createdAt:(e==null?void 0:e.createdAt)??new Date().toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),path:(e==null?void 0:e.path)??`/${r}`,handler:(e==null?void 0:e.handler)??"Pages Kit",isPublic:(e==null?void 0:e.isPublic)??!0,params:(e==null?void 0:e.params)??[],enabledGenerate:(e==null?void 0:e.enabledGenerate)??!1,displayTemplateId:(e==null?void 0:e.displayTemplateId)??void 0,dataSource:(e==null?void 0:e.dataSource)??{}};return t.doc.transact(()=>{n.routes??(n.routes={}),n.routeIds??(n.routeIds=[]),n.routes[s.id]=s,n.routeIds.splice(o??n.routeIds.length,0,s.id)}),s},deleteRoute:e=>{var r;if(!e)return;const o=(r=n.routeIds)==null?void 0:r.indexOf(e);o!==void 0&&o!==-1&&t.doc.transact(()=>{var s,c;(s=n.routeIds)==null||s.splice(o,1),(c=n.routes)==null||delete c[e]})},deletePage:e=>{const o=n.pageIds.indexOf(e);o!==-1&&t.doc.transact(()=>{n.pageIds.splice(o,1),delete n.pages[e]})},movePage:(e,o)=>{const{pageIds:r}=n,s=r.indexOf(e);s>=0&&r.splice(o,0,...r.splice(s,1))},addSection:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const c={...o,id:o.id??x(),isTemplateSection:o.isTemplateSection??!0,llmConfig:o.llmConfig??{}};return t.doc.transact(()=>{s.sections[c.id]=c,s.sectionIds.splice(r??s.sectionIds.length,0,c.id)}),c},deleteSection:(e,o)=>{const r=n.pages[e];if(!r)throw new Error(`Page ${e} is not exists`);const s=r.sectionIds.indexOf(o);s!==-1&&t.doc.transact(()=>{r.sectionIds.splice(s,1),delete r.sections[o]})},toggleSectionVisibility:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const c=s.sections[o];c&&(c.visibility=r)},moveSection:(e,o,r)=>{const s=n.pages[e];if(!s)throw new Error(`Page ${e} is not exists`);const{sectionIds:c}=s,a=c.indexOf(o);a>=0&&c.splice(r,0,...c.splice(a,1))},addDataSource:e=>{const o=e.id??x(),r={...e??{},id:o,createdAt:new Date().toISOString()};return t.doc.transact(()=>{n.dataSourceIds??(n.dataSourceIds=[]),n.dataSources??(n.dataSources={}),n.dataSourceIds.push(o),n.dataSources[o]=r}),n.dataSources[o]},deleteDataSource:e=>{const o=n.dataSourceIds.indexOf(e);o!==-1&&t.doc.transact(()=>{n.dataSourceIds.splice(o,1),delete n.dataSources[e]})}}),[n,t.doc]);return{...t,state:n,actions:p,localActions:j,get currentPage(){const{localState:{currentPageId:e}}=t;return e?n.pages[e]:void 0},get currentSection(){var s,c,a;const{localState:{currentPageId:e,...o}}=t;if(!e)return;const r=(c=(s=o.pages)==null?void 0:s[e])==null?void 0:c.currentSectionId;if(r)return(a=n.pages[e])==null?void 0:a.sections[r]},get currentRoute(){var o;const{localState:{currentRouteId:e}}=t;return e?(o=n.routes)==null?void 0:o[e]:void 0}}},R=()=>{const{projectId:t}=V.useParams();return t??z()??""};function K(t){var S,g;const{resources:n}=t;if(!n.components)return{};const i={};return(g=(S=window==null?void 0:window.blocklet)==null?void 0:S.componentMountPoints)==null||g.forEach(P=>{i[P.did]=P}),Object.fromEntries(Object.entries(n.components).map(([P,{blockletId:j,component:p}])=>{var e;return[P,{data:p,blockletId:j,blockletTitle:((e=i[j])==null?void 0:e.title)||j}]}))}function Q(t){const{components:n}=t;return n||{}}function X(t){return{...K(t),...Q(t)}}const ke=()=>X(B().state);exports.ErrorView=Ie;exports.StoreProvider=_e;exports.api=L;exports.autoResizeImage=be;exports.getAllComponents=X;exports.getCustomComponents=Q;exports.getImageAbsoluteUrl=Ce;exports.getMountPoint=pe;exports.getProjectIdFromPathnameOrWindow=z;exports.getProjectPageVersionKey=we;exports.getResourceComponents=K;exports.getWssURL=je;exports.nextId=x;exports.transformValue=Pe;exports.useAllComponents=ke;exports.useProjectId=R;exports.useStore=B;
|
package/lib/cjs/home.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-DytLDIZR.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/pages-kit/utils/data-source");require("@blocklet/pages-kit/utils/route");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-5NwrYcJ5.js");const e=require("./chunks/home-WKpO7IF-.js");exports.HomeView=e.HomeView;exports.PageRoutes=e.PageRoutes;exports.PageView=e.PageView;exports.PageViewByPath=e.PageViewByPath;exports.PageViewWithDataSource=e.PageViewWithDataSource;exports.TranslucentHeader=e.TranslucentHeader;exports.default=e.Home;
|
package/lib/cjs/setting.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),R=require("./chunks/state-tJl9YPbn.js"),De=require("@arcblock/ux/lib/Empty"),_=require("@arcblock/ux/lib/Locale/context"),ie=require("@blocklet/code-editor"),Ee=require("@mui/icons-material/AddRounded"),Ve=require("@mui/icons-material/ArrowDownward"),ze=require("@mui/icons-material/ArrowUpward"),Ae=require("@mui/icons-material/DeleteOutline"),r=require("@mui/material"),Ne=require("lodash/sortBy"),C=require("react"),ke=require("react-use"),ye=require("@blocklet/pages-kit/builtin/color-picker"),qe=require("./chunks/config-string-CN-vvf1B.js"),Fe=require("lodash/isEmpty"),Ue=require("lodash/set"),Me=require("yaml"),F=require("@blocklet/pages-kit/builtin/uploader"),We=require("lodash/cloneDeep"),Ke=require("@arcblock/ux/lib/Toast"),Q=require("@blocklet/pages-kit/components"),Le=require("@blocklet/pages-kit/utils/property"),Se=require("@mui/base"),D=require("@mui/icons-material"),Y=require("@syncedstore/core"),Pe=require("ahooks"),Je=require("lodash/assign"),He=require("lodash/get"),Ye=require("lodash/has"),$e=require("lodash/isEqual"),Ge=require("lodash/isNil"),Qe=require("lodash/isObject"),Xe=require("lodash/keyBy"),Ze=require("lodash/omit"),et=require("lodash/pick"),tt=require("lodash/reduce"),z=require("material-ui-popup-state/hooks"),rt=require("react-error-boundary"),st=require("@emotion/css"),te=require("react-dnd"),T=e=>e&&e.__esModule?e:{default:e};function lt(e){if(e&&e.__esModule)return e;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const o=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(s,l,o.get?o:{enumerable:!0,get:()=>e[l]})}}return s.default=e,Object.freeze(s)}const Z=T(De),ot=T(Ee),it=T(Ve),nt=T(ze),ct=T(Ae),E=T(Ne),ne=T(Fe),we=T(Ue),re=lt(Me),at=T(We),se=T(Ke),ut=T(Je),dt=T(He),pt=T(Ye),mt=T($e),X=T(Ge),xt=T(Qe),ft=T(Xe),jt=T(Ze),bt=T(et),ht=T(tt);function yt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"warning",variant:"outlined",disabled:s,onClick:e,...o,children:t.jsx(ct.default,{fontSize:"small"})})}function gt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:e,...o,children:t.jsx(nt.default,{fontSize:"small"})})}function vt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:e,...o,children:t.jsx(it.default,{fontSize:"small"})})}function kt({label:e,value:s,onChange:l,disabled:o=!1,itemLabel:p="",emptyHeight:h=40,property:d,renderItem:g,...v}){const{t:b,locale:P}=_.useLocaleContext(),y=ke.useUpdate(),i=C.useCallback(m=>{l(R.transformValue(m,d.type))},[l,d.type]),n=C.useMemo(()=>Array.isArray(s)?s:[],[s]),c=C.useCallback(()=>{const m=[...n,""];i(m),y()},[n,i,y]),u=C.useCallback(()=>{if(!d||!d.subProperties)return c();const m={};E.default(Object.values(d.subProperties),"index").forEach(({data:B})=>{var A,N;if(!B.key)return;const V=((N=(A=B.locales)==null?void 0:A[P])==null?void 0:N.defaultValue)??"";m[B.key]=V});const O=[...n,m];i(O),y()},[n,i,y,d,P,c]),x=C.useCallback(m=>{try{const w=JSON.parse(m);Array.isArray(w)?i(w):console.error("JSON解析结果不是数组")}catch(w){console.error("JSON解析错误:",w)}},[i]),S=C.useCallback(m=>{const w=n.filter((O,B)=>B!==m);i(w),y()},[n,i,y]),a=C.useCallback(m=>{if(m<=0)return;const w=[...n],O=w[m];w[m]=w[m-1],w[m-1]=O,i(w),y()},[n,i,y]),j=C.useCallback(m=>{if(m>=n.length-1)return;const w=[...n],O=w[m];w[m]=w[m+1],w[m+1]=O,i(w),y()},[n,i,y]),f=C.useCallback((m,w)=>{const O=[...n];O[m]=w,i(O)},[n,i]),k=d&&d.subProperties&&Object.keys(d.subProperties).length>0,I=C.useMemo(()=>[{field:"index",headerName:"#",width:40,align:"center",renderCell:({index:m})=>t.jsx(r.Typography,{variant:"body1",sx:{bgcolor:"action.hover",borderRadius:"50%",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:m+1})},{field:"content",headerName:"",renderCell:({row:m,index:w})=>g&&k?g({item:m,index:w,property:d,onChange:O=>f(w,O)}):t.jsx(r.TextField,{fullWidth:!0,size:"small",disabled:o,value:m,placeholder:p||`${b("item")} ${w+1}`,onChange:O=>f(w,O.target.value),...v})},{field:"actions",headerName:"",width:30,align:"center",renderCell:({index:m})=>t.jsxs(r.Stack,{direction:"column",spacing:.25,children:[t.jsx(gt,{disabled:o||m===0,onClick:()=>a(m)}),t.jsx(vt,{disabled:o||m===n.length-1,onClick:()=>j(m)}),t.jsx(yt,{disabled:o,onClick:()=>S(m)})]})}],[g,k,d,f,p,b,o,v,S,a,j,n.length]);return k?t.jsxs(r.Stack,{width:"100%",gap:1,children:[e&&t.jsx(r.FormLabel,{children:e}),n.length>0?t.jsx(r.TableContainer,{component:r.Paper,variant:"outlined",sx:{borderRadius:1,mb:1},children:t.jsxs(r.Table,{size:"small",sx:{"& .MuiTableCell-root":{py:.25,px:1,whiteSpace:"nowrap"},"& .MuiTableCell-head":{backgroundColor:"action.hover",py:.25,px:1},borderCollapse:"collapse"},children:[t.jsx(r.TableHead,{sx:{display:"none"},children:t.jsx(r.TableRow,{children:I.map(m=>t.jsx(r.TableCell,{width:m.width,align:m.align||"left",sx:{fontWeight:"bold"},children:m.renderHeader?m.renderHeader():m.headerName},m.field))})}),t.jsx(r.TableBody,{children:n.map((m,w,O)=>t.jsx(r.TableRow,{sx:{borderBottom:w<O.length-1?"1px solid":"none",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:I.map(B=>t.jsx(r.TableCell,{width:B.width,align:B.align||"left",sx:{borderBottom:"none"},children:B.renderCell({row:m,index:w,onChange:V=>f(w,V)})},`${w}-${B.field}`))},w))})]})}):t.jsx(Z.default,{style:{fontSize:12,height:h},children:b("maker.properties.arrayEmpty")}),t.jsx(r.Button,{fullWidth:!0,size:"small",variant:"outlined",disabled:o,startIcon:t.jsx(ot.default,{}),onClick:u,children:b("maker.properties.addArrayItem")})]}):t.jsxs(r.Stack,{width:"100%",gap:1,children:[e&&t.jsx(r.FormLabel,{children:e}),t.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,minHeight:150},children:t.jsx(ie.CodeEditor,{keyId:d.id,locale:P,language:"json",value:JSON.stringify(n,null,2),onChange:m=>x(m||""),fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},d.id)})]})}function St({value:e,onChange:s,...l}){const o=C.useRef(null);return t.jsxs(t.Fragment,{children:[t.jsx(qe.ConfigString,{...l,value:e,onChange:s,InputProps:{endAdornment:t.jsx(r.InputAdornment,{position:"end",children:t.jsx(ye.ColorItem,{color:e??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var p;(p=o.current)==null||p.open({value:e??""})}})})}}),t.jsx(ye.ConfigColorDialog,{ref:o,onSave:({value:p},h)=>{s(p),h()}})]})}function Pt({label:e,value:s,onChange:l,property:o,component:p,defaultLocale:h,allComponents:d,PropertyValueField:g,onUpload:v}){const{locale:b}=_.useLocaleContext(),P=C.useRef(null);if(!ne.default(o.subProperties)){const i=E.default(Object.values(o.subProperties||{}),"index").filter(n=>n.data.visible!==!1&&n.data.key);return t.jsxs(r.Stack,{width:"100%",children:[t.jsx(r.FormLabel,{sx:{px:.25,py:.5},children:e}),t.jsx(r.Box,{children:t.jsx(r.Box,{sx:{position:"relative"},children:i.map((n,c)=>{const{data:u}=n,x=u.key??u.id,S=c===i.length-1;let a=null;try{s&&typeof s=="object"?a=s[x]:typeof s=="string"&&(a=(o.type==="yaml"?re.parse(s||""):JSON.parse(s||"{}"))[x])}catch{}a==null&&(u.locales&&b&&u.locales[b]?a=u.locales[b].defaultValue:u.locales&&h&&u.locales[h]&&(a=u.locales[h].defaultValue));const j=k=>{try{let I={};if(typeof s=="string")try{I=o.type==="yaml"?re.parse(s||""):JSON.parse(s||"{}")}catch{}else typeof s=="object"&&s!==null&&(I={...s});we.default(I,x,k);const m=R.transformValue(I,o.type);l==null||l(m)}catch(I){console.error("Error updating property:",I)}},f=8;return t.jsxs(r.Box,{sx:{mb:S?0:1,display:"flex",flexDirection:"row"},children:[t.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[t.jsx(r.Box,{sx:{position:"absolute",left:f,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),t.jsx(r.Box,{sx:{position:"absolute",left:f,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!S&&t.jsx(r.Box,{sx:{position:"absolute",left:f,top:16,bottom:-8,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),t.jsx(r.Box,{sx:{flexGrow:1},children:t.jsx(g,{component:p,property:u,value:a,onChange:j,size:"small",fullWidth:!0,defaultLocale:h,allComponents:d})})]},u.id)})})})]})}return t.jsx(r.Stack,{width:"100%",gap:2,children:t.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[t.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:e}),t.jsx(ie.CodeEditor,{keyId:o.id,locale:b,language:o.type==="yaml"?"yaml":"json",value:typeof s=="string"?s:"",onChange:i=>{l==null||l(i)},onUpload:i=>{P.current=i,v&&v(i)},fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},o.id),t.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:t.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:t.jsx(r.Box,{component:"span",sx:{opacity:0},children:e})})})]})})}const wt=["string","multiline","json","yaml","url","component","custom"];function ge(e){return e.type?!wt.includes(e.type):!1}function Ie({disabled:e,list:s,renderItem:l,...o}){const p=C.useRef(null),h=C.useId(),d=Pe.useUpdate(),g=E.default(Object.entries(s),n=>n[1].index).map(n=>n[0]),v=C.useRef(g),b=C.useCallback(n=>{v.current=n,d()},[d]),P=C.useCallback(({index:n},{index:c})=>{const u=[...v.current];u.splice(c,0,...u.splice(n,1)),b(u)},[b]);C.useEffect(()=>{b(g)},[g.join("-")]);const[{isOver:y},i]=te.useDrop({accept:h,collect:n=>({isOver:n.isOver()}),canDrop:()=>!e,drop:()=>{var u;const n=()=>{v.current.forEach((x,S)=>{const a=s[x];a&&(a.index=S)})},c=(u=Y.getYjsValue(s))==null?void 0:u.doc;c?c.transact(()=>{n()}):n()}});return C.useEffect(()=>{y||b(g)},[y]),i(p),t.jsx(r.Box,{...o,ref:p,className:st.cx(y&&"isDragging"),children:v.current.map((n,c)=>t.jsx(It,{type:h,disabled:e,id:n,index:c,itemIndex:u=>v.current.indexOf(u),move:P,children:u=>{const x=s[n];return x?l(x.data,c,u):null}},n))})}function It({disabled:e,id:s,index:l,type:o,children:p,itemIndex:h,move:d}){const g=C.useRef(),[{isDragging:v},b,P]=te.useDrag({type:o,item:()=>({id:s}),canDrag:()=>!e,collect:i=>({isDragging:i.isDragging()})}),[,y]=te.useDrop({accept:o,canDrop:()=>!e,hover(i,n){var f;if(!g.current)return;const c=h(i.id),u=l;if(c===u)return;const x=(f=g.current)==null?void 0:f.getBoundingClientRect(),S=(x.bottom-x.top)/2,j=n.getClientOffset().y-x.top;c<u&&j<S||c>u&&j>S||d({id:i.id,index:c},{id:s,index:l})}});return typeof p=="function"?p({isDragging:v,drag:b,drop:i=>(g.current=i,y(i)),preview:P}):(b(y(P(g))),t.jsx(r.Box,{ref:g,children:p}))}function Ct({drop:e,preview:s,drag:l,disabled:o,isDragging:p,children:h,onDelete:d,onVisibilityChange:g,visible:v=!0,actions:b,alwaysShowActions:P=!1}){const{t:y}=_.useLocaleContext();return t.jsx(r.Box,{ref:e,sx:{":hover .hover-visible":{maxWidth:"100%"},opacity:v?1:.5},children:t.jsxs(r.Box,{sx:{position:"relative"},children:[t.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:.5,bgcolor:p?"action.hover":"background.paper",opacity:.9999},children:h}),!o&&t.jsx(r.Box,{className:P?"":"hover-visible",sx:{maxWidth:P?"100%":0,overflow:"hidden",position:"absolute",right:2,top:2,transition:"max-width 0.3s ease-in-out"},children:t.jsxs(r.Stack,{direction:"row",sx:{bgcolor:i=>r.alpha(i.palette.grey[200],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[b,g&&t.jsx(r.Tooltip,{title:y(v?"hideParameter":"showParameter"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{onClick:()=>g(!v),children:v?t.jsx(D.VisibilityOffRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}}):t.jsx(D.VisibilityRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),d&&t.jsx(r.Tooltip,{title:y("delete"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{onClick:d,children:t.jsx(D.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),t.jsx(r.Tooltip,{title:y("dragSort"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{ref:l,children:t.jsx(D.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function Ot({label:e,value:s,onChange:l}){const[o,p]=C.useState(!1);return t.jsxs(r.Stack,{gap:1,children:[t.jsx(r.TextField,{label:e,size:"small",value:s,onChange:h=>l==null?void 0:l(h.target.value),InputProps:{endAdornment:t.jsx(F.UploaderButton,{onChange:({response:h})=>{var g;const d=(g=h==null?void 0:h.data)==null?void 0:g.filename;d&&(l==null||l(d))}})}}),s&&t.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:R.getImageAbsoluteUrl(s),alt:e,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>p(!0)}),t.jsx(r.Dialog,{open:o,onClose:()=>p(!1),children:t.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:R.getImageAbsoluteUrl(s),alt:e})})]})}function le(e,s=""){return ht.default(e,(l,o,p)=>{const h=s?`${s}.${p}`:p;return xt.default(o)?ut.default(l,le(o,h)):l[h]=o,l},{})}const Tt=[{value:"string",label:"Text"},{value:"multiline",label:"Text (Multiline)"},{value:"number",label:"Number"},{value:"decimal",label:"Decimal"},{value:"boolean",label:"Boolean"},{value:"color",label:"Color"},{value:"url",label:"URL (Upload)"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"array",label:"Array"},{value:"component",label:"Component"},{value:"custom",label:"Custom (Render by a Component)"}];function G(e,s,l){return!e||!l?!1:Object.values(e).some(({data:o})=>o.id!==s&&o.key===l)}function oe(e,s){var l;return!e||!s?!1:((l=e[s])==null?void 0:l.data.visible)??!0}function Bt({componentId:e}){const{state:{components:s}}=R.useStore(),l=s[e],o=l==null?void 0:l.data;return o?t.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:t.jsx(r.Box,{p:2,children:t.jsx(rt.ErrorBoundary,{FallbackComponent:R.ErrorView,resetKeys:[e],children:t.jsx(Rt,{value:o})})})}):null}function Rt({value:e}){var b,P,y;const{t:s}=_.useLocaleContext(),{localState:{currentLocale:l,customComponentPreviewerProperties:o},state:{config:{defaultLocale:p}},localActions:{setCustomComponentPreviewerProperties:h}}=R.useStore(),d=Y.getYjsValue(e).doc,g=R.useAllComponents(),v=Pe.useReactive({propertiesValue:{...h}});return C.useEffect(()=>{const i=Object.fromEntries(Object.values(e.properties??{}).map(({data:n})=>{var c,u,x,S,a;return[n.id,{value:((c=v.propertiesValue[n.id])==null?void 0:c.value)??Le.parsePropertyValue(n,((x=(u=n.locales)==null?void 0:u[l])==null?void 0:x.defaultValue)??((a=(S=n.locales)==null?void 0:S[p])==null?void 0:a.defaultValue),{locale:l,defaultLocale:p})}]}));h(i)},[JSON.stringify(v.propertiesValue)]),t.jsx(r.Stack,{height:"100%",children:t.jsxs(r.Stack,{gap:2,children:[t.jsx(Ce,{config:e}),t.jsx(Te,{config:e,currentLocale:l,defaultLocale:p,allComponents:g,onUpdateConfig:i=>{d.transact(()=>{i(e)})}}),t.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[t.jsx(r.Typography,{variant:"subtitle1",children:s("renderer")}),t.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((b=e.renderer)==null?void 0:b.type)||"react-component",onChange:i=>{d.transact(()=>{const n=i.target.value;e.renderer??(e.renderer={type:n}),e.renderer.type=n})},children:[t.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),t.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((P=e.renderer)==null?void 0:P.type)==="component"&&t.jsx(Nt,{value:e}),((y=e.renderer)==null?void 0:y.type)==="react-component"&&t.jsx(At,{value:e}),t.jsx(ce,{config:e,currentLocale:l,defaultLocale:p,allComponents:g,propertiesValue:o,onChange:({value:i,id:n,path:c})=>{const u=[...c,"data"];if(!dt.default(e,u)){se.default.warning(s("cannotFindPropertyKey",{key:u.join(".")}));return}v.propertiesValue[n]={value:i.value}}})]})})}function Ce({config:e}){const{t:s}=_.useLocaleContext();return t.jsx(F.UploaderProvider,{children:t.jsxs(r.Stack,{gap:2,children:[t.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),t.jsx(r.TextField,{label:s("name"),size:"small",value:e.name||"",onChange:l=>e.name=l.target.value}),t.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:e.description||"",onChange:l=>e.description=l.target.value}),t.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:e.tags??[],onChange:(l,o)=>e.tags=o,renderInput:l=>t.jsx(r.TextField,{label:s("tags"),...l})}),t.jsx(Ot,{label:s("previewImage"),value:e.previewImage||"",onChange:l=>e.previewImage=l})]})})}function Oe({data:e,params:s,visible:l,config:o,currentLocale:p,defaultLocale:h,allComponents:d,onUpdateConfig:g}){var P,y,i,n,c,u;const{t:v}=_.useLocaleContext(),b=C.useMemo(()=>e.type==="json"||e.type==="yaml"||e.type==="array"?Vt:U,[e.type]);return t.jsx(Ct,{preview:s.preview,drop:s.drop,drag:s.drag,isDragging:s.isDragging,onDelete:()=>{g(x=>{if(x.properties){const a=Object.entries(x.properties).sort(([,f],[,k])=>f.index-k.index);delete x.properties[e.id],a.filter(([f])=>f!==e.id).forEach(([,f],k)=>{f.index=k})}})},visible:l,onVisibilityChange:x=>{g(S=>{const a=S.properties[e.id].data;a.visible=x})},alwaysShowActions:!0,children:t.jsxs(r.Stack,{direction:"column",gap:2,children:[t.jsx(r.TextField,{label:v("key"),size:"small",required:!0,sx:{width:"calc(100% - 80px - 8px)",flex:1,"& .MuiOutlinedInput-root":{borderColor:e.key?G(o.properties,e.id,e.key)?"warning.main":void 0:"error.main"},"& .MuiFormLabel-root":{color:e.key?G(o.properties,e.id,e.key)?"warning.main":"text.secondary":"error.main"},"& .MuiFormLabel-root.Mui-focused":{color:e.key?G(o.properties,e.id,e.key)?"warning.main":"primary.main":"error.main"}},value:e.key||"",onChange:x=>{g(S=>{const a=S.properties[e.id].data;a.key=x.target.value.trim()})},InputProps:{endAdornment:!e.key||e.key&&G(o.properties,e.id,e.key)?t.jsx(r.InputAdornment,{position:"end",sx:{width:16,ml:0},children:t.jsx(r.Tooltip,{title:e.key?v("duplicateKey"):v("requiredKey"),children:t.jsx(D.InfoRounded,{sx:{color:e.key?"warning.main":"error.main",fontSize:16}})})}):null}}),t.jsxs(r.Stack,{direction:"row",gap:1,children:[t.jsx(r.TextField,{label:v("label"),size:"small",sx:{flex:1},value:(((y=(P=e.locales)==null?void 0:P[p])==null?void 0:y.name)??((n=(i=e.locales)==null?void 0:i[h])==null?void 0:n.name))||"",onChange:x=>{g(S=>{var j;const a=S.properties[e.id].data;a.locales??(a.locales={}),(j=a.locales)[p]??(j[p]={}),a.locales[p].name=x.target.value})}}),t.jsx(r.TextField,{label:v("type"),size:"small",select:!0,sx:{flex:1},value:e.type==="string"&&e.multiline?"multiline":e.type||"string",onChange:x=>{g(S=>{const a=S.properties[e.id].data;if(a.locales)for(const f of Object.keys(a.locales))a.locales[f].defaultValue=void 0;const j=x.target.value;j==="multiline"?(a.type="string",a.multiline=!0):(typeof a.multiline<"u"&&delete a.multiline,a.type=j)})},children:Tt.map(x=>t.jsx(r.MenuItem,{value:x.value,children:x.label},x.value))})]}),t.jsxs(r.Stack,{direction:"row",gap:1,children:[t.jsx(b,{allComponents:d,defaultLocale:h,component:o,property:e,label:v("defaultValue"),size:"small",fullWidth:!0,value:(u=(c=e.locales)==null?void 0:c[p])==null?void 0:u.defaultValue,onChange:(x,S)=>{g(a=>{var f;const j=a.properties[e.id].data;if(S!=null&&S.forceUpdateProperty){const k=le(j),I=le(x);Object.keys(I).forEach(m=>{k[m]||we.default(j,m,I[m])})}else j.locales??(j.locales={}),(f=j.locales)[p]??(f[p]={}),j.locales[p].defaultValue=x})}}),e.type==="custom"?t.jsx(r.Box,{children:t.jsx(Dt,{property:e,allComponents:d})}):null]})]})})}function _t(e,s){const[l,o]=C.useState(0);return C.useEffect(()=>{const h=setTimeout(()=>{if(e.current){let d=e.current.parentElement,g=0;for(;d;)d.classList.contains("property-container")&&g++,d=d.parentElement;o(g)}},100);return()=>clearTimeout(h)},[e,s]),l}function Te({config:e,currentLocale:s,defaultLocale:l,allComponents:o,onUpdateConfig:p,useI18nEditor:h=!0}){const{t:d}=_.useLocaleContext(),g=z.usePopupState({variant:"dialog"}),v=e.properties&&E.default(Object.values(e.properties),"index");return t.jsx(F.UploaderProvider,{children:t.jsxs(r.Stack,{gap:2,children:[t.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[t.jsx(r.Typography,{variant:"subtitle1",children:d("properties")}),t.jsx(r.Box,{flex:1}),h&&t.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...z.bindTrigger(g),children:t.jsx(D.TranslateRounded,{fontSize:"small"})})]}),e.properties&&Object.keys(e.properties).length>0?t.jsx(Ie,{component:r.Stack,gap:2,list:e.properties,renderItem:(b,P,y)=>{const i=oe(e.properties,b.id);return t.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:i?"1px solid":"1px dashed",borderColor:"divider"},children:t.jsx(r.Stack,{gap:2,children:t.jsx(Oe,{data:b,params:y,visible:i,config:e,currentLocale:s,defaultLocale:l,allComponents:o,onUpdateConfig:p})})},b.id)}}):t.jsx(Z.default,{style:{fontSize:12},children:d("maker.properties.noProperties")}),t.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",onClick:()=>{p(b=>{var y;const P=R.nextId();b.properties??(b.properties={}),(y=b.properties)[P]??(y[P]={index:(v==null?void 0:v.length)||0,data:{id:P}})})},startIcon:t.jsx(D.AddRounded,{}),children:d("addObject",{object:d("property")})}),h&&t.jsx(Be,{...z.bindDialog(g),component:e})]})})}function Dt({property:e,allComponents:s}){const l=z.usePopupState({variant:"popper"});return t.jsxs(t.Fragment,{children:[t.jsx(r.Button,{sx:{minWidth:0},...z.bindTrigger(l),children:t.jsx(D.SettingsRounded,{fontSize:"small"})}),t.jsx(r.Popper,{...z.bindPopper(l),children:t.jsx(Se.ClickAwayListener,{onClickAway:l.close,children:t.jsx(r.Paper,{children:t.jsx(r.Box,{width:500,p:2,children:t.jsx(ee,{value:e.componentId,onChange:(o,p)=>e.componentId=p,allComponents:s})})})})})]})}function Et({value:e,valueImmutable:s,onChange:l,defaultLocale:o,allComponents:p}){var P;const[h,d]=C.useState(!1),{t:g,locale:v}=_.useLocaleContext(),b=typeof(e==null?void 0:e.componentId)=="string"?(P=p[e.componentId])==null?void 0:P.data:void 0;return b?t.jsxs(r.Box,{sx:{width:"100%",position:"relative"},children:[t.jsx(r.IconButton,{sx:{minWidth:0},disabled:!b,size:"small",onClick:()=>d(!h),color:h?"primary":"default",children:t.jsx(D.SettingsRounded,{fontSize:"small"})}),h&&t.jsx(r.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,sx:{width:"100%",zIndex:10},children:t.jsxs(r.Paper,{elevation:1,sx:{mt:1,p:2,borderRadius:1,border:"1px solid",borderColor:"divider",width:"100%"},children:[t.jsx(r.Box,{width:"100%",mb:2,children:t.jsx(ce,{config:b,currentLocale:v,defaultLocale:o,allComponents:p,propertiesValue:e==null?void 0:e.properties,onChange:({id:y,value:i})=>{const n=at.default(i.value),c=JSON.parse(JSON.stringify(e));c!=null&&c.componentId&&(s?l==null||l({...c,properties:{...c.properties,[y]:{value:n}}}):(c.properties=c.properties??{},c.properties[y]={value:n},l==null||l(c)))}})}),t.jsx(r.Button,{size:"small",onClick:()=>d(!1),sx:{mt:1},children:g("close")})]})})]}):null}function Be({type:e="properties",component:s,...l}){var y,i,n;const{t:o}=_.useLocaleContext(),{state:{components:p,supportedLocales:h,config:{defaultLocale:d}}}=R.useStore(),g=R.useAllComponents(),v=Y.getYjsValue(s).doc,b=e==="properties"?s.properties:e==="parameters"&&((y=s.renderer)==null?void 0:y.type)==="component"?(i=p[s.renderer.componentId])==null?void 0:i.data.properties:void 0,P=((n=s.renderer)==null?void 0:n.type)==="component"?s:void 0;return t.jsxs(r.Dialog,{...l,fullWidth:!0,maxWidth:"lg",children:[t.jsx(r.DialogTitle,{children:o("i18nEditorTitle")}),t.jsx(r.DialogContent,{children:b&&t.jsx(r.Stack,{children:t.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[t.jsx(r.TableHead,{children:t.jsx(r.TableRow,{children:h.map(({locale:c,name:u})=>t.jsx(r.TableCell,{children:t.jsxs(r.Typography,{color:"text.primary",children:[u,d===c&&t.jsx(D.StarRounded,{sx:{fontSize:12}})]})},c))})}),t.jsx(r.TableBody,{children:E.default(Object.values(b),"index").map(({data:c})=>t.jsx(r.TableRow,{children:h.map(({locale:u})=>{var x,S,a,j,f,k,I,m,w,O,B,V,A,N,$,W,K,L,J,H,ae,ue,de,pe,me,xe;return t.jsx(r.TableCell,{children:t.jsx(r.Stack,{gap:1,children:e==="properties"?t.jsxs(t.Fragment,{children:[t.jsx(r.TextField,{size:"small",label:"Key",value:c.key||"",onChange:M=>{v.transact(()=>{c.key=M.target.value.trim()})}}),t.jsx(r.TextField,{size:"small",label:o("label"),value:(((S=(x=c.locales)==null?void 0:x[u])==null?void 0:S.name)??((j=(a=c.locales)==null?void 0:a[d])==null?void 0:j.name))||"",onChange:M=>{v.transact(()=>{var q;c.locales??(c.locales={}),(q=c.locales)[u]??(q[u]={}),c.locales[u].name=M.target.value})}}),t.jsx(r.Box,{children:t.jsx(U,{allComponents:g,defaultLocale:d,component:s,property:c,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:X.default((k=(f=c.locales)==null?void 0:f[u])==null?void 0:k.defaultValue),value:((m=(I=c.locales)==null?void 0:I[u])==null?void 0:m.defaultValue)??((O=(w=c.locales)==null?void 0:w[d])==null?void 0:O.defaultValue),onChange:M=>{v.transact(()=>{var q;c.locales??(c.locales={}),(q=c.locales)[u]??(q[u]={}),c.locales[u].defaultValue=M})}})})]}):e==="parameters"&&P?t.jsx(r.Box,{children:t.jsx(U,{allComponents:g,defaultLocale:d,component:s,property:c,size:"small",fullWidth:!0,valueImmutable:X.default((N=(A=(V=(B=P.renderer.properties)==null?void 0:B[c.id])==null?void 0:V.locales)==null?void 0:A[u])==null?void 0:N.value),value:((L=(K=(W=($=P.renderer.properties)==null?void 0:$[c.id])==null?void 0:W.locales)==null?void 0:K[u])==null?void 0:L.value)??((ue=(ae=(H=(J=P.renderer.properties)==null?void 0:J[c.id])==null?void 0:H.locales)==null?void 0:ae[d])==null?void 0:ue.value)??((pe=(de=c.locales)==null?void 0:de[u])==null?void 0:pe.defaultValue)??((xe=(me=c.locales)==null?void 0:me[d])==null?void 0:xe.defaultValue),onChange:M=>{v.transact(()=>{var q,fe,je,be,he;(q=P.renderer).properties??(q.properties={}),(fe=P.renderer.properties)[je=c.id]??(fe[je]={}),(be=P.renderer.properties[c.id]).locales??(be.locales={}),(he=P.renderer.properties[c.id].locales)[u]??(he[u]={}),P.renderer.properties[c.id].locales[u].value=M})}})}):null},c.id)},u)})},c.id))})]})})}),t.jsx(r.DialogActions,{children:t.jsx(r.Button,{onClick:c=>{var u;return(u=l.onClose)==null?void 0:u.call(l,c,"escapeKeyDown")},children:o("close")})})]})}const ve=(e,s)=>l=>{const o=[l.palette.info.main,l.palette.primary.main,l.palette.secondary.main,l.palette.success.main,l.palette.warning.main],p=Math.min(o.length-1,e),h=o[p],d=r.alpha(h,.5),g=r.alpha(h,1);return{borderColor:`${d} !important`,borderLeft:"3px solid !important",borderLeftColor:d,color:g,...s}};function Vt({property:e,onChange:s,defaultLocale:l,allComponents:o}){const{t:p,locale:h}=_.useLocaleContext(),d=C.useRef(null),g=_t(d,e),v=C.useCallback(()=>{if(!(e.type!=="json"&&e.type!=="yaml"&&e.type!=="array")&&e.subProperties)try{let b={};E.default(Object.values(e.subProperties),"index").filter(i=>i.data.visible!==!1&&i.data.key).forEach(({data:i})=>{var c,u,x,S;if(!i.key)return;let n=((u=(c=i.locales)==null?void 0:c[h])==null?void 0:u.defaultValue)??((S=(x=i.locales)==null?void 0:x[l])==null?void 0:S.defaultValue);if(i.type==="number")n=Number(n);else if(i.type==="boolean")n=n===!0||n==="true";else if((i.type==="json"||i.type==="yaml")&&typeof n=="string")try{i.type==="json"?n=JSON.parse(n):n=re.parse(n)}catch(a){console.error("Error parsing nested value",n,a),n={}}b[i.key]=n}),e.type==="array"&&!Array.isArray(b)&&(b=ne.default(b)?[]:[b]);const y=R.transformValue(b,e.type);s==null||s(y)}catch(b){console.error("Error converting structure to text:",b)}},[e,h,l,s]);return e.type!=="json"&&e.type!=="yaml"&&e.type!=="array"?null:t.jsxs(r.Stack,{direction:"column",gap:1.5,sx:{width:"100%"},ref:d,children:[t.jsx(r.Divider,{sx:{mt:-1},children:t.jsx(r.Typography,{variant:"caption",color:"text.secondary",children:p("maker.properties.subProperties")})}),e.subProperties&&Object.keys(e.subProperties).length>0?t.jsx(Ie,{component:r.Stack,gap:2,list:e.subProperties,renderItem:(b,P,y)=>{const i=b.visible!==!1;return t.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:i?"1px solid":"1px dashed","&":ve(g)},children:t.jsx(r.Stack,{gap:2,children:t.jsx(Oe,{data:b,params:y,visible:i,config:{properties:e.subProperties},currentLocale:h,defaultLocale:l,allComponents:o,onUpdateConfig:n=>{try{const c={properties:e.subProperties||{}};n(c);const u={...e,subProperties:c.properties};s==null||s(u,{forceUpdateProperty:!0}),v()}catch(c){console.error("Error updating property:",c)}}})})},b.id)}}):t.jsx(Z.default,{style:{fontSize:12,height:100},children:p("maker.properties.noSubProperties")}),t.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",size:"small",startIcon:t.jsx(D.AddRounded,{}),onClick:()=>{try{const b=e.subProperties||{},P=R.nextId(),i={index:Object.values(b).length,data:{id:P,key:"",type:"string",visible:!0,locales:{[h]:{name:"",defaultValue:""}},subProperties:{}}},n={...e,subProperties:{...b,[P]:i}};s==null||s(n,{forceUpdateProperty:!0}),v()}catch(b){console.error("Error adding property:",b)}},sx:{"&":ve(g,{})},children:p("maker.properties.addSubProperty")})]})}function U({component:e,property:s,value:l,onChange:o,valueImmutable:p,defaultLocale:h,allComponents:d,...g}){var n,c,u,x,S;const{locale:v}=_.useLocaleContext(),b=F.useUploader(),P=C.useRef(null),y=()=>{var j;const a=(j=b==null?void 0:b.current)==null?void 0:j.getUploader();a==null||a.open(),P.current&&a.onceUploadSuccess(({response:f})=>{var I,m;let k=((I=f==null?void 0:f.data)==null?void 0:I.filename)||"";k&&(k=`mediakit://${k}`,l&&!l.includes("mediakit://")&&(k+=" # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")),(m=P.current)==null||m.call(P,k)})},i=g.label??(((c=(n=s.locales)==null?void 0:n[v])==null?void 0:c.name)||((x=(u=s.locales)==null?void 0:u[h])==null?void 0:x.name)||s.key||s.id);if(s.type==="number")return t.jsx(zt,{...g,label:i,NumberProps:{value:["number","string"].includes(typeof l)?l:null,onChange:(a,j)=>o==null?void 0:o(j)}});if(s.type==="decimal")return t.jsx(r.TextField,{...g,label:i,type:"text",value:l??"",onChange:a=>{const j=a.target.value;if(j===""||j==="-"){o==null||o(j);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(j)){let k=j;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(k)&&(k=Number(k)),o==null||o(k)}}});if(s.type==="boolean")return t.jsx(r.FormControlLabel,{label:i,labelPlacement:"start",control:t.jsx(r.Switch,{checked:l===!0,onChange:(a,j)=>o==null?void 0:o(j)})});if(s.type==="color")return t.jsx(St,{label:i,value:l,onChange:a=>{o==null||o(a)}});if(s.type==="json"||s.type==="yaml")return t.jsx(Pt,{label:i,value:l,onChange:a=>{o==null||o(a)},property:s,component:e,defaultLocale:h,allComponents:d,PropertyValueField:U,onUpload:a=>{P.current=a,y()}});if(s.type==="custom"){const a=(S=d[s.componentId])==null?void 0:S.data;return a?t.jsx(r.Box,{width:"100%",children:t.jsx(Q.CustomComponentRenderer,{componentId:a.id,props:{label:i,value:l,onChange:o},locale:v,dev:{mode:"draft",components:d,defaultLocale:h}})}):t.jsx(r.TextField,{...g,label:i,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return t.jsxs(r.Stack,{width:"100%",direction:"column",gap:1,children:[t.jsx(ee,{allComponents:d,label:i,value:l==null?void 0:l.componentId,onChange:(a,j)=>{p||!l?o==null||o({...l&&JSON.parse(JSON.stringify(l)),componentId:j}):typeof l=="object"&&(l.componentId=j,o==null||o({...l&&JSON.parse(JSON.stringify(l)),componentId:j}))}}),(l==null?void 0:l.componentId)&&t.jsx(Et,{value:l,valueImmutable:p,onChange:o,defaultLocale:h,allComponents:d})]});if(!s.type||["string","url","multiline"].includes(s.type)){let a=s.type==="string"?s.multiline:void 0;s.type==="multiline"&&(a=!0);const j=s.type==="url"?l==null?void 0:l.url:l;return t.jsx(r.TextField,{...g,label:i,value:typeof j=="string"?j:"",multiline:a,minRows:a?2:void 0,maxRows:a?10:void 0,onChange:f=>o==null?void 0:o(s.type==="url"?{...l,url:f.target.value,mediaKitUrl:f.target.value}:f.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:t.jsxs(r.InputAdornment,{position:"end",children:[t.jsx(F.UploaderButton,{onChange:async({response:f})=>{var w,O,B;const k=((w=f==null?void 0:f.data)==null?void 0:w.url)||((O=f==null?void 0:f.data)==null?void 0:O.fileUrl);let I;k&&(I=await F.getImageSize(k).catch(()=>F.getVideoSize(k)).catch(()=>{}));let m=((B=f==null?void 0:f.data)==null?void 0:B.filename)||"";m&&(m=`mediakit://${m}`),o==null||o({url:k,mediaKitUrl:m,width:I==null?void 0:I.naturalWidth,height:I==null?void 0:I.naturalHeight})}}),t.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:t.jsx(D.InfoRounded,{sx:{cursor:"default",mr:1},fontSize:"small"})})]})}:void 0})}return s.type==="array"?t.jsx(kt,{label:i,value:Array.isArray(l)?l:[],onChange:a=>o==null?void 0:o(a),property:s,renderItem:({item:a,index:j,onChange:f})=>s.subProperties&&Object.keys(s.subProperties).length>0?t.jsx(r.Stack,{gap:1,width:"100%",children:E.default(Object.values(s.subProperties),"index").filter(k=>k.data.visible!==!1).map(({data:k})=>k.key?t.jsx(U,{component:e,property:k,value:a[k.key],onChange:I=>{const m={...a,[k.key]:I};f(m)},size:"small",fullWidth:!0,defaultLocale:h,allComponents:d},k.id):null)},j):t.jsx(r.TextField,{size:g.size,fullWidth:!0,value:a,onChange:k=>f(k.target.value)})}):(console.error("Unsupported property type",s.type),null)}function zt({NumberProps:e,...s}){const{getInputProps:l}=Se.unstable_useNumberInput(e),o=l();return t.jsx(r.TextField,{...s,inputProps:o})}const Re=`import React from '@blocklet/pages-kit/builtin/react'
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),R=require("./chunks/state-DytLDIZR.js"),De=require("@arcblock/ux/lib/Empty"),_=require("@arcblock/ux/lib/Locale/context"),ie=require("@blocklet/code-editor"),Ee=require("@mui/icons-material/AddRounded"),Ve=require("@mui/icons-material/ArrowDownward"),ze=require("@mui/icons-material/ArrowUpward"),Ae=require("@mui/icons-material/DeleteOutline"),r=require("@mui/material"),Ne=require("lodash/sortBy"),C=require("react"),ke=require("react-use"),ye=require("@blocklet/pages-kit/builtin/color-picker"),qe=require("./chunks/config-string-DV4-1k4s.js"),Fe=require("lodash/isEmpty"),Ue=require("lodash/set"),Me=require("yaml"),F=require("@blocklet/pages-kit/builtin/uploader"),We=require("lodash/cloneDeep"),Ke=require("@arcblock/ux/lib/Toast"),Q=require("@blocklet/pages-kit/components"),Le=require("@blocklet/pages-kit/utils/property"),Se=require("@mui/base"),D=require("@mui/icons-material"),Y=require("@syncedstore/core"),Pe=require("ahooks"),Je=require("lodash/assign"),He=require("lodash/get"),Ye=require("lodash/has"),$e=require("lodash/isEqual"),Ge=require("lodash/isNil"),Qe=require("lodash/isObject"),Xe=require("lodash/keyBy"),Ze=require("lodash/omit"),et=require("lodash/pick"),tt=require("lodash/reduce"),z=require("material-ui-popup-state/hooks"),rt=require("react-error-boundary"),st=require("@emotion/css"),te=require("react-dnd"),T=e=>e&&e.__esModule?e:{default:e};function lt(e){if(e&&e.__esModule)return e;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const o=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(s,l,o.get?o:{enumerable:!0,get:()=>e[l]})}}return s.default=e,Object.freeze(s)}const Z=T(De),ot=T(Ee),it=T(Ve),nt=T(ze),ct=T(Ae),E=T(Ne),ne=T(Fe),we=T(Ue),re=lt(Me),at=T(We),se=T(Ke),ut=T(Je),dt=T(He),pt=T(Ye),mt=T($e),X=T(Ge),xt=T(Qe),ft=T(Xe),jt=T(Ze),bt=T(et),ht=T(tt);function yt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"warning",variant:"outlined",disabled:s,onClick:e,...o,children:t.jsx(ct.default,{fontSize:"small"})})}function gt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:e,...o,children:t.jsx(nt.default,{fontSize:"small"})})}function vt({onClick:e,disabled:s,sx:l,...o}){return t.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:e,...o,children:t.jsx(it.default,{fontSize:"small"})})}function kt({label:e,value:s,onChange:l,disabled:o=!1,itemLabel:p="",emptyHeight:h=40,property:d,renderItem:g,...v}){const{t:b,locale:P}=_.useLocaleContext(),y=ke.useUpdate(),i=C.useCallback(m=>{l(R.transformValue(m,d.type))},[l,d.type]),n=C.useMemo(()=>Array.isArray(s)?s:[],[s]),c=C.useCallback(()=>{const m=[...n,""];i(m),y()},[n,i,y]),u=C.useCallback(()=>{if(!d||!d.subProperties)return c();const m={};E.default(Object.values(d.subProperties),"index").forEach(({data:B})=>{var A,N;if(!B.key)return;const V=((N=(A=B.locales)==null?void 0:A[P])==null?void 0:N.defaultValue)??"";m[B.key]=V});const O=[...n,m];i(O),y()},[n,i,y,d,P,c]),x=C.useCallback(m=>{try{const w=JSON.parse(m);Array.isArray(w)?i(w):console.error("JSON解析结果不是数组")}catch(w){console.error("JSON解析错误:",w)}},[i]),S=C.useCallback(m=>{const w=n.filter((O,B)=>B!==m);i(w),y()},[n,i,y]),a=C.useCallback(m=>{if(m<=0)return;const w=[...n],O=w[m];w[m]=w[m-1],w[m-1]=O,i(w),y()},[n,i,y]),j=C.useCallback(m=>{if(m>=n.length-1)return;const w=[...n],O=w[m];w[m]=w[m+1],w[m+1]=O,i(w),y()},[n,i,y]),f=C.useCallback((m,w)=>{const O=[...n];O[m]=w,i(O)},[n,i]),k=d&&d.subProperties&&Object.keys(d.subProperties).length>0,I=C.useMemo(()=>[{field:"index",headerName:"#",width:40,align:"center",renderCell:({index:m})=>t.jsx(r.Typography,{variant:"body1",sx:{bgcolor:"action.hover",borderRadius:"50%",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:m+1})},{field:"content",headerName:"",renderCell:({row:m,index:w})=>g&&k?g({item:m,index:w,property:d,onChange:O=>f(w,O)}):t.jsx(r.TextField,{fullWidth:!0,size:"small",disabled:o,value:m,placeholder:p||`${b("item")} ${w+1}`,onChange:O=>f(w,O.target.value),...v})},{field:"actions",headerName:"",width:30,align:"center",renderCell:({index:m})=>t.jsxs(r.Stack,{direction:"column",spacing:.25,children:[t.jsx(gt,{disabled:o||m===0,onClick:()=>a(m)}),t.jsx(vt,{disabled:o||m===n.length-1,onClick:()=>j(m)}),t.jsx(yt,{disabled:o,onClick:()=>S(m)})]})}],[g,k,d,f,p,b,o,v,S,a,j,n.length]);return k?t.jsxs(r.Stack,{width:"100%",gap:1,children:[e&&t.jsx(r.FormLabel,{children:e}),n.length>0?t.jsx(r.TableContainer,{component:r.Paper,variant:"outlined",sx:{borderRadius:1,mb:1},children:t.jsxs(r.Table,{size:"small",sx:{"& .MuiTableCell-root":{py:.25,px:1,whiteSpace:"nowrap"},"& .MuiTableCell-head":{backgroundColor:"action.hover",py:.25,px:1},borderCollapse:"collapse"},children:[t.jsx(r.TableHead,{sx:{display:"none"},children:t.jsx(r.TableRow,{children:I.map(m=>t.jsx(r.TableCell,{width:m.width,align:m.align||"left",sx:{fontWeight:"bold"},children:m.renderHeader?m.renderHeader():m.headerName},m.field))})}),t.jsx(r.TableBody,{children:n.map((m,w,O)=>t.jsx(r.TableRow,{sx:{borderBottom:w<O.length-1?"1px solid":"none",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:I.map(B=>t.jsx(r.TableCell,{width:B.width,align:B.align||"left",sx:{borderBottom:"none"},children:B.renderCell({row:m,index:w,onChange:V=>f(w,V)})},`${w}-${B.field}`))},w))})]})}):t.jsx(Z.default,{style:{fontSize:12,height:h},children:b("maker.properties.arrayEmpty")}),t.jsx(r.Button,{fullWidth:!0,size:"small",variant:"outlined",disabled:o,startIcon:t.jsx(ot.default,{}),onClick:u,children:b("maker.properties.addArrayItem")})]}):t.jsxs(r.Stack,{width:"100%",gap:1,children:[e&&t.jsx(r.FormLabel,{children:e}),t.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,minHeight:150},children:t.jsx(ie.CodeEditor,{keyId:d.id,locale:P,language:"json",value:JSON.stringify(n,null,2),onChange:m=>x(m||""),fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},d.id)})]})}function St({value:e,onChange:s,...l}){const o=C.useRef(null);return t.jsxs(t.Fragment,{children:[t.jsx(qe.ConfigString,{...l,value:e,onChange:s,InputProps:{endAdornment:t.jsx(r.InputAdornment,{position:"end",children:t.jsx(ye.ColorItem,{color:e??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var p;(p=o.current)==null||p.open({value:e??""})}})})}}),t.jsx(ye.ConfigColorDialog,{ref:o,onSave:({value:p},h)=>{s(p),h()}})]})}function Pt({label:e,value:s,onChange:l,property:o,component:p,defaultLocale:h,allComponents:d,PropertyValueField:g,onUpload:v}){const{locale:b}=_.useLocaleContext(),P=C.useRef(null);if(!ne.default(o.subProperties)){const i=E.default(Object.values(o.subProperties||{}),"index").filter(n=>n.data.visible!==!1&&n.data.key);return t.jsxs(r.Stack,{width:"100%",children:[t.jsx(r.FormLabel,{sx:{px:.25,py:.5},children:e}),t.jsx(r.Box,{children:t.jsx(r.Box,{sx:{position:"relative"},children:i.map((n,c)=>{const{data:u}=n,x=u.key??u.id,S=c===i.length-1;let a=null;try{s&&typeof s=="object"?a=s[x]:typeof s=="string"&&(a=(o.type==="yaml"?re.parse(s||""):JSON.parse(s||"{}"))[x])}catch{}a==null&&(u.locales&&b&&u.locales[b]?a=u.locales[b].defaultValue:u.locales&&h&&u.locales[h]&&(a=u.locales[h].defaultValue));const j=k=>{try{let I={};if(typeof s=="string")try{I=o.type==="yaml"?re.parse(s||""):JSON.parse(s||"{}")}catch{}else typeof s=="object"&&s!==null&&(I={...s});we.default(I,x,k);const m=R.transformValue(I,o.type);l==null||l(m)}catch(I){console.error("Error updating property:",I)}},f=8;return t.jsxs(r.Box,{sx:{mb:S?0:1,display:"flex",flexDirection:"row"},children:[t.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[t.jsx(r.Box,{sx:{position:"absolute",left:f,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),t.jsx(r.Box,{sx:{position:"absolute",left:f,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!S&&t.jsx(r.Box,{sx:{position:"absolute",left:f,top:16,bottom:-8,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),t.jsx(r.Box,{sx:{flexGrow:1},children:t.jsx(g,{component:p,property:u,value:a,onChange:j,size:"small",fullWidth:!0,defaultLocale:h,allComponents:d})})]},u.id)})})})]})}return t.jsx(r.Stack,{width:"100%",gap:2,children:t.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[t.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:e}),t.jsx(ie.CodeEditor,{keyId:o.id,locale:b,language:o.type==="yaml"?"yaml":"json",value:typeof s=="string"?s:"",onChange:i=>{l==null||l(i)},onUpload:i=>{P.current=i,v&&v(i)},fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},o.id),t.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:t.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:t.jsx(r.Box,{component:"span",sx:{opacity:0},children:e})})})]})})}const wt=["string","multiline","json","yaml","url","component","custom"];function ge(e){return e.type?!wt.includes(e.type):!1}function Ie({disabled:e,list:s,renderItem:l,...o}){const p=C.useRef(null),h=C.useId(),d=Pe.useUpdate(),g=E.default(Object.entries(s),n=>n[1].index).map(n=>n[0]),v=C.useRef(g),b=C.useCallback(n=>{v.current=n,d()},[d]),P=C.useCallback(({index:n},{index:c})=>{const u=[...v.current];u.splice(c,0,...u.splice(n,1)),b(u)},[b]);C.useEffect(()=>{b(g)},[g.join("-")]);const[{isOver:y},i]=te.useDrop({accept:h,collect:n=>({isOver:n.isOver()}),canDrop:()=>!e,drop:()=>{var u;const n=()=>{v.current.forEach((x,S)=>{const a=s[x];a&&(a.index=S)})},c=(u=Y.getYjsValue(s))==null?void 0:u.doc;c?c.transact(()=>{n()}):n()}});return C.useEffect(()=>{y||b(g)},[y]),i(p),t.jsx(r.Box,{...o,ref:p,className:st.cx(y&&"isDragging"),children:v.current.map((n,c)=>t.jsx(It,{type:h,disabled:e,id:n,index:c,itemIndex:u=>v.current.indexOf(u),move:P,children:u=>{const x=s[n];return x?l(x.data,c,u):null}},n))})}function It({disabled:e,id:s,index:l,type:o,children:p,itemIndex:h,move:d}){const g=C.useRef(),[{isDragging:v},b,P]=te.useDrag({type:o,item:()=>({id:s}),canDrag:()=>!e,collect:i=>({isDragging:i.isDragging()})}),[,y]=te.useDrop({accept:o,canDrop:()=>!e,hover(i,n){var f;if(!g.current)return;const c=h(i.id),u=l;if(c===u)return;const x=(f=g.current)==null?void 0:f.getBoundingClientRect(),S=(x.bottom-x.top)/2,j=n.getClientOffset().y-x.top;c<u&&j<S||c>u&&j>S||d({id:i.id,index:c},{id:s,index:l})}});return typeof p=="function"?p({isDragging:v,drag:b,drop:i=>(g.current=i,y(i)),preview:P}):(b(y(P(g))),t.jsx(r.Box,{ref:g,children:p}))}function Ct({drop:e,preview:s,drag:l,disabled:o,isDragging:p,children:h,onDelete:d,onVisibilityChange:g,visible:v=!0,actions:b,alwaysShowActions:P=!1}){const{t:y}=_.useLocaleContext();return t.jsx(r.Box,{ref:e,sx:{":hover .hover-visible":{maxWidth:"100%"},opacity:v?1:.5},children:t.jsxs(r.Box,{sx:{position:"relative"},children:[t.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:.5,bgcolor:p?"action.hover":"background.paper",opacity:.9999},children:h}),!o&&t.jsx(r.Box,{className:P?"":"hover-visible",sx:{maxWidth:P?"100%":0,overflow:"hidden",position:"absolute",right:2,top:2,transition:"max-width 0.3s ease-in-out"},children:t.jsxs(r.Stack,{direction:"row",sx:{bgcolor:i=>r.alpha(i.palette.grey[200],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[b,g&&t.jsx(r.Tooltip,{title:y(v?"hideParameter":"showParameter"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{onClick:()=>g(!v),children:v?t.jsx(D.VisibilityOffRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}}):t.jsx(D.VisibilityRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),d&&t.jsx(r.Tooltip,{title:y("delete"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{onClick:d,children:t.jsx(D.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),t.jsx(r.Tooltip,{title:y("dragSort"),disableInteractive:!0,placement:"top",children:t.jsx(r.Button,{ref:l,children:t.jsx(D.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function Ot({label:e,value:s,onChange:l}){const[o,p]=C.useState(!1);return t.jsxs(r.Stack,{gap:1,children:[t.jsx(r.TextField,{label:e,size:"small",value:s,onChange:h=>l==null?void 0:l(h.target.value),InputProps:{endAdornment:t.jsx(F.UploaderButton,{onChange:({response:h})=>{var g;const d=(g=h==null?void 0:h.data)==null?void 0:g.filename;d&&(l==null||l(d))}})}}),s&&t.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:R.getImageAbsoluteUrl(s),alt:e,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>p(!0)}),t.jsx(r.Dialog,{open:o,onClose:()=>p(!1),children:t.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:R.getImageAbsoluteUrl(s),alt:e})})]})}function le(e,s=""){return ht.default(e,(l,o,p)=>{const h=s?`${s}.${p}`:p;return xt.default(o)?ut.default(l,le(o,h)):l[h]=o,l},{})}const Tt=[{value:"string",label:"Text"},{value:"multiline",label:"Text (Multiline)"},{value:"number",label:"Number"},{value:"decimal",label:"Decimal"},{value:"boolean",label:"Boolean"},{value:"color",label:"Color"},{value:"url",label:"URL (Upload)"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"array",label:"Array"},{value:"component",label:"Component"},{value:"custom",label:"Custom (Render by a Component)"}];function G(e,s,l){return!e||!l?!1:Object.values(e).some(({data:o})=>o.id!==s&&o.key===l)}function oe(e,s){var l;return!e||!s?!1:((l=e[s])==null?void 0:l.data.visible)??!0}function Bt({componentId:e}){const{state:{components:s}}=R.useStore(),l=s[e],o=l==null?void 0:l.data;return o?t.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:t.jsx(r.Box,{p:2,children:t.jsx(rt.ErrorBoundary,{FallbackComponent:R.ErrorView,resetKeys:[e],children:t.jsx(Rt,{value:o})})})}):null}function Rt({value:e}){var b,P,y;const{t:s}=_.useLocaleContext(),{localState:{currentLocale:l,customComponentPreviewerProperties:o},state:{config:{defaultLocale:p}},localActions:{setCustomComponentPreviewerProperties:h}}=R.useStore(),d=Y.getYjsValue(e).doc,g=R.useAllComponents(),v=Pe.useReactive({propertiesValue:{...h}});return C.useEffect(()=>{const i=Object.fromEntries(Object.values(e.properties??{}).map(({data:n})=>{var c,u,x,S,a;return[n.id,{value:((c=v.propertiesValue[n.id])==null?void 0:c.value)??Le.parsePropertyValue(n,((x=(u=n.locales)==null?void 0:u[l])==null?void 0:x.defaultValue)??((a=(S=n.locales)==null?void 0:S[p])==null?void 0:a.defaultValue),{locale:l,defaultLocale:p})}]}));h(i)},[JSON.stringify(v.propertiesValue)]),t.jsx(r.Stack,{height:"100%",children:t.jsxs(r.Stack,{gap:2,children:[t.jsx(Ce,{config:e}),t.jsx(Te,{config:e,currentLocale:l,defaultLocale:p,allComponents:g,onUpdateConfig:i=>{d.transact(()=>{i(e)})}}),t.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[t.jsx(r.Typography,{variant:"subtitle1",children:s("renderer")}),t.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((b=e.renderer)==null?void 0:b.type)||"react-component",onChange:i=>{d.transact(()=>{const n=i.target.value;e.renderer??(e.renderer={type:n}),e.renderer.type=n})},children:[t.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),t.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((P=e.renderer)==null?void 0:P.type)==="component"&&t.jsx(Nt,{value:e}),((y=e.renderer)==null?void 0:y.type)==="react-component"&&t.jsx(At,{value:e}),t.jsx(ce,{config:e,currentLocale:l,defaultLocale:p,allComponents:g,propertiesValue:o,onChange:({value:i,id:n,path:c})=>{const u=[...c,"data"];if(!dt.default(e,u)){se.default.warning(s("cannotFindPropertyKey",{key:u.join(".")}));return}v.propertiesValue[n]={value:i.value}}})]})})}function Ce({config:e}){const{t:s}=_.useLocaleContext();return t.jsx(F.UploaderProvider,{children:t.jsxs(r.Stack,{gap:2,children:[t.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),t.jsx(r.TextField,{label:s("name"),size:"small",value:e.name||"",onChange:l=>e.name=l.target.value}),t.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:e.description||"",onChange:l=>e.description=l.target.value}),t.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:e.tags??[],onChange:(l,o)=>e.tags=o,renderInput:l=>t.jsx(r.TextField,{label:s("tags"),...l})}),t.jsx(Ot,{label:s("previewImage"),value:e.previewImage||"",onChange:l=>e.previewImage=l})]})})}function Oe({data:e,params:s,visible:l,config:o,currentLocale:p,defaultLocale:h,allComponents:d,onUpdateConfig:g}){var P,y,i,n,c,u;const{t:v}=_.useLocaleContext(),b=C.useMemo(()=>e.type==="json"||e.type==="yaml"||e.type==="array"?Vt:U,[e.type]);return t.jsx(Ct,{preview:s.preview,drop:s.drop,drag:s.drag,isDragging:s.isDragging,onDelete:()=>{g(x=>{if(x.properties){const a=Object.entries(x.properties).sort(([,f],[,k])=>f.index-k.index);delete x.properties[e.id],a.filter(([f])=>f!==e.id).forEach(([,f],k)=>{f.index=k})}})},visible:l,onVisibilityChange:x=>{g(S=>{const a=S.properties[e.id].data;a.visible=x})},alwaysShowActions:!0,children:t.jsxs(r.Stack,{direction:"column",gap:2,children:[t.jsx(r.TextField,{label:v("key"),size:"small",required:!0,sx:{width:"calc(100% - 80px - 8px)",flex:1,"& .MuiOutlinedInput-root":{borderColor:e.key?G(o.properties,e.id,e.key)?"warning.main":void 0:"error.main"},"& .MuiFormLabel-root":{color:e.key?G(o.properties,e.id,e.key)?"warning.main":"text.secondary":"error.main"},"& .MuiFormLabel-root.Mui-focused":{color:e.key?G(o.properties,e.id,e.key)?"warning.main":"primary.main":"error.main"}},value:e.key||"",onChange:x=>{g(S=>{const a=S.properties[e.id].data;a.key=x.target.value.trim()})},InputProps:{endAdornment:!e.key||e.key&&G(o.properties,e.id,e.key)?t.jsx(r.InputAdornment,{position:"end",sx:{width:16,ml:0},children:t.jsx(r.Tooltip,{title:e.key?v("duplicateKey"):v("requiredKey"),children:t.jsx(D.InfoRounded,{sx:{color:e.key?"warning.main":"error.main",fontSize:16}})})}):null}}),t.jsxs(r.Stack,{direction:"row",gap:1,children:[t.jsx(r.TextField,{label:v("label"),size:"small",sx:{flex:1},value:(((y=(P=e.locales)==null?void 0:P[p])==null?void 0:y.name)??((n=(i=e.locales)==null?void 0:i[h])==null?void 0:n.name))||"",onChange:x=>{g(S=>{var j;const a=S.properties[e.id].data;a.locales??(a.locales={}),(j=a.locales)[p]??(j[p]={}),a.locales[p].name=x.target.value})}}),t.jsx(r.TextField,{label:v("type"),size:"small",select:!0,sx:{flex:1},value:e.type==="string"&&e.multiline?"multiline":e.type||"string",onChange:x=>{g(S=>{const a=S.properties[e.id].data;if(a.locales)for(const f of Object.keys(a.locales))a.locales[f].defaultValue=void 0;const j=x.target.value;j==="multiline"?(a.type="string",a.multiline=!0):(typeof a.multiline<"u"&&delete a.multiline,a.type=j)})},children:Tt.map(x=>t.jsx(r.MenuItem,{value:x.value,children:x.label},x.value))})]}),t.jsxs(r.Stack,{direction:"row",gap:1,children:[t.jsx(b,{allComponents:d,defaultLocale:h,component:o,property:e,label:v("defaultValue"),size:"small",fullWidth:!0,value:(u=(c=e.locales)==null?void 0:c[p])==null?void 0:u.defaultValue,onChange:(x,S)=>{g(a=>{var f;const j=a.properties[e.id].data;if(S!=null&&S.forceUpdateProperty){const k=le(j),I=le(x);Object.keys(I).forEach(m=>{k[m]||we.default(j,m,I[m])})}else j.locales??(j.locales={}),(f=j.locales)[p]??(f[p]={}),j.locales[p].defaultValue=x})}}),e.type==="custom"?t.jsx(r.Box,{children:t.jsx(Dt,{property:e,allComponents:d})}):null]})]})})}function _t(e,s){const[l,o]=C.useState(0);return C.useEffect(()=>{const h=setTimeout(()=>{if(e.current){let d=e.current.parentElement,g=0;for(;d;)d.classList.contains("property-container")&&g++,d=d.parentElement;o(g)}},100);return()=>clearTimeout(h)},[e,s]),l}function Te({config:e,currentLocale:s,defaultLocale:l,allComponents:o,onUpdateConfig:p,useI18nEditor:h=!0}){const{t:d}=_.useLocaleContext(),g=z.usePopupState({variant:"dialog"}),v=e.properties&&E.default(Object.values(e.properties),"index");return t.jsx(F.UploaderProvider,{children:t.jsxs(r.Stack,{gap:2,children:[t.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[t.jsx(r.Typography,{variant:"subtitle1",children:d("properties")}),t.jsx(r.Box,{flex:1}),h&&t.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...z.bindTrigger(g),children:t.jsx(D.TranslateRounded,{fontSize:"small"})})]}),e.properties&&Object.keys(e.properties).length>0?t.jsx(Ie,{component:r.Stack,gap:2,list:e.properties,renderItem:(b,P,y)=>{const i=oe(e.properties,b.id);return t.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:i?"1px solid":"1px dashed",borderColor:"divider"},children:t.jsx(r.Stack,{gap:2,children:t.jsx(Oe,{data:b,params:y,visible:i,config:e,currentLocale:s,defaultLocale:l,allComponents:o,onUpdateConfig:p})})},b.id)}}):t.jsx(Z.default,{style:{fontSize:12},children:d("maker.properties.noProperties")}),t.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",onClick:()=>{p(b=>{var y;const P=R.nextId();b.properties??(b.properties={}),(y=b.properties)[P]??(y[P]={index:(v==null?void 0:v.length)||0,data:{id:P}})})},startIcon:t.jsx(D.AddRounded,{}),children:d("addObject",{object:d("property")})}),h&&t.jsx(Be,{...z.bindDialog(g),component:e})]})})}function Dt({property:e,allComponents:s}){const l=z.usePopupState({variant:"popper"});return t.jsxs(t.Fragment,{children:[t.jsx(r.Button,{sx:{minWidth:0},...z.bindTrigger(l),children:t.jsx(D.SettingsRounded,{fontSize:"small"})}),t.jsx(r.Popper,{...z.bindPopper(l),children:t.jsx(Se.ClickAwayListener,{onClickAway:l.close,children:t.jsx(r.Paper,{children:t.jsx(r.Box,{width:500,p:2,children:t.jsx(ee,{value:e.componentId,onChange:(o,p)=>e.componentId=p,allComponents:s})})})})})]})}function Et({value:e,valueImmutable:s,onChange:l,defaultLocale:o,allComponents:p}){var P;const[h,d]=C.useState(!1),{t:g,locale:v}=_.useLocaleContext(),b=typeof(e==null?void 0:e.componentId)=="string"?(P=p[e.componentId])==null?void 0:P.data:void 0;return b?t.jsxs(r.Box,{sx:{width:"100%",position:"relative"},children:[t.jsx(r.IconButton,{sx:{minWidth:0},disabled:!b,size:"small",onClick:()=>d(!h),color:h?"primary":"default",children:t.jsx(D.SettingsRounded,{fontSize:"small"})}),h&&t.jsx(r.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,sx:{width:"100%",zIndex:10},children:t.jsxs(r.Paper,{elevation:1,sx:{mt:1,p:2,borderRadius:1,border:"1px solid",borderColor:"divider",width:"100%"},children:[t.jsx(r.Box,{width:"100%",mb:2,children:t.jsx(ce,{config:b,currentLocale:v,defaultLocale:o,allComponents:p,propertiesValue:e==null?void 0:e.properties,onChange:({id:y,value:i})=>{const n=at.default(i.value),c=JSON.parse(JSON.stringify(e));c!=null&&c.componentId&&(s?l==null||l({...c,properties:{...c.properties,[y]:{value:n}}}):(c.properties=c.properties??{},c.properties[y]={value:n},l==null||l(c)))}})}),t.jsx(r.Button,{size:"small",onClick:()=>d(!1),sx:{mt:1},children:g("close")})]})})]}):null}function Be({type:e="properties",component:s,...l}){var y,i,n;const{t:o}=_.useLocaleContext(),{state:{components:p,supportedLocales:h,config:{defaultLocale:d}}}=R.useStore(),g=R.useAllComponents(),v=Y.getYjsValue(s).doc,b=e==="properties"?s.properties:e==="parameters"&&((y=s.renderer)==null?void 0:y.type)==="component"?(i=p[s.renderer.componentId])==null?void 0:i.data.properties:void 0,P=((n=s.renderer)==null?void 0:n.type)==="component"?s:void 0;return t.jsxs(r.Dialog,{...l,fullWidth:!0,maxWidth:"lg",children:[t.jsx(r.DialogTitle,{children:o("i18nEditorTitle")}),t.jsx(r.DialogContent,{children:b&&t.jsx(r.Stack,{children:t.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[t.jsx(r.TableHead,{children:t.jsx(r.TableRow,{children:h.map(({locale:c,name:u})=>t.jsx(r.TableCell,{children:t.jsxs(r.Typography,{color:"text.primary",children:[u,d===c&&t.jsx(D.StarRounded,{sx:{fontSize:12}})]})},c))})}),t.jsx(r.TableBody,{children:E.default(Object.values(b),"index").map(({data:c})=>t.jsx(r.TableRow,{children:h.map(({locale:u})=>{var x,S,a,j,f,k,I,m,w,O,B,V,A,N,$,W,K,L,J,H,ae,ue,de,pe,me,xe;return t.jsx(r.TableCell,{children:t.jsx(r.Stack,{gap:1,children:e==="properties"?t.jsxs(t.Fragment,{children:[t.jsx(r.TextField,{size:"small",label:"Key",value:c.key||"",onChange:M=>{v.transact(()=>{c.key=M.target.value.trim()})}}),t.jsx(r.TextField,{size:"small",label:o("label"),value:(((S=(x=c.locales)==null?void 0:x[u])==null?void 0:S.name)??((j=(a=c.locales)==null?void 0:a[d])==null?void 0:j.name))||"",onChange:M=>{v.transact(()=>{var q;c.locales??(c.locales={}),(q=c.locales)[u]??(q[u]={}),c.locales[u].name=M.target.value})}}),t.jsx(r.Box,{children:t.jsx(U,{allComponents:g,defaultLocale:d,component:s,property:c,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:X.default((k=(f=c.locales)==null?void 0:f[u])==null?void 0:k.defaultValue),value:((m=(I=c.locales)==null?void 0:I[u])==null?void 0:m.defaultValue)??((O=(w=c.locales)==null?void 0:w[d])==null?void 0:O.defaultValue),onChange:M=>{v.transact(()=>{var q;c.locales??(c.locales={}),(q=c.locales)[u]??(q[u]={}),c.locales[u].defaultValue=M})}})})]}):e==="parameters"&&P?t.jsx(r.Box,{children:t.jsx(U,{allComponents:g,defaultLocale:d,component:s,property:c,size:"small",fullWidth:!0,valueImmutable:X.default((N=(A=(V=(B=P.renderer.properties)==null?void 0:B[c.id])==null?void 0:V.locales)==null?void 0:A[u])==null?void 0:N.value),value:((L=(K=(W=($=P.renderer.properties)==null?void 0:$[c.id])==null?void 0:W.locales)==null?void 0:K[u])==null?void 0:L.value)??((ue=(ae=(H=(J=P.renderer.properties)==null?void 0:J[c.id])==null?void 0:H.locales)==null?void 0:ae[d])==null?void 0:ue.value)??((pe=(de=c.locales)==null?void 0:de[u])==null?void 0:pe.defaultValue)??((xe=(me=c.locales)==null?void 0:me[d])==null?void 0:xe.defaultValue),onChange:M=>{v.transact(()=>{var q,fe,je,be,he;(q=P.renderer).properties??(q.properties={}),(fe=P.renderer.properties)[je=c.id]??(fe[je]={}),(be=P.renderer.properties[c.id]).locales??(be.locales={}),(he=P.renderer.properties[c.id].locales)[u]??(he[u]={}),P.renderer.properties[c.id].locales[u].value=M})}})}):null},c.id)},u)})},c.id))})]})})}),t.jsx(r.DialogActions,{children:t.jsx(r.Button,{onClick:c=>{var u;return(u=l.onClose)==null?void 0:u.call(l,c,"escapeKeyDown")},children:o("close")})})]})}const ve=(e,s)=>l=>{const o=[l.palette.info.main,l.palette.primary.main,l.palette.secondary.main,l.palette.success.main,l.palette.warning.main],p=Math.min(o.length-1,e),h=o[p],d=r.alpha(h,.5),g=r.alpha(h,1);return{borderColor:`${d} !important`,borderLeft:"3px solid !important",borderLeftColor:d,color:g,...s}};function Vt({property:e,onChange:s,defaultLocale:l,allComponents:o}){const{t:p,locale:h}=_.useLocaleContext(),d=C.useRef(null),g=_t(d,e),v=C.useCallback(()=>{if(!(e.type!=="json"&&e.type!=="yaml"&&e.type!=="array")&&e.subProperties)try{let b={};E.default(Object.values(e.subProperties),"index").filter(i=>i.data.visible!==!1&&i.data.key).forEach(({data:i})=>{var c,u,x,S;if(!i.key)return;let n=((u=(c=i.locales)==null?void 0:c[h])==null?void 0:u.defaultValue)??((S=(x=i.locales)==null?void 0:x[l])==null?void 0:S.defaultValue);if(i.type==="number")n=Number(n);else if(i.type==="boolean")n=n===!0||n==="true";else if((i.type==="json"||i.type==="yaml")&&typeof n=="string")try{i.type==="json"?n=JSON.parse(n):n=re.parse(n)}catch(a){console.error("Error parsing nested value",n,a),n={}}b[i.key]=n}),e.type==="array"&&!Array.isArray(b)&&(b=ne.default(b)?[]:[b]);const y=R.transformValue(b,e.type);s==null||s(y)}catch(b){console.error("Error converting structure to text:",b)}},[e,h,l,s]);return e.type!=="json"&&e.type!=="yaml"&&e.type!=="array"?null:t.jsxs(r.Stack,{direction:"column",gap:1.5,sx:{width:"100%"},ref:d,children:[t.jsx(r.Divider,{sx:{mt:-1},children:t.jsx(r.Typography,{variant:"caption",color:"text.secondary",children:p("maker.properties.subProperties")})}),e.subProperties&&Object.keys(e.subProperties).length>0?t.jsx(Ie,{component:r.Stack,gap:2,list:e.subProperties,renderItem:(b,P,y)=>{const i=b.visible!==!1;return t.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:i?"1px solid":"1px dashed","&":ve(g)},children:t.jsx(r.Stack,{gap:2,children:t.jsx(Oe,{data:b,params:y,visible:i,config:{properties:e.subProperties},currentLocale:h,defaultLocale:l,allComponents:o,onUpdateConfig:n=>{try{const c={properties:e.subProperties||{}};n(c);const u={...e,subProperties:c.properties};s==null||s(u,{forceUpdateProperty:!0}),v()}catch(c){console.error("Error updating property:",c)}}})})},b.id)}}):t.jsx(Z.default,{style:{fontSize:12,height:100},children:p("maker.properties.noSubProperties")}),t.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",size:"small",startIcon:t.jsx(D.AddRounded,{}),onClick:()=>{try{const b=e.subProperties||{},P=R.nextId(),i={index:Object.values(b).length,data:{id:P,key:"",type:"string",visible:!0,locales:{[h]:{name:"",defaultValue:""}},subProperties:{}}},n={...e,subProperties:{...b,[P]:i}};s==null||s(n,{forceUpdateProperty:!0}),v()}catch(b){console.error("Error adding property:",b)}},sx:{"&":ve(g,{})},children:p("maker.properties.addSubProperty")})]})}function U({component:e,property:s,value:l,onChange:o,valueImmutable:p,defaultLocale:h,allComponents:d,...g}){var n,c,u,x,S;const{locale:v}=_.useLocaleContext(),b=F.useUploader(),P=C.useRef(null),y=()=>{var j;const a=(j=b==null?void 0:b.current)==null?void 0:j.getUploader();a==null||a.open(),P.current&&a.onceUploadSuccess(({response:f})=>{var I,m;let k=((I=f==null?void 0:f.data)==null?void 0:I.filename)||"";k&&(k=`mediakit://${k}`,l&&!l.includes("mediakit://")&&(k+=" # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")),(m=P.current)==null||m.call(P,k)})},i=g.label??(((c=(n=s.locales)==null?void 0:n[v])==null?void 0:c.name)||((x=(u=s.locales)==null?void 0:u[h])==null?void 0:x.name)||s.key||s.id);if(s.type==="number")return t.jsx(zt,{...g,label:i,NumberProps:{value:["number","string"].includes(typeof l)?l:null,onChange:(a,j)=>o==null?void 0:o(j)}});if(s.type==="decimal")return t.jsx(r.TextField,{...g,label:i,type:"text",value:l??"",onChange:a=>{const j=a.target.value;if(j===""||j==="-"){o==null||o(j);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(j)){let k=j;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(k)&&(k=Number(k)),o==null||o(k)}}});if(s.type==="boolean")return t.jsx(r.FormControlLabel,{label:i,labelPlacement:"start",control:t.jsx(r.Switch,{checked:l===!0,onChange:(a,j)=>o==null?void 0:o(j)})});if(s.type==="color")return t.jsx(St,{label:i,value:l,onChange:a=>{o==null||o(a)}});if(s.type==="json"||s.type==="yaml")return t.jsx(Pt,{label:i,value:l,onChange:a=>{o==null||o(a)},property:s,component:e,defaultLocale:h,allComponents:d,PropertyValueField:U,onUpload:a=>{P.current=a,y()}});if(s.type==="custom"){const a=(S=d[s.componentId])==null?void 0:S.data;return a?t.jsx(r.Box,{width:"100%",children:t.jsx(Q.CustomComponentRenderer,{componentId:a.id,props:{label:i,value:l,onChange:o},locale:v,dev:{mode:"draft",components:d,defaultLocale:h}})}):t.jsx(r.TextField,{...g,label:i,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return t.jsxs(r.Stack,{width:"100%",direction:"column",gap:1,children:[t.jsx(ee,{allComponents:d,label:i,value:l==null?void 0:l.componentId,onChange:(a,j)=>{p||!l?o==null||o({...l&&JSON.parse(JSON.stringify(l)),componentId:j}):typeof l=="object"&&(l.componentId=j,o==null||o({...l&&JSON.parse(JSON.stringify(l)),componentId:j}))}}),(l==null?void 0:l.componentId)&&t.jsx(Et,{value:l,valueImmutable:p,onChange:o,defaultLocale:h,allComponents:d})]});if(!s.type||["string","url","multiline"].includes(s.type)){let a=s.type==="string"?s.multiline:void 0;s.type==="multiline"&&(a=!0);const j=s.type==="url"?l==null?void 0:l.url:l;return t.jsx(r.TextField,{...g,label:i,value:typeof j=="string"?j:"",multiline:a,minRows:a?2:void 0,maxRows:a?10:void 0,onChange:f=>o==null?void 0:o(s.type==="url"?{...l,url:f.target.value,mediaKitUrl:f.target.value}:f.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:t.jsxs(r.InputAdornment,{position:"end",children:[t.jsx(F.UploaderButton,{onChange:async({response:f})=>{var w,O,B;const k=((w=f==null?void 0:f.data)==null?void 0:w.url)||((O=f==null?void 0:f.data)==null?void 0:O.fileUrl);let I;k&&(I=await F.getImageSize(k).catch(()=>F.getVideoSize(k)).catch(()=>{}));let m=((B=f==null?void 0:f.data)==null?void 0:B.filename)||"";m&&(m=`mediakit://${m}`),o==null||o({url:k,mediaKitUrl:m,width:I==null?void 0:I.naturalWidth,height:I==null?void 0:I.naturalHeight})}}),t.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:t.jsx(D.InfoRounded,{sx:{cursor:"default",mr:1},fontSize:"small"})})]})}:void 0})}return s.type==="array"?t.jsx(kt,{label:i,value:Array.isArray(l)?l:[],onChange:a=>o==null?void 0:o(a),property:s,renderItem:({item:a,index:j,onChange:f})=>s.subProperties&&Object.keys(s.subProperties).length>0?t.jsx(r.Stack,{gap:1,width:"100%",children:E.default(Object.values(s.subProperties),"index").filter(k=>k.data.visible!==!1).map(({data:k})=>k.key?t.jsx(U,{component:e,property:k,value:a[k.key],onChange:I=>{const m={...a,[k.key]:I};f(m)},size:"small",fullWidth:!0,defaultLocale:h,allComponents:d},k.id):null)},j):t.jsx(r.TextField,{size:g.size,fullWidth:!0,value:a,onChange:k=>f(k.target.value)})}):(console.error("Unsupported property type",s.type),null)}function zt({NumberProps:e,...s}){const{getInputProps:l}=Se.unstable_useNumberInput(e),o=l();return t.jsx(r.TextField,{...s,inputProps:o})}const Re=`import React from '@blocklet/pages-kit/builtin/react'
|
|
2
2
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
3
3
|
|
|
4
4
|
export default function () {
|
package/lib/es/add-component.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as e, jsx as I, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import { b as oI, h as q, i as IC, n as _, f as CC, j as gC, k as AC, g as iC } from "./chunks/state-
|
|
2
|
+
import { b as oI, h as q, i as IC, n as _, f as CC, j as gC, k as AC, g as iC } from "./chunks/state-C_CbKF7g.js";
|
|
3
3
|
import HI from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { Icon as $ } from "@iconify-icon/react";
|
|
@@ -7,14 +7,14 @@ import oC from "@mui/icons-material/Check";
|
|
|
7
7
|
import { Box as D, styled as lI, InputLabel as EI, TextField as h, IconButton as G, Autocomplete as tI, FormControl as wC, Select as sC, MenuItem as Q, ListItemText as nI, Typography as k, OutlinedInput as MC, useTheme as LC, CircularProgress as gI, InputAdornment as jC, Button as X, Grid as V, Stack as uI, Input as XI, CssBaseline as JC, Menu as OC, Dialog as wI, DialogTitle as sI, DialogContent as MI, DialogActions as LI, Tabs as mC, Tab as SC, Card as BC, CardMedia as yC, CardContent as DC, Skeleton as eC } from "@mui/material";
|
|
8
8
|
import { useRequest as bC, useReactive as v, useUpdate as WI, useThrottleFn as TI, useGetState as NC, useAsyncEffect as YI, useBoolean as xI } from "ahooks";
|
|
9
9
|
import rI, { useState as c, useEffect as t, useMemo as E, createContext as jI, useContext as KC, useRef as Z, useCallback as T, createElement as dC, forwardRef as JI, useImperativeHandle as OI } from "react";
|
|
10
|
-
import { I as zC, n as DI, A as cC, b as FC, T as aC, c as HC, B as lC } from "./chunks/array-
|
|
10
|
+
import { I as zC, n as DI, A as cC, b as FC, T as aC, c as HC, B as lC } from "./chunks/array-BAy40Bak.js";
|
|
11
11
|
import { styled as AI } from "@arcblock/ux/lib/Theme";
|
|
12
12
|
import "@blocklet/pages-kit/builtin/color-picker";
|
|
13
13
|
import "@blocklet/pages-kit/utils/style";
|
|
14
14
|
import { cx as EC } from "@emotion/css";
|
|
15
15
|
import "lodash/without";
|
|
16
16
|
import { red as tC, pink as nC, purple as uC, indigo as XC, blue as WC, cyan as TC, teal as YC, green as xC, lime as rC, yellow as hC, amber as ZC, orange as QC, brown as kC, grey as RC, blueGrey as pC } from "@mui/material/colors";
|
|
17
|
-
import { C as CI } from "./chunks/config-string-
|
|
17
|
+
import { C as CI } from "./chunks/config-string-SEFT7xVe.js";
|
|
18
18
|
import UC from "lodash/cloneDeep";
|
|
19
19
|
import { DragIndicator as fC, SearchRounded as GC, Remove as VC, Add as hI, Language as vC, CopyAll as PC, Settings as _C, Delete as $C } from "@mui/icons-material";
|
|
20
20
|
import { useDrag as qC, useDrop as Ig } from "react-dnd";
|
|
@@ -3,7 +3,7 @@ import "@mui/icons-material";
|
|
|
3
3
|
import { Box as b, styled as Tt, Typography as C, Container as Et, Stack as Ot, useTheme as At, createTheme as Ft, ThemeProvider as Ut, Card as Vt, CircularProgress as Dt, Grid as st, CardMedia as Ht, CardContent as Yt } from "@mui/material";
|
|
4
4
|
import Jt, { createContext as xt, useMemo as W, useCallback as M, useContext as bt, Fragment as Mt, isValidElement as yt, useState as K, useEffect as E, useRef as tt } from "react";
|
|
5
5
|
import G from "lodash/keyBy";
|
|
6
|
-
import { e as j, g as N, E as Kt, h as et, l as ot } from "./state-
|
|
6
|
+
import { e as j, g as N, E as Kt, h as et, l as ot } from "./state-C_CbKF7g.js";
|
|
7
7
|
import { AIForm as lt, AIFormResult as ct } from "@blocklet/ai-runtime/components";
|
|
8
8
|
import { deepmerge as Gt } from "@mui/utils";
|
|
9
9
|
import nt from "lodash/pick";
|
|
@@ -4,7 +4,7 @@ import { Icon as P } from "@iconify-icon/react";
|
|
|
4
4
|
import { TextField as A, Stack as w, FormControlLabel as F, Switch as L, Box as j, InputAdornment as k } from "@mui/material";
|
|
5
5
|
import { forwardRef as B, useState as D, useEffect as E, useImperativeHandle as U } from "react";
|
|
6
6
|
import { useDebounce as V } from "react-use";
|
|
7
|
-
import { g as x } from "./state-
|
|
7
|
+
import { g as x } from "./state-C_CbKF7g.js";
|
|
8
8
|
const J = B(function({ showMarkdown: I, markdown: h, onMarkdownChange: n, showUploader: S, value: o, meta: H, onChange: l, ...a }, z) {
|
|
9
9
|
const [e, c] = D("");
|
|
10
10
|
E(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { u as a, S as o, a as s, b as n } from "./state-
|
|
2
|
+
import { u as a, S as o, a as s, b as n } from "./state-C_CbKF7g.js";
|
|
3
3
|
function d({ children: t }) {
|
|
4
4
|
const r = a();
|
|
5
5
|
return /* @__PURE__ */ e(o, { url: s(r ?? ""), name: "root", waitingSynced: !0, children: /* @__PURE__ */ e(i, { children: t }) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as D } from "react/jsx-runtime";
|
|
2
|
-
import { d as q, e as pe, g as me, u as de, c as ge } from "./state-
|
|
2
|
+
import { d as q, e as pe, g as me, u as de, c as ge } from "./state-C_CbKF7g.js";
|
|
3
3
|
import { useLocaleContext as K } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import Q from "@arcblock/ux/lib/Result";
|
|
5
5
|
import { useHeaderState as fe } from "@blocklet/pages-kit/builtin/page/header";
|
|
@@ -21,7 +21,7 @@ import { Helmet as Ee } from "react-helmet";
|
|
|
21
21
|
import { useSearchParams as se, Routes as Me, Route as I, Navigate as Te, ScrollRestoration as Be } from "react-router-dom";
|
|
22
22
|
import { useAsync as ie } from "react-use";
|
|
23
23
|
import { joinURL as R } from "ufo";
|
|
24
|
-
import { S as Fe, n as Oe, P as Le, a as _e, B as Ae, g as De } from "./array-
|
|
24
|
+
import { S as Fe, n as Oe, P as Le, a as _e, B as Ae, g as De } from "./array-BAy40Bak.js";
|
|
25
25
|
import { styled as le, useTheme as Ne } from "@arcblock/ux/lib/Theme";
|
|
26
26
|
import $e from "@blocklet/ui-react/lib/Footer";
|
|
27
27
|
import "webfontloader";
|
|
@@ -110,7 +110,7 @@ function Je({ mode: t }) {
|
|
|
110
110
|
}
|
|
111
111
|
return /* @__PURE__ */ e(Ze, { children: ({ state: n }) => /* @__PURE__ */ e(H, { mode: t, state: n }) });
|
|
112
112
|
}
|
|
113
|
-
const Ze = re(() => import("./draft-data-
|
|
113
|
+
const Ze = re(() => import("./draft-data-B7-JQvuO.js"));
|
|
114
114
|
function et({
|
|
115
115
|
mode: t,
|
|
116
116
|
children: n
|
|
@@ -121,39 +121,39 @@ function et({
|
|
|
121
121
|
return Number(c) ? Number(c) : (/* @__PURE__ */ new Date()).getTime();
|
|
122
122
|
}
|
|
123
123
|
return Number(a);
|
|
124
|
-
}, [a]), { loading:
|
|
125
|
-
return
|
|
124
|
+
}, [a]), { loading: d, value: s } = ie(() => De({ mode: t, version: o }), [t, o]);
|
|
125
|
+
return d ? /* @__PURE__ */ e(ze, {}) : s ? n({ state: s }) : null;
|
|
126
126
|
}
|
|
127
127
|
function H({ mode: t, state: n }) {
|
|
128
|
-
const { t: r, locale: a } = K(), [l] = se(), o = l.get("hiddenBadge") === "true",
|
|
128
|
+
const { t: r, locale: a } = K(), [l] = se(), o = l.get("hiddenBadge") === "true", d = l.get("showPublish") === "true", {
|
|
129
129
|
pageIds: s,
|
|
130
130
|
pages: c,
|
|
131
131
|
routeIds: g,
|
|
132
|
-
routes:
|
|
133
|
-
supportedLocales:
|
|
132
|
+
routes: u,
|
|
133
|
+
supportedLocales: p,
|
|
134
134
|
config: { defaultLocale: b },
|
|
135
135
|
resources: v
|
|
136
136
|
} = n, w = q(n), y = j(
|
|
137
|
-
() =>
|
|
138
|
-
[a,
|
|
139
|
-
), f = Object.values(
|
|
140
|
-
() => s.map((
|
|
141
|
-
const i = c[
|
|
137
|
+
() => p != null && p.some((m) => m.locale === a) ? a : void 0,
|
|
138
|
+
[a, p]
|
|
139
|
+
), f = Object.values(u).find((m) => (m == null ? void 0 : m.path) === "/") ? void 0 : Object.values(c)[0], _ = j(
|
|
140
|
+
() => s.map((m) => {
|
|
141
|
+
const i = c[m];
|
|
142
142
|
return i && {
|
|
143
143
|
id: i.id,
|
|
144
144
|
path: R("/", y || "", i.slug, t !== "production" ? `?mode=${t}` : "")
|
|
145
145
|
};
|
|
146
146
|
}).filter(Oe),
|
|
147
147
|
[s, c, y, t]
|
|
148
|
-
), k = ([...
|
|
148
|
+
), k = ([...m]) => (t !== "production" && d && m.unshift(
|
|
149
149
|
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e("div", {}), children: /* @__PURE__ */ e(tt, { mode: "production", state: n }) })
|
|
150
|
-
),
|
|
150
|
+
), m);
|
|
151
151
|
return /* @__PURE__ */ D(Le, { value: { pages: _ }, children: [
|
|
152
152
|
/* @__PURE__ */ D(Me, { children: [
|
|
153
153
|
f && /* @__PURE__ */ e(I, { index: !0, element: /* @__PURE__ */ e(Te, { to: R("/", y || "", f.slug) }) }),
|
|
154
|
-
g == null ? void 0 : g.map((
|
|
154
|
+
g == null ? void 0 : g.map((m) => {
|
|
155
155
|
var E, M, T, S;
|
|
156
|
-
const i =
|
|
156
|
+
const i = u == null ? void 0 : u[m];
|
|
157
157
|
if (!i || !i.displayTemplateId) return null;
|
|
158
158
|
const P = c[i.displayTemplateId];
|
|
159
159
|
if (!P) return null;
|
|
@@ -217,8 +217,8 @@ function H({ mode: t, state: n }) {
|
|
|
217
217
|
)
|
|
218
218
|
), C;
|
|
219
219
|
}),
|
|
220
|
-
s.map((
|
|
221
|
-
const i = c[
|
|
220
|
+
s.map((m) => {
|
|
221
|
+
const i = c[m];
|
|
222
222
|
return i ? /* @__PURE__ */ e(
|
|
223
223
|
I,
|
|
224
224
|
{
|
|
@@ -238,10 +238,10 @@ function H({ mode: t, state: n }) {
|
|
|
238
238
|
i.id
|
|
239
239
|
) : null;
|
|
240
240
|
}),
|
|
241
|
-
v.pages && Object.values(v.pages).map(({ blockletId:
|
|
241
|
+
v.pages && Object.values(v.pages).map(({ blockletId: m, page: i }) => /* @__PURE__ */ e(
|
|
242
242
|
I,
|
|
243
243
|
{
|
|
244
|
-
path: R("/", `@${
|
|
244
|
+
path: R("/", `@${m}`, i.slug),
|
|
245
245
|
element: /* @__PURE__ */ e(
|
|
246
246
|
$,
|
|
247
247
|
{
|
|
@@ -275,15 +275,15 @@ function W({
|
|
|
275
275
|
page: a,
|
|
276
276
|
locale: l,
|
|
277
277
|
defaultLocale: o,
|
|
278
|
-
headerAddons:
|
|
278
|
+
headerAddons: d,
|
|
279
279
|
state: s
|
|
280
280
|
}) {
|
|
281
281
|
const c = oe({
|
|
282
282
|
page: null
|
|
283
283
|
});
|
|
284
284
|
O(() => {
|
|
285
|
-
const
|
|
286
|
-
|
|
285
|
+
const u = a || null;
|
|
286
|
+
u ? c.page = N(u) : c.page = null;
|
|
287
287
|
}, [a, c]);
|
|
288
288
|
const g = ae();
|
|
289
289
|
return O(() => {
|
|
@@ -296,7 +296,7 @@ function W({
|
|
|
296
296
|
page: c.page,
|
|
297
297
|
locale: l,
|
|
298
298
|
defaultLocale: o,
|
|
299
|
-
headerAddons:
|
|
299
|
+
headerAddons: d
|
|
300
300
|
}
|
|
301
301
|
) : null;
|
|
302
302
|
}
|
|
@@ -307,24 +307,24 @@ function _t({
|
|
|
307
307
|
pageData: a
|
|
308
308
|
}) {
|
|
309
309
|
const { t: l, locale: o } = K(), {
|
|
310
|
-
pages:
|
|
310
|
+
pages: d,
|
|
311
311
|
supportedLocales: s,
|
|
312
312
|
config: { defaultLocale: c },
|
|
313
313
|
resources: g
|
|
314
|
-
} = n,
|
|
314
|
+
} = n, u = Object.values(d).find((f) => (f == null ? void 0 : f.slug) === r), p = Object.values(g.pages || {}).find((f) => f.page.slug === r), b = j(
|
|
315
315
|
() => s != null && s.some((f) => f.locale === o) ? o : void 0,
|
|
316
316
|
[o, s]
|
|
317
317
|
), v = oe({
|
|
318
318
|
page: null
|
|
319
319
|
});
|
|
320
320
|
O(() => {
|
|
321
|
-
const f =
|
|
321
|
+
const f = u || (p == null ? void 0 : p.page) || null;
|
|
322
322
|
f ? v.page = N(f) : v.page = null;
|
|
323
|
-
}, [
|
|
323
|
+
}, [u, p]);
|
|
324
324
|
const w = ae();
|
|
325
325
|
if (O(() => {
|
|
326
326
|
ne(a, w.current) || a && v.page && (X(v.page, n, b, a), w.current = N(a));
|
|
327
|
-
}, [{}]), !
|
|
327
|
+
}, [{}]), !u && !(p != null && p.page))
|
|
328
328
|
return /* @__PURE__ */ e(L, { width: "100vw", height: "100vh", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Q, { style: { background: "inherit" }, status: 404, extra: /* @__PURE__ */ e(ue, { href: "/", children: l("common.back") }) }) });
|
|
329
329
|
const y = q(n);
|
|
330
330
|
return v.page ? /* @__PURE__ */ e(
|
|
@@ -346,8 +346,8 @@ function $({
|
|
|
346
346
|
defaultLocale: l,
|
|
347
347
|
headerAddons: o
|
|
348
348
|
}) {
|
|
349
|
-
var _, k,
|
|
350
|
-
const
|
|
349
|
+
var _, k, m, i, P, C, E, M, T;
|
|
350
|
+
const d = he(), s = ((_ = r.locales) == null ? void 0 : _[a]) ?? ((k = r.locales) == null ? void 0 : k[l]) ?? {}, c = s.title || ((m = window.blocklet) == null ? void 0 : m.appName), g = s.description || ((i = window.blocklet) == null ? void 0 : i.appDescription), u = pe(me(s.image), 540), { logo: p, brand: b, description: v, ...w } = fe(), y = j(
|
|
351
351
|
() => (S) => {
|
|
352
352
|
var x;
|
|
353
353
|
let h = (o == null ? void 0 : o(S)) ?? S;
|
|
@@ -361,7 +361,7 @@ function $({
|
|
|
361
361
|
{
|
|
362
362
|
styles: Z`
|
|
363
363
|
body {
|
|
364
|
-
background-color: ${
|
|
364
|
+
background-color: ${d(
|
|
365
365
|
!s.backgroundColor || s.backgroundColor === "transparent" ? "background.default" : s.backgroundColor
|
|
366
366
|
)} !important;
|
|
367
367
|
}
|
|
@@ -373,7 +373,7 @@ function $({
|
|
|
373
373
|
{
|
|
374
374
|
hideNavMenu: !!((C = s.header) != null && C.hideNavMenus),
|
|
375
375
|
translucentTextColor: (E = s.header) == null ? void 0 : E.translucentTextColor,
|
|
376
|
-
...
|
|
376
|
+
...p ? { logo: p } : {},
|
|
377
377
|
...b ? { brand: b } : {},
|
|
378
378
|
...v ? { description: v } : {},
|
|
379
379
|
className: Y(((M = s.header) == null ? void 0 : M.sticky) && "sticky", "page-header"),
|
|
@@ -386,9 +386,9 @@ function $({
|
|
|
386
386
|
/* @__PURE__ */ e("title", { children: c }),
|
|
387
387
|
/* @__PURE__ */ e("meta", { name: "og:title", content: c }),
|
|
388
388
|
/* @__PURE__ */ e("meta", { name: "og:description", content: g }),
|
|
389
|
-
/* @__PURE__ */ e("meta", { name: "og:image", content:
|
|
390
|
-
/* @__PURE__ */ e("meta", { name: "twitter:image:src", content:
|
|
391
|
-
/* @__PURE__ */ e("meta", { name: "twitter:image", content:
|
|
389
|
+
/* @__PURE__ */ e("meta", { name: "og:image", content: u }),
|
|
390
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image:src", content: u }),
|
|
391
|
+
/* @__PURE__ */ e("meta", { name: "twitter:image", content: u }),
|
|
392
392
|
/* @__PURE__ */ e("meta", { property: "twitter:description", content: g }),
|
|
393
393
|
/* @__PURE__ */ e("meta", { property: "twitter:title", content: c }),
|
|
394
394
|
/* @__PURE__ */ e("meta", { name: "description", content: g })
|
|
@@ -434,7 +434,7 @@ function $({
|
|
|
434
434
|
!((T = s.footer) != null && T.hidden) && /* @__PURE__ */ e(Ve, {})
|
|
435
435
|
] });
|
|
436
436
|
}
|
|
437
|
-
const tt = re(() => import("./publish-button-
|
|
437
|
+
const tt = re(() => import("./publish-button-CxEaqAku.js")), ce = ee(ye)`
|
|
438
438
|
&.sticky {
|
|
439
439
|
position: sticky;
|
|
440
440
|
top: 0;
|
|
@@ -448,13 +448,13 @@ function ot({ logo: t }) {
|
|
|
448
448
|
window.location.origin
|
|
449
449
|
);
|
|
450
450
|
o.searchParams.delete("imageFilter"), o.searchParams.delete("f");
|
|
451
|
-
const
|
|
451
|
+
const d = o.toString();
|
|
452
452
|
return new Promise((g) => {
|
|
453
|
-
fetch(
|
|
454
|
-
const
|
|
455
|
-
|
|
453
|
+
fetch(d).then((u) => {
|
|
454
|
+
const p = u.headers.get("content-type");
|
|
455
|
+
p != null && p.includes("svg") && u.text().then((b) => {
|
|
456
456
|
r(b), g(null);
|
|
457
|
-
}), g(
|
|
457
|
+
}), g(u.url);
|
|
458
458
|
});
|
|
459
459
|
});
|
|
460
460
|
}, [a]);
|
|
@@ -465,8 +465,8 @@ function ot({ logo: t }) {
|
|
|
465
465
|
if (l) {
|
|
466
466
|
const o = new URL(l);
|
|
467
467
|
o.searchParams.set("imageFilter", "convert"), o.searchParams.set("f", "png"), o.searchParams.set("h", "80");
|
|
468
|
-
const
|
|
469
|
-
return /* @__PURE__ */ e("img", { src:
|
|
468
|
+
const d = o.toString();
|
|
469
|
+
return /* @__PURE__ */ e("img", { src: d, alt: "logo" });
|
|
470
470
|
}
|
|
471
471
|
return null;
|
|
472
472
|
}
|
|
@@ -476,8 +476,8 @@ function nt({
|
|
|
476
476
|
...r
|
|
477
477
|
}) {
|
|
478
478
|
const { top: a = 0 } = ke(() => document.getElementById("app")) || {}, l = te();
|
|
479
|
-
let o = Math.min(a / 800, 1),
|
|
480
|
-
return o > 0.1 ? (o = Math.max(o, 0.6),
|
|
479
|
+
let o = Math.min(a / 800, 1), d = "";
|
|
480
|
+
return o > 0.1 ? (o = Math.max(o, 0.6), d = G(l.palette.text.primary, o)) : d = n || "#EEEEEE", /* @__PURE__ */ e(
|
|
481
481
|
ce,
|
|
482
482
|
{
|
|
483
483
|
logo: /* @__PURE__ */ e(ot, { logo: t }),
|
|
@@ -498,7 +498,7 @@ function nt({
|
|
|
498
498
|
bgcolor: "transparent",
|
|
499
499
|
"&.reverse-color": {
|
|
500
500
|
".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button": {
|
|
501
|
-
color: `${
|
|
501
|
+
color: `${d} !important`
|
|
502
502
|
}
|
|
503
503
|
},
|
|
504
504
|
"& .navmenu--horizontal": {
|
|
@@ -508,7 +508,7 @@ function nt({
|
|
|
508
508
|
filter: "invert(var(--logo-invert))"
|
|
509
509
|
},
|
|
510
510
|
".header-logo": {
|
|
511
|
-
color:
|
|
511
|
+
color: d
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { u as ce, c as de } from "./state-
|
|
2
|
+
import { u as ce, c as de } from "./state-C_CbKF7g.js";
|
|
3
3
|
import { useLocaleContext as U } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import Q from "@arcblock/ux/lib/Toast";
|
|
5
5
|
import { generateParamCombinations as me } from "@blocklet/pages-kit/utils/route";
|
|
@@ -10,8 +10,8 @@ import { produce as Oe } from "immer";
|
|
|
10
10
|
import ee from "lodash/difference";
|
|
11
11
|
import { useState as T, useMemo as R, useCallback as j, forwardRef as Te, useImperativeHandle as je, useEffect as W, useRef as ve } from "react";
|
|
12
12
|
import { useAsync as Re } from "react-use";
|
|
13
|
-
import { L as Ee } from "./home-
|
|
14
|
-
import { p as ze, g as Be } from "./array-
|
|
13
|
+
import { L as Ee } from "./home-DOrhBil-.js";
|
|
14
|
+
import { p as ze, g as Be } from "./array-BAy40Bak.js";
|
|
15
15
|
function Le(s) {
|
|
16
16
|
const [y, w] = T(!1);
|
|
17
17
|
return /* @__PURE__ */ t(
|
|
@@ -8,11 +8,11 @@ import { useLocaleContext as Z } from "@arcblock/ux/lib/Locale/context";
|
|
|
8
8
|
import H, { getYjsDoc as ee } from "@syncedstore/core";
|
|
9
9
|
import { useSyncedStore as te } from "@syncedstore/react";
|
|
10
10
|
import { useLocalStorageState as ne } from "ahooks";
|
|
11
|
-
import { produce as
|
|
11
|
+
import { produce as v } from "immer";
|
|
12
12
|
import oe from "js-cookie";
|
|
13
13
|
import N from "lodash/debounce";
|
|
14
14
|
import { customAlphabet as re } from "nanoid";
|
|
15
|
-
import { createContext as se, useState as E, useRef as ce, useMemo as
|
|
15
|
+
import { createContext as se, useState as E, useRef as ce, useMemo as C, useCallback as k, useEffect as O, useContext as ie } from "react";
|
|
16
16
|
import { useParams as ae, useNavigate as de } from "react-router-dom";
|
|
17
17
|
import { IndexeddbPersistence as le } from "y-indexeddb";
|
|
18
18
|
import { WebsocketProvider as ue } from "y-websocket";
|
|
@@ -73,7 +73,7 @@ function Ye({
|
|
|
73
73
|
listenStorageChange: !0
|
|
74
74
|
}), c = ce(r);
|
|
75
75
|
c.current = r;
|
|
76
|
-
const i =
|
|
76
|
+
const i = C(
|
|
77
77
|
() => H({
|
|
78
78
|
dataSourceIds: [],
|
|
79
79
|
dataSources: {},
|
|
@@ -87,9 +87,9 @@ function Ye({
|
|
|
87
87
|
resources: {}
|
|
88
88
|
}),
|
|
89
89
|
[]
|
|
90
|
-
), d =
|
|
91
|
-
|
|
92
|
-
const p =
|
|
90
|
+
), d = C(() => ee(i), [i]);
|
|
91
|
+
C(() => new le(o, d), [o, d]);
|
|
92
|
+
const p = C(
|
|
93
93
|
() => new ue(n, o, d, {
|
|
94
94
|
params: { token: oe.get("login_token") },
|
|
95
95
|
resyncInterval: 5 * 60 * 1e3
|
|
@@ -97,7 +97,7 @@ function Ye({
|
|
|
97
97
|
[n, o, d]
|
|
98
98
|
), g = k(() => {
|
|
99
99
|
p && (p.disconnect(), p.connect());
|
|
100
|
-
}, [p]), y =
|
|
100
|
+
}, [p]), y = C(
|
|
101
101
|
() => new me(
|
|
102
102
|
[d.getArray("pageIds"), d.getMap("pages"), d.getArray("supportedLocales"), d.getMap("config")],
|
|
103
103
|
{ doc: d }
|
|
@@ -138,7 +138,7 @@ function Ye({
|
|
|
138
138
|
O(() => {
|
|
139
139
|
S && M();
|
|
140
140
|
}, [S, M]);
|
|
141
|
-
const W =
|
|
141
|
+
const W = C(
|
|
142
142
|
() => ({
|
|
143
143
|
doc: d,
|
|
144
144
|
state: i,
|
|
@@ -203,16 +203,16 @@ function Ye({
|
|
|
203
203
|
};
|
|
204
204
|
}, [p, s]), f && !I ? null : /* @__PURE__ */ L(B.Provider, { value: W, children: a });
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const Ce = () => {
|
|
207
207
|
const n = ie(B);
|
|
208
208
|
if (!n)
|
|
209
209
|
throw new Error("Context is null");
|
|
210
|
-
const t = te(n.state), { setLocalState: a, localState: f } = n, I = de(), w = V(), h =
|
|
210
|
+
const t = te(n.state), { setLocalState: a, localState: f } = n, I = de(), w = V(), h = C(
|
|
211
211
|
() => ({
|
|
212
212
|
setCurrentSectionId: (e, o) => {
|
|
213
213
|
var r, s;
|
|
214
214
|
e === f.currentPageId && o === ((s = (r = f.pages) == null ? void 0 : r[e]) == null ? void 0 : s.currentSectionId) || (I(b("/admin/maker", w ?? "", "pages", e)), a(
|
|
215
|
-
(c) =>
|
|
215
|
+
(c) => v(c, (i) => {
|
|
216
216
|
var d;
|
|
217
217
|
i.currentPageId = e, i.currentComponentId = void 0, i.customComponentPreviewerProperties = {}, o !== void 0 && (i.pages ?? (i.pages = {}), (d = i.pages)[e] ?? (d[e] = {}), i.pages[e].currentSectionId = o ?? void 0), o ? window.sessionStorage.setItem("iframe_show_id", `"${o}"`) : window.sessionStorage.removeItem("iframe_show_id");
|
|
218
218
|
})
|
|
@@ -220,14 +220,14 @@ const ve = () => {
|
|
|
220
220
|
},
|
|
221
221
|
setCurrentComponentId: (e) => {
|
|
222
222
|
e !== f.currentComponentId && (I(b("/admin/maker", w ?? "", "components", e)), a(
|
|
223
|
-
(o) =>
|
|
224
|
-
r.
|
|
223
|
+
(o) => v(o, (r) => {
|
|
224
|
+
r.currentComponentId = e, r.customComponentPreviewerProperties = {};
|
|
225
225
|
})
|
|
226
226
|
));
|
|
227
227
|
},
|
|
228
228
|
setCurrentRouteId: ({ routeId: e, dynamicParams: o }) => {
|
|
229
229
|
a(
|
|
230
|
-
(r) =>
|
|
230
|
+
(r) => v(r, (s) => {
|
|
231
231
|
s.currentRouteId = e, s.currentDynamicParams = o;
|
|
232
232
|
})
|
|
233
233
|
);
|
|
@@ -235,7 +235,7 @@ const ve = () => {
|
|
|
235
235
|
setCustomComponentPreviewerProperties: (() => {
|
|
236
236
|
const e = {}, o = N(() => {
|
|
237
237
|
a(
|
|
238
|
-
(r) =>
|
|
238
|
+
(r) => v(r, (s) => {
|
|
239
239
|
s.customComponentPreviewerProperties = {
|
|
240
240
|
...s == null ? void 0 : s.customComponentPreviewerProperties,
|
|
241
241
|
...e
|
|
@@ -249,7 +249,7 @@ const ve = () => {
|
|
|
249
249
|
})(),
|
|
250
250
|
setRouteGenerateProcess: (e) => {
|
|
251
251
|
a(
|
|
252
|
-
(o) =>
|
|
252
|
+
(o) => v(o, (r) => {
|
|
253
253
|
e ? r.routeGenerateProcess = {
|
|
254
254
|
...r.routeGenerateProcess,
|
|
255
255
|
...e
|
|
@@ -259,7 +259,7 @@ const ve = () => {
|
|
|
259
259
|
},
|
|
260
260
|
resetRouteGenerateProcess: () => {
|
|
261
261
|
a(
|
|
262
|
-
(e) =>
|
|
262
|
+
(e) => v(e, (o) => {
|
|
263
263
|
o.routeGenerateProcess = {
|
|
264
264
|
progress: "complete"
|
|
265
265
|
};
|
|
@@ -268,14 +268,14 @@ const ve = () => {
|
|
|
268
268
|
},
|
|
269
269
|
setCurrentThemeMode: (e) => {
|
|
270
270
|
a(
|
|
271
|
-
(o) =>
|
|
271
|
+
(o) => v(o, (r) => {
|
|
272
272
|
r.currentThemeMode = e;
|
|
273
273
|
})
|
|
274
274
|
);
|
|
275
275
|
}
|
|
276
276
|
}),
|
|
277
277
|
[a, I, w]
|
|
278
|
-
), S =
|
|
278
|
+
), S = C(
|
|
279
279
|
() => ({
|
|
280
280
|
addPage: (e, o) => {
|
|
281
281
|
var c, i, d, p, g, y;
|
|
@@ -431,7 +431,7 @@ const ve = () => {
|
|
|
431
431
|
const { projectId: n } = ae();
|
|
432
432
|
return n ?? fe() ?? "";
|
|
433
433
|
};
|
|
434
|
-
function
|
|
434
|
+
function ve(n) {
|
|
435
435
|
var f, I;
|
|
436
436
|
const { resources: t } = n;
|
|
437
437
|
if (!t.components)
|
|
@@ -455,16 +455,16 @@ function ge(n) {
|
|
|
455
455
|
}
|
|
456
456
|
function je(n) {
|
|
457
457
|
return {
|
|
458
|
-
...
|
|
458
|
+
...ve(n),
|
|
459
459
|
...ge(n)
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
const Ze = () => je(
|
|
462
|
+
const Ze = () => je(Ce().state);
|
|
463
463
|
export {
|
|
464
464
|
Ke as E,
|
|
465
465
|
Ye as S,
|
|
466
466
|
qe as a,
|
|
467
|
-
|
|
467
|
+
Ce as b,
|
|
468
468
|
We as c,
|
|
469
469
|
je as d,
|
|
470
470
|
Xe as e,
|
|
@@ -473,7 +473,7 @@ export {
|
|
|
473
473
|
J as h,
|
|
474
474
|
Ve as i,
|
|
475
475
|
ge as j,
|
|
476
|
-
|
|
476
|
+
ve as k,
|
|
477
477
|
fe as l,
|
|
478
478
|
A as n,
|
|
479
479
|
ze as t,
|
package/lib/es/home.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "./chunks/state-
|
|
2
|
+
import "./chunks/state-C_CbKF7g.js";
|
|
3
3
|
import "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import "@arcblock/ux/lib/Result";
|
|
5
5
|
import "@blocklet/pages-kit/builtin/page/header";
|
|
@@ -21,8 +21,8 @@ import "react-helmet";
|
|
|
21
21
|
import "react-router-dom";
|
|
22
22
|
import "react-use";
|
|
23
23
|
import "ufo";
|
|
24
|
-
import "./chunks/array-
|
|
25
|
-
import { a as D, P as R, d as S, c as W, b as j, T as k, H as q } from "./chunks/home-
|
|
24
|
+
import "./chunks/array-BAy40Bak.js";
|
|
25
|
+
import { a as D, P as R, d as S, c as W, b as j, T as k, H as q } from "./chunks/home-DOrhBil-.js";
|
|
26
26
|
export {
|
|
27
27
|
D as HomeView,
|
|
28
28
|
R as PageRoutes,
|
package/lib/es/setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O, Fragment as X } from "react/jsx-runtime";
|
|
2
|
-
import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-
|
|
2
|
+
import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-C_CbKF7g.js";
|
|
3
3
|
import de from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { CodeEditor as xe } from "@blocklet/code-editor";
|
|
@@ -12,7 +12,7 @@ import A from "lodash/sortBy";
|
|
|
12
12
|
import { useCallback as D, useMemo as ne, useRef as J, useId as gt, useEffect as $, useState as Q } from "react";
|
|
13
13
|
import { useUpdate as _e } from "react-use";
|
|
14
14
|
import { ColorItem as Pt, ConfigColorDialog as wt } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
-
import { C as kt } from "./chunks/config-string-
|
|
15
|
+
import { C as kt } from "./chunks/config-string-SEFT7xVe.js";
|
|
16
16
|
import Pe from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
18
|
import * as me from "yaml";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.159",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -205,8 +205,8 @@
|
|
|
205
205
|
"yaml": "^2.5.0",
|
|
206
206
|
"yjs": "^13.6.18",
|
|
207
207
|
"zustand": "^4.5.5",
|
|
208
|
-
"@blocklet/pages-kit": "^0.4.
|
|
209
|
-
"@blocklet/pages-kit-block-studio": "^0.4.
|
|
208
|
+
"@blocklet/pages-kit": "^0.4.159",
|
|
209
|
+
"@blocklet/pages-kit-block-studio": "^0.4.159"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|