@project-skymap/library 0.4.0 → 0.6.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/index.cjs +1516 -376
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +139 -46
- package/dist/index.d.ts +139 -46
- package/dist/index.js +1516 -376
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,64 +5,95 @@ type SceneNode = {
|
|
|
5
5
|
label: string;
|
|
6
6
|
level: number;
|
|
7
7
|
parent?: string;
|
|
8
|
+
children?: string[];
|
|
8
9
|
weight?: number;
|
|
9
10
|
icon?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
size?: number;
|
|
12
11
|
meta?: Record<string, unknown>;
|
|
13
12
|
};
|
|
14
|
-
type SceneLink = {
|
|
15
|
-
source: string;
|
|
16
|
-
target: string;
|
|
17
|
-
};
|
|
18
13
|
type SceneModel = {
|
|
19
|
-
meta?: Record<string, unknown>;
|
|
20
14
|
nodes: SceneNode[];
|
|
21
|
-
links
|
|
15
|
+
links?: SceneLink[];
|
|
16
|
+
meta?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
type LayoutAlgorithm = "phyllotaxis" | "voronoi";
|
|
19
|
+
type LayoutConfig = {
|
|
20
|
+
algorithm: LayoutAlgorithm;
|
|
21
|
+
radius?: number;
|
|
22
|
+
voronoi?: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type StarArrangement = {
|
|
28
|
+
[id: string]: {
|
|
29
|
+
position: [number, number, number];
|
|
30
|
+
};
|
|
22
31
|
};
|
|
23
|
-
type Vector3Arr = [number, number, number];
|
|
24
|
-
type StarArrangement = Record<string, {
|
|
25
|
-
position: Vector3Arr;
|
|
26
|
-
}>;
|
|
27
32
|
type StarMapConfig = {
|
|
33
|
+
data?: any;
|
|
34
|
+
adapter?: (data: any) => SceneModel;
|
|
35
|
+
model?: SceneModel;
|
|
36
|
+
layout: LayoutConfig;
|
|
37
|
+
arrangement?: StarArrangement;
|
|
38
|
+
polygons?: Record<string, [number, number][]>;
|
|
28
39
|
background?: string;
|
|
40
|
+
labelColors?: Record<string, string>;
|
|
41
|
+
constellations?: any;
|
|
42
|
+
showConstellationArt?: boolean;
|
|
43
|
+
showConstellationLines?: boolean;
|
|
44
|
+
showDivisionBoundaries?: boolean;
|
|
45
|
+
showBackdropStars?: boolean;
|
|
46
|
+
backdropStarsCount?: number;
|
|
47
|
+
showAtmosphere?: boolean;
|
|
48
|
+
showBookLabels?: boolean;
|
|
49
|
+
showChapterLabels?: boolean;
|
|
50
|
+
showDivisionLabels?: boolean;
|
|
51
|
+
showGroupLabels?: boolean;
|
|
52
|
+
groups?: Record<string, {
|
|
53
|
+
name: string;
|
|
54
|
+
start: number;
|
|
55
|
+
end: number;
|
|
56
|
+
}[]>;
|
|
57
|
+
editable?: boolean;
|
|
58
|
+
projection?: "perspective" | "stereographic" | "blended";
|
|
29
59
|
camera?: {
|
|
30
|
-
fov?: number;
|
|
31
|
-
z?: number;
|
|
32
60
|
lon?: number;
|
|
33
61
|
lat?: number;
|
|
34
62
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
fitProjection?: boolean;
|
|
64
|
+
};
|
|
65
|
+
type SceneLink = {
|
|
66
|
+
source: string;
|
|
67
|
+
target: string;
|
|
68
|
+
};
|
|
69
|
+
type ConstellationConfig = {
|
|
70
|
+
version: number;
|
|
71
|
+
atlasBasePath: string;
|
|
72
|
+
constellations: {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
type: string;
|
|
76
|
+
image: string;
|
|
77
|
+
anchors: string[];
|
|
78
|
+
center: null | [number, number];
|
|
79
|
+
radius: number;
|
|
80
|
+
rotationDeg: number;
|
|
81
|
+
opacity: number;
|
|
82
|
+
blend: string;
|
|
83
|
+
zBias: number;
|
|
84
|
+
fade: {
|
|
85
|
+
zoomInStart: number;
|
|
86
|
+
zoomInEnd: number;
|
|
87
|
+
hoverBoost: number;
|
|
88
|
+
minOpacity: number;
|
|
89
|
+
maxOpacity: number;
|
|
90
|
+
};
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
type HierarchyFilter = {
|
|
94
|
+
testament?: string;
|
|
95
|
+
division?: string;
|
|
96
|
+
bookKey?: string;
|
|
66
97
|
};
|
|
67
98
|
|
|
68
99
|
type StarMapProps = {
|
|
@@ -71,9 +102,16 @@ type StarMapProps = {
|
|
|
71
102
|
onSelect?: (node: SceneNode) => void;
|
|
72
103
|
onHover?: (node?: SceneNode) => void;
|
|
73
104
|
onArrangementChange?: (arrangement: StarArrangement) => void;
|
|
105
|
+
onFovChange?: (fov: number) => void;
|
|
74
106
|
};
|
|
75
107
|
type StarMapHandle = {
|
|
76
108
|
getFullArrangement: () => StarArrangement | undefined;
|
|
109
|
+
setHoveredBook: (id: string | null) => void;
|
|
110
|
+
setFocusedBook: (id: string | null) => void;
|
|
111
|
+
setOrderRevealEnabled: (enabled: boolean) => void;
|
|
112
|
+
setHierarchyFilter: (filter: HierarchyFilter | null) => void;
|
|
113
|
+
flyTo: (nodeId: string, targetFov?: number) => void;
|
|
114
|
+
setProjection: (id: "perspective" | "stereographic" | "blended") => void;
|
|
77
115
|
};
|
|
78
116
|
declare const StarMap: React.ForwardRefExoticComponent<StarMapProps & React.RefAttributes<StarMapHandle>>;
|
|
79
117
|
|
|
@@ -29153,4 +29191,59 @@ interface GenerateOptions {
|
|
|
29153
29191
|
declare const defaultGenerateOptions: GenerateOptions;
|
|
29154
29192
|
declare function generateArrangement(bible: BibleJSON, options?: Partial<GenerateOptions>): StarArrangement;
|
|
29155
29193
|
|
|
29156
|
-
|
|
29194
|
+
/**
|
|
29195
|
+
* Projection system inspired by Stellarium's projection architecture.
|
|
29196
|
+
*
|
|
29197
|
+
* Stellarium supports 5 projection types (Perspective, Stereographic, Mercator,
|
|
29198
|
+
* Hammer, Mollweide). We implement Perspective, Stereographic, and a Blended
|
|
29199
|
+
* mode that reproduces the original auto-blend behavior.
|
|
29200
|
+
*
|
|
29201
|
+
* Each projection maps a view-space unit direction vector to/from 2D screen
|
|
29202
|
+
* coordinates, independent of Three.js's built-in camera projection.
|
|
29203
|
+
*/
|
|
29204
|
+
type Vec3 = {
|
|
29205
|
+
x: number;
|
|
29206
|
+
y: number;
|
|
29207
|
+
z: number;
|
|
29208
|
+
};
|
|
29209
|
+
interface Projection {
|
|
29210
|
+
/** Unique key for config / serialization */
|
|
29211
|
+
readonly id: string;
|
|
29212
|
+
/** Human-readable name */
|
|
29213
|
+
readonly label: string;
|
|
29214
|
+
/** Maximum valid FOV in degrees for this projection */
|
|
29215
|
+
readonly maxFov: number;
|
|
29216
|
+
/**
|
|
29217
|
+
* Integer sent to the shader as uProjectionType.
|
|
29218
|
+
* 0 = perspective, 1 = stereographic, 2 = blended (auto)
|
|
29219
|
+
*/
|
|
29220
|
+
readonly glslProjectionType: number;
|
|
29221
|
+
/**
|
|
29222
|
+
* Forward projection: view-space unit direction -> raw projected xy.
|
|
29223
|
+
* Returns null if the point should be clipped.
|
|
29224
|
+
* The returned {x,y} are pre-scale values (caller multiplies by uScale/uAspect).
|
|
29225
|
+
* Also returns the original dir.z for clipping decisions.
|
|
29226
|
+
*/
|
|
29227
|
+
forward(dir: Vec3): {
|
|
29228
|
+
x: number;
|
|
29229
|
+
y: number;
|
|
29230
|
+
z: number;
|
|
29231
|
+
} | null;
|
|
29232
|
+
/**
|
|
29233
|
+
* Inverse projection: NDC xy (after dividing out scale/aspect) -> view-space
|
|
29234
|
+
* unit direction vector. Used for mouse picking / unprojection.
|
|
29235
|
+
*/
|
|
29236
|
+
inverse(uvX: number, uvY: number, fovRad: number): Vec3;
|
|
29237
|
+
/**
|
|
29238
|
+
* Compute the uniform scale factor for a given FOV (radians).
|
|
29239
|
+
*/
|
|
29240
|
+
getScale(fovRad: number): number;
|
|
29241
|
+
/**
|
|
29242
|
+
* Whether a view-space direction with the given z component should be clipped.
|
|
29243
|
+
*/
|
|
29244
|
+
isClipped(dirZ: number): boolean;
|
|
29245
|
+
}
|
|
29246
|
+
type ProjectionId = "perspective" | "stereographic" | "blended";
|
|
29247
|
+
declare const PROJECTIONS: Record<ProjectionId, () => Projection>;
|
|
29248
|
+
|
|
29249
|
+
export { type BibleJSON, type ConstellationConfig, type GenerateOptions, type HierarchyFilter, PROJECTIONS, type Projection, type ProjectionId, type SceneLink, type SceneModel, type SceneNode, type StarArrangement, StarMap, type StarMapConfig, type StarMapHandle, type StarMapProps, bibleToSceneModel, defaultGenerateOptions, defaultStars, generateArrangement };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,64 +5,95 @@ type SceneNode = {
|
|
|
5
5
|
label: string;
|
|
6
6
|
level: number;
|
|
7
7
|
parent?: string;
|
|
8
|
+
children?: string[];
|
|
8
9
|
weight?: number;
|
|
9
10
|
icon?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
size?: number;
|
|
12
11
|
meta?: Record<string, unknown>;
|
|
13
12
|
};
|
|
14
|
-
type SceneLink = {
|
|
15
|
-
source: string;
|
|
16
|
-
target: string;
|
|
17
|
-
};
|
|
18
13
|
type SceneModel = {
|
|
19
|
-
meta?: Record<string, unknown>;
|
|
20
14
|
nodes: SceneNode[];
|
|
21
|
-
links
|
|
15
|
+
links?: SceneLink[];
|
|
16
|
+
meta?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
type LayoutAlgorithm = "phyllotaxis" | "voronoi";
|
|
19
|
+
type LayoutConfig = {
|
|
20
|
+
algorithm: LayoutAlgorithm;
|
|
21
|
+
radius?: number;
|
|
22
|
+
voronoi?: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type StarArrangement = {
|
|
28
|
+
[id: string]: {
|
|
29
|
+
position: [number, number, number];
|
|
30
|
+
};
|
|
22
31
|
};
|
|
23
|
-
type Vector3Arr = [number, number, number];
|
|
24
|
-
type StarArrangement = Record<string, {
|
|
25
|
-
position: Vector3Arr;
|
|
26
|
-
}>;
|
|
27
32
|
type StarMapConfig = {
|
|
33
|
+
data?: any;
|
|
34
|
+
adapter?: (data: any) => SceneModel;
|
|
35
|
+
model?: SceneModel;
|
|
36
|
+
layout: LayoutConfig;
|
|
37
|
+
arrangement?: StarArrangement;
|
|
38
|
+
polygons?: Record<string, [number, number][]>;
|
|
28
39
|
background?: string;
|
|
40
|
+
labelColors?: Record<string, string>;
|
|
41
|
+
constellations?: any;
|
|
42
|
+
showConstellationArt?: boolean;
|
|
43
|
+
showConstellationLines?: boolean;
|
|
44
|
+
showDivisionBoundaries?: boolean;
|
|
45
|
+
showBackdropStars?: boolean;
|
|
46
|
+
backdropStarsCount?: number;
|
|
47
|
+
showAtmosphere?: boolean;
|
|
48
|
+
showBookLabels?: boolean;
|
|
49
|
+
showChapterLabels?: boolean;
|
|
50
|
+
showDivisionLabels?: boolean;
|
|
51
|
+
showGroupLabels?: boolean;
|
|
52
|
+
groups?: Record<string, {
|
|
53
|
+
name: string;
|
|
54
|
+
start: number;
|
|
55
|
+
end: number;
|
|
56
|
+
}[]>;
|
|
57
|
+
editable?: boolean;
|
|
58
|
+
projection?: "perspective" | "stereographic" | "blended";
|
|
29
59
|
camera?: {
|
|
30
|
-
fov?: number;
|
|
31
|
-
z?: number;
|
|
32
60
|
lon?: number;
|
|
33
61
|
lat?: number;
|
|
34
62
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
fitProjection?: boolean;
|
|
64
|
+
};
|
|
65
|
+
type SceneLink = {
|
|
66
|
+
source: string;
|
|
67
|
+
target: string;
|
|
68
|
+
};
|
|
69
|
+
type ConstellationConfig = {
|
|
70
|
+
version: number;
|
|
71
|
+
atlasBasePath: string;
|
|
72
|
+
constellations: {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
type: string;
|
|
76
|
+
image: string;
|
|
77
|
+
anchors: string[];
|
|
78
|
+
center: null | [number, number];
|
|
79
|
+
radius: number;
|
|
80
|
+
rotationDeg: number;
|
|
81
|
+
opacity: number;
|
|
82
|
+
blend: string;
|
|
83
|
+
zBias: number;
|
|
84
|
+
fade: {
|
|
85
|
+
zoomInStart: number;
|
|
86
|
+
zoomInEnd: number;
|
|
87
|
+
hoverBoost: number;
|
|
88
|
+
minOpacity: number;
|
|
89
|
+
maxOpacity: number;
|
|
90
|
+
};
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
type HierarchyFilter = {
|
|
94
|
+
testament?: string;
|
|
95
|
+
division?: string;
|
|
96
|
+
bookKey?: string;
|
|
66
97
|
};
|
|
67
98
|
|
|
68
99
|
type StarMapProps = {
|
|
@@ -71,9 +102,16 @@ type StarMapProps = {
|
|
|
71
102
|
onSelect?: (node: SceneNode) => void;
|
|
72
103
|
onHover?: (node?: SceneNode) => void;
|
|
73
104
|
onArrangementChange?: (arrangement: StarArrangement) => void;
|
|
105
|
+
onFovChange?: (fov: number) => void;
|
|
74
106
|
};
|
|
75
107
|
type StarMapHandle = {
|
|
76
108
|
getFullArrangement: () => StarArrangement | undefined;
|
|
109
|
+
setHoveredBook: (id: string | null) => void;
|
|
110
|
+
setFocusedBook: (id: string | null) => void;
|
|
111
|
+
setOrderRevealEnabled: (enabled: boolean) => void;
|
|
112
|
+
setHierarchyFilter: (filter: HierarchyFilter | null) => void;
|
|
113
|
+
flyTo: (nodeId: string, targetFov?: number) => void;
|
|
114
|
+
setProjection: (id: "perspective" | "stereographic" | "blended") => void;
|
|
77
115
|
};
|
|
78
116
|
declare const StarMap: React.ForwardRefExoticComponent<StarMapProps & React.RefAttributes<StarMapHandle>>;
|
|
79
117
|
|
|
@@ -29153,4 +29191,59 @@ interface GenerateOptions {
|
|
|
29153
29191
|
declare const defaultGenerateOptions: GenerateOptions;
|
|
29154
29192
|
declare function generateArrangement(bible: BibleJSON, options?: Partial<GenerateOptions>): StarArrangement;
|
|
29155
29193
|
|
|
29156
|
-
|
|
29194
|
+
/**
|
|
29195
|
+
* Projection system inspired by Stellarium's projection architecture.
|
|
29196
|
+
*
|
|
29197
|
+
* Stellarium supports 5 projection types (Perspective, Stereographic, Mercator,
|
|
29198
|
+
* Hammer, Mollweide). We implement Perspective, Stereographic, and a Blended
|
|
29199
|
+
* mode that reproduces the original auto-blend behavior.
|
|
29200
|
+
*
|
|
29201
|
+
* Each projection maps a view-space unit direction vector to/from 2D screen
|
|
29202
|
+
* coordinates, independent of Three.js's built-in camera projection.
|
|
29203
|
+
*/
|
|
29204
|
+
type Vec3 = {
|
|
29205
|
+
x: number;
|
|
29206
|
+
y: number;
|
|
29207
|
+
z: number;
|
|
29208
|
+
};
|
|
29209
|
+
interface Projection {
|
|
29210
|
+
/** Unique key for config / serialization */
|
|
29211
|
+
readonly id: string;
|
|
29212
|
+
/** Human-readable name */
|
|
29213
|
+
readonly label: string;
|
|
29214
|
+
/** Maximum valid FOV in degrees for this projection */
|
|
29215
|
+
readonly maxFov: number;
|
|
29216
|
+
/**
|
|
29217
|
+
* Integer sent to the shader as uProjectionType.
|
|
29218
|
+
* 0 = perspective, 1 = stereographic, 2 = blended (auto)
|
|
29219
|
+
*/
|
|
29220
|
+
readonly glslProjectionType: number;
|
|
29221
|
+
/**
|
|
29222
|
+
* Forward projection: view-space unit direction -> raw projected xy.
|
|
29223
|
+
* Returns null if the point should be clipped.
|
|
29224
|
+
* The returned {x,y} are pre-scale values (caller multiplies by uScale/uAspect).
|
|
29225
|
+
* Also returns the original dir.z for clipping decisions.
|
|
29226
|
+
*/
|
|
29227
|
+
forward(dir: Vec3): {
|
|
29228
|
+
x: number;
|
|
29229
|
+
y: number;
|
|
29230
|
+
z: number;
|
|
29231
|
+
} | null;
|
|
29232
|
+
/**
|
|
29233
|
+
* Inverse projection: NDC xy (after dividing out scale/aspect) -> view-space
|
|
29234
|
+
* unit direction vector. Used for mouse picking / unprojection.
|
|
29235
|
+
*/
|
|
29236
|
+
inverse(uvX: number, uvY: number, fovRad: number): Vec3;
|
|
29237
|
+
/**
|
|
29238
|
+
* Compute the uniform scale factor for a given FOV (radians).
|
|
29239
|
+
*/
|
|
29240
|
+
getScale(fovRad: number): number;
|
|
29241
|
+
/**
|
|
29242
|
+
* Whether a view-space direction with the given z component should be clipped.
|
|
29243
|
+
*/
|
|
29244
|
+
isClipped(dirZ: number): boolean;
|
|
29245
|
+
}
|
|
29246
|
+
type ProjectionId = "perspective" | "stereographic" | "blended";
|
|
29247
|
+
declare const PROJECTIONS: Record<ProjectionId, () => Projection>;
|
|
29248
|
+
|
|
29249
|
+
export { type BibleJSON, type ConstellationConfig, type GenerateOptions, type HierarchyFilter, PROJECTIONS, type Projection, type ProjectionId, type SceneLink, type SceneModel, type SceneNode, type StarArrangement, StarMap, type StarMapConfig, type StarMapHandle, type StarMapProps, bibleToSceneModel, defaultGenerateOptions, defaultStars, generateArrangement };
|