@chaibuilder/sdk 4.0.0-beta.2 → 4.0.0-beta.4
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-C4VFVd-q.cjs → 2SSKDMRQ-CopJgtZb.cjs} +1 -1
- package/dist/{2SSKDMRQ-DSnzF_1o.js → 2SSKDMRQ-Difo_1pg.js} +2 -2
- package/dist/{AP7HFJJL-Cxwj01Aq.js → AP7HFJJL-BPuPBqj4.js} +1 -1
- package/dist/{AP7HFJJL-B7YYCY9q.cjs → AP7HFJJL-DYxDgaOs.cjs} +1 -1
- package/dist/{IconPicker-RqVvq6G2.js → IconPicker-B2-oriq2.js} +8 -7
- package/dist/IconPicker-C0oycHbs.cjs +1 -0
- package/dist/{WDYDFRGG-b3T2SQbz.cjs → WDYDFRGG-DbejaRPK.cjs} +1 -1
- package/dist/{WDYDFRGG-C7aSUcjs.js → WDYDFRGG-KK8pkcW1.js} +2 -2
- package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
- package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/active-in-another-tab-Cu_ASKtx.cjs +1 -0
- package/dist/active-in-another-tab-DkR2HWI4.js +35 -0
- package/dist/add-new-language-page-BXuwluuU.cjs +1 -0
- package/dist/{add-new-language-page-D7NDABl1.js → add-new-language-page-CBY0RR6q.js} +54 -53
- package/dist/{add-new-page-BNfwKjRd.cjs → add-new-page-C_PzKby8.cjs} +1 -1
- package/dist/{add-new-page-B4hc0B-g.js → add-new-page-DJLJFLAd.js} +2 -2
- package/dist/{ai-panel-content-BnbURb7j.js → ai-panel-content--YM01Aly.js} +12 -11
- package/dist/ai-panel-content-rRmJdH7L.cjs +1 -0
- package/dist/{ai-panel-default-lang-oVk4TDeb.js → ai-panel-default-lang-BZl0tPYo.js} +40 -40
- package/dist/{ai-panel-default-lang-3tCHzab5.cjs → ai-panel-default-lang-D2zhXvKP.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DmQ3QMDD.js → ai-panel-other-lang-Bfjk2CYZ.js} +8 -8
- package/dist/{ai-panel-other-lang-BBHCCSen.cjs → ai-panel-other-lang-Y4bEKHoG.cjs} +1 -1
- package/dist/{ai-prompt-input-DaTyfib-.js → ai-prompt-input-DueQYNf-.js} +68 -67
- package/dist/ai-prompt-input-N9PcYCFa.cjs +1 -0
- package/dist/{ai-translation-prompt-DJPe2O-n.js → ai-translation-prompt-B36F3d7K.js} +2 -2
- package/dist/ai-translation-prompt-IAdWMNZb.cjs +1 -0
- package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
- package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
- package/dist/{code-display-BzBq5xSn.js → code-display-Ck81Id9K.js} +1 -1
- package/dist/code-display-DloSPyPr.cjs +1 -0
- package/dist/{code-editor-DWWnphW9.js → code-editor-Bb7JumZy.js} +11 -10
- package/dist/code-editor-DQB8lAOk.cjs +1 -0
- package/dist/{continue-editing-in-this-client-BllU94XG.js → continue-editing-in-this-client-Dm9cCj7K.js} +10 -9
- package/dist/continue-editing-in-this-client-DmGFLHXw.cjs +1 -0
- package/dist/core-Dr7QYemB.js +56 -0
- package/dist/core-Y0lXLwkq.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +41 -39
- package/dist/{css-import-modal-D72a-16X.js → css-import-modal-9P_0uNa4.js} +4 -3
- package/dist/css-import-modal-Rh1QAVxo.cjs +13 -0
- package/dist/{delete-design-token-D_TLlO3I.cjs → delete-design-token-BG8yHcS5.cjs} +1 -1
- package/dist/{delete-design-token-Cd1ZDtqT.js → delete-design-token-COvR4G1S.js} +1 -1
- package/dist/{delete-page-DC8pzvWW.js → delete-page-CNucxe4P.js} +11 -10
- package/dist/delete-page-DAvEjHwF.cjs +1 -0
- package/dist/design-token-usage-CXglXgcJ.cjs +1 -0
- package/dist/{design-token-usage-DE4XCDdn.js → design-token-usage-MNYsFlPG.js} +14 -13
- package/dist/digital-asset-manager-CB5MRBcW.cjs +1 -0
- package/dist/{digital-asset-manager-C_gL_0YY.js → digital-asset-manager-CqCWBO0s.js} +6 -5
- package/dist/{duplicate-page-BoVhko2q.js → duplicate-page-BknLfqr0.js} +19 -18
- package/dist/duplicate-page-DzZByALW.cjs +1 -0
- package/dist/{dynamic-page-selector-CSndg2-y.js → dynamic-page-selector-DoW7OyUB.js} +15 -14
- package/dist/dynamic-page-selector-WA007Sni.cjs +1 -0
- package/dist/get-chai-builder-tailwind-config-BFePCEIS.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-BXf_xLHk.js} +5 -5
- package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
- package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
- package/dist/{image-editor-oypq8asR.js → image-editor-CQnNtak2.js} +1 -1
- package/dist/{image-editor-DTspjj_c.cjs → image-editor-CqwaVxO2.cjs} +1 -1
- package/dist/index-C0-pgg_p.cjs +5 -0
- package/dist/index-C99FhuF1.cjs +160 -0
- package/dist/{index-BDnwJqMw.js → index-Dno42B0a.js} +716 -714
- package/dist/{index-S8ibZk9Q.js → index-rAcNbjk_.js} +3744 -3920
- package/dist/{json-diff-viewer-XX1pgabt.cjs → json-diff-viewer-CLuUHiPU.cjs} +3 -3
- package/dist/{json-diff-viewer-B5dr-Y_L.js → json-diff-viewer-CMvGUvJ2.js} +5 -4
- package/dist/{lang-panel-Cn83SRzd.js → lang-panel-CnwTb05j.js} +15 -14
- package/dist/lang-panel-fDCYm5Jm.cjs +1 -0
- package/dist/{manage-design-tokens-lP4HLS0P.js → manage-design-tokens-BsSZE9Vs.js} +12 -11
- package/dist/manage-design-tokens-BvH5KTJX.cjs +1 -0
- package/dist/mark-as-template-CpWEBJGd.cjs +1 -0
- package/dist/{mark-as-template-jncsjfHm.js → mark-as-template-DBLshWb5.js} +17 -16
- package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-6OBJ8LG8.js} +24 -23
- package/dist/nested-path-selector-content-C2sD9dkq.cjs +1 -0
- package/dist/no-language-page-content-BvPDdccK.cjs +1 -0
- package/dist/{no-language-page-content-D_zd9Rb0.js → no-language-page-content-CzENgtnu.js} +10 -9
- package/dist/{no-language-page-dialog-C5Ps6YYL.js → no-language-page-dialog-CbYI2cVg.js} +2 -2
- package/dist/{no-language-page-dialog-fXmbQO7L.cjs → no-language-page-dialog-CgW4yJBC.cjs} +1 -1
- package/dist/{page-creator-wCMtlE6Z.js → page-creator-Cc83uQqw.js} +113 -112
- package/dist/page-creator-g8GqgcKH.cjs +1 -0
- package/dist/{page-lock-BPCxfv9J.js → page-lock-BJUkyxdh.js} +2 -2
- package/dist/{page-lock-DweiYy1w.cjs → page-lock-CT7SmQqp.cjs} +1 -1
- package/dist/page-locked-dialog-Co5b9XIZ.cjs +1 -0
- package/dist/{page-locked-dialog-ByGl18_m.js → page-locked-dialog-DsEbWRed.js} +18 -15
- package/dist/{page-manager-new-BWFE-S-O.js → page-manager-new-5rFP5DyQ.js} +30 -29
- package/dist/page-manager-new-BOkJImo2.cjs +1 -0
- package/dist/page-manager-search-and-filter-Bfm0j1gg.cjs +1 -0
- package/dist/{page-manager-search-and-filter-kNJFWJ86.js → page-manager-search-and-filter-zq-LfhQ1.js} +13 -12
- package/dist/{page-revisions-content-Ulr8slUN.js → page-revisions-content-D38G2tJM.js} +34 -31
- package/dist/page-revisions-content-ag-MHBGr.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +22 -23
- package/dist/pages.js +12 -12
- package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
- package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
- package/dist/publish-pages-content-BiX-GMLw.cjs +1 -0
- package/dist/{publish-pages-content-BTPzt_m4.js → publish-pages-content-CS7f41Ac.js} +66 -65
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
- package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -2
- package/dist/render.js +87 -80
- package/dist/rte-widget-modal-BKNx2wln.cjs +1 -0
- package/dist/{rte-widget-modal-Rk_NW3KU.js → rte-widget-modal-D6Zik0Ta.js} +15 -14
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +168 -4
- package/dist/runtime.js +68 -38
- package/dist/{save-to-lib-BK3uTFss.js → save-to-lib-WwOzbgiF.js} +39 -38
- package/dist/save-to-lib-ffjCZYJ5.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CU3TwIMA.js → selected-block-display-B1SG_UXw.js} +37 -36
- package/dist/selected-block-display-BOgnQRLF.cjs +16 -0
- package/dist/{seo-panel-jbzxFioc.js → seo-panel-BkOgRoWd.js} +12 -11
- package/dist/seo-panel-FjS1UF_y.cjs +2 -0
- package/dist/{shared-json-ld-BL_dv3_q.js → shared-json-ld-uka9TOgA.js} +68 -67
- package/dist/shared-json-ld-yJkXjENy.cjs +1 -0
- package/dist/slug-input-Cyd6NR6J.cjs +1 -0
- package/dist/{slug-input-1qwKkXhA.js → slug-input-DHLmUNrH.js} +9 -8
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-DKvKi3mM.js → take-over-request-Ca0X-qyf.js} +17 -16
- package/dist/take-over-request-CmpJVe9T.cjs +1 -0
- package/dist/{theme-panel-footer-DbMDLYGI.js → theme-panel-footer-BUXIu252.js} +11 -10
- package/dist/theme-panel-footer-CKO9YYwZ.cjs +1 -0
- package/dist/{translation-warning-modal-9wTwIy_9.js → translation-warning-modal-DrpFeI83.js} +9 -8
- package/dist/translation-warning-modal-pSZVKcNW.cjs +1 -0
- package/dist/{unmark-as-template-Dulvf7Zw.js → unmark-as-template-BMqgelv-.js} +11 -10
- package/dist/unmark-as-template-DF1Ms4VN.cjs +1 -0
- package/dist/unpublish-page-BJ0Bsvt2.js +28 -0
- package/dist/unpublish-page-Bsq2yEqQ.cjs +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +5 -5
- package/dist/{web-preview-DXE4Jnf5.js → web-preview-D6h1L2nV.js} +2 -2
- package/dist/web-preview-kres0aG7.cjs +1 -0
- package/package.json +4 -2
- package/dist/IconPicker-C9-ieDWm.cjs +0 -1
- package/dist/active-in-another-tab-Clng6zpY.cjs +0 -1
- package/dist/active-in-another-tab-wb8qolB8.js +0 -34
- package/dist/add-new-language-page-C4BuMTaN.cjs +0 -1
- package/dist/ai-panel-content-DPy2jgKw.cjs +0 -1
- package/dist/ai-prompt-input-b5ty81RB.cjs +0 -1
- package/dist/ai-translation-prompt-c0Q3zkT2.cjs +0 -1
- package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
- package/dist/code-display-Q3_sK_Ta.cjs +0 -1
- package/dist/code-editor-BQZi6-FB.cjs +0 -1
- package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +0 -1
- package/dist/core-BoRDjj4h.cjs +0 -1
- package/dist/core-yvI6kCyw.js +0 -56
- package/dist/css-import-modal-BSMGKA2T.cjs +0 -13
- package/dist/delete-page-ByQwBupJ.cjs +0 -1
- package/dist/design-token-usage-BqZeR1sT.cjs +0 -1
- package/dist/digital-asset-manager-BYLKFEYi.cjs +0 -1
- package/dist/duplicate-page-vdvwLQLo.cjs +0 -1
- package/dist/dynamic-page-selector-DdnbCuQZ.cjs +0 -1
- package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
- package/dist/index-CbwxUFy_.cjs +0 -5
- package/dist/index-CnSjWE1P.cjs +0 -160
- package/dist/lang-panel-BPxex-M2.cjs +0 -1
- package/dist/manage-design-tokens-ConiyuPr.cjs +0 -1
- package/dist/mark-as-template-DYRxre1f.cjs +0 -1
- package/dist/nested-path-selector-content-BYtLi7mC.cjs +0 -1
- package/dist/no-language-page-content-DAbLq0gX.cjs +0 -1
- package/dist/page-creator-VWIB2VAs.cjs +0 -1
- package/dist/page-locked-dialog-BlbgvaG2.cjs +0 -1
- package/dist/page-manager-new-D0lGfNnS.cjs +0 -1
- package/dist/page-manager-search-and-filter-DpGMoOII.cjs +0 -1
- package/dist/page-revisions-content-DYxXZqmh.cjs +0 -1
- package/dist/publish-pages-content-D6g8GAsd.cjs +0 -1
- package/dist/rte-widget-modal-DrMzWWjw.cjs +0 -1
- package/dist/save-to-lib-DHHUO12i.cjs +0 -1
- package/dist/selected-block-display-DSFhddPj.cjs +0 -16
- package/dist/seo-panel-Dl0IDV09.cjs +0 -2
- package/dist/shared-json-ld-DPNkqDC1.cjs +0 -1
- package/dist/slug-input-YVLjtTI3.cjs +0 -1
- package/dist/take-over-request-DvMIg_cZ.cjs +0 -1
- package/dist/theme-panel-footer-BMOaPLWc.cjs +0 -1
- package/dist/translation-warning-modal-DjTwz75c.cjs +0 -1
- package/dist/unmark-as-template-CdqIJJER.cjs +0 -1
- package/dist/unpublish-page-BwSVBf0_.cjs +0 -1
- package/dist/unpublish-page-Degu5Cy9.js +0 -27
- package/dist/web-preview-YzKxyXft.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-C99FhuF1.cjs"),L=require("./register-chai-top-bar-BqwKw4uy.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-C0-pgg_p.cjs"),H=require("@tanstack/react-query");function K(t,r){const o=O.useApiUrl(),n=O.useFetch(),f=p.startsWith(t.uid,"draft:")||p.startsWith(r.uid,"live:");return H.useQuery({queryKey:["revision-comparison",t.uid,r.uid],queryFn:async()=>{if(!t.uid||!r.uid)throw new Error("Both revision IDs are required for comparison");const l=u=>u==="draft"||u==="live"?u:"revision",s=u=>p.replace(u.uid,`${u.label}:`,"");return await n(o,{action:O.ACTIONS.GET_COMPARE_DATA,data:{versions:{version1:{type:l(t.label),id:s(t)},version2:{type:l(r.label),id:s(r)}}}})},enabled:!!t.uid&&!!r.uid,staleTime:f?0:1/0})}const V=({version:t})=>{const r=t==null?void 0:t.item,{data:o}=O.useChaiUserInfo(r==null?void 0:r.currentEditor),n=t.label==="live",f=t.label==="draft";return e.jsxs("span",{className:`flex items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${n?"border-green-500/30":f?"border-amber-500/30":"border-purple-500/30"}`,children:[e.jsx("div",{className:"h-full items-center rounded px-1.5 py-0.5 font-medium capitalize"+(n?" bg-green-500 text-green-50":f?" bg-amber-500 text-amber-50":" bg-purple-500 text-purple-50"),children:t.label}),e.jsxs("div",{className:"py-1 text-xs font-light leading-none text-gray-800",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-light opacity-90",children:f?"Currently editing":"Published by"}),!f&&e.jsx("span",{className:"pl-1 font-medium",children:(o==null?void 0:o.name)||"Unknown"})]}),e.jsx("div",{className:"text-[10px] leading-tight",children:z.formatDate(r.createdAt,"dd MMM yyyy, h:mm a")})]})]})},F=({version:t})=>e.jsx(V,{version:t});function U(t,r,o="data.json"){const n=JSON.stringify(t,null,2),f=JSON.stringify(r,null,2),l=n.split(`
|
|
2
2
|
`),s=f.split(`
|
|
3
3
|
`);let d=`--- a/${o}
|
|
4
4
|
`;d+=`+++ b/${o}
|
|
5
|
-
`;const u=[];let c=0,
|
|
5
|
+
`;const u=[];let c=0,x=0;for(;c<l.length||x<s.length;){const g=l[c]||"",v=s[x]||"";if(g===v)u.push(` ${g}`),c++,x++;else{let h=-1,j=-1;for(let a=c+1;a<l.length;a++)if(s[x]===l[a]){h=a;break}for(let a=x+1;a<s.length;a++)if(l[c]===s[a]){j=a;break}if(h!==-1&&(j===-1||h-c<=j-x)){for(let a=c;a<h;a++)u.push(`-${l[a]}`);c=h}else if(j!==-1){for(let a=x;a<j;a++)u.push(`+${s[a]}`);x=j}else g&&u.push(`-${g}`),v&&u.push(`+${v}`),c++,x++}}const w=l.length,J=s.length;return d+=`@@ -1,${w} +1,${J} @@
|
|
6
6
|
`,d+=u.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
`,d}function T(t,r=!0,o=!1){if(p.isString(t)){const n=p.trim(t);if(p.startsWith(n,"{")||p.startsWith(n,"[")||r&&(n==="true"||n==="false"||n==="null"||/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(n)))try{const l=JSON.parse(n);return T(l,r,o)}catch{if(o)throw new Error(`Invalid JSON string: ${n}`);return{}}return t}return p.isArray(t)?p.map(t,n=>T(n,r,o)):p.isPlainObject(t)?p.mapValues(t,n=>T(n,r,o)):t}const
|
|
8
|
+
`,d}function T(t,r=!0,o=!1){if(p.isString(t)){const n=p.trim(t);if(p.startsWith(n,"{")||p.startsWith(n,"[")||r&&(n==="true"||n==="false"||n==="null"||/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(n)))try{const l=JSON.parse(n);return T(l,r,o)}catch{if(o)throw new Error(`Invalid JSON string: ${n}`);return{}}return t}return p.isArray(t)?p.map(t,n=>T(n,r,o)):p.isPlainObject(t)?p.mapValues(t,n=>T(n,r,o)):t}const W=t=>{switch(t){case"blocks":return"Blocks";case"seo":return"SEO";case"tracking":return"Tracking";default:return t}},_=(t,r)=>{if(!t||!r)return[{key:"blocks",label:"Blocks"}];const o=Object.keys(t),n=Object.keys(r);return o.filter(s=>n.includes(s)).map(s=>({key:s,label:W(s)})).filter(s=>s.key.length>0)},P=(t,r=3)=>{const o=new Set;t.map((s,d)=>({change:s,index:d})).filter(({change:s})=>s.type!=="normal").map(({index:s})=>s).forEach(s=>{const d=Math.max(0,s-r),u=Math.min(t.length-1,s+r);for(let c=d;c<=u;c++)o.add(c)});const f=[];let l=-1;return t.forEach((s,d)=>{if(o.has(d)){if(l!==-1&&d-l>1){const u=t[l].lineNumber!=null?t[l].lineNumber+1:l+2,c=t[d].lineNumber!=null?t[d].lineNumber-1:d;f.push({content:e.jsx(m.Badge,{className:"pointer-events-none w-60 -translate-x-1/2 cursor-default border-none bg-transparent py-1 shadow-none",children:e.jsxs("span",{className:"rounded border border-border bg-muted px-3 py-1 text-xs font-light leading-none text-muted-foreground",children:["No changes from ",u," to ",c," line"]})})})}f.push(s),l=d}}),f};function G({open:t,compare:r,onOpenChange:o}){const n=r[0],f=r[1],[l,s]=b.useState(null),[d,u]=b.useState("split"),[c,x]=b.useState(!1),[w,J]=b.useState(!0),[g,v]=b.useState("blocks"),{data:h,isLoading:j}=K(n,f),{leftData:a,rightData:k,options:B}=b.useMemo(()=>{var y,R;const i=(y=h==null?void 0:h.version1)==null?void 0:y[g],C=(R=h==null?void 0:h.version2)==null?void 0:R[g],S=T(i),D=T(C),q=_(h==null?void 0:h.version1,h==null?void 0:h.version2);return{leftData:S,rightData:D,options:q}},[h,g]),$=b.useMemo(()=>!a||!k?"":U(a,k),[a,k]),A=b.useMemo(()=>{if(!$)return[];try{return M.parseDiff($)}catch(i){return console.error("Failed to parse diff:",i),[]}},[$]),I=async(i,C)=>{try{await navigator.clipboard.writeText(JSON.stringify(i,null,2)),s(C),setTimeout(()=>s(null),2e3)}catch(S){console.error("Failed to copy:",S)}},E=i=>JSON.stringify(i,null,2);return e.jsx(m.Dialog,{open:t,onOpenChange:o,children:e.jsxs(m.DialogContent,{className:"flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-6",children:[e.jsx(m.DialogHeader,{className:"pb-4 pt-0",children:e.jsxs(m.DialogTitle,{className:"flex items-center justify-between gap-2 leading-none",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N.FileJson,{className:"h-5 w-5"}),"Compare","",B.map(i=>e.jsx("div",{className:`cursor-pointer rounded-full border px-2.5 py-1 text-xs leading-none ${g===i.key?"border-blue-500 bg-blue-500 text-white":"border-gray-600 text-gray-600 hover:bg-gray-200"}`,onClick:()=>v(i.key),children:i.label},i.key))]}),e.jsx("div",{className:"flex flex-1 items-center justify-end pr-8",children:e.jsxs("div",{className:"flex w-max items-center justify-end gap-2 rounded-md border px-1.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{disabled:c,checked:c?!0:d==="split",onCheckedChange:i=>u(i?"split":"unified")}),e.jsx("label",{className:"text-sm",children:"Split View"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{checked:c,onCheckedChange:i=>x(i)}),e.jsx("label",{className:"text-sm",children:"Show Raw Data"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{checked:w,onCheckedChange:i=>J(i)}),e.jsx("label",{className:"text-sm",children:"Hide Common Data"})]})]})})]})}),j?e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(N.Loader,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsxs("div",{className:"relative min-h-0 flex-1",children:[e.jsxs("div",{className:"absolute -top-5 z-50 mt-0.5 flex w-full items-center justify-between gap-2",children:[e.jsx("div",{className:"flex w-1/2 items-center justify-center gap-2",children:e.jsx(F,{version:n})}),e.jsx("div",{className:"flex w-1/2 items-center justify-center gap-2",children:e.jsx(F,{version:f})})]}),c?e.jsxs("div",{className:"grid h-full grid-cols-2 gap-3 rounded-lg border",children:[e.jsxs("div",{className:"relative flex min-h-0 flex-col border-r",children:[e.jsx("div",{className:"absolute -top-4 right-4 z-50",children:e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>I(a,"left"),children:[l==="left"?e.jsx(N.Check,{className:"text-green-500"}):e.jsx(N.Copy,{}),"Copy"]})}),e.jsx(m.ScrollArea,{className:"flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:E(a)})})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-col",children:[e.jsx("div",{className:"absolute -top-4 right-4 z-50",children:e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>I(k,"right"),children:[l==="right"?e.jsx(N.Check,{className:"text-green-500"}):e.jsx(N.Copy,{}),"Copy"]})}),e.jsx(m.ScrollArea,{className:"flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:E(k)})})]})]}):e.jsx(m.ScrollArea,{className:"h-full overflow-y-auto rounded-lg border bg-slate-50 text-xs dark:bg-slate-900",children:A.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(N.FileJson,{className:"mx-auto mb-2 h-8 w-8 opacity-50"}),e.jsx("p",{children:"No differences found or unable to parse diff"})]})}):e.jsx("div",{children:A.map((i,C)=>e.jsx("div",{className:"relative mb-4",children:e.jsx(M.Diff,{viewType:d,diffType:i.type,hunks:i.hunks,className:"rounded-lg text-xs",children:S=>S.map((D,q)=>{const y=w?P(D.changes):D.changes;return(y==null?void 0:y.length)===0?e.jsx("div",{className:"absolute h-full w-full border-l pt-64 text-center font-sans text-sm",children:e.jsx("span",{children:"No difference found"})}):e.jsx(M.Hunk,{hunk:{...D,changes:y}},q)})},w?"hide-common-data":"show-common-data")},C))})})]})})]})})}exports.default=G;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
-
import { D as V, d as _, e as q, f as G,
|
|
2
|
+
import { D as V, d as _, e as q, f as G, af as $, a2 as I, ag as P } from "./index-rAcNbjk_.js";
|
|
3
|
+
import { B as z } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
4
|
import { formatDate as Q } from "date-fns";
|
|
4
5
|
import { startsWith as T, replace as W, isString as X, trim as Y, isArray as Z, map as ee, isPlainObject as te, mapValues as re } from "lodash-es";
|
|
5
6
|
import { FileJson as B, Loader as ne, Check as F, Copy as H } from "lucide-react";
|
|
6
7
|
import { useState as D, useMemo as A } from "react";
|
|
7
8
|
import { parseDiff as se, Diff as le, Hunk as ae } from "react-diff-view";
|
|
8
|
-
import { ar as ie, as as oe, A as ce, ap as de } from "./index-
|
|
9
|
+
import { ar as ie, as as oe, A as ce, ap as de } from "./index-Dno42B0a.js";
|
|
9
10
|
import { useQuery as fe } from "@tanstack/react-query";
|
|
10
11
|
function me(t, n) {
|
|
11
12
|
const o = ie(), s = oe(), u = T(t.uid, "draft:") || T(n.uid, "live:");
|
|
@@ -156,7 +157,7 @@ const pe = (t) => {
|
|
|
156
157
|
}
|
|
157
158
|
}), u;
|
|
158
159
|
};
|
|
159
|
-
function
|
|
160
|
+
function je({ open: t, compare: n, onOpenChange: o }) {
|
|
160
161
|
const s = n[0], u = n[1], [l, r] = D(null), [d, f] = D("split"), [c, p] = D(!1), [y, j] = D(!0), [g, N] = D("blocks"), { data: m, isLoading: x } = me(s, u), { leftData: a, rightData: w, options: U } = A(() => {
|
|
161
162
|
var b, R;
|
|
162
163
|
const i = (b = m == null ? void 0 : m.version1) == null ? void 0 : b[g], v = (R = m == null ? void 0 : m.version2) == null ? void 0 : R[g], k = S(i), C = S(v), J = ge(m == null ? void 0 : m.version1, m == null ? void 0 : m.version2);
|
|
@@ -254,5 +255,5 @@ function Te({ open: t, compare: n, onOpenChange: o }) {
|
|
|
254
255
|
] }) });
|
|
255
256
|
}
|
|
256
257
|
export {
|
|
257
|
-
|
|
258
|
+
je as default
|
|
258
259
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as M } from "react/jsx-runtime";
|
|
2
|
-
import { D as j,
|
|
3
|
-
import {
|
|
2
|
+
import { D as j, z as F, B as A } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { D as B, d as H, e as O, f as W, p as q, L as R, q as J, n as K, r as Q, s as V, t as X, v as w } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { au as Y, m as T, L as I, av as Z, l as ee, aw as se, j as ae, ax as f, ay as o } from "./index-Dno42B0a.js";
|
|
4
5
|
import { find as G, startsWith as E, isEqual as ne, filter as te, get as D, map as le, isEmpty as ie } from "lodash-es";
|
|
5
6
|
import { AlertCircle as re, StarIcon as ce, MoreHorizontal as oe, PencilIcon as de, Power as me, TrashIcon as ue } from "lucide-react";
|
|
6
7
|
import { useState as S, useMemo as he, Suspense as L, lazy as z } from "react";
|
|
@@ -8,8 +9,8 @@ import { useTranslation as U } from "react-i18next";
|
|
|
8
9
|
import { toast as ge } from "sonner";
|
|
9
10
|
import { useSetAtom as pe } from "jotai";
|
|
10
11
|
const fe = ({ page: a, onClose: g }) => {
|
|
11
|
-
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data: t } =
|
|
12
|
-
if (m.preventDefault(), !(a != null && a.primaryPage) && Object.keys(
|
|
12
|
+
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data: t } = T(), r = G(t, { key: a == null ? void 0 : a.pageType }), x = (m) => {
|
|
13
|
+
if (m.preventDefault(), !(a != null && a.primaryPage) && Object.keys(I).some((p) => i === `/${p}` || E(i, `/${p}/`))) {
|
|
13
14
|
ge.error(l("Error"), {
|
|
14
15
|
description: l("Slugs cannot start with a language code for primary page")
|
|
15
16
|
});
|
|
@@ -17,10 +18,10 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
17
18
|
}
|
|
18
19
|
N({ ...a, slug: i }, { onSuccess: g });
|
|
19
20
|
}, d = (a == null ? void 0 : a.lang) || "";
|
|
20
|
-
return /* @__PURE__ */ e(
|
|
21
|
-
/* @__PURE__ */ s(
|
|
22
|
-
/* @__PURE__ */ e(
|
|
23
|
-
/* @__PURE__ */ e(
|
|
21
|
+
return /* @__PURE__ */ e(B, { open: !!a, onOpenChange: g, children: /* @__PURE__ */ s(H, { children: [
|
|
22
|
+
/* @__PURE__ */ s(O, { children: [
|
|
23
|
+
/* @__PURE__ */ e(W, { children: l("Change Slug") }),
|
|
24
|
+
/* @__PURE__ */ e(q, { className: "text-xs", children: /* @__PURE__ */ s(j, { variant: "destructive", className: "mt-2", children: [
|
|
24
25
|
/* @__PURE__ */ e(re, { className: "h-4 w-4" }),
|
|
25
26
|
l("Changing the slug may have impact on your SEO. Please proceed with caution.")
|
|
26
27
|
] }) })
|
|
@@ -50,7 +51,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
50
51
|
] })
|
|
51
52
|
] }),
|
|
52
53
|
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
53
|
-
/* @__PURE__ */ s(
|
|
54
|
+
/* @__PURE__ */ s(R, { htmlFor: "slug", className: "text-right", children: [
|
|
54
55
|
l("Slug"),
|
|
55
56
|
" ",
|
|
56
57
|
/* @__PURE__ */ s("small", { className: "font-light text-gray-500", children: [
|
|
@@ -60,7 +61,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
60
61
|
] })
|
|
61
62
|
] }),
|
|
62
63
|
/* @__PURE__ */ e(
|
|
63
|
-
|
|
64
|
+
F,
|
|
64
65
|
{
|
|
65
66
|
id: "slug",
|
|
66
67
|
value: i,
|
|
@@ -80,8 +81,8 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
80
81
|
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { type: "submit", disabled: y || !E(i, `/${d}`) || ne(a == null ? void 0 : a.slug, i), children: l(y ? "Changing..." : "Change Slug") }) })
|
|
81
82
|
] })
|
|
82
83
|
] }) });
|
|
83
|
-
}, Ne = z(() => import("./delete-page-
|
|
84
|
-
const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data: t } = se(), { data: r } =
|
|
84
|
+
}, Ne = z(() => import("./delete-page-CNucxe4P.js")), ye = z(() => import("./unpublish-page-BJ0Bsvt2.js")), ke = () => {
|
|
85
|
+
const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data: t } = se(), { data: r } = T(), x = he(() => {
|
|
85
86
|
const n = r == null ? void 0 : r.find((h) => h.key === (t == null ? void 0 : t.pageType));
|
|
86
87
|
return t != null && t.dynamic ? n == null ? void 0 : n.dynamicSlug : "";
|
|
87
88
|
}, [r, t == null ? void 0 : t.pageType, t == null ? void 0 : t.dynamic]), [d, m] = S(null), [u, C] = S(null), [p, _] = S(null), { data: P } = ae(), $ = te(
|
|
@@ -105,7 +106,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
105
106
|
/* @__PURE__ */ s("div", { className: "flex-1 gap-x-3", children: [
|
|
106
107
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-x-2 text-[13px] text-slate-800", children: [
|
|
107
108
|
/* @__PURE__ */ e("div", { className: `h-2.5 w-2.5 rounded-full ${n.online ? "bg-green-300" : "bg-gray-300"}` }),
|
|
108
|
-
D(
|
|
109
|
+
D(I, k ? i : h, h)
|
|
109
110
|
] }),
|
|
110
111
|
/* @__PURE__ */ s("div", { children: [
|
|
111
112
|
b && /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
|
|
@@ -211,5 +212,5 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
211
212
|
] });
|
|
212
213
|
};
|
|
213
214
|
export {
|
|
214
|
-
|
|
215
|
+
ke as default
|
|
215
216
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-BqwKw4uy.cjs"),a=require("./index-C99FhuF1.cjs"),n=require("./index-C0-pgg_p.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DAvEjHwF.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-Bsq2yEqQ.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.useChaiCurrentPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,C]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,v=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[v&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${v}/${E}`:v})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),C(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>C(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { z, B as u } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { a0 as _, a1 as H, a2 as K, L as X, a3 as q, a4 as J, a5 as Y } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { D as ee } from "./apply-binding-BvWfJCSZ.js";
|
|
4
5
|
import { MagnifyingGlassIcon as L, PlusIcon as O, TokensIcon as te, ArrowLeftIcon as ne, EyeOpenIcon as se, Pencil1Icon as re, TrashIcon as ae } from "@radix-ui/react-icons";
|
|
5
6
|
import { useAtom as oe } from "jotai";
|
|
6
7
|
import { nanoid as ie } from "nanoid";
|
|
@@ -16,7 +17,7 @@ const S = (n) => {
|
|
|
16
17
|
return m.length === 0 ? "" : m.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m) ? Object.entries(s).find(
|
|
17
18
|
([l, v]) => v.name === m && (!d || l !== i)
|
|
18
19
|
) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
|
|
19
|
-
}, xe = (n) => n.replace(/\s+/g, "-"), ge = M(() => import("./delete-design-token-
|
|
20
|
+
}, xe = (n) => n.replace(/\s+/g, "-"), ge = M(() => import("./delete-design-token-COvR4G1S.js")), pe = M(() => import("./design-token-usage-MNYsFlPG.js")), ve = ({ tokenId: n, token: s, isDisabled: o, onEdit: d, onDelete: i }) => /* @__PURE__ */ a("div", { className: "group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 hover:bg-muted/90", children: [
|
|
20
21
|
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
|
|
21
22
|
/* @__PURE__ */ e("div", { className: "text-xs font-semibold", children: s.name }),
|
|
22
23
|
/* @__PURE__ */ e("div", { className: "w-full max-w-52 truncate text-[10px] font-light", children: s.value })
|
|
@@ -53,7 +54,7 @@ const S = (n) => {
|
|
|
53
54
|
}
|
|
54
55
|
) }) })
|
|
55
56
|
] })
|
|
56
|
-
] }),
|
|
57
|
+
] }), Le = ({}) => {
|
|
57
58
|
const { t: n } = ue(), [s, o] = oe(_), d = H(), [i, m] = g("view"), [p, k] = g(null), [l, v] = g(""), [h, b] = g(""), [T, y] = g(""), [w, P] = g(""), [B, C] = g(!1), f = le(null), D = ce(() => Object.entries(s).filter(
|
|
58
59
|
([, t]) => t.name.toLowerCase().includes(w.toLowerCase()) || t.value.toLowerCase().includes(w.toLowerCase())
|
|
59
60
|
), [s, w]);
|
|
@@ -103,7 +104,7 @@ const S = (n) => {
|
|
|
103
104
|
}, W = (t) => {
|
|
104
105
|
const r = s[t];
|
|
105
106
|
r && (k(t), v(r.name), b(r.value), y(""), m("edit"));
|
|
106
|
-
},
|
|
107
|
+
}, E = () => {
|
|
107
108
|
k(null), v(""), b(""), y(""), m("add");
|
|
108
109
|
}, A = () => {
|
|
109
110
|
f.current && clearTimeout(f.current), k(null), v(""), b(""), y(""), C(!1), m("view");
|
|
@@ -112,14 +113,14 @@ const S = (n) => {
|
|
|
112
113
|
v(r);
|
|
113
114
|
const c = fe(r, s, n, i === "edit", p || void 0);
|
|
114
115
|
y(c), i === "edit" && !c && j(r, h);
|
|
115
|
-
},
|
|
116
|
+
}, I = (t) => {
|
|
116
117
|
b(t), i === "edit" && !T && l.trim() && j(l, t);
|
|
117
118
|
}, $ = (t) => {
|
|
118
119
|
const r = J(Y(he(h, t)));
|
|
119
|
-
|
|
120
|
+
I(r);
|
|
120
121
|
}, G = (t) => {
|
|
121
122
|
const r = h.split(" ").filter((c) => c !== t).join(" ");
|
|
122
|
-
|
|
123
|
+
I(r);
|
|
123
124
|
};
|
|
124
125
|
return /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i === "view" ? /* @__PURE__ */ a(Q, { children: [
|
|
125
126
|
Object.entries(s).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
@@ -139,7 +140,7 @@ const S = (n) => {
|
|
|
139
140
|
u,
|
|
140
141
|
{
|
|
141
142
|
variant: "outline",
|
|
142
|
-
onClick:
|
|
143
|
+
onClick: E,
|
|
143
144
|
size: "sm",
|
|
144
145
|
className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
|
|
145
146
|
children: [
|
|
@@ -154,7 +155,7 @@ const S = (n) => {
|
|
|
154
155
|
/* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(te, { className: "h-12 w-12 text-muted-foreground" }) }),
|
|
155
156
|
/* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
|
|
156
157
|
/* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
|
|
157
|
-
/* @__PURE__ */ a(u, { variant: "default", onClick:
|
|
158
|
+
/* @__PURE__ */ a(u, { variant: "default", onClick: E, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
|
|
158
159
|
/* @__PURE__ */ e(O, { className: "mr-1 h-3 w-3" }),
|
|
159
160
|
n("Add first design token")
|
|
160
161
|
] })
|
|
@@ -236,5 +237,5 @@ const S = (n) => {
|
|
|
236
237
|
})() });
|
|
237
238
|
};
|
|
238
239
|
export {
|
|
239
|
-
|
|
240
|
+
Le as default
|
|
240
241
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-BqwKw4uy.cjs"),v=require("./index-C99FhuF1.cjs"),Z=require("./apply-binding-IsUf6UWJ.cjs"),u=require("@radix-ui/react-icons"),$=require("jotai"),U=require("nanoid"),a=require("react"),Q=require("react-i18next"),p=require("sonner"),_=require("tailwind-merge"),q=t=>{const n=t.trim();return n.length===0||n.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(n)},H=(t,n,o,m=!1,i)=>{const x=t.trim();return x.length===0?"":x.length>25?o("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(x)?Object.entries(n).find(([l,N])=>N.name===x&&(!m||l!==i))?o("Token name already exists"):"":o("Only alphanumeric characters and hyphens allowed")},K=t=>t.replace(/\s+/g,"-"),X=a.lazy(()=>Promise.resolve().then(()=>require("./delete-design-token-BG8yHcS5.cjs"))),J=a.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-CXglXgcJ.cjs"))),Y=({tokenId:t,token:n,isDisabled:o,onEdit:m,onDelete:i})=>e.jsxs("div",{className:"group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 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",children:n.name}),e.jsx("div",{className:"w-full max-w-52 truncate text-[10px] font-light",children:n.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:[e.jsx(a.Suspense,{fallback:null,children:e.jsx(J,{tokenId:t,tokenName:n.name,children:e.jsx(c.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(u.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(c.Button,{variant:"ghost",size:"sm",onClick:()=>m(t),disabled:o,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(u.Pencil1Icon,{className:"h-3 w-3"})}),e.jsx(a.Suspense,{fallback:null,children:e.jsx(X,{tokenName:n.name,tokenValue:n.value,onDelete:()=>i(t),children:e.jsx(c.Button,{variant:"ghost",size:"sm",disabled:o,className:"h-6 w-6 rounded-full p-0 hover:bg-destructive/10",children:e.jsx(u.TrashIcon,{className:"h-3 w-3 text-destructive"})})})})]})]}),ee=({})=>{const{t}=Q.useTranslation(),[n,o]=$.useAtom(v.chaiDesignTokensAtom),m=v.useIncrementActionsCount(),[i,x]=a.useState("view"),[j,k]=a.useState(null),[l,N]=a.useState(""),[h,b]=a.useState(""),[T,y]=a.useState(""),[w,E]=a.useState(""),[z,C]=a.useState(!1),f=a.useRef(null),I=a.useMemo(()=>Object.entries(n).filter(([,s])=>s.name.toLowerCase().includes(w.toLowerCase())||s.value.toLowerCase().includes(w.toLowerCase())),[n,w]);a.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const S=a.useCallback((s,r)=>{!j||i!=="edit"||!s.trim()||!r.trim()||!q(s)||Object.entries(n).find(([g,W])=>W.name===s.trim()&&g!==j)||(C(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{const g={...n,[j]:{name:s.trim(),value:r.trim()}};o(g),m(),C(!1)},250))},[j,i,n,o,m]),M=()=>{if(!l.trim()||!h.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!q(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.values(n).find(g=>g.name===l.trim())){p.toast.error(t("Token already exists"));return}const r=`${Z.DESIGN_TOKEN_PREFIX}${U.nanoid(12)}`,d={...n,[r]:{name:l.trim(),value:h.trim()}};o(d),m(),p.toast.success(t("Token added successfully")),A()},P=s=>{const r={...n};delete r[s],o(r),m(),p.toast.success(t("Token deleted successfully"))},R=s=>{const r=n[s];r&&(k(s),N(r.name),b(r.value),y(""),x("edit"))},B=()=>{k(null),N(""),b(""),y(""),x("add")},A=()=>{f.current&&clearTimeout(f.current),k(null),N(""),b(""),y(""),C(!1),x("view")},O=s=>{const r=K(s);N(r);const d=H(r,n,t,i==="edit",j||void 0);y(d),i==="edit"&&!d&&S(r,h)},D=s=>{b(s),i==="edit"&&!T&&l.trim()&&S(l,s)},L=s=>{const r=v.orderClassesByBreakpoint(v.removeDuplicateClasses(_.twMerge(h,s)));D(r)},F=s=>{const r=h.split(" ").filter(d=>d!==s).join(" ");D(r)},G=()=>{const s=i==="edit",r=t(s?"Edit Design Token":"Add Design Token"),d=t(s?"Update design token. Auto-saved.":"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(c.Button,{variant:"ghost",size:"sm",onClick:A,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(u.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:r}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:d})]}),s&&z&&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(v.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:t("Token Name")}),e.jsx(c.Input,{id:"token-name",placeholder:"Button-Primary",value:l,onChange:g=>O(g.target.value),className:"h-7 text-xs"}),T?e.jsx("span",{className:"text-[10px] text-destructive",children:T}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:t("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(v.ManualClasses,{from:"designToken",classFromProps:h,onAddNew:L,onRemove:F}),!s&&e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(c.Button,{variant:"outline",onClick:A,className:"h-7 text-xs",children:t("Cancel")}),e.jsx(c.Button,{onClick:M,disabled:!l.trim()||!h.trim()||!!T,className:"h-7 text-xs",children:t("Add Token")})]})]})]})},V=()=>e.jsxs(e.Fragment,{children:[Object.entries(n).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(u.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(c.Input,{placeholder:t("Search tokens"),value:w,onChange:s=>E(s.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(c.Button,{variant:"outline",onClick:B,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(u.PlusIcon,{className:"h-3 w-3"}),t("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(v.ScrollArea,{className:"h-full flex-1",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(n).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(u.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("Create reusable design tokens to streamline your styling")}),e.jsxs(c.Button,{variant:"default",onClick:B,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(u.PlusIcon,{className:"mr-1 h-3 w-3"}),t("Add first design token")]})]}):I.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(u.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("No design tokens match your search")})]}):I.map(([s,r])=>e.jsx(Y,{token:r,tokenId:s,onEdit:R,onDelete:P,isDisabled:!1},s)),e.jsx("div",{className:"h-44"})]})})})]});return e.jsx("div",{className:"flex h-full w-full flex-col",children:i==="view"?V():G()})};exports.default=ee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./index-C99FhuF1.cjs"),y=require("./index-C0-pgg_p.cjs"),w=require("lodash-es"),m=require("lucide-react"),l=require("react"),M=require("react-i18next"),k=require("sonner"),B=1*1024*1024,A=({page:r,onClose:u})=>{const{t:s}=M.useTranslation(),[f,p]=l.useState(!1),[j,T]=l.useState(""),[c,N]=l.useState(""),[v,x]=l.useState(!1),i=l.useRef(null),C=y.useMarkAsTemplate(),{data:h}=y.usePageTypes(),g=h==null?void 0:h.find(a=>a.key===r.pageType),I=(g==null?void 0:g.name)||w.startCase(r.pageType),D=l.useCallback(a=>{var b;const d=(b=a.target.files)==null?void 0:b[0];if(d){if(d.size>B){k.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(d.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{x(!0);const n=new FileReader;n.onloadend=()=>{N(n.result),x(!1)},n.readAsDataURL(d)}catch(n){console.error("Error reading file:",n),x(!1),k.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),F=()=>{N(""),i.current&&(i.current.value="")},S=()=>{var a;(a=i.current)==null||a.click()},q=()=>{p(!0),C.mutate({page:r,name:r.name,description:j.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{p(!1),u()},onError:()=>{p(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:u,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:s("Mark as template")}),e.jsxs(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:w.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:I})]})]}),e.jsxs("div",{children:[e.jsx(t.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(t.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:j,onChange:a=>T(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o.Input,{type:"file",id:"previewImage",ref:i,onChange:D,accept:"image/*",className:"hidden"}),e.jsx(o.Button,{type:"button",variant:"outline",onClick:S,disabled:v,className:"w-full",children:v?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(m.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(o.Button,{type:"button",variant:"outline",size:"icon",onClick:F,children:e.jsx(m.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(t.DialogFooter,{className:f?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:a=>{a.stopPropagation(),u()},children:s("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:f,onClick:q,children:s("Mark as template")})]})]})})};exports.default=A;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { z, B as c } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { D as L, d as P, e as B, f as E, p as S, L as w, T as U, q as R } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { q as j, m as O } from "./index-Dno42B0a.js";
|
|
4
5
|
import { startCase as y } from "lodash-es";
|
|
5
6
|
import { Tag as q, File as X, ImageIcon as _, X as $ } from "lucide-react";
|
|
6
|
-
import { useState as
|
|
7
|
+
import { useState as m, useRef as H, useCallback as K } from "react";
|
|
7
8
|
import { useTranslation as Z } from "react-i18next";
|
|
8
9
|
import { toast as k } from "sonner";
|
|
9
|
-
const G = 1 * 1024 * 1024,
|
|
10
|
-
const { t: a } = Z(), [g, p] =
|
|
10
|
+
const G = 1 * 1024 * 1024, re = ({ page: n, onClose: d }) => {
|
|
11
|
+
const { t: a } = Z(), [g, p] = m(!1), [x, T] = m(""), [l, N] = m(""), [v, u] = m(!1), i = H(null), I = j(), { data: h } = O(), f = h == null ? void 0 : h.find((s) => s.key === n.pageType), C = (f == null ? void 0 : f.name) || y(n.pageType), D = K(
|
|
11
12
|
(s) => {
|
|
12
13
|
var b;
|
|
13
14
|
const o = (b = s.target.files) == null ? void 0 : b[0];
|
|
@@ -38,7 +39,7 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
38
39
|
var s;
|
|
39
40
|
(s = i.current) == null || s.click();
|
|
40
41
|
}, A = () => {
|
|
41
|
-
p(!0),
|
|
42
|
+
p(!0), I.mutate(
|
|
42
43
|
{
|
|
43
44
|
page: n,
|
|
44
45
|
name: n.name,
|
|
@@ -48,7 +49,7 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
onSuccess: () => {
|
|
51
|
-
p(!1),
|
|
52
|
+
p(!1), d();
|
|
52
53
|
},
|
|
53
54
|
onError: () => {
|
|
54
55
|
p(!1);
|
|
@@ -56,10 +57,10 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
59
|
};
|
|
59
|
-
return /* @__PURE__ */ e(L, { open: !0, onOpenChange:
|
|
60
|
-
/* @__PURE__ */ t(
|
|
61
|
-
/* @__PURE__ */ e(
|
|
62
|
-
/* @__PURE__ */ t(
|
|
60
|
+
return /* @__PURE__ */ e(L, { open: !0, onOpenChange: d, children: /* @__PURE__ */ t(P, { children: [
|
|
61
|
+
/* @__PURE__ */ t(B, { children: [
|
|
62
|
+
/* @__PURE__ */ e(E, { children: a("Mark as template") }),
|
|
63
|
+
/* @__PURE__ */ t(S, { className: "space-y-1 py-4 text-xs text-slate-500", children: [
|
|
63
64
|
a("Are you sure you want to mark this page as a template?"),
|
|
64
65
|
/* @__PURE__ */ e("br", {}),
|
|
65
66
|
a("Templates can be used to create new pages with the same content.")
|
|
@@ -87,13 +88,13 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
87
88
|
/* @__PURE__ */ t("div", { children: [
|
|
88
89
|
/* @__PURE__ */ e(w, { htmlFor: "description", className: "text-xs font-medium", children: a("Description (Optional)") }),
|
|
89
90
|
/* @__PURE__ */ e(
|
|
90
|
-
|
|
91
|
+
U,
|
|
91
92
|
{
|
|
92
93
|
id: "description",
|
|
93
94
|
placeholder: a("Describe this template's purpose"),
|
|
94
95
|
className: "mt-1 h-24 resize-none text-xs",
|
|
95
96
|
value: x,
|
|
96
|
-
onChange: (s) =>
|
|
97
|
+
onChange: (s) => T(s.target.value)
|
|
97
98
|
}
|
|
98
99
|
)
|
|
99
100
|
] }),
|
|
@@ -102,7 +103,7 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
102
103
|
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
103
104
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
104
105
|
/* @__PURE__ */ e(
|
|
105
|
-
|
|
106
|
+
z,
|
|
106
107
|
{
|
|
107
108
|
type: "file",
|
|
108
109
|
id: "previewImage",
|
|
@@ -142,7 +143,7 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
142
143
|
{
|
|
143
144
|
variant: "outline",
|
|
144
145
|
onClick: (s) => {
|
|
145
|
-
s.stopPropagation(),
|
|
146
|
+
s.stopPropagation(), d();
|
|
146
147
|
},
|
|
147
148
|
children: a("Cancel")
|
|
148
149
|
}
|
|
@@ -152,5 +153,5 @@ const G = 1 * 1024 * 1024, se = ({ page: n, onClose: m }) => {
|
|
|
152
153
|
] }) });
|
|
153
154
|
};
|
|
154
155
|
export {
|
|
155
|
-
|
|
156
|
+
re as default
|
|
156
157
|
};
|
package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-6OBJ8LG8.js}
RENAMED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { jsx as c, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeft as
|
|
2
|
+
import { ChevronLeft as v, ChevronRight as g } from "lucide-react";
|
|
3
3
|
import * as l from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { B as k } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
5
|
+
import { P as N, C as x, i as P, j as S, k as w, l as B, m as d } from "./index-rAcNbjk_.js";
|
|
6
|
+
function I({
|
|
6
7
|
data: o,
|
|
7
|
-
onSelect:
|
|
8
|
+
onSelect: m,
|
|
8
9
|
dataType: t = "value",
|
|
9
|
-
open:
|
|
10
|
-
setOpen:
|
|
10
|
+
open: h,
|
|
11
|
+
setOpen: u
|
|
11
12
|
}) {
|
|
12
|
-
const [s, i] = l.useState([]), [y,
|
|
13
|
+
const [s, i] = l.useState([]), [y, f] = l.useState(o);
|
|
13
14
|
l.useEffect(() => {
|
|
14
|
-
|
|
15
|
-
}, [o,
|
|
15
|
+
h || i([]), f(o);
|
|
16
|
+
}, [o, h]);
|
|
16
17
|
const b = (e) => Array.isArray(e) ? "array" : typeof e == "object" && e !== null ? "object" : "value", j = l.useCallback(
|
|
17
18
|
(e) => {
|
|
18
19
|
const r = (a) => t === "value" ? a === "value" || a === "object" : t === "array" ? a === "array" : a === t;
|
|
19
|
-
e.type === "object" ? (i((a) => [...a, e.key]),
|
|
20
|
+
e.type === "object" ? (i((a) => [...a, e.key]), f(e.value)) : r(e.type) && (m([...s, e.key].join(".")), u(!1));
|
|
20
21
|
},
|
|
21
|
-
[t,
|
|
22
|
+
[t, m, s, u]
|
|
22
23
|
), C = l.useCallback(() => {
|
|
23
24
|
if (s.length > 0) {
|
|
24
25
|
const e = s.slice(0, -1);
|
|
25
|
-
i(e),
|
|
26
|
+
i(e), f(e.reduce((r, a) => r[a], o));
|
|
26
27
|
}
|
|
27
|
-
}, [s, o]),
|
|
28
|
+
}, [s, o]), p = l.useMemo(() => Object.entries(y).map(([e, r]) => ({
|
|
28
29
|
key: e,
|
|
29
30
|
value: r,
|
|
30
31
|
type: b(r)
|
|
31
32
|
})).filter((e) => t === "value" ? e.type === "value" || e.type === "object" : t === "array" ? e.type === "array" || e.type === "object" : t === "object" ? e.type === "object" : !0), [y, t]);
|
|
32
|
-
return /* @__PURE__ */ c(
|
|
33
|
-
/* @__PURE__ */ c(
|
|
33
|
+
return /* @__PURE__ */ c(N, { className: "z-[9999] w-[200px] p-0", children: /* @__PURE__ */ n(x, { children: [
|
|
34
|
+
/* @__PURE__ */ c(P, { className: "border-none", placeholder: "Search..." }),
|
|
34
35
|
/* @__PURE__ */ n(
|
|
35
|
-
|
|
36
|
+
S,
|
|
36
37
|
{
|
|
37
38
|
onWheel: (e) => {
|
|
38
39
|
try {
|
|
@@ -44,13 +45,13 @@ function E({
|
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
children: [
|
|
47
|
-
/* @__PURE__ */ c(
|
|
48
|
-
/* @__PURE__ */ n(
|
|
48
|
+
/* @__PURE__ */ c(w, { children: "No option found." }),
|
|
49
|
+
/* @__PURE__ */ n(B, { children: [
|
|
49
50
|
s.length > 0 && /* @__PURE__ */ n(d, { onSelect: C, className: "flex items-center text-sm", children: [
|
|
50
|
-
/* @__PURE__ */ c(
|
|
51
|
+
/* @__PURE__ */ c(v, { className: "mr-2 h-4 w-4" }),
|
|
51
52
|
"Back"
|
|
52
53
|
] }),
|
|
53
|
-
|
|
54
|
+
p.map((e) => /* @__PURE__ */ n(
|
|
54
55
|
d,
|
|
55
56
|
{
|
|
56
57
|
onSelect: () => j(e),
|
|
@@ -59,13 +60,13 @@ function E({
|
|
|
59
60
|
/* @__PURE__ */ c("span", { children: e.key }),
|
|
60
61
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
61
62
|
t === "object" && e.type === "object" && /* @__PURE__ */ c(
|
|
62
|
-
|
|
63
|
+
k,
|
|
63
64
|
{
|
|
64
65
|
size: "sm",
|
|
65
66
|
variant: "ghost",
|
|
66
67
|
className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
|
|
67
68
|
onClick: (r) => {
|
|
68
|
-
r.stopPropagation(),
|
|
69
|
+
r.stopPropagation(), m([...s, e.key].join(".")), u(!1);
|
|
69
70
|
},
|
|
70
71
|
children: "Select"
|
|
71
72
|
}
|
|
@@ -83,5 +84,5 @@ function E({
|
|
|
83
84
|
] }) });
|
|
84
85
|
}
|
|
85
86
|
export {
|
|
86
|
-
|
|
87
|
+
I as default
|
|
87
88
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),p=require("react"),v=require("./register-chai-top-bar-BqwKw4uy.cjs"),a=require("./index-C99FhuF1.cjs");function C(c){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(l,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return l.default=c,Object.freeze(l)}const o=C(p);function N({data:c,onSelect:l,dataType:r="value",open:i,setOpen:m}){const[u,f]=o.useState([]),[h,j]=o.useState(c);o.useEffect(()=>{i||f([]),j(c)},[c,i]);const b=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",y=o.useCallback(e=>{const n=s=>r==="value"?s==="value"||s==="object":r==="array"?s==="array":s===r;e.type==="object"?(f(s=>[...s,e.key]),j(e.value)):n(e.type)&&(l([...u,e.key].join(".")),m(!1))},[r,l,u,m]),x=o.useCallback(()=>{if(u.length>0){const e=u.slice(0,-1);f(e),j(e.reduce((n,s)=>n[s],c))}},[u,c]),g=o.useMemo(()=>Object.entries(h).map(([e,n])=>({key:e,value:n,type:b(n)})).filter(e=>r==="value"?e.type==="value"||e.type==="object":r==="array"?e.type==="array"||e.type==="object":r==="object"?e.type==="object":!0),[h,r]);return t.jsx(a.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(a.Command,{children:[t.jsx(a.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(a.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(a.CommandEmpty,{children:"No option found."}),t.jsxs(a.CommandGroup,{children:[u.length>0&&t.jsxs(a.CommandItem,{onSelect:x,className:"flex items-center text-sm",children:[t.jsx(d.ChevronLeft,{className:"mr-2 h-4 w-4"}),"Back"]}),g.map(e=>t.jsxs(a.CommandItem,{onSelect:()=>y(e),className:"flex items-center justify-between",children:[t.jsx("span",{children:e.key}),t.jsxs("div",{className:"flex items-center gap-2",children:[r==="object"&&e.type==="object"&&t.jsx(v.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:n=>{n.stopPropagation(),l([...u,e.key].join(".")),m(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&t.jsx("div",{className:"cursor-pointer rounded p-1 hover:bg-muted",children:t.jsx(d.ChevronRight,{className:"h-4 w-4 opacity-50"})})]})]},e.key))]})]})]})})}exports.default=N;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./index-C99FhuF1.cjs"),n=require("./index-C0-pgg_p.cjs"),w=require("lodash-es"),x=require("lucide-react"),p=require("react-i18next"),P=()=>{const{t:a}=p.useTranslation(),[i,l]=n.useSearchParams(),c=i.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=t.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),l(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(m.Button,{onClick:d,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { B as h } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { n as u, R as w, U as p, V as f, W as P, X as C } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { c as S, d as L, L as x, B as N } from "./index-Dno42B0a.js";
|
|
4
5
|
import { get as v } from "lodash-es";
|
|
5
6
|
import { LockIcon as B } from "lucide-react";
|
|
6
7
|
import { useTranslation as E } from "react-i18next";
|
|
7
8
|
const A = () => {
|
|
8
|
-
const { t: a } = E(), [c, l] = S(), r = c.get("lang"), i = L(r), { setSelectedLang: g } =
|
|
9
|
+
const { t: a } = E(), [c, l] = S(), r = c.get("lang"), i = L(r), { setSelectedLang: g } = u(), m = () => {
|
|
9
10
|
const n = new URLSearchParams(window.location.search);
|
|
10
11
|
n.delete("lang");
|
|
11
|
-
const o = n.toString(),
|
|
12
|
-
window.history.pushState({}, "",
|
|
12
|
+
const o = n.toString(), d = `${window.location.pathname}${o ? `?${o}` : ""}`;
|
|
13
|
+
window.history.pushState({}, "", d), l(n), g(""), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
13
14
|
};
|
|
14
15
|
if (i) return null;
|
|
15
16
|
const t = v(x, r);
|
|
16
|
-
return /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s(
|
|
17
|
-
/* @__PURE__ */ e(
|
|
17
|
+
return /* @__PURE__ */ e(N, { children: /* @__PURE__ */ s(w, { className: "mx-auto w-full max-w-md", children: [
|
|
18
|
+
/* @__PURE__ */ e(p, { className: "space-y-1", children: /* @__PURE__ */ s(f, { className: "flex items-center gap-2 text-2xl", children: [
|
|
18
19
|
/* @__PURE__ */ e(B, { className: "h-6 w-6 text-yellow-500" }),
|
|
19
20
|
a("Page missing for"),
|
|
20
21
|
' "',
|
|
@@ -23,7 +24,7 @@ const A = () => {
|
|
|
23
24
|
a("language"),
|
|
24
25
|
"."
|
|
25
26
|
] }) }),
|
|
26
|
-
/* @__PURE__ */ e(
|
|
27
|
+
/* @__PURE__ */ e(P, { className: "grid gap-4", children: /* @__PURE__ */ s("div", { children: [
|
|
27
28
|
a("Page is not available in the"),
|
|
28
29
|
' "',
|
|
29
30
|
t,
|
|
@@ -34,7 +35,7 @@ const A = () => {
|
|
|
34
35
|
'"',
|
|
35
36
|
a("language or switch to the base language.")
|
|
36
37
|
] }) }),
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(h, { onClick: m, className: "w-full", variant: "destructive", children: a("Switch to default language") }) })
|
|
38
39
|
] }) });
|
|
39
40
|
};
|
|
40
41
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { c as g, d as n } from "./index-
|
|
2
|
+
import { c as g, d as n } from "./index-Dno42B0a.js";
|
|
3
3
|
import { Suspense as s, lazy as t } from "react";
|
|
4
|
-
const o = t(() => import("./no-language-page-content-
|
|
4
|
+
const o = t(() => import("./no-language-page-content-CzENgtnu.js")), l = () => {
|
|
5
5
|
const [e] = g(), r = e.get("lang");
|
|
6
6
|
return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-C0-pgg_p.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-BvPDdccK.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
|