@chaibuilder/sdk 3.2.8 → 4.0.0-beta.2
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/README.md +25 -20
- package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
- package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
- package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
- package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
- package/dist/IconPicker-C9-ieDWm.cjs +1 -0
- package/dist/IconPicker-RqVvq6G2.js +59 -0
- package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
- package/dist/WDYDFRGG-b3T2SQbz.cjs +1 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/actions-registery-CZ1w0NKa.js +15545 -0
- package/dist/actions-registery-YnFmU21O.cjs +418 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.ts +3202 -0
- package/dist/actions.js +216 -0
- package/dist/active-in-another-tab-Clng6zpY.cjs +1 -0
- package/dist/active-in-another-tab-wb8qolB8.js +34 -0
- package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
- package/dist/add-new-language-page-D7NDABl1.js +401 -0
- package/dist/add-new-page-B4hc0B-g.js +31 -0
- package/dist/add-new-page-BNfwKjRd.cjs +1 -0
- package/dist/ai-panel-content-BnbURb7j.js +61 -0
- package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
- package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
- package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
- package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
- package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
- package/dist/ai-prompt-input-DaTyfib-.js +655 -0
- package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
- package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
- package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
- package/dist/{apply-binding-DLaiD20q.js → apply-binding-6iwlED02.js} +156 -166
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/{code-display-DuH-UOhl.js → code-display-BzBq5xSn.js} +1 -1
- package/dist/code-display-Q3_sK_Ta.cjs +1 -0
- package/dist/code-editor-BQZi6-FB.cjs +1 -0
- package/dist/code-editor-DWWnphW9.js +50 -0
- package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
- package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +1 -0
- package/dist/core-BoRDjj4h.cjs +1 -0
- package/dist/core-yvI6kCyw.js +56 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -393
- package/dist/core.js +37 -105
- package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
- package/dist/{css-import-modal-CFB2YjDT.js → css-import-modal-D72a-16X.js} +39 -38
- package/dist/{delete-design-token-BjMakV-b.js → delete-design-token-Cd1ZDtqT.js} +3 -3
- package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
- package/dist/delete-page-ByQwBupJ.cjs +1 -0
- package/dist/delete-page-DC8pzvWW.js +70 -0
- package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
- package/dist/design-token-usage-DE4XCDdn.js +113 -0
- package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
- package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
- package/dist/duplicate-page-BoVhko2q.js +133 -0
- package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
- package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
- package/dist/dynamic-page-selector-DdnbCuQZ.cjs +1 -0
- package/dist/fonts-B-Xt29pe.cjs +1 -0
- package/dist/fonts-DRly3Wzd.js +78 -0
- package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
- package/dist/get-chai-builder-theme-BYtp20KD.js +24 -0
- package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
- package/dist/get-seo-defaults-9zHebckY.js +65 -0
- package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
- package/dist/image-compression-DZ9WMmyn.cjs +1 -0
- package/dist/image-compression-DsZ1oqpb.js +37 -0
- package/dist/image-editor-DTspjj_c.cjs +1 -0
- package/dist/image-editor-oypq8asR.js +108 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-BDnwJqMw.js +4732 -0
- package/dist/index-CbwxUFy_.cjs +5 -0
- package/dist/index-CnSjWE1P.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-S8ibZk9Q.js +19069 -0
- package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
- package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
- package/dist/lang-panel-BPxex-M2.cjs +1 -0
- package/dist/lang-panel-Cn83SRzd.js +215 -0
- package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
- package/dist/{manage-design-tokens-DUoMdCBl.js → manage-design-tokens-lP4HLS0P.js} +31 -32
- package/dist/mark-as-template-DYRxre1f.cjs +1 -0
- package/dist/mark-as-template-jncsjfHm.js +156 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
- package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
- package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
- package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
- package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
- package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
- package/dist/page-creator-VWIB2VAs.cjs +1 -0
- package/dist/page-creator-wCMtlE6Z.js +795 -0
- package/dist/page-lock-BPCxfv9J.js +30 -0
- package/dist/page-lock-DweiYy1w.cjs +1 -0
- package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
- package/dist/page-locked-dialog-ByGl18_m.js +133 -0
- package/dist/page-manager-new-BWFE-S-O.js +394 -0
- package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
- package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
- package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
- package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
- package/dist/page-revisions-content-Ulr8slUN.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +492 -0
- package/dist/pages.js +27 -0
- package/dist/{plugin-BOcGV_IY.js → plugin-3ZKK6RXm.js} +30 -44
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-BTPzt_m4.js +178 -0
- package/dist/publish-pages-content-D6g8GAsd.cjs +1 -0
- package/dist/register-partial-type-BjtdfKHE.js +36 -0
- package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +12 -9
- package/dist/render.js +97 -99
- package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
- package/dist/rte-widget-modal-Rk_NW3KU.js +38 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +306 -7
- package/dist/runtime.js +44 -1
- package/dist/save-to-lib-BK3uTFss.js +422 -0
- package/dist/save-to-lib-DHHUO12i.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-CU3TwIMA.js +319 -0
- package/dist/selected-block-display-DSFhddPj.cjs +16 -0
- package/dist/seo-panel-Dl0IDV09.cjs +2 -0
- package/dist/seo-panel-jbzxFioc.js +798 -0
- package/dist/shared-json-ld-BL_dv3_q.js +565 -0
- package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
- package/dist/slug-input-1qwKkXhA.js +86 -0
- package/dist/slug-input-YVLjtTI3.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -0
- package/dist/supabase-actions.d.ts +284 -0
- package/dist/supabase-actions.js +524 -0
- package/dist/take-over-request-DKvKi3mM.js +63 -0
- package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
- package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
- package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
- package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
- package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
- package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
- package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
- package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
- package/dist/unpublish-page-Degu5Cy9.js +27 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/utils.cjs +1 -0
- package/dist/{tailwind.d.ts → utils.d.ts} +4 -7
- package/dist/utils.js +7 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +0 -6
- package/dist/web-blocks.js +48 -47
- package/dist/web-preview-DXE4Jnf5.js +73 -0
- package/dist/web-preview-YzKxyXft.cjs +1 -0
- package/package.json +159 -89
- package/dist/IconPicker-6JSublJp.js +0 -64
- package/dist/IconPicker-DpQQDK_Q.cjs +0 -1
- package/dist/apply-binding-Bn1KC8uC.cjs +0 -1
- package/dist/code-display-Dw1tAwiJ.cjs +0 -1
- package/dist/code-editor-cnBzYLxk.cjs +0 -1
- package/dist/code-editor-vpbOSO05.js +0 -59
- package/dist/css-import-modal-bGWZSlqv.cjs +0 -13
- package/dist/delete-design-token-Bzxspf8D.cjs +0 -1
- package/dist/design-token-usage-BDArZ38H.js +0 -120
- package/dist/design-token-usage-CCv4XltM.cjs +0 -1
- package/dist/get-chai-builder-theme-B1tr_NJB.cjs +0 -1
- package/dist/get-chai-builder-theme-BarMkcGH.js +0 -12
- package/dist/index-CuANr9iH.cjs +0 -160
- package/dist/index-DvdOXKUE.js +0 -18338
- package/dist/manage-design-tokens-DpC46NAy.cjs +0 -1
- package/dist/mockServiceWorker.js +0 -349
- package/dist/plugin-CSgw-f78.cjs +0 -22
- package/dist/rte-widget-modal-CXbmmhcb.js +0 -41
- package/dist/rte-widget-modal-DDjf0xui.cjs +0 -1
- package/dist/tailwind.cjs +0 -1
- package/dist/tailwind.js +0 -8
- package/dist/tooltip-Ba1-8jmj.cjs +0 -1
- package/dist/tooltip-DUosa-uC.js +0 -1067
- package/dist/ui.cjs +0 -1
- package/dist/ui.d.ts +0 -415
- package/dist/ui.js +0 -129
- package/dist/vite.svg +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const T=require("./common-functions-B3a4xKt_.cjs"),t=require("lodash-es"),V=require("@chaibuilder/runtime"),k=require("himalaya"),U=require("tailwind-merge"),m="#styles:",Y="__ADD_BLOCK_INTERNAL_ROOT",K="@",H="#",v="dt#",M=e=>{if(e=e.replace(m,""),!e)return{baseClasses:"",classes:""};const i=e.split(/,(?![^\[]*\])/);if(i.length===1)return{baseClasses:"",classes:i[0].trim()};const[s,...n]=i;return{baseClasses:s.trim(),classes:n.join(",").trim().replace(/ +(?= )/g,"")}},X=e=>{const i=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return i.test(e)||s.test(e)},G=e=>{if(t.isEmpty(e))return e;const i=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,n=e.match(i),a=e.match(s),l=n?n[1]:a?a[1]:null,r=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(r.test(l)||o.test(l))?l:e},O=["chai-name","data-chai-name"],Z={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"},form:{action:"action"}},Q=(e,i)=>e.children.length===1&&t.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],i._type),E=e=>e.map(i=>i.type==="text"?t.get(i,"content",""):t.isEmpty(i.children)?"":E(i.children)).join(""),B=e=>e===null?"":e,F=e=>{const i=t.compact(t.map(e.split(/\s+/),t.trim)),s=t.find(i,o=>/^w-/.test(o)),n=t.find(i,o=>/^h-/.test(o));if(!n||!s)return{height:"",width:""};const a=o=>{if(!o)return;const d=o.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!d)return;if(d[1])return d[1];const c=d[2];return/^\d+(\.\d+)?$/.test(c)?`${Number(c)*4}px`:c==="auto"||t.includes(c,"%")?c:"16px"},l=a(s),r=a(n);return{width:t.includes(l,"px")?l:"16px",height:t.includes(r,"px")?r:"16px"}},q=e=>{if(e.tagName==="svg")return{};const i={},s=Z[e.tagName]||{},n=e.attributes;return t.forEach(n,({key:a,value:l})=>{var r;if(!t.includes(O,a))if(a==="bid"&&(i._bid=B(l)),s[a]){if(e.tagName==="img"&&a==="src"&&!l.startsWith("http")){const o=t.find(e.attributes,{key:"width"}),d=t.find(e.attributes,{key:"height"});o&&d?l=`https://picsum.photos/${o==null?void 0:o.value}x${d==null?void 0:d.value}`:l="https://picsum.photos/150x150"}else if(e.tagName==="a"){const o=t.find(e.attributes,{key:"href"});o&&typeof(o==null?void 0:o.value)=="string"&&((r=o==null?void 0:o.value)!=null&&r.startsWith("pageType:"))&&t.set(i,"link.type","pageType")}t.set(i,s[a],B(l))}else t.includes(["style","class","srcset","bid"],a)||(t.has(i,"styles_attrs")||(i.styles_attrs={}),t.startsWith(a,"@")&&(a=a.replace("@","x-on:")),i.styles_attrs[`${a}`]=B(l))}),delete i.class,i},tt=(e,i="styles")=>{if(!e.attributes)return{[i]:`${m},`};const s=t.find(e.attributes,{key:"class"});if(s){const n=s.value;return{[i]:`${m},${n}`}}return{[i]:`${m},`}},et=e=>{const i=t.get(e,"attributes",[]),s=i.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),n=i.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),a=i.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),l=i.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),r=i.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content"),o=i.find(c=>c.key==="class"),d=o&&o.value.split(/\s+/).includes("rte");if(a)return{_type:"Dropdown"};if(l)return{_type:"DropdownButton"};if(r)return{_type:"DropdownContent"};if(s||d)return{_type:"Paragraph"};if(n)return{_type:"LightBoxLink"};switch(e.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:e.tagName,_listType:e.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:e.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:e.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Box",_name:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:e.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:e.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:{const c=t.get(e,"children",[]).length>0?"Box":"EmptyBox";return{_type:c,tag:e.tagName,_name:c=="EmptyBox"||e.tagName==="div"?c:t.capitalize(e.tagName)}}}},w=(e,i=null)=>t.flatMapDeep(e,s=>{var D,I,C,$,N,L,W,A,P,R;if(s.type==="comment")return[];let n={_id:T.generateUUID()};if(i&&(n._parent=i.block._id),s.type==="text")return t.isEmpty(t.get(s,"content",""))?[]:i&&Q(i.node,i.block)?(t.set(i,"block.content",t.get(s,"content","")),[]):{...n,_type:"Text",content:t.get(s,"content","")};if(t.startsWith(s.tagName,"chai-")){const p=s.attributes,u=t.find(p,{key:"chai-type"}),y=(u==null?void 0:u.value)||t.startCase(s.tagName.replace("chai-","")).replace(/\s+/g,"");n._type=y,t.forEach(p,({key:h,value:j})=>{if(h==="about-this-component"||h==="chai-type"||h==="can-move"||h==="can-delete")return;if(h==="id"){n._id=j;return}const z=t.startsWith(h,"_")?h:t.camelCase(h);let f=B(j);typeof f=="string"&&t.startsWith(f,"#styles:")&&(f=f.replace("#styles:","#styles:,")),n[z]=f});const g=w(s.children,{block:n,node:s});return[n,...g]}const a=t.get(s,"attributes",[]),l=s.tagName==="p"||a.find(p=>p.key==="data-chai-richtext"||p.key==="chai-richtext"),r=a.find(p=>p.key==="class"),o=r&&r.value.split(/\s+/).includes("rte"),d=a.find(p=>p.key==="data-chai-lightbox"||p.key==="chai-lightbox"),c=a.find(p=>p.key==="data-chai-dropdown"||p.key==="chai-dropdown"),b=a.find(p=>p.key==="data-chai-dropdown-button"||p.key==="chai-dropdown-button"),_=a.find(p=>p.key==="data-chai-dropdown-content"||p.key==="chai-dropdown-content");if(n={...n,...et(s),...q(s),...tt(s)},s.attributes){const p=s.attributes.find(u=>t.includes(O,u.key));p&&(n._name=p.value)}if(l||o)return n.content=`<p>${k.stringify(s.children||[])}</p>`,t.has(n,"styles_attrs.data-chai-richtext")&&delete n.styles_attrs["data-chai-richtext"],t.has(n,"styles_attrs.chai-richtext")&&delete n.styles_attrs["chai-richtext"],[n];if(d){const p=["data-chai-lightbox","chai-lightbox","data-vbtype","data-autoplay","data-maxwidth","data-overlay","data-gall","href"];n={...n,href:((D=a.find(u=>u.key==="href"))==null?void 0:D.value)||"",hrefType:((I=a.find(u=>u.key==="data-vbtype"))==null?void 0:I.value)||"video",autoplay:((C=a.find(u=>u.key==="data-autoplay"))==null?void 0:C.value)==="true"?"true":"false",maxWidth:((N=($=a.find(u=>u.key==="data-maxwidth"))==null?void 0:$.value)==null?void 0:N.replace("px",""))||"",backdropColor:((L=a.find(u=>u.key==="data-overlay"))==null?void 0:L.value)||"",galleryName:((W=a.find(u=>u.key==="data-gall"))==null?void 0:W.value)||""},t.forEach(p,u=>{t.has(n,`styles_attrs.${u}`)&&delete n.styles_attrs[u]})}if(c&&(delete n.styles_attrs,n.showDropdown=!1),_&&delete n.styles_attrs,b){delete n.styles_attrs;const p=t.filter(s.children||[],y=>(y==null?void 0:y.tagName)!=="span");n.content=E(p);const u=t.find(s.children||[],y=>(y==null?void 0:y.tagName)==="span"&&t.some(y.children||[],g=>(g==null?void 0:g.tagName)==="svg"));if(u){const y=t.find(u.children||[],g=>(g==null?void 0:g.tagName)==="svg");if(y){n.icon=k.stringify([y]);const{height:g,width:h}=st(y,"16px","16px");n.iconHeight=g,n.iconWidth=h}}return[n]}if(n._type==="Input"){const p=n.inputType||"text";p==="checkbox"?t.set(n,"_type","Checkbox"):p==="radio"&&t.set(n,"_type","Radio")}else if(s.tagName==="video"||s.tagName==="iframe"){const p=k.stringify([s]);return X(p)&&(t.set(n,"_type","Video"),t.set(n,"url",G(p)),t.set(n,"styles",`${m},`),t.set(n,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),n.content=p,[n]}else if(s.tagName==="svg"){const p=t.get(t.find(s.attributes,{key:"class"}),"value",""),{height:u,width:y}=F(p);if(u&&y)n.styles=`${m}, ${T.cn(`w-${y} h-${u}`,p)}`.trim(),n.height=u==null?void 0:u.replace("px",""),n.width=y==null?void 0:y.replace("px","");else{const g=(A=t.find(s.attributes,{key:"height"}))==null?void 0:A.value,h=(P=t.find(s.attributes,{key:"width"}))==null?void 0:P.value;g&&h?(n.styles=`${m}, ${T.cn(`w-[${h}px] h-[${g}px]`,p)}`.trim(),n.height=g,n.width=h):n.styles=`${m}, ${T.cn("w-full h-full",p)}`.trim()}return s.attributes=t.filter(s.attributes,g=>!t.includes(["style","width","height","class"],g.key)),n.icon=k.stringify([s]),[n]}else if(s.tagName=="option"&&i&&((R=i.block)==null?void 0:R._type)==="Select")return i.block.options.push({label:E(s.children),...q(s)}),[];const x=w(s.children,{block:n,node:s});return[n,...x]}),st=(e,i,s)=>{var d,c;const n=t.get(e,"attributes",[]),{height:a,width:l}=F(t.get(t.find(n,{key:"class"}),"value",""));if(a&&l)return{height:`[${a}px]`,width:`[${l}px]`};const r=(d=t.find(n,{key:"height"}))==null?void 0:d.value,o=(c=t.find(n,{key:"width"}))==null?void 0:c.value;return{height:r?`[${r}px]`:s,width:o?`[${o}px]`:i}},nt=e=>{e=e.replace(/(\w+)=\\?"(.*?)\\?"/g,(n,a,l)=>{let r=l.replace(/\\"/g,'"');return r=r.replace(/{([^}]+)}/g,o=>o.replace(/"/g,'\\"')),`${a}="${r.replace(/\\"/g,'"')}"`}),e=e.replace(/\\n/g,"").replace(/\\\\/g,"").replace(/\\([/<>])/g,"$1").replace(/\\./g,"").replace(/[\n\r\t\f\v]/g,""),e=e.replace(/\$name="[^"]*"/g,"");const i=e.match(/<body[^>]*>[\s\S]*?<\/body>/);return(i&&i.length>0?i[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):e).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},at=(e,i)=>t.find(e,{_id:i}),lt=(e,i)=>t.isEmpty(i)?e.map(s=>(t.unset(s,"_bid"),s)):t.map(e,s=>{const n=t.isEmpty(s._bid)?void 0:at(i,s._bid);if(n){n._type==="Icon"&&t.get(s,"icon","").match(/chai-default-svg/)&&delete s.icon;const a={...n,...s};return t.unset(a,"_bid"),a}return t.unset(s,"_bid"),s}),ot=e=>{const i=k.parse(nt(e));if(t.isEmpty(e))return[];const s=t.flatten(w(i));return V.syncBlocksWithDefaults(s)};function rt(e,i,s){const n=t.get(s,"i18nProps",[]);if(t.isEmpty(i)||t.isEmpty(n))return e;const a=t.cloneDeep(e);return t.forEach(t.keys(a),l=>{if(t.includes(n,l)&&!t.isEmpty(i)){const r=t.get(a,l),o=t.get(a,`${l}-${i}`,"");t.isString(r)?a[l]=t.isString(o)&&!t.isEmpty(o.trim())&&o.trimStart()||r:a[l]=t.isEmpty(o)?r:o}}),a}const J=(e,i)=>{const{baseClasses:s,classes:n}=M(e),l=n.split(" ").filter(o=>o.startsWith(v)).map(o=>{var d;return(d=i[o])==null?void 0:d.value}),r=n.split(" ").filter(o=>!o.startsWith(v)).join(" ");return U.twMerge.apply(null,[s,...l,r])};function ct(e,i){return t.get(e,`${i}_attrs`,{})}function pt(e,i=!0,s={}){const n={};return Object.keys(e).forEach(a=>{if(t.isString(e[a])&&e[a].startsWith(m)){const l=J(e[a],s),r=ct(e,a);n[a]={...!t.isEmpty(l)&&{className:l},...r,...i?{"data-style-prop":a,"data-block-parent":e._id,"data-style-id":`${a}-${e._id}`}:{}}}}),n}const ut=t.memoize(e=>{const i=V.getRegisteredChaiBlock(e),s=t.get(i,"schema.properties",{});return Object.fromEntries(Object.entries(s).filter(([,n])=>t.get(n,"runtime",!1)))}),dt=(e,i)=>{if(!t.isArray(e))return e;let s=e,n;return typeof i.limit=="number"&&i.limit>0&&(n=i.limit),n!==void 0&&(s=s.slice(0,n)),s},yt=(e,i)=>{const s=t.cloneDeep(e);return t.forEach(t.keys(s),n=>{if(t.isString(s[n])&&!t.startsWith(n,"_")){let a=s[n];n==="repeaterItems"&&(s.repeaterItemsBinding=a);const l=/\{\{(.*?)\}\}/g,r=a.match(l);r&&r.forEach(o=>{let d=o.slice(2,-2);const c=t.get(i,d,o);a=t.isArray(c)?c:a.replace(o,c)}),s[n]=a}}),s},gt=(e,i)=>e.map(s=>{const n=t.keys(s).filter(a=>t.isString(s[a])&&s[a].startsWith(m));return t.each(n,a=>{s[a]=`${m},${J(s[a],i)}`}),s}),ht=e=>{const i=t.last(e);return e.map(s=>{const n=Object.keys(s);for(let a=0;a<n.length;a++)if(t.isString(s[n[a]])&&t.startsWith(n[a],"content")){const l=s===i?"":" ";s[n[a]]=`${s[n[a]].trim()}${l}`}return s})},S=(e,i,{index:s,key:n},a)=>{if(t.isString(e)){let l=e;const r=/\{\{(.*?)\}\}/g,o=e.match(r);if(o){const d=a==="image"||a==="mobileImage";o.forEach(c=>{let b=c.slice(2,-2).trim(),_=n.slice(2,-2).trim();s!==-1&&t.startsWith(b,"$index.")?b=`${_}.${s}.${b.slice(7)}`:s!==-1&&t.startsWith(b,"$index")&&(b=`${_}.${s}`);const x=t.get(i,b);x===void 0?l=l.replace(c,""):d&&!t.isArray(x)?l=x:l=t.isArray(x)?x:l.replace(c,x)})}return l}if(t.isArray(e))return e.map(l=>S(l,i,{index:s,key:n},a));if(e&&typeof e=="object"){const l={};return t.forEach(t.keys(e),r=>{!t.startsWith(r,"_")&&r!=="$repeaterItemsKey"?l[r]=S(e[r],i,{index:s,key:n},r):l[r]=e[r]}),l}return e},mt=(e,i,{index:s,key:n})=>{let a=t.cloneDeep(e);return a.repeaterItems&&(a.$repeaterItemsKey=a.repeaterItems,t.startsWith(a.repeaterItems,`{{${H}`)&&(a.$repeaterItemsKey=a.repeaterItems=`${a.repeaterItems.replace("}}",`/${a._id}}}`)}`),!t.isEmpty(a.repeaterItems)&&a.pagination&&(a.repeaterTotalItems=`${a.repeaterItems.replace("}}",`/${a._id}/totalItems}}`)}`)),S(a,i,{index:s,key:n})};exports.COLLECTION_PREFIX=H;exports.DESIGN_TOKEN_PREFIX=v;exports.REPEATER_PREFIX=K;exports.ROOT_TEMP_KEY=Y;exports.STYLES_KEY=m;exports.adjustSpacingInContentBlocks=ht;exports.applyBindingToBlockProps=mt;exports.applyChaiDataBinding=yt;exports.applyDesignTokens=gt;exports.applyLanguage=rt;exports.applyLimit=dt;exports.getBlockRuntimeProps=ut;exports.getBlockTagAttributes=pt;exports.getBlocksFromHTML=ot;exports.getSplitChaiClasses=M;exports.mergeBlocksWithExisting=lt;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./tooltip-Ba1-8jmj.cjs"),m=require("@monaco-editor/react"),o=require("@radix-ui/react-icons"),l=require("react");function j({code:r,onCopy:d,language:s="javascript",onDownload:c,downloadText:u="Download"}){const[n,a]=l.useState(!1),[t,p]=l.useState(r),f=()=>{d(t),a(!0),setTimeout(()=>{a(!1)},2e3)},h=()=>{c(t)};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:e.jsx(m,{height:"100%",defaultLanguage:s,language:s,value:t,onChange:x=>p(x||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(i.Button,{type:"button",variant:"outline",onClick:f,children:[n?e.jsx(o.CheckIcon,{className:"text-green-500"}):e.jsx(o.CopyIcon,{})," ",n?"Copied":"Copy"]}),e.jsxs(i.Button,{type:"button",onClick:h,children:[e.jsx(o.DownloadIcon,{})," ",u]})]})]})}exports.default=j;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-CuANr9iH.cjs");require("clsx");require("lodash-es");require("nanoid");require("tailwind-merge");require("tree-model");const c=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-Ba1-8jmj.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=c.useState(!1),[a,p]=c.useState(""),[t,d]=i.useCodeEditor(),[u]=i.useSelectedBlockIds(),b=i.useUpdateBlocksProps(),f=i.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=c.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { u as C, a as k, b as v, c as g } from "./index-DvdOXKUE.js";
|
|
3
|
-
import "clsx";
|
|
4
|
-
import "lodash-es";
|
|
5
|
-
import "nanoid";
|
|
6
|
-
import "tailwind-merge";
|
|
7
|
-
import "tree-model";
|
|
8
|
-
import { useState as m, useCallback as T, useEffect as y } from "react";
|
|
9
|
-
import "jotai";
|
|
10
|
-
import "@chaibuilder/runtime";
|
|
11
|
-
import "sonner";
|
|
12
|
-
import { useTranslation as w } from "react-i18next";
|
|
13
|
-
import { a1 as N, a3 as E, a6 as D, a9 as H, b1 as P } from "./tooltip-DUosa-uC.js";
|
|
14
|
-
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
15
|
-
const p = (a) => {
|
|
16
|
-
const t = document.createElement("div");
|
|
17
|
-
return t.innerHTML = a, t.innerHTML;
|
|
18
|
-
};
|
|
19
|
-
function Q() {
|
|
20
|
-
const { t: a } = w(), [t, u] = m(!1), [r, f] = m(""), [e, n] = C(), [i] = k(), h = v(), x = g(), b = B(
|
|
21
|
-
(s) => {
|
|
22
|
-
const l = p(s);
|
|
23
|
-
x([e.blockId], { [e.blockProp]: l });
|
|
24
|
-
},
|
|
25
|
-
[],
|
|
26
|
-
300
|
|
27
|
-
), c = T(() => {
|
|
28
|
-
if (t) {
|
|
29
|
-
const s = p(r);
|
|
30
|
-
h([e.blockId], { [e.blockProp]: s });
|
|
31
|
-
}
|
|
32
|
-
}, [t, r]);
|
|
33
|
-
return y(() => {
|
|
34
|
-
i.includes(e == null ? void 0 : e.blockId) || (c(), n(null));
|
|
35
|
-
}, [i]), /* @__PURE__ */ o(N, { open: !0, onOpenChange: () => {
|
|
36
|
-
c(), n(null);
|
|
37
|
-
}, children: /* @__PURE__ */ d(E, { className: "flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black", children: [
|
|
38
|
-
/* @__PURE__ */ o(D, { className: "shrink-0 border-b border-gray-700 pb-3", children: /* @__PURE__ */ o(H, { className: "flex items-center justify-between text-black", children: /* @__PURE__ */ d("div", { className: "space-x-3 text-sm font-semibold", children: [
|
|
39
|
-
/* @__PURE__ */ o("span", { children: a("HTML Code Editor |") }),
|
|
40
|
-
/* @__PURE__ */ o("span", { className: "text-xs text-gray-400", children: a("Scripts will be only executed in preview and live mode.") })
|
|
41
|
-
] }) }) }),
|
|
42
|
-
/* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ o(
|
|
43
|
-
P,
|
|
44
|
-
{
|
|
45
|
-
className: "h-full w-full resize-none font-mono text-xs",
|
|
46
|
-
value: r || e.initialCode,
|
|
47
|
-
onChange: (s) => {
|
|
48
|
-
const l = s.target.value;
|
|
49
|
-
u(!0), f(l), b(l);
|
|
50
|
-
},
|
|
51
|
-
rows: 10,
|
|
52
|
-
placeholder: "Enter your code here..."
|
|
53
|
-
}
|
|
54
|
-
) })
|
|
55
|
-
] }) });
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
Q as default
|
|
59
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("react"),c=require("./tooltip-Ba1-8jmj.cjs"),T=require("culori"),V=require("@chaibuilder/runtime"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const S=$(w),y=$(T),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),l=m(r,"--font-sans")||m(r,"--font-family")||m(r,"--font-heading")||m(r,"--font-body"),a=D(l);o.fontFamily={heading:a,body:a};const u=m(r,"--radius")||m(r,"--border-radius")||"0.5rem";o.borderRadius=P(u),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=m(r,`--${i}`),g=m(s,`--${i}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[i]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},m=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[r,s,l,a]=t,u=`hsl(${s} ${l}% ${a}%)`;return b(u)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const l=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(l)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=V.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(l=>l.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{if(!e)return"8px";try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
|
|
2
|
-
--background: 0 0% 100%;
|
|
3
|
-
--foreground: oklch(0.52 0.13 144.17);
|
|
4
|
-
--primary: #3e2723;
|
|
5
|
-
--primary-foreground: #ffffff;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.dark {
|
|
9
|
-
--background: 222.2 84% 4.9%;
|
|
10
|
-
--foreground: hsl(37.50 36.36% 95.69%);
|
|
11
|
-
--primary: rgb(46, 125, 50);
|
|
12
|
-
--primary-foreground: #ffffff;
|
|
13
|
-
}`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=S.useState(""),[l,a]=S.useState(null),[u,h]=S.useState(!1),{t:i}=N.useTranslation(),p=async()=>{h(!0),a(null);try{const d=F(r);if(!d.isValid){a(d.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),h(!1);return}const x=I(r);if(!q(x)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),h(!1);return}t(x),s(""),a(null),o(!1)}catch(d){console.error("Error importing CSS:",d),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{h(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(c.Dialog,{open:e,onOpenChange:o,children:n.jsxs(c.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(c.DialogHeader,{children:[n.jsx(c.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(c.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(c.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(c.Textarea,{id:"css-input",placeholder:M,value:r,onChange:d=>s(d.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:u})]}),l&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:l})})]}),n.jsxs(c.DialogFooter,{className:"gap-2",children:[n.jsx(c.Button,{variant:"outline",onClick:g,disabled:u,children:i("Cancel")}),n.jsx(c.Button,{onClick:p,disabled:!r.trim()||u,children:i(u?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=_;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./tooltip-Ba1-8jmj.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,120 +0,0 @@
|
|
|
1
|
-
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { g as w, a as _, h as f, i as C, j as I } from "./index-DvdOXKUE.js";
|
|
3
|
-
import "clsx";
|
|
4
|
-
import { noop as O } from "lodash-es";
|
|
5
|
-
import "nanoid";
|
|
6
|
-
import "tailwind-merge";
|
|
7
|
-
import "@chaibuilder/runtime";
|
|
8
|
-
import { useMemo as d, useCallback as z } from "react";
|
|
9
|
-
import "jotai";
|
|
10
|
-
import "sonner";
|
|
11
|
-
import { useTranslation as W } from "react-i18next";
|
|
12
|
-
import { b8 as A, av as E, ay as F, ax as M } from "./tooltip-DUosa-uC.js";
|
|
13
|
-
import { ArrowRightIcon as R, FileIcon as $, GlobeIcon as D } from "@radix-ui/react-icons";
|
|
14
|
-
const b = ({ title: s, items: i, emptyLabel: n, onSelect: t, icon: o }) => /* @__PURE__ */ c("div", { className: "space-y-2", children: [
|
|
15
|
-
/* @__PURE__ */ r("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: s }),
|
|
16
|
-
i.length > 0 ? /* @__PURE__ */ r("div", { className: "space-y-1", children: i.map((a) => /* @__PURE__ */ r(
|
|
17
|
-
"button",
|
|
18
|
-
{
|
|
19
|
-
type: "button",
|
|
20
|
-
onClick: () => t(a.id),
|
|
21
|
-
className: A(
|
|
22
|
-
"group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition",
|
|
23
|
-
"hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
|
|
24
|
-
a.isSelected && "border-primary/40 bg-primary/10 text-primary"
|
|
25
|
-
),
|
|
26
|
-
children: /* @__PURE__ */ c("span", { className: "flex items-center space-x-2", children: [
|
|
27
|
-
o && o,
|
|
28
|
-
/* @__PURE__ */ r("span", { className: "truncate", children: a.label })
|
|
29
|
-
] })
|
|
30
|
-
},
|
|
31
|
-
a.id
|
|
32
|
-
)) }) : /* @__PURE__ */ r("div", { className: "rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground", children: n })
|
|
33
|
-
] }), G = "#styles:", X = (s) => {
|
|
34
|
-
const n = [
|
|
35
|
-
typeof s._name == "string" ? s._name : void 0,
|
|
36
|
-
typeof s._type == "string" ? s._type : void 0
|
|
37
|
-
].filter(Boolean).find((t) => t.trim().length > 0);
|
|
38
|
-
return n ? n.length > 40 ? `${n.slice(0, 37)}...` : n : s._id;
|
|
39
|
-
}, Y = (s, i) => {
|
|
40
|
-
const n = `${i}`;
|
|
41
|
-
return s.filter((t) => Object.values(t).some((o) => typeof o != "string" || !o.startsWith(G) ? !1 : o.includes(n))).map((t) => ({
|
|
42
|
-
id: t._id,
|
|
43
|
-
label: X(t)
|
|
44
|
-
}));
|
|
45
|
-
}, ie = ({ tokenId: s, tokenName: i, children: n }) => {
|
|
46
|
-
const { t } = W(), [o] = w(), [a, g] = _(), h = f("pageId"), u = f("siteWideUsage"), y = d(() => Y(o, s), [o, s]), k = d(
|
|
47
|
-
() => y.map((e) => ({
|
|
48
|
-
id: e.id,
|
|
49
|
-
label: e.label,
|
|
50
|
-
isSelected: a.includes(e.id)
|
|
51
|
-
})),
|
|
52
|
-
[y, a]
|
|
53
|
-
), m = d(() => u ? Object.entries(u).reduce(
|
|
54
|
-
(e, [p, l]) => (p === h || !(l != null && l.designTokens) || !Object.keys(l.designTokens).some((P) => typeof P != "string" ? !1 : P === s) || e.push({ id: p, name: l.name || p, isPartial: !!l.isPartial }), e),
|
|
55
|
-
[]
|
|
56
|
-
) : [], [u, i, s, h]), v = d(
|
|
57
|
-
() => m.filter((e) => !e.isPartial).map((e) => ({
|
|
58
|
-
id: e.id,
|
|
59
|
-
label: e.name
|
|
60
|
-
})),
|
|
61
|
-
[m]
|
|
62
|
-
), S = d(
|
|
63
|
-
() => m.filter((e) => e.isPartial).map((e) => ({
|
|
64
|
-
id: e.id,
|
|
65
|
-
label: e.name
|
|
66
|
-
})),
|
|
67
|
-
[m]
|
|
68
|
-
), N = z(
|
|
69
|
-
(e) => {
|
|
70
|
-
g([e]);
|
|
71
|
-
},
|
|
72
|
-
[g]
|
|
73
|
-
), B = f("gotoPage", O), { selectedLang: T, fallbackLang: L } = C(), { savePageAsync: j } = I(), x = async (e) => {
|
|
74
|
-
e && (await j(!0), B({ pageId: e, lang: T || L }));
|
|
75
|
-
};
|
|
76
|
-
return /* @__PURE__ */ c(E, { children: [
|
|
77
|
-
/* @__PURE__ */ r(F, { asChild: !0, children: n }),
|
|
78
|
-
/* @__PURE__ */ c(M, { side: "bottom", align: "end", className: "w-80 p-0", children: [
|
|
79
|
-
/* @__PURE__ */ c("div", { className: "space-y-1 px-4 py-3", children: [
|
|
80
|
-
/* @__PURE__ */ r("p", { className: "text-xs font-semibold", children: i }),
|
|
81
|
-
/* @__PURE__ */ r("p", { className: "text-[11px] text-muted-foreground", children: t("Usage summary for this design token across your site.") })
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ c("div", { className: "no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4", children: [
|
|
84
|
-
/* @__PURE__ */ r(
|
|
85
|
-
b,
|
|
86
|
-
{
|
|
87
|
-
title: t("Blocks affected on this page"),
|
|
88
|
-
items: k,
|
|
89
|
-
emptyLabel: t("None"),
|
|
90
|
-
onSelect: N,
|
|
91
|
-
icon: /* @__PURE__ */ r(R, { fontSize: 4 })
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
/* @__PURE__ */ r(
|
|
95
|
-
b,
|
|
96
|
-
{
|
|
97
|
-
title: t("Blocks affected on other pages"),
|
|
98
|
-
items: v,
|
|
99
|
-
emptyLabel: t("None"),
|
|
100
|
-
onSelect: x,
|
|
101
|
-
icon: /* @__PURE__ */ r($, { fontSize: 8 })
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
/* @__PURE__ */ r(
|
|
105
|
-
b,
|
|
106
|
-
{
|
|
107
|
-
title: t("Blocks affected on partial blocks"),
|
|
108
|
-
items: S,
|
|
109
|
-
emptyLabel: t("None"),
|
|
110
|
-
onSelect: x,
|
|
111
|
-
icon: /* @__PURE__ */ r(D, { fontSize: 8 })
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
] })
|
|
115
|
-
] })
|
|
116
|
-
] });
|
|
117
|
-
};
|
|
118
|
-
export {
|
|
119
|
-
ie as default
|
|
120
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-CuANr9iH.cjs");require("clsx");const L=require("lodash-es");require("nanoid");require("tailwind-merge");require("@chaibuilder/runtime");const d=require("react");require("jotai");require("sonner");const w=require("react-i18next"),m=require("./tooltip-Ba1-8jmj.cjs"),x=require("@radix-ui/react-icons"),b=({title:r,items:i,emptyLabel:n,onSelect:t,icon:o})=>s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:r}),i.length>0?s.jsx("div",{className:"space-y-1",children:i.map(l=>s.jsx("button",{type:"button",onClick:()=>t(l.id),className:m.cn("group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition","hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",l.isSelected&&"border-primary/40 bg-primary/10 text-primary"),children:s.jsxs("span",{className:"flex items-center space-x-2",children:[o&&o,s.jsx("span",{className:"truncate",children:l.label})]})},l.id))}):s.jsx("div",{className:"rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground",children:n})]}),M="#styles:",_=r=>{const n=[typeof r._name=="string"?r._name:void 0,typeof r._type=="string"?r._type:void 0].filter(Boolean).find(t=>t.trim().length>0);return n?n.length>40?`${n.slice(0,37)}...`:n:r._id},C=(r,i)=>{const n=`${i}`;return r.filter(t=>Object.values(t).some(o=>typeof o!="string"||!o.startsWith(M)?!1:o.includes(n))).map(t=>({id:t._id,label:_(t)}))},O=({tokenId:r,tokenName:i,children:n})=>{const{t}=w.useTranslation(),[o]=a.useBlocksStore(),[l,g]=a.useSelectedBlockIds(),h=a.useBuilderProp("pageId"),f=a.useBuilderProp("siteWideUsage"),y=d.useMemo(()=>C(o,r),[o,r]),S=d.useMemo(()=>y.map(e=>({id:e.id,label:e.label,isSelected:l.includes(e.id)})),[y,l]),u=d.useMemo(()=>f?Object.entries(f).reduce((e,[p,c])=>(p===h||!(c!=null&&c.designTokens)||!Object.keys(c.designTokens).some(P=>typeof P!="string"?!1:P===r)||e.push({id:p,name:c.name||p,isPartial:!!c.isPartial}),e),[]):[],[f,i,r,h]),k=d.useMemo(()=>u.filter(e=>!e.isPartial).map(e=>({id:e.id,label:e.name})),[u]),v=d.useMemo(()=>u.filter(e=>e.isPartial).map(e=>({id:e.id,label:e.name})),[u]),B=d.useCallback(e=>{g([e])},[g]),N=a.useBuilderProp("gotoPage",L.noop),{selectedLang:q,fallbackLang:T}=a.useLanguages(),{savePageAsync:I}=a.useSavePage(),j=async e=>{e&&(await I(!0),N({pageId:e,lang:q||T}))};return s.jsxs(m.Popover,{children:[s.jsx(m.PopoverTrigger,{asChild:!0,children:n}),s.jsxs(m.PopoverContent,{side:"bottom",align:"end",className:"w-80 p-0",children:[s.jsxs("div",{className:"space-y-1 px-4 py-3",children:[s.jsx("p",{className:"text-xs font-semibold",children:i}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("Usage summary for this design token across your site.")})]}),s.jsxs("div",{className:"no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4",children:[s.jsx(b,{title:t("Blocks affected on this page"),items:S,emptyLabel:t("None"),onSelect:B,icon:s.jsx(x.ArrowRightIcon,{fontSize:4})}),s.jsx(b,{title:t("Blocks affected on other pages"),items:k,emptyLabel:t("None"),onSelect:j,icon:s.jsx(x.FileIcon,{fontSize:8})}),s.jsx(b,{title:t("Blocks affected on partial blocks"),items:v,emptyLabel:t("None"),onSelect:j,icon:s.jsx(x.GlobeIcon,{fontSize:8})})]})]})]})};exports.default=O;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./plugin-CSgw-f78.cjs"),i=(t=e.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...e.getChaiThemeOptions(t)});exports.getChaiBuilderTheme=i;
|