@chaibuilder/sdk 4.0.0-beta.31 → 4.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2SSKDMRQ-gmj-yWTy.js → 2SSKDMRQ-BXAXoR9y.js} +5 -5
- package/dist/{2SSKDMRQ-BksFOLpD.cjs → 2SSKDMRQ-BqOsh3tf.cjs} +1 -1
- package/dist/{AP7HFJJL-kVgc0R61.js → AP7HFJJL-B78LfetW.js} +1 -1
- package/dist/{AP7HFJJL-CO-deD_p.cjs → AP7HFJJL-Cv6sqAAd.cjs} +1 -1
- package/dist/{IconPicker-D_GRfhwS.js → IconPicker-BlO5Pnyu.js} +1 -1
- package/dist/{IconPicker-BJHUCDn4.cjs → IconPicker-D4yq_b-k.cjs} +1 -1
- package/dist/{WDYDFRGG-C9_E3QW0.js → WDYDFRGG-BE7jgVqa.js} +4 -4
- package/dist/{WDYDFRGG-KPpWFul_.cjs → WDYDFRGG-Dz9d3cVW.cjs} +1 -1
- package/dist/{actions-registery-Bj-j1k5i.js → actions-registery-D3-4Yha7.js} +1108 -1061
- package/dist/{actions-registery-Cy1lqUVI.cjs → actions-registery-vPaY-3dZ.cjs} +25 -25
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-1GoKTVcF.js → active-in-another-tab-CA47uafJ.js} +2 -2
- package/dist/{active-in-another-tab-iEd5fZD0.cjs → active-in-another-tab-CNn_R-55.cjs} +1 -1
- package/dist/{add-new-language-page-B3GUvWdP.js → add-new-language-page-B-kPbhFd.js} +3 -3
- package/dist/{add-new-language-page-Cq8R42Ro.cjs → add-new-language-page-QAZbAFQe.cjs} +1 -1
- package/dist/{add-new-page-DiHnECAR.cjs → add-new-page-D4nbAHOp.cjs} +1 -1
- package/dist/add-new-page-Y0d9tHh0.js +31 -0
- package/dist/{ai-panel-content-BPpawv4D.cjs → ai-panel-content-DXbebC-m.cjs} +1 -1
- package/dist/{ai-panel-content-tExD3yhH.js → ai-panel-content-WMOeK5pF.js} +5 -5
- package/dist/{ai-panel-default-lang-DnYLHSaS.js → ai-panel-default-lang-CM_psX_h.js} +7 -7
- package/dist/{ai-panel-default-lang-C6N4wUUF.cjs → ai-panel-default-lang-hmfyAYPM.cjs} +2 -2
- package/dist/{ai-panel-other-lang-D1pCJluY.js → ai-panel-other-lang-BKANRJAb.js} +13 -13
- package/dist/{ai-panel-other-lang-C65lVVtZ.cjs → ai-panel-other-lang-D4GL1b-W.cjs} +1 -1
- package/dist/{ai-prompt-input-Dws5BHhQ.cjs → ai-prompt-input-Dwd0-pcD.cjs} +1 -1
- package/dist/{ai-prompt-input-B2q30bhR.js → ai-prompt-input-mxXtWptn.js} +13 -13
- package/dist/{ai-translation-prompt-DnwG2BmF.cjs → ai-translation-prompt-7M2aEZ1w.cjs} +1 -1
- package/dist/{ai-translation-prompt-Dnn6i_t3.js → ai-translation-prompt-C_Pb7BE4.js} +1 -1
- package/dist/{apply-binding-chfbBKi2.js → apply-binding-BYCW1k2l.js} +1 -1
- package/dist/{apply-binding-9XSrYzAE.cjs → apply-binding-xiigK7eK.cjs} +1 -1
- package/dist/{change-password-modal-LKtYY-8V.cjs → change-password-modal-BYZoefwT.cjs} +1 -1
- package/dist/{change-password-modal-C0MMizgl.js → change-password-modal-Dqf_mleR.js} +5 -5
- package/dist/{code-editor-CWOmKcUc.js → code-editor-1fSEocLK.js} +1 -1
- package/dist/{code-editor-Cim6jQVF.cjs → code-editor-uN7W7KMD.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-oxYWGWON.js → continue-editing-in-this-client-DD7bBhjD.js} +2 -2
- package/dist/{continue-editing-in-this-client-Dd6nKIvX.cjs → continue-editing-in-this-client-DDM65ror.cjs} +1 -1
- package/dist/{core-BWQrViOY.cjs → core-czmLeR0h.cjs} +1 -1
- package/dist/{core-QlWEXm1d.js → core-nSRy3D7z.js} +16 -15
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -2
- package/dist/core.js +19 -19
- package/dist/{css-import-modal-CXulmaB4.cjs → css-import-modal-BU7bJAaT.cjs} +1 -1
- package/dist/{css-import-modal-6bMTRlCg.js → css-import-modal-pBNRVmGj.js} +1 -1
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/{plugin-BSjgGgwo.js → default-theme-options-saBIkWGT.js} +114 -114
- package/dist/{delete-page-D0tdn6VW.cjs → delete-page-8oEYsHPE.cjs} +1 -1
- package/dist/delete-page-B53nkF74.js +71 -0
- package/dist/{design-token-usage-D-hrcKz1.cjs → design-token-usage-Cm9m4AMz.cjs} +1 -1
- package/dist/{design-token-usage-lf7N_uOk.js → design-token-usage-DzWav2ip.js} +14 -14
- package/dist/{digital-asset-manager-DJhRhLGC.js → digital-asset-manager-1yLYGPuf.js} +5 -5
- package/dist/digital-asset-manager-BaTvMY8Q.cjs +1 -0
- package/dist/{duplicate-page-ChSp1TYN.cjs → duplicate-page-C2DZI4U0.cjs} +1 -1
- package/dist/{duplicate-page-CXzYy7vx.js → duplicate-page-DCRVR-kF.js} +6 -6
- package/dist/{dynamic-page-selector-btGtkyyv.cjs → dynamic-page-selector-CZJQnc-Q.cjs} +1 -1
- package/dist/{dynamic-page-selector-r5IR9_7k.js → dynamic-page-selector-DCGWkLVV.js} +12 -12
- package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
- package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
- package/dist/image-compression-UaU7Bwqe.cjs +1 -0
- package/dist/{image-editor-CilPMtAC.js → image-editor-C0EYZJY_.js} +1 -1
- package/dist/{image-editor-BdW476J8.cjs → image-editor-DkgZrSGr.cjs} +1 -1
- package/dist/{index-DtMksfXx.js → index-BDrc0HJQ.js} +1729 -1680
- package/dist/index-BuXfCtgR.cjs +5 -0
- package/dist/{index-DsQXiNA_.js → index-C7bidKtE.js} +2786 -2752
- package/dist/index-DKjYF53r.cjs +160 -0
- package/dist/{json-diff-viewer-BkrnLb3B.cjs → json-diff-viewer-88jEhq8D.cjs} +1 -1
- package/dist/{json-diff-viewer-D3N3w3Ax.js → json-diff-viewer-wmzIZcuQ.js} +34 -34
- package/dist/{lang-panel-BAaaP4Qc.js → lang-panel--kWBnU_W.js} +7 -7
- package/dist/{lang-panel-BjDRrpwN.cjs → lang-panel-I_ABfjOZ.cjs} +1 -1
- package/dist/manage-design-tokens-CslCEOXU.cjs +1 -0
- package/dist/manage-design-tokens-JdVKj09s.js +445 -0
- package/dist/manage-design-tokens-modal-DA15ou0u.cjs +1 -0
- package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-xKxC72Bc.js} +9 -9
- package/dist/{mark-as-template-DNHYNjI9.js → mark-as-template-AbZrkEYl.js} +7 -7
- package/dist/{mark-as-template-IYRjta97.cjs → mark-as-template-ClQjC2p2.cjs} +1 -1
- package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-B04k-PPB.js} +1 -1
- package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-dFwZaM1r.cjs} +1 -1
- package/dist/{no-language-page-content-C-ltY7bj.js → no-language-page-content-CbUqxuC4.js} +2 -2
- package/dist/{no-language-page-content-8_J6y-cm.cjs → no-language-page-content-pzkWJAg6.cjs} +1 -1
- package/dist/{no-language-page-dialog-D5NXpDHi.js → no-language-page-dialog-AavD_Mmc.js} +2 -2
- package/dist/{no-language-page-dialog-BOZZZzqx.cjs → no-language-page-dialog-DhlOVXUm.cjs} +1 -1
- package/dist/{page-creator-BuHHnqiQ.js → page-creator-2OZveMsR.js} +95 -95
- package/dist/{page-creator-wtbae2U7.cjs → page-creator-DMjnStPf.cjs} +1 -1
- package/dist/{page-lock-pPGlTxj7.js → page-lock-5MwwTWe8.js} +2 -2
- package/dist/{page-lock-DN4iJc-V.cjs → page-lock-B3CpoFTs.cjs} +1 -1
- package/dist/{page-locked-dialog-Bl-ojgIW.js → page-locked-dialog-BhNZC9wZ.js} +13 -13
- package/dist/{page-locked-dialog-B_vdgv24.cjs → page-locked-dialog-ZOvjnxRI.cjs} +1 -1
- package/dist/page-manager-new-BcI-1Dms.cjs +1 -0
- package/dist/{page-manager-new-Bg8H6yrg.js → page-manager-new-l68-Lc9h.js} +85 -88
- package/dist/{page-manager-search-and-filter-CDXunXNd.cjs → page-manager-search-and-filter-BOpne6v-.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-CyfO7O96.js → page-manager-search-and-filter-DJn98D02.js} +31 -30
- package/dist/{page-revisions-content-BKT8S9_g.cjs → page-revisions-content-B00tDCzu.cjs} +1 -1
- package/dist/{page-revisions-content-B-egQgoZ.js → page-revisions-content-Bqp-9bae.js} +23 -23
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +14 -2
- package/dist/pages.js +12 -12
- package/dist/{publish-pages-content-D2B_ScCQ.js → publish-pages-content-CtZLSG6O.js} +68 -75
- package/dist/publish-pages-content-DfYG0biw.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +5 -5
- package/dist/{rte-widget-modal-c3T09VeO.js → rte-widget-modal-DGEWoQ1b.js} +1 -1
- package/dist/{rte-widget-modal-CC1KcrAT.cjs → rte-widget-modal-DX66uSPv.cjs} +1 -1
- package/dist/runtime.cjs +6 -6
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +36 -35
- package/dist/{save-to-lib-dT1NDd5w.js → save-to-lib-CCxX5ZmQ.js} +26 -26
- package/dist/{save-to-lib-CiM0wiIr.cjs → save-to-lib-DmAjdhzU.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-BgqcPsXI.cjs → selected-block-display-Csce27bR.cjs} +1 -1
- package/dist/{selected-block-display-BQndDPcY.js → selected-block-display-Cv6jBhJD.js} +20 -20
- package/dist/{seo-panel-DXZvGYEM.cjs → seo-panel-BZYXeYzE.cjs} +1 -1
- package/dist/{seo-panel-Z93Zf_bz.js → seo-panel-Ctstjs-d.js} +25 -25
- package/dist/{shared-json-ld-DwvUDGAS.cjs → shared-json-ld-BDWtjHgw.cjs} +1 -1
- package/dist/{shared-json-ld-Ct68RlWD.js → shared-json-ld-BNHGmUBd.js} +45 -45
- package/dist/{slug-input-CAqkFZBq.js → slug-input-Bui1Qmvh.js} +1 -1
- package/dist/{slug-input-Curnt2n3.cjs → slug-input-IAl_jfHr.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +272 -206
- package/dist/{take-over-request-D6y2HcDr.cjs → take-over-request-Bl6jS1cK.cjs} +1 -1
- package/dist/{take-over-request-C6ngP1QR.js → take-over-request-Ceuqyk5K.js} +13 -13
- package/dist/{translation-warning-modal-B876S5yp.cjs → translation-warning-modal-CCmmwz1C.cjs} +1 -1
- package/dist/{translation-warning-modal-kRcfrPgo.js → translation-warning-modal-DA5dt2FA.js} +9 -9
- package/dist/types.d.ts +14 -2
- package/dist/{unmark-as-template-DeeWUTco.js → unmark-as-template-CKVMibvu.js} +13 -13
- package/dist/{unmark-as-template-f1dl_YTz.cjs → unmark-as-template-OEUqo0uc.cjs} +1 -1
- package/dist/unpublish-page-A5qn6E6g.js +28 -0
- package/dist/{unpublish-page-DEPFjGuu.cjs → unpublish-page-C81bYHLI.cjs} +1 -1
- package/dist/{unpublished-partials-modal-Ts5ZhAK9.js → unpublished-partials-modal-FqzTp5el.js} +3 -3
- package/dist/{unpublished-partials-modal-CEFXp1D1.cjs → unpublished-partials-modal-af5uDL7Y.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/dist/{web-preview-CoT8r96b.js → web-preview-vge6uUSa.js} +1 -1
- package/dist/{web-preview-DTDoIE-c.cjs → web-preview-xtKkQOXy.cjs} +1 -1
- package/package.json +2 -7
- package/dist/add-new-page-C5HlQfzy.js +0 -31
- package/dist/delete-page-LnzR01A8.js +0 -71
- package/dist/digital-asset-manager-eCJHNSjj.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-CAhDwfHE.cjs +0 -5
- package/dist/index-mPCp0j2h.cjs +0 -160
- package/dist/manage-design-tokens-BknGNAKE.cjs +0 -1
- package/dist/manage-design-tokens-Co5677WS.js +0 -428
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +0 -1
- package/dist/page-manager-new-5W5M9_ue.cjs +0 -1
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/publish-pages-content-WJHTVYnx.cjs +0 -1
- package/dist/theme-panel-footer-CGZL2F7R.js +0 -26
- package/dist/theme-panel-footer-IgGj-_OA.cjs +0 -1
- package/dist/unpublish-page-U_79Pwc0.js +0 -28
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-mPCp0j2h.cjs"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),ne=require("./STRINGS-FNnfjF5H.cjs"),v=require("@radix-ui/react-icons"),re=require("jotai"),ae=require("nanoid"),l=require("react"),oe=require("react-i18next"),p=require("sonner"),ie=require("tailwind-merge"),W=o=>{const m=o.trim();return m.length===0||m.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m)},le=(o,m,s,a=!1,h)=>{const f=o.trim();return f.length===0?"":f.length>25?s("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(f)?Object.entries(m).find(([c,y])=>y.name===f&&(!a||c!==h))?s("Token name already exists"):"":s("Only alphanumeric characters and hyphens allowed")},ce=o=>o.replace(/\s+/g,"-"),de=l.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-D-hrcKz1.cjs"))),G=({tokenId:o,token:m,isDisabled:s,isSelected:a,isArchived:h=!1,onSelect:f,onEdit:b,onUnarchive:j})=>e.jsxs("div",{onClick:()=>f(o),className:`group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${h?"border-muted bg-muted/30 opacity-60":a?"border-primary bg-primary/10":"hover:bg-muted/90"}`,children:[e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:`text-xs font-semibold ${h?"text-muted-foreground":""}`,children:m.name}),e.jsx("div",{className:`w-full max-w-52 truncate text-[10px] font-light ${h?"text-muted-foreground":""}`,children:m.value})]}),e.jsxs("div",{className:"absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:[!h&&e.jsxs(e.Fragment,{children:[e.jsx(l.Suspense,{fallback:null,children:e.jsx(de,{tokenId:o,tokenName:m.name,children:e.jsx(g.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(v.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:c=>{c.stopPropagation(),b(o)},disabled:s,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(v.Pencil1Icon,{className:"h-3 w-3"})})]}),h&&e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:c=>{c.stopPropagation(),j==null||j(o)},disabled:s,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(v.EyeOpenIcon,{className:"h-3 w-3"})})]})]}),ue=({onActiveTokenChange:o,onDirtyStateChange:m})=>{const{t:s}=oe.useTranslation(),[a,h]=re.useAtom(u.chaiDesignTokensAtom),f=u.useIncrementActionsCount(),b=u.useBuilderProp("pageId",""),j=u.useBuilderProp("siteWideUsage",{}),[c,y]=l.useState("view"),[k,P]=l.useState(null),[N,R]=l.useState(null),[i,C]=l.useState(""),[d,w]=l.useState(""),[A,S]=l.useState(""),[I,Z]=l.useState(""),[V,Q]=l.useState(!1),[O,B]=l.useState({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),D=l.useRef(null),_=l.useCallback(t=>{if(!j)return{pageCount:0,partialCount:0};let n=0,r=0;return Object.entries(j).forEach(([x,T])=>{if(x===b||!(T!=null&&T.designTokens))return;Object.keys(T.designTokens).some(te=>te===t)&&(T.isPartial?r++:n++)}),{pageCount:n,partialCount:r}},[j,b]),q=l.useMemo(()=>Object.entries(a).filter(([,t])=>t.name.toLowerCase().includes(I.toLowerCase())||t.value.toLowerCase().includes(I.toLowerCase())),[a,I]);l.useEffect(()=>{if(!m)return;const t=c==="add"&&(i&&i.trim().length>0||d&&d.trim().length>0);m(t)},[c,i,d,m]),l.useEffect(()=>{if(o)if(c==="edit"||c==="add")o(i&&d?{name:i,value:d,id:k||void 0}:null);else if(c==="view"&&N&&a[N]){const t=a[N];o({name:t.name,value:t.value,id:N})}else o(null)},[c,i,d,k,N,a,o]);const H=()=>{if(!i.trim()||!d.trim()){p.toast.error(s("Please fill in both token name and classes"));return}if(!W(i)){p.toast.error(s("Invalid design token name format"));return}if(Object.entries(a).find(([r,x])=>x.name===i.trim()&&r!==k)){p.toast.error(s("Token already exists"));return}if(!k)return;const n={...a,[k]:{name:i.trim(),value:d.trim()}};h(n),f(),p.toast.success(s("Token updated successfully")),E()},K=()=>{if(!i.trim()||!d.trim()){p.toast.error(s("Please fill in both token name and classes"));return}if(!W(i)){p.toast.error(s("Invalid design token name format"));return}if(Object.values(a).find(x=>x.name===i.trim())){p.toast.error(s("Token already exists"));return}const n=`${ne.DESIGN_TOKEN_PREFIX}${ae.nanoid(12)}`,r={...a,[n]:{name:i.trim(),value:d.trim()}};h(r),f(),p.toast.success(s("Token added successfully")),E()},z=t=>{const n=a[t];if(!n)return;const{pageCount:r,partialCount:x}=_(t);B({isOpen:!0,tokenId:t,tokenName:n.name,pageCount:r,partialCount:x}),D.current=t},X=()=>{const t=D.current;if(!t)return;const n={...a,[t]:{...a[t],archived:!0}};h(n),f(),p.toast.success(s("Token archived successfully")),B({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),D.current=null},M=t=>{const n={...a,[t]:{name:a[t].name,value:a[t].value}};h(n),f(),p.toast.success(s("Token unarchived successfully"))},F=t=>{const n=a[t];n&&(P(t),C(n.name),w(n.value),S(""),y("edit"))},L=()=>{P(null),C(""),w(""),S(""),y("add")},E=()=>{P(null),C(""),w(""),S(""),Q(!1),y("view")},J=t=>{const n=ce(t);C(n);const r=le(n,a,s,c==="edit",k||void 0);S(r)},$=t=>{w(t)},Y=t=>{const n=u.orderClassesByBreakpoint(u.removeDuplicateClasses(ie.twMerge(d,t)));$(n)},U=t=>{const n=d.split(" ").filter(r=>r!==t).join(" ");$(n)},ee=()=>{const t=c==="edit",n=s(t?"Edit Design Token":"Add Design Token"),r=s(t?"Update design token":"Create a reusable design token");return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5",children:[e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:E,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(v.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:n}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:r})]}),t&&V&&e.jsx("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"})})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:s("Token Name")}),e.jsx(g.Input,{id:"token-name",placeholder:"Button-Primary",value:i,onChange:x=>J(x.target.value),className:"h-7 text-xs"}),A?e.jsx("span",{className:"text-[10px] text-destructive",children:A}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:s("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(u.ManualClasses,{from:"designToken",classFromProps:d,onAddNew:Y,onRemove:U}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(g.Button,{variant:"outline",onClick:E,className:"h-7 text-xs",children:s("Cancel")}),t?e.jsx(g.Button,{onClick:H,disabled:!i.trim()||!d.trim()||!!A,className:"h-7 text-xs",children:s("Save Token")}):e.jsx(g.Button,{onClick:K,disabled:!i.trim()||!d.trim()||!!A,className:"h-7 text-xs",children:s("Add Token")})]})]})]})},se=()=>{const t=q.filter(([,r])=>!r.archived),n=q.filter(([,r])=>r.archived);return e.jsxs(e.Fragment,{children:[Object.entries(a).length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(v.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(g.Input,{placeholder:s("Search tokens"),value:I,onChange:r=>Z(r.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(g.Button,{variant:"outline",onClick:L,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(v.PlusIcon,{className:"h-3 w-3"}),s("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(u.ScrollArea,{className:"flex h-full flex-1 items-center justify-center",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(a).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2 text-3xl",children:e.jsx(v.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:s("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:s("Create reusable design tokens to streamline your styling")}),e.jsxs(g.Button,{variant:"default",onClick:L,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(v.PlusIcon,{className:"mr-1 h-3 w-3"}),s("Add first design token")]})]}):q.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx(v.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:s("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:s("No design tokens match your search")})]}):e.jsxs(e.Fragment,{children:[t.length>0&&e.jsx("div",{className:"space-y-1",children:t.map(([r,x])=>e.jsx(G,{token:x,tokenId:r,isSelected:N===r,isArchived:!1,onSelect:R,onEdit:F,onArchive:z,onUnarchive:M,isDisabled:!1},r))}),n.length>0&&e.jsxs("div",{className:"mt-4 space-y-1",children:[e.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold text-muted-foreground",children:s("Archived")}),n.map(([r,x])=>e.jsx(G,{token:x,tokenId:r,isSelected:N===r,isArchived:!0,onSelect:R,onEdit:F,onArchive:z,onUnarchive:M,isDisabled:!1},r))]})]}),e.jsx("div",{className:"h-44"})]})})})]})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full w-full flex-col",children:c==="view"?se():ee()}),e.jsx(u.AlertDialog,{open:O.isOpen,onOpenChange:t=>{t||(B({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),D.current=null)},children:e.jsxs(u.AlertDialogContent,{children:[e.jsx(u.AlertDialogTitle,{children:s("Archive Design Token")}),e.jsxs(u.AlertDialogDescription,{className:"space-y-3",children:[e.jsxs("p",{children:[s("This token is used on")," ",e.jsx("span",{className:"font-semibold",children:O.pageCount})," ",s("pages"),O.partialCount>0&&e.jsxs(e.Fragment,{children:[" ",s("and")," ",e.jsx("span",{className:"font-semibold",children:O.partialCount})," ",s("partials")]}),"."]}),e.jsx("p",{className:"text-sm text-destructive",children:s("Archiving this token will remove the styling for those blocks.")}),e.jsx("p",{children:s("Do you wish to continue?")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(u.AlertDialogCancel,{children:s("Cancel")}),e.jsx(u.AlertDialogAction,{onClick:X,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("Archive")})]})]})})]})};exports.default=ue;
|
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, Fragment as C, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Z as oe, _ as le, $ as Z, a0 as ce, a1 as de, a2 as me, a3 as ue, a4 as he, a5 as fe, a6 as pe, q as ge, a7 as xe, a8 as ve, a9 as Ne } from "./index-DsQXiNA_.js";
|
|
3
|
-
import { z as G, B as x } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
|
-
import { D as ke } from "./STRINGS-BExFecZW.js";
|
|
5
|
-
import { MagnifyingGlassIcon as V, PlusIcon as _, TokensIcon as be, ArrowLeftIcon as Te, EyeOpenIcon as Q, Pencil1Icon as ye } from "@radix-ui/react-icons";
|
|
6
|
-
import { useAtom as Ce } from "jotai";
|
|
7
|
-
import { nanoid as we } from "nanoid";
|
|
8
|
-
import { useState as g, useRef as Ae, useCallback as je, useMemo as De, useEffect as q, Suspense as Oe, lazy as Ee } from "react";
|
|
9
|
-
import { useTranslation as Se } from "react-i18next";
|
|
10
|
-
import { toast as p } from "sonner";
|
|
11
|
-
import { twMerge as Ie } from "tailwind-merge";
|
|
12
|
-
const H = (o) => {
|
|
13
|
-
const m = o.trim();
|
|
14
|
-
return m.length === 0 || m.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m);
|
|
15
|
-
}, Pe = (o, m, t, i = !1, h) => {
|
|
16
|
-
const f = o.trim();
|
|
17
|
-
return f.length === 0 ? "" : f.length > 25 ? t("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(f) ? Object.entries(m).find(
|
|
18
|
-
([c, T]) => T.name === f && (!i || c !== h)
|
|
19
|
-
) ? t("Token name already exists") : "" : t("Only alphanumeric characters and hyphens allowed");
|
|
20
|
-
}, ze = (o) => o.replace(/\s+/g, "-"), Le = Ee(() => import("./design-token-usage-lf7N_uOk.js")), K = ({
|
|
21
|
-
tokenId: o,
|
|
22
|
-
token: m,
|
|
23
|
-
isDisabled: t,
|
|
24
|
-
isSelected: i,
|
|
25
|
-
isArchived: h = !1,
|
|
26
|
-
onSelect: f,
|
|
27
|
-
onEdit: b,
|
|
28
|
-
onUnarchive: v
|
|
29
|
-
}) => /* @__PURE__ */ a(
|
|
30
|
-
"div",
|
|
31
|
-
{
|
|
32
|
-
onClick: () => f(o),
|
|
33
|
-
className: `group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${h ? "border-muted bg-muted/30 opacity-60" : i ? "border-primary bg-primary/10" : "hover:bg-muted/90"}`,
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
36
|
-
/* @__PURE__ */ e("div", { className: `text-xs font-semibold ${h ? "text-muted-foreground" : ""}`, children: m.name }),
|
|
37
|
-
/* @__PURE__ */ e("div", { className: `w-full max-w-52 truncate text-[10px] font-light ${h ? "text-muted-foreground" : ""}`, children: m.value })
|
|
38
|
-
] }),
|
|
39
|
-
/* @__PURE__ */ a("div", { className: "absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100", children: [
|
|
40
|
-
!h && /* @__PURE__ */ a(C, { children: [
|
|
41
|
-
/* @__PURE__ */ e(Oe, { fallback: null, children: /* @__PURE__ */ e(Le, { tokenId: o, tokenName: m.name, children: /* @__PURE__ */ e(
|
|
42
|
-
x,
|
|
43
|
-
{
|
|
44
|
-
variant: "ghost",
|
|
45
|
-
size: "sm",
|
|
46
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
47
|
-
children: /* @__PURE__ */ e(Q, { className: "h-3 w-3" })
|
|
48
|
-
}
|
|
49
|
-
) }) }),
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
x,
|
|
52
|
-
{
|
|
53
|
-
variant: "ghost",
|
|
54
|
-
size: "sm",
|
|
55
|
-
onClick: (c) => {
|
|
56
|
-
c.stopPropagation(), b(o);
|
|
57
|
-
},
|
|
58
|
-
disabled: t,
|
|
59
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
60
|
-
children: /* @__PURE__ */ e(ye, { className: "h-3 w-3" })
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
] }),
|
|
64
|
-
h && /* @__PURE__ */ e(
|
|
65
|
-
x,
|
|
66
|
-
{
|
|
67
|
-
variant: "ghost",
|
|
68
|
-
size: "sm",
|
|
69
|
-
onClick: (c) => {
|
|
70
|
-
c.stopPropagation(), v == null || v(o);
|
|
71
|
-
},
|
|
72
|
-
disabled: t,
|
|
73
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
|
|
74
|
-
children: /* @__PURE__ */ e(Q, { className: "h-3 w-3" })
|
|
75
|
-
}
|
|
76
|
-
)
|
|
77
|
-
] })
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
), Xe = ({ onActiveTokenChange: o, onDirtyStateChange: m }) => {
|
|
81
|
-
const { t } = Se(), [i, h] = Ce(oe), f = le(), b = Z("pageId", ""), v = Z("siteWideUsage", {}), [c, T] = g("view"), [k, P] = g(null), [N, R] = g(null), [l, w] = g(""), [d, A] = g(""), [j, D] = g(""), [O, X] = g(""), [J, Y] = g(!1), [E, z] = g({
|
|
82
|
-
isOpen: !1,
|
|
83
|
-
tokenId: null,
|
|
84
|
-
tokenName: "",
|
|
85
|
-
pageCount: 0,
|
|
86
|
-
partialCount: 0
|
|
87
|
-
}), S = Ae(null), U = je(
|
|
88
|
-
(n) => {
|
|
89
|
-
if (!v) return { pageCount: 0, partialCount: 0 };
|
|
90
|
-
let s = 0, r = 0;
|
|
91
|
-
return Object.entries(v).forEach(([u, y]) => {
|
|
92
|
-
if (u === b || !(y != null && y.designTokens)) return;
|
|
93
|
-
Object.keys(y.designTokens).some((ie) => ie === n) && (y.isPartial ? r++ : s++);
|
|
94
|
-
}), { pageCount: s, partialCount: r };
|
|
95
|
-
},
|
|
96
|
-
[v, b]
|
|
97
|
-
), L = De(() => Object.entries(i).filter(
|
|
98
|
-
([, n]) => n.name.toLowerCase().includes(O.toLowerCase()) || n.value.toLowerCase().includes(O.toLowerCase())
|
|
99
|
-
), [i, O]);
|
|
100
|
-
q(() => {
|
|
101
|
-
if (!m)
|
|
102
|
-
return;
|
|
103
|
-
const n = c === "add" && (l && l.trim().length > 0 || d && d.trim().length > 0);
|
|
104
|
-
m(n);
|
|
105
|
-
}, [c, l, d, m]), q(() => {
|
|
106
|
-
if (o)
|
|
107
|
-
if (c === "edit" || c === "add")
|
|
108
|
-
o(l && d ? {
|
|
109
|
-
name: l,
|
|
110
|
-
value: d,
|
|
111
|
-
id: k || void 0
|
|
112
|
-
} : null);
|
|
113
|
-
else if (c === "view" && N && i[N]) {
|
|
114
|
-
const n = i[N];
|
|
115
|
-
o({
|
|
116
|
-
name: n.name,
|
|
117
|
-
value: n.value,
|
|
118
|
-
id: N
|
|
119
|
-
});
|
|
120
|
-
} else
|
|
121
|
-
o(null);
|
|
122
|
-
}, [c, l, d, k, N, i, o]);
|
|
123
|
-
const ee = () => {
|
|
124
|
-
if (!l.trim() || !d.trim()) {
|
|
125
|
-
p.error(t("Please fill in both token name and classes"));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (!H(l)) {
|
|
129
|
-
p.error(t("Invalid design token name format"));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (Object.entries(i).find(
|
|
133
|
-
([r, u]) => u.name === l.trim() && r !== k
|
|
134
|
-
)) {
|
|
135
|
-
p.error(t("Token already exists"));
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (!k) return;
|
|
139
|
-
const s = {
|
|
140
|
-
...i,
|
|
141
|
-
[k]: {
|
|
142
|
-
name: l.trim(),
|
|
143
|
-
value: d.trim()
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
h(s), f(), p.success(t("Token updated successfully")), I();
|
|
147
|
-
}, te = () => {
|
|
148
|
-
if (!l.trim() || !d.trim()) {
|
|
149
|
-
p.error(t("Please fill in both token name and classes"));
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (!H(l)) {
|
|
153
|
-
p.error(t("Invalid design token name format"));
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (Object.values(i).find((u) => u.name === l.trim())) {
|
|
157
|
-
p.error(t("Token already exists"));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const s = `${ke}${we(12)}`, r = {
|
|
161
|
-
...i,
|
|
162
|
-
[s]: {
|
|
163
|
-
name: l.trim(),
|
|
164
|
-
value: d.trim()
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
h(r), f(), p.success(t("Token added successfully")), I();
|
|
168
|
-
}, M = (n) => {
|
|
169
|
-
const s = i[n];
|
|
170
|
-
if (!s) return;
|
|
171
|
-
const { pageCount: r, partialCount: u } = U(n);
|
|
172
|
-
z({
|
|
173
|
-
isOpen: !0,
|
|
174
|
-
tokenId: n,
|
|
175
|
-
tokenName: s.name,
|
|
176
|
-
pageCount: r,
|
|
177
|
-
partialCount: u
|
|
178
|
-
}), S.current = n;
|
|
179
|
-
}, ne = () => {
|
|
180
|
-
const n = S.current;
|
|
181
|
-
if (!n) return;
|
|
182
|
-
const s = {
|
|
183
|
-
...i,
|
|
184
|
-
[n]: {
|
|
185
|
-
...i[n],
|
|
186
|
-
archived: !0
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
h(s), f(), p.success(t("Token archived successfully")), z({
|
|
190
|
-
isOpen: !1,
|
|
191
|
-
tokenId: null,
|
|
192
|
-
tokenName: "",
|
|
193
|
-
pageCount: 0,
|
|
194
|
-
partialCount: 0
|
|
195
|
-
}), S.current = null;
|
|
196
|
-
}, $ = (n) => {
|
|
197
|
-
const s = {
|
|
198
|
-
...i,
|
|
199
|
-
[n]: {
|
|
200
|
-
name: i[n].name,
|
|
201
|
-
value: i[n].value
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
h(s), f(), p.success(t("Token unarchived successfully"));
|
|
205
|
-
}, B = (n) => {
|
|
206
|
-
const s = i[n];
|
|
207
|
-
s && (P(n), w(s.name), A(s.value), D(""), T("edit"));
|
|
208
|
-
}, F = () => {
|
|
209
|
-
P(null), w(""), A(""), D(""), T("add");
|
|
210
|
-
}, I = () => {
|
|
211
|
-
P(null), w(""), A(""), D(""), Y(!1), T("view");
|
|
212
|
-
}, se = (n) => {
|
|
213
|
-
const s = ze(n);
|
|
214
|
-
w(s);
|
|
215
|
-
const r = Pe(s, i, t, c === "edit", k || void 0);
|
|
216
|
-
D(r);
|
|
217
|
-
}, W = (n) => {
|
|
218
|
-
A(n);
|
|
219
|
-
}, re = (n) => {
|
|
220
|
-
const s = ve(Ne(Ie(d, n)));
|
|
221
|
-
W(s);
|
|
222
|
-
}, ae = (n) => {
|
|
223
|
-
const s = d.split(" ").filter((r) => r !== n).join(" ");
|
|
224
|
-
W(s);
|
|
225
|
-
};
|
|
226
|
-
return /* @__PURE__ */ a(C, { children: [
|
|
227
|
-
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: c === "view" ? (() => {
|
|
228
|
-
const n = L.filter(([, r]) => !r.archived), s = L.filter(([, r]) => r.archived);
|
|
229
|
-
return /* @__PURE__ */ a(C, { children: [
|
|
230
|
-
Object.entries(i).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
231
|
-
/* @__PURE__ */ a("div", { className: "relative flex-1", children: [
|
|
232
|
-
/* @__PURE__ */ e(V, { className: "absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" }),
|
|
233
|
-
/* @__PURE__ */ e(
|
|
234
|
-
G,
|
|
235
|
-
{
|
|
236
|
-
placeholder: t("Search tokens"),
|
|
237
|
-
value: O,
|
|
238
|
-
onChange: (r) => X(r.target.value),
|
|
239
|
-
className: "h-6 pl-7 text-xs"
|
|
240
|
-
}
|
|
241
|
-
)
|
|
242
|
-
] }),
|
|
243
|
-
/* @__PURE__ */ a(
|
|
244
|
-
x,
|
|
245
|
-
{
|
|
246
|
-
variant: "outline",
|
|
247
|
-
onClick: F,
|
|
248
|
-
size: "sm",
|
|
249
|
-
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
250
|
-
children: [
|
|
251
|
-
/* @__PURE__ */ e(_, { className: "h-3 w-3" }),
|
|
252
|
-
t("Add")
|
|
253
|
-
]
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
] }),
|
|
257
|
-
/* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(pe, { className: "flex h-full flex-1 items-center justify-center", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
258
|
-
Object.entries(i).length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
259
|
-
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(be, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
260
|
-
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: t("No design tokens yet") }),
|
|
261
|
-
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: t("Create reusable design tokens to streamline your styling") }),
|
|
262
|
-
/* @__PURE__ */ a(x, { variant: "default", onClick: F, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
263
|
-
/* @__PURE__ */ e(_, { className: "mr-1 h-3 w-3" }),
|
|
264
|
-
t("Add first design token")
|
|
265
|
-
] })
|
|
266
|
-
] }) : L.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
|
|
267
|
-
/* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(V, { className: "h-10 w-10 text-muted-foreground" }) }),
|
|
268
|
-
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: t("No tokens found") }),
|
|
269
|
-
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: t("No design tokens match your search") })
|
|
270
|
-
] }) : /* @__PURE__ */ a(C, { children: [
|
|
271
|
-
n.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-1", children: n.map(([r, u]) => /* @__PURE__ */ e(
|
|
272
|
-
K,
|
|
273
|
-
{
|
|
274
|
-
token: u,
|
|
275
|
-
tokenId: r,
|
|
276
|
-
isSelected: N === r,
|
|
277
|
-
isArchived: !1,
|
|
278
|
-
onSelect: R,
|
|
279
|
-
onEdit: B,
|
|
280
|
-
onArchive: M,
|
|
281
|
-
onUnarchive: $,
|
|
282
|
-
isDisabled: !1
|
|
283
|
-
},
|
|
284
|
-
r
|
|
285
|
-
)) }),
|
|
286
|
-
s.length > 0 && /* @__PURE__ */ a("div", { className: "mt-4 space-y-1", children: [
|
|
287
|
-
/* @__PURE__ */ e("div", { className: "px-2 py-1 text-[10px] font-semibold text-muted-foreground", children: t("Archived") }),
|
|
288
|
-
s.map(([r, u]) => /* @__PURE__ */ e(
|
|
289
|
-
K,
|
|
290
|
-
{
|
|
291
|
-
token: u,
|
|
292
|
-
tokenId: r,
|
|
293
|
-
isSelected: N === r,
|
|
294
|
-
isArchived: !0,
|
|
295
|
-
onSelect: R,
|
|
296
|
-
onEdit: B,
|
|
297
|
-
onArchive: M,
|
|
298
|
-
onUnarchive: $,
|
|
299
|
-
isDisabled: !1
|
|
300
|
-
},
|
|
301
|
-
r
|
|
302
|
-
))
|
|
303
|
-
] })
|
|
304
|
-
] }),
|
|
305
|
-
/* @__PURE__ */ e("div", { className: "h-44" })
|
|
306
|
-
] }) }) })
|
|
307
|
-
] });
|
|
308
|
-
})() : (() => {
|
|
309
|
-
const n = c === "edit", s = t(n ? "Edit Design Token" : "Add Design Token"), r = t(n ? "Update design token" : "Create a reusable design token");
|
|
310
|
-
return /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
|
|
311
|
-
/* @__PURE__ */ a("div", { className: "mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5", children: [
|
|
312
|
-
/* @__PURE__ */ e(
|
|
313
|
-
x,
|
|
314
|
-
{
|
|
315
|
-
variant: "ghost",
|
|
316
|
-
size: "sm",
|
|
317
|
-
onClick: I,
|
|
318
|
-
className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
|
|
319
|
-
children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
|
|
320
|
-
}
|
|
321
|
-
),
|
|
322
|
-
/* @__PURE__ */ a("div", { className: "flex-1", children: [
|
|
323
|
-
/* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: s }),
|
|
324
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: r })
|
|
325
|
-
] }),
|
|
326
|
-
n && J && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary" }) })
|
|
327
|
-
] }),
|
|
328
|
-
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
|
|
329
|
-
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
330
|
-
/* @__PURE__ */ e(ge, { htmlFor: "token-name", className: "text-xs font-medium", children: t("Token Name") }),
|
|
331
|
-
/* @__PURE__ */ e(
|
|
332
|
-
G,
|
|
333
|
-
{
|
|
334
|
-
id: "token-name",
|
|
335
|
-
placeholder: "Button-Primary",
|
|
336
|
-
value: l,
|
|
337
|
-
onChange: (u) => se(u.target.value),
|
|
338
|
-
className: "h-7 text-xs"
|
|
339
|
-
}
|
|
340
|
-
),
|
|
341
|
-
j ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: j }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: t("Button-Primary, Card-Header, Text-Large etc.") })
|
|
342
|
-
] }),
|
|
343
|
-
/* @__PURE__ */ e(
|
|
344
|
-
xe,
|
|
345
|
-
{
|
|
346
|
-
from: "designToken",
|
|
347
|
-
classFromProps: d,
|
|
348
|
-
onAddNew: re,
|
|
349
|
-
onRemove: ae
|
|
350
|
-
}
|
|
351
|
-
),
|
|
352
|
-
/* @__PURE__ */ a("div", { className: "mt-3 flex items-center justify-end gap-2 pt-3", children: [
|
|
353
|
-
/* @__PURE__ */ e(x, { variant: "outline", onClick: I, className: "h-7 text-xs", children: t("Cancel") }),
|
|
354
|
-
n ? /* @__PURE__ */ e(
|
|
355
|
-
x,
|
|
356
|
-
{
|
|
357
|
-
onClick: ee,
|
|
358
|
-
disabled: !l.trim() || !d.trim() || !!j,
|
|
359
|
-
className: "h-7 text-xs",
|
|
360
|
-
children: t("Save Token")
|
|
361
|
-
}
|
|
362
|
-
) : /* @__PURE__ */ e(
|
|
363
|
-
x,
|
|
364
|
-
{
|
|
365
|
-
onClick: te,
|
|
366
|
-
disabled: !l.trim() || !d.trim() || !!j,
|
|
367
|
-
className: "h-7 text-xs",
|
|
368
|
-
children: t("Add Token")
|
|
369
|
-
}
|
|
370
|
-
)
|
|
371
|
-
] })
|
|
372
|
-
] })
|
|
373
|
-
] });
|
|
374
|
-
})() }),
|
|
375
|
-
/* @__PURE__ */ e(
|
|
376
|
-
ce,
|
|
377
|
-
{
|
|
378
|
-
open: E.isOpen,
|
|
379
|
-
onOpenChange: (n) => {
|
|
380
|
-
n || (z({
|
|
381
|
-
isOpen: !1,
|
|
382
|
-
tokenId: null,
|
|
383
|
-
tokenName: "",
|
|
384
|
-
pageCount: 0,
|
|
385
|
-
partialCount: 0
|
|
386
|
-
}), S.current = null);
|
|
387
|
-
},
|
|
388
|
-
children: /* @__PURE__ */ a(de, { children: [
|
|
389
|
-
/* @__PURE__ */ e(me, { children: t("Archive Design Token") }),
|
|
390
|
-
/* @__PURE__ */ a(ue, { className: "space-y-3", children: [
|
|
391
|
-
/* @__PURE__ */ a("p", { children: [
|
|
392
|
-
t("This token is used on"),
|
|
393
|
-
" ",
|
|
394
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: E.pageCount }),
|
|
395
|
-
" ",
|
|
396
|
-
t("pages"),
|
|
397
|
-
E.partialCount > 0 && /* @__PURE__ */ a(C, { children: [
|
|
398
|
-
" ",
|
|
399
|
-
t("and"),
|
|
400
|
-
" ",
|
|
401
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: E.partialCount }),
|
|
402
|
-
" ",
|
|
403
|
-
t("partials")
|
|
404
|
-
] }),
|
|
405
|
-
"."
|
|
406
|
-
] }),
|
|
407
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: t("Archiving this token will remove the styling for those blocks.") }),
|
|
408
|
-
/* @__PURE__ */ e("p", { children: t("Do you wish to continue?") })
|
|
409
|
-
] }),
|
|
410
|
-
/* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
411
|
-
/* @__PURE__ */ e(he, { children: t("Cancel") }),
|
|
412
|
-
/* @__PURE__ */ e(
|
|
413
|
-
fe,
|
|
414
|
-
{
|
|
415
|
-
onClick: ne,
|
|
416
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
417
|
-
children: t("Archive")
|
|
418
|
-
}
|
|
419
|
-
)
|
|
420
|
-
] })
|
|
421
|
-
] })
|
|
422
|
-
}
|
|
423
|
-
)
|
|
424
|
-
] });
|
|
425
|
-
};
|
|
426
|
-
export {
|
|
427
|
-
Xe as default
|
|
428
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-mPCp0j2h.cjs"),y=require("@radix-ui/react-icons"),c=require("react"),j=require("react-i18next"),g=require("./plugin-DHpuZZXz.cjs"),o=require("lodash-es"),b=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),w=require("@tailwindcss/forms"),C=require("@tailwindcss/typography"),D=require("./fonts-D5fTqvSS.cjs"),F=require("./manage-design-tokens-BknGNAKE.cjs"),N=()=>{const[s]=t.useTheme(),r=t.useThemeOptions(),[l]=t.useDarkMode(),{document:n,window:d}=t.useFrame(),i=D.useRegisteredFonts();c.useEffect(()=>{l?n==null||n.documentElement.classList.add("dark"):n==null||n.documentElement.classList.remove("dark")},[l,n]),c.useEffect(()=>{!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...g.getChaiThemeOptions(r)}},plugins:[C,w,b,v,g.plugin(function({addBase:a,theme:m}){a({"h1,h2,h3,h4,h5,h6":{fontFamily:m("fontFamily.heading")},body:{fontFamily:m("fontFamily.body"),color:m("colors.foreground"),backgroundColor:m("colors.background")}})})]})},[s,r,d]);const u=c.useMemo(()=>{const a=o.get(s,"fontFamily.heading"),m=o.get(s,"fontFamily.body");return i.filter(f=>f.family===a||f.family===m)},[s,i]),p=c.useMemo(()=>g.getThemeFontsUrls(o.filter(u,a=>o.has(a,"url"))),[u]),h=c.useMemo(()=>g.getThemeCustomFontFace(o.filter(u,a=>o.has(a,"src"))),[u]);return e.jsxs(e.Fragment,{children:[e.jsx(t.CssThemeVariables,{theme:s}),p.map((a,m)=>e.jsx("link",{rel:"stylesheet",href:a},`preview-font-${m}`)),e.jsx("style",{id:"chai-custom-fonts",dangerouslySetInnerHTML:{__html:h}})]})},T=({content:s,classes:r="",className:l="w-full rounded border-0",style:n={minHeight:80},title:d="Preview"})=>{const i=c.useMemo(()=>t.IframeInitialContent.replace('dir="__HTML_DIR__"','dir="ltr"'),[]);return e.jsxs(t.ChaiFrame,{className:l,style:n,title:d,initialContent:i,children:[e.jsx(N,{}),e.jsx("div",{className:"h-full p-4",children:e.jsx("div",{className:r||void 0,dangerouslySetInnerHTML:{__html:s}})})]})},x=["xs","sm","md","lg","xl","2xl"],k=s=>{if(s=s.trim().replace(/ +(?= )/g,""),o.isEmpty(s))return"";const r=o.map(s.split(" "),t.constructClassObject),l=[];for(const n of r){const d=n.mq;if(!l.includes(n.fullCls))for(let i=x.indexOf(d)+1;i<x.length;i++){const u=o.find(r,{property:n.property,mq:x[i]});if(u&&u.cls!==n.cls)break;o.find(r,{cls:n.cls,mq:x[i]})&&l.push(`${x[i]}:${n.cls}`)}}return o.filter(o.map(r,n=>l.includes(n.fullCls)?null:n.fullCls),n=>n!==null).join(" ")},q=({activeToken:s})=>{const{t:r}=j.useTranslation(),l=s!=null&&s.value?k(s.value):"",n=s&&s.name&&s.value;return e.jsx(t.ScrollArea,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-4",children:e.jsxs("div",{className:"space-y-2 rounded-lg border bg-card p-4",children:[n&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.name}),s.id&&e.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground",children:s.id})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[10px] font-medium text-muted-foreground",children:r("Preview:")}),e.jsx(T,{content:r("Sample text with token styles applied"),classes:l,style:{minHeight:80},title:r("Token Preview")})]})]})})})},A=({open:s,onOpenChange:r})=>{const{t:l}=j.useTranslation(),[n,d]=c.useState(null),[i,u]=c.useState(!1),[p,h]=c.useState(!1),a=c.useCallback(f=>{if(!f&&i){h(!0);return}r(f)},[i,r]),m=c.useCallback(()=>{h(!1),u(!1),r(!1)},[r]);return e.jsxs(e.Fragment,{children:[e.jsx(t.Dialog,{open:s,onOpenChange:a,children:e.jsxs(t.DialogContent,{className:"flex h-[53vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(t.DialogHeader,{className:"border-b border-border px-6 py-4",children:e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(y.TokensIcon,{className:"h-5 w-5 text-primary"}),l("Design Token Management")]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex w-1/2 flex-col border-r border-border p-4",children:e.jsx(F.default,{onActiveTokenChange:d,onDirtyStateChange:u})}),e.jsxs("div",{className:"flex w-1/2 flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold",children:l("Live Preview")})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{activeToken:n})})]})]})]})}),e.jsx(t.AlertDialog,{open:p,onOpenChange:h,children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:l("Unsaved Changes")}),e.jsx(t.AlertDialogDescription,{children:l("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{children:l("Continue Editing")}),e.jsx(t.AlertDialogAction,{onClick:m,children:l("Discard Changes")})]})]})})]})};exports.default=A;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),K=require("./index-mPCp0j2h.cjs"),p=require("./index-CAhDwfHE.cjs"),G=require("./use-page-expand-manager-B6XTvk0E.cjs"),n=require("lodash-es"),R=require("jotai"),S=require("lucide-react"),o=require("react"),oe=require("react-i18next"),ie=require("./register-chai-top-bar-DyW9GPzV.cjs"),Z=(e,r)=>!e||!Array.isArray(e)?[]:n.isEmpty(r)?e:n.compact(n.filter(e,a=>{const s=n.toLower(r);return n.includes(n.toLower((a==null?void 0:a.name)||""),s)||n.includes(n.toLower((a==null?void 0:a.slug)||""),s)})),le=(e,r)=>{const a=new Set,s=n.keyBy(e,"id");return r.forEach(c=>{let l=c;for(;l.parent&&s[l.parent];)a.add(l.parent),l=s[l.parent]}),Array.from(a).map(c=>s[c])},O=(e,r,a)=>n.isEmpty(r)?e:e.map(s=>{if(!a(s.pageType))return{...s,shouldExpandOnSearch:!0,children:s.children?O(s.children,r,a):[]};const c=s.children&&s.children.some(l=>n.includes(n.toLower(l.name||""),n.toLower(r))||n.includes(n.toLower(l.slug||""),n.toLower(r)));return{...s,shouldExpandOnSearch:c,children:s.children?O(s.children,r,a):[]}}),ce=e=>{if(!e||!e.length)return[];const r={};e.forEach(s=>{r[s.id]={...s,children:[]}});const a=[];return Object.values(r).forEach(s=>{s.parent&&r[s.parent]?r[s.parent].children.push(s):a.push(s)}),a},ee=e=>!e||!e.length?[]:[...e].sort((a,s)=>(a.name||"").localeCompare(s.name||"")).map(a=>({...a,children:a.children?ee(a.children):[]})),de=(e,r,a,s)=>{if(!e||!e.length)return[];let c=e;if(a!=="all"&&(c=n.compact(n.filter(e,{pageType:a}))),n.isEmpty(r))c=Z(c,r);else{const f=Z(c,r),u=le(e,f);c=n.uniqBy([...f,...u],"id")}const l=ee(ce(c)),y=O(l,r,s),j=n.filter(y,f=>s(f.pageType)).sort((f,u)=>(f.name||"").localeCompare(u.name||"")),m=n.filter(y,f=>!s(f.pageType));let P=[];if(a==="all"){const f=n.keyBy(m,"pageType");P=Object.values(n.mapValues(f,(u,w)=>({...u,id:w,name:n.startCase(w),isPartialGroup:!0,children:y.filter(k=>k.pageType===w)})))}else P=m.sort((f,u)=>(f.name||"").localeCompare(u.name||""));return[...j,...P]},ue=R.atom({pageId:null,position:{x:0,y:0}}),me=({pageId:e,children:r})=>{const[a,s]=R.useAtom(ue),c=o.useRef(null),l=a.pageId===e;o.useEffect(()=>{const m=()=>s({pageId:null,position:{x:0,y:0}});if(l)return document.addEventListener("click",m),()=>document.removeEventListener("click",m)},[l,s]);const y=m=>{m.preventDefault(),m.stopPropagation(),s({pageId:e,position:{x:m.clientX,y:m.clientY}})},j=()=>{const m=`${window.location.pathname}?page=${e}`;window.open(m,"_blank"),s({pageId:null,position:{x:0,y:0}})};return t.jsxs(t.Fragment,{children:[t.jsx("span",{onContextMenu:y,children:r}),l&&t.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",style:{top:a.position.y,left:a.position.x},children:t.jsx("div",{className:"",children:t.jsxs(ie.Button,{variant:"ghost",onClick:j,className:"w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",children:[t.jsx(S.ExternalLink,{className:"h-4 w-4"}),"Open in new tab"]})})})]})},he=({page:e})=>{var s,c;const{isExpanded:r,toggleExpanded:a}=G.usePageExpandManager(e==null?void 0:e.id);return t.jsx("button",{onClick:l=>{l.stopPropagation(),a()},disabled:!((s=e==null?void 0:e.children)!=null&&s.length),className:`flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(c=e==null?void 0:e.children)!=null&&c.length?"hover:text-blue-400":"opacity-0"}`,children:t.jsx(S.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${r?"rotate-90":""}`})})},xe=({page:e,pageType:r})=>t.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?t.jsx(S.StarsIcon,{size:12,className:"text-yellow-400"}):r!=null&&r.icon?t.jsx("div",{className:"flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",dangerouslySetInnerHTML:{__html:r.icon}}):r!=null&&r.hasSlug?t.jsx(S.File,{size:12,className:"stroke-[1] text-slate-500"}):t.jsx(S.Hash,{size:12,className:"stroke-[1] text-slate-500"})}),fe=({isOnline:e})=>t.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),pe=({page:e,pageTypes:r,currentPage:a,onClickAction:s,languagePages:c,selectedLanguage:l,showUntranslatedPages:y})=>{const j=p.useUserId(),{pageToUser:m}=p.usePageToUser(),P=n.get(m,[e==null?void 0:e.id,"userId"]),{data:f}=p.useChaiUserInfo(P),u=f&&j!==P?f==null?void 0:f.name:null,w=p.useFallbackLang(),k=a===e.id,F=!!e.isTemplate,g=o.useMemo(()=>n.find(r,{key:e.pageType}),[r,e.pageType]);let h=n.get(c,e==null?void 0:e.id);h=n.get(h,"lang")===l?h:null;const E=l===w||!!h,T=(h==null?void 0:h.name)||(e==null?void 0:e.name)||"No name";let v=(h==null?void 0:h.slug)||(e==null?void 0:e.slug)||"";const $=v+(e!=null&&e.dynamic?`/${g==null?void 0:g.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(v.startsWith("/")&&!y){const d=v.split("/").pop();v=v.endsWith(d)&&e.dynamic?"":`/${d}`}const q=o.useMemo(()=>{const d="flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]",C=`${k?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${d} ${C} ${u?"opacity-60":""}`:`${d} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,k,u]),z=o.useMemo(()=>{if(e.isPartialGroup)return!1;if(h){if(!h.online||n.isEmpty(h.changes))return!1}else if(e&&(!e.online||n.isEmpty(e.changes)))return!1;return!0},[h,e]);return t.jsxs("div",{className:"group relative",children:[t.jsx(me,{pageId:e.id,children:t.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&s("select",e==null?void 0:e.id),className:q,children:[t.jsx(he,{page:e}),!e.isPartialGroup&&t.jsx(fe,{isOnline:h?h.online:e.online}),!e.isPartialGroup&&t.jsx(xe,{page:e,pageType:g}),t.jsx(p.Tooltip,{content:T,side:"top",showTooltip:T.length>35,children:t.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:T})}),(v||e.dynamic)&&t.jsx(p.Tooltip,{content:$,side:"top",showTooltip:!0,children:t.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[v,e.dynamic&&(g==null?void 0:g.dynamicSlug)&&t.jsxs("span",{className:"text-xs text-gray-500",children:["/",g==null?void 0:g.dynamicSlug,e.dynamicSlugCustom]})]})}),z&&t.jsx(p.Tooltip,{content:"Has unpublished changes",side:"top",children:t.jsx("span",{className:"text-amber-500",children:t.jsx(S.Pencil,{size:12,className:"stroke-[2]"})})}),F&&t.jsx(p.Tooltip,{content:"Template",side:"top",children:t.jsx("span",{className:"text-blue-500",children:t.jsx(S.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!u?t.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:t.jsx(p.PageActionsDropdown,{isLanguagePage:!!h,page:h||e,setDuplicatePage:d=>s("duplicate",d),setAddEditPage:d=>s("edit",h||d),setUnpublishPage:d=>s("unpublish",d),setDeletePage:d=>s("delete",h||d),setMarkAsTemplate:d=>s("markAsTemplate",d),setUnmarkAsTemplate:d=>s("unmarkAsTemplate",d),children:t.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:t.jsx(S.MoreHorizontal,{className:"h-4 w-4",onClick:d=>d.stopPropagation()})})})}):u?t.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:t.jsx(S.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]})}),t.jsx(t.Fragment,{children:u&&t.jsxs("button",{className:"absolute right-px top-1/2 flex h-6 -translate-y-1/2 items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[t.jsx(S.Edit,{size:12,className:"stroke-[3]"})," ",t.jsx("span",{className:"font-medium",children:u})," is editing this page"]})}),t.jsx(t.Fragment,{children:!E&&!e.isPartialGroup&&!u&&t.jsxs("button",{onClick:d=>{d.stopPropagation(),s("addLanguagePage",{language:l,page:e})},className:"absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",children:[t.jsx(S.Plus,{size:12,className:"stroke-[3]"})," ",t.jsxs("span",{className:"text-[10px]",children:["Add ",n.get(p.LANGUAGES,l)," Page"]})]})})]})},te=({pages:e,tier:r,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j})=>{const{expandedPages:m}=G.usePageExpandManager();return t.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${r*10}px`},children:e.map(P=>t.jsxs(t.Fragment,{children:[t.jsx(pe,{page:P,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j}),P.children&&P.children.length>0&&(m==null?void 0:m.includes(P.id))&&t.jsx(te,{pages:P.children,tier:r+1,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j})]},P.id))})},ye=o.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-CDXunXNd.cjs"))),Pe=o.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-DiHnECAR.cjs"))),we=o.lazy(()=>Promise.resolve().then(()=>require("./delete-page-D0tdn6VW.cjs"))),ge=o.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-ChSp1TYN.cjs"))),je=o.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-IYRjta97.cjs"))),be=o.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-f1dl_YTz.cjs"))),Se=o.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DEPFjGuu.cjs"))),ke=({close:e})=>{const{t:r}=oe.useTranslation(),{languages:a,setSelectedLang:s}=K.useLanguages(),{data:c}=p.usePageTypes(),{data:l,isFetching:y}=p.useWebsitePages(),[j,m]=p.useSearchParams(),{updateForSelectedPage:P,expandPagesOnSearch:f}=G.usePageExpandManager(null),u=p.useFallbackLang(),w=j.get("page"),[k,F]=o.useState(""),[g,h]=o.useState(null),[E,T]=o.useState(null),[v,$]=o.useState(null),[q,z]=o.useState(null),[d,C]=o.useState(""),[D,W]=o.useState(null),[H,_]=o.useState(null),[b,I]=o.useState(u),[se,ne]=o.useState(!1),V=R.useSetAtom(p.addNewLangAtom),U=se&&b!==u,{data:A,isFetching:re}=p.useWebsiteLanguagePages(b),Q=o.useCallback(x=>{var i;return(i=n.find(c,{key:x}))==null?void 0:i.hasSlug},[c]),N=o.useMemo(()=>l?U?n.filter(l,x=>!(A!=null&&A[x.id])):de(l,k,d,Q):[],[l,Q,k,d,A,U]);o.useEffect(()=>{s(u)},[u,s]),o.useEffect(()=>{const x=j.get("lang");if(x){const i=a,L=a[0]??u,M=i.includes(x);o.startTransition(()=>{M&&b!==x?I(x):!M&&b!==L&&I(L)})}},[]),o.useEffect(()=>{if(!n.isEmpty(d))return;const x=sessionStorage.getItem("pageTypeFilter")||"all";!n.isEmpty(c)&&x&&(n.find(c,{key:x})?C(x):C("all"))},[c,d]),o.useEffect(()=>{if(w&&!y&&!n.find(l,{id:w})){const i=new URLSearchParams(j.toString());if(i.delete("page"),[...i.keys()].length>0){if(typeof window<"u"&&window.history&&window.location){const L=i.toString(),M=window.location.hash||"",J=window.location.pathname,ae=L?`${J}?${L}${M}`:`${J}${M}`;window.history.replaceState(window.history.state,"",ae)}m(i)}else typeof window<"u"&&window.history&&window.location&&(window.history.replaceState(window.history.state,"",window.location.pathname+window.location.hash),window.dispatchEvent(new PopStateEvent("popstate",{state:window.history.state}))),m(i)}},[l,w,y,m]),o.useEffect(()=>{w&&!y&&!n.isEmpty(N)&&P(N,w)},[w,y,N,P]),o.useEffect(()=>{!n.isEmpty(k)&&!n.isEmpty(N)&&f(N)},[k,N,f]);const{setSelectedLang:B}=K.useLanguages(),X=o.useCallback(x=>{const i=new URLSearchParams({page:x});b!==u?(i.set("lang",b),B(b)):B(""),p.navigateToPage(i,m),e()},[e,m,B,b,u]),Y=(x,i)=>{var L;if(i)switch(x){case"add":T(i);break;case"select":X(i);break;case"edit":b!==u?V({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):T(i);break;case"delete":h(i);break;case"unpublish":$(i);break;case"markAsTemplate":z(i);break;case"unmarkAsTemplate":_(i);break;case"duplicate":W(i);break;case"addLanguagePage":V({edit:!1,primaryPage:((L=i==null?void 0:i.page)==null?void 0:L.id)||"",preselectedLang:(i==null?void 0:i.language)||b});break}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col justify-between",children:[t.jsx(o.Suspense,{children:t.jsx(ye,{pages:N,search:k,setSearch:F,languages:[u,...a],selectedLanguage:b,setSelectedLanguage:I,selectedPageType:d,setSelectedPageType:C,onAddPage:x=>Y("add",x),showUntranslatedPages:U,setShowUntranslatedPages:ne})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:y||re?t.jsx("div",{className:"space-y-2",children:n.map([...Array(15).keys()],x=>t.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},x))}):n.isEmpty(N)?t.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[t.jsx(S.File,{className:"h-6 w-6 stroke-[1]"}),r("Empty List!"),t.jsx("span",{className:"font-light",children:r("Add new page to start")})]}):t.jsx(te,{tier:0,pages:N,pageTypes:c,currentPage:w||"",onClickAction:Y,languagePages:A,selectedLanguage:b,showUntranslatedPages:U})})]}),E&&t.jsx(o.Suspense,{children:t.jsx(Pe,{closePanel:e,editPage:X,addEditPage:E,setAddEditPage:T})}),g&&t.jsx(o.Suspense,{children:t.jsx(we,{page:g,onClose:()=>h(null)})}),v&&t.jsx(o.Suspense,{children:t.jsx(Se,{page:v,onClose:()=>$(null)})}),q&&t.jsx(o.Suspense,{children:t.jsx(je,{page:q,onClose:()=>z(null)})}),H&&t.jsx(o.Suspense,{children:t.jsx(be,{page:H,onClose:()=>_(null)})}),D&&t.jsx(o.Suspense,{children:t.jsx(ge,{page:D,onClose:()=>W(null),closePanel:e})})]})};exports.default=ke;
|
package/dist/plugin-DHpuZZXz.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("lodash-es"),$=require("./fonts-D5fTqvSS.cjs"),b=require("./_commonjsHelpers-DwGv2jUC.cjs"),B={fontFamily:{"font-heading":"Arial","font-body":"Arial"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]},v={fontFamily:{heading:"Arial",body:"Arial"},borderRadius:"6px",colors:{background:["#FFFFFF","#09090B"],foreground:["#09090B","#FFFFFF"],primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"],secondary:["#F4F4F5","#27272A"],"secondary-foreground":["#09090B","#FFFFFF"],muted:["#F4F4F5","#27272A"],"muted-foreground":["#71717A","#A1A1AA"],accent:["#F4F4F5","#27272A"],"accent-foreground":["#09090B","#FFFFFF"],destructive:["#EF4444","#7F1D1D"],"destructive-foreground":["#FFFFFF","#FFFFFF"],border:["#E4E4E7","#27272A"],input:["#E4E4E7","#27272A"],ring:["#2563EB","#3B82F6"],card:["#FFFFFF","#09090B"],"card-foreground":["#09090B","#FFFFFF"],popover:["#FFFFFF","#09090B"],"popover-foreground":["#09090B","#FFFFFF"]}},_=e=>({fontFamily:e.fontFamily?a.keys(e.fontFamily).reduce((r,t)=>({...r,[t.replace("font-","")]:`var(--${t})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?a.flatten(e.colors.map(r=>Object.entries(r.items))).reduce((r,[t])=>({...r,[t]:`hsl(var(--${t}))`}),{}):{}});function m(e){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=parseInt(n[1],16),t=parseInt(n[2],16),F=parseInt(n[3],16);r/=255,t/=255,F/=255;const o=Math.max(r,t,F),u=Math.min(r,t,F);let i=0,l=0;const g=(o+u)/2;if(o==u)i=l=0;else{const s=o-u;switch(l=g>.5?s/(2-o-u):s/(o+u),o){case r:i=(t-F)/s+(t<F?6:0);break;case t:i=(F-r)/s+2;break;case F:i=(r-t)/s+4;break}i/=6}return`${Math.round(i*360)} ${Math.round(l*100)}% ${Math.round(g*100)}%`}const E=e=>{const r=$.getAllRegisteredFonts().find(t=>t.family===e);return`"${e}", ${a.get(r,"fallback","")}`},A=({theme:e})=>{const n=e;return`:root {
|
|
2
|
-
${e.fontFamily?Object.entries(e.fontFamily).map(([r,t])=>`--font-${r}: ${E(t)};`).join(`
|
|
3
|
-
`):""}
|
|
4
|
-
${n.borderRadius?`--radius: ${n.borderRadius};`:""}
|
|
5
|
-
${n.colors?Object.entries(n.colors).map(([r,t])=>`--${r}: ${m(t[0])};`).join(`
|
|
6
|
-
`):""}
|
|
7
|
-
}
|
|
8
|
-
.dark {
|
|
9
|
-
${n.colors?Object.entries(n.colors).map(([r,t])=>`--${r}: ${m(t[1])};`).join(`
|
|
10
|
-
`):""}
|
|
11
|
-
}`},C=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(n=>`<link rel="stylesheet" href="${n.url}" />`).join(`
|
|
12
|
-
`),P=e=>!e||e.length===0?[]:a.uniqBy(e,"family").map(n=>n.url),j=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(n=>`@import url("${n.url}");`).join(`
|
|
13
|
-
`),q=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(n=>n.src.map(r=>`@font-face {
|
|
14
|
-
font-family: "${n.family}";
|
|
15
|
-
src: url("${r.url}") format("${r.format}");
|
|
16
|
-
font-display: swap;
|
|
17
|
-
${r.fontWeight?`font-weight: ${r.fontWeight};`:""}
|
|
18
|
-
${r.fontStyle?`font-style: ${r.fontStyle};`:""}
|
|
19
|
-
${r.fontStretch?`font-stretch: ${r.fontStretch};`:""}
|
|
20
|
-
}`).join(`
|
|
21
|
-
`)).join(`
|
|
22
|
-
`);var d={},c={},p;function T(){return p||(p=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});function n(t,F){return{handler:t,config:F}}n.withOptions=function(t,F=()=>({})){const o=function(u){return{__options:u,handler:t(u),config:F(u)}};return o.__isOptionsFunction=!0,o.__pluginFunction=t,o.__configFunction=F,o};const r=n})(c)),c}var h;function M(){return h||(h=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const n=r(T());function r(F){return F&&F.__esModule?F:{default:F}}const t=n.default})(d)),d}var f,y;function k(){if(y)return f;y=1;let e=M();return f=(e.__esModule?e:{default:e}).default,f}var R=k();const O=b.getDefaultExportFromCjs(R);exports.defaultThemeOptions=B;exports.defaultThemeValues=v;exports.getChaiThemeCssVariables=A;exports.getChaiThemeOptions=_;exports.getThemeCustomFontFace=q;exports.getThemeFontsCSSImport=j;exports.getThemeFontsLinkMarkup=C;exports.getThemeFontsUrls=P;exports.plugin=O;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-DyW9GPzV.cjs"),f=require("./index-mPCp0j2h.cjs"),r=require("./index-CAhDwfHE.cjs"),U=require("./page-manager-search-and-filter-CDXunXNd.cjs"),F=require("@tanstack/react-query"),t=require("lodash-es"),b=require("lucide-react"),a=require("react"),M=()=>{const l=r.useApiUrl(),d=r.useFetch();return F.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>d(l,{action:r.ACTIONS.GET_CHANGES})})},G=({page:l,selectedPages:d,handleCheckboxChange:N,getPageType:y,hasSlug:h,currentOwnerId:c})=>{const x=r.useUserId(),{data:u}=r.useChaiUserInfo(c),o=c===x?null:u==null?void 0:u.name;return e.jsxs("tr",{className:"group relative border-b last:border-b-0 hover:bg-gray-50",children:[e.jsxs("td",{scope:"row",className:`flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o?"opacity-50":""}`,children:[o?e.jsx(b.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(d,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),N(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",h(l.pageType)?e.jsx(b.File,{className:"h-4 w-4"}):e.jsx(b.GlobeIcon,{className:"h-4 w-4"}),e.jsx(r.Tooltip,{content:l.name,side:"top",showTooltip:l.name.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-medium text-black",children:l.name})}),l.slug&&e.jsx(r.Tooltip,{content:l.slug,side:"top",showTooltip:l.slug.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs text-muted-foreground",children:l.slug})})]}),e.jsx("td",{className:"px-2",children:y(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:o&&e.jsxs("button",{className:"absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[e.jsx(b.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:o})," is editing this page"]})})]},l==null?void 0:l.id)},O=({onClose:l=()=>{},isPending:d,publishPage:N})=>{const y=r.useUserId(),{pageToUser:h}=r.usePageToUser(),[c,x]=a.useState([]),u=r.useFallbackLang(),[o,p]=a.useState(u),{data:T,isFetching:C}=M(),{data:m}=r.usePageTypes(),k=a.useCallback(s=>{var n;return(n=t.find(m,{key:s}))==null?void 0:n.hasSlug},[m]),j=a.useMemo(()=>t.filter(m,s=>!k(s.key)).map(s=>s.key),[k,m]),P=t.uniq(t.map(T,"lang")).filter(Boolean),i=a.useMemo(()=>t.filter(T,s=>s.pageType==="theme"?!1:o===u?s.lang===o||s.lang==="":s.lang===o),[T,o,u]),w=a.useMemo(()=>t.filter(i,s=>!j.includes(s.pageType)),[i,j]),S=a.useMemo(()=>t.filter(i,s=>j.includes(s.pageType)),[i,j]);a.useEffect(()=>{const s=t.map(t.filter(i,{online:!0}),"id");a.startTransition(()=>x(s))},[i]),a.useEffect(()=>{const s=t.filter(t.keys(h),n=>t.get(h,[n,"userId"])!==y);a.startTransition(()=>x(n=>t.filter(n,g=>!t.includes(s,g))))},[h,y]);const v=c.length===(i==null?void 0:i.length),E=s=>{x(n=>t.includes(n,s)?t.filter(n,g=>g!==s):t.concat(n,s))},B=()=>{x(v?[]:t.map(i,"id"))},I=()=>{N({ids:t.uniq(c)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(u)}})},A=s=>{if(s==="theme")return"Theme";const n=t.find(m,{key:s});return n?n==null?void 0:n.name:s},L=a.useMemo(()=>{const s=[{label:"Updated",top:"pt-2"},...t.orderBy(t.filter(w,{online:!0}),"pageType"),...t.orderBy(t.filter(S,{online:!0}),"pageType")].filter(g=>g.pageType!=="theme"),n=[{label:"Offline",top:"pt-6"},...t.orderBy(t.filter(w,{online:!1}),"pageType"),...t.orderBy(t.filter(S,{online:!1}),"pageType")];return[...s,...n]},[w,S]);return e.jsxs(f.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:"Publish changes"}),e.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),P.length>0&&e.jsx("div",{className:"my-[2px] mt-0",children:e.jsx(U.LanguageSelector,{languages:[u,...P],selectedLanguage:o,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:C?e.jsxs("div",{className:"space-y-2 px-1",children:[e.jsx("div",{className:"mt-2 h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"})]}):e.jsxs("table",{className:"w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right",children:[e.jsx("thead",{className:"sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400",children:e.jsxs("tr",{children:[e.jsxs("th",{scope:"col",className:"w-[1 50px] flex items-center gap-x-2 px-6 py-3",children:[e.jsx("input",{checked:v,onClick:s=>{s.stopPropagation(),B()},type:"checkbox",className:"mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"}),"Name"]}),e.jsx("th",{scope:"col",className:"w-[150px] px-2 py-3",children:"Type"}),e.jsx("th",{scope:"col",className:"w-[150px] px-4 py-3 text-right",children:"Status"})]})}),e.jsx("tbody",{children:t.map(L,s=>s.label?e.jsx("tr",{children:e.jsxs("td",{colSpan:3,className:`relative px-6 py-2 text-xs font-medium text-gray-800 ${s.top}`,children:[e.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:e.jsx("div",{className:"order-gray-300 w-full"})}),e.jsx("div",{className:"relative flex justify-start",children:e.jsx("span",{className:"bg-gray-50 pr-2",children:s.label})})]})},"separator"):e.jsx(G,{page:s,selectedPages:c,handleCheckboxChange:E,getPageType:A,hasSlug:k,currentOwnerId:t.get(h,[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id),"userId"])}))})]})}),e.jsxs(f.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[c.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[c.length," Page",c.length!==1?"s":""," Selected"]}),e.jsx(q.Button,{disabled:d,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(q.Button,{disabled:d||C||t.isEmpty(c),onClick:I,children:d?"Publishing...":"Publish Selected"})]})]})};exports.default=O;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { B as o } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { i as d } from "./index-DsQXiNA_.js";
|
|
4
|
-
import { e as h, f as u, t as f } from "./index-DtMksfXx.js";
|
|
5
|
-
import { useTranslation as p } from "react-i18next";
|
|
6
|
-
const v = () => {
|
|
7
|
-
const [e] = d(), { mutate: r, isPending: s } = h(), { mutateAsync: t, isPending: i } = u(), { t: n } = p(), m = () => {
|
|
8
|
-
t({ settings: { theme: e } });
|
|
9
|
-
}, l = async () => {
|
|
10
|
-
await t({ settings: { theme: e } }), r(
|
|
11
|
-
{ ids: ["THEME"] },
|
|
12
|
-
{
|
|
13
|
-
onSuccess: () => {
|
|
14
|
-
f("BOTTOM_RIGHT");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
return /* @__PURE__ */ c("div", { className: "flex items-center justify-center gap-x-3 border-t bg-white py-3", children: [
|
|
20
|
-
/* @__PURE__ */ a(o, { size: "sm", variant: "outline", disabled: s || i, onClick: m, children: n("Save draft") }),
|
|
21
|
-
/* @__PURE__ */ a(o, { size: "sm", disabled: s || i, onClick: l, children: n("Publish") })
|
|
22
|
-
] });
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
v as default
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),d=require("./index-mPCp0j2h.cjs"),s=require("./index-CAhDwfHE.cjs"),h=require("react-i18next"),m=()=>{const[t]=d.useTheme(),{mutate:c,isPending:i}=s.usePublishPages(),{mutateAsync:n,isPending:r}=s.useUpdateWebsiteFields(),{t:a}=h.useTranslation(),u=()=>{n({settings:{theme:t}})},l=async()=>{await n({settings:{theme:t}}),c({ids:["THEME"]},{onSuccess:()=>{s.throwConfetti("BOTTOM_RIGHT")}})};return e.jsxs("div",{className:"flex items-center justify-center gap-x-3 border-t bg-white py-3",children:[e.jsx(o.Button,{size:"sm",variant:"outline",disabled:i||r,onClick:u,children:a("Save draft")}),e.jsx(o.Button,{size:"sm",disabled:i||r,onClick:l,children:a("Publish")})]})};exports.default=m;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as s, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import { B as l } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as c, e as u, f as h, g as d, p as m, r as b } from "./index-DsQXiNA_.js";
|
|
4
|
-
import { s as f } from "./index-DtMksfXx.js";
|
|
5
|
-
import { useTranslation as D } from "react-i18next";
|
|
6
|
-
const v = ({ page: n, onClose: r }) => {
|
|
7
|
-
const { t: i } = D(), { mutate: e, isPending: t } = f(), a = async () => {
|
|
8
|
-
e(n, { onSuccess: r });
|
|
9
|
-
};
|
|
10
|
-
return /* @__PURE__ */ s(c, { open: !!n, onOpenChange: r, children: /* @__PURE__ */ o(u, { children: [
|
|
11
|
-
/* @__PURE__ */ o(h, { children: [
|
|
12
|
-
/* @__PURE__ */ s(d, { children: i("Confirm action") }),
|
|
13
|
-
/* @__PURE__ */ o(m, { children: [
|
|
14
|
-
i("Are you sure you want to unpublish"),
|
|
15
|
-
" ",
|
|
16
|
-
/* @__PURE__ */ s("b", { children: (n == null ? void 0 : n.name) ?? (n == null ? void 0 : n.slug) }),
|
|
17
|
-
"?"
|
|
18
|
-
] })
|
|
19
|
-
] }),
|
|
20
|
-
/* @__PURE__ */ o(b, { children: [
|
|
21
|
-
/* @__PURE__ */ s(l, { variant: "outline", onClick: r, children: i("Cancel") }),
|
|
22
|
-
/* @__PURE__ */ s(l, { variant: "destructive", disabled: t, onClick: a, children: i(t ? "Updating..." : "Unpublish") })
|
|
23
|
-
] })
|
|
24
|
-
] }) });
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
v as default
|
|
28
|
-
};
|