@superdoc-dev/template-builder 0.2.0-next.7 → 0.2.0-next.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AA0GhC,QAAA,MAAM,uBAAuB,oJAukB3B,CAAC;AAIH,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AA0GhC,QAAA,MAAM,uBAAuB,oJAwkB3B,CAAC;AAIH,eAAe,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Te=Object.create;var pe=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ne=(o,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of Ee(a))!De.call(o,n)&&n!==c&&pe(o,n,{get:()=>a[n],enumerable:!(d=Re(a,n))||d.enumerable});return o};var Be=(o,a,c)=>(c=o!=null?Te(Ie(o)):{},Ne(a||!o||!o.__esModule?pe(c,"default",{value:o,enumerable:!0}):c,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),me=({isVisible:o,position:a,availableFields:c,filteredFields:d,filterQuery:n,allowCreate:m,onSelect:N,onClose:O,onCreateField:z})=>{const[_,M]=s.useState(!1),[w,b]=s.useState(""),[V,j]=s.useState("inline");s.useEffect(()=>{o||(M(!1),b(""),j("inline"))},[o]);const K=s.useMemo(()=>({position:"absolute",left:a?.left,top:a?.top,zIndex:1e3,background:"white",border:"1px solid #ddd",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"8px 0",minWidth:"200px"}),[a]),q=d??c,A=!!n,f=s.useMemo(()=>{const i=[],g=new Map;return q.forEach(C=>{const h=C.category?.trim()||"Uncategorized",T=g.get(h);if(T!==void 0){i[T].fields.push(C);return}g.set(h,i.length),i.push({category:h,fields:[C]})}),i},[q]),[B,S]=s.useState({});s.useEffect(()=>{S(i=>{if(f.length===0)return Object.keys(i).length===0?i:{};const g={};let C=Object.keys(i).length!==f.length;return f.forEach(({category:h},T)=>{const R=A?!0:i[h]??T===0;g[h]=R,!C&&i[h]!==R&&(C=!0)}),C?g:i})},[f,A]);const U=s.useCallback(i=>{S(g=>({...g,[i]:!g[i]}))},[]);if(!o)return null;const L=async()=>{const i=w.trim();if(!i)return;const g={id:`custom_${Date.now()}`,label:i,category:"Custom",metadata:{mode:V}};try{if(z){const C=await z(g);N(C||g)}else N(g)}finally{M(!1),b(""),j("inline")}};return t.jsxs("div",{className:"superdoc-field-menu",style:K,children:[A&&t.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:t.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",t.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:n})]})}),m&&!_&&t.jsx("div",{className:"field-menu-item",onClick:()=>M(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),m&&_&&t.jsxs("div",{style:{padding:"8px 16px"},children:[t.jsx("input",{type:"text",value:w,placeholder:"Field name...",onChange:i=>b(i.target.value),onKeyDown:i=>{i.key==="Enter"&&L(),i.key==="Escape"&&(M(!1),b(""),j("inline"))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),t.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"12px",fontSize:"13px"},children:[t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},children:[t.jsx("input",{type:"radio",value:"inline",checked:V==="inline",onChange:()=>j("inline")}),"Inline"]}),t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},children:[t.jsx("input",{type:"radio",value:"block",checked:V==="block",onChange:()=>j("block")}),"Block"]})]}),t.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[t.jsx("button",{onClick:L,disabled:!w.trim(),style:{padding:"4px 12px",background:w.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:w.trim()?"pointer":"not-allowed"},children:"Create"}),t.jsx("button",{onClick:()=>{M(!1),b(""),j("inline")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),m&&c.length>0&&t.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),f.length===0?t.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):f.map(({category:i,fields:g},C)=>{const h=!!B[i],T=`${Math.max(g.length*40,0)}px`;return t.jsxs("div",{style:{borderTop:C===0&&m?void 0:"1px solid #f0f0f0"},children:[t.jsxs("button",{type:"button",onClick:()=>U(i),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[t.jsxs("span",{children:[i," (",g.length,")"]}),t.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:h?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),t.jsx("div",{"data-category":i,"aria-hidden":!h,style:{overflow:"hidden",maxHeight:h?T:"0px",opacity:h?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:h?"auto":"none"},children:t.jsx("div",{style:{padding:h?"4px 0":0},children:g.map(R=>t.jsx("div",{className:"field-menu-item",onClick:()=>N(R),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:t.jsx("span",{style:{fontWeight:500},children:R.label})},R.id))})})]},i)}),t.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:t.jsx("button",{onClick:O,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},ge=({fields:o,onSelect:a,onDelete:c,selectedFieldId:d})=>t.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[t.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",o.length,")"]}),o.length===0?t.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(n=>t.jsxs("div",{onClick:()=>a(n),style:{position:"relative",padding:"12px",background:d===n.id?"#eff6ff":"#f9fafb",border:d===n.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:m=>{d!==n.id&&(m.currentTarget.style.background="#f3f4f6")},onMouseLeave:m=>{d!==n.id&&(m.currentTarget.style.background="#f9fafb")},title:n.alias,children:[t.jsx("button",{onClick:m=>{m.stopPropagation(),c(n.id)},style:{position:"absolute",top:"8px",right:"8px",padding:"4px",background:"transparent",border:"none",cursor:"pointer",color:"#9ca3af",transition:"color 0.2s",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:m=>{m.currentTarget.style.color="#ef4444"},onMouseLeave:m=>{m.currentTarget.style.color="#9ca3af"},title:"Delete field",children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsxs("div",{style:{paddingRight:"24px"},children:[t.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:n.alias&&n.alias!==n.id?"4px":"0"},children:n.id}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"#4b5563"},children:[n.alias&&n.alias!==n.id&&t.jsx("span",{children:n.alias}),n.mode&&t.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:n.mode==="block"?"#dbeafe":"#f3f4f6",color:n.mode==="block"?"#1e40af":"#4b5563",fontWeight:"500"},children:n.mode})]})]})]},n.id))})]}),oe=o=>{const a=o.helpers?.structuredContentCommands;return a?.getStructuredContentTags?(a.getStructuredContentTags(o.state)||[]).map(d=>{const n=d?.node??d,m=n?.attrs??{},O=(n?.type?.name||"").includes("Block")?"block":"inline";return{id:m.id,alias:m.alias||m.label||"",tag:m.tag,mode:O}}):[]},xe=(o,a)=>{if(o===a)return!0;if(o.length!==a.length)return!1;for(let c=0;c<o.length;c+=1){const d=o[c],n=a[c];if(!n||d.id!==n.id||d.alias!==n.alias||d.tag!==n.tag||d.position!==n.position||d.mode!==n.mode)return!1}return!0},Le=o=>{if(!o)return null;if(o===!0)return{selector:"#superdoc-toolbar",config:{},renderDefaultContainer:!0};if(typeof o=="string")return{selector:o,config:{},renderDefaultContainer:!1};const{selector:a,...c}=o;return{selector:a||"#superdoc-toolbar",config:c,renderDefaultContainer:a===void 0}},Q=10,He=250,Pe=300,fe=o=>{const a=window.innerWidth-He-Q,c=window.innerHeight-Pe-Q,d=Math.min(o.left,a),n=Math.min(o.top,c);return new DOMRect(Math.max(d,Q),Math.max(n,Q),o.width,o.height)},he=s.forwardRef((o,a)=>{const{document:c,fields:d={},menu:n={},list:m={},toolbar:N,onReady:O,onTrigger:z,onFieldInsert:_,onFieldUpdate:M,onFieldDelete:w,onFieldsChange:b,onFieldSelect:V,onFieldCreate:j,className:K,style:q,documentHeight:A="600px"}=o,[f,B]=s.useState(d.initial||[]),[S,U]=s.useState(null),[L,i]=s.useState(!1),[g,C]=s.useState(),[h,T]=s.useState(""),[R,be]=s.useState(()=>d.available||[]),X=s.useRef(null),v=s.useRef(null),E=s.useRef(null),se=s.useRef(d);se.current=d;const I=s.useRef(null),ie=s.useRef(L);s.useEffect(()=>{ie.current=L},[L]);const $=n.trigger||"{{",Y=se.current.available||[],le=s.useCallback(e=>{const r=e.trim().toLowerCase();return r?Y.filter(l=>{const u=l.label.toLowerCase(),F=l.category?.toLowerCase()||"";return u.includes(r)||F.includes(r)}):Y},[Y]),Z=s.useCallback(e=>{T(e),be(le(e))},[le]),H=s.useCallback(()=>{Z("")},[Z]),G=s.useCallback((e,r)=>{if(!v.current?.activeEditor)return!1;const l=v.current.activeEditor,u=f,F=e==="inline"?l.commands.insertStructuredContentInline?.({attrs:{alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias}):l.commands.insertStructuredContentBlock?.({attrs:{alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias});if(F){const y=oe(l);B(y),b?.(y);const p=y.find(x=>!u.some(D=>D.id===x.id));p&&_?.(p)}return F},[_,b,f]),ee=s.useCallback((e,r)=>{if(!v.current?.activeEditor)return!1;const u=v.current.activeEditor.commands.updateStructuredContentById?.(e,{attrs:r});return u&&B(F=>{const y=F.map(x=>x.id===e?{...x,...r}:x);b?.(y);const p=y.find(x=>x.id===e);return p&&M?.(p),y}),u},[M,b]),te=s.useCallback(e=>{const r=v.current?.activeEditor;if(!r){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let p=!1;return B(x=>{if(!x.some(k=>k.id===e))return x;const D=x.filter(k=>k.id!==e);return p=!0,b?.(D),D}),p&&(w?.(e),U(x=>x===e?null:x)),p}let l=!1;try{l=r.commands.deleteStructuredContentById?.(e)??!1}catch(p){console.error("[SuperDocTemplateBuilder] Delete command failed:",p)}let u=oe(r);const F=u.some(p=>p.id===e);!l&&F&&(u=u.filter(p=>p.id!==e));let y=!1;return B(p=>{if(xe(p,u))return p;const x=p.some(k=>k.id===e),D=u.some(k=>k.id===e);return x&&!D&&(y=!0),b?.(u),u}),y&&(w?.(e),U(p=>p===e?null:p)),l||y},[w,b]),P=s.useCallback(e=>{if(!v.current?.activeEditor)return;v.current.activeEditor.commands.selectStructuredContentById?.(e),U(e);const l=f.find(u=>u.id===e);l&&V?.(l)},[f,V]),ne=s.useCallback(e=>{if(!e)return;const r=oe(e);B(l=>xe(l,r)?l:(b?.(r),r))},[b]);s.useEffect(()=>X.current?((async()=>{const{SuperDoc:r}=await import("superdoc"),l={selector:X.current,document:c?.source,documentMode:c?.mode||"editing",onReady:()=>{if(u.activeEditor){const F=u.activeEditor;F.on("update",({editor:y})=>{const{state:p}=y,{from:x}=p.selection;if(x>=$.length){const re=x-$.length;if(p.doc.textBetween(re,x)===$){const de=y.view.coordsAtPos(x),ce=fe(new DOMRect(de.left,de.top,0,0)),ue=()=>{const J=v.current?.activeEditor;if(!J)return;const Se=J.state.selection.from,Me=J.state.tr.delete(re,Se);J.view.dispatch(Me)};E.current=ue,I.current=x,C(ce),i(!0),H(),z?.({position:{from:re,to:x},bounds:ce,cleanup:ue});return}}if(!ie.current)return;if(I.current==null){i(!1),H();return}if(x<I.current){i(!1),I.current=null,H();return}const D=p.doc.textBetween(I.current,x);Z(D);const k=y.view.coordsAtPos(x),we=fe(new DOMRect(k.left,k.top,0,0));C(we)}),F.on("update",()=>{ne(F)}),ne(F)}O?.()}},u=new r({selector:X.current,documentMode:c?.mode||"editing",...l,...W&&{toolbar:W.selector,modules:{toolbar:{selector:W.selector,toolbarGroups:W.config.toolbarGroups||["center"],excludeItems:W.config.excludeItems||[],...W.config}}}});v.current=u})(),()=>{E.current=null,I.current=null;const r=v.current;r&&typeof r.destroy=="function"&&r.destroy(),v.current=null}):void 0,[c?.source,c?.mode,$,ne,O,z,N]);const ye=s.useCallback(async e=>{E.current&&(E.current(),E.current=null),I.current=null,H();const r=e.metadata?.mode||"inline";if(e.id.startsWith("custom_")&&j)try{const l=await j(e);if(l){const u=l.metadata?.mode||r;G(u,{alias:l.label,category:l.category,metadata:l.metadata,defaultValue:l.defaultValue}),i(!1);return}}catch(l){console.error("Field creation failed:",l)}G(r,{alias:e.label,category:e.category,metadata:e.metadata,defaultValue:e.defaultValue}),i(!1)},[G,j,H]),Ce=s.useCallback(()=>{i(!1),I.current=null,H(),E.current&&(E.current(),E.current=null)},[H]),ve=s.useCallback(()=>{if(!v.current?.activeEditor||f.length===0)return;const e=f.findIndex(l=>l.id===S),r=e>=0?(e+1)%f.length:0;P(f[r].id)},[f,S,P]),Fe=s.useCallback(()=>{if(!v.current?.activeEditor||f.length===0)return;const e=f.findIndex(l=>l.id===S),r=e>0?e-1:f.length-1;P(f[r].id)},[f,S,P]),je=s.useCallback(async e=>{const{fileName:r="document",triggerDownload:l=!0}=e||{};try{return await v.current?.export({exportType:["docx"],exportedName:r,triggerDownload:l})}catch(u){throw console.error("Failed to export DOCX",u),u}},[]);s.useImperativeHandle(a,()=>({insertField:e=>G("inline",e),insertBlockField:e=>G("block",e),updateField:ee,deleteField:te,selectField:P,nextField:ve,previousField:Fe,getFields:()=>f,exportTemplate:je}));const ke=n.component||me,ae=m.component||ge,W=Le(N);return t.jsxs("div",{className:`superdoc-template-builder ${K||""}`,style:q,children:[t.jsxs("div",{style:{display:"flex",gap:"20px"},children:[m.position==="left"&&t.jsx("div",{className:"superdoc-template-builder-sidebar",children:t.jsx(ae,{fields:f,onSelect:e=>P(e.id),onDelete:te,onUpdate:e=>ee(e.id,e),selectedFieldId:S||void 0})}),t.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[W?.renderDefaultContainer&&t.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),t.jsx("div",{ref:X,className:"superdoc-template-builder-editor",style:{height:A},"data-testid":"template-builder-editor"})]}),m.position==="right"&&t.jsx("div",{className:"superdoc-template-builder-sidebar",children:t.jsx(ae,{fields:f,onSelect:e=>P(e.id),onDelete:te,onUpdate:e=>ee(e.id,e),selectedFieldId:S||void 0})})]}),t.jsx(ke,{isVisible:L,position:g,availableFields:d.available||[],filteredFields:R,filterQuery:h,allowCreate:d.allowCreate||!1,onSelect:ye,onClose:Ce,onCreateField:j})]})});he.displayName="SuperDocTemplateBuilder";exports.FieldList=ge;exports.FieldMenu=me;exports.default=he;
1
+ "use strict";var Te=Object.create;var pe=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ne=(o,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of Ee(a))!De.call(o,n)&&n!==c&&pe(o,n,{get:()=>a[n],enumerable:!(d=Re(a,n))||d.enumerable});return o};var Be=(o,a,c)=>(c=o!=null?Te(Ie(o)):{},Ne(a||!o||!o.__esModule?pe(c,"default",{value:o,enumerable:!0}):c,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),me=({isVisible:o,position:a,availableFields:c,filteredFields:d,filterQuery:n,allowCreate:m,onSelect:N,onClose:O,onCreateField:z})=>{const[_,M]=s.useState(!1),[w,b]=s.useState(""),[V,j]=s.useState("inline");s.useEffect(()=>{o||(M(!1),b(""),j("inline"))},[o]);const K=s.useMemo(()=>({position:"absolute",left:a?.left,top:a?.top,zIndex:1e3,background:"white",border:"1px solid #ddd",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"8px 0",minWidth:"200px"}),[a]),q=d??c,A=!!n,f=s.useMemo(()=>{const i=[],g=new Map;return q.forEach(v=>{const h=v.category?.trim()||"Uncategorized",T=g.get(h);if(T!==void 0){i[T].fields.push(v);return}g.set(h,i.length),i.push({category:h,fields:[v]})}),i},[q]),[B,S]=s.useState({});s.useEffect(()=>{S(i=>{if(f.length===0)return Object.keys(i).length===0?i:{};const g={};let v=Object.keys(i).length!==f.length;return f.forEach(({category:h},T)=>{const R=A?!0:i[h]??T===0;g[h]=R,!v&&i[h]!==R&&(v=!0)}),v?g:i})},[f,A]);const U=s.useCallback(i=>{S(g=>({...g,[i]:!g[i]}))},[]);if(!o)return null;const L=async()=>{const i=w.trim();if(!i)return;const g={id:`custom_${Date.now()}`,label:i,category:"Custom",metadata:{mode:V}};try{if(z){const v=await z(g);N(v||g)}else N(g)}finally{M(!1),b(""),j("inline")}};return t.jsxs("div",{className:"superdoc-field-menu",style:K,children:[A&&t.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:t.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",t.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:n})]})}),m&&!_&&t.jsx("div",{className:"field-menu-item",onClick:()=>M(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),m&&_&&t.jsxs("div",{style:{padding:"8px 16px"},children:[t.jsx("input",{type:"text",value:w,placeholder:"Field name...",onChange:i=>b(i.target.value),onKeyDown:i=>{i.key==="Enter"&&L(),i.key==="Escape"&&(M(!1),b(""),j("inline"))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),t.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"12px",fontSize:"13px"},children:[t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},children:[t.jsx("input",{type:"radio",value:"inline",checked:V==="inline",onChange:()=>j("inline")}),"Inline"]}),t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},children:[t.jsx("input",{type:"radio",value:"block",checked:V==="block",onChange:()=>j("block")}),"Block"]})]}),t.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[t.jsx("button",{onClick:L,disabled:!w.trim(),style:{padding:"4px 12px",background:w.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:w.trim()?"pointer":"not-allowed"},children:"Create"}),t.jsx("button",{onClick:()=>{M(!1),b(""),j("inline")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),m&&c.length>0&&t.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),f.length===0?t.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):f.map(({category:i,fields:g},v)=>{const h=!!B[i],T=`${Math.max(g.length*40,0)}px`;return t.jsxs("div",{style:{borderTop:v===0&&m?void 0:"1px solid #f0f0f0"},children:[t.jsxs("button",{type:"button",onClick:()=>U(i),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[t.jsxs("span",{children:[i," (",g.length,")"]}),t.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:h?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),t.jsx("div",{"data-category":i,"aria-hidden":!h,style:{overflow:"hidden",maxHeight:h?T:"0px",opacity:h?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:h?"auto":"none"},children:t.jsx("div",{style:{padding:h?"4px 0":0},children:g.map(R=>t.jsx("div",{className:"field-menu-item",onClick:()=>N(R),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:t.jsx("span",{style:{fontWeight:500},children:R.label})},R.id))})})]},i)}),t.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:t.jsx("button",{onClick:O,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},ge=({fields:o,onSelect:a,onDelete:c,selectedFieldId:d})=>t.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[t.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",o.length,")"]}),o.length===0?t.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(n=>t.jsxs("div",{onClick:()=>a(n),style:{position:"relative",padding:"12px",background:d===n.id?"#eff6ff":"#f9fafb",border:d===n.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:m=>{d!==n.id&&(m.currentTarget.style.background="#f3f4f6")},onMouseLeave:m=>{d!==n.id&&(m.currentTarget.style.background="#f9fafb")},title:n.alias,children:[t.jsx("button",{onClick:m=>{m.stopPropagation(),c(n.id)},style:{position:"absolute",top:"8px",right:"8px",padding:"4px",background:"transparent",border:"none",cursor:"pointer",color:"#9ca3af",transition:"color 0.2s",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:m=>{m.currentTarget.style.color="#ef4444"},onMouseLeave:m=>{m.currentTarget.style.color="#9ca3af"},title:"Delete field",children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsxs("div",{style:{paddingRight:"24px"},children:[t.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:n.alias&&n.alias!==n.id?"4px":"0"},children:n.id}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"#4b5563"},children:[n.alias&&n.alias!==n.id&&t.jsx("span",{children:n.alias}),n.mode&&t.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:n.mode==="block"?"#dbeafe":"#f3f4f6",color:n.mode==="block"?"#1e40af":"#4b5563",fontWeight:"500"},children:n.mode})]})]})]},n.id))})]}),oe=o=>{const a=o.helpers?.structuredContentCommands;return a?.getStructuredContentTags?(a.getStructuredContentTags(o.state)||[]).map(d=>{const n=d?.node??d,m=n?.attrs??{},O=(n?.type?.name||"").includes("Block")?"block":"inline";return{id:m.id,alias:m.alias||m.label||"",tag:m.tag,mode:O}}):[]},xe=(o,a)=>{if(o===a)return!0;if(o.length!==a.length)return!1;for(let c=0;c<o.length;c+=1){const d=o[c],n=a[c];if(!n||d.id!==n.id||d.alias!==n.alias||d.tag!==n.tag||d.position!==n.position||d.mode!==n.mode)return!1}return!0},Le=o=>{if(!o)return null;if(o===!0)return{selector:"#superdoc-toolbar",config:{},renderDefaultContainer:!0};if(typeof o=="string")return{selector:o,config:{},renderDefaultContainer:!1};const{selector:a,...c}=o;return{selector:a||"#superdoc-toolbar",config:c,renderDefaultContainer:a===void 0}},Q=10,He=250,Pe=300,fe=o=>{const a=window.innerWidth-He-Q,c=window.innerHeight-Pe-Q,d=Math.min(o.left,a),n=Math.min(o.top,c);return new DOMRect(Math.max(d,Q),Math.max(n,Q),o.width,o.height)},he=s.forwardRef((o,a)=>{const{document:c,fields:d={},menu:n={},list:m={},toolbar:N,onReady:O,onTrigger:z,onFieldInsert:_,onFieldUpdate:M,onFieldDelete:w,onFieldsChange:b,onFieldSelect:V,onFieldCreate:j,className:K,style:q,documentHeight:A="600px"}=o,[f,B]=s.useState(d.initial||[]),[S,U]=s.useState(null),[L,i]=s.useState(!1),[g,v]=s.useState(),[h,T]=s.useState(""),[R,be]=s.useState(()=>d.available||[]),X=s.useRef(null),y=s.useRef(null),E=s.useRef(null),se=s.useRef(d);se.current=d;const I=s.useRef(null),ie=s.useRef(L);s.useEffect(()=>{ie.current=L},[L]);const $=n.trigger||"{{",Y=se.current.available||[],le=s.useCallback(e=>{const r=e.trim().toLowerCase();return r?Y.filter(l=>{const u=l.label.toLowerCase(),F=l.category?.toLowerCase()||"";return u.includes(r)||F.includes(r)}):Y},[Y]),Z=s.useCallback(e=>{T(e),be(le(e))},[le]),H=s.useCallback(()=>{Z("")},[Z]),G=s.useCallback((e,r)=>{if(!y.current?.activeEditor)return!1;const l=y.current.activeEditor,u=f,F=e==="inline"?l.commands.insertStructuredContentInline?.({attrs:{alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias}):l.commands.insertStructuredContentBlock?.({attrs:{alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias});if(F){const C=oe(l);B(C),b?.(C);const p=C.find(x=>!u.some(D=>D.id===x.id));p&&_?.(p)}return F},[_,b,f]),ee=s.useCallback((e,r)=>{if(!y.current?.activeEditor)return!1;const u=y.current.activeEditor.commands.updateStructuredContentById?.(e,{attrs:r});return u&&B(F=>{const C=F.map(x=>x.id===e?{...x,...r}:x);b?.(C);const p=C.find(x=>x.id===e);return p&&M?.(p),C}),u},[M,b]),te=s.useCallback(e=>{const r=y.current?.activeEditor;if(!r){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let p=!1;return B(x=>{if(!x.some(k=>k.id===e))return x;const D=x.filter(k=>k.id!==e);return p=!0,b?.(D),D}),p&&(w?.(e),U(x=>x===e?null:x)),p}let l=!1;try{l=r.commands.deleteStructuredContentById?.(e)??!1}catch(p){console.error("[SuperDocTemplateBuilder] Delete command failed:",p)}let u=oe(r);const F=u.some(p=>p.id===e);!l&&F&&(u=u.filter(p=>p.id!==e));let C=!1;return B(p=>{if(xe(p,u))return p;const x=p.some(k=>k.id===e),D=u.some(k=>k.id===e);return x&&!D&&(C=!0),b?.(u),u}),C&&(w?.(e),U(p=>p===e?null:p)),l||C},[w,b]),P=s.useCallback(e=>{if(!y.current?.activeEditor)return;y.current.activeEditor.commands.selectStructuredContentById?.(e),U(e);const l=f.find(u=>u.id===e);l&&V?.(l)},[f,V]),ne=s.useCallback(e=>{if(!e)return;const r=oe(e);B(l=>xe(l,r)?l:(b?.(r),r))},[b]);s.useEffect(()=>X.current?((async()=>{const{SuperDoc:r}=await import("superdoc"),l={selector:X.current,document:c?.source,documentMode:c?.mode||"editing",onReady:()=>{if(u.activeEditor){const F=u.activeEditor;F.on("update",({editor:C})=>{const{state:p}=C,{from:x}=p.selection;if(x>=$.length){const re=x-$.length;if(p.doc.textBetween(re,x)===$){const de=C.view.coordsAtPos(x),ce=fe(new DOMRect(de.left,de.top,0,0)),ue=()=>{const J=y.current?.activeEditor;if(!J)return;const Se=J.state.selection.from,Me=J.state.tr.delete(re,Se);J.view.dispatch(Me)};E.current=ue,I.current=x,v(ce),i(!0),H(),z?.({position:{from:re,to:x},bounds:ce,cleanup:ue});return}}if(!ie.current)return;if(I.current==null){i(!1),H();return}if(x<I.current){i(!1),I.current=null,H();return}const D=p.doc.textBetween(I.current,x);Z(D);const k=C.view.coordsAtPos(x),we=fe(new DOMRect(k.left,k.top,0,0));v(we)}),F.on("update",()=>{ne(F)}),ne(F)}O?.()}},u=new r({selector:X.current,documentMode:c?.mode||"editing",...l,...W&&{toolbar:W.selector,modules:{toolbar:{selector:W.selector,toolbarGroups:W.config.toolbarGroups||["center"],excludeItems:W.config.excludeItems||[],...W.config}}}});y.current=u})(),()=>{E.current=null,I.current=null;const r=y.current;r&&typeof r.destroy=="function"&&r.destroy(),y.current=null}):void 0,[c?.source,c?.mode,$,ne,O,z,N]);const ye=s.useCallback(async e=>{E.current&&(E.current(),E.current=null),I.current=null,H();const r=e.metadata?.mode||"inline";if(e.id.startsWith("custom_")&&j)try{const l=await j(e);if(l){const u=l.metadata?.mode||r;G(u,{alias:l.label,category:l.category,metadata:l.metadata,defaultValue:l.defaultValue}),i(!1);return}}catch(l){console.error("Field creation failed:",l)}G(r,{alias:e.label,category:e.category,metadata:e.metadata,defaultValue:e.defaultValue}),i(!1)},[G,j,H]),Ce=s.useCallback(()=>{i(!1),I.current=null,H(),E.current&&(E.current(),E.current=null)},[H]),ve=s.useCallback(()=>{if(!y.current?.activeEditor||f.length===0)return;const e=f.findIndex(l=>l.id===S),r=e>=0?(e+1)%f.length:0;P(f[r].id)},[f,S,P]),Fe=s.useCallback(()=>{if(!y.current?.activeEditor||f.length===0)return;const e=f.findIndex(l=>l.id===S),r=e>0?e-1:f.length-1;P(f[r].id)},[f,S,P]),je=s.useCallback(async e=>{const{fileName:r="document",triggerDownload:l=!0}=e||{};try{return await y.current?.export({exportType:["docx"],exportedName:r,triggerDownload:l})}catch(u){throw console.error("Failed to export DOCX",u),u}},[]);s.useImperativeHandle(a,()=>({insertField:e=>G("inline",e),insertBlockField:e=>G("block",e),updateField:ee,deleteField:te,selectField:P,nextField:ve,previousField:Fe,getFields:()=>f,exportTemplate:je,getSuperDoc:()=>y.current}));const ke=n.component||me,ae=m.component||ge,W=Le(N);return t.jsxs("div",{className:`superdoc-template-builder ${K||""}`,style:q,children:[t.jsxs("div",{style:{display:"flex",gap:"20px"},children:[m.position==="left"&&t.jsx("div",{className:"superdoc-template-builder-sidebar",children:t.jsx(ae,{fields:f,onSelect:e=>P(e.id),onDelete:te,onUpdate:e=>ee(e.id,e),selectedFieldId:S||void 0})}),t.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[W?.renderDefaultContainer&&t.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),t.jsx("div",{ref:X,className:"superdoc-template-builder-editor",style:{height:A},"data-testid":"template-builder-editor"})]}),m.position==="right"&&t.jsx("div",{className:"superdoc-template-builder-sidebar",children:t.jsx(ae,{fields:f,onSelect:e=>P(e.id),onDelete:te,onUpdate:e=>ee(e.id,e),selectedFieldId:S||void 0})})]}),t.jsx(ke,{isVisible:L,position:g,availableFields:d.available||[],filteredFields:R,filterQuery:h,allowCreate:d.allowCreate||!1,onSelect:ye,onClose:Ce,onCreateField:j})]})});he.displayName="SuperDocTemplateBuilder";exports.FieldList=ge;exports.FieldMenu=me;exports.default=he;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs as g, jsx as i } from "react/jsx-runtime";
2
- import { useState as T, useEffect as ee, useMemo as xe, useCallback as F, forwardRef as Ee, useRef as _, useImperativeHandle as De } from "react";
2
+ import { useState as S, useEffect as ee, useMemo as xe, useCallback as F, forwardRef as De, useRef as _, useImperativeHandle as Ee } from "react";
3
3
  const Ne = ({
4
4
  isVisible: s,
5
5
  position: f,
@@ -11,9 +11,9 @@ const Ne = ({
11
11
  onClose: j,
12
12
  onCreateField: U
13
13
  }) => {
14
- const [G, E] = T(!1), [S, y] = T(""), [A, k] = T("inline");
14
+ const [G, D] = S(!1), [T, y] = S(""), [A, k] = S("inline");
15
15
  ee(() => {
16
- s || (E(!1), y(""), k("inline"));
16
+ s || (D(!1), y(""), k("inline"));
17
17
  }, [s]);
18
18
  const te = xe(() => ({
19
19
  position: "absolute",
@@ -28,25 +28,25 @@ const Ne = ({
28
28
  minWidth: "200px"
29
29
  }), [f]), Q = c ?? m, X = !!n, u = xe(() => {
30
30
  const r = [], x = /* @__PURE__ */ new Map();
31
- return Q.forEach((v) => {
32
- const h = v.category?.trim() || "Uncategorized", D = x.get(h);
33
- if (D !== void 0) {
34
- r[D].fields.push(v);
31
+ return Q.forEach((C) => {
32
+ const h = C.category?.trim() || "Uncategorized", E = x.get(h);
33
+ if (E !== void 0) {
34
+ r[E].fields.push(C);
35
35
  return;
36
36
  }
37
- x.set(h, r.length), r.push({ category: h, fields: [v] });
37
+ x.set(h, r.length), r.push({ category: h, fields: [C] });
38
38
  }), r;
39
- }, [Q]), [P, I] = T({});
39
+ }, [Q]), [P, I] = S({});
40
40
  ee(() => {
41
41
  I((r) => {
42
42
  if (u.length === 0)
43
43
  return Object.keys(r).length === 0 ? r : {};
44
44
  const x = {};
45
- let v = Object.keys(r).length !== u.length;
46
- return u.forEach(({ category: h }, D) => {
47
- const N = X ? !0 : r[h] ?? D === 0;
48
- x[h] = N, !v && r[h] !== N && (v = !0);
49
- }), v ? x : r;
45
+ let C = Object.keys(r).length !== u.length;
46
+ return u.forEach(({ category: h }, E) => {
47
+ const N = X ? !0 : r[h] ?? E === 0;
48
+ x[h] = N, !C && r[h] !== N && (C = !0);
49
+ }), C ? x : r;
50
50
  });
51
51
  }, [u, X]);
52
52
  const $ = F((r) => {
@@ -57,7 +57,7 @@ const Ne = ({
57
57
  }, []);
58
58
  if (!s) return null;
59
59
  const W = async () => {
60
- const r = S.trim();
60
+ const r = T.trim();
61
61
  if (!r) return;
62
62
  const x = {
63
63
  id: `custom_${Date.now()}`,
@@ -67,12 +67,12 @@ const Ne = ({
67
67
  };
68
68
  try {
69
69
  if (U) {
70
- const v = await U(x);
71
- H(v || x);
70
+ const C = await U(x);
71
+ H(C || x);
72
72
  } else
73
73
  H(x);
74
74
  } finally {
75
- E(!1), y(""), k("inline");
75
+ D(!1), y(""), k("inline");
76
76
  }
77
77
  };
78
78
  return /* @__PURE__ */ g("div", { className: "superdoc-field-menu", style: te, children: [
@@ -100,7 +100,7 @@ const Ne = ({
100
100
  "div",
101
101
  {
102
102
  className: "field-menu-item",
103
- onClick: () => E(!0),
103
+ onClick: () => D(!0),
104
104
  style: {
105
105
  padding: "8px 16px",
106
106
  cursor: "pointer",
@@ -115,11 +115,11 @@ const Ne = ({
115
115
  "input",
116
116
  {
117
117
  type: "text",
118
- value: S,
118
+ value: T,
119
119
  placeholder: "Field name...",
120
120
  onChange: (r) => y(r.target.value),
121
121
  onKeyDown: (r) => {
122
- r.key === "Enter" && W(), r.key === "Escape" && (E(!1), y(""), k("inline"));
122
+ r.key === "Enter" && W(), r.key === "Escape" && (D(!1), y(""), k("inline"));
123
123
  },
124
124
  autoFocus: !0,
125
125
  style: {
@@ -202,14 +202,14 @@ const Ne = ({
202
202
  "button",
203
203
  {
204
204
  onClick: W,
205
- disabled: !S.trim(),
205
+ disabled: !T.trim(),
206
206
  style: {
207
207
  padding: "4px 12px",
208
- background: S.trim() ? "#0066cc" : "#ccc",
208
+ background: T.trim() ? "#0066cc" : "#ccc",
209
209
  color: "white",
210
210
  border: "none",
211
211
  borderRadius: "3px",
212
- cursor: S.trim() ? "pointer" : "not-allowed"
212
+ cursor: T.trim() ? "pointer" : "not-allowed"
213
213
  },
214
214
  children: "Create"
215
215
  }
@@ -218,7 +218,7 @@ const Ne = ({
218
218
  "button",
219
219
  {
220
220
  onClick: () => {
221
- E(!1), y(""), k("inline");
221
+ D(!1), y(""), k("inline");
222
222
  },
223
223
  style: {
224
224
  padding: "4px 12px",
@@ -254,13 +254,13 @@ const Ne = ({
254
254
  },
255
255
  children: "No matching fields"
256
256
  }
257
- ) : u.map(({ category: r, fields: x }, v) => {
258
- const h = !!P[r], D = `${Math.max(x.length * 40, 0)}px`;
257
+ ) : u.map(({ category: r, fields: x }, C) => {
258
+ const h = !!P[r], E = `${Math.max(x.length * 40, 0)}px`;
259
259
  return /* @__PURE__ */ g(
260
260
  "div",
261
261
  {
262
262
  style: {
263
- borderTop: v === 0 && p ? void 0 : "1px solid #f0f0f0"
263
+ borderTop: C === 0 && p ? void 0 : "1px solid #f0f0f0"
264
264
  },
265
265
  children: [
266
266
  /* @__PURE__ */ g(
@@ -313,7 +313,7 @@ const Ne = ({
313
313
  "aria-hidden": !h,
314
314
  style: {
315
315
  overflow: "hidden",
316
- maxHeight: h ? D : "0px",
316
+ maxHeight: h ? E : "0px",
317
317
  opacity: h ? 1 : 0,
318
318
  transition: "max-height 0.2s ease, opacity 0.2s ease",
319
319
  pointerEvents: h ? "auto" : "none"
@@ -569,7 +569,7 @@ const Ne = ({
569
569
  s.width,
570
570
  s.height
571
571
  );
572
- }, Pe = Ee((s, f) => {
572
+ }, Pe = De((s, f) => {
573
573
  const {
574
574
  document: m,
575
575
  fields: c = {},
@@ -579,17 +579,17 @@ const Ne = ({
579
579
  onReady: j,
580
580
  onTrigger: U,
581
581
  onFieldInsert: G,
582
- onFieldUpdate: E,
583
- onFieldDelete: S,
582
+ onFieldUpdate: D,
583
+ onFieldDelete: T,
584
584
  onFieldsChange: y,
585
585
  onFieldSelect: A,
586
586
  onFieldCreate: k,
587
587
  className: te,
588
588
  style: Q,
589
589
  documentHeight: X = "600px"
590
- } = s, [u, P] = T(
590
+ } = s, [u, P] = S(
591
591
  c.initial || []
592
- ), [I, $] = T(null), [W, r] = T(!1), [x, v] = T(), [h, D] = T(""), [N, be] = T(() => c.available || []), q = _(null), C = _(null), R = _(null), de = _(c);
592
+ ), [I, $] = S(null), [W, r] = S(!1), [x, C] = S(), [h, E] = S(""), [N, be] = S(() => c.available || []), q = _(null), b = _(null), R = _(null), de = _(c);
593
593
  de.current = c;
594
594
  const B = _(null), ce = _(W);
595
595
  ee(() => {
@@ -606,15 +606,15 @@ const Ne = ({
606
606
  [ne]
607
607
  ), re = F(
608
608
  (e) => {
609
- D(e), be(ue(e));
609
+ E(e), be(ue(e));
610
610
  },
611
611
  [ue]
612
612
  ), V = F(() => {
613
613
  re("");
614
614
  }, [re]), J = F(
615
615
  (e, t) => {
616
- if (!C.current?.activeEditor) return !1;
617
- const o = C.current.activeEditor, l = u, w = e === "inline" ? o.commands.insertStructuredContentInline?.({
616
+ if (!b.current?.activeEditor) return !1;
617
+ const o = b.current.activeEditor, l = u, w = e === "inline" ? o.commands.insertStructuredContentInline?.({
618
618
  attrs: {
619
619
  alias: t.alias,
620
620
  tag: t.metadata ? JSON.stringify(t.metadata) : t.category
@@ -628,9 +628,9 @@ const Ne = ({
628
628
  text: t.defaultValue || t.alias
629
629
  });
630
630
  if (w) {
631
- const b = ae(o);
632
- P(b), y?.(b);
633
- const a = b.find(
631
+ const v = ae(o);
632
+ P(v), y?.(v);
633
+ const a = v.find(
634
634
  (d) => !l.some((L) => L.id === d.id)
635
635
  );
636
636
  a && G?.(a);
@@ -640,23 +640,23 @@ const Ne = ({
640
640
  [G, y, u]
641
641
  ), oe = F(
642
642
  (e, t) => {
643
- if (!C.current?.activeEditor) return !1;
644
- const l = C.current.activeEditor.commands.updateStructuredContentById?.(e, {
643
+ if (!b.current?.activeEditor) return !1;
644
+ const l = b.current.activeEditor.commands.updateStructuredContentById?.(e, {
645
645
  attrs: t
646
646
  });
647
647
  return l && P((w) => {
648
- const b = w.map(
648
+ const v = w.map(
649
649
  (d) => d.id === e ? { ...d, ...t } : d
650
650
  );
651
- y?.(b);
652
- const a = b.find((d) => d.id === e);
653
- return a && E?.(a), b;
651
+ y?.(v);
652
+ const a = v.find((d) => d.id === e);
653
+ return a && D?.(a), v;
654
654
  }), l;
655
655
  },
656
- [E, y]
656
+ [D, y]
657
657
  ), ie = F(
658
658
  (e) => {
659
- const t = C.current?.activeEditor;
659
+ const t = b.current?.activeEditor;
660
660
  if (!t) {
661
661
  console.warn(
662
662
  "[SuperDocTemplateBuilder] deleteField called without active editor"
@@ -666,7 +666,7 @@ const Ne = ({
666
666
  if (!d.some((M) => M.id === e)) return d;
667
667
  const L = d.filter((M) => M.id !== e);
668
668
  return a = !0, y?.(L), L;
669
- }), a && (S?.(e), $((d) => d === e ? null : d)), a;
669
+ }), a && (T?.(e), $((d) => d === e ? null : d)), a;
670
670
  }
671
671
  let o = !1;
672
672
  try {
@@ -680,19 +680,19 @@ const Ne = ({
680
680
  let l = ae(t);
681
681
  const w = l.some((a) => a.id === e);
682
682
  !o && w && (l = l.filter((a) => a.id !== e));
683
- let b = !1;
683
+ let v = !1;
684
684
  return P((a) => {
685
685
  if (he(a, l))
686
686
  return a;
687
687
  const d = a.some((M) => M.id === e), L = l.some((M) => M.id === e);
688
- return d && !L && (b = !0), y?.(l), l;
689
- }), b && (S?.(e), $((a) => a === e ? null : a)), o || b;
688
+ return d && !L && (v = !0), y?.(l), l;
689
+ }), v && (T?.(e), $((a) => a === e ? null : a)), o || v;
690
690
  },
691
- [S, y]
691
+ [T, y]
692
692
  ), z = F(
693
693
  (e) => {
694
- if (!C.current?.activeEditor) return;
695
- C.current.activeEditor.commands.selectStructuredContentById?.(e), $(e);
694
+ if (!b.current?.activeEditor) return;
695
+ b.current.activeEditor.commands.selectStructuredContentById?.(e), $(e);
696
696
  const o = u.find((l) => l.id === e);
697
697
  o && A?.(o);
698
698
  },
@@ -713,20 +713,20 @@ const Ne = ({
713
713
  onReady: () => {
714
714
  if (l.activeEditor) {
715
715
  const w = l.activeEditor;
716
- w.on("update", ({ editor: b }) => {
717
- const { state: a } = b, { from: d } = a.selection;
716
+ w.on("update", ({ editor: v }) => {
717
+ const { state: a } = v, { from: d } = a.selection;
718
718
  if (d >= K.length) {
719
719
  const le = d - K.length;
720
720
  if (a.doc.textBetween(le, d) === K) {
721
- const me = b.view.coordsAtPos(d), fe = ye(
721
+ const me = v.view.coordsAtPos(d), fe = ye(
722
722
  new DOMRect(me.left, me.top, 0, 0)
723
723
  ), ge = () => {
724
- const Y = C.current?.activeEditor;
724
+ const Y = b.current?.activeEditor;
725
725
  if (!Y) return;
726
- const Se = Y.state.selection.from, Ie = Y.state.tr.delete(le, Se);
726
+ const Te = Y.state.selection.from, Ie = Y.state.tr.delete(le, Te);
727
727
  Y.view.dispatch(Ie);
728
728
  };
729
- R.current = ge, B.current = d, v(fe), r(!0), V(), U?.({
729
+ R.current = ge, B.current = d, C(fe), r(!0), V(), U?.({
730
730
  position: { from: le, to: d },
731
731
  bounds: fe,
732
732
  cleanup: ge
@@ -749,10 +749,10 @@ const Ne = ({
749
749
  d
750
750
  );
751
751
  re(L);
752
- const M = b.view.coordsAtPos(d), Te = ye(
752
+ const M = v.view.coordsAtPos(d), Se = ye(
753
753
  new DOMRect(M.left, M.top, 0, 0)
754
754
  );
755
- v(Te);
755
+ C(Se);
756
756
  }), w.on("update", () => {
757
757
  se(w);
758
758
  }), se(w);
@@ -775,11 +775,11 @@ const Ne = ({
775
775
  }
776
776
  }
777
777
  });
778
- C.current = l;
778
+ b.current = l;
779
779
  })(), () => {
780
780
  R.current = null, B.current = null;
781
- const t = C.current;
782
- t && typeof t.destroy == "function" && t.destroy(), C.current = null;
781
+ const t = b.current;
782
+ t && typeof t.destroy == "function" && t.destroy(), b.current = null;
783
783
  }) : void 0, [
784
784
  m?.source,
785
785
  m?.mode,
@@ -820,14 +820,14 @@ const Ne = ({
820
820
  ), Ce = F(() => {
821
821
  r(!1), B.current = null, V(), R.current && (R.current(), R.current = null);
822
822
  }, [V]), Fe = F(() => {
823
- if (!C.current?.activeEditor || u.length === 0)
823
+ if (!b.current?.activeEditor || u.length === 0)
824
824
  return;
825
825
  const e = u.findIndex(
826
826
  (o) => o.id === I
827
827
  ), t = e >= 0 ? (e + 1) % u.length : 0;
828
828
  z(u[t].id);
829
829
  }, [u, I, z]), we = F(() => {
830
- if (!C.current?.activeEditor || u.length === 0)
830
+ if (!b.current?.activeEditor || u.length === 0)
831
831
  return;
832
832
  const e = u.findIndex(
833
833
  (o) => o.id === I
@@ -837,7 +837,7 @@ const Ne = ({
837
837
  async (e) => {
838
838
  const { fileName: t = "document", triggerDownload: o = !0 } = e || {};
839
839
  try {
840
- return await C.current?.export({
840
+ return await b.current?.export({
841
841
  exportType: ["docx"],
842
842
  exportedName: t,
843
843
  triggerDownload: o
@@ -848,7 +848,7 @@ const Ne = ({
848
848
  },
849
849
  []
850
850
  );
851
- De(f, () => ({
851
+ Ee(f, () => ({
852
852
  insertField: (e) => J("inline", e),
853
853
  insertBlockField: (e) => J("block", e),
854
854
  updateField: oe,
@@ -857,7 +857,8 @@ const Ne = ({
857
857
  nextField: Fe,
858
858
  previousField: we,
859
859
  getFields: () => u,
860
- exportTemplate: ke
860
+ exportTemplate: ke,
861
+ getSuperDoc: () => b.current
861
862
  }));
862
863
  const Me = n.component || Ne, pe = p.component || Re, O = Be(H);
863
864
  return /* @__PURE__ */ g(
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { SuperDoc } from 'superdoc';
1
2
  export interface FieldDefinition {
2
3
  id: string;
3
4
  label: string;
@@ -115,5 +116,15 @@ export interface SuperDocTemplateBuilderHandle {
115
116
  previousField: () => void;
116
117
  getFields: () => TemplateField[];
117
118
  exportTemplate: (config?: ExportConfig) => Promise<void | Blob>;
119
+ /**
120
+ * Returns the SuperDoc instance.
121
+ * Use this to access the full SuperDoc API, including:
122
+ * - The active editor: `getSuperDoc()?.activeEditor`
123
+ * - Editor commands: `getSuperDoc()?.activeEditor?.commands.*`
124
+ * - Editor state and helpers: `getSuperDoc()?.activeEditor?.state`
125
+ *
126
+ * Note: Full TypeScript types for SuperDoc will be available in a future update.
127
+ */
128
+ getSuperDoc: () => SuperDoc | null;
118
129
  }
119
130
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,eAAe,KACnB,IAAI,GAAG,OAAO,CAAC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AAC;IAC9C,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,aAAa,EAAE,CAAC;IACjC,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAChE;;;;;;;;OAQG;IACH,WAAW,EAAE,MAAM,QAAQ,GAAG,IAAI,CAAC;CACpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/template-builder",
3
- "version": "0.2.0-next.7",
3
+ "version": "0.2.0-next.8",
4
4
  "description": "React template builder component for SuperDoc",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",