@project-skymap/library 0.5.0 → 0.7.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.d.cts CHANGED
@@ -5,102 +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: SceneLink[];
15
+ links?: SceneLink[];
16
+ meta?: Record<string, unknown>;
22
17
  };
23
- type ConstellationItem = {
24
- id: string;
25
- title: string;
26
- type: "book" | "division" | "custom";
27
- image: string;
28
- anchors: string[];
29
- center: [number, number, number] | null;
30
- radius: number;
31
- rotationDeg: number;
32
- aspectRatio?: number;
33
- opacity: number;
34
- blend: "normal" | "additive" | "screen";
35
- zBias: number;
36
- fade: {
37
- zoomInStart: number;
38
- zoomInEnd: number;
39
- hoverBoost: number;
40
- minOpacity: number;
41
- maxOpacity: number;
18
+ type LayoutAlgorithm = "phyllotaxis" | "voronoi";
19
+ type LayoutConfig = {
20
+ algorithm: LayoutAlgorithm;
21
+ radius?: number;
22
+ voronoi?: {
23
+ width: number;
24
+ height: number;
42
25
  };
43
26
  };
44
- type ConstellationConfig = {
45
- version: number;
46
- atlasBasePath: string;
47
- constellations: ConstellationItem[];
48
- };
49
- type Vector3Arr = [number, number, number];
50
- type StarArrangement = Record<string, {
51
- position: Vector3Arr;
52
- }>;
53
- type GroupDef = {
54
- name: string;
55
- start: number;
56
- end: number;
27
+ type StarArrangement = {
28
+ [id: string]: {
29
+ position: [number, number, number];
30
+ };
57
31
  };
58
32
  type StarMapConfig = {
59
- background?: string;
60
- camera?: {
61
- fov?: number;
62
- z?: number;
63
- lon?: number;
64
- lat?: number;
65
- };
33
+ data?: any;
34
+ adapter?: (data: any) => SceneModel;
35
+ model?: SceneModel;
36
+ layout: LayoutConfig;
66
37
  arrangement?: StarArrangement;
67
- polygons?: Record<string, Vector3Arr[]>;
68
- editable?: boolean;
69
- constellations?: ConstellationConfig;
70
- groups?: Record<string, GroupDef[]>;
71
- showBookLabels?: boolean;
72
- showDivisionLabels?: boolean;
73
- showChapterLabels?: boolean;
74
- showGroupLabels?: boolean;
38
+ polygons?: Record<string, [number, number][]>;
39
+ background?: string;
40
+ labelColors?: Record<string, string>;
41
+ constellations?: any;
42
+ showConstellationArt?: boolean;
75
43
  showConstellationLines?: boolean;
76
44
  showDivisionBoundaries?: boolean;
77
- showConstellationArt?: boolean;
78
45
  showBackdropStars?: boolean;
79
46
  backdropStarsCount?: number;
80
47
  showAtmosphere?: boolean;
81
- model?: SceneModel;
82
- data?: any;
83
- adapter?: (data: any) => SceneModel;
84
- visuals?: {
85
- colorBy?: Array<{
86
- when: Record<string, unknown>;
87
- value: string;
88
- }>;
89
- sizeBy?: Array<{
90
- when: Record<string, unknown>;
91
- field: "weight";
92
- scale: [number, number];
93
- }>;
94
- };
95
- focus?: {
96
- nodeId?: string;
97
- animate?: boolean;
98
- };
99
- layout?: {
100
- mode?: "radial" | "grid" | "force" | "spherical" | "manual";
101
- radius?: number;
102
- chapterRingSpacing?: number;
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";
59
+ camera?: {
60
+ lon?: number;
61
+ lat?: number;
103
62
  };
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;
104
97
  };
105
98
 
106
99
  type StarMapProps = {
@@ -116,6 +109,9 @@ type StarMapHandle = {
116
109
  setHoveredBook: (id: string | null) => void;
117
110
  setFocusedBook: (id: string | null) => void;
118
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;
119
115
  };
120
116
  declare const StarMap: React.ForwardRefExoticComponent<StarMapProps & React.RefAttributes<StarMapHandle>>;
121
117
 
@@ -29195,4 +29191,59 @@ interface GenerateOptions {
29195
29191
  declare const defaultGenerateOptions: GenerateOptions;
29196
29192
  declare function generateArrangement(bible: BibleJSON, options?: Partial<GenerateOptions>): StarArrangement;
29197
29193
 
29198
- export { type BibleJSON, type ConstellationConfig, type GenerateOptions, type SceneLink, type SceneModel, type SceneNode, type StarArrangement, StarMap, type StarMapConfig, type StarMapHandle, type StarMapProps, bibleToSceneModel, defaultGenerateOptions, defaultStars, generateArrangement };
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";
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,102 +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: SceneLink[];
15
+ links?: SceneLink[];
16
+ meta?: Record<string, unknown>;
22
17
  };
23
- type ConstellationItem = {
24
- id: string;
25
- title: string;
26
- type: "book" | "division" | "custom";
27
- image: string;
28
- anchors: string[];
29
- center: [number, number, number] | null;
30
- radius: number;
31
- rotationDeg: number;
32
- aspectRatio?: number;
33
- opacity: number;
34
- blend: "normal" | "additive" | "screen";
35
- zBias: number;
36
- fade: {
37
- zoomInStart: number;
38
- zoomInEnd: number;
39
- hoverBoost: number;
40
- minOpacity: number;
41
- maxOpacity: number;
18
+ type LayoutAlgorithm = "phyllotaxis" | "voronoi";
19
+ type LayoutConfig = {
20
+ algorithm: LayoutAlgorithm;
21
+ radius?: number;
22
+ voronoi?: {
23
+ width: number;
24
+ height: number;
42
25
  };
43
26
  };
44
- type ConstellationConfig = {
45
- version: number;
46
- atlasBasePath: string;
47
- constellations: ConstellationItem[];
48
- };
49
- type Vector3Arr = [number, number, number];
50
- type StarArrangement = Record<string, {
51
- position: Vector3Arr;
52
- }>;
53
- type GroupDef = {
54
- name: string;
55
- start: number;
56
- end: number;
27
+ type StarArrangement = {
28
+ [id: string]: {
29
+ position: [number, number, number];
30
+ };
57
31
  };
58
32
  type StarMapConfig = {
59
- background?: string;
60
- camera?: {
61
- fov?: number;
62
- z?: number;
63
- lon?: number;
64
- lat?: number;
65
- };
33
+ data?: any;
34
+ adapter?: (data: any) => SceneModel;
35
+ model?: SceneModel;
36
+ layout: LayoutConfig;
66
37
  arrangement?: StarArrangement;
67
- polygons?: Record<string, Vector3Arr[]>;
68
- editable?: boolean;
69
- constellations?: ConstellationConfig;
70
- groups?: Record<string, GroupDef[]>;
71
- showBookLabels?: boolean;
72
- showDivisionLabels?: boolean;
73
- showChapterLabels?: boolean;
74
- showGroupLabels?: boolean;
38
+ polygons?: Record<string, [number, number][]>;
39
+ background?: string;
40
+ labelColors?: Record<string, string>;
41
+ constellations?: any;
42
+ showConstellationArt?: boolean;
75
43
  showConstellationLines?: boolean;
76
44
  showDivisionBoundaries?: boolean;
77
- showConstellationArt?: boolean;
78
45
  showBackdropStars?: boolean;
79
46
  backdropStarsCount?: number;
80
47
  showAtmosphere?: boolean;
81
- model?: SceneModel;
82
- data?: any;
83
- adapter?: (data: any) => SceneModel;
84
- visuals?: {
85
- colorBy?: Array<{
86
- when: Record<string, unknown>;
87
- value: string;
88
- }>;
89
- sizeBy?: Array<{
90
- when: Record<string, unknown>;
91
- field: "weight";
92
- scale: [number, number];
93
- }>;
94
- };
95
- focus?: {
96
- nodeId?: string;
97
- animate?: boolean;
98
- };
99
- layout?: {
100
- mode?: "radial" | "grid" | "force" | "spherical" | "manual";
101
- radius?: number;
102
- chapterRingSpacing?: number;
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";
59
+ camera?: {
60
+ lon?: number;
61
+ lat?: number;
103
62
  };
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;
104
97
  };
105
98
 
106
99
  type StarMapProps = {
@@ -116,6 +109,9 @@ type StarMapHandle = {
116
109
  setHoveredBook: (id: string | null) => void;
117
110
  setFocusedBook: (id: string | null) => void;
118
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;
119
115
  };
120
116
  declare const StarMap: React.ForwardRefExoticComponent<StarMapProps & React.RefAttributes<StarMapHandle>>;
121
117
 
@@ -29195,4 +29191,59 @@ interface GenerateOptions {
29195
29191
  declare const defaultGenerateOptions: GenerateOptions;
29196
29192
  declare function generateArrangement(bible: BibleJSON, options?: Partial<GenerateOptions>): StarArrangement;
29197
29193
 
29198
- export { type BibleJSON, type ConstellationConfig, type GenerateOptions, type SceneLink, type SceneModel, type SceneNode, type StarArrangement, StarMap, type StarMapConfig, type StarMapHandle, type StarMapProps, bibleToSceneModel, defaultGenerateOptions, defaultStars, generateArrangement };
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";
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 };