@abyss-project/main 1.0.63 → 1.0.65
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/api/draw.api.d.ts +8 -0
- package/dist/api/draw.api.js +36 -0
- package/dist/api/draw.public.api.d.ts +5 -0
- package/dist/api/draw.public.api.js +20 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +7 -0
- package/dist/api/retrospective-card.api.d.ts +6 -0
- package/dist/api/retrospective-card.api.js +26 -0
- package/dist/api/retrospective-member.api.d.ts +5 -0
- package/dist/api/retrospective-member.api.js +20 -0
- package/dist/api/retrospective-section.api.d.ts +6 -0
- package/dist/api/retrospective-section.api.js +26 -0
- package/dist/api/retrospective.api.d.ts +8 -0
- package/dist/api/retrospective.api.js +34 -0
- package/dist/api/retrospective.public.api.d.ts +11 -0
- package/dist/api/retrospective.public.api.js +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -1
- package/dist/server-sent-events/index.d.ts +2 -1
- package/dist/server-sent-events/index.js +1 -0
- package/dist/server-sent-events/protocols/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/index.js +1 -0
- package/dist/server-sent-events/protocols/retrospective/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/retrospective/index.js +17 -0
- package/dist/server-sent-events/protocols/retrospective/retrospective.sse-protocol.d.ts +73 -0
- package/dist/server-sent-events/protocols/retrospective/retrospective.sse-protocol.js +22 -0
- package/dist/server-sent-events/server-sent-events.manager.d.ts +1 -1
- package/dist/server-sent-events/server-sent-events.manager.js +2 -1
- package/dist/types/draw.type.d.ts +106 -0
- package/dist/types/draw.type.js +14 -0
- package/dist/types/enum/abyss-application-event.enum.d.ts +24 -2
- package/dist/types/enum/abyss-application-event.enum.js +24 -2
- package/dist/types/enum/api-error.enum.d.ts +2 -1
- package/dist/types/enum/api-error.enum.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interface/api/index.d.ts +14 -0
- package/dist/types/interface/api/index.js +14 -0
- package/dist/types/interface/api/requests/draw.public.request.d.ts +17 -0
- package/dist/types/interface/api/requests/draw.public.request.js +2 -0
- package/dist/types/interface/api/requests/draw.request.d.ts +31 -0
- package/dist/types/interface/api/requests/draw.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-card.request.d.ts +32 -0
- package/dist/types/interface/api/requests/retrospective-card.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-member.request.d.ts +17 -0
- package/dist/types/interface/api/requests/retrospective-member.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-section.request.d.ts +36 -0
- package/dist/types/interface/api/requests/retrospective-section.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective.public.request.d.ts +71 -0
- package/dist/types/interface/api/requests/retrospective.public.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective.request.d.ts +39 -0
- package/dist/types/interface/api/requests/retrospective.request.js +2 -0
- package/dist/types/interface/api/responses/draw.public.response.d.ts +17 -0
- package/dist/types/interface/api/responses/draw.public.response.js +2 -0
- package/dist/types/interface/api/responses/draw.response.d.ts +18 -0
- package/dist/types/interface/api/responses/draw.response.js +2 -0
- package/dist/types/interface/api/responses/project.response.d.ts +7 -0
- package/dist/types/interface/api/responses/retrospective-card.response.d.ts +18 -0
- package/dist/types/interface/api/responses/retrospective-card.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective-member.response.d.ts +18 -0
- package/dist/types/interface/api/responses/retrospective-member.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective-section.response.d.ts +18 -0
- package/dist/types/interface/api/responses/retrospective-section.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective.public.response.d.ts +36 -0
- package/dist/types/interface/api/responses/retrospective.public.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective.response.d.ts +18 -0
- package/dist/types/interface/api/responses/retrospective.response.js +2 -0
- package/dist/types/interface/index.d.ts +5 -0
- package/dist/types/interface/index.js +5 -0
- package/dist/types/interface/models/draw.model.d.ts +20 -0
- package/dist/types/interface/models/draw.model.js +2 -0
- package/dist/types/interface/models/project.model.d.ts +2 -0
- package/dist/types/interface/models/retrospective-card.model.d.ts +14 -0
- package/dist/types/interface/models/retrospective-card.model.js +2 -0
- package/dist/types/interface/models/retrospective-member.model.d.ts +12 -0
- package/dist/types/interface/models/retrospective-member.model.js +2 -0
- package/dist/types/interface/models/retrospective-section.model.d.ts +13 -0
- package/dist/types/interface/models/retrospective-section.model.js +2 -0
- package/dist/types/interface/models/retrospective.model.d.ts +24 -0
- package/dist/types/interface/models/retrospective.model.js +2 -0
- package/dist/types/interface/models/user.model.d.ts +2 -0
- package/dist/utils/compression.utils.d.ts +2 -0
- package/dist/utils/compression.utils.js +12 -0
- package/dist/utils/file.utils.d.ts +1 -0
- package/dist/utils/file.utils.js +22 -0
- package/dist/utils/icons.utils.d.ts +75 -0
- package/dist/utils/icons.utils.js +86 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/shape.utils.d.ts +22 -0
- package/dist/utils/shape.utils.js +181 -0
- package/package.json +2 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sceneToSVG = exports.arrowToSvg = exports.commentToSvg = exports.imageToSvg = exports.iconToSvg = exports.textToSvg = exports.ellipseToSvg = exports.diamondToSvg = exports.rectangleToSvg = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const draw_type_1 = require("../types/draw.type");
|
|
6
|
+
const rectangleToSvg = (position, size, style) => {
|
|
7
|
+
const x = position.x - size.width / 2;
|
|
8
|
+
const y = position.y - size.height / 2;
|
|
9
|
+
const width = size.width;
|
|
10
|
+
const height = size.height;
|
|
11
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
12
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
13
|
+
const centerX = position.x;
|
|
14
|
+
const centerY = position.y;
|
|
15
|
+
return `<rect x="${x}" y="${y}" width="${width}" height="${height}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" opacity="${style.opacity}" rx="${style.cornerRadius}" ry="${style.cornerRadius}" stroke-dasharray="${style.lineDash || 'none'}" transform="rotate(${style.rotation} ${centerX} ${centerY})" />`;
|
|
16
|
+
};
|
|
17
|
+
exports.rectangleToSvg = rectangleToSvg;
|
|
18
|
+
const diamondToSvg = (position, size, style) => {
|
|
19
|
+
const cx = position.x;
|
|
20
|
+
const cy = position.y;
|
|
21
|
+
const halfWidth = size.width / 2;
|
|
22
|
+
const halfHeight = size.height / 2;
|
|
23
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
24
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
25
|
+
const points = [
|
|
26
|
+
`${cx},${cy - halfHeight}`,
|
|
27
|
+
`${cx + halfWidth},${cy}`,
|
|
28
|
+
`${cx},${cy + halfHeight}`,
|
|
29
|
+
`${cx - halfWidth},${cy}`,
|
|
30
|
+
].join(' ');
|
|
31
|
+
return `<polygon points="${points}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" stroke-dasharray="${style.lineDash || 'none'}" opacity="${style.opacity}" transform="rotate(${style.rotation} ${cx} ${cy})" />`;
|
|
32
|
+
};
|
|
33
|
+
exports.diamondToSvg = diamondToSvg;
|
|
34
|
+
const ellipseToSvg = (position, size, style) => {
|
|
35
|
+
const cx = position.x;
|
|
36
|
+
const cy = position.y;
|
|
37
|
+
const radiusX = size.width / 2;
|
|
38
|
+
const radiusY = size.height / 2;
|
|
39
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
40
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
41
|
+
return `<ellipse cx="${cx}" cy="${cy}" rx="${radiusX}" ry="${radiusY}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" opacity="${style.opacity}" stroke-dasharray="${style.lineDash || 'none'}" transform="rotate(${style.rotation} ${cx} ${cy})" />`;
|
|
42
|
+
};
|
|
43
|
+
exports.ellipseToSvg = ellipseToSvg;
|
|
44
|
+
const textToSvg = (position, style, text) => {
|
|
45
|
+
const x = position.x;
|
|
46
|
+
const y = position.y;
|
|
47
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
48
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
49
|
+
return `<text x="${x}" y="${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" opacity="${style.opacity}" font-size="${style.fontSize}" font-family="${style.fontFamily}"
|
|
50
|
+
stroke-dasharray="${style.lineDash || 'none'}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${style.rotation} ${x} ${y})">${text}</text>`;
|
|
51
|
+
};
|
|
52
|
+
exports.textToSvg = textToSvg;
|
|
53
|
+
const iconToSvg = (position, size, style, iconSymbol) => {
|
|
54
|
+
const x = position.x;
|
|
55
|
+
const y = position.y;
|
|
56
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
57
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
58
|
+
const fontSize = Math.min(size.width, size.height) * 0.8;
|
|
59
|
+
return `<text x="${x}" y="${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" opacity="${style.opacity}" font-size="${fontSize}" font-family="Arial" text-anchor="middle" dominant-baseline="middle" transform="rotate(${style.rotation} ${x} ${y})">${iconSymbol}</text>`;
|
|
60
|
+
};
|
|
61
|
+
exports.iconToSvg = iconToSvg;
|
|
62
|
+
const imageToSvg = (position, size, style, src) => {
|
|
63
|
+
const x = position.x - size.width / 2;
|
|
64
|
+
const y = position.y - size.height / 2;
|
|
65
|
+
const width = size.width;
|
|
66
|
+
const height = size.height;
|
|
67
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
68
|
+
const centerX = position.x;
|
|
69
|
+
const centerY = position.y;
|
|
70
|
+
return `<image x="${x}" y="${y}" width="${width}" height="${height}" href="${src}" opacity="${style.opacity}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" rx="${style.cornerRadius}" ry="${style.cornerRadius}" transform="rotate(${style.rotation} ${centerX} ${centerY})" />`;
|
|
71
|
+
};
|
|
72
|
+
exports.imageToSvg = imageToSvg;
|
|
73
|
+
const commentToSvg = (position, size, style, id) => {
|
|
74
|
+
const cx = position.x;
|
|
75
|
+
const cy = position.y;
|
|
76
|
+
const radius = size.width / 2;
|
|
77
|
+
const fillColor = style.fillColor === 'none' ? 'transparent' : style.fillColor;
|
|
78
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
79
|
+
const fontSize = size.width * 0.6;
|
|
80
|
+
const textX = cx;
|
|
81
|
+
const textY = cy + fontSize * 0.35;
|
|
82
|
+
return `
|
|
83
|
+
<g opacity="${style.opacity}" transform="rotate(${style.rotation} ${cx} ${cy})">
|
|
84
|
+
<defs>
|
|
85
|
+
<filter id="comment-shadow-${id}" x="-50%" y="-50%" width="200%" height="200%">
|
|
86
|
+
<feDropShadow dx="2" dy="2" stdDeviation="5" flood-color="black" flood-opacity="0.3"/>
|
|
87
|
+
</filter>
|
|
88
|
+
</defs>
|
|
89
|
+
<circle cx="${cx}" cy="${cy}" r="${radius}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" filter="url(#comment-shadow-${id})" />
|
|
90
|
+
<text x="${textX}" y="${textY}" fill="white" font-size="${fontSize}" font-family="Arial" text-anchor="middle" dominant-baseline="middle" font-weight="bold">!</text>
|
|
91
|
+
</g>`;
|
|
92
|
+
};
|
|
93
|
+
exports.commentToSvg = commentToSvg;
|
|
94
|
+
const renderEndpointStyleSvg = (x, y, style, angle, strokeColor, fillColor, strokeWidth) => {
|
|
95
|
+
switch (style) {
|
|
96
|
+
case 'circle':
|
|
97
|
+
return `<circle cx="${x}" cy="${y}" r="6" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
98
|
+
case 'square':
|
|
99
|
+
const squareX = x - 6;
|
|
100
|
+
const squareY = y - 6;
|
|
101
|
+
return `<rect x="${squareX}" y="${squareY}" width="12" height="12" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" transform="rotate(${angle * (180 / Math.PI)} ${x} ${y})" />`;
|
|
102
|
+
case 'diamond':
|
|
103
|
+
return `<polygon points="${x},${y - 6} ${x + 6},${y} ${x},${y + 6} ${x - 6},${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" transform="rotate(${angle * (180 / Math.PI)} ${x} ${y})" />`;
|
|
104
|
+
case 'arrow':
|
|
105
|
+
const arrowSize = 8;
|
|
106
|
+
const x1 = x - arrowSize * Math.cos(angle - Math.PI / 6);
|
|
107
|
+
const y1 = y - arrowSize * Math.sin(angle - Math.PI / 6);
|
|
108
|
+
const x2 = x - arrowSize * Math.cos(angle + Math.PI / 6);
|
|
109
|
+
const y2 = y - arrowSize * Math.sin(angle + Math.PI / 6);
|
|
110
|
+
return `<polygon points="${x},${y} ${x1},${y1} ${x2},${y2}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
111
|
+
case 'none':
|
|
112
|
+
default:
|
|
113
|
+
return '';
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const arrowToSvg = (style, startEndpoint, endEndpoint, fromPos, toPos) => {
|
|
117
|
+
const angle = Math.atan2(toPos.y - fromPos.y, toPos.x - fromPos.x);
|
|
118
|
+
let svg = `<g opacity="${style.opacity}">`;
|
|
119
|
+
svg += `<line x1="${fromPos.x}" y1="${fromPos.y}" x2="${toPos.x}" y2="${toPos.y}" stroke="${style.strokeColor}" stroke-width="${style.strokeWidth}" />`;
|
|
120
|
+
svg += renderEndpointStyleSvg(fromPos.x, fromPos.y, startEndpoint.style, angle + Math.PI, style.strokeColor, style.fillColor, style.strokeWidth);
|
|
121
|
+
svg += renderEndpointStyleSvg(toPos.x, toPos.y, endEndpoint.style, angle, style.strokeColor, style.fillColor, style.strokeWidth);
|
|
122
|
+
svg += '</g>';
|
|
123
|
+
return svg;
|
|
124
|
+
};
|
|
125
|
+
exports.arrowToSvg = arrowToSvg;
|
|
126
|
+
const sceneToSVG = (shapes, width, height) => {
|
|
127
|
+
const shapeEls = shapes
|
|
128
|
+
.sort((a, b) => (a.zIndex || 0) - (b.zIndex || 0))
|
|
129
|
+
.map((s) => {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
switch (s.type) {
|
|
132
|
+
case draw_type_1.DrawShapeType.RECTANGLE:
|
|
133
|
+
return (0, exports.rectangleToSvg)(s.position, s.size, s.style);
|
|
134
|
+
case draw_type_1.DrawShapeType.DIAMOND:
|
|
135
|
+
return (0, exports.diamondToSvg)(s.position, s.size, s.style);
|
|
136
|
+
case draw_type_1.DrawShapeType.ELLIPSE:
|
|
137
|
+
return (0, exports.ellipseToSvg)(s.position, s.size, s.style);
|
|
138
|
+
case draw_type_1.DrawShapeType.TEXT:
|
|
139
|
+
return (0, exports.textToSvg)(s.position, s.style, s.text || '');
|
|
140
|
+
case draw_type_1.DrawShapeType.ICON:
|
|
141
|
+
const iconSymbol = __1.ICON_LIBRARY[s.iconType] || '';
|
|
142
|
+
return (0, exports.iconToSvg)(s.position, s.size, s.style, iconSymbol);
|
|
143
|
+
case draw_type_1.DrawShapeType.IMAGE:
|
|
144
|
+
return (0, exports.imageToSvg)(s.position, s.size, s.style, s.src);
|
|
145
|
+
case draw_type_1.DrawShapeType.COMMENT:
|
|
146
|
+
return (0, exports.commentToSvg)(s.position, s.size, s.style, s.id);
|
|
147
|
+
case draw_type_1.DrawShapeType.ARROW:
|
|
148
|
+
if (s.startEndpoint && s.endEndpoint) {
|
|
149
|
+
const fromPos = s.startEndpoint.kind === 'port'
|
|
150
|
+
? (_a = shapes.find((shape) => { var _a; return shape.id === ((_a = s.startEndpoint) === null || _a === void 0 ? void 0 : _a.shapeId); })) === null || _a === void 0 ? void 0 : _a.position
|
|
151
|
+
: {
|
|
152
|
+
x: s.startEndpoint.x,
|
|
153
|
+
y: s.startEndpoint.y,
|
|
154
|
+
};
|
|
155
|
+
const toPos = s.endEndpoint.kind === 'port'
|
|
156
|
+
? (_b = shapes.find((shape) => { var _a; return shape.id === ((_a = s.endEndpoint) === null || _a === void 0 ? void 0 : _a.shapeId); })) === null || _b === void 0 ? void 0 : _b.position
|
|
157
|
+
: {
|
|
158
|
+
x: s.endEndpoint.x,
|
|
159
|
+
y: s.endEndpoint.y,
|
|
160
|
+
};
|
|
161
|
+
if (!fromPos || !toPos)
|
|
162
|
+
return '';
|
|
163
|
+
return (0, exports.arrowToSvg)(s.style, s.startEndpoint, s.endEndpoint, fromPos, toPos);
|
|
164
|
+
}
|
|
165
|
+
return '';
|
|
166
|
+
default:
|
|
167
|
+
return '';
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const defs = `
|
|
171
|
+
<defs>
|
|
172
|
+
<marker id="arrow" markerWidth="10" markerHeight="10" refX="10" refY="5" orient="auto-start-reverse">
|
|
173
|
+
<path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>
|
|
174
|
+
</marker>
|
|
175
|
+
</defs>`;
|
|
176
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
|
|
177
|
+
${defs}
|
|
178
|
+
${shapeEls.join('\n')}
|
|
179
|
+
</svg>`;
|
|
180
|
+
};
|
|
181
|
+
exports.sceneToSVG = sceneToSVG;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/main",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
4
4
|
"description": "Core package to interact with Abyss-Project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dayjs": "^1.10.7",
|
|
24
24
|
"discord.js": "^14.7.1",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
|
+
"lz-string": "^1.5.0",
|
|
26
27
|
"reflect-metadata": "^0.1.13",
|
|
27
28
|
"uuid": "^9.0.0"
|
|
28
29
|
},
|