@chaibuilder/sdk 4.0.0-beta.30 → 4.0.0-beta.32
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-Dub3pRV1.cjs → 2SSKDMRQ-DfXKDvXk.cjs} +1 -1
- package/dist/{2SSKDMRQ-B5Tzwoh4.js → 2SSKDMRQ-pPung-JB.js} +2 -2
- package/dist/{AP7HFJJL-CfmdXP9M.js → AP7HFJJL-CEJuc_Ox.js} +1 -1
- package/dist/{AP7HFJJL-Dt6MglIr.cjs → AP7HFJJL-PvPBwV6T.cjs} +1 -1
- package/dist/{IconPicker-DLqOB-ri.cjs → IconPicker-BJHUCDn4.cjs} +1 -1
- package/dist/{IconPicker-Cn8Z42-Z.js → IconPicker-D_GRfhwS.js} +1 -1
- package/dist/{WDYDFRGG-BOpmZGHS.js → WDYDFRGG-B3FrCE_j.js} +2 -2
- package/dist/{WDYDFRGG-Dfj1ikzw.cjs → WDYDFRGG-BPHlcLi5.cjs} +1 -1
- package/dist/{active-in-another-tab-CEWvA8SG.js → active-in-another-tab-C_Ma7oFU.js} +2 -2
- package/dist/{active-in-another-tab-DV83cJ_v.cjs → active-in-another-tab-WVYf-z5w.cjs} +1 -1
- package/dist/{add-new-language-page-C3Uu92KN.cjs → add-new-language-page-CxW2Vuyr.cjs} +1 -1
- package/dist/{add-new-language-page-B3wK94-S.js → add-new-language-page-DtsBO739.js} +3 -3
- package/dist/{add-new-page-BOE-xwBc.cjs → add-new-page-BfKt72NF.cjs} +1 -1
- package/dist/{add-new-page-DsvGVrR8.js → add-new-page-DG38rI6S.js} +2 -2
- package/dist/{ai-panel-content-DBlnfRRi.cjs → ai-panel-content-Dfo4jOVB.cjs} +1 -1
- package/dist/{ai-panel-content-BBSzHZG6.js → ai-panel-content-dktE9CIO.js} +3 -3
- package/dist/{ai-panel-default-lang-BVBuwnyU.js → ai-panel-default-lang-BbUTXMbm.js} +9 -9
- package/dist/{ai-panel-default-lang-DJJWAtN0.cjs → ai-panel-default-lang-GQCtwlPs.cjs} +2 -2
- package/dist/{ai-panel-other-lang-fIEZkmRy.js → ai-panel-other-lang-DIDS-mTi.js} +13 -13
- package/dist/{ai-panel-other-lang-v8Yd5ggR.cjs → ai-panel-other-lang-nCUxwpLX.cjs} +1 -1
- package/dist/{ai-prompt-input-CmSfGxTN.js → ai-prompt-input-B2q30bhR.js} +16 -16
- package/dist/{ai-prompt-input-C7ha_0Cn.cjs → ai-prompt-input-Dws5BHhQ.cjs} +1 -1
- package/dist/{ai-translation-prompt-BzTGAS3W.cjs → ai-translation-prompt-CJVcuWrs.cjs} +1 -1
- package/dist/{ai-translation-prompt-CtBmvsRy.js → ai-translation-prompt-D87qk3C1.js} +1 -1
- package/dist/{change-password-modal-CdOwtCWN.cjs → change-password-modal-CVUa60pC.cjs} +1 -1
- package/dist/{change-password-modal-DxkhBI5d.js → change-password-modal-PahNYs8x.js} +2 -2
- package/dist/{code-editor-Bpn8z2fo.js → code-editor-CWOmKcUc.js} +1 -1
- package/dist/{code-editor-fL3s6Hk7.cjs → code-editor-Cim6jQVF.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DDB816CQ.js → continue-editing-in-this-client-BYFOU3hH.js} +2 -2
- package/dist/{continue-editing-in-this-client-DjxpjsA8.cjs → continue-editing-in-this-client-CW0f2LRk.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +37 -37
- package/dist/{css-import-modal-CL8SIC3K.js → css-import-modal-6bMTRlCg.js} +1 -1
- package/dist/{css-import-modal-CRC7bK1c.cjs → css-import-modal-CXulmaB4.cjs} +1 -1
- package/dist/{delete-page-41tvYcEw.js → delete-page-BDViv7Xm.js} +2 -2
- package/dist/{delete-page-BHPlx8ec.cjs → delete-page-CdByrw3j.cjs} +1 -1
- package/dist/{design-token-usage-DtdjTCn3.cjs → design-token-usage-D-hrcKz1.cjs} +1 -1
- package/dist/{design-token-usage-CyOY4Pni.js → design-token-usage-lf7N_uOk.js} +28 -28
- package/dist/digital-asset-manager-CxxhsToc.cjs +1 -0
- package/dist/{digital-asset-manager-C_ru4Zes.js → digital-asset-manager-PcYficIX.js} +5 -5
- package/dist/{duplicate-page-BvggF83O.cjs → duplicate-page-D2f3HvWX.cjs} +1 -1
- package/dist/{duplicate-page-DMmDdmfS.js → duplicate-page-DfEA148D.js} +3 -3
- package/dist/{dynamic-page-selector-D2z51nLi.js → dynamic-page-selector-DB__KD2y.js} +2 -2
- package/dist/{dynamic-page-selector-C5agz2Ze.cjs → dynamic-page-selector-Dz7D1Wdr.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DNp8Vhme.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-k8l5sdcw.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +3 -3
- package/dist/{get-chai-builder-theme-BSUcPs5t.js → get-chai-builder-theme-BpuwSLeS.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-DFmlG348.cjs → image-editor-BdW476J8.cjs} +1 -1
- package/dist/{image-editor-sKvOFo-S.js → image-editor-CilPMtAC.js} +1 -1
- package/dist/index-Bzyv7mAh.cjs +5 -0
- package/dist/{index-BFnMzGe6.js → index-DsQXiNA_.js} +4997 -4877
- package/dist/{index-CA1OwKJX.js → index-IQefjAA0.js} +1696 -1640
- package/dist/index-mPCp0j2h.cjs +160 -0
- package/dist/{json-diff-viewer-DRQSNhaS.cjs → json-diff-viewer-BPqY25PU.cjs} +1 -1
- package/dist/{json-diff-viewer-B5wAR5GY.js → json-diff-viewer-Ci2IbgDn.js} +34 -34
- package/dist/{lang-panel-q04hEq5o.js → lang-panel-DlAQr-y9.js} +3 -3
- package/dist/{lang-panel-BZsICcBR.cjs → lang-panel-jebYHYGD.cjs} +1 -1
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
- package/dist/library-blocks/bento/product-features/product-features.html +159 -0
- package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
- package/dist/library-blocks/blocks-list.json +145 -12
- package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
- package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
- package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
- package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
- package/dist/manage-design-tokens-BknGNAKE.cjs +1 -0
- package/dist/manage-design-tokens-Co5677WS.js +428 -0
- package/dist/manage-design-tokens-modal-9qpcb-EC.js +161 -0
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +1 -0
- package/dist/{mark-as-template-raTtKmQ9.js → mark-as-template-DOZL3umP.js} +2 -2
- package/dist/{mark-as-template-CT-hLGIW.cjs → mark-as-template-DS-tMllK.cjs} +1 -1
- package/dist/{nested-path-selector-content-CzQ2Lorl.js → nested-path-selector-content-Be-pbnVl.js} +1 -1
- package/dist/{nested-path-selector-content-CSUHTj9G.cjs → nested-path-selector-content-CWmPgU-L.cjs} +1 -1
- package/dist/{no-language-page-content-Bg6VjMVY.js → no-language-page-content-C8W0M_Fj.js} +4 -4
- package/dist/{no-language-page-content-Bkj8JpEY.cjs → no-language-page-content-DWtEo657.cjs} +1 -1
- package/dist/{no-language-page-dialog-TffLjvJn.cjs → no-language-page-dialog-FVXkSnfT.cjs} +1 -1
- package/dist/{no-language-page-dialog-CRPMr9YT.js → no-language-page-dialog-cpCZ9vES.js} +2 -2
- package/dist/{page-creator-CQhE1tgn.js → page-creator-CFtxeW_t.js} +172 -172
- package/dist/{page-creator-RrUhy8uH.cjs → page-creator-o6yRzsVf.cjs} +1 -1
- package/dist/{page-lock-D9h5pgxn.cjs → page-lock-BS_ErOIW.cjs} +1 -1
- package/dist/{page-lock-Dye1JZBB.js → page-lock-Cthbk6Pg.js} +2 -2
- package/dist/{page-locked-dialog-b2_f-A7a.cjs → page-locked-dialog-BWXifuQ8.cjs} +1 -1
- package/dist/{page-locked-dialog-BMjPVyHF.js → page-locked-dialog-D5hmaWqw.js} +16 -16
- package/dist/page-manager-new-Dl5YwsMm.js +418 -0
- package/dist/page-manager-new-DpSqBzeh.cjs +1 -0
- package/dist/{page-manager-search-and-filter-DCcYyoPO.js → page-manager-search-and-filter-iFsFJhn4.js} +27 -26
- package/dist/{page-manager-search-and-filter-D0ZXojiu.cjs → page-manager-search-and-filter-jDoLrCB7.cjs} +1 -1
- package/dist/{page-revisions-content-mDwvH6J-.js → page-revisions-content-C1IGUurW.js} +13 -13
- package/dist/{page-revisions-content-BX8ZWebc.cjs → page-revisions-content-CeBepZEw.cjs} +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +3 -0
- package/dist/pages.js +1 -1
- package/dist/{plugin-Dkmjb2_e.js → plugin-BSjgGgwo.js} +10 -10
- package/dist/{publish-pages-content-M_Kb8b-F.js → publish-pages-content-BpEoA1T6.js} +3 -3
- package/dist/{publish-pages-content-CR4e9inX.cjs → publish-pages-content-PNsiaGI-.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.js +32 -32
- package/dist/{rte-widget-modal-BRSm1Lnp.cjs → rte-widget-modal-CC1KcrAT.cjs} +1 -1
- package/dist/{rte-widget-modal-CVZDktXI.js → rte-widget-modal-c3T09VeO.js} +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/{save-to-lib-B1ccNhR2.js → save-to-lib-BERYhyxq.js} +27 -27
- package/dist/{save-to-lib-CYEAWxL9.cjs → save-to-lib-Bk59qO1r.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-aGR7p5JC.js → selected-block-display-C6NxfC0N.js} +11 -11
- package/dist/{selected-block-display-MyU0rS4q.cjs → selected-block-display-vFSCOnw8.cjs} +1 -1
- package/dist/{seo-panel-B5mDwpaT.cjs → seo-panel-0vlr_dBq.cjs} +1 -1
- package/dist/{seo-panel-P9uixkoZ.js → seo-panel-COrEJZLA.js} +138 -138
- package/dist/{shared-json-ld-DhQJh_mT.cjs → shared-json-ld-C46hURIr.cjs} +1 -1
- package/dist/{shared-json-ld-Ba9GcvLr.js → shared-json-ld-DnTuCBc3.js} +70 -70
- package/dist/{slug-input-CAfGHqMW.js → slug-input-CAqkFZBq.js} +1 -1
- package/dist/{slug-input-BdMnlYKT.cjs → slug-input-Curnt2n3.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +193 -195
- package/dist/{take-over-request-BeHTL28z.cjs → take-over-request-6fliSr8w.cjs} +1 -1
- package/dist/{take-over-request-CXjaDliJ.js → take-over-request-DvmM5qTu.js} +10 -10
- package/dist/{theme-panel-footer-D_gxD0j4.cjs → theme-panel-footer-3ixmq107.cjs} +1 -1
- package/dist/{theme-panel-footer-BkwhuXM7.js → theme-panel-footer-BlsXRcEY.js} +2 -2
- package/dist/{translation-warning-modal-D_vt37fW.cjs → translation-warning-modal-B876S5yp.cjs} +1 -1
- package/dist/{translation-warning-modal-CTfArsb1.js → translation-warning-modal-kRcfrPgo.js} +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/{unmark-as-template-vFgMIdxN.js → unmark-as-template-Dn3klZKq.js} +2 -2
- package/dist/{unmark-as-template-D2bvjGKt.cjs → unmark-as-template-q1GblG-u.cjs} +1 -1
- package/dist/{unpublish-page-CxkjTzBB.js → unpublish-page-BbFZw0so.js} +2 -2
- package/dist/{unpublish-page-CPjHmtSM.cjs → unpublish-page-DMbcHmUV.cjs} +1 -1
- package/dist/unpublished-partials-modal-CEFXp1D1.cjs +1 -0
- package/dist/unpublished-partials-modal-Ts5ZhAK9.js +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/{web-preview--by73Vvr.js → web-preview-B2YGL26D.js} +1 -1
- package/dist/{web-preview-C3AMe_BB.cjs → web-preview-C6SLwtqv.cjs} +1 -1
- package/package.json +2 -7
- package/dist/delete-design-token-B0md8qUi.js +0 -40
- package/dist/delete-design-token-C94IgWdi.cjs +0 -1
- package/dist/digital-asset-manager-DSLQz8qk.cjs +0 -1
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-Bzn_gpaK.cjs +0 -5
- package/dist/index-D30xvFa5.cjs +0 -160
- package/dist/library-blocks/hero-1/hero-1.html +0 -74
- package/dist/library-blocks/hero-1/hero-1.webp +0 -0
- package/dist/library-blocks/hero-2/hero-2.html +0 -95
- package/dist/library-blocks/hero-2/hero-2.webp +0 -0
- package/dist/manage-design-tokens-Cene3KEu.js +0 -241
- package/dist/manage-design-tokens-Di5C6nTj.cjs +0 -1
- package/dist/page-manager-new-2mDjnSqc.cjs +0 -1
- package/dist/page-manager-new-DP1b_dXt.js +0 -411
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),r=require("./index-mPCp0j2h.cjs"),t=require("./index-Bzyv7mAh.cjs"),l=require("lucide-react"),j=require("react"),p=require("react-i18next"),T=()=>{const i=t.useSendRealtimeEvent(),{pageLockMeta:n}=t.usePageLockMeta(),{setPageStatus:d}=t.usePageLockStatus(),{savePageAsync:x}=r.useSavePage(),h=n==null?void 0:n.requestingUserId,{data:s,isFetching:g}=t.useChaiUserInfo(h||""),o=g?"Fetching user...":(s==null?void 0:s.name)||"Current editor",[u,c]=j.useState(!1),N=async()=>{c(!0),await x(),i(t.EVENT.CONTINUE_EDITING_IN_THIS_CLIENT,n),d(t.PAGE_STATUS.CHECKING),setTimeout(()=>c(!1),2e3)},f=()=>{c(!0),i(t.EVENT.TAKE_OVER_REJECTED,n),d(t.PAGE_STATUS.EDITING),setTimeout(()=>c(!1),2e3)},{t:a}=p.useTranslation();return e.jsx(t.BlurContainer,{children:e.jsxs(r.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(r.CardHeader,{className:"space-y-1",children:e.jsxs(r.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(l.AlertCircle,{className:"h-8 w-8 rounded-md bg-amber-500/20 p-1.5 text-amber-500"}),a("Take Over Requested")]})}),e.jsxs(r.CardContent,{className:"space-y-4",children:[e.jsxs("div",{className:"relative rounded-md border border-green-500 px-2 pb-2 pt-4",children:[e.jsx("div",{className:"absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white",children:"Requested by"}),e.jsxs("div",{className:"flex items-center space-x-4 p-1",children:[s!=null&&s.avatar?e.jsx("img",{src:s.avatar,alt:s.name,className:"h-12 w-12 flex-shrink-0 rounded-full bg-black text-white"}):e.jsx(l.UserIcon,{className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}),e.jsxs("div",{className:"flex-1 space-y-0",children:[e.jsx("div",{className:"truncate font-medium leading-tight text-black",children:o}),(s==null?void 0:s.email)&&e.jsx("p",{className:"truncate text-sm leading-tight text-muted-foreground",children:s.email})]})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-gray-700",children:o})," ",a("has requested to")," ",e.jsx("span",{className:"font-medium text-gray-500",children:"take over"})," ",a("editing this page."),"."," ",a("Do you want to allow them to continue?")]})]}),e.jsxs(r.CardFooter,{className:"flex gap-2",children:[e.jsxs(m.Button,{disabled:u,variant:"default",onClick:N,className:"flex-1 gap-2",children:[e.jsx(l.Check,{className:"h-4 w-4"}),a("Accept")]}),e.jsxs(m.Button,{disabled:u,variant:"outline",onClick:f,className:"flex-1 gap-2",children:[e.jsx(l.X,{className:"h-4 w-4"}),a("Reject")]})]})]})})};exports.default=T;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as a, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { B as m } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import {
|
|
4
|
-
import { ao as w, b as I, a as k, ap as y, B as R, E as d, P as u } from "./index-
|
|
5
|
-
import { AlertCircle as S, UserIcon as A, Check as P, X as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
const
|
|
9
|
-
const l = w(), { pageLockMeta: r } = I(), { setPageStatus: c } = k(), { savePageAsync: h } = N(), f = r == null ? void 0 : r.requestingUserId, { data: e, isFetching: p } = y(f || ""), i = p ? "Fetching user..." : (e == null ? void 0 : e.name) || "Current editor", [o, n] =
|
|
3
|
+
import { F as N, G as C, H as b, I as v, J as E, K as T } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { ao as w, b as I, a as k, ap as y, B as R, E as d, P as u } from "./index-IQefjAA0.js";
|
|
5
|
+
import { AlertCircle as S, UserIcon as A, Check as P, X as _ } from "lucide-react";
|
|
6
|
+
import { useState as q } from "react";
|
|
7
|
+
import { useTranslation as U } from "react-i18next";
|
|
8
|
+
const K = () => {
|
|
9
|
+
const l = w(), { pageLockMeta: r } = I(), { setPageStatus: c } = k(), { savePageAsync: h } = N(), f = r == null ? void 0 : r.requestingUserId, { data: e, isFetching: p } = y(f || ""), i = p ? "Fetching user..." : (e == null ? void 0 : e.name) || "Current editor", [o, n] = q(!1), x = async () => {
|
|
10
10
|
n(!0), await h(), l(d.CONTINUE_EDITING_IN_THIS_CLIENT, r), c(u.CHECKING), setTimeout(() => n(!1), 2e3);
|
|
11
11
|
}, g = () => {
|
|
12
12
|
n(!0), l(d.TAKE_OVER_REJECTED, r), c(u.EDITING), setTimeout(() => n(!1), 2e3);
|
|
13
|
-
}, { t: s } =
|
|
13
|
+
}, { t: s } = U();
|
|
14
14
|
return /* @__PURE__ */ a(R, { children: /* @__PURE__ */ t(C, { className: "mx-auto w-full max-w-md", children: [
|
|
15
15
|
/* @__PURE__ */ a(b, { className: "space-y-1", children: /* @__PURE__ */ t(v, { className: "flex items-center gap-2 text-xl", children: [
|
|
16
16
|
/* @__PURE__ */ a(S, { className: "h-8 w-8 rounded-md bg-amber-500/20 p-1.5 text-amber-500" }),
|
|
@@ -53,12 +53,12 @@ const V = () => {
|
|
|
53
53
|
s("Accept")
|
|
54
54
|
] }),
|
|
55
55
|
/* @__PURE__ */ t(m, { disabled: o, variant: "outline", onClick: g, className: "flex-1 gap-2", children: [
|
|
56
|
-
/* @__PURE__ */ a(
|
|
56
|
+
/* @__PURE__ */ a(_, { className: "h-4 w-4" }),
|
|
57
57
|
s("Reject")
|
|
58
58
|
] })
|
|
59
59
|
] })
|
|
60
60
|
] }) });
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
K as default
|
|
64
64
|
};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-Bzyv7mAh.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,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { B as o } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { i as d } from "./index-
|
|
4
|
-
import { e as h, f as u, t as f } from "./index-
|
|
3
|
+
import { i as d } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { e as h, f as u, t as f } from "./index-IQefjAA0.js";
|
|
5
5
|
import { useTranslation as p } from "react-i18next";
|
|
6
6
|
const v = () => {
|
|
7
7
|
const [e] = d(), { mutate: r, isPending: s } = h(), { mutateAsync: t, isPending: i } = u(), { t: n } = p(), m = () => {
|
package/dist/{translation-warning-modal-D_vt37fW.cjs → translation-warning-modal-B876S5yp.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-mPCp0j2h.cjs"),u=({isOpen:o,onClose:i,onContinue:t,isPending:a=!1,title:r="Translation Warning",description:s="Some blocks need translations before publishing. Do you want to continue anyway?"})=>{const c=()=>{i()},d=()=>{t()};return e.jsx(n.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxs(n.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{children:r}),e.jsx(n.DialogDescription,{children:s})]}),e.jsxs(n.DialogFooter,{className:"flex gap-2",children:[e.jsx(l.Button,{variant:"outline",onClick:c,disabled:a,children:"Cancel"}),e.jsx(l.Button,{onClick:d,disabled:a,children:a?"Publishing...":"Continue Anyway"})]})]})})};exports.default=u;
|
package/dist/{translation-warning-modal-CTfArsb1.js → translation-warning-modal-kRcfrPgo.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as n, jsxs as e } from "react/jsx-runtime";
|
|
2
2
|
import { B as i } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as c, e as d, f as h, g, p as m, r as u } from "./index-
|
|
3
|
+
import { D as c, e as d, f as h, g, p as m, r as u } from "./index-DsQXiNA_.js";
|
|
4
4
|
const x = ({
|
|
5
5
|
isOpen: l,
|
|
6
6
|
onClose: o,
|
package/dist/types.d.ts
CHANGED
|
@@ -350,6 +350,7 @@ export declare interface ChaiDesignTokens {
|
|
|
350
350
|
[uniqueId: string]: {
|
|
351
351
|
name: string;
|
|
352
352
|
value: string;
|
|
353
|
+
archived?: boolean;
|
|
353
354
|
};
|
|
354
355
|
}
|
|
355
356
|
|
|
@@ -500,6 +501,8 @@ declare type ChaiSavePageData = {
|
|
|
500
501
|
theme?: ChaiTheme;
|
|
501
502
|
needTranslations?: boolean;
|
|
502
503
|
designTokens: ChaiDesignTokens;
|
|
504
|
+
partialIds?: string[];
|
|
505
|
+
linkPageIds?: string[];
|
|
503
506
|
};
|
|
504
507
|
export { ChaiSavePageData }
|
|
505
508
|
export { ChaiSavePageData as SavePageData }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
2
|
import { B as s } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as p, e as u, f as d, g as f, p as g, r as h } from "./index-
|
|
4
|
-
import { r as k } from "./index-
|
|
3
|
+
import { D as p, e as u, f as d, g as f, p as g, r as h } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { r as k } from "./index-IQefjAA0.js";
|
|
5
5
|
import { useState as D } from "react";
|
|
6
6
|
import { useTranslation as x } from "react-i18next";
|
|
7
7
|
const j = ({ page: i, onClose: t }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-mPCp0j2h.cjs"),p=require("./index-Bzyv7mAh.cjs"),d=require("react"),m=require("react-i18next"),g=({page:i,onClose:n})=>{const{t:a}=m.useTranslation(),[r,s]=d.useState(!1),l=p.useUnmarkAsTemplate(),c=()=>{s(!0),l.mutate(i,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:u=>{u.stopPropagation(),n()},children:a("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:r,onClick:c,children:a("Unmark as template")})]})]})})};exports.default=g;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, jsxs as o } from "react/jsx-runtime";
|
|
2
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-
|
|
4
|
-
import { s as f } from "./index-
|
|
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-IQefjAA0.js";
|
|
5
5
|
import { useTranslation as D } from "react-i18next";
|
|
6
6
|
const v = ({ page: n, onClose: r }) => {
|
|
7
7
|
const { t: i } = D(), { mutate: e, isPending: t } = f(), a = async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),e=require("./index-mPCp0j2h.cjs"),c=require("./index-Bzyv7mAh.cjs"),a=require("react-i18next"),d=({page:i,onClose:t})=>{const{t:s}=a.useTranslation(),{mutate:l,isPending:r}=c.useUnpublishPage(),u=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(o.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(o.Button,{variant:"destructive",disabled:r,onClick:u,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-mPCp0j2h.cjs"),i=require("react-i18next"),n=({isOpen:u,onClose:d,onContinue:c,isPending:r=!1,partialBlocksInfo:a=[]})=>{const{t:l}=i.useTranslation();return e.jsx(t.Dialog,{open:u,onOpenChange:d,children:u&&e.jsxs(t.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:l("Publish Page with Unpublished Blocks?")}),e.jsx(t.DialogDescription,{children:l("You have unpublished changes in the following blocks. They will be published together with the page.")})]}),(a==null?void 0:a.length)>0&&e.jsx("div",{className:"max-h-32 overflow-y-auto rounded-md border bg-muted/50 p-2",children:e.jsx("ul",{className:"space-y-1 text-sm",children:a.map(s=>e.jsxs("li",{className:"flex items-center justify-between text-muted-foreground",children:[e.jsxs("span",{children:["• ",s==null?void 0:s.name]}),e.jsx("span",{className:`ml-2 rounded px-1.5 pb-0.5 text-[10px] ${(s==null?void 0:s.status)==="unpublished"?"text-orange-700":"text-blue-700"}`,children:(s==null?void 0:s.status)==="unpublished"?l("Unpublished page"):l("Unpublished changes")})]},s==null?void 0:s.id))})}),e.jsxs(t.DialogFooter,{className:"flex gap-2",children:[e.jsx(h.Button,{variant:"outline",onClick:d,disabled:r,children:l("Cancel")}),e.jsx(h.Button,{onClick:c,disabled:r,children:l(r?"Publishing...":"Publish Page & Blocks")})]})]})})};exports.default=n;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as l, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { B as u } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
+
import { D as i, e as m, f as n, g as p, p as b, r as g } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { useTranslation as x } from "react-i18next";
|
|
5
|
+
const v = ({
|
|
6
|
+
isOpen: h,
|
|
7
|
+
onClose: r,
|
|
8
|
+
onContinue: c,
|
|
9
|
+
isPending: d = !1,
|
|
10
|
+
partialBlocksInfo: t = []
|
|
11
|
+
}) => {
|
|
12
|
+
const { t: s } = x();
|
|
13
|
+
return /* @__PURE__ */ l(i, { open: h, onOpenChange: r, children: h && /* @__PURE__ */ a(m, { className: "sm:max-w-[425px]", children: [
|
|
14
|
+
/* @__PURE__ */ a(n, { children: [
|
|
15
|
+
/* @__PURE__ */ l(p, { children: s("Publish Page with Unpublished Blocks?") }),
|
|
16
|
+
/* @__PURE__ */ l(b, { children: s(
|
|
17
|
+
"You have unpublished changes in the following blocks. They will be published together with the page."
|
|
18
|
+
) })
|
|
19
|
+
] }),
|
|
20
|
+
(t == null ? void 0 : t.length) > 0 && /* @__PURE__ */ l("div", { className: "max-h-32 overflow-y-auto rounded-md border bg-muted/50 p-2", children: /* @__PURE__ */ l("ul", { className: "space-y-1 text-sm", children: t.map((e) => /* @__PURE__ */ a("li", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
21
|
+
/* @__PURE__ */ a("span", { children: [
|
|
22
|
+
"• ",
|
|
23
|
+
e == null ? void 0 : e.name
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ l(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
className: `ml-2 rounded px-1.5 pb-0.5 text-[10px] ${(e == null ? void 0 : e.status) === "unpublished" ? "text-orange-700" : "text-blue-700"}`,
|
|
29
|
+
children: (e == null ? void 0 : e.status) === "unpublished" ? s("Unpublished page") : s("Unpublished changes")
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] }, e == null ? void 0 : e.id)) }) }),
|
|
33
|
+
/* @__PURE__ */ a(g, { className: "flex gap-2", children: [
|
|
34
|
+
/* @__PURE__ */ l(u, { variant: "outline", onClick: r, disabled: d, children: s("Cancel") }),
|
|
35
|
+
/* @__PURE__ */ l(u, { onClick: c, disabled: d, children: s(d ? "Publishing..." : "Publish Page & Blocks") })
|
|
36
|
+
] })
|
|
37
|
+
] }) });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
v as default
|
|
41
|
+
};
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./get-chai-builder-theme-B5RkBTsB.cjs"),e=require("./get-chai-builder-tailwind-config-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./get-chai-builder-theme-B5RkBTsB.cjs"),e=require("./get-chai-builder-tailwind-config-7CxFxEYL.cjs");exports.chaiBuilderPlugin=i.chaiBuilderPlugin;exports.getChaiBuilderTheme=i.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=e.getChaiBuilderTailwindConfig;
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as a, g as r } from "./get-chai-builder-theme-
|
|
2
|
-
import { g as l } from "./get-chai-builder-tailwind-config-
|
|
1
|
+
import { c as a, g as r } from "./get-chai-builder-theme-BpuwSLeS.js";
|
|
2
|
+
import { g as l } from "./get-chai-builder-tailwind-config-DC4sDOYK.js";
|
|
3
3
|
export {
|
|
4
4
|
a as chaiBuilderPlugin,
|
|
5
5
|
l as getChaiBuilderTailwindConfig,
|
|
@@ -4,7 +4,7 @@ import { B as s } from "./register-chai-top-bar-D6GjnauV.js";
|
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
5
|
import { map as p } from "lodash-es";
|
|
6
6
|
import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
|
|
7
|
-
import { p as v, T as _ } from "./index-
|
|
7
|
+
import { p as v, T as _ } from "./index-IQefjAA0.js";
|
|
8
8
|
const b = [
|
|
9
9
|
{
|
|
10
10
|
title: "mobile_xs_title",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-Bzyv7mAh.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:o,setIframeWidth:r})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>r(s),variant:s===t?"default":"ghost",children:o}),p=()=>{const[t,s]=l.useState(1200),o=i=>s(i),[r,d]=u.useAtom(c.previewUrlAtom);if(!r)return null;const h=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,i=>l.createElement(w,{...i,setIframeWidth:o,key:i.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:h,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor",fillRule:"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:r})]})};exports.default=p;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "4.0.0-beta.
|
|
8
|
+
"version": "4.0.0-beta.32",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -80,8 +80,7 @@
|
|
|
80
80
|
"drizzle-orm": "^0.45.1",
|
|
81
81
|
"postgres": "^3.4.8",
|
|
82
82
|
"react": "^18.0 || ^19.0 || ^19.1 || ^19.2",
|
|
83
|
-
"react-dom": "^18.0 || ^19.0 || ^19.1 || ^19.2"
|
|
84
|
-
"sharp": "^0.34.5"
|
|
83
|
+
"react-dom": "^18.0 || ^19.0 || ^19.1 || ^19.2"
|
|
85
84
|
},
|
|
86
85
|
"peerDependenciesMeta": {
|
|
87
86
|
"@types/react": {
|
|
@@ -99,9 +98,6 @@
|
|
|
99
98
|
"ai": {
|
|
100
99
|
"optional": true
|
|
101
100
|
},
|
|
102
|
-
"sharp": {
|
|
103
|
-
"optional": true
|
|
104
|
-
},
|
|
105
101
|
"next": {
|
|
106
102
|
"optional": true
|
|
107
103
|
},
|
|
@@ -252,7 +248,6 @@
|
|
|
252
248
|
"react-dom": "19.2.0",
|
|
253
249
|
"react-router-dom": "^7.11.0",
|
|
254
250
|
"shadcn": "2.3.0",
|
|
255
|
-
"sharp": "^0.34.5",
|
|
256
251
|
"tailwindcss": "^3.4.19",
|
|
257
252
|
"ts-jest": "^29.4.6",
|
|
258
253
|
"ts-node": "^10.9.2",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs as e, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { F as i, G as n, H as c, I as d, J as m, K as h, M as g, O as u, Q as x } from "./index-BFnMzGe6.js";
|
|
3
|
-
import { useTranslation as D } from "react-i18next";
|
|
4
|
-
const N = ({ tokenName: l, tokenValue: s, onDelete: a, children: o }) => {
|
|
5
|
-
const { t: r } = D();
|
|
6
|
-
return /* @__PURE__ */ e(i, { children: [
|
|
7
|
-
/* @__PURE__ */ t(n, { asChild: !0, children: o }),
|
|
8
|
-
/* @__PURE__ */ e(c, { className: "max-w-md", children: [
|
|
9
|
-
/* @__PURE__ */ e(d, { children: [
|
|
10
|
-
/* @__PURE__ */ e(m, { className: "text-base", children: [
|
|
11
|
-
r("Delete"),
|
|
12
|
-
' "',
|
|
13
|
-
l,
|
|
14
|
-
'"?'
|
|
15
|
-
] }),
|
|
16
|
-
/* @__PURE__ */ t(h, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "space-y-3 pt-1 text-sm", children: [
|
|
17
|
-
/* @__PURE__ */ t("p", { className: "text-muted-foreground", children: r("This action cannot be undone. This will permanently remove the design token from your project.") }),
|
|
18
|
-
/* @__PURE__ */ e("div", { className: "rounded-md border bg-muted/50 p-3", children: [
|
|
19
|
-
/* @__PURE__ */ t("p", { className: "mb-1 text-xs font-medium text-foreground", children: r("Token classes") }),
|
|
20
|
-
/* @__PURE__ */ t("p", { className: "font-mono text-xs text-muted-foreground", children: s })
|
|
21
|
-
] })
|
|
22
|
-
] }) })
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ e(g, { children: [
|
|
25
|
-
/* @__PURE__ */ t(u, { className: "h-7 text-xs", children: r("Cancel") }),
|
|
26
|
-
/* @__PURE__ */ t(
|
|
27
|
-
x,
|
|
28
|
-
{
|
|
29
|
-
onClick: a,
|
|
30
|
-
className: "h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",
|
|
31
|
-
children: r("Delete")
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
] })
|
|
35
|
-
] })
|
|
36
|
-
] });
|
|
37
|
-
};
|
|
38
|
-
export {
|
|
39
|
-
N as default
|
|
40
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-D30xvFa5.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),d=require("./index-D30xvFa5.cjs"),ee=require("./image-compression-DZ9WMmyn.cjs"),B=require("lodash-es"),f=require("lucide-react"),u=require("react"),ge=require("react-dropzone"),je=require("react-error-boundary"),R=require("react-i18next"),C=require("sonner"),D=require("@tanstack/react-query"),j=require("./index-Bzn_gpaK.cjs"),te=require("./common-functions-B3a4xKt_.cjs"),ve=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>{const n=i.map(async l=>x(r,{action:j.ACTIONS.UPLOAD_ASSET,data:l}));return await Promise.all(n)},onSuccess:i=>{var n;if(i!=null&&i.some(s=>s.error))throw new Error(((n=i==null?void 0:i.find(s=>s.error))==null?void 0:n.error)||"Failed to upload asset");{a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]});const s=i==null?void 0:i.length;C.toast.success(`${s===1?"Asset":s+" Assets"} uploaded successfully`)}},onError:()=>{C.toast.error("Failed to upload asset")}})},ye=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.DELETE_ASSET,data:{id:i}}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),C.toast.success("Asset deleted successfully")},onError:()=>{C.toast.error("Failed to delete asset")}})},Ne=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.UPDATE_ASSET,data:i}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),i!=null&&i.id&&a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSET,i.id]}),C.toast.success("Asset updated successfully")},onError:()=>{C.toast.error("Failed to update asset")}})};function be({currentPage:r,totalPages:a,onPageChange:x,pageRangeDisplayed:i=3,showPageInput:n=!0,className:s=""}){const[l,I]=u.useState(String(r)),b=u.useMemo(()=>{const o=Math.floor(i/2);let m=Math.max(1,r-o),c=Math.min(a,r+o);c-m+1<i&&(m===1?c=Math.min(a,m+i-1):c===a&&(m=Math.max(1,c-i+1)));const p=[];m>1&&(p.push(1),m>2&&p.push("..."));for(let N=m;N<=c;N++)p.push(N);return c<a&&(c<a-1&&p.push("..."),p.push(a)),p},[r,a,i]),y=o=>{o!==r&&o>=1&&o<=a&&(x(o),I(String(o)))},v=()=>{r>1&&y(r-1)},w=()=>{r<a&&y(r+1)},A=()=>{const o=Number(l);!isNaN(o)&&o>=1&&o<=a&&y(o)},S=o=>{o.key==="Enter"&&A()};return a<=1?null:e.jsxs("div",{className:`flex flex-wrap items-center justify-center gap-3 ${s}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:v,disabled:r===1,className:"px-2 py-1 text-sm hover:bg-gray-50",children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-2",children:b.map((o,m)=>{if(o==="...")return e.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${m}`);const c=o,p=c===r;return e.jsx(g.Button,{variant:p?"default":"outline",size:"sm",onClick:()=>y(c),className:p?"border-blue-600 bg-blue-600 px-3 py-1 text-sm text-white":"border px-3 py-1 text-sm hover:bg-gray-50 hover:text-black",children:c},c)})}),e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:w,disabled:r===a,className:"px-2 py-1 text-sm hover:bg-gray-50",children:["Next",e.jsx(f.ChevronRight,{className:"h-4 w-4"})]})]}),n&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Go to"}),e.jsx(g.Input,{type:"number",min:1,max:a,value:l,onChange:o=>{const m=o.target.value.replace(/[^\d]/g,"");I(m)},onKeyDown:S,className:"h-8 w-16 px-2 py-1"}),e.jsx(g.Button,{variant:"outline",size:"sm",onClick:A,disabled:l===""||Number(l)<1||Number(l)>a,children:"Go"})]})]})}const we=(r={})=>{const a=j.useApiUrl(),x=j.useFetch(),{search:i,page:n=1,limit:s=30}=r;return D.useQuery({queryKey:[j.ACTIONS.GET_ASSETS,i,n,s],queryFn:async()=>{const l=await x(a,{action:j.ACTIONS.GET_ASSETS,data:{search:i,page:n,limit:s}});return l.page=n,l.limit=s,l},staleTime:1/0,retry:1})},Ce=r=>{const a=j.useApiUrl(),x=j.useFetch();return D.useQuery({queryKey:[j.ACTIONS.GET_ASSET,r],queryFn:async()=>r?await x(a,{action:j.ACTIONS.GET_ASSET,data:{id:r}}):null,staleTime:1/0,retry:1})};function Ae(r){const a=isNaN(r)?0:typeof r=="number"?r:parseInt(r);return a?a<1024?`${a.toFixed(2)} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/(1024*1024)).toFixed(2)} MB`:"0 B"}function J(r){if(!r)return"N/A";const a=new Date(r);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(a)}function Y(r,a){let x=r,i=a==null?void 0:a.description;return(!i||typeof i!="string")&&(i=""),(!x||typeof x!="string")&&(x=""),x!==i}const Se=({assetId:r,onBack:a,onEdit:x,onSave:i,isSaving:n})=>{var o,m;const{t:s}=R.useTranslation(),{data:l,isLoading:I,isError:b}=Ce(r||""),[y,v]=u.useState(""),[w,A]=u.useState(!1);u.useEffect(()=>{const c=new Image;return c.src=(l==null?void 0:l.url)||"",c.onload=()=>A(!0),()=>{c.onload=null}},[l]);const S=async(c,p)=>{try{await navigator.clipboard.writeText(c),C.toast.success(s("{{type}} copied to clipboard",{type:p}))}catch(N){C.toast.error(s("Failed to copy {{type}}",{type:p}),{description:N==null?void 0:N.message})}};return u.useEffect(()=>{l!=null&&l.description&&v(l.description)},[l]),I||!w?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}):b||!(l!=null&&l.id)?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"mx-auto max-w-md p-6 text-center",children:[e.jsx("div",{className:"mb-4 flex justify-center",children:e.jsx(f.AlertCircle,{className:"h-12 w-12 text-gray-400"})}),e.jsx("h3",{className:"mb-2 text-lg font-medium text-gray-900",children:s("No Asset Found")}),e.jsx("p",{className:"mb-6 text-sm text-gray-500",children:s(b?"There was an error loading the asset. Please try again later.":"The asset you're looking for doesn't exist or has been removed.")}),e.jsxs("div",{className:"flex justify-center gap-4",children:[e.jsx(g.Button,{variant:"outline",onClick:a,children:s("Back to Assets")}),b&&e.jsx(g.Button,{variant:"default",onClick:()=>window.location.reload(),children:s("Try Again")})]})]})}):e.jsxs("div",{className:"flex flex-1 flex-col gap-y-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:a,disabled:n,children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),s("Back to Assets")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g.Button,{variant:"outline",onClick:a,disabled:n,children:s("Cancel")}),e.jsxs(g.Button,{variant:"outline",onClick:()=>S(l.url,s("Asset URL")),disabled:n,children:[e.jsx(f.Copy,{className:"mr-2 h-4 w-4"}),s("Copy URL")]}),e.jsxs(g.Button,{variant:"default",onClick:()=>x(l),disabled:n,children:[e.jsx(f.Pencil,{className:"h-4 w-4"}),s("Edit Image")]})]})]}),e.jsxs("div",{className:"grid flex-1 grid-cols-2 items-start gap-6 overflow-hidden",children:[e.jsx("div",{className:"relative flex h-[calc(80vh-200px)] w-full items-start justify-center",children:e.jsx("img",{src:l.url,alt:l.name,className:"h-full max-h-max w-full max-w-max rounded-lg object-contain"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Details")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border bg-white p-2 text-sm",children:[{label:s("File Name"),value:l.name},{label:s("Type"),value:l.type,capitalize:!0},{label:s("Format"),value:((o=l.metadata)==null?void 0:o.format)||l.type,capitalize:!0},{label:s("Size"),value:Ae(l.size)},{label:s("Dimensions"),value:`${l.width||0} × ${l.height||0}`},{label:s("Created"),value:J(l.createdAt)},{label:s("Updated"),value:J(((m=l.metadata)==null?void 0:m.updatedAt)||(l==null?void 0:l.updatedAt)||l.createdAt)},{label:s("URL"),value:l.url,copyable:!0}].map(c=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.Label,{className:"w-1/4 w-max px-2 text-left font-normal text-gray-700",children:c.label}),":",e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900"+(c.capitalize?" capitalize":""),children:c.value}),c.copyable&&e.jsx(g.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>S(c.value,c.label),children:e.jsx(f.Link,{className:"h-3 w-3"})})]})]},c.label))})]}),l.usedOn&&l.usedOn.length>0&&e.jsxs("div",{className:"grid gap-3",children:[e.jsx(d.Label,{children:s("Used On")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border p-2 text-sm",children:l.usedOn.map((c,p)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900",children:c.name}),e.jsxs("div",{className:"text-gray-500",children:["(",c.slug,")"]})]},p))})]}),e.jsxs("div",{className:"relative grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Description")}),e.jsx(d.Textarea,{id:"description",value:y,placeholder:s("Enter a description for the asset"),onChange:c=>v(c.target.value),rows:3,disabled:n,className:"bg-white hover:border-black/40"}),e.jsx("div",{className:"absolute right-2 top-1.5 flex items-start justify-end",children:e.jsx("button",{type:"button",onClick:()=>i(y),disabled:n||!Y(y,l),className:`rounded-md bg-blue-500 px-3 py-0 py-0.5 text-sm text-white ${n||!Y(y,l)?"cursor-not-allowed opacity-50":""}`,children:n?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"mr-2 h-4 w-4 animate-spin"}),s("Saving...")]}):s("Save")})})]})]})]})]})},Te=u.lazy(()=>Promise.resolve().then(()=>require("./image-editor-DFmlG348.cjs"))),Ee=25*1024*1024,Ie=({isUpdatingAsset:r,allowedTypes:a,uploadAssets:x,isUploadingAsset:i,onUploaded:n})=>{const{t:s}=R.useTranslation(),[l,I]=u.useState(()=>{const o=localStorage.getItem("chai_optimize_images");return o!==null?o==="true":!0});u.useEffect(()=>{localStorage.setItem("chai_optimize_images",l.toString())},[l]);const b=r||i,y=u.useCallback(async o=>{try{const m=o;if(!m.every(T=>T.type.startsWith("image/")))return C.toast.error(s("Invalid file type. Please upload a valid file.")),Promise.reject(new Error("Invalid file type"));const c=m.map(async T=>{let U=T;return T.type.startsWith("image/")&&(U=await ee.compressImageIfNeeded(T)),new Promise((_,q)=>{const L=new FileReader;L.readAsDataURL(U),L.onload=async()=>{_({file:L.result,folderId:void 0,name:T.name,optimize:l})},L.onerror=()=>q(null)})}),p=await Promise.all(c),N=await x(p);return(N==null?void 0:N.length)===1&&n(N[0]),N}catch(m){return Promise.reject(m)}},[x,l,n,s]),v=o=>{const m=[];let c=0;return o.forEach(p=>{p.size>Ee?c++:m.push(p)}),c>0&&C.toast.error(`${c===1&&o.length===1?s("File"):c+s(c===1?" file":" files")} ${s("exceed the maximum size limit of 10MB.")}`),B.isEmpty(m)?[]:y(m)},{getRootProps:w,getInputProps:A,isDragActive:S}=ge.useDropzone({onDrop:v,accept:{"image/*":a.includes("image")?[]:[]},disabled:r||i,multiple:!0});return e.jsx("div",{className:`flex h-[60px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-slate-300 p-0 py-2 hover:border-black/50 ${b?"pointer-events-none bg-gray-100 opacity-90":"bg-gray-100 hover:border-black/50 hover:bg-gray-100"}`,children:e.jsxs("div",{...w(),className:te.cn("flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",b?"items-start":"items-center",S?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...A()}),b?e.jsx("div",{className:"flex flex-col items-center px-6",children:e.jsxs("div",{className:"flex items-center justify-center gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full bg-indigo-100 p-2",children:e.jsx(f.Loader,{className:"h-4 w-4 animate-spin text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:s(r?"Updating file...":"Uploading file...")}),e.jsxs("div",{className:"text-xs font-light text-muted-foreground",children:[s("Please wait while we")," ",s(r?"update":"upload")," ",s("your file...")]})]})]})}):e.jsxs("div",{className:"flex w-full items-center justify-between px-6",children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full border border-indigo-500 bg-indigo-100 p-2",children:e.jsx(f.Upload,{className:"h-4 w-4 text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"font-medium",children:[s("Drop your file here or")," ",e.jsx("span",{className:"cursor-pointer text-indigo-500 hover:underline",children:s("browse")})]}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:e.jsxs("span",{className:"",children:[s("Accepted file types:")," ",e.jsx("span",{className:"capitalize text-indigo-400",children:a.join(", ")})]})})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs",children:[s("Optimization:")," ",e.jsx("span",{className:l?"text-indigo-600":"text-gray-400",children:s(l?"On":"Off")})]}),e.jsx(d.Switch,{checked:l,onCheckedChange:o=>{I(o)},onClick:o=>{o.stopPropagation()},className:"data-[state=checked]:bg-indigo-500"})]}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("span",{className:`flex cursor-help items-center text-amber-500 ${l?"invisible":""}`,children:e.jsx(f.AlertTriangle,{className:"mr-1 h-4 w-4"})})}),e.jsx(d.TooltipContent,{side:"top",children:e.jsx("p",{className:"text-xs text-white",children:s("Warning: Unoptimized images may affect performance and page load times")})})]})})]})]})]})})};function ke({close:r,onSelect:a,mode:x="image",assetId:i}){const{t:n}=R.useTranslation(),s=!1,l=10,I=u.useMemo(()=>[x],[x]),[b,y]=u.useState(null),[v,w]=u.useState(null),[A,S]=u.useState(null),[o,m]=u.useState({show:!1,file:""}),[c,p]=u.useState(!1),[N,T]=u.useState(i?"details":"grid"),[U,_]=u.useState(""),[q,L]=u.useState(""),[P,Q]=u.useState(1),[K]=u.useState(30),[E,G]=u.useState([]);u.useEffect(()=>{i&&(y(i),T("details"))},[i]),u.useEffect(()=>{const t=setTimeout(()=>{_(q),Q(1)},300);return()=>clearTimeout(t)},[q]);const{data:O,isLoading:$,refetch:se}=we({search:U.toLowerCase().trim(),page:P,limit:K}),F=(O==null?void 0:O.assets)||[],ie=(O==null?void 0:O.total)||0,k=Math.ceil(ie/K);u.useEffect(()=>{$||k<=0||Q(t=>t>k?k:t<1?1:t)},[$,k]);const le=(F==null?void 0:F.length)>0,{mutate:ae}=ye(),{mutateAsync:W,isPending:re}=ve(),{mutateAsync:V,isPending:ne}=Ne(),H=u.useCallback(t=>{const h=Math.min(Math.max(1,t),Math.max(1,k));h!==P&&Q(h)},[k,P]),oe=t=>{L(t.target.value)},ce=u.useCallback(t=>{G(h=>B.find(h,{id:t.id})?[]:[t])},[s]),de=u.useCallback(()=>{G([])},[]),X=t=>{(t==null?void 0:t.length)!==0&&(a(B.pick(B.first(t||E),["id","url","width","height","description"])),r())},ue=async t=>{w(t)},me=async()=>{v&&(S(v==null?void 0:v.id),await ae(v.id,{onSuccess:()=>{S(null),w(null)},onError:()=>{S(null)}}),w(null))},he=t=>{y(t.id),T("details")},xe=async(t,h)=>{try{const M=localStorage.getItem("chai_optimize_images")!=="false";if(h){const z=await W([{file:t,folderId:void 0,name:o.name||"",optimize:M}]);if((z==null?void 0:z.length)>0){const Z=z[0];a({...B.pick(Z,["id","width","height","description"]),url:Z.url})}}else{const z=await V({id:o.id||"",file:t});z&&a({...B.pick(z,["id","width","height","description"]),url:z.url})}m({show:!1,file:""}),r()}catch(M){console.error(n("Error saving edited image:"),M)}},fe=u.useCallback(t=>{G([t])},[]),pe=u.useCallback(t=>{H(t)},[H]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4",children:[e.jsx("h1",{className:"text-lg font-medium",children:n("Digital Asset Manager")}),N==="grid"?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{maxFileSize:l,allowedTypes:I,uploadAssets:W,isUpdatingAsset:ne,isUploadingAsset:re,onUploaded:fe}),e.jsxs("div",{className:"relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"relative w-1/2",children:[e.jsx(f.Search,{strokeWidth:3,className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${q.length>0?"text-indigo-800":""}`}),e.jsx(g.Input,{placeholder:n("Search assets..."),onChange:oe,value:q,className:"pl-8"})]}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[E.length>0?e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.length>0&&e.jsx(e.Fragment,{children:e.jsx(g.Button,{variant:"outline",size:"sm",onClick:()=>de(),title:n("Clear selection"),children:n("Clear")})}),e.jsx(g.Button,{size:"sm",onClick:()=>X(E),disabled:E.length===0,children:n("Select Asset")})]})}):null,e.jsx(g.Button,{variant:"ghost",size:"icon",onClick:()=>se(),children:e.jsx(f.RefreshCwIcon,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pb-[66px]",children:$?e.jsxs("div",{className:"columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5",children:[e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"})]}):!$&&!le?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center rounded-lg border",children:[e.jsx("div",{className:"text-muted-foreground",children:e.jsx(f.Archive,{className:"h-9 w-9 text-indigo-500"})}),e.jsx("div",{className:"text-lg text-muted-foreground",children:n("No assets found")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:U.length>0?n("No assets found for your search: {{query}}",{query:U}):n("Start uploading assets to get started")}),e.jsx("br",{})]}):e.jsx("div",{className:"flex flex-wrap gap-3 p-1",children:F==null?void 0:F.map(t=>e.jsxs("div",{className:te.cn("group relative flex max-h-[180px] max-w-[180px] cursor-pointer flex-col justify-between overflow-hidden rounded-lg border-2 transition-all",E.some(h=>h.id===t.id)?"border-blue-500":"hover:border-black/90",A&&(v==null?void 0:v.id)===t.id?"pointer-events-none opacity-50":"",A===t.id?"pointer-events-none opacity-50":""),onClick:()=>ce(t),onDoubleClick:()=>X([t]),children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden",children:[A===t.id?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin text-white"})}):null,t.type==="image"?e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.name,className:`h-full min-h-[80px] w-full object-contain ${E.some(h=>h.id===t.id)?"":"group-hover:blur group-hover:contrast-50"}`}):e.jsxs("div",{className:"flex h-full items-center justify-center",children:[e.jsx(f.Film,{className:"h-12 w-12 text-muted-foreground"}),t.thumbnailUrl&&e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.name,className:"absolute inset-0 h-full w-full object-cover"})]})]}),e.jsxs("div",{className:"flex items-end justify-between border-t-[1px] border-black/10 bg-white px-2 py-1",children:[e.jsx("div",{className:"truncate text-xs leading-tight",title:t.name,children:t.name}),e.jsx("div",{className:"flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground",children:e.jsx("span",{children:ee.formatFileSize((t==null?void 0:t.size)||0)})})]}),!E.some(h=>h.id===t.id)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:e.jsxs("div",{className:"grid grid-cols-4 gap-2 p-2",children:[e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),he(t)},children:e.jsx(f.ImageIcon,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("View Details")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),navigator.clipboard.writeText(t.url),C.toast.success(n("Asset URL copied to clipboard"))},children:e.jsx(f.Copy,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Copy URL")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),m({id:t.id,show:!0,file:t.url,name:t.name})},children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Edit Image")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"destructive",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),ue(t)},children:e.jsx(f.Trash2,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Delete Asset")})})]})})]})}),E.some(h=>h.id===t.id)&&e.jsx("div",{className:"absolute right-1 top-1 h-max rounded-full border border-white bg-blue-500 p-1",children:e.jsx(f.Check,{className:"h-3 w-3 text-white",strokeWidth:5})})]},t.id))})}),k>1&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t bg-white p-4",children:e.jsx(je.ErrorBoundary,{fallback:e.jsx("div",{className:"text-red-500",children:n("Error loading pagination")}),children:e.jsx(be,{currentPage:P,totalPages:k,onPageChange:pe,pageRangeDisplayed:3,showPageInput:!0})})})]})]}):e.jsx(Se,{assetId:b||i||"",onBack:()=>{T("grid"),y(null)},onEdit:t=>{m({id:t.id,show:!0,file:t.url,name:t.name})},onSave:async t=>{if(b){p(!0);try{const h=F.find(M=>M.id===b);h&&await V(B.merge(h,{description:t}))}finally{p(!1)}}},isSaving:c})]}),o.show&&e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}),children:e.jsx(Te,{imageUrl:o.file,onSave:xe,onClose:()=>m({show:!1,file:""}),defaultSavedImageName:o.name,isEditing:!!o.id})}),v&&e.jsx(d.Dialog,{open:!!v,onOpenChange:()=>w(null),children:e.jsxs(d.DialogContent,{children:[e.jsxs(d.DialogHeader,{children:[e.jsx(d.DialogTitle,{children:n("Delete Asset")}),e.jsx(d.DialogDescription,{children:n('Are you sure you want to delete "{{name}}"? This action cannot be undone.',{name:v.name})})]}),e.jsxs(d.DialogFooter,{className:"gap-2 sm:gap-0",children:[e.jsx(g.Button,{variant:"outline",onClick:()=>w(null),children:n("Cancel")}),e.jsx(g.Button,{variant:"destructive",onClick:me,children:n("Delete")})]})]})})]})}exports.default=ke;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("compressorjs"),m=require("sonner"),t=3*1024*1024,c=10*1024*1024;function s(e){const r=isNaN(e)?0:typeof e=="number"?e:parseInt(e);return r?r<1024?`${r.toFixed(2)} B`:r<1024*1024?`${(r/1024).toFixed(2)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`:"0 B"}function a(e){return new Promise((r,o)=>{if(e.size<=t){r(e);return}new n(e,{quality:.8,maxWidth:2048,maxHeight:2048,convertSize:t,success(i){r(i)},error(i){m.toast.error(`Failed to compress image. Image size is ${s(e.size)}, which exceeds the maximum allowed size of ${s(c)}.`),o(i)}})})}exports.compressImageIfNeeded=a;exports.formatFileSize=s;
|