@abyss-project/main 1.0.72 → 1.0.74

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.js CHANGED
@@ -96,4 +96,7 @@ AbyssCore.config = {
96
96
  baseURL: DEFAULT_BASE_URL,
97
97
  abyssUserAnonymousIdentifier: '',
98
98
  };
99
- AbyssCore.axios = axios_1.default.create({ baseURL: _a.config.baseURL });
99
+ AbyssCore.axios = axios_1.default.create({
100
+ baseURL: _a.config.baseURL,
101
+ withCredentials: true,
102
+ });
@@ -47,6 +47,7 @@ export interface DrawStyle {
47
47
  textHorizontalPosition?: 'left' | 'center' | 'right';
48
48
  }
49
49
  export interface ShapeProperties {
50
+ id?: string;
50
51
  position: Point;
51
52
  zIndex?: number;
52
53
  size: DrawSize;
@@ -78,9 +79,8 @@ export type Id = string;
78
79
  export type PortId = 'top' | 'right' | 'bottom' | 'left' | 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
79
80
  export type TextAnchor = {
80
81
  shapeId: string;
81
- portId: PortId;
82
- offsetX?: number;
83
- offsetY?: number;
82
+ relativeX: number;
83
+ relativeY: number;
84
84
  };
85
85
  export type DrawShapeToJsonBaseResult = {
86
86
  id: string;
@@ -1,4 +1,4 @@
1
- import { Id, PortId, Point, DrawSize, DrawStyle, DrawShapeToJsonResult } from '../types/draw.type';
1
+ import { Id, Point, DrawSize, DrawStyle, DrawShapeToJsonResult } from '../types/draw.type';
2
2
  export type Endpoint = {
3
3
  style: DrawArrowEndpointStyle;
4
4
  } & ({
@@ -6,9 +6,10 @@ export type Endpoint = {
6
6
  x: number;
7
7
  y: number;
8
8
  } | {
9
- kind: 'port';
9
+ kind: 'anchor';
10
10
  shapeId: Id;
11
- portId: PortId;
11
+ relativeX: number;
12
+ relativeY: number;
12
13
  });
13
14
  export type DrawArrowEndpointStyle = 'arrow' | 'circle' | 'square' | 'diamond' | 'none';
14
15
  export type CurvePoint = Point & {
@@ -46,7 +46,7 @@ const textToSvg = (position, style, text) => {
46
46
  const y = position.y;
47
47
  const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
48
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}"
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
50
  stroke-dasharray="${style.lineDash || 'none'}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${style.rotation} ${x} ${y})">${text}</text>`;
51
51
  };
52
52
  exports.textToSvg = textToSvg;
@@ -79,15 +79,15 @@ const commentToSvg = (position, size, style, id) => {
79
79
  const fontSize = size.width * 0.6;
80
80
  const textX = cx;
81
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>
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
91
  </g>`;
92
92
  };
93
93
  exports.commentToSvg = commentToSvg;
@@ -146,13 +146,13 @@ const sceneToSVG = (shapes, width, height) => {
146
146
  return (0, exports.commentToSvg)(s.position, s.size, s.style, s.id);
147
147
  case draw_type_1.DrawShapeType.ARROW:
148
148
  if (s.startEndpoint && s.endEndpoint) {
149
- const fromPos = s.startEndpoint.kind === 'port'
149
+ const fromPos = s.startEndpoint.kind === 'anchor'
150
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
151
  : {
152
152
  x: s.startEndpoint.x,
153
153
  y: s.startEndpoint.y,
154
154
  };
155
- const toPos = s.endEndpoint.kind === 'port'
155
+ const toPos = s.endEndpoint.kind === 'anchor'
156
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
157
  : {
158
158
  x: s.endEndpoint.x,
@@ -167,15 +167,15 @@ const sceneToSVG = (shapes, width, height) => {
167
167
  return '';
168
168
  }
169
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>
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
175
  </defs>`;
176
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
177
- ${defs}
178
- ${shapeEls.join('\n')}
176
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
177
+ ${defs}
178
+ ${shapeEls.join('\n')}
179
179
  </svg>`;
180
180
  };
181
181
  exports.sceneToSVG = sceneToSVG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/main",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "Core package to interact with Abyss-Project",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",