@cnvx/nodal 0.4.0 → 0.5.0
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/BaseEdge.svelte +3 -3
- package/dist/BaseEdge.svelte.d.ts +1 -1
- package/dist/Surface.svelte +15 -8
- package/dist/Surface.svelte.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/BaseEdge.svelte
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
export interface NodalEdgeProps {
|
|
5
5
|
edge: SurfaceEdge;
|
|
6
|
-
|
|
6
|
+
d: string;
|
|
7
7
|
}
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
const { edge,
|
|
11
|
+
const { edge, d }: NodalEdgeProps = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<path
|
|
15
|
-
d
|
|
15
|
+
{d}
|
|
16
16
|
fill="none"
|
|
17
17
|
stroke-width="2"
|
|
18
18
|
stroke="currentColor"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SurfaceEdge } from "./Surface.svelte";
|
|
2
2
|
export interface NodalEdgeProps {
|
|
3
3
|
edge: SurfaceEdge;
|
|
4
|
-
|
|
4
|
+
d: string;
|
|
5
5
|
}
|
|
6
6
|
declare const BaseEdge: import("svelte").Component<NodalEdgeProps, {}, "">;
|
|
7
7
|
type BaseEdge = ReturnType<typeof BaseEdge>;
|
package/dist/Surface.svelte
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
getNodeAnchorWithBoundingClientRect,
|
|
18
18
|
} from "./layout-utils.js";
|
|
19
19
|
import { fade } from "svelte/transition";
|
|
20
|
+
import type { ComponentProps } from "svelte";
|
|
20
21
|
|
|
21
22
|
type PathGenParams =
|
|
22
23
|
| {
|
|
@@ -30,12 +31,13 @@
|
|
|
30
31
|
center?: Vector2;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
export type SurfaceEdgeParams =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
export type SurfaceEdgeParams<C extends typeof BaseEdge = typeof BaseEdge> =
|
|
35
|
+
{
|
|
36
|
+
component?: C | [C, Omit<ComponentProps<C>, "d" | "edge">];
|
|
37
|
+
sourceAnchor?: Vector2;
|
|
38
|
+
targetAnchor?: Vector2;
|
|
39
|
+
svgPathAttributes?: HTMLAttributes<SVGPathElement>;
|
|
40
|
+
} & PathGenParams;
|
|
39
41
|
|
|
40
42
|
// export type SurfaceEdge = {
|
|
41
43
|
|
|
@@ -253,9 +255,14 @@
|
|
|
253
255
|
{#if svg}
|
|
254
256
|
<g in:fade={{ duration: fadeInDuration }}>
|
|
255
257
|
{#each edges.values() as edge}
|
|
256
|
-
{#each generateEdgePath(edge) as
|
|
258
|
+
{#each generateEdgePath(edge) as d}
|
|
257
259
|
{@const EdgeComponent = edge.component ?? BaseEdge}
|
|
258
|
-
|
|
260
|
+
{#if Array.isArray(EdgeComponent)}
|
|
261
|
+
{@const [EdgeComp, edgeProps] = EdgeComponent}
|
|
262
|
+
<EdgeComp {d} {edge} {...edgeProps} />
|
|
263
|
+
{:else}
|
|
264
|
+
<EdgeComponent {d} {edge} />
|
|
265
|
+
{/if}
|
|
259
266
|
{/each}
|
|
260
267
|
{/each}
|
|
261
268
|
</g>
|
package/dist/Surface.svelte.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type Vector2 } from "./diagram-lib.js";
|
|
|
4
4
|
import type { HTMLAttributes } from "svelte/elements";
|
|
5
5
|
import type { Writable } from "svelte/store";
|
|
6
6
|
import { getNodeAnchorFast } from "./layout-utils.js";
|
|
7
|
+
import type { ComponentProps } from "svelte";
|
|
7
8
|
type PathGenParams = {
|
|
8
9
|
pathGen?: "bezier";
|
|
9
10
|
curvature?: number;
|
|
@@ -13,8 +14,8 @@ type PathGenParams = {
|
|
|
13
14
|
borderRadius?: number;
|
|
14
15
|
center?: Vector2;
|
|
15
16
|
};
|
|
16
|
-
export type SurfaceEdgeParams = {
|
|
17
|
-
component?:
|
|
17
|
+
export type SurfaceEdgeParams<C extends typeof BaseEdge = typeof BaseEdge> = {
|
|
18
|
+
component?: C | [C, Omit<ComponentProps<C>, "d" | "edge">];
|
|
18
19
|
sourceAnchor?: Vector2;
|
|
19
20
|
targetAnchor?: Vector2;
|
|
20
21
|
svgPathAttributes?: HTMLAttributes<SVGPathElement>;
|
package/dist/index.d.ts
CHANGED