@superdoc-dev/template-builder 0.2.0-next.3 → 0.2.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,9 +24,9 @@ function TemplateEditor() {
24
24
 
25
25
  fields={{
26
26
  available: [
27
- { id: 'customer_name', label: 'Customer Name', category: 'Contact' },
28
- { id: 'invoice_date', label: 'Invoice Date', category: 'Invoice' },
29
- { id: 'amount', label: 'Amount', category: 'Invoice' }
27
+ { id: '1324567890', label: 'Customer Name', category: 'Contact' },
28
+ { id: '1324567891', label: 'Invoice Date', category: 'Invoice' },
29
+ { id: '1324567892', label: 'Amount', category: 'Invoice' }
30
30
  ]
31
31
  }}
32
32
 
@@ -47,8 +47,8 @@ function TemplateEditor() {
47
47
  ```javascript
48
48
  {
49
49
  fields: [
50
- { id: "field_123", alias: "Customer Name", tag: "contact" },
51
- { id: "field_124", alias: "Invoice Date", tag: "invoice" }
50
+ { id: "1324567890", alias: "Customer Name", tag: "contact" },
51
+ { id: "1324567891", alias: "Invoice Date", tag: "invoice" }
52
52
  ],
53
53
  document: { /* ProseMirror document JSON */ }
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FieldMenu.d.ts","sourceRoot":"","sources":["../../src/defaults/FieldMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA8U9C,CAAC"}
1
+ {"version":3,"file":"FieldMenu.d.ts","sourceRoot":"","sources":["../../src/defaults/FieldMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAkV9C,CAAC"}
@@ -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;AAwGhC,QAAA,MAAM,uBAAuB,oJA2jB3B,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;AAsGhC,QAAA,MAAM,uBAAuB,oJA4jB3B,CAAC;AAIH,eAAe,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ye;function Ye(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case v:return"Profiler";case Q:return"StrictMode";case b:return"Suspense";case E:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case q:return"Portal";case A:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case c:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return a=e.displayName||null,a!==null?a:o(e.type)||"Memo";case j:a=e._payload,e=e._init;try{return o(e(a))}catch{}}return null}function u(e){return""+e}function f(e){try{u(e);var a=!1}catch{a=!0}if(a){a=console;var m=a.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return m.call(a,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),u(e)}}function d(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var a=o(e);return a?"<"+a+">":"<...>"}catch{return"<...>"}}function r(){var e=Z.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function F(e){if(se.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function D(e,a){function m(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",a))}m.isReactWarning=!0,Object.defineProperty(e,"key",{get:m,configurable:!0})}function H(){var e=o(this.type);return ee[e]||(ee[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function U(e,a,m,p,B,re){var h=m.ref;return e={$$typeof:L,type:e,key:a,props:m,_owner:p},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:H}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,a,m,p,B,re){var h=a.children;if(h!==void 0)if(p)if(K(h)){for(p=0;p<h.length;p++)N(h[p]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(h);if(se.call(a,"key")){h=o(e);var _=Object.keys(a).filter(function(ue){return ue!=="key"});p=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",G[h+p]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ye;function Ye(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case v:return"Profiler";case Z:return"StrictMode";case b:return"Suspense";case E:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case q:return"Portal";case A:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case c:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return a=e.displayName||null,a!==null?a:o(e.type)||"Memo";case j:a=e._payload,e=e._init;try{return o(e(a))}catch{}}return null}function u(e){return""+e}function f(e){try{u(e);var a=!1}catch{a=!0}if(a){a=console;var m=a.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return m.call(a,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),u(e)}}function d(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var a=o(e);return a?"<"+a+">":"<...>"}catch{return"<...>"}}function r(){var e=K.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function F(e){if(se.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function D(e,a){function m(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",a))}m.isReactWarning=!0,Object.defineProperty(e,"key",{get:m,configurable:!0})}function z(){var e=o(this.type);return te[e]||(te[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function H(e,a,m,p,B,J){var h=m.ref;return e={$$typeof:L,type:e,key:a,props:m,_owner:p},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,a,m,p,B,J){var h=a.children;if(h!==void 0)if(p)if(ee(h)){for(p=0;p<h.length;p++)N(h[p]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(h);if(se.call(a,"key")){h=o(e);var _=Object.keys(a).filter(function(ue){return ue!=="key"});p=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",G[h+p]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,p,h,_,h),G[h+p]=!0)}if(h=null,m!==void 0&&(f(m),h=""+m),F(a)&&(f(a.key),h=""+a.key),"key"in a){m={};for(var J in a)J!=="key"&&(m[J]=a[J])}else m=a;return h&&D(m,typeof e=="function"?e.displayName||e.name||"Unknown":e),U(e,h,m,r(),B,re)}function N(e){C(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?C(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function C(e){return typeof e=="object"&&e!==null&&e.$$typeof===L}var Y=i,L=Symbol.for("react.transitional.element"),q=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),A=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),Z=Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,K=Array.isArray,k=console.createTask?console.createTask:function(){return null};Y={react_stack_bottom_frame:function(e){return e()}};var M,ee={},I=Y.react_stack_bottom_frame.bind(Y,l)(),te=k(d(l)),G={};oe.Fragment=O,oe.jsx=function(e,a,m){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,m,!1,p?Error("react-stack-top-frame"):I,p?k(d(e)):te)},oe.jsxs=function(e,a,m){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,m,!0,p?Error("react-stack-top-frame"):I,p?k(d(e)):te)}})()),oe}var ve;function $e(){return ve||(ve=1,process.env.NODE_ENV==="production"?ie.exports=Ve():ie.exports=Ye()),ie.exports}var s=$e();const Ce=({isVisible:o,position:u,availableFields:f,filteredFields:d,filterQuery:r,allowCreate:l,onSelect:F,onClose:D,onCreateField:H})=>{const[U,P]=i.useState(!1),[N,C]=i.useState("");i.useEffect(()=>{o||(P(!1),C(""))},[o]);const Y=i.useMemo(()=>({position:"absolute",left:u?.left,top:u?.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"}),[u]),L=d??f,q=!!r,O=i.useMemo(()=>{const c=[],b=new Map;return L.forEach(E=>{const T=E.category?.trim()||"Uncategorized",j=b.get(T);if(j!==void 0){c[j].fields.push(E);return}b.set(T,c.length),c.push({category:T,fields:[E]})}),c},[L]),[Q,v]=i.useState({});i.useEffect(()=>{v(c=>{if(O.length===0)return Object.keys(c).length===0?c:{};const b={};let E=Object.keys(c).length!==O.length;return O.forEach(({category:T},j)=>{const W=q?!0:c[T]??j===0;b[T]=W,!E&&c[T]!==W&&(E=!0)}),E?b:c})},[O,q]);const $=i.useCallback(c=>{v(b=>({...b,[c]:!b[c]}))},[]);if(!o)return null;const A=async()=>{const c=N.trim();if(!c)return;const b={id:`custom_${Date.now()}`,label:c,category:"Custom"};try{if(H){const E=await H(b);F(E||b)}else F(b)}finally{P(!1),C("")}};return s.jsxs("div",{className:"superdoc-field-menu",style:Y,children:[q&&s.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:s.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",s.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:r})]})}),l&&!U&&s.jsx("div",{className:"field-menu-item",onClick:()=>P(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),l&&U&&s.jsxs("div",{style:{padding:"8px 16px"},children:[s.jsx("input",{type:"text",value:N,placeholder:"Field name...",onChange:c=>C(c.target.value),onKeyDown:c=>{c.key==="Enter"&&A(),c.key==="Escape"&&(P(!1),C(""))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),s.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[s.jsx("button",{onClick:A,disabled:!N.trim(),style:{padding:"4px 12px",background:N.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:N.trim()?"pointer":"not-allowed"},children:"Create"}),s.jsx("button",{onClick:()=>{P(!1),C("")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),l&&f.length>0&&s.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),O.length===0?s.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):O.map(({category:c,fields:b},E)=>{const T=!!Q[c],j=`${Math.max(b.length*40,0)}px`;return s.jsxs("div",{style:{borderTop:E===0&&l?void 0:"1px solid #f0f0f0"},children:[s.jsxs("button",{type:"button",onClick:()=>$(c),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[s.jsxs("span",{children:[c," (",b.length,")"]}),s.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:T?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),s.jsx("div",{"data-category":c,"aria-hidden":!T,style:{overflow:"hidden",maxHeight:T?j:"0px",opacity:T?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:T?"auto":"none"},children:s.jsx("div",{style:{padding:T?"4px 0":0},children:b.map(W=>s.jsx("div",{className:"field-menu-item",onClick:()=>F(W),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:s.jsx("span",{style:{fontWeight:500},children:W.label})},W.id))})})]},c)}),s.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:s.jsx("button",{onClick:D,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},Te=({fields:o,onSelect:u,onDelete:f,selectedFieldId:d})=>s.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[s.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",o.length,")"]}),o.length===0?s.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(r=>s.jsxs("div",{onClick:()=>u(r),style:{position:"relative",padding:"12px",background:d===r.id?"#eff6ff":"#f9fafb",border:d===r.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:l=>{d!==r.id&&(l.currentTarget.style.background="#f3f4f6")},onMouseLeave:l=>{d!==r.id&&(l.currentTarget.style.background="#f9fafb")},title:r.alias,children:[s.jsx("button",{onClick:l=>{l.stopPropagation(),f(r.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:l=>{l.currentTarget.style.color="#ef4444"},onMouseLeave:l=>{l.currentTarget.style.color="#9ca3af"},title:"Delete field",children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.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"})})}),s.jsxs("div",{style:{paddingRight:"24px"},children:[s.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:r.alias&&r.alias!==r.id?"4px":"0"},children:r.id}),r.alias&&r.alias!==r.id&&s.jsx("div",{style:{fontSize:"12px",color:"#4b5563"},children:r.alias})]})]},r.id))})]}),fe=o=>{const u=o.helpers?.structuredContentCommands;return u?.getStructuredContentTags?(u.getStructuredContentTags(o.state)||[]).map(d=>{const l=(d?.node??d)?.attrs??{};return{id:l.id,alias:l.alias||l.label||"",tag:l.tag}}):[]},Ee=(o,u)=>{if(o===u)return!0;if(o.length!==u.length)return!1;for(let f=0;f<o.length;f+=1){const d=o[f],r=u[f];if(!r||d.id!==r.id||d.alias!==r.alias||d.tag!==r.tag||d.position!==r.position)return!1}return!0},ze=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:u,...f}=o;return{selector:u||"#superdoc-toolbar",config:f,renderDefaultContainer:u===void 0}},le=10,He=250,Ue=300,Re=o=>{const u=window.innerWidth-He-le,f=window.innerHeight-Ue-le,d=Math.min(o.left,u),r=Math.min(o.top,f);return new DOMRect(Math.max(d,le),Math.max(r,le),o.width,o.height)},ke=i.forwardRef((o,u)=>{const{document:f,fields:d={},menu:r={},list:l={},toolbar:F,onReady:D,onTrigger:H,onFieldInsert:U,onFieldUpdate:P,onFieldDelete:N,onFieldsChange:C,onFieldSelect:Y,onFieldCreate:L,className:q,style:O,documentHeight:Q="600px"}=o,[v,$]=i.useState(d.initial||[]),[A,c]=i.useState(null),[b,E]=i.useState(!1),[T,j]=i.useState(),[W,ce]=i.useState(""),[Z,se]=i.useState(()=>d.available||[]),K=i.useRef(null),k=i.useRef(null),M=i.useRef(null),ee=i.useRef(d);ee.current=d;const I=i.useRef(null),te=i.useRef(b);i.useEffect(()=>{te.current=b},[b]);const G=r.trigger||"{{",e=ee.current.available||[],a=i.useCallback(t=>{const n=t.trim().toLowerCase();return n?e.filter(y=>{const R=y.label.toLowerCase(),S=y.category?.toLowerCase()||"";return R.includes(n)||S.includes(n)}):e},[e]),m=i.useCallback(t=>{ce(t),se(a(t))},[a]),p=i.useCallback(()=>{m("")},[m]),B=i.useCallback((t,n)=>{if(!k.current?.activeEditor)return!1;const y=k.current.activeEditor,R=v,S=t==="inline"?y.commands.insertStructuredContentInline?.({attrs:{alias:n.alias,tag:n.metadata?JSON.stringify(n.metadata):n.category},text:n.defaultValue||n.alias}):y.commands.insertStructuredContentBlock?.({attrs:{alias:n.alias,tag:n.metadata?JSON.stringify(n.metadata):n.category},text:n.defaultValue||n.alias});if(S){const w=fe(y);$(w),C?.(w);const x=w.find(g=>!R.some(z=>z.id===g.id));x&&U?.(x)}return S},[U,C,v]),re=i.useCallback((t,n)=>{if(!k.current?.activeEditor)return!1;const R=k.current.activeEditor.commands.updateStructuredContentById?.(t,{attrs:n});return R&&$(S=>{const w=S.map(g=>g.id===t?{...g,...n}:g);C?.(w);const x=w.find(g=>g.id===t);return x&&P?.(x),w}),R},[P,C]),h=i.useCallback(t=>{const n=k.current?.activeEditor;if(!n){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let x=!1;return $(g=>{if(!g.some(V=>V.id===t))return g;const z=g.filter(V=>V.id!==t);return x=!0,C?.(z),z}),x&&(N?.(t),c(g=>g===t?null:g)),x}let y=!1;try{y=n.commands.deleteStructuredContentById?.(t)??!1}catch(x){console.error("[SuperDocTemplateBuilder] Delete command failed:",x)}let R=fe(n);const S=R.some(x=>x.id===t);!y&&S&&(R=R.filter(x=>x.id!==t));let w=!1;return $(x=>{if(Ee(x,R))return x;const g=x.some(V=>V.id===t),z=R.some(V=>V.id===t);return g&&!z&&(w=!0),C?.(R),R}),w&&(N?.(t),c(x=>x===t?null:x)),y||w},[N,C]),_=i.useCallback(t=>{if(!k.current?.activeEditor)return;k.current.activeEditor.commands.selectStructuredContentById?.(t),c(t);const y=v.find(R=>R.id===t);y&&Y?.(y)},[v,Y]),J=i.useCallback(t=>{if(!t)return;const n=fe(t);$(y=>Ee(y,n)?y:(C?.(n),n))},[C]);i.useEffect(()=>K.current?((async()=>{const{SuperDoc:n}=await import("superdoc"),y={selector:K.current,document:f?.source,documentMode:f?.mode||"editing",onReady:()=>{if(R.activeEditor){const S=R.activeEditor;S.on("update",({editor:w})=>{const{state:x}=w,{from:g}=x.selection;if(g>=G.length){const de=g-G.length;if(x.doc.textBetween(de,g)===G){const me=w.view.coordsAtPos(g),xe=Re(new DOMRect(me.left,me.top,0,0)),ge=()=>{const ae=k.current?.activeEditor;if(!ae)return;const Oe=ae.state.selection.from,Pe=ae.state.tr.delete(de,Oe);ae.view.dispatch(Pe)};M.current=ge,I.current=g,j(xe),E(!0),p(),H?.({position:{from:de,to:g},bounds:xe,cleanup:ge});return}}if(!te.current)return;if(I.current==null){E(!1),p();return}if(g<I.current){E(!1),I.current=null,p();return}const z=x.doc.textBetween(I.current,g);m(z);const V=w.view.coordsAtPos(g),Ne=Re(new DOMRect(V.left,V.top,0,0));j(Ne)}),S.on("update",()=>{J(S)}),J(S)}D?.()}},R=new n({...y,...X&&{toolbar:X.selector,modules:{toolbar:{selector:X.selector,toolbarGroups:X.config.toolbarGroups||["center"],excludeItems:X.config.excludeItems||[],...X.config}}}});k.current=R})(),()=>{M.current=null,I.current=null;const n=k.current;n&&typeof n.destroy=="function"&&n.destroy(),k.current=null}):void 0,[f?.source,f?.mode,G,J,D,H,F]);const ue=i.useCallback(async t=>{if(M.current&&(M.current(),M.current=null),I.current=null,p(),t.id.startsWith("custom_")&&L)try{const n=await L(t);if(n){B("inline",{alias:n.label,category:n.category,metadata:n.metadata,defaultValue:n.defaultValue}),E(!1);return}}catch(n){console.error("Field creation failed:",n)}B("inline",{alias:t.label,category:t.category,metadata:t.metadata,defaultValue:t.defaultValue}),E(!1)},[B,L,p]),we=i.useCallback(()=>{E(!1),I.current=null,p(),M.current&&(M.current(),M.current=null)},[p]),_e=i.useCallback(()=>{if(!k.current?.activeEditor||v.length===0)return;const t=v.findIndex(y=>y.id===A),n=t>=0?(t+1)%v.length:0;_(v[n].id)},[v,A,_]),je=i.useCallback(()=>{if(!k.current?.activeEditor||v.length===0)return;const t=v.findIndex(y=>y.id===A),n=t>0?t-1:v.length-1;_(v[n].id)},[v,A,_]),Se=i.useCallback(async t=>{try{await k.current?.export({exportType:["docx"],exportedName:t?.fileName?t?.fileName:"document"})}catch(n){throw console.error("Failed to export DOCX",n),n}},[]);i.useImperativeHandle(u,()=>({insertField:t=>B("inline",t),insertBlockField:t=>B("block",t),updateField:re,deleteField:h,selectField:_,nextField:_e,previousField:je,getFields:()=>v,exportTemplate:Se}));const Fe=r.component||Ce,pe=l.component||Te,X=ze(F);return s.jsxs("div",{className:`superdoc-template-builder ${q||""}`,style:O,children:[s.jsxs("div",{style:{display:"flex",gap:"20px"},children:[l.position==="left"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(pe,{fields:v,onSelect:t=>_(t.id),onDelete:h,selectedFieldId:A||void 0})}),s.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[X?.renderDefaultContainer&&s.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),s.jsx("div",{ref:K,className:"superdoc-template-builder-editor",style:{height:Q},"data-testid":"template-builder-editor"})]}),l.position==="right"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(pe,{fields:v,onSelect:t=>_(t.id),onDelete:h,selectedFieldId:A||void 0})})]}),s.jsx(Fe,{isVisible:b,position:T,availableFields:d.available||[],filteredFields:Z,filterQuery:W,allowCreate:d.allowCreate||!1,onSelect:ue,onClose:we,onCreateField:L})]})});ke.displayName="SuperDocTemplateBuilder";exports.FieldList=Te;exports.FieldMenu=Ce;exports.default=ke;
22
+ <%s key={someKey} {...props} />`,p,h,_,h),G[h+p]=!0)}if(h=null,m!==void 0&&(f(m),h=""+m),F(a)&&(f(a.key),h=""+a.key),"key"in a){m={};for(var X in a)X!=="key"&&(m[X]=a[X])}else m=a;return h&&D(m,typeof e=="function"?e.displayName||e.name||"Unknown":e),H(e,h,m,r(),B,J)}function N(e){C(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?C(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function C(e){return typeof e=="object"&&e!==null&&e.$$typeof===L}var Y=i,L=Symbol.for("react.transitional.element"),q=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),A=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),K=Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,ee=Array.isArray,k=console.createTask?console.createTask:function(){return null};Y={react_stack_bottom_frame:function(e){return e()}};var M,te={},I=Y.react_stack_bottom_frame.bind(Y,l)(),re=k(d(l)),G={};oe.Fragment=O,oe.jsx=function(e,a,m){var p=1e4>K.recentlyCreatedOwnerStacks++;return P(e,a,m,!1,p?Error("react-stack-top-frame"):I,p?k(d(e)):re)},oe.jsxs=function(e,a,m){var p=1e4>K.recentlyCreatedOwnerStacks++;return P(e,a,m,!0,p?Error("react-stack-top-frame"):I,p?k(d(e)):re)}})()),oe}var ve;function $e(){return ve||(ve=1,process.env.NODE_ENV==="production"?ie.exports=Ve():ie.exports=Ye()),ie.exports}var s=$e();const Ce=({isVisible:o,position:u,availableFields:f,filteredFields:d,filterQuery:r,allowCreate:l,onSelect:F,onClose:D,onCreateField:z})=>{const[H,P]=i.useState(!1),[N,C]=i.useState("");i.useEffect(()=>{o||(P(!1),C(""))},[o]);const Y=i.useMemo(()=>({position:"absolute",left:u?.left,top:u?.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"}),[u]),L=d??f,q=!!r,O=i.useMemo(()=>{const c=[],b=new Map;return L.forEach(E=>{const T=E.category?.trim()||"Uncategorized",j=b.get(T);if(j!==void 0){c[j].fields.push(E);return}b.set(T,c.length),c.push({category:T,fields:[E]})}),c},[L]),[Z,v]=i.useState({});i.useEffect(()=>{v(c=>{if(O.length===0)return Object.keys(c).length===0?c:{};const b={};let E=Object.keys(c).length!==O.length;return O.forEach(({category:T},j)=>{const W=q?!0:c[T]??j===0;b[T]=W,!E&&c[T]!==W&&(E=!0)}),E?b:c})},[O,q]);const $=i.useCallback(c=>{v(b=>({...b,[c]:!b[c]}))},[]);if(!o)return null;const A=async()=>{const c=N.trim();if(!c)return;const b={id:`custom_${Date.now()}`,label:c,category:"Custom"};try{if(z){const E=await z(b);F(E||b)}else F(b)}finally{P(!1),C("")}};return s.jsxs("div",{className:"superdoc-field-menu",style:Y,children:[q&&s.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:s.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",s.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:r})]})}),l&&!H&&s.jsx("div",{className:"field-menu-item",onClick:()=>P(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),l&&H&&s.jsxs("div",{style:{padding:"8px 16px"},children:[s.jsx("input",{type:"text",value:N,placeholder:"Field name...",onChange:c=>C(c.target.value),onKeyDown:c=>{c.key==="Enter"&&A(),c.key==="Escape"&&(P(!1),C(""))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),s.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[s.jsx("button",{onClick:A,disabled:!N.trim(),style:{padding:"4px 12px",background:N.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:N.trim()?"pointer":"not-allowed"},children:"Create"}),s.jsx("button",{onClick:()=>{P(!1),C("")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),l&&f.length>0&&s.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),O.length===0?s.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):O.map(({category:c,fields:b},E)=>{const T=!!Z[c],j=`${Math.max(b.length*40,0)}px`;return s.jsxs("div",{style:{borderTop:E===0&&l?void 0:"1px solid #f0f0f0"},children:[s.jsxs("button",{type:"button",onClick:()=>$(c),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[s.jsxs("span",{children:[c," (",b.length,")"]}),s.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:T?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),s.jsx("div",{"data-category":c,"aria-hidden":!T,style:{overflow:"hidden",maxHeight:T?j:"0px",opacity:T?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:T?"auto":"none"},children:s.jsx("div",{style:{padding:T?"4px 0":0},children:b.map(W=>s.jsx("div",{className:"field-menu-item",onClick:()=>F(W),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:s.jsx("span",{style:{fontWeight:500},children:W.label})},W.id))})})]},c)}),s.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:s.jsx("button",{onClick:D,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},Te=({fields:o,onSelect:u,onDelete:f,selectedFieldId:d})=>s.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[s.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",o.length,")"]}),o.length===0?s.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(r=>s.jsxs("div",{onClick:()=>u(r),style:{position:"relative",padding:"12px",background:d===r.id?"#eff6ff":"#f9fafb",border:d===r.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:l=>{d!==r.id&&(l.currentTarget.style.background="#f3f4f6")},onMouseLeave:l=>{d!==r.id&&(l.currentTarget.style.background="#f9fafb")},title:r.alias,children:[s.jsx("button",{onClick:l=>{l.stopPropagation(),f(r.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:l=>{l.currentTarget.style.color="#ef4444"},onMouseLeave:l=>{l.currentTarget.style.color="#9ca3af"},title:"Delete field",children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.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"})})}),s.jsxs("div",{style:{paddingRight:"24px"},children:[s.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:r.alias&&r.alias!==r.id?"4px":"0"},children:r.id}),r.alias&&r.alias!==r.id&&s.jsx("div",{style:{fontSize:"12px",color:"#4b5563"},children:r.alias})]})]},r.id))})]}),fe=o=>{const u=o.helpers?.structuredContentCommands;return u?.getStructuredContentTags?(u.getStructuredContentTags(o.state)||[]).map(d=>{const l=(d?.node??d)?.attrs??{};return{id:l.id,alias:l.alias||l.label||"",tag:l.tag}}):[]},Ee=(o,u)=>{if(o===u)return!0;if(o.length!==u.length)return!1;for(let f=0;f<o.length;f+=1){const d=o[f],r=u[f];if(!r||d.id!==r.id||d.alias!==r.alias||d.tag!==r.tag||d.position!==r.position)return!1}return!0},Ue=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:u,...f}=o;return{selector:u||"#superdoc-toolbar",config:f,renderDefaultContainer:u===void 0}},le=10,ze=250,He=300,Re=o=>{const u=window.innerWidth-ze-le,f=window.innerHeight-He-le,d=Math.min(o.left,u),r=Math.min(o.top,f);return new DOMRect(Math.max(d,le),Math.max(r,le),o.width,o.height)},ke=i.forwardRef((o,u)=>{const{document:f,fields:d={},menu:r={},list:l={},toolbar:F,onReady:D,onTrigger:z,onFieldInsert:H,onFieldUpdate:P,onFieldDelete:N,onFieldsChange:C,onFieldSelect:Y,onFieldCreate:L,className:q,style:O,documentHeight:Z="600px"}=o,[v,$]=i.useState(d.initial||[]),[A,c]=i.useState(null),[b,E]=i.useState(!1),[T,j]=i.useState(),[W,ce]=i.useState(""),[K,se]=i.useState(()=>d.available||[]),ee=i.useRef(null),k=i.useRef(null),M=i.useRef(null),te=i.useRef(d);te.current=d;const I=i.useRef(null),re=i.useRef(b);i.useEffect(()=>{re.current=b},[b]);const G=r.trigger||"{{",e=te.current.available||[],a=i.useCallback(t=>{const n=t.trim().toLowerCase();return n?e.filter(y=>{const R=y.label.toLowerCase(),S=y.category?.toLowerCase()||"";return R.includes(n)||S.includes(n)}):e},[e]),m=i.useCallback(t=>{ce(t),se(a(t))},[a]),p=i.useCallback(()=>{m("")},[m]),B=i.useCallback((t,n)=>{if(!k.current?.activeEditor)return!1;const y=k.current.activeEditor,R=v,S=t==="inline"?y.commands.insertStructuredContentInline?.({attrs:{alias:n.alias,tag:n.metadata?JSON.stringify(n.metadata):n.category},text:n.defaultValue||n.alias}):y.commands.insertStructuredContentBlock?.({attrs:{alias:n.alias,tag:n.metadata?JSON.stringify(n.metadata):n.category},text:n.defaultValue||n.alias});if(S){const w=fe(y);$(w),C?.(w);const x=w.find(g=>!R.some(U=>U.id===g.id));x&&H?.(x)}return S},[H,C,v]),J=i.useCallback((t,n)=>{if(!k.current?.activeEditor)return!1;const R=k.current.activeEditor.commands.updateStructuredContentById?.(t,{attrs:n});return R&&$(S=>{const w=S.map(g=>g.id===t?{...g,...n}:g);C?.(w);const x=w.find(g=>g.id===t);return x&&P?.(x),w}),R},[P,C]),h=i.useCallback(t=>{const n=k.current?.activeEditor;if(!n){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let x=!1;return $(g=>{if(!g.some(V=>V.id===t))return g;const U=g.filter(V=>V.id!==t);return x=!0,C?.(U),U}),x&&(N?.(t),c(g=>g===t?null:g)),x}let y=!1;try{y=n.commands.deleteStructuredContentById?.(t)??!1}catch(x){console.error("[SuperDocTemplateBuilder] Delete command failed:",x)}let R=fe(n);const S=R.some(x=>x.id===t);!y&&S&&(R=R.filter(x=>x.id!==t));let w=!1;return $(x=>{if(Ee(x,R))return x;const g=x.some(V=>V.id===t),U=R.some(V=>V.id===t);return g&&!U&&(w=!0),C?.(R),R}),w&&(N?.(t),c(x=>x===t?null:x)),y||w},[N,C]),_=i.useCallback(t=>{if(!k.current?.activeEditor)return;k.current.activeEditor.commands.selectStructuredContentById?.(t),c(t);const y=v.find(R=>R.id===t);y&&Y?.(y)},[v,Y]),X=i.useCallback(t=>{if(!t)return;const n=fe(t);$(y=>Ee(y,n)?y:(C?.(n),n))},[C]);i.useEffect(()=>ee.current?((async()=>{const{SuperDoc:n}=await import("superdoc"),y={selector:ee.current,document:f?.source,documentMode:f?.mode||"editing",onReady:()=>{if(R.activeEditor){const S=R.activeEditor;S.on("update",({editor:w})=>{const{state:x}=w,{from:g}=x.selection;if(g>=G.length){const de=g-G.length;if(x.doc.textBetween(de,g)===G){const me=w.view.coordsAtPos(g),xe=Re(new DOMRect(me.left,me.top,0,0)),ge=()=>{const ae=k.current?.activeEditor;if(!ae)return;const Oe=ae.state.selection.from,Pe=ae.state.tr.delete(de,Oe);ae.view.dispatch(Pe)};M.current=ge,I.current=g,j(xe),E(!0),p(),z?.({position:{from:de,to:g},bounds:xe,cleanup:ge});return}}if(!re.current)return;if(I.current==null){E(!1),p();return}if(g<I.current){E(!1),I.current=null,p();return}const U=x.doc.textBetween(I.current,g);m(U);const V=w.view.coordsAtPos(g),Ne=Re(new DOMRect(V.left,V.top,0,0));j(Ne)}),S.on("update",()=>{X(S)}),X(S)}D?.()}},R=new n({...y,...Q&&{toolbar:Q.selector,modules:{toolbar:{selector:Q.selector,toolbarGroups:Q.config.toolbarGroups||["center"],excludeItems:Q.config.excludeItems||[],...Q.config}}}});k.current=R})(),()=>{M.current=null,I.current=null;const n=k.current;n&&typeof n.destroy=="function"&&n.destroy(),k.current=null}):void 0,[f?.source,f?.mode,G,X,D,z,F]);const ue=i.useCallback(async t=>{if(M.current&&(M.current(),M.current=null),I.current=null,p(),t.id.startsWith("custom_")&&L)try{const n=await L(t);if(n){B("inline",{alias:n.label,category:n.category,metadata:n.metadata,defaultValue:n.defaultValue}),E(!1);return}}catch(n){console.error("Field creation failed:",n)}B("inline",{alias:t.label,category:t.category,metadata:t.metadata,defaultValue:t.defaultValue}),E(!1)},[B,L,p]),we=i.useCallback(()=>{E(!1),I.current=null,p(),M.current&&(M.current(),M.current=null)},[p]),_e=i.useCallback(()=>{if(!k.current?.activeEditor||v.length===0)return;const t=v.findIndex(y=>y.id===A),n=t>=0?(t+1)%v.length:0;_(v[n].id)},[v,A,_]),je=i.useCallback(()=>{if(!k.current?.activeEditor||v.length===0)return;const t=v.findIndex(y=>y.id===A),n=t>0?t-1:v.length-1;_(v[n].id)},[v,A,_]),Se=i.useCallback(async t=>{try{await k.current?.export({exportType:["docx"],exportedName:t?.fileName?t?.fileName:"document"})}catch(n){throw console.error("Failed to export DOCX",n),n}},[]);i.useImperativeHandle(u,()=>({insertField:t=>B("inline",t),insertBlockField:t=>B("block",t),updateField:J,deleteField:h,selectField:_,nextField:_e,previousField:je,getFields:()=>v,exportTemplate:Se}));const Fe=r.component||Ce,pe=l.component||Te,Q=Ue(F);return s.jsxs("div",{className:`superdoc-template-builder ${q||""}`,style:O,children:[s.jsxs("div",{style:{display:"flex",gap:"20px"},children:[l.position==="left"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(pe,{fields:v,onSelect:t=>_(t.id),onDelete:h,onUpdate:t=>J(t.id,t),selectedFieldId:A||void 0})}),s.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[Q?.renderDefaultContainer&&s.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),s.jsx("div",{ref:ee,className:"superdoc-template-builder-editor",style:{height:Z},"data-testid":"template-builder-editor"})]}),l.position==="right"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(pe,{fields:v,onSelect:t=>_(t.id),onDelete:h,onUpdate:t=>J(t.id,t),selectedFieldId:A||void 0})})]}),s.jsx(Fe,{isVisible:b,position:T,availableFields:d.available||[],filteredFields:K,filterQuery:W,allowCreate:d.allowCreate||!1,onSelect:ue,onClose:we,onCreateField:L})]})});ke.displayName="SuperDocTemplateBuilder";exports.FieldList=Te;exports.FieldMenu=Ce;exports.default=ke;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import Ae, { useState as z, useEffect as ue, useMemo as ve, useCallback as C, forwardRef as Me, useRef as Z, useImperativeHandle as Ie } from "react";
1
+ import Ae, { useState as U, useEffect as ue, useMemo as ve, useCallback as C, forwardRef as Me, useRef as K, useImperativeHandle as Ie } from "react";
2
2
  var ce = { exports: {} }, se = {};
3
3
  /**
4
4
  * @license React
@@ -54,7 +54,7 @@ function Le() {
54
54
  return "Fragment";
55
55
  case y:
56
56
  return "Profiler";
57
- case K:
57
+ case ee:
58
58
  return "StrictMode";
59
59
  case g:
60
60
  return "Suspense";
@@ -119,7 +119,7 @@ function Le() {
119
119
  }
120
120
  }
121
121
  function n() {
122
- var e = ee.A;
122
+ var e = te.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
125
  function i() {
@@ -144,13 +144,13 @@ function Le() {
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function U() {
147
+ function H() {
148
148
  var e = a(this.type);
149
- return re[e] || (re[e] = !0, console.error(
149
+ return ne[e] || (ne[e] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function G(e, s, u, d, B, oe) {
153
+ function G(e, s, u, d, B, X) {
154
154
  var h = u.ref;
155
155
  return e = {
156
156
  $$typeof: L,
@@ -160,7 +160,7 @@ function Le() {
160
160
  _owner: d
161
161
  }, (h !== void 0 ? h : null) !== null ? Object.defineProperty(e, "ref", {
162
162
  enumerable: !1,
163
- get: U
163
+ get: H
164
164
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
@@ -180,14 +180,14 @@ function Le() {
180
180
  configurable: !1,
181
181
  enumerable: !1,
182
182
  writable: !0,
183
- value: oe
183
+ value: X
184
184
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
185
  }
186
- function P(e, s, u, d, B, oe) {
186
+ function P(e, s, u, d, B, X) {
187
187
  var h = s.children;
188
188
  if (h !== void 0)
189
189
  if (d)
190
- if (te(h)) {
190
+ if (re(h)) {
191
191
  for (d = 0; d < h.length; d++)
192
192
  N(h[d]);
193
193
  Object.freeze && Object.freeze(h);
@@ -216,8 +216,8 @@ React keys must be passed directly to JSX without using spread:
216
216
  }
217
217
  if (h = null, u !== void 0 && (m(u), h = "" + u), F(s) && (m(s.key), h = "" + s.key), "key" in s) {
218
218
  u = {};
219
- for (var X in s)
220
- X !== "key" && (u[X] = s[X]);
219
+ for (var Q in s)
220
+ Q !== "key" && (u[Q] = s[Q]);
221
221
  } else u = s;
222
222
  return h && D(
223
223
  u,
@@ -228,7 +228,7 @@ React keys must be passed directly to JSX without using spread:
228
228
  u,
229
229
  n(),
230
230
  B,
231
- oe
231
+ X
232
232
  );
233
233
  }
234
234
  function N(e) {
@@ -237,7 +237,7 @@ React keys must be passed directly to JSX without using spread:
237
237
  function R(e) {
238
238
  return typeof e == "object" && e !== null && e.$$typeof === L;
239
239
  }
240
- var Y = Ae, L = Symbol.for("react.transitional.element"), J = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), K = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), A = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), W = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), ee = Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ie = Object.prototype.hasOwnProperty, te = Array.isArray, w = console.createTask ? console.createTask : function() {
240
+ var Y = Ae, L = Symbol.for("react.transitional.element"), J = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), ee = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), A = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), W = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), te = Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ie = Object.prototype.hasOwnProperty, re = Array.isArray, w = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  Y = {
@@ -245,29 +245,29 @@ React keys must be passed directly to JSX without using spread:
245
245
  return e();
246
246
  }
247
247
  };
248
- var M, re = {}, I = Y.react_stack_bottom_frame.bind(
248
+ var M, ne = {}, I = Y.react_stack_bottom_frame.bind(
249
249
  Y,
250
250
  i
251
- )(), ne = w(c(i)), q = {};
251
+ )(), oe = w(c(i)), q = {};
252
252
  ae.Fragment = O, ae.jsx = function(e, s, u) {
253
- var d = 1e4 > ee.recentlyCreatedOwnerStacks++;
253
+ var d = 1e4 > te.recentlyCreatedOwnerStacks++;
254
254
  return P(
255
255
  e,
256
256
  s,
257
257
  u,
258
258
  !1,
259
259
  d ? Error("react-stack-top-frame") : I,
260
- d ? w(c(e)) : ne
260
+ d ? w(c(e)) : oe
261
261
  );
262
262
  }, ae.jsxs = function(e, s, u) {
263
- var d = 1e4 > ee.recentlyCreatedOwnerStacks++;
263
+ var d = 1e4 > te.recentlyCreatedOwnerStacks++;
264
264
  return P(
265
265
  e,
266
266
  s,
267
267
  u,
268
268
  !0,
269
269
  d ? Error("react-stack-top-frame") : I,
270
- d ? w(c(e)) : ne
270
+ d ? w(c(e)) : oe
271
271
  );
272
272
  };
273
273
  })()), ae;
@@ -286,9 +286,9 @@ const Be = ({
286
286
  allowCreate: i,
287
287
  onSelect: F,
288
288
  onClose: D,
289
- onCreateField: U
289
+ onCreateField: H
290
290
  }) => {
291
- const [G, P] = z(!1), [N, R] = z("");
291
+ const [G, P] = U(!1), [N, R] = U("");
292
292
  ue(() => {
293
293
  a || (P(!1), R(""));
294
294
  }, [a]);
@@ -313,7 +313,7 @@ const Be = ({
313
313
  }
314
314
  g.set(T, l.length), l.push({ category: T, fields: [v] });
315
315
  }), l;
316
- }, [L]), [K, y] = z({});
316
+ }, [L]), [ee, y] = U({});
317
317
  ue(() => {
318
318
  y((l) => {
319
319
  if (O.length === 0)
@@ -342,8 +342,8 @@ const Be = ({
342
342
  category: "Custom"
343
343
  };
344
344
  try {
345
- if (U) {
346
- const v = await U(g);
345
+ if (H) {
346
+ const v = await H(g);
347
347
  F(v || g);
348
348
  } else
349
349
  F(g);
@@ -472,7 +472,7 @@ const Be = ({
472
472
  children: "No matching fields"
473
473
  }
474
474
  ) : O.map(({ category: l, fields: g }, v) => {
475
- const T = !!K[l], k = `${Math.max(g.length * 40, 0)}px`;
475
+ const T = !!ee[l], k = `${Math.max(g.length * 40, 0)}px`;
476
476
  return /* @__PURE__ */ o.jsxs(
477
477
  "div",
478
478
  {
@@ -758,15 +758,15 @@ const Be = ({
758
758
  config: m,
759
759
  renderDefaultContainer: x === void 0
760
760
  };
761
- }, de = 10, $e = 250, ze = 300, _e = (a) => {
762
- const x = window.innerWidth - $e - de, m = window.innerHeight - ze - de, c = Math.min(a.left, x), n = Math.min(a.top, m);
761
+ }, de = 10, $e = 250, Ue = 300, _e = (a) => {
762
+ const x = window.innerWidth - $e - de, m = window.innerHeight - Ue - de, c = Math.min(a.left, x), n = Math.min(a.top, m);
763
763
  return new DOMRect(
764
764
  Math.max(c, de),
765
765
  Math.max(n, de),
766
766
  a.width,
767
767
  a.height
768
768
  );
769
- }, He = Me((a, x) => {
769
+ }, ze = Me((a, x) => {
770
770
  const {
771
771
  document: m,
772
772
  fields: c = {},
@@ -774,7 +774,7 @@ const Be = ({
774
774
  list: i = {},
775
775
  toolbar: F,
776
776
  onReady: D,
777
- onTrigger: U,
777
+ onTrigger: H,
778
778
  onFieldInsert: G,
779
779
  onFieldUpdate: P,
780
780
  onFieldDelete: N,
@@ -783,18 +783,16 @@ const Be = ({
783
783
  onFieldCreate: L,
784
784
  className: J,
785
785
  style: O,
786
- documentHeight: K = "600px"
787
- } = a, [y, $] = z(
786
+ documentHeight: ee = "600px"
787
+ } = a, [y, $] = U(
788
788
  c.initial || []
789
- ), [A, l] = z(
790
- null
791
- ), [g, v] = z(!1), [T, k] = z(), [W, fe] = z(""), [ee, ie] = z(() => c.available || []), te = Z(null), w = Z(null), M = Z(null), re = Z(c);
792
- re.current = c;
793
- const I = Z(null), ne = Z(g);
789
+ ), [A, l] = U(null), [g, v] = U(!1), [T, k] = U(), [W, fe] = U(""), [te, ie] = U(() => c.available || []), re = K(null), w = K(null), M = K(null), ne = K(c);
790
+ ne.current = c;
791
+ const I = K(null), oe = K(g);
794
792
  ue(() => {
795
- ne.current = g;
793
+ oe.current = g;
796
794
  }, [g]);
797
- const q = n.trigger || "{{", e = re.current.available || [], s = C(
795
+ const q = n.trigger || "{{", e = ne.current.available || [], s = C(
798
796
  (t) => {
799
797
  const r = t.trim().toLowerCase();
800
798
  return r ? e.filter((b) => {
@@ -830,14 +828,14 @@ const Be = ({
830
828
  const _ = xe(b);
831
829
  $(_), R?.(_);
832
830
  const f = _.find(
833
- (p) => !E.some((H) => H.id === p.id)
831
+ (p) => !E.some((z) => z.id === p.id)
834
832
  );
835
833
  f && G?.(f);
836
834
  }
837
835
  return S;
838
836
  },
839
837
  [G, R, y]
840
- ), oe = C(
838
+ ), X = C(
841
839
  (t, r) => {
842
840
  if (!w.current?.activeEditor) return !1;
843
841
  const E = w.current.activeEditor.commands.updateStructuredContentById?.(t, {
@@ -863,8 +861,8 @@ const Be = ({
863
861
  let f = !1;
864
862
  return $((p) => {
865
863
  if (!p.some((V) => V.id === t)) return p;
866
- const H = p.filter((V) => V.id !== t);
867
- return f = !0, R?.(H), H;
864
+ const z = p.filter((V) => V.id !== t);
865
+ return f = !0, R?.(z), z;
868
866
  }), f && (N?.(t), l((p) => p === t ? null : p)), f;
869
867
  }
870
868
  let b = !1;
@@ -883,8 +881,8 @@ const Be = ({
883
881
  return $((f) => {
884
882
  if (we(f, E))
885
883
  return f;
886
- const p = f.some((V) => V.id === t), H = E.some((V) => V.id === t);
887
- return p && !H && (_ = !0), R?.(E), E;
884
+ const p = f.some((V) => V.id === t), z = E.some((V) => V.id === t);
885
+ return p && !z && (_ = !0), R?.(E), E;
888
886
  }), _ && (N?.(t), l((f) => f === t ? null : f)), b || _;
889
887
  },
890
888
  [N, R]
@@ -896,7 +894,7 @@ const Be = ({
896
894
  b && Y?.(b);
897
895
  },
898
896
  [y, Y]
899
- ), X = C(
897
+ ), Q = C(
900
898
  (t) => {
901
899
  if (!t) return;
902
900
  const r = xe(t);
@@ -904,9 +902,9 @@ const Be = ({
904
902
  },
905
903
  [R]
906
904
  );
907
- ue(() => te.current ? ((async () => {
905
+ ue(() => re.current ? ((async () => {
908
906
  const { SuperDoc: r } = await import("superdoc"), b = {
909
- selector: te.current,
907
+ selector: re.current,
910
908
  document: m?.source,
911
909
  documentMode: m?.mode || "editing",
912
910
  onReady: () => {
@@ -925,7 +923,7 @@ const Be = ({
925
923
  const Oe = le.state.selection.from, Pe = le.state.tr.delete(me, Oe);
926
924
  le.view.dispatch(Pe);
927
925
  };
928
- M.current = ye, I.current = p, k(be), v(!0), d(), U?.({
926
+ M.current = ye, I.current = p, k(be), v(!0), d(), H?.({
929
927
  position: { from: me, to: p },
930
928
  bounds: be,
931
929
  cleanup: ye
@@ -933,7 +931,7 @@ const Be = ({
933
931
  return;
934
932
  }
935
933
  }
936
- if (!ne.current)
934
+ if (!oe.current)
937
935
  return;
938
936
  if (I.current == null) {
939
937
  v(!1), d();
@@ -943,31 +941,31 @@ const Be = ({
943
941
  v(!1), I.current = null, d();
944
942
  return;
945
943
  }
946
- const H = f.doc.textBetween(
944
+ const z = f.doc.textBetween(
947
945
  I.current,
948
946
  p
949
947
  );
950
- u(H);
948
+ u(z);
951
949
  const V = _.view.coordsAtPos(p), Ne = _e(
952
950
  new DOMRect(V.left, V.top, 0, 0)
953
951
  );
954
952
  k(Ne);
955
953
  }), S.on("update", () => {
956
- X(S);
957
- }), X(S);
954
+ Q(S);
955
+ }), Q(S);
958
956
  }
959
957
  D?.();
960
958
  }
961
959
  }, E = new r({
962
960
  ...b,
963
- ...Q && {
964
- toolbar: Q.selector,
961
+ ...Z && {
962
+ toolbar: Z.selector,
965
963
  modules: {
966
964
  toolbar: {
967
- selector: Q.selector,
968
- toolbarGroups: Q.config.toolbarGroups || ["center"],
969
- excludeItems: Q.config.excludeItems || [],
970
- ...Q.config
965
+ selector: Z.selector,
966
+ toolbarGroups: Z.config.toolbarGroups || ["center"],
967
+ excludeItems: Z.config.excludeItems || [],
968
+ ...Z.config
971
969
  }
972
970
  }
973
971
  }
@@ -981,9 +979,9 @@ const Be = ({
981
979
  m?.source,
982
980
  m?.mode,
983
981
  q,
984
- X,
982
+ Q,
985
983
  D,
986
- U,
984
+ H,
987
985
  F
988
986
  ]);
989
987
  const pe = C(
@@ -1043,7 +1041,7 @@ const Be = ({
1043
1041
  Ie(x, () => ({
1044
1042
  insertField: (t) => B("inline", t),
1045
1043
  insertBlockField: (t) => B("block", t),
1046
- updateField: oe,
1044
+ updateField: X,
1047
1045
  deleteField: h,
1048
1046
  selectField: j,
1049
1047
  nextField: Ce,
@@ -1051,7 +1049,7 @@ const Be = ({
1051
1049
  getFields: () => y,
1052
1050
  exportTemplate: Se
1053
1051
  }));
1054
- const Fe = n.component || Be, ge = i.component || Ve, Q = Ye(F);
1052
+ const Fe = n.component || Be, ge = i.component || Ve, Z = Ye(F);
1055
1053
  return /* @__PURE__ */ o.jsxs(
1056
1054
  "div",
1057
1055
  {
@@ -1065,11 +1063,12 @@ const Be = ({
1065
1063
  fields: y,
1066
1064
  onSelect: (t) => j(t.id),
1067
1065
  onDelete: h,
1066
+ onUpdate: (t) => X(t.id, t),
1068
1067
  selectedFieldId: A || void 0
1069
1068
  }
1070
1069
  ) }),
1071
1070
  /* @__PURE__ */ o.jsxs("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
1072
- Q?.renderDefaultContainer && /* @__PURE__ */ o.jsx(
1071
+ Z?.renderDefaultContainer && /* @__PURE__ */ o.jsx(
1073
1072
  "div",
1074
1073
  {
1075
1074
  id: "superdoc-toolbar",
@@ -1080,9 +1079,9 @@ const Be = ({
1080
1079
  /* @__PURE__ */ o.jsx(
1081
1080
  "div",
1082
1081
  {
1083
- ref: te,
1082
+ ref: re,
1084
1083
  className: "superdoc-template-builder-editor",
1085
- style: { height: K },
1084
+ style: { height: ee },
1086
1085
  "data-testid": "template-builder-editor"
1087
1086
  }
1088
1087
  )
@@ -1093,6 +1092,7 @@ const Be = ({
1093
1092
  fields: y,
1094
1093
  onSelect: (t) => j(t.id),
1095
1094
  onDelete: h,
1095
+ onUpdate: (t) => X(t.id, t),
1096
1096
  selectedFieldId: A || void 0
1097
1097
  }
1098
1098
  ) })
@@ -1103,7 +1103,7 @@ const Be = ({
1103
1103
  isVisible: g,
1104
1104
  position: T,
1105
1105
  availableFields: c.available || [],
1106
- filteredFields: ee,
1106
+ filteredFields: te,
1107
1107
  filterQuery: W,
1108
1108
  allowCreate: c.allowCreate || !1,
1109
1109
  onSelect: pe,
@@ -1115,9 +1115,9 @@ const Be = ({
1115
1115
  }
1116
1116
  );
1117
1117
  });
1118
- He.displayName = "SuperDocTemplateBuilder";
1118
+ ze.displayName = "SuperDocTemplateBuilder";
1119
1119
  export {
1120
1120
  Ve as FieldList,
1121
1121
  Be as FieldMenu,
1122
- He as default
1122
+ ze as default
1123
1123
  };
package/dist/types.d.ts CHANGED
@@ -34,6 +34,7 @@ export interface FieldListProps {
34
34
  fields: TemplateField[];
35
35
  onSelect: (field: TemplateField) => void;
36
36
  onDelete: (fieldId: string | number) => void;
37
+ onUpdate?: (field: TemplateField) => void;
37
38
  selectedFieldId?: string | number;
38
39
  }
39
40
  export interface DocumentConfig {
@@ -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;CACnB;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,IAA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version": "0.2.0-next.4",
4
4
  "description": "React template builder component for SuperDoc",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",