@visualli/core 0.1.4 → 0.1.6
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/animations/index.cjs +146 -0
- package/dist/animations/index.cjs.map +1 -0
- package/dist/animations/index.d.cts +81 -0
- package/dist/animations/index.d.ts +81 -0
- package/dist/animations/index.js +35 -0
- package/dist/animations/index.js.map +1 -0
- package/dist/chunk-6NXADJK2.js +562 -0
- package/dist/chunk-6NXADJK2.js.map +1 -0
- package/dist/chunk-F36SMC3K.js +106 -0
- package/dist/chunk-F36SMC3K.js.map +1 -0
- package/dist/chunk-G5H3P4YZ.js +273 -0
- package/dist/chunk-G5H3P4YZ.js.map +1 -0
- package/dist/chunk-GQMFBYLK.js +81 -0
- package/dist/chunk-GQMFBYLK.js.map +1 -0
- package/dist/chunk-I75TMOE4.js +108 -0
- package/dist/chunk-I75TMOE4.js.map +1 -0
- package/dist/chunk-LDJRGT2Q.js +163 -0
- package/dist/chunk-LDJRGT2Q.js.map +1 -0
- package/dist/chunk-LI3BVD6H.js +98 -0
- package/dist/chunk-LI3BVD6H.js.map +1 -0
- package/dist/chunk-LJYSKSCE.js +95 -0
- package/dist/chunk-LJYSKSCE.js.map +1 -0
- package/dist/chunk-LNTJTDB2.js +349 -0
- package/dist/chunk-LNTJTDB2.js.map +1 -0
- package/dist/chunk-PDP5CVUL.js +139 -0
- package/dist/chunk-PDP5CVUL.js.map +1 -0
- package/dist/chunk-VLGR5PZX.js +1 -0
- package/dist/chunk-VLGR5PZX.js.map +1 -0
- package/dist/config/index.cjs +391 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.cts +77 -0
- package/dist/config/index.d.ts +77 -0
- package/dist/config/index.js +38 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants/index.cjs +642 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +448 -0
- package/dist/constants/index.d.ts +448 -0
- package/dist/constants/index.js +183 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/document-B3hnNr-F.d.cts +73 -0
- package/dist/document-B3hnNr-F.d.ts +73 -0
- package/dist/index.cjs +32 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1044
- package/dist/index.d.ts +15 -1044
- package/dist/index.js +179 -1747
- package/dist/index.js.map +1 -1
- package/dist/layout/index.cjs +210 -0
- package/dist/layout/index.cjs.map +1 -0
- package/dist/layout/index.d.cts +80 -0
- package/dist/layout/index.d.ts +80 -0
- package/dist/layout/index.js +25 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/mindmap-DWS0WZT_.d.cts +118 -0
- package/dist/mindmap-DWS0WZT_.d.ts +118 -0
- package/dist/parser/index.cjs +739 -0
- package/dist/parser/index.cjs.map +1 -0
- package/dist/parser/index.d.cts +87 -0
- package/dist/parser/index.d.ts +87 -0
- package/dist/parser/index.js +43 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/performance/index.cjs +167 -0
- package/dist/performance/index.cjs.map +1 -0
- package/dist/performance/index.d.cts +40 -0
- package/dist/performance/index.d.ts +40 -0
- package/dist/performance/index.js +12 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/types/index.cjs +19 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +8 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/viewport/index.cjs +131 -0
- package/dist/viewport/index.cjs.map +1 -0
- package/dist/viewport/index.d.cts +56 -0
- package/dist/viewport/index.d.ts +56 -0
- package/dist/viewport/index.js +26 -0
- package/dist/viewport/index.js.map +1 -0
- package/package.json +6 -1
- package/src/config/README.md +59 -0
- package/src/config/USAGE_EXAMPLES.md +285 -0
- package/src/config/index.ts +7 -0
- package/src/index.ts +1 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Connection, Container, Node, Meta } from '@visualli/bindings';
|
|
2
|
+
|
|
3
|
+
/** Alias to schema Node type for SDK consistency */
|
|
4
|
+
type LayerNode = Node;
|
|
5
|
+
/** Alias to schema Connection type for SDK consistency */
|
|
6
|
+
type LayerConnection = Connection;
|
|
7
|
+
/** Alias to schema Container type for SDK consistency */
|
|
8
|
+
type LayerContainer = Container;
|
|
9
|
+
/**
|
|
10
|
+
* SDK's stricter version of schema Layer.
|
|
11
|
+
* - Makes nodes/connections/containers required (always arrays, even if empty)
|
|
12
|
+
* - Adds SDK-specific `description` field
|
|
13
|
+
* - Explicitly types key fields to avoid 'unknown' from schema's index signature
|
|
14
|
+
*/
|
|
15
|
+
interface VisualliLayer {
|
|
16
|
+
type: 'layer';
|
|
17
|
+
/** UUID of the layer */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Hierarchy level (0 = root) */
|
|
20
|
+
level: number;
|
|
21
|
+
/** UUID of the parent layer */
|
|
22
|
+
parentLayerId?: string;
|
|
23
|
+
/** UUID of the specific node in parent layer */
|
|
24
|
+
parentNodeId?: string;
|
|
25
|
+
/** SDK-specific description field (not in schema) */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Spatial arrangement (inherits from schema) */
|
|
28
|
+
layout?: 'radial' | 'linear-horizontal' | 'linear-vertical';
|
|
29
|
+
/** Required array of nodes (schema has optional) */
|
|
30
|
+
nodes: LayerNode[];
|
|
31
|
+
/** Required array of connections (schema has optional) */
|
|
32
|
+
connections: LayerConnection[];
|
|
33
|
+
/** Required array of containers (schema has optional) */
|
|
34
|
+
containers: LayerContainer[];
|
|
35
|
+
}
|
|
36
|
+
/** Intermediate format for rendering – converts VisualliLayer to flat nodes. */
|
|
37
|
+
interface VisualliRenderNode {
|
|
38
|
+
id: string;
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
title: string;
|
|
42
|
+
summary: string;
|
|
43
|
+
level: number;
|
|
44
|
+
layerId: string;
|
|
45
|
+
layerLevel: number;
|
|
46
|
+
color: string;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
branchCount: number;
|
|
50
|
+
}
|
|
51
|
+
interface VisualliRenderConnection {
|
|
52
|
+
id: string;
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
label?: string;
|
|
56
|
+
style?: 'dashed' | 'solid';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Alias to schema Meta type for SDK consistency */
|
|
60
|
+
type VisualliMeta = Meta;
|
|
61
|
+
|
|
62
|
+
/** Parsed .visualli document structure. */
|
|
63
|
+
interface VisualliDocument {
|
|
64
|
+
meta: VisualliMeta;
|
|
65
|
+
/** Keyed by layer ID */
|
|
66
|
+
layers: Map<string, VisualliLayer>;
|
|
67
|
+
/** Quick lookup by level */
|
|
68
|
+
layersByLevel: Map<number, VisualliLayer[]>;
|
|
69
|
+
/** The level-0 layer */
|
|
70
|
+
rootLayer: VisualliLayer | null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type { LayerConnection as L, VisualliDocument as V, VisualliLayer as a, LayerContainer as b, LayerNode as c, VisualliMeta as d, VisualliRenderConnection as e, VisualliRenderNode as f };
|
package/dist/index.cjs
CHANGED
|
@@ -1827,38 +1827,6 @@ function getViewportVisibleNodes(options) {
|
|
|
1827
1827
|
);
|
|
1828
1828
|
}
|
|
1829
1829
|
|
|
1830
|
-
// src/config/textScaling.ts
|
|
1831
|
-
var NODE_TEXT_BASE_FONT_PX = 28;
|
|
1832
|
-
var DESCRIPTION_TEXT_BASE_FONT_PX = 12;
|
|
1833
|
-
var CONTAINER_LABEL_BASE_FONT_PX = 24;
|
|
1834
|
-
var EDGE_LABEL_BASE_FONT_PX = 18;
|
|
1835
|
-
var OVERLAY_FONT_UPPER_BOOST_PX = 8;
|
|
1836
|
-
var NODE_TEXT_SAFE_BLOB_FILL_RATIO = 0.88;
|
|
1837
|
-
function computeNodeTextWorldScale(nodeWidth, zoomLevel) {
|
|
1838
|
-
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
1839
|
-
const baseRadiusX = nodeWidth / 2;
|
|
1840
|
-
const baseRadiusY = Math.max(NODE_HEIGHT * 1.6 / 2, baseRadiusX * 0.74);
|
|
1841
|
-
const textNaturalWidth = nodeWidth - 40;
|
|
1842
|
-
const textNaturalHeight = NODE_HEIGHT - 20;
|
|
1843
|
-
const maxScaleX = baseRadiusX * 2 * NODE_TEXT_SAFE_BLOB_FILL_RATIO / Math.max(textNaturalWidth, 1);
|
|
1844
|
-
const maxScaleY = baseRadiusY * 2 * NODE_TEXT_SAFE_BLOB_FILL_RATIO / Math.max(textNaturalHeight, 1);
|
|
1845
|
-
const fitScale = Math.max(0.01, Math.min(maxScaleX, maxScaleY));
|
|
1846
|
-
return Math.min(1 / safeZoom, fitScale);
|
|
1847
|
-
}
|
|
1848
|
-
function computeNodeTextScreenScale(nodeWidth, zoomLevel) {
|
|
1849
|
-
return computeNodeTextWorldScale(nodeWidth, zoomLevel) * zoomLevel;
|
|
1850
|
-
}
|
|
1851
|
-
function computeOverlayScale(zoomLevel) {
|
|
1852
|
-
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
1853
|
-
const inverseScale = 1 / safeZoom;
|
|
1854
|
-
const maxScale = (NODE_TEXT_BASE_FONT_PX + OVERLAY_FONT_UPPER_BOOST_PX) / NODE_TEXT_BASE_FONT_PX;
|
|
1855
|
-
return Math.min(Math.max(inverseScale, 1), maxScale);
|
|
1856
|
-
}
|
|
1857
|
-
function computeEdgeLabelScale(zoomLevel) {
|
|
1858
|
-
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
1859
|
-
return Math.min(Math.max(EDGE_LABEL_BASE_FONT_PX / safeZoom, 10), 32);
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
1830
|
// src/config/blobShapes.ts
|
|
1863
1831
|
var BLOB_LAYER_CONFIG = [
|
|
1864
1832
|
{ opacity: 0.3, rotation: -15, scaleUp: 1.3, strokeWidth: 3, dash: [6, 4] },
|
|
@@ -2152,6 +2120,38 @@ function drawBlobPath(ctx, radiusX, radiusY, blobType) {
|
|
|
2152
2120
|
}
|
|
2153
2121
|
ctx.closePath();
|
|
2154
2122
|
}
|
|
2123
|
+
|
|
2124
|
+
// src/config/textScaling.ts
|
|
2125
|
+
var NODE_TEXT_BASE_FONT_PX = 28;
|
|
2126
|
+
var DESCRIPTION_TEXT_BASE_FONT_PX = 12;
|
|
2127
|
+
var CONTAINER_LABEL_BASE_FONT_PX = 24;
|
|
2128
|
+
var EDGE_LABEL_BASE_FONT_PX = 18;
|
|
2129
|
+
var OVERLAY_FONT_UPPER_BOOST_PX = 8;
|
|
2130
|
+
var NODE_TEXT_SAFE_BLOB_FILL_RATIO = 0.88;
|
|
2131
|
+
function computeNodeTextWorldScale(nodeWidth, zoomLevel) {
|
|
2132
|
+
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
2133
|
+
const baseRadiusX = nodeWidth / 2;
|
|
2134
|
+
const baseRadiusY = Math.max(NODE_HEIGHT * 1.6 / 2, baseRadiusX * 0.74);
|
|
2135
|
+
const textNaturalWidth = nodeWidth - 40;
|
|
2136
|
+
const textNaturalHeight = NODE_HEIGHT - 20;
|
|
2137
|
+
const maxScaleX = baseRadiusX * 2 * NODE_TEXT_SAFE_BLOB_FILL_RATIO / Math.max(textNaturalWidth, 1);
|
|
2138
|
+
const maxScaleY = baseRadiusY * 2 * NODE_TEXT_SAFE_BLOB_FILL_RATIO / Math.max(textNaturalHeight, 1);
|
|
2139
|
+
const fitScale = Math.max(0.01, Math.min(maxScaleX, maxScaleY));
|
|
2140
|
+
return Math.min(1 / safeZoom, fitScale);
|
|
2141
|
+
}
|
|
2142
|
+
function computeNodeTextScreenScale(nodeWidth, zoomLevel) {
|
|
2143
|
+
return computeNodeTextWorldScale(nodeWidth, zoomLevel) * zoomLevel;
|
|
2144
|
+
}
|
|
2145
|
+
function computeOverlayScale(zoomLevel) {
|
|
2146
|
+
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
2147
|
+
const inverseScale = 1 / safeZoom;
|
|
2148
|
+
const maxScale = (NODE_TEXT_BASE_FONT_PX + OVERLAY_FONT_UPPER_BOOST_PX) / NODE_TEXT_BASE_FONT_PX;
|
|
2149
|
+
return Math.min(Math.max(inverseScale, 1), maxScale);
|
|
2150
|
+
}
|
|
2151
|
+
function computeEdgeLabelScale(zoomLevel) {
|
|
2152
|
+
const safeZoom = Math.max(zoomLevel, 1e-4);
|
|
2153
|
+
return Math.min(Math.max(EDGE_LABEL_BASE_FONT_PX / safeZoom, 10), 32);
|
|
2154
|
+
}
|
|
2155
2155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2156
2156
|
0 && (module.exports = {
|
|
2157
2157
|
ACTIVE_BLOB_TYPES,
|