integration-modules 0.1.10 → 0.1.12
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 +16 -16
- package/dist/chunks/Board-BPjNyr3D.js +58 -0
- package/dist/chunks/Board-BPjNyr3D.js.map +1 -0
- package/dist/chunks/Board-LDrQezYP.js +19485 -0
- package/dist/chunks/Board-LDrQezYP.js.map +1 -0
- package/dist/chunks/{EmojiBoardWidget-Dk8VCGyk.js → EmojiBoardWidget-C9Nx3caB.js} +140 -134
- package/dist/chunks/EmojiBoardWidget-C9Nx3caB.js.map +1 -0
- package/dist/chunks/{EmojiBoardWidget-DpXXIo8W.js → EmojiBoardWidget-DwyWXjjk.js} +2 -2
- package/dist/chunks/EmojiBoardWidget-DwyWXjjk.js.map +1 -0
- package/dist/chunks/{ShapeBoardWidget-CURF-esc.js → ShapeBoardWidget-BFWxWu8h.js} +43 -42
- package/dist/chunks/ShapeBoardWidget-BFWxWu8h.js.map +1 -0
- package/dist/chunks/{ShapeBoardWidget-lQuZw7IG.js → ShapeBoardWidget-ZKB_BDkq.js} +2 -2
- package/dist/chunks/ShapeBoardWidget-ZKB_BDkq.js.map +1 -0
- package/dist/emoji/index.cjs +1 -1
- package/dist/emoji/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +55 -54
- package/dist/index.mjs.map +1 -1
- package/dist/integration-modules.css +1 -1
- package/dist/shape/index.cjs +1 -1
- package/dist/shape/index.js +1 -1
- package/package.json +78 -78
- package/dist/chunks/Board-C2sVqXKk.js +0 -19431
- package/dist/chunks/Board-C2sVqXKk.js.map +0 -1
- package/dist/chunks/Board-D7raFrnX.js +0 -38
- package/dist/chunks/Board-D7raFrnX.js.map +0 -1
- package/dist/chunks/EmojiBoardWidget-Dk8VCGyk.js.map +0 -1
- package/dist/chunks/EmojiBoardWidget-DpXXIo8W.js.map +0 -1
- package/dist/chunks/ShapeBoardWidget-CURF-esc.js.map +0 -1
- package/dist/chunks/ShapeBoardWidget-lQuZw7IG.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as e, S
|
|
2
|
-
import I, { useState as
|
|
1
|
+
import { j as e, S as B, e as y, D as N, u as C, B as A, a as w } from "./Board-LDrQezYP.js";
|
|
2
|
+
import I, { useState as b, useRef as f, useEffect as k } from "react";
|
|
3
3
|
const D = {
|
|
4
4
|
square: /* @__PURE__ */ e.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ e.jsx("rect", { x: "4", y: "4", width: "32", height: "32", stroke: "black", fill: "none", strokeWidth: "2" }) }),
|
|
5
5
|
circle: /* @__PURE__ */ e.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ e.jsx("circle", { cx: "20", cy: "20", r: "14", stroke: "black", fill: "none", strokeWidth: "2" }) }),
|
|
@@ -63,22 +63,22 @@ const D = {
|
|
|
63
63
|
/* @__PURE__ */ e.jsx("line", { x1: "14", y1: "28", x2: "36", y2: "28", stroke: "black", strokeWidth: "2" })
|
|
64
64
|
] })
|
|
65
65
|
}, E = "data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='black'%20stroke-width='3'/%3e%3c/svg%3e", H = "data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='%230000FF'%20stroke-width='3'/%3e%3c/svg%3e", P = () => {
|
|
66
|
-
const [
|
|
67
|
-
t.stopPropagation(), a((
|
|
66
|
+
const [i, a] = b(!1), n = f(null), x = (t) => {
|
|
67
|
+
t.stopPropagation(), a((r) => !r);
|
|
68
68
|
};
|
|
69
69
|
k(() => {
|
|
70
|
-
if (!
|
|
71
|
-
const t = (
|
|
72
|
-
n.current && !n.current.contains(
|
|
70
|
+
if (!i) return;
|
|
71
|
+
const t = (r) => {
|
|
72
|
+
n.current && !n.current.contains(r.target) && a(!1);
|
|
73
73
|
};
|
|
74
74
|
return window.addEventListener("pointerdown", t), () => window.removeEventListener("pointerdown", t);
|
|
75
|
-
}, [
|
|
76
|
-
const h = (t) => (
|
|
77
|
-
|
|
75
|
+
}, [i]);
|
|
76
|
+
const h = (t) => (r) => {
|
|
77
|
+
r.stopPropagation(), r.dataTransfer.setData(N, JSON.stringify({ shapeId: t.id })), r.dataTransfer.effectAllowed = "copy";
|
|
78
78
|
};
|
|
79
79
|
return /* @__PURE__ */ e.jsxs("div", { className: "left-toolbar-container dragHandle__custom", ref: n, onClick: (t) => t.stopPropagation(), children: [
|
|
80
|
-
/* @__PURE__ */ e.jsx("div", { className: `toolbar-card ${
|
|
81
|
-
|
|
80
|
+
/* @__PURE__ */ e.jsx("div", { className: `toolbar-card ${i ? "toolbar-card--open" : ""}`, children: /* @__PURE__ */ e.jsx("button", { onClick: x, className: `toolbar-btn toolbar-btn--icon toolbar-btn--shape ${i ? "toolbar-btn--active" : ""}`, children: /* @__PURE__ */ e.jsx("div", { className: `toolbar-shape-plate ${i ? "toolbar-shape-plate--active" : ""}`, children: /* @__PURE__ */ e.jsx("img", { src: i ? H : E, alt: "Фигуры", draggable: !1 }) }) }) }),
|
|
81
|
+
i && /* @__PURE__ */ e.jsx("div", { className: "palette-wrapper", onClick: (t) => t.stopPropagation(), children: /* @__PURE__ */ e.jsx("div", { className: "shape-panel", children: /* @__PURE__ */ e.jsx("div", { className: "shape-grid", children: B.map((t) => /* @__PURE__ */ e.jsx(
|
|
82
82
|
"button",
|
|
83
83
|
{
|
|
84
84
|
className: "shape-item",
|
|
@@ -88,62 +88,63 @@ const D = {
|
|
|
88
88
|
children: D[t.id]
|
|
89
89
|
},
|
|
90
90
|
t.id
|
|
91
|
-
)) }) }) })
|
|
91
|
+
)) }) }) }),
|
|
92
|
+
/* @__PURE__ */ e.jsx(y, { shapeOpen: i })
|
|
92
93
|
] });
|
|
93
94
|
}, R = {
|
|
94
|
-
shape:
|
|
95
|
-
},
|
|
96
|
-
const a = C((l) => l.setStickers), n =
|
|
95
|
+
shape: y
|
|
96
|
+
}, d = ({ children: i }) => /* @__PURE__ */ e.jsx("div", { children: i }), V = ({ nodeTypes: i }) => {
|
|
97
|
+
const a = C((l) => l.setStickers), n = f(null), [x, h] = b(() => d), t = {
|
|
97
98
|
...R,
|
|
98
|
-
...
|
|
99
|
+
...i || {}
|
|
99
100
|
};
|
|
100
101
|
k(() => {
|
|
101
102
|
(async () => {
|
|
102
103
|
try {
|
|
103
|
-
const [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
]),
|
|
104
|
+
const [s, c] = await Promise.all([
|
|
105
|
+
w.getAll(),
|
|
106
|
+
w.getBoard()
|
|
107
|
+
]), v = new Map(s.map((o) => [String(o.id), o.shapeId]));
|
|
107
108
|
let g = 30, p = 30;
|
|
108
|
-
const
|
|
109
|
-
for (const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
id:
|
|
113
|
-
stickerId:
|
|
109
|
+
const j = [];
|
|
110
|
+
for (const o of c) {
|
|
111
|
+
const W = o.width ?? 140, u = o.height ?? 140, S = o.rotation ?? 0, m = v.get(String(o.shapeId)) ?? "square";
|
|
112
|
+
j.push({
|
|
113
|
+
id: o.id,
|
|
114
|
+
stickerId: o.id,
|
|
114
115
|
type: "shape",
|
|
115
|
-
shapeId:
|
|
116
|
-
shapeDbId:
|
|
116
|
+
shapeId: m,
|
|
117
|
+
shapeDbId: o.shapeId,
|
|
117
118
|
x: g,
|
|
118
119
|
y: p,
|
|
119
|
-
width:
|
|
120
|
-
height:
|
|
121
|
-
rotation:
|
|
120
|
+
width: W,
|
|
121
|
+
height: u,
|
|
122
|
+
rotation: S,
|
|
122
123
|
zIndex: 1,
|
|
123
124
|
fill: "transparent",
|
|
124
125
|
stroke: "#000"
|
|
125
126
|
}), g += 24, p += 24;
|
|
126
127
|
}
|
|
127
|
-
a(
|
|
128
|
-
} catch (
|
|
129
|
-
console.warn("Не удалось загрузить доску для фигур:",
|
|
128
|
+
a(j);
|
|
129
|
+
} catch (s) {
|
|
130
|
+
console.warn("Не удалось загрузить доску для фигур:", s);
|
|
130
131
|
}
|
|
131
132
|
})();
|
|
132
133
|
}, [a]), k(() => {
|
|
133
134
|
let l = !0;
|
|
134
|
-
return import("@xyflow/react").then((
|
|
135
|
+
return import("@xyflow/react").then((s) => {
|
|
135
136
|
if (!l)
|
|
136
137
|
return;
|
|
137
|
-
const
|
|
138
|
-
typeof
|
|
138
|
+
const c = (s && (s.Widget || s.default || (s == null ? void 0 : s.widget) || (s == null ? void 0 : s.XyflowWidget))) ?? null;
|
|
139
|
+
typeof c == "function" || I.isValidElement(c) ? h(() => c) : h(() => d);
|
|
139
140
|
}).catch(() => {
|
|
140
|
-
l && h(() =>
|
|
141
|
+
l && h(() => d);
|
|
141
142
|
}), () => {
|
|
142
143
|
l = !1;
|
|
143
144
|
};
|
|
144
145
|
}, []);
|
|
145
|
-
const
|
|
146
|
-
return /* @__PURE__ */ e.jsx(
|
|
146
|
+
const r = x || d;
|
|
147
|
+
return /* @__PURE__ */ e.jsx(r, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-screen w-screen bg-gray-100", children: [
|
|
147
148
|
/* @__PURE__ */ e.jsx(P, {}),
|
|
148
149
|
/* @__PURE__ */ e.jsx(A, { ref: n, nodeTypes: t })
|
|
149
150
|
] }) });
|
|
@@ -153,4 +154,4 @@ export {
|
|
|
153
154
|
P as a,
|
|
154
155
|
R as s
|
|
155
156
|
};
|
|
156
|
-
//# sourceMappingURL=ShapeBoardWidget-
|
|
157
|
+
//# sourceMappingURL=ShapeBoardWidget-BFWxWu8h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeBoardWidget-BFWxWu8h.js","sources":["../../src/components/shapeIcons.jsx","../../src/assets/shape_add.svg","../../src/assets/shape_add_active.svg","../../src/components/ShapeToolbar.jsx","../../src/features/shape/public/shapeNodeTypes.js","../../src/widgets/ShapeBoardWidget.jsx"],"sourcesContent":["import React from \"react\";\r\n\r\nexport const SHAPE_ICONS = {\r\n square: (\r\n <svg width=\"40\" height=\"40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n circle: (\r\n <svg width=\"40\" height=\"40\">\r\n <circle cx=\"20\" cy=\"20\" r=\"14\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n triangle: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon points=\"20,6 34,34 6,34\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n star: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon\r\n points=\"20,4 25,16 38,16 27,24 32,36 20,28 8,36 13,24 2,16 15,16\"\r\n stroke=\"black\"\r\n fill=\"none\"\r\n strokeWidth=\"2\"\r\n />\r\n </svg>\r\n ),\r\n\r\n stick: (\r\n <svg width=\"40\" height=\"40\">\r\n <rect x=\"16\" y=\"4\" width=\"8\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n\r\n line: (\r\n <svg width=\"40\" height=\"40\">\r\n <line x1=\"4\" y1=\"20\" x2=\"36\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n\r\n arrow: (\r\n <svg width=\"40\" height=\"40\">\r\n <line x1=\"4\" y1=\"20\" x2=\"30\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"30,14 38,20 30,26\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n dblarrow: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon points=\"4,20 12,14 12,26\" fill=\"black\"/>\r\n <line x1=\"12\" y1=\"20\" x2=\"28\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"28,14 36,20 28,26\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n parallelogram: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"8,8 34,8 26,32 0,32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n roundedRect: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"6\" y=\"10\" width=\"28\" height=\"20\" rx=\"4\" ry=\"4\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n capsule: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"6\" y=\"14\" width=\"28\" height=\"12\" rx=\"6\" ry=\"6\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n pentagon: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"20,6 34,15 28,32 12,32 6,15\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n chevron: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 100 100\">\r\n <polyline\r\n points=\"0,0 50,100 100,0\"\r\n fill=\"none\"\r\n stroke=\"black\"\r\n strokeWidth=\"5\"\r\n />\r\n </svg>\r\n ),\r\n table3x3: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n\r\n <line x1=\"14\" y1=\"4\" x2=\"14\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"26\" y1=\"4\" x2=\"26\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n\r\n <line x1=\"4\" y1=\"14\" x2=\"36\" y2=\"14\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"4\" y1=\"26\" x2=\"36\" y2=\"26\" stroke=\"black\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n pyramid: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"20,4 36,36 4,36\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\" />\r\n <line x1=\"15\" y1=\"12\" x2=\"25\" y2=\"12\" stroke=\"black\" strokeWidth=\"2\" />\r\n <line x1=\"11\" y1=\"20\" x2=\"28\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\" />\r\n <line x1=\"7\" y1=\"28\" x2=\"32\" y2=\"28\" stroke=\"black\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n circleArrow: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <circle cx=\"20\" cy=\"20\" r=\"14\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n <line x1=\"20\" y1=\"6\" x2=\"20\" y2=\"0\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"18,2 22,2 20,0\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n table3x3LeftMerge: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"4\" x2=\"14\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"26\" y1=\"4\" x2=\"26\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"16\" x2=\"36\" y2=\"16\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"28\" x2=\"36\" y2=\"28\" stroke=\"black\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n};\r\n","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='black'%20stroke-width='3'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='%230000FF'%20stroke-width='3'/%3e%3c/svg%3e\"","\r\nimport React, { useState, useRef, useEffect } from 'react';\r\nimport { SHAPES } from '../features/shape/constants.jsx';\r\nimport { SHAPE_ICONS } from \"./shapeIcons.jsx\";\r\nimport { DND_SHAPE } from '../features/board/constants.js';\r\nimport shapeAdd from '../assets/shape_add.svg';\r\nimport shapeAddActive from '../assets/shape_add_active.svg';\r\nimport '../styles/stickerPalette.css';\r\nimport { ShapeNode } from '../features/shape/ui/ShapeNode.jsx';\r\n\r\nexport const ShapeToolbar = () => {\r\n const [shapeOpen, setShapeOpen] = useState(false);\r\n const wrapperRef = useRef(null);\r\n\r\n const toggleShape = (e) => {\r\n e.stopPropagation();\r\n setShapeOpen((v) => !v);\r\n };\r\n\r\n useEffect(() => {\r\n if (!shapeOpen) return;\r\n const handler = (e) => {\r\n if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {\r\n setShapeOpen(false);\r\n }\r\n };\r\n window.addEventListener('pointerdown', handler);\r\n return () => window.removeEventListener('pointerdown', handler);\r\n }, [shapeOpen]);\r\n\r\n const onShapeDragStart = (shape) => (e) => {\r\n e.stopPropagation();\r\n e.dataTransfer.setData(DND_SHAPE, JSON.stringify({ shapeId: shape.id }));\r\n e.dataTransfer.effectAllowed = 'copy';\r\n };\r\n\r\n return (\r\n <div className=\"left-toolbar-container dragHandle__custom\" ref={wrapperRef} onClick={(e) => e.stopPropagation()}>\r\n <div className={`toolbar-card ${shapeOpen ? 'toolbar-card--open' : ''}`}>\r\n <button onClick={toggleShape} className={`toolbar-btn toolbar-btn--icon toolbar-btn--shape ${shapeOpen ? 'toolbar-btn--active' : ''}`}>\r\n <div className={`toolbar-shape-plate ${shapeOpen ? 'toolbar-shape-plate--active' : ''}`}>\r\n <img src={shapeOpen ? shapeAddActive : shapeAdd} alt=\"Фигуры\" draggable={false} />\r\n </div>\r\n </button>\r\n </div>\r\n {shapeOpen && (\r\n <div className=\"palette-wrapper\" onClick={(e) => e.stopPropagation()}>\r\n <div className=\"shape-panel\">\r\n <div className=\"shape-grid\">\r\n {SHAPES.map((shape) => (\r\n <button\r\n key={shape.id}\r\n className=\"shape-item\"\r\n draggable\r\n onDragStart={onShapeDragStart(shape)}\r\n title={shape.name}\r\n >\r\n {SHAPE_ICONS[shape.id]}\r\n </button>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n <ShapeNode shapeOpen={shapeOpen} />\r\n </div>\r\n );\r\n};","import { ShapeNode } from '../ui/ShapeNode.jsx'\r\n\r\nexport const shapeNodeTypes = {\r\n shape: ShapeNode,\r\n}\r\n","import React, { useEffect, useRef, useState } from 'react'\r\nimport { ShapeToolbar } from '../components/ShapeToolbar.jsx'\r\nimport { Board } from '../features/board/ui/Board.jsx'\r\nimport { useStickersStore } from '../entities/stickers/model/useStickersStore.js'\r\nimport { shapesApi } from '../shared/api/shapesApi.js'\r\nimport { shapeNodeTypes } from '../features/shape/public/shapeNodeTypes.js'\r\n\r\nconst SafeFallbackWidget = ({ children }) => <div>{children}</div>\r\n\r\n/**\r\n * @typedef {import('@xyflow/react').NodeProps} NodeProps\r\n * @typedef {Record<string, React.ComponentType<NodeProps>>} NodeTypes\r\n */\r\n\r\n/**\r\n * @param {{ nodeTypes?: NodeTypes }} props\r\n */\r\nexport const ShapeBoardWidget = ({ nodeTypes }) => {\r\n const setStickers = useStickersStore((state) => state.setStickers)\r\n const boardRef = useRef(null)\r\n const [WidgetComp, setWidgetComp] = useState(() => SafeFallbackWidget)\r\n\r\n const mergedNodeTypes = {\r\n ...shapeNodeTypes,\r\n ...(nodeTypes || {}),\r\n }\r\n\r\n useEffect(() => {\r\n const loadBoard = async () => {\r\n try {\r\n const [allShapes, boardShapes] = await Promise.all([\r\n shapesApi.getAll(),\r\n shapesApi.getBoard(),\r\n ])\r\n\r\n const shapeKeyByDbId = new Map(allShapes.map((x) => [String(x.id), x.shapeId]))\r\n\r\n let x = 30\r\n let y = 30\r\n const items = []\r\n\r\n for (const s of boardShapes) {\r\n const w = s.width ?? 140\r\n const h = s.height ?? 140\r\n const r = s.rotation ?? 0\r\n\r\n const shapeKey = shapeKeyByDbId.get(String(s.shapeId)) ?? 'square'\r\n\r\n items.push({\r\n id: s.id,\r\n stickerId: s.id,\r\n type: 'shape',\r\n shapeId: shapeKey,\r\n shapeDbId: s.shapeId,\r\n x,\r\n y,\r\n width: w,\r\n height: h,\r\n rotation: r,\r\n zIndex: 1,\r\n fill: 'transparent',\r\n stroke: '#000',\r\n })\r\n\r\n x += 24\r\n y += 24\r\n }\r\n\r\n setStickers(items)\r\n } catch (e) {\r\n console.warn('Не удалось загрузить доску для фигур:', e)\r\n }\r\n }\r\n\r\n loadBoard()\r\n }, [setStickers])\r\n\r\n useEffect(() => {\r\n let mounted = true\r\n\r\n import('@xyflow/react')\r\n .then((mod) => {\r\n if (!mounted) {\r\n return\r\n }\r\n\r\n const candidate =\r\n (mod && (mod.Widget || mod.default || mod?.widget || mod?.XyflowWidget)) ?? null\r\n\r\n if (typeof candidate === 'function' || React.isValidElement(candidate)) {\r\n setWidgetComp(() => candidate)\r\n } else {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n .catch(() => {\r\n if (mounted) {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n\r\n return () => {\r\n mounted = false\r\n }\r\n }, [])\r\n\r\n const Wrapper = WidgetComp || SafeFallbackWidget\r\n\r\n return (\r\n <Wrapper>\r\n <div className=\"relative flex h-screen w-screen bg-gray-100\">\r\n <ShapeToolbar />\r\n <Board ref={boardRef} nodeTypes={mergedNodeTypes} />\r\n </div>\r\n </Wrapper>\r\n )\r\n}\r\n"],"names":["SHAPE_ICONS","jsx","jsxs","shapeAdd","shapeAddActive","ShapeToolbar","shapeOpen","setShapeOpen","useState","wrapperRef","useRef","toggleShape","e","v","useEffect","handler","onShapeDragStart","shape","DND_SHAPE","SHAPES","ShapeNode","shapeNodeTypes","SafeFallbackWidget","children","ShapeBoardWidget","nodeTypes","setStickers","useStickersStore","state","boardRef","WidgetComp","setWidgetComp","mergedNodeTypes","allShapes","boardShapes","shapesApi","shapeKeyByDbId","x","y","items","s","w","h","r","shapeKey","mounted","mod","candidate","React","Wrapper","Board"],"mappings":";;AAEO,MAAMA,IAAc;AAAA,EACvB,8BACK,OAAI,EAAA,OAAM,MAAK,QAAO,MACnB,UAACC,gBAAAA,EAAA,IAAA,QAAA,EAAK,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MAAK,QAAO,SAAQ,MAAK,QAAO,aAAY,IAAA,CAAG,EACvF,CAAA;AAAA,EAGJ,8BACK,OAAI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EAAA,IAAAgD,GAAA,EACG,UAAC/C,gBAAAA,EAAAA,KAAA,OAAA,EAAI,WAAU,+CACX,UAAA;AAAA,IAAAD,gBAAAA,EAAA,IAACI,GAAa,EAAA;AAAA,IACbJ,gBAAAA,EAAA,IAAAiD,GAAA,EAAM,KAAKrB,GAAU,WAAWG,GAAiB;AAAA,EAAA,EACtD,CAAA,EACJ,CAAA;AAER;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var v=Object.create;var u=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var C=(e,i,
|
|
2
|
-
//# sourceMappingURL=ShapeBoardWidget-
|
|
1
|
+
"use strict";var v=Object.create;var u=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var C=(e,i,r,h)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of S(i))!N.call(e,n)&&n!==r&&u(e,n,{get:()=>i[n],enumerable:!(h=W(i,n))||h.enumerable});return e};var A=(e,i,r)=>(r=e!=null?v(B(e)):{},C(i||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));const t=require("./Board-BPjNyr3D.js"),a=require("react"),I={square:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("rect",{x:"4",y:"4",width:"32",height:"32",stroke:"black",fill:"none",strokeWidth:"2"})}),circle:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("circle",{cx:"20",cy:"20",r:"14",stroke:"black",fill:"none",strokeWidth:"2"})}),triangle:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("polygon",{points:"20,6 34,34 6,34",stroke:"black",fill:"none",strokeWidth:"2"})}),star:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("polygon",{points:"20,4 25,16 38,16 27,24 32,36 20,28 8,36 13,24 2,16 15,16",stroke:"black",fill:"none",strokeWidth:"2"})}),stick:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("rect",{x:"16",y:"4",width:"8",height:"32",stroke:"black",fill:"none",strokeWidth:"2"})}),line:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",children:t.jsxRuntimeExports.jsx("line",{x1:"4",y1:"20",x2:"36",y2:"20",stroke:"black",strokeWidth:"2"})}),arrow:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",children:[t.jsxRuntimeExports.jsx("line",{x1:"4",y1:"20",x2:"30",y2:"20",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("polygon",{points:"30,14 38,20 30,26",fill:"black"})]}),dblarrow:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",children:[t.jsxRuntimeExports.jsx("polygon",{points:"4,20 12,14 12,26",fill:"black"}),t.jsxRuntimeExports.jsx("line",{x1:"12",y1:"20",x2:"28",y2:"20",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("polygon",{points:"28,14 36,20 28,26",fill:"black"})]}),parallelogram:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:t.jsxRuntimeExports.jsx("polygon",{points:"8,8 34,8 26,32 0,32",stroke:"black",fill:"none",strokeWidth:"2"})}),roundedRect:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:t.jsxRuntimeExports.jsx("rect",{x:"6",y:"10",width:"28",height:"20",rx:"4",ry:"4",stroke:"black",fill:"none",strokeWidth:"2"})}),capsule:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:t.jsxRuntimeExports.jsx("rect",{x:"6",y:"14",width:"28",height:"12",rx:"6",ry:"6",stroke:"black",fill:"none",strokeWidth:"2"})}),pentagon:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:t.jsxRuntimeExports.jsx("polygon",{points:"20,6 34,15 28,32 12,32 6,15",stroke:"black",fill:"none",strokeWidth:"2"})}),chevron:t.jsxRuntimeExports.jsx("svg",{width:"40",height:"40",viewBox:"0 0 100 100",children:t.jsxRuntimeExports.jsx("polyline",{points:"0,0 50,100 100,0",fill:"none",stroke:"black",strokeWidth:"5"})}),table3x3:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[t.jsxRuntimeExports.jsx("rect",{x:"4",y:"4",width:"32",height:"32",stroke:"black",fill:"none",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"14",y1:"4",x2:"14",y2:"36",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"26",y1:"4",x2:"26",y2:"36",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"4",y1:"14",x2:"36",y2:"14",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"4",y1:"26",x2:"36",y2:"26",stroke:"black",strokeWidth:"2"})]}),pyramid:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[t.jsxRuntimeExports.jsx("polygon",{points:"20,4 36,36 4,36",stroke:"black",fill:"none",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"15",y1:"12",x2:"25",y2:"12",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"11",y1:"20",x2:"28",y2:"20",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"7",y1:"28",x2:"32",y2:"28",stroke:"black",strokeWidth:"2"})]}),circleArrow:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[t.jsxRuntimeExports.jsx("circle",{cx:"20",cy:"20",r:"14",stroke:"black",fill:"none",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"20",y1:"6",x2:"20",y2:"0",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("polygon",{points:"18,2 22,2 20,0",fill:"black"})]}),table3x3LeftMerge:t.jsxRuntimeExports.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[t.jsxRuntimeExports.jsx("rect",{x:"4",y:"4",width:"32",height:"32",stroke:"black",fill:"none",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"14",y1:"4",x2:"14",y2:"36",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"26",y1:"4",x2:"26",y2:"36",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"14",y1:"16",x2:"36",y2:"16",stroke:"black",strokeWidth:"2"}),t.jsxRuntimeExports.jsx("line",{x1:"14",y1:"28",x2:"36",y2:"28",stroke:"black",strokeWidth:"2"})]})},H="data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='black'%20stroke-width='3'/%3e%3c/svg%3e",P="data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='%230000FF'%20stroke-width='3'/%3e%3c/svg%3e",m=()=>{const[e,i]=a.useState(!1),r=a.useRef(null),h=s=>{s.stopPropagation(),i(l=>!l)};a.useEffect(()=>{if(!e)return;const s=l=>{r.current&&!r.current.contains(l.target)&&i(!1)};return window.addEventListener("pointerdown",s),()=>window.removeEventListener("pointerdown",s)},[e]);const n=s=>l=>{l.stopPropagation(),l.dataTransfer.setData(t.DND_SHAPE,JSON.stringify({shapeId:s.id})),l.dataTransfer.effectAllowed="copy"};return t.jsxRuntimeExports.jsxs("div",{className:"left-toolbar-container dragHandle__custom",ref:r,onClick:s=>s.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:`toolbar-card ${e?"toolbar-card--open":""}`,children:t.jsxRuntimeExports.jsx("button",{onClick:h,className:`toolbar-btn toolbar-btn--icon toolbar-btn--shape ${e?"toolbar-btn--active":""}`,children:t.jsxRuntimeExports.jsx("div",{className:`toolbar-shape-plate ${e?"toolbar-shape-plate--active":""}`,children:t.jsxRuntimeExports.jsx("img",{src:e?P:H,alt:"Фигуры",draggable:!1})})})}),e&&t.jsxRuntimeExports.jsx("div",{className:"palette-wrapper",onClick:s=>s.stopPropagation(),children:t.jsxRuntimeExports.jsx("div",{className:"shape-panel",children:t.jsxRuntimeExports.jsx("div",{className:"shape-grid",children:t.SHAPES.map(s=>t.jsxRuntimeExports.jsx("button",{className:"shape-item",draggable:!0,onDragStart:n(s),title:s.name,children:I[s.id]},s.id))})})}),t.jsxRuntimeExports.jsx(t.ShapeNode,{shapeOpen:e})]})},E={shape:t.ShapeNode},d=({children:e})=>t.jsxRuntimeExports.jsx("div",{children:e}),T=({nodeTypes:e})=>{const i=t.useStickersStore(c=>c.setStickers),r=a.useRef(null),[h,n]=a.useState(()=>d),s={...E,...e||{}};a.useEffect(()=>{(async()=>{try{const[o,p]=await Promise.all([t.shapesApi.getAll(),t.shapesApi.getBoard()]),R=new Map(o.map(x=>[String(x.id),x.shapeId]));let j=30,k=30;const g=[];for(const x of p){const w=x.width??140,y=x.height??140,b=x.rotation??0,f=R.get(String(x.shapeId))??"square";g.push({id:x.id,stickerId:x.id,type:"shape",shapeId:f,shapeDbId:x.shapeId,x:j,y:k,width:w,height:y,rotation:b,zIndex:1,fill:"transparent",stroke:"#000"}),j+=24,k+=24}i(g)}catch(o){console.warn("Не удалось загрузить доску для фигур:",o)}})()},[i]),a.useEffect(()=>{let c=!0;return import("@xyflow/react").then(o=>{if(!c)return;const p=(o&&(o.Widget||o.default||(o==null?void 0:o.widget)||(o==null?void 0:o.XyflowWidget)))??null;typeof p=="function"||a.isValidElement(p)?n(()=>p):n(()=>d)}).catch(()=>{c&&n(()=>d)}),()=>{c=!1}},[]);const l=h||d;return t.jsxRuntimeExports.jsx(l,{children:t.jsxRuntimeExports.jsxs("div",{className:"relative flex h-screen w-screen bg-gray-100",children:[t.jsxRuntimeExports.jsx(m,{}),t.jsxRuntimeExports.jsx(t.Board,{ref:r,nodeTypes:s})]})})};exports.ShapeBoardWidget=T;exports.ShapeToolbar=m;exports.shapeNodeTypes=E;
|
|
2
|
+
//# sourceMappingURL=ShapeBoardWidget-ZKB_BDkq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeBoardWidget-ZKB_BDkq.js","sources":["../../src/components/shapeIcons.jsx","../../src/assets/shape_add.svg","../../src/assets/shape_add_active.svg","../../src/components/ShapeToolbar.jsx","../../src/features/shape/public/shapeNodeTypes.js","../../src/widgets/ShapeBoardWidget.jsx"],"sourcesContent":["import React from \"react\";\r\n\r\nexport const SHAPE_ICONS = {\r\n square: (\r\n <svg width=\"40\" height=\"40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n circle: (\r\n <svg width=\"40\" height=\"40\">\r\n <circle cx=\"20\" cy=\"20\" r=\"14\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n triangle: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon points=\"20,6 34,34 6,34\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n star: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon\r\n points=\"20,4 25,16 38,16 27,24 32,36 20,28 8,36 13,24 2,16 15,16\"\r\n stroke=\"black\"\r\n fill=\"none\"\r\n strokeWidth=\"2\"\r\n />\r\n </svg>\r\n ),\r\n\r\n stick: (\r\n <svg width=\"40\" height=\"40\">\r\n <rect x=\"16\" y=\"4\" width=\"8\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n\r\n line: (\r\n <svg width=\"40\" height=\"40\">\r\n <line x1=\"4\" y1=\"20\" x2=\"36\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n\r\n arrow: (\r\n <svg width=\"40\" height=\"40\">\r\n <line x1=\"4\" y1=\"20\" x2=\"30\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"30,14 38,20 30,26\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n dblarrow: (\r\n <svg width=\"40\" height=\"40\">\r\n <polygon points=\"4,20 12,14 12,26\" fill=\"black\"/>\r\n <line x1=\"12\" y1=\"20\" x2=\"28\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"28,14 36,20 28,26\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n parallelogram: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"8,8 34,8 26,32 0,32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n roundedRect: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"6\" y=\"10\" width=\"28\" height=\"20\" rx=\"4\" ry=\"4\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n capsule: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"6\" y=\"14\" width=\"28\" height=\"12\" rx=\"6\" ry=\"6\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n pentagon: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"20,6 34,15 28,32 12,32 6,15\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n chevron: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 100 100\">\r\n <polyline\r\n points=\"0,0 50,100 100,0\"\r\n fill=\"none\"\r\n stroke=\"black\"\r\n strokeWidth=\"5\"\r\n />\r\n </svg>\r\n ),\r\n table3x3: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n\r\n <line x1=\"14\" y1=\"4\" x2=\"14\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"26\" y1=\"4\" x2=\"26\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n\r\n <line x1=\"4\" y1=\"14\" x2=\"36\" y2=\"14\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"4\" y1=\"26\" x2=\"36\" y2=\"26\" stroke=\"black\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n\r\n pyramid: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <polygon points=\"20,4 36,36 4,36\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\" />\r\n <line x1=\"15\" y1=\"12\" x2=\"25\" y2=\"12\" stroke=\"black\" strokeWidth=\"2\" />\r\n <line x1=\"11\" y1=\"20\" x2=\"28\" y2=\"20\" stroke=\"black\" strokeWidth=\"2\" />\r\n <line x1=\"7\" y1=\"28\" x2=\"32\" y2=\"28\" stroke=\"black\" strokeWidth=\"2\" />\r\n </svg>\r\n ),\r\n circleArrow: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <circle cx=\"20\" cy=\"20\" r=\"14\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n <line x1=\"20\" y1=\"6\" x2=\"20\" y2=\"0\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <polygon points=\"18,2 22,2 20,0\" fill=\"black\"/>\r\n </svg>\r\n ),\r\n\r\n table3x3LeftMerge: (\r\n <svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\">\r\n <rect x=\"4\" y=\"4\" width=\"32\" height=\"32\" stroke=\"black\" fill=\"none\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"4\" x2=\"14\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"26\" y1=\"4\" x2=\"26\" y2=\"36\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"16\" x2=\"36\" y2=\"16\" stroke=\"black\" strokeWidth=\"2\"/>\r\n <line x1=\"14\" y1=\"28\" x2=\"36\" y2=\"28\" stroke=\"black\" strokeWidth=\"2\"/>\r\n </svg>\r\n ),\r\n};\r\n","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='black'%20stroke-width='3'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='%230000FF'%20stroke-width='3'/%3e%3c/svg%3e\"","\r\nimport React, { useState, useRef, useEffect } from 'react';\r\nimport { SHAPES } from '../features/shape/constants.jsx';\r\nimport { SHAPE_ICONS } from \"./shapeIcons.jsx\";\r\nimport { DND_SHAPE } from '../features/board/constants.js';\r\nimport shapeAdd from '../assets/shape_add.svg';\r\nimport shapeAddActive from '../assets/shape_add_active.svg';\r\nimport '../styles/stickerPalette.css';\r\nimport { ShapeNode } from '../features/shape/ui/ShapeNode.jsx';\r\n\r\nexport const ShapeToolbar = () => {\r\n const [shapeOpen, setShapeOpen] = useState(false);\r\n const wrapperRef = useRef(null);\r\n\r\n const toggleShape = (e) => {\r\n e.stopPropagation();\r\n setShapeOpen((v) => !v);\r\n };\r\n\r\n useEffect(() => {\r\n if (!shapeOpen) return;\r\n const handler = (e) => {\r\n if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {\r\n setShapeOpen(false);\r\n }\r\n };\r\n window.addEventListener('pointerdown', handler);\r\n return () => window.removeEventListener('pointerdown', handler);\r\n }, [shapeOpen]);\r\n\r\n const onShapeDragStart = (shape) => (e) => {\r\n e.stopPropagation();\r\n e.dataTransfer.setData(DND_SHAPE, JSON.stringify({ shapeId: shape.id }));\r\n e.dataTransfer.effectAllowed = 'copy';\r\n };\r\n\r\n return (\r\n <div className=\"left-toolbar-container dragHandle__custom\" ref={wrapperRef} onClick={(e) => e.stopPropagation()}>\r\n <div className={`toolbar-card ${shapeOpen ? 'toolbar-card--open' : ''}`}>\r\n <button onClick={toggleShape} className={`toolbar-btn toolbar-btn--icon toolbar-btn--shape ${shapeOpen ? 'toolbar-btn--active' : ''}`}>\r\n <div className={`toolbar-shape-plate ${shapeOpen ? 'toolbar-shape-plate--active' : ''}`}>\r\n <img src={shapeOpen ? shapeAddActive : shapeAdd} alt=\"Фигуры\" draggable={false} />\r\n </div>\r\n </button>\r\n </div>\r\n {shapeOpen && (\r\n <div className=\"palette-wrapper\" onClick={(e) => e.stopPropagation()}>\r\n <div className=\"shape-panel\">\r\n <div className=\"shape-grid\">\r\n {SHAPES.map((shape) => (\r\n <button\r\n key={shape.id}\r\n className=\"shape-item\"\r\n draggable\r\n onDragStart={onShapeDragStart(shape)}\r\n title={shape.name}\r\n >\r\n {SHAPE_ICONS[shape.id]}\r\n </button>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n <ShapeNode shapeOpen={shapeOpen} />\r\n </div>\r\n );\r\n};","import { ShapeNode } from '../ui/ShapeNode.jsx'\r\n\r\nexport const shapeNodeTypes = {\r\n shape: ShapeNode,\r\n}\r\n","import React, { useEffect, useRef, useState } from 'react'\r\nimport { ShapeToolbar } from '../components/ShapeToolbar.jsx'\r\nimport { Board } from '../features/board/ui/Board.jsx'\r\nimport { useStickersStore } from '../entities/stickers/model/useStickersStore.js'\r\nimport { shapesApi } from '../shared/api/shapesApi.js'\r\nimport { shapeNodeTypes } from '../features/shape/public/shapeNodeTypes.js'\r\n\r\nconst SafeFallbackWidget = ({ children }) => <div>{children}</div>\r\n\r\n/**\r\n * @typedef {import('@xyflow/react').NodeProps} NodeProps\r\n * @typedef {Record<string, React.ComponentType<NodeProps>>} NodeTypes\r\n */\r\n\r\n/**\r\n * @param {{ nodeTypes?: NodeTypes }} props\r\n */\r\nexport const ShapeBoardWidget = ({ nodeTypes }) => {\r\n const setStickers = useStickersStore((state) => state.setStickers)\r\n const boardRef = useRef(null)\r\n const [WidgetComp, setWidgetComp] = useState(() => SafeFallbackWidget)\r\n\r\n const mergedNodeTypes = {\r\n ...shapeNodeTypes,\r\n ...(nodeTypes || {}),\r\n }\r\n\r\n useEffect(() => {\r\n const loadBoard = async () => {\r\n try {\r\n const [allShapes, boardShapes] = await Promise.all([\r\n shapesApi.getAll(),\r\n shapesApi.getBoard(),\r\n ])\r\n\r\n const shapeKeyByDbId = new Map(allShapes.map((x) => [String(x.id), x.shapeId]))\r\n\r\n let x = 30\r\n let y = 30\r\n const items = []\r\n\r\n for (const s of boardShapes) {\r\n const w = s.width ?? 140\r\n const h = s.height ?? 140\r\n const r = s.rotation ?? 0\r\n\r\n const shapeKey = shapeKeyByDbId.get(String(s.shapeId)) ?? 'square'\r\n\r\n items.push({\r\n id: s.id,\r\n stickerId: s.id,\r\n type: 'shape',\r\n shapeId: shapeKey,\r\n shapeDbId: s.shapeId,\r\n x,\r\n y,\r\n width: w,\r\n height: h,\r\n rotation: r,\r\n zIndex: 1,\r\n fill: 'transparent',\r\n stroke: '#000',\r\n })\r\n\r\n x += 24\r\n y += 24\r\n }\r\n\r\n setStickers(items)\r\n } catch (e) {\r\n console.warn('Не удалось загрузить доску для фигур:', e)\r\n }\r\n }\r\n\r\n loadBoard()\r\n }, [setStickers])\r\n\r\n useEffect(() => {\r\n let mounted = true\r\n\r\n import('@xyflow/react')\r\n .then((mod) => {\r\n if (!mounted) {\r\n return\r\n }\r\n\r\n const candidate =\r\n (mod && (mod.Widget || mod.default || mod?.widget || mod?.XyflowWidget)) ?? null\r\n\r\n if (typeof candidate === 'function' || React.isValidElement(candidate)) {\r\n setWidgetComp(() => candidate)\r\n } else {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n .catch(() => {\r\n if (mounted) {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n\r\n return () => {\r\n mounted = false\r\n }\r\n }, [])\r\n\r\n const Wrapper = WidgetComp || SafeFallbackWidget\r\n\r\n return (\r\n <Wrapper>\r\n <div className=\"relative flex h-screen w-screen bg-gray-100\">\r\n <ShapeToolbar />\r\n <Board ref={boardRef} nodeTypes={mergedNodeTypes} />\r\n </div>\r\n </Wrapper>\r\n )\r\n}\r\n"],"names":["SHAPE_ICONS","jsx","jsxs","shapeAdd","shapeAddActive","ShapeToolbar","shapeOpen","setShapeOpen","useState","wrapperRef","useRef","toggleShape","e","v","useEffect","handler","onShapeDragStart","shape","DND_SHAPE","SHAPES","ShapeNode","shapeNodeTypes","SafeFallbackWidget","children","ShapeBoardWidget","nodeTypes","setStickers","useStickersStore","state","boardRef","WidgetComp","setWidgetComp","mergedNodeTypes","allShapes","boardShapes","shapesApi","shapeKeyByDbId","x","y","items","s","h","r","shapeKey","mounted","mod","candidate","React","Wrapper","Board"],"mappings":"khBAEaA,EAAc,CACvB,+BACK,MAAI,CAAA,MAAM,KAAK,OAAO,KACnB,SAACC,EAAA,kBAAA,IAAA,OAAA,CAAK,EAAE,IAAI,EAAE,IAAI,MAAM,KAAK,OAAO,KAAK,OAAO,QAAQ,KAAK,OAAO,YAAY,GAAA,CAAG,CACvF,CAAA,EAGJ,+BACK,MAAI,CAAA,MAAM,KAAK,OAAO,KACnB,iCAAC,SAAO,CAAA,GAAG,KAAK,GAAG,KAAK,EAAE,KAAK,OAAO,QAAQ,KAAK,OAAO,YAAY,GAAA,CAAG,CAC7E,CAAA,EAGJ,SACKA,EAAAA,kBAAAA,IAAA,MAAA,CAAI,MAAM,KAAK,OAAO,KACnB,SAAAA,wBAAC,UAAQ,CAAA,OAAO,kBAAkB,OAAO,QAAQ,KAAK,OAAO,YAAY,GAAG,CAAA,EAChF,EAGJ,KACKA,EAAAA,kBAAAA,IAAA,MAAA,CAAI,MAAM,KAAK,OAAO,KACnB,SAAAA,EAAA,kBAAA,IAAC,UAAA,CACG,OAAO,2DACP,OAAO,QACP,KAAK,OACL,YAAY,GAAA,CAAA,EAEpB,EAGJ,8BACK,MAAI,CAAA,MAAM,KAAK,OAAO,KACnB,SAACA,EAAA,kBAAA,IAAA,OAAA,CAAK,EAAE,KAAK,EAAE,IAAI,MAAM,IAAI,OAAO,KAAK,OAAO,QAAQ,KAAK,OAAO,YAAY,GAAA,CAAI,CACxF,CAAA,EAGJ,6BACK,MAAI,CAAA,MAAM,KAAK,OAAO,KACnB,iCAAC,OAAK,CAAA,GAAG,IAAI,GAAG,K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,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/Board-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/Board-BPjNyr3D.js");const e=require("../chunks/EmojiBoardWidget-DwyWXjjk.js");exports.EmojiBoardWidget=e.EmojiBoardWidget;exports.emojiNodeTypes=e.emojiNodeTypes;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/emoji/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../chunks/Board-
|
|
2
|
-
import { E as m, e as r } from "../chunks/EmojiBoardWidget-
|
|
1
|
+
import "../chunks/Board-LDrQezYP.js";
|
|
2
|
+
import { E as m, e as r } from "../chunks/EmojiBoardWidget-C9Nx3caB.js";
|
|
3
3
|
export {
|
|
4
4
|
m as EmojiBoardWidget,
|
|
5
5
|
r as emojiNodeTypes
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/widgets/CombinedBoardWidget.jsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\nimport { EmojiToolbar } from '../components/EmojiToolbar.jsx'\nimport { ShapeToolbar } from '../components/ShapeToolbar.jsx'\nimport { Board } from '../features/board/ui/Board.jsx'\nimport { useStickersStore } from '../entities/stickers/model/useStickersStore.js'\nimport { stickersApi } from '../shared/api/stickerApi.js'\nimport { shapesApi } from '../shared/api/shapesApi.js'\nimport { EMOJI_W, EMOJI_H } from '../features/board/constants'\nimport { EMOJI_CATALOG, EMOJI_MAP } from '../features/emoji-sticker/stickers.js'\nimport { emojiNodeTypes } from '../features/emoji-sticker/public/emojiNodeTypes.js'\nimport { shapeNodeTypes } from '../features/shape/public/shapeNodeTypes.js'\n\nconst SafeFallbackWidget = ({ children }) => <div>{children}</div>\n\n/**\n * @typedef {import('@xyflow/react').NodeProps} NodeProps\n * @typedef {Record<string, React.ComponentType<NodeProps>>} NodeTypes\n */\n\n/**\n * @param {{ nodeTypes?: NodeTypes }} props\n */\nexport const CombinedBoardWidget = ({ nodeTypes }) => {\n const setStickers = useStickersStore((state) => state.setStickers)\n const boardRef = useRef(null)\n const [WidgetComp, setWidgetComp] = useState(() => SafeFallbackWidget)\n\n const mergedNodeTypes = {\n ...emojiNodeTypes,\n ...shapeNodeTypes,\n ...(nodeTypes || {}),\n }\n\n async function getEmojiUrlForStickerId(stickerId) {\n if (EMOJI_MAP && EMOJI_MAP[stickerId]) {\n return EMOJI_MAP[stickerId]\n }\n\n try {\n const info = await stickersApi.getById(stickerId)\n if (info?.name) {\n const local = EMOJI_CATALOG.find((e) => e.name === info.name)\n if (local) {\n return local.url\n }\n }\n } catch (err) {\n console.warn('getEmojiUrlForStickerId: backend lookup failed', err)\n }\n\n return ''\n }\n\n useEffect(() => {\n const loadBoard = async () => {\n try {\n const [boardEmojis, allShapes, boardShapes] = await Promise.all([\n stickersApi.getBoard(),\n shapesApi.getAll(),\n shapesApi.getBoard(),\n ])\n\n const shapeKeyByDbId = new Map(allShapes.map((x) => [String(x.id), x.shapeId]))\n\n let ex = 30\n let ey = 30\n let z = 1\n const emojiItems = []\n\n for (const e of boardEmojis) {\n const w = e.width ?? EMOJI_W\n const h = e.height ?? EMOJI_H\n\n let imageUrl = EMOJI_MAP?.[String(e.stickerId)] ?? ''\n if (!imageUrl) {\n imageUrl = await getEmojiUrlForStickerId(e.stickerId)\n }\n\n emojiItems.push({\n id: e.id,\n x: ex,\n y: ey,\n color: 'transparent',\n width: w,\n height: h,\n text: '',\n zIndex: z,\n stickerId: e.stickerId,\n imageUrl,\n type: 'emoji',\n })\n\n ex += 24\n ey += 24\n z += 1\n }\n\n let sx = 500\n let sy = 30\n let sz = 10000\n const shapeItems = []\n\n for (const s of boardShapes) {\n const w = s.width ?? 140\n const h = s.height ?? 140\n const r = s.rotation ?? 0\n const shapeKey = shapeKeyByDbId.get(String(s.shapeId)) ?? 'square'\n\n shapeItems.push({\n id: s.id,\n stickerId: s.id,\n type: 'shape',\n shapeId: shapeKey,\n shapeDbId: s.shapeId,\n x: sx,\n y: sy,\n width: w,\n height: h,\n rotation: r,\n zIndex: sz,\n fill: 'transparent',\n stroke: '#000',\n })\n\n sx += 24\n sy += 24\n sz += 1\n }\n\n setStickers([...emojiItems, ...shapeItems])\n } catch (e) {\n console.warn('Не удалось загрузить доску:', e)\n }\n }\n\n loadBoard()\n }, [setStickers])\n\n useEffect(() => {\n let mounted = true\n\n import('@xyflow/react')\n .then((mod) => {\n if (!mounted) {\n return\n }\n\n const candidate = (mod && (mod.Widget || mod.default || mod?.widget || mod?.XyflowWidget)) ?? null\n if (typeof candidate === 'function' || React.isValidElement(candidate)) {\n setWidgetComp(() => candidate)\n } else {\n setWidgetComp(() => SafeFallbackWidget)\n }\n })\n .catch(() => {\n if (mounted) {\n setWidgetComp(() => SafeFallbackWidget)\n }\n })\n\n return () => {\n mounted = false\n }\n }, [])\n\n const Wrapper = WidgetComp || SafeFallbackWidget\n\n return (\n <Wrapper>\n <div className=\"relative flex h-screen w-screen bg-gray-100\">\n <div className=\"flex flex-col\">\n <EmojiToolbar />\n <ShapeToolbar />\n </div>\n <Board ref={boardRef} nodeTypes={mergedNodeTypes} />\n </div>\n </Wrapper>\n )\n}\n"],"names":["SafeFallbackWidget","children","jsx","CombinedBoardWidget","nodeTypes","setStickers","useStickersStore","state","boardRef","useRef","WidgetComp","setWidgetComp","useState","mergedNodeTypes","emojiNodeTypes","shapeNodeTypes","getEmojiUrlForStickerId","stickerId","EMOJI_MAP","info","stickersApi","local","EMOJI_CATALOG","e","err","useEffect","boardEmojis","allShapes","boardShapes","shapesApi","shapeKeyByDbId","x","ex","ey","z","emojiItems","w","EMOJI_W","h","EMOJI_H","imageUrl","sx","sy","sz","shapeItems","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/widgets/CombinedBoardWidget.jsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\r\nimport { EmojiToolbar } from '../components/EmojiToolbar.jsx'\r\nimport { ShapeToolbar } from '../components/ShapeToolbar.jsx'\r\nimport { Board } from '../features/board/ui/Board.jsx'\r\nimport { useStickersStore } from '../entities/stickers/model/useStickersStore.js'\r\nimport { stickersApi } from '../shared/api/stickerApi.js'\r\nimport { shapesApi } from '../shared/api/shapesApi.js'\r\nimport { EMOJI_W, EMOJI_H } from '../features/board/constants'\r\nimport { EMOJI_CATALOG, EMOJI_MAP } from '../features/emoji-sticker/stickers.js'\r\nimport { emojiNodeTypes } from '../features/emoji-sticker/public/emojiNodeTypes.js'\r\nimport { shapeNodeTypes } from '../features/shape/public/shapeNodeTypes.js'\r\n\r\nconst SafeFallbackWidget = ({ children }) => <div>{children}</div>\r\n\r\n/**\r\n * @typedef {import('@xyflow/react').NodeProps} NodeProps\r\n * @typedef {Record<string, React.ComponentType<NodeProps>>} NodeTypes\r\n */\r\n\r\n/**\r\n * @param {{ nodeTypes?: NodeTypes }} props\r\n */\r\nexport const CombinedBoardWidget = ({ nodeTypes }) => {\r\n const setStickers = useStickersStore((state) => state.setStickers)\r\n const boardRef = useRef(null)\r\n const [WidgetComp, setWidgetComp] = useState(() => SafeFallbackWidget)\r\n\r\n const mergedNodeTypes = {\r\n ...emojiNodeTypes,\r\n ...shapeNodeTypes,\r\n ...(nodeTypes || {}),\r\n }\r\n\r\n async function getEmojiUrlForStickerId(stickerId) {\r\n if (EMOJI_MAP && EMOJI_MAP[stickerId]) {\r\n return EMOJI_MAP[stickerId]\r\n }\r\n\r\n try {\r\n const info = await stickersApi.getById(stickerId)\r\n if (info?.name) {\r\n const local = EMOJI_CATALOG.find((e) => e.name === info.name)\r\n if (local) {\r\n return local.url\r\n }\r\n }\r\n } catch (err) {\r\n console.warn('getEmojiUrlForStickerId: backend lookup failed', err)\r\n }\r\n\r\n return ''\r\n }\r\n\r\n useEffect(() => {\r\n const loadBoard = async () => {\r\n try {\r\n const [boardEmojis, allShapes, boardShapes] = await Promise.all([\r\n stickersApi.getBoard(),\r\n shapesApi.getAll(),\r\n shapesApi.getBoard(),\r\n ])\r\n\r\n const shapeKeyByDbId = new Map(allShapes.map((x) => [String(x.id), x.shapeId]))\r\n\r\n let ex = 30\r\n let ey = 30\r\n let z = 1\r\n const emojiItems = []\r\n\r\n for (const e of boardEmojis) {\r\n const w = e.width ?? EMOJI_W\r\n const h = e.height ?? EMOJI_H\r\n\r\n let imageUrl = EMOJI_MAP?.[String(e.stickerId)] ?? ''\r\n if (!imageUrl) {\r\n imageUrl = await getEmojiUrlForStickerId(e.stickerId)\r\n }\r\n\r\n emojiItems.push({\r\n id: e.id,\r\n x: ex,\r\n y: ey,\r\n color: 'transparent',\r\n width: w,\r\n height: h,\r\n text: '',\r\n zIndex: z,\r\n stickerId: e.stickerId,\r\n imageUrl,\r\n type: 'emoji',\r\n })\r\n\r\n ex += 24\r\n ey += 24\r\n z += 1\r\n }\r\n\r\n let sx = 500\r\n let sy = 30\r\n let sz = 10000\r\n const shapeItems = []\r\n\r\n for (const s of boardShapes) {\r\n const w = s.width ?? 140\r\n const h = s.height ?? 140\r\n const r = s.rotation ?? 0\r\n const shapeKey = shapeKeyByDbId.get(String(s.shapeId)) ?? 'square'\r\n\r\n shapeItems.push({\r\n id: s.id,\r\n stickerId: s.id,\r\n type: 'shape',\r\n shapeId: shapeKey,\r\n shapeDbId: s.shapeId,\r\n x: sx,\r\n y: sy,\r\n width: w,\r\n height: h,\r\n rotation: r,\r\n zIndex: sz,\r\n fill: 'transparent',\r\n stroke: '#000',\r\n })\r\n\r\n sx += 24\r\n sy += 24\r\n sz += 1\r\n }\r\n\r\n setStickers([...emojiItems, ...shapeItems])\r\n } catch (e) {\r\n console.warn('Не удалось загрузить доску:', e)\r\n }\r\n }\r\n\r\n loadBoard()\r\n }, [setStickers])\r\n\r\n useEffect(() => {\r\n let mounted = true\r\n\r\n import('@xyflow/react')\r\n .then((mod) => {\r\n if (!mounted) {\r\n return\r\n }\r\n\r\n const candidate = (mod && (mod.Widget || mod.default || mod?.widget || mod?.XyflowWidget)) ?? null\r\n if (typeof candidate === 'function' || React.isValidElement(candidate)) {\r\n setWidgetComp(() => candidate)\r\n } else {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n .catch(() => {\r\n if (mounted) {\r\n setWidgetComp(() => SafeFallbackWidget)\r\n }\r\n })\r\n\r\n return () => {\r\n mounted = false\r\n }\r\n }, [])\r\n\r\n const Wrapper = WidgetComp || SafeFallbackWidget\r\n\r\n return (\r\n <Wrapper>\r\n <div className=\"relative flex h-screen w-screen bg-gray-100\">\r\n <div className=\"flex flex-col\">\r\n <EmojiToolbar />\r\n <ShapeToolbar />\r\n </div>\r\n <Board ref={boardRef} nodeTypes={mergedNodeTypes} />\r\n </div>\r\n </Wrapper>\r\n )\r\n}\r\n"],"names":["SafeFallbackWidget","children","jsx","CombinedBoardWidget","nodeTypes","setStickers","useStickersStore","state","boardRef","useRef","WidgetComp","setWidgetComp","useState","mergedNodeTypes","emojiNodeTypes","shapeNodeTypes","getEmojiUrlForStickerId","stickerId","EMOJI_MAP","info","stickersApi","local","EMOJI_CATALOG","e","err","useEffect","boardEmojis","allShapes","boardShapes","shapesApi","shapeKeyByDbId","x","ex","ey","z","emojiItems","w","EMOJI_W","h","EMOJI_H","imageUrl","sx","sy","sz","shapeItems","r","shapeKey","mounted","mod","candidate","React","Wrapper","jsxs","EmojiToolbar","ShapeToolbar","Board"],"mappings":"ksBAYMA,EAAqB,CAAC,CAAE,SAAAC,CAAe,IAAAC,EAAA,kBAAA,IAAC,OAAK,SAAAD,CAAS,CAAA,EAU/CE,EAAsB,CAAC,CAAE,UAAAC,KAAgB,CAClD,MAAMC,EAAcC,EAAAA,iBAAkBC,GAAUA,EAAM,WAAW,EAC3DC,EAAWC,SAAO,IAAI,EACtB,CAACC,EAAYC,CAAa,EAAIC,EAAAA,SAAS,IAAMZ,CAAkB,EAE/Da,EAAkB,CACpB,GAAGC,EAAA,eACH,GAAGC,EAAA,eACH,GAAIX,GAAa,CAAC,CAAA,EAGtB,eAAeY,EAAwBC,EAAW,CAC1C,GAAAC,EAAA,WAAaA,YAAUD,CAAS,EAChC,OAAOC,EAAAA,UAAUD,CAAS,EAG1B,GAAA,CACA,MAAME,EAAO,MAAMC,EAAAA,YAAY,QAAQH,CAAS,EAChD,GAAIE,GAAA,MAAAA,EAAM,KAAM,CACN,MAAAE,EAAQC,gBAAc,KAAMC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
|
|
1
|
-
import { u as
|
|
2
|
-
import { e as
|
|
3
|
-
import { E as
|
|
4
|
-
import { s as
|
|
5
|
-
import { S as
|
|
6
|
-
import
|
|
7
|
-
const n = ({ children:
|
|
8
|
-
const f =
|
|
9
|
-
...
|
|
10
|
-
...
|
|
11
|
-
...
|
|
1
|
+
import { u as O, j as r, B as v, s as w, a as E, E as z, b as C, c as i, d as J } from "./chunks/Board-LDrQezYP.js";
|
|
2
|
+
import { e as R, a as F } from "./chunks/EmojiBoardWidget-C9Nx3caB.js";
|
|
3
|
+
import { E as Z } from "./chunks/EmojiBoardWidget-C9Nx3caB.js";
|
|
4
|
+
import { s as U, a as D } from "./chunks/ShapeBoardWidget-BFWxWu8h.js";
|
|
5
|
+
import { S as ee } from "./chunks/ShapeBoardWidget-BFWxWu8h.js";
|
|
6
|
+
import K, { useRef as P, useState as q, useEffect as k } from "react";
|
|
7
|
+
const n = ({ children: c }) => /* @__PURE__ */ r.jsx("div", { children: c }), X = ({ nodeTypes: c }) => {
|
|
8
|
+
const f = O((s) => s.setStickers), b = P(null), [B, d] = q(() => n), W = {
|
|
9
|
+
...R,
|
|
10
|
+
...U,
|
|
11
|
+
...c || {}
|
|
12
12
|
};
|
|
13
13
|
async function T(s) {
|
|
14
14
|
if (i && i[s])
|
|
15
15
|
return i[s];
|
|
16
16
|
try {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
const a =
|
|
17
|
+
const e = await w.getById(s);
|
|
18
|
+
if (e != null && e.name) {
|
|
19
|
+
const a = J.find((l) => l.name === e.name);
|
|
20
20
|
if (a)
|
|
21
21
|
return a.url;
|
|
22
22
|
}
|
|
23
|
-
} catch (
|
|
24
|
-
console.warn("getEmojiUrlForStickerId: backend lookup failed",
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.warn("getEmojiUrlForStickerId: backend lookup failed", e);
|
|
25
25
|
}
|
|
26
26
|
return "";
|
|
27
27
|
}
|
|
28
28
|
k(() => {
|
|
29
29
|
(async () => {
|
|
30
|
+
var e;
|
|
30
31
|
try {
|
|
31
|
-
const [
|
|
32
|
+
const [a, l, M] = await Promise.all([
|
|
32
33
|
w.getBoard(),
|
|
33
34
|
E.getAll(),
|
|
34
35
|
E.getBoard()
|
|
35
|
-
]),
|
|
36
|
-
let
|
|
36
|
+
]), _ = new Map(l.map((t) => [String(t.id), t.shapeId]));
|
|
37
|
+
let g = 30, u = 30, m = 1;
|
|
37
38
|
const x = [];
|
|
38
|
-
for (const
|
|
39
|
-
const p =
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
id:
|
|
43
|
-
x:
|
|
44
|
-
y:
|
|
39
|
+
for (const t of a) {
|
|
40
|
+
const p = t.width ?? z, h = t.height ?? C;
|
|
41
|
+
let o = ((e = i) == null ? void 0 : e[String(t.stickerId)]) ?? "";
|
|
42
|
+
o || (o = await T(t.stickerId)), x.push({
|
|
43
|
+
id: t.id,
|
|
44
|
+
x: g,
|
|
45
|
+
y: u,
|
|
45
46
|
color: "transparent",
|
|
46
47
|
width: p,
|
|
47
48
|
height: h,
|
|
48
49
|
text: "",
|
|
49
|
-
zIndex:
|
|
50
|
-
stickerId:
|
|
51
|
-
imageUrl:
|
|
50
|
+
zIndex: m,
|
|
51
|
+
stickerId: t.stickerId,
|
|
52
|
+
imageUrl: o,
|
|
52
53
|
type: "emoji"
|
|
53
|
-
}),
|
|
54
|
+
}), g += 24, u += 24, m += 1;
|
|
54
55
|
}
|
|
55
56
|
let y = 500, I = 30, j = 1e4;
|
|
56
57
|
const S = [];
|
|
57
|
-
for (const
|
|
58
|
-
const p =
|
|
58
|
+
for (const t of M) {
|
|
59
|
+
const p = t.width ?? 140, h = t.height ?? 140, o = t.rotation ?? 0, N = _.get(String(t.shapeId)) ?? "square";
|
|
59
60
|
S.push({
|
|
60
|
-
id:
|
|
61
|
-
stickerId:
|
|
61
|
+
id: t.id,
|
|
62
|
+
stickerId: t.id,
|
|
62
63
|
type: "shape",
|
|
63
|
-
shapeId:
|
|
64
|
-
shapeDbId:
|
|
64
|
+
shapeId: N,
|
|
65
|
+
shapeDbId: t.shapeId,
|
|
65
66
|
x: y,
|
|
66
67
|
y: I,
|
|
67
68
|
width: p,
|
|
68
69
|
height: h,
|
|
69
|
-
rotation:
|
|
70
|
+
rotation: o,
|
|
70
71
|
zIndex: j,
|
|
71
72
|
fill: "transparent",
|
|
72
73
|
stroke: "#000"
|
|
73
74
|
}), y += 24, I += 24, j += 1;
|
|
74
75
|
}
|
|
75
76
|
f([...x, ...S]);
|
|
76
|
-
} catch (
|
|
77
|
-
console.warn("Не удалось загрузить доску:",
|
|
77
|
+
} catch (a) {
|
|
78
|
+
console.warn("Не удалось загрузить доску:", a);
|
|
78
79
|
}
|
|
79
80
|
})();
|
|
80
81
|
}, [f]), k(() => {
|
|
81
82
|
let s = !0;
|
|
82
|
-
return import("@xyflow/react").then((
|
|
83
|
+
return import("@xyflow/react").then((e) => {
|
|
83
84
|
if (!s)
|
|
84
85
|
return;
|
|
85
|
-
const a = (
|
|
86
|
-
typeof a == "function" ||
|
|
86
|
+
const a = (e && (e.Widget || e.default || (e == null ? void 0 : e.widget) || (e == null ? void 0 : e.XyflowWidget))) ?? null;
|
|
87
|
+
typeof a == "function" || K.isValidElement(a) ? d(() => a) : d(() => n);
|
|
87
88
|
}).catch(() => {
|
|
88
|
-
s &&
|
|
89
|
+
s && d(() => n);
|
|
89
90
|
}), () => {
|
|
90
91
|
s = !1;
|
|
91
92
|
};
|
|
92
93
|
}, []);
|
|
93
94
|
const A = B || n;
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ r.jsx(A, { children: /* @__PURE__ */ r.jsxs("div", { className: "relative flex h-screen w-screen bg-gray-100", children: [
|
|
96
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-col", children: [
|
|
97
|
+
/* @__PURE__ */ r.jsx(F, {}),
|
|
98
|
+
/* @__PURE__ */ r.jsx(D, {})
|
|
98
99
|
] }),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ r.jsx(v, { ref: b, nodeTypes: W })
|
|
100
101
|
] }) });
|
|
101
102
|
};
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
v as Board,
|
|
105
|
+
X as CombinedBoardWidget,
|
|
106
|
+
Z as EmojiBoardWidget,
|
|
107
|
+
ee as ShapeBoardWidget,
|
|
108
|
+
R as emojiNodeTypes,
|
|
109
|
+
U as shapeNodeTypes
|
|
109
110
|
};
|
|
110
111
|
//# sourceMappingURL=index.mjs.map
|