@buley/hexgrid-3d 1.0.0 → 1.1.1
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/build_log.txt +500 -0
- package/build_src_log.txt +8 -0
- package/examples/basic-usage.tsx +19 -19
- package/package.json +1 -1
- package/public/hexgrid-worker.js +2350 -1638
- package/site/.eslintrc.json +3 -0
- package/site/DEPLOYMENT.md +196 -0
- package/site/INDEX.md +127 -0
- package/site/QUICK_START.md +86 -0
- package/site/README.md +85 -0
- package/site/SITE_SUMMARY.md +180 -0
- package/site/next.config.js +12 -0
- package/site/package.json +26 -0
- package/site/src/app/docs/page.tsx +148 -0
- package/site/src/app/examples/page.tsx +133 -0
- package/site/src/app/globals.css +160 -0
- package/site/src/app/layout.tsx +29 -0
- package/site/src/app/page.tsx +163 -0
- package/site/tsconfig.json +29 -0
- package/site/vercel.json +6 -0
- package/src/Snapshot.ts +790 -585
- package/src/adapters/DashAdapter.ts +57 -0
- package/src/adapters.ts +16 -18
- package/src/algorithms/AdvancedStatistics.ts +58 -24
- package/src/algorithms/BayesianStatistics.ts +43 -12
- package/src/algorithms/FlowField.ts +30 -6
- package/src/algorithms/FlowField3D.ts +573 -0
- package/src/algorithms/FluidSimulation.ts +19 -3
- package/src/algorithms/FluidSimulation3D.ts +664 -0
- package/src/algorithms/GraphAlgorithms.ts +19 -12
- package/src/algorithms/OutlierDetection.ts +72 -38
- package/src/algorithms/ParticleSystem.ts +12 -2
- package/src/algorithms/ParticleSystem3D.ts +567 -0
- package/src/algorithms/index.ts +14 -8
- package/src/compat.ts +10 -10
- package/src/components/HexGrid.tsx +10 -23
- package/src/components/NarrationOverlay.tsx +140 -52
- package/src/components/index.ts +2 -1
- package/src/features.ts +31 -31
- package/src/index.ts +11 -11
- package/src/lib/narration.ts +17 -0
- package/src/lib/stats-tracker.ts +25 -0
- package/src/lib/theme-colors.ts +12 -0
- package/src/math/HexCoordinates.ts +849 -4
- package/src/math/Matrix4.ts +2 -12
- package/src/math/Vector3.ts +49 -1
- package/src/math/index.ts +6 -6
- package/src/note-adapter.ts +50 -42
- package/src/ontology-adapter.ts +30 -23
- package/src/stores/uiStore.ts +34 -34
- package/src/types/shared-utils.d.ts +10 -0
- package/src/types.ts +110 -98
- package/src/utils/image-utils.ts +9 -6
- package/src/wasm/HexGridWasmWrapper.ts +436 -388
- package/src/wasm/index.ts +2 -2
- package/src/workers/hexgrid-math.ts +40 -35
- package/src/workers/hexgrid-worker.worker.ts +1992 -1018
- package/tsconfig.json +21 -14
package/src/types.ts
CHANGED
|
@@ -2,68 +2,69 @@
|
|
|
2
2
|
* Type definitions for HexGrid Visualization
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { RefObject } from 'react'
|
|
6
|
-
import type { HexGridFeatureFlags } from './features'
|
|
5
|
+
import type { RefObject } from 'react';
|
|
6
|
+
import type { HexGridFeatureFlags } from './features';
|
|
7
|
+
export type { HexGridFeatureFlags } from './features';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Photo type for HexGrid visualization
|
|
10
|
-
*
|
|
11
|
+
*
|
|
11
12
|
* This is the unified Photo type used throughout the hexgrid-3d package.
|
|
12
13
|
* It includes all fields needed for display, media playback, and analytics.
|
|
13
14
|
*/
|
|
14
15
|
export interface Photo {
|
|
15
|
-
id: string
|
|
16
|
-
title: string
|
|
17
|
-
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
|
|
18
19
|
// Image URLs - imageUrl is primary, url is for backward compatibility
|
|
19
|
-
imageUrl: string
|
|
20
|
-
url?: string
|
|
21
|
-
thumbnailUrl?: string
|
|
22
|
-
|
|
20
|
+
imageUrl: string;
|
|
21
|
+
url?: string; // Alias for imageUrl (backward compatibility)
|
|
22
|
+
thumbnailUrl?: string;
|
|
23
|
+
|
|
23
24
|
// Display metadata
|
|
24
|
-
alt: string
|
|
25
|
-
category: string
|
|
26
|
-
description?: string
|
|
27
|
-
|
|
25
|
+
alt: string;
|
|
26
|
+
category: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
|
|
28
29
|
// Source information
|
|
29
|
-
source: string
|
|
30
|
-
sourceUrl?: string
|
|
31
|
-
createdAt?: string
|
|
32
|
-
|
|
30
|
+
source: string;
|
|
31
|
+
sourceUrl?: string;
|
|
32
|
+
createdAt?: string;
|
|
33
|
+
|
|
33
34
|
// Shop integration
|
|
34
|
-
shopUrl?: string
|
|
35
|
-
location?: string
|
|
36
|
-
|
|
35
|
+
shopUrl?: string;
|
|
36
|
+
location?: string;
|
|
37
|
+
|
|
37
38
|
// Media type flags
|
|
38
|
-
isVideo?: boolean
|
|
39
|
-
videoUrl?: string
|
|
40
|
-
isTweet?: boolean
|
|
41
|
-
tweetUrl?: string
|
|
42
|
-
redditUrl?: string
|
|
43
|
-
durationSeconds?: number
|
|
44
|
-
|
|
39
|
+
isVideo?: boolean;
|
|
40
|
+
videoUrl?: string;
|
|
41
|
+
isTweet?: boolean;
|
|
42
|
+
tweetUrl?: string;
|
|
43
|
+
redditUrl?: string;
|
|
44
|
+
durationSeconds?: number;
|
|
45
|
+
|
|
45
46
|
// Competition/ranking system
|
|
46
|
-
velocity?: number
|
|
47
|
-
|
|
47
|
+
velocity?: number; // Normalized velocity [0.1, 1.0] for meritocratic competition
|
|
48
|
+
|
|
48
49
|
// User info
|
|
49
|
-
userId?: string
|
|
50
|
-
username?: string
|
|
51
|
-
platform?: string
|
|
52
|
-
author?: string
|
|
53
|
-
authorUrl?: string
|
|
54
|
-
|
|
50
|
+
userId?: string;
|
|
51
|
+
username?: string;
|
|
52
|
+
platform?: string;
|
|
53
|
+
author?: string;
|
|
54
|
+
authorUrl?: string;
|
|
55
|
+
|
|
55
56
|
// Metrics for analytics
|
|
56
|
-
views?: number
|
|
57
|
-
likes?: number
|
|
58
|
-
comments?: number
|
|
59
|
-
shares?: number
|
|
60
|
-
upvotes?: number
|
|
61
|
-
retweets?: number
|
|
62
|
-
replies?: number
|
|
63
|
-
age_in_hours?: number
|
|
64
|
-
|
|
57
|
+
views?: number;
|
|
58
|
+
likes?: number;
|
|
59
|
+
comments?: number;
|
|
60
|
+
shares?: number;
|
|
61
|
+
upvotes?: number;
|
|
62
|
+
retweets?: number;
|
|
63
|
+
replies?: number;
|
|
64
|
+
age_in_hours?: number;
|
|
65
|
+
|
|
65
66
|
// Visual
|
|
66
|
-
dominantColor?: string
|
|
67
|
+
dominantColor?: string;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/**
|
|
@@ -72,81 +73,92 @@ export interface Photo {
|
|
|
72
73
|
*/
|
|
73
74
|
export interface GridItem<T = unknown> {
|
|
74
75
|
// Core identification
|
|
75
|
-
id: string
|
|
76
|
-
type: string // 'photo' | 'note' | 'emotion' | 'ontology-entity' | 'custom'
|
|
76
|
+
id: string;
|
|
77
|
+
type: string; // 'photo' | 'note' | 'emotion' | 'ontology-entity' | 'custom'
|
|
77
78
|
|
|
78
79
|
// Visual representation (optional - allows non-visual items)
|
|
79
|
-
imageUrl?: string
|
|
80
|
-
thumbnailUrl?: string
|
|
81
|
-
videoUrl?: string
|
|
80
|
+
imageUrl?: string;
|
|
81
|
+
thumbnailUrl?: string;
|
|
82
|
+
videoUrl?: string;
|
|
82
83
|
|
|
83
84
|
// Display metadata
|
|
84
|
-
title?: string
|
|
85
|
-
alt?: string
|
|
86
|
-
description?: string
|
|
87
|
-
category?: string
|
|
85
|
+
title?: string;
|
|
86
|
+
alt?: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
category?: string;
|
|
88
89
|
|
|
89
90
|
// Embedded data object (preserves original type)
|
|
90
|
-
data?: T
|
|
91
|
+
data?: T;
|
|
91
92
|
|
|
92
93
|
// Ontology metadata (optional, for ontology-aware items)
|
|
93
94
|
ontologyMetadata?: {
|
|
94
|
-
entityId?: string
|
|
95
|
-
entityType?: string | string[]
|
|
96
|
-
properties?: Record<string, unknown
|
|
95
|
+
entityId?: string;
|
|
96
|
+
entityType?: string | string[];
|
|
97
|
+
properties?: Record<string, unknown>;
|
|
97
98
|
provenance?: {
|
|
98
|
-
source: string
|
|
99
|
-
extractedAt: string
|
|
100
|
-
confidence: number
|
|
101
|
-
}
|
|
102
|
-
}
|
|
99
|
+
source: string;
|
|
100
|
+
extractedAt: string;
|
|
101
|
+
confidence: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
103
104
|
|
|
104
105
|
// Grid behavior
|
|
105
|
-
velocity?: number
|
|
106
|
-
source?: string
|
|
107
|
-
sourceUrl?: string
|
|
108
|
-
createdAt?: string
|
|
106
|
+
velocity?: number;
|
|
107
|
+
source?: string;
|
|
108
|
+
sourceUrl?: string;
|
|
109
|
+
createdAt?: string;
|
|
109
110
|
|
|
110
111
|
// Metrics (flexible for any data type)
|
|
111
|
-
metrics?: Record<string, number
|
|
112
|
+
metrics?: Record<string, number>;
|
|
112
113
|
|
|
113
114
|
// Legacy Photo fields (for backward compatibility)
|
|
114
|
-
url?: string // Maps to imageUrl
|
|
115
|
-
userId?: string
|
|
116
|
-
username?: string
|
|
117
|
-
platform?: string
|
|
118
|
-
author?: string
|
|
119
|
-
authorUrl?: string
|
|
120
|
-
likes?: number
|
|
121
|
-
views?: number
|
|
122
|
-
comments?: number
|
|
123
|
-
dominantColor?: string
|
|
115
|
+
url?: string; // Maps to imageUrl
|
|
116
|
+
userId?: string;
|
|
117
|
+
username?: string;
|
|
118
|
+
platform?: string;
|
|
119
|
+
author?: string;
|
|
120
|
+
authorUrl?: string;
|
|
121
|
+
likes?: number;
|
|
122
|
+
views?: number;
|
|
123
|
+
comments?: number;
|
|
124
|
+
dominantColor?: string;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
export interface HexGridProps {
|
|
127
|
-
photos: Photo[]
|
|
128
|
-
onHexClick?: (photo: Photo) => void
|
|
129
|
-
spacing?: number
|
|
130
|
-
canvasRef?: RefObject<HTMLCanvasElement
|
|
131
|
-
onLeaderboardUpdate?: (leaderboard: any) => void
|
|
132
|
-
autoplayQueueLimit?: number
|
|
133
|
-
onAutoplayQueueLimitChange?: (limit: number) => void
|
|
134
|
-
modalOpen?: boolean
|
|
135
|
-
userId?: string
|
|
136
|
-
username?: string
|
|
137
|
-
featureFlags?: HexGridFeatureFlags
|
|
128
|
+
photos: Photo[];
|
|
129
|
+
onHexClick?: (photo: Photo) => void;
|
|
130
|
+
spacing?: number;
|
|
131
|
+
canvasRef?: RefObject<HTMLCanvasElement>;
|
|
132
|
+
onLeaderboardUpdate?: (leaderboard: any) => void;
|
|
133
|
+
autoplayQueueLimit?: number;
|
|
134
|
+
onAutoplayQueueLimitChange?: (limit: number) => void;
|
|
135
|
+
modalOpen?: boolean;
|
|
136
|
+
userId?: string;
|
|
137
|
+
username?: string;
|
|
138
|
+
featureFlags?: HexGridFeatureFlags;
|
|
139
|
+
enableEnhanced?: boolean;
|
|
140
|
+
enhancedConfig?: {
|
|
141
|
+
useWasm?: boolean;
|
|
142
|
+
enableParticles?: boolean;
|
|
143
|
+
enableFlowField?: boolean;
|
|
144
|
+
};
|
|
145
|
+
onTerritoryEvent?: (event: {
|
|
146
|
+
type: 'conquest' | 'birth' | 'death';
|
|
147
|
+
toOwner: number;
|
|
148
|
+
fromOwner?: number;
|
|
149
|
+
}) => Promise<void>;
|
|
138
150
|
}
|
|
139
151
|
|
|
140
152
|
export interface UIState {
|
|
141
|
-
debugOpen: boolean
|
|
142
|
-
showStats: boolean
|
|
143
|
-
cameraOpen: boolean
|
|
144
|
-
showNarration: boolean
|
|
153
|
+
debugOpen: boolean;
|
|
154
|
+
showStats: boolean;
|
|
155
|
+
cameraOpen: boolean;
|
|
156
|
+
showNarration: boolean;
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
export interface WorkerDebug {
|
|
148
|
-
curveUDeg: number
|
|
149
|
-
curveVDeg: number
|
|
150
|
-
batchPerFrame: number
|
|
151
|
-
[key: string]: any
|
|
160
|
+
curveUDeg: number;
|
|
161
|
+
curveVDeg: number;
|
|
162
|
+
batchPerFrame: number;
|
|
163
|
+
[key: string]: any;
|
|
152
164
|
}
|
package/src/utils/image-utils.ts
CHANGED
|
@@ -12,14 +12,17 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export function getProxiedImageUrl(imageUrl: string): string {
|
|
14
14
|
if (!imageUrl || typeof imageUrl !== 'string') {
|
|
15
|
-
return imageUrl
|
|
15
|
+
return imageUrl;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
// Only proxy preview.redd.it URLs (they have CORS issues)
|
|
19
19
|
// external-preview.redd.it URLs work fine, so don't proxy them
|
|
20
|
-
if (
|
|
21
|
-
|
|
20
|
+
if (
|
|
21
|
+
imageUrl.includes('preview.redd.it') &&
|
|
22
|
+
!imageUrl.includes('external-preview.redd.it')
|
|
23
|
+
) {
|
|
24
|
+
return `/api/proxy-image?url=${encodeURIComponent(imageUrl)}`;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
return imageUrl
|
|
26
|
+
|
|
27
|
+
return imageUrl;
|
|
25
28
|
}
|