@floegence/floe-webapp-core 0.101.44 → 0.101.46
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function w() {
|
|
2
|
-
const t = new Worker(new URL("../../assets/layout-worker-
|
|
2
|
+
const t = new Worker(new URL("../../assets/layout-worker-DQfxkYMB.js", import.meta.url), { type: "module" });
|
|
3
3
|
let a, d = 0;
|
|
4
4
|
const o = /* @__PURE__ */ new Map(), n = (e) => {
|
|
5
5
|
a = e, t.terminate();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GraphLayout, GraphLayoutNode } from './types';
|
|
2
|
+
/** Separate shared tracks across the independently opaque compound routing scopes. */
|
|
3
|
+
export declare function separateRouteLanes(layout: GraphLayout, obstacles: ReadonlyMap<string, readonly GraphLayoutNode[]>, clearance: number, inset: number): void;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
function
|
|
2
|
-
return ![i.width, i.height].every((
|
|
1
|
+
function $(i, t) {
|
|
2
|
+
return ![i.width, i.height].every((h) => Number.isSafeInteger(h) && h > 0 && h <= 16384) || !t || ![t.x, t.y].every(Number.isFinite) || t.x < 0 || t.y < 0 || t.x > i.width || t.y > i.height ? !1 : t.kind === "point" ? !0 : t.kind === "rectangle" && [t.width, t.height].every((h) => Number.isFinite(h) && h > 0) && t.x + t.width <= i.width && t.y + t.height <= i.height;
|
|
3
3
|
}
|
|
4
|
-
function m(i,
|
|
5
|
-
if (
|
|
6
|
-
const
|
|
7
|
-
if (!(![
|
|
8
|
-
return { x: Math.max(0, Math.min(i.width,
|
|
4
|
+
function m(i, t, h, e = !1) {
|
|
5
|
+
if (t.width <= 0 || t.height <= 0) return;
|
|
6
|
+
const r = (h.x - t.left) * i.width / t.width, n = (h.y - t.top) * i.height / t.height;
|
|
7
|
+
if (!(![r, n].every(Number.isFinite) || !e && (r < 0 || n < 0 || r > i.width || n > i.height)))
|
|
8
|
+
return { x: Math.max(0, Math.min(i.width, r)), y: Math.max(0, Math.min(i.height, n)) };
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
if (!Number.isSafeInteger(
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
return `<g fill="none" stroke-linejoin="round"
|
|
10
|
+
function f(i, t, h = 1) {
|
|
11
|
+
if (!Number.isSafeInteger(h) || h < 1 || h > 99) throw new Error("Invalid annotation marker");
|
|
12
|
+
if (!$(i, t)) throw new Error("Invalid image annotation");
|
|
13
|
+
const e = Math.max(1, Math.min(i.width, i.height) / 800), { x: r, y: n } = t, s = 11 * e, o = Math.max(s + e, Math.min(i.width - s - e, r + s)), w = Math.max(s + e, Math.min(i.height - s - e, n - s - 3 * e)), a = t.kind === "rectangle" ? `<rect x="${r}" y="${n}" width="${t.width}" height="${t.height}"/>` : `<path d="M${r - 5 * e},${n}h${10 * e}M${r},${n - 5 * e}v${10 * e}"/>`;
|
|
14
|
+
return `<g fill="none" stroke-linejoin="round">${t.kind === "rectangle" ? `<rect x="${r}" y="${n}" width="${t.width}" height="${t.height}" fill="#2563eb" fill-opacity=".035"/>` : ""}<g stroke="white" stroke-opacity=".9" stroke-width="${3.5 * e}">${a}</g><g stroke="#2563eb" stroke-width="${1.5 * e}">${a}<path d="M${r},${n}L${o},${w}"/></g><rect data-annotation-marker="" pointer-events="all" x="${o - s}" y="${w - s}" width="${2 * s}" height="${2 * s}" rx="${7 * e}" fill="#2563eb" stroke="white" stroke-width="${1.5 * e}"/><text data-annotation-marker="" pointer-events="all" x="${o}" y="${w}" dy=".35em" text-anchor="middle" fill="white" stroke="none" font-family="system-ui, sans-serif" font-size="${11 * e}" font-weight="600">${h}</text></g>`;
|
|
15
15
|
}
|
|
16
|
-
async function x(i,
|
|
17
|
-
const
|
|
18
|
-
let
|
|
16
|
+
async function x(i, t) {
|
|
17
|
+
const h = await createImageBitmap(i);
|
|
18
|
+
let e;
|
|
19
19
|
try {
|
|
20
|
-
const { width:
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
return
|
|
20
|
+
const { width: r, height: n } = h;
|
|
21
|
+
if (r * n > 32e6) throw new Error("Image exceeds annotation pixel limit");
|
|
22
|
+
const s = Array.isArray(t) ? t : [t];
|
|
23
|
+
if (!s.length || s.length > 99) throw new Error("Invalid annotation count");
|
|
24
|
+
const o = s.map((l, g) => f({ width: r, height: n }, l, g + 1)).join(""), w = document.createElement("canvas");
|
|
25
|
+
w.width = r, w.height = n;
|
|
26
|
+
const a = w.getContext("2d");
|
|
27
|
+
if (!a) throw new Error("Image annotation is unavailable");
|
|
28
|
+
a.drawImage(h, 0, 0), e = URL.createObjectURL(new Blob([`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}" viewBox="0 0 ${r} ${n}">${o}</svg>`], { type: "image/svg+xml" }));
|
|
29
|
+
const d = new Image();
|
|
30
|
+
return d.src = e, await d.decode(), a.drawImage(d, 0, 0), await new Promise((l, g) => w.toBlob((c) => c ? l(c) : g(new Error("Image annotation is unavailable")), "image/png"));
|
|
31
31
|
} finally {
|
|
32
|
-
|
|
32
|
+
h.close(), e && URL.revokeObjectURL(e);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
36
|
x as annotateImage,
|
|
37
|
-
|
|
37
|
+
f as imageAnnotationMarkup,
|
|
38
38
|
m as imagePointFromClient,
|
|
39
|
-
|
|
39
|
+
$ as validateImageAnnotation
|
|
40
40
|
};
|