integration-modules 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var O=Object.create;var b=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var v=(r,o,d,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of _(o))!q.call(r,n)&&n!==d&&b(r,n,{get:()=>o[n],enumerable:!(p=J(o,n))||p.enumerable});return r};var C=(r,o,d)=>(d=r!=null?O(P(r)):{},v(o||!r||!r.__esModule?b(d,"default",{value:r,enumerable:!0}):d,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Board-BPjNyr3D.js"),u=require("./chunks/EmojiBoardWidget-DwyWXjjk.js"),g=require("./chunks/ShapeBoardWidget-ZKB_BDkq.js"),l=require("react"),h=({children:r})=>e.jsxRuntimeExports.jsx("div",{children:r}),z=({nodeTypes:r})=>{const o=e.useStickersStore(i=>i.setStickers),d=l.useRef(null),[p,n]=l.useState(()=>h),k={...u.emojiNodeTypes,...g.shapeNodeTypes,...r||{}};async function M(i){if(e.EMOJI_MAP&&e.EMOJI_MAP[i])return e.EMOJI_MAP[i];try{const t=await e.stickersApi.getById(i);if(t!=null&&t.name){const a=e.EMOJI_CATALOG.find(f=>f.name===t.name);if(a)return a.url}}catch(t){console.warn("getEmojiUrlForStickerId: backend lookup failed",t)}return""}l.useEffect(()=>{(async()=>{var t;try{const[a,f,A]=await Promise.all([e.stickersApi.getBoard(),e.shapesApi.getAll(),e.shapesApi.getBoard()]),R=new Map(f.map(s=>[String(s.id),s.shapeId]));let y=30,m=30,E=1;const I=[];for(const s of a){const x=s.width??e.EMOJI_W,j=s.height??e.EMOJI_H;let c=((t=e.EMOJI_MAP)==null?void 0:t[String(s.stickerId)])??"";c||(c=await M(s.stickerId)),I.push({id:s.id,x:y,y:m,color:"transparent",width:x,height:j,text:"",zIndex:E,stickerId:s.stickerId,imageUrl:c,type:"emoji"}),y+=24,m+=24,E+=1}let S=500,B=30,w=1e4;const W=[];for(const s of A){const x=s.width??140,j=s.height??140,c=s.rotation??0,N=R.get(String(s.shapeId))??"square";W.push({id:s.id,stickerId:s.id,type:"shape",shapeId:N,shapeDbId:s.shapeId,x:S,y:B,width:x,height:j,rotation:c,zIndex:w,fill:"transparent",stroke:"#000"}),S+=24,B+=24,w+=1}o([...I,...W])}catch(a){console.warn("Не удалось загрузить доску:",a)}})()},[o]),l.useEffect(()=>{let i=!0;return import("@xyflow/react").then(t=>{if(!i)return;const a=(t&&(t.Widget||t.default||(t==null?void 0:t.widget)||(t==null?void 0:t.XyflowWidget)))??null;typeof a=="function"||l.isValidElement(a)?n(()=>a):n(()=>h)}).catch(()=>{i&&n(()=>h)}),()=>{i=!1}},[]);const T=p||h;return e.jsxRuntimeExports.jsx(T,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-screen w-screen bg-gray-100",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx(u.EmojiToolbar,{}),e.jsxRuntimeExports.jsx(g.ShapeToolbar,{})]}),e.jsxRuntimeExports.jsx(e.Board,{ref:d,nodeTypes:k})]})})};exports.Board=e.Board;exports.EmojiBoardWidget=u.EmojiBoardWidget;exports.emojiNodeTypes=u.emojiNodeTypes;exports.ShapeBoardWidget=g.ShapeBoardWidget;exports.shapeNodeTypes=g.shapeNodeTypes;exports.CombinedBoardWidget=z;
1
+ "use strict";var O=Object.create;var b=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var v=(i,r,d,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of _(r))!q.call(i,n)&&n!==d&&b(i,n,{get:()=>r[n],enumerable:!(p=J(r,n))||p.enumerable});return i};var C=(i,r,d)=>(d=i!=null?O(P(i)):{},v(r||!i||!i.__esModule?b(d,"default",{value:i,enumerable:!0}):d,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Board-BPjNyr3D.js"),u=require("./chunks/EmojiBoardWidget-DwyWXjjk.js"),g=require("./chunks/ShapeBoardWidget-ZKB_BDkq.js"),l=require("react"),h=({children:i})=>e.jsxRuntimeExports.jsx("div",{children:i}),z=({nodeTypes:i})=>{const r=e.useStickersStore(o=>o.setStickers),d=l.useRef(null),[p,n]=l.useState(()=>h),k={...u.emojiNodeTypes,...g.shapeNodeTypes,...i||{}};async function M(o){if(e.EMOJI_MAP&&e.EMOJI_MAP[o])return e.EMOJI_MAP[o];try{const t=await e.stickersApi.getById(o);if(t!=null&&t.name){const a=e.EMOJI_CATALOG.find(f=>f.name===t.name);if(a)return a.url}}catch(t){console.warn("getEmojiUrlForStickerId: backend lookup failed",t)}return""}l.useEffect(()=>{(async()=>{var t;try{const[a,f,A]=await Promise.all([e.stickersApi.getBoard(),e.shapesApi.getAll(),e.shapesApi.getBoard()]),R=new Map(f.map(s=>[String(s.id),s.shapeId]));let y=30,m=30,E=1;const I=[];for(const s of a){const x=s.width??e.EMOJI_W,j=s.height??e.EMOJI_H;let c=((t=e.EMOJI_MAP)==null?void 0:t[String(s.stickerId)])??"";c||(c=await M(s.stickerId)),I.push({id:s.id,x:y,y:m,color:"transparent",width:x,height:j,text:"",zIndex:E,stickerId:s.stickerId,imageUrl:c,type:"emoji"}),y+=24,m+=24,E+=1}let S=500,B=30,w=1e4;const W=[];for(const s of A){const x=s.width??140,j=s.height??140,c=s.rotation??0,N=R.get(String(s.shapeId))??"square";W.push({id:s.id,stickerId:s.id,type:"shape",shapeId:N,shapeDbId:s.shapeId,x:S,y:B,width:x,height:j,rotation:c,zIndex:w,fill:"transparent",stroke:"#000"}),S+=24,B+=24,w+=1}r([...I,...W])}catch(a){console.warn("Не удалось загрузить доску:",a)}})()},[r]),l.useEffect(()=>{let o=!0;return import("@xyflow/react").then(t=>{if(!o)return;const a=(t&&(t.Widget||t.default||(t==null?void 0:t.widget)||(t==null?void 0:t.XyflowWidget)))??null;typeof a=="function"||l.isValidElement(a)?n(()=>a):n(()=>h)}).catch(()=>{o&&n(()=>h)}),()=>{o=!1}},[]);const T=p||h;return e.jsxRuntimeExports.jsx(T,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-screen w-screen bg-gray-100",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx(u.EmojiToolbar,{}),e.jsxRuntimeExports.jsx(g.ShapeToolbar,{})]}),e.jsxRuntimeExports.jsx(e.Board,{ref:d,nodeTypes:k})]})})};exports.EmojiBoardWidget=u.EmojiBoardWidget;exports.emojiNodeTypes=u.emojiNodeTypes;exports.ShapeBoardWidget=g.ShapeBoardWidget;exports.shapeNodeTypes=g.shapeNodeTypes;exports.CombinedBoardWidget=z;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.mjs CHANGED
@@ -101,7 +101,6 @@ const n = ({ children: c }) => /* @__PURE__ */ r.jsx("div", { children: c }), X
101
101
  ] }) });
102
102
  };
103
103
  export {
104
- v as Board,
105
104
  X as CombinedBoardWidget,
106
105
  Z as EmojiBoardWidget,
107
106
  ee as ShapeBoardWidget,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "integration-modules",
3
3
  "private": false,
4
- "version": "0.1.12",
4
+ "version": "0.1.13",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",