@buley/hexgrid-3d 3.5.1 → 3.6.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.
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { type HexTerritoryCell } from './globe';
3
+ export interface HexTerritoryGlobeProps {
4
+ cells: HexTerritoryCell[];
5
+ selectedCellId?: string | null;
6
+ hoverCellId?: string | null;
7
+ claimedCellIds?: Iterable<string>;
8
+ lockedCellIds?: Iterable<string>;
9
+ colorsByCellId?: Record<string, string>;
10
+ tileRadius?: number;
11
+ onSelectCell?: (cell: HexTerritoryCell) => void;
12
+ onHoverCell?: (cell: HexTerritoryCell | null) => void;
13
+ }
14
+ export declare function HexTerritoryGlobe({ cells, selectedCellId, hoverCellId, claimedCellIds, lockedCellIds, colorsByCellId, tileRadius, onSelectCell, onHoverCell, }: HexTerritoryGlobeProps): React.JSX.Element;
15
+ //# sourceMappingURL=HexTerritoryGlobe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HexTerritoryGlobe.d.ts","sourceRoot":"","sources":["../../src/territory/HexTerritoryGlobe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAgC,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;CACvD;AAMD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,cAAqB,EACrB,WAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,EAAE,sBAAsB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6F5C"}
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef } from 'react';
3
+ import { Color, CircleGeometry, Matrix4, Object3D } from 'three';
4
+ import { calculateAutoTileRadiusByRow } from './globe';
5
+ function asSet(values) {
6
+ return values ? new Set(values) : new Set();
7
+ }
8
+ export function HexTerritoryGlobe({ cells, selectedCellId = null, hoverCellId = null, claimedCellIds, lockedCellIds, colorsByCellId, tileRadius, onSelectCell, onHoverCell, }) {
9
+ const meshRef = useRef(null);
10
+ const geometry = useMemo(() => new CircleGeometry(1, 6), []);
11
+ const workingObject = useMemo(() => new Object3D(), []);
12
+ const claimed = useMemo(() => asSet(claimedCellIds), [claimedCellIds]);
13
+ const locked = useMemo(() => asSet(lockedCellIds), [lockedCellIds]);
14
+ const autoTileRadiusByRow = useMemo(() => tileRadius === undefined ? calculateAutoTileRadiusByRow(cells) : undefined, [cells, tileRadius]);
15
+ useEffect(() => {
16
+ const mesh = meshRef.current;
17
+ if (!mesh) {
18
+ return;
19
+ }
20
+ const matrix = new Matrix4();
21
+ cells.forEach((cell, index) => {
22
+ const point = cell.surfacePoint;
23
+ const effectiveTileRadius = tileRadius ?? autoTileRadiusByRow?.get(cell.rowIndex) ?? 0;
24
+ workingObject.position.set(point.x, point.y, point.z);
25
+ workingObject.lookAt(point.x * 2, point.y * 2, point.z * 2);
26
+ workingObject.scale.setScalar(effectiveTileRadius);
27
+ workingObject.updateMatrix();
28
+ matrix.copy(workingObject.matrix);
29
+ mesh.setMatrixAt(index, matrix);
30
+ const baseColor = locked.has(cell.cellId)
31
+ ? '#23345c'
32
+ : colorsByCellId?.[cell.cellId] ??
33
+ (selectedCellId === cell.cellId
34
+ ? '#7ee7ff'
35
+ : hoverCellId === cell.cellId
36
+ ? '#59d0ff'
37
+ : claimed.has(cell.cellId)
38
+ ? '#63f2c6'
39
+ : '#1f2a4a');
40
+ mesh.setColorAt(index, new Color(baseColor));
41
+ });
42
+ mesh.instanceMatrix.needsUpdate = true;
43
+ if (mesh.instanceColor) {
44
+ mesh.instanceColor.needsUpdate = true;
45
+ }
46
+ }, [
47
+ cells,
48
+ claimed,
49
+ colorsByCellId,
50
+ hoverCellId,
51
+ locked,
52
+ selectedCellId,
53
+ tileRadius,
54
+ autoTileRadiusByRow,
55
+ workingObject,
56
+ ]);
57
+ return (_jsx("instancedMesh", { ref: meshRef, args: [geometry, undefined, cells.length], onClick: (event) => {
58
+ if (typeof event.instanceId !== 'number') {
59
+ return;
60
+ }
61
+ const cell = cells[event.instanceId];
62
+ if (cell) {
63
+ onSelectCell?.(cell);
64
+ }
65
+ }, onPointerMove: (event) => {
66
+ if (typeof event.instanceId !== 'number') {
67
+ onHoverCell?.(null);
68
+ return;
69
+ }
70
+ const cell = cells[event.instanceId];
71
+ onHoverCell?.(cell ?? null);
72
+ }, onPointerOut: () => {
73
+ onHoverCell?.(null);
74
+ }, children: _jsx("meshStandardMaterial", { transparent: true, opacity: 0.92, metalness: 0.14, roughness: 0.42 }) }));
75
+ }
@@ -0,0 +1,54 @@
1
+ export interface CanonicalHexGlobeConfig {
2
+ boardId: string;
3
+ curveUDeg: number;
4
+ curveVDeg: number;
5
+ rowCount: number;
6
+ equatorColumns: number;
7
+ minimumColumnsPerRow: number;
8
+ poleMinScale: number;
9
+ sphereRadius?: number;
10
+ }
11
+ export type HexSubdivisionSegment = 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ export type HexNodePath = HexSubdivisionSegment[];
13
+ export type HexwarEmbedProvider = 'youtube' | 'x' | 'instagram' | 'threads' | 'tiktok';
14
+ export interface HexwarEmbedRef {
15
+ provider: HexwarEmbedProvider;
16
+ submittedUrl: string;
17
+ canonicalUrl: string;
18
+ kind: 'video' | 'post' | 'thread' | 'short' | 'reel';
19
+ title?: string;
20
+ authorName?: string;
21
+ thumbnailUrl?: string;
22
+ embedAllowed: boolean;
23
+ }
24
+ export interface HexTerritoryTickState {
25
+ stage: 'dormant' | 'active' | 'surging' | 'entrenched' | 'fading';
26
+ energy: number;
27
+ pressure: number;
28
+ cohesion: number;
29
+ lastResolvedAt: number;
30
+ }
31
+ export interface HexTerritoryCellPoint {
32
+ x: number;
33
+ y: number;
34
+ z: number;
35
+ }
36
+ export interface HexTerritoryCell {
37
+ cellId: string;
38
+ rowIndex: number;
39
+ columnIndex: number;
40
+ columnCount: number;
41
+ lat: number;
42
+ lon: number;
43
+ surfacePoint: HexTerritoryCellPoint;
44
+ neighborCellIds: string[];
45
+ }
46
+ export interface HexTerritoryBoard {
47
+ boardId: string;
48
+ config: CanonicalHexGlobeConfig;
49
+ configHash: string;
50
+ cells: HexTerritoryCell[];
51
+ }
52
+ export declare function generateCanonicalHexGlobe(config: CanonicalHexGlobeConfig): HexTerritoryBoard;
53
+ export declare function calculateAutoTileRadiusByRow(cells: readonly HexTerritoryCell[]): Map<number, number>;
54
+ //# sourceMappingURL=globe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globe.d.ts","sourceRoot":"","sources":["../../src/territory/globe.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,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,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,uBAAuB,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AA2HD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,uBAAuB,GAC9B,iBAAiB,CAoDnB;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,SAAS,gBAAgB,EAAE,GACjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiErB"}
@@ -0,0 +1,180 @@
1
+ const boardCache = new Map();
2
+ const HEX_HORIZONTAL_RADIUS_RATIO = Math.sqrt(3);
3
+ const HEX_VERTICAL_RADIUS_RATIO = 1.5;
4
+ const TERRITORY_TILE_RADIUS_SAFETY_MARGIN = 0.96;
5
+ function toRadians(value) {
6
+ return (value * Math.PI) / 180;
7
+ }
8
+ function normalizeLongitude(value) {
9
+ let next = value;
10
+ while (next < -180) {
11
+ next += 360;
12
+ }
13
+ while (next >= 180) {
14
+ next -= 360;
15
+ }
16
+ return next;
17
+ }
18
+ function buildConfigHash(config) {
19
+ return [
20
+ config.boardId,
21
+ config.curveUDeg,
22
+ config.curveVDeg,
23
+ config.rowCount,
24
+ config.equatorColumns,
25
+ config.minimumColumnsPerRow,
26
+ config.poleMinScale,
27
+ config.sphereRadius ?? 1,
28
+ ].join(':');
29
+ }
30
+ function toSurfacePoint(lat, lon, sphereRadius) {
31
+ const latRadians = toRadians(lat);
32
+ const lonRadians = toRadians(lon);
33
+ const cosLat = Math.cos(latRadians);
34
+ return {
35
+ x: sphereRadius * cosLat * Math.cos(lonRadians),
36
+ y: sphereRadius * Math.sin(latRadians),
37
+ z: sphereRadius * cosLat * Math.sin(lonRadians),
38
+ };
39
+ }
40
+ function shortestWrappedDistance(a, b) {
41
+ const delta = Math.abs(a - b);
42
+ return Math.min(delta, 360 - delta);
43
+ }
44
+ function pointDistance(left, right) {
45
+ const dx = left.x - right.x;
46
+ const dy = left.y - right.y;
47
+ const dz = left.z - right.z;
48
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
49
+ }
50
+ function columnCountForLatitude(latitude, config) {
51
+ const cosScale = Math.abs(Math.cos(toRadians(latitude)));
52
+ const scaled = Math.max(config.poleMinScale, cosScale);
53
+ return Math.max(config.minimumColumnsPerRow, Math.round(config.equatorColumns * scaled));
54
+ }
55
+ function findClosestColumns(rowCells, lon) {
56
+ const ranked = rowCells
57
+ .map((cell) => ({
58
+ cell,
59
+ distance: shortestWrappedDistance(cell.lon, lon),
60
+ }))
61
+ .sort((left, right) => left.distance - right.distance);
62
+ return ranked.slice(0, Math.min(3, ranked.length)).map((item) => item.cell);
63
+ }
64
+ function buildNeighbors(cell, rows) {
65
+ const currentRow = rows[cell.rowIndex] ?? [];
66
+ const neighborIds = new Set();
67
+ const sameRowCount = currentRow.length;
68
+ if (sameRowCount > 1) {
69
+ const left = currentRow[(cell.columnIndex - 1 + sameRowCount) % sameRowCount] ?? null;
70
+ const right = currentRow[(cell.columnIndex + 1) % sameRowCount] ?? null;
71
+ if (left) {
72
+ neighborIds.add(left.cellId);
73
+ }
74
+ if (right) {
75
+ neighborIds.add(right.cellId);
76
+ }
77
+ }
78
+ const adjacentRows = [cell.rowIndex - 1, cell.rowIndex + 1];
79
+ for (const rowIndex of adjacentRows) {
80
+ const row = rows[rowIndex] ?? [];
81
+ for (const adjacent of findClosestColumns(row, cell.lon)) {
82
+ neighborIds.add(adjacent.cellId);
83
+ }
84
+ }
85
+ return Array.from(neighborIds);
86
+ }
87
+ export function generateCanonicalHexGlobe(config) {
88
+ const configHash = buildConfigHash(config);
89
+ const cached = boardCache.get(configHash);
90
+ if (cached) {
91
+ return cached;
92
+ }
93
+ const sphereRadius = config.sphereRadius ?? 1;
94
+ const rows = [];
95
+ for (let rowIndex = 0; rowIndex < config.rowCount; rowIndex += 1) {
96
+ const latitudeProgress = config.rowCount <= 1 ? 0 : rowIndex / (config.rowCount - 1);
97
+ const lat = -90 + latitudeProgress * 180;
98
+ const columnCount = columnCountForLatitude(lat, config);
99
+ const lonStep = 360 / columnCount;
100
+ const lonOffset = rowIndex % 2 === 0 ? 0 : lonStep / 2;
101
+ const rowCells = [];
102
+ for (let columnIndex = 0; columnIndex < columnCount; columnIndex += 1) {
103
+ const lon = normalizeLongitude(-180 + lonOffset + columnIndex * lonStep + lonStep / 2);
104
+ rowCells.push({
105
+ cellId: `${config.boardId}:r${rowIndex}:c${columnIndex}`,
106
+ rowIndex,
107
+ columnIndex,
108
+ columnCount,
109
+ lat,
110
+ lon,
111
+ surfacePoint: toSurfacePoint(lat, lon, sphereRadius),
112
+ neighborCellIds: [],
113
+ });
114
+ }
115
+ rows.push(rowCells);
116
+ }
117
+ for (const row of rows) {
118
+ for (const cell of row) {
119
+ cell.neighborCellIds = buildNeighbors(cell, rows);
120
+ }
121
+ }
122
+ const board = {
123
+ boardId: config.boardId,
124
+ config,
125
+ configHash,
126
+ cells: rows.flat(),
127
+ };
128
+ boardCache.set(configHash, board);
129
+ return board;
130
+ }
131
+ export function calculateAutoTileRadiusByRow(cells) {
132
+ const rowMap = new Map();
133
+ const cellById = new Map();
134
+ for (const cell of cells) {
135
+ const row = rowMap.get(cell.rowIndex);
136
+ if (row) {
137
+ row.push(cell);
138
+ }
139
+ else {
140
+ rowMap.set(cell.rowIndex, [cell]);
141
+ }
142
+ cellById.set(cell.cellId, cell);
143
+ }
144
+ const radiusByRow = new Map();
145
+ for (const [rowIndex, unsortedRow] of rowMap.entries()) {
146
+ const row = [...unsortedRow].sort((left, right) => left.columnIndex - right.columnIndex);
147
+ let minimumSameRowDistance = Number.POSITIVE_INFINITY;
148
+ let minimumAdjacentRowDistance = Number.POSITIVE_INFINITY;
149
+ if (row.length > 1) {
150
+ for (let columnIndex = 0; columnIndex < row.length; columnIndex += 1) {
151
+ const current = row[columnIndex];
152
+ const next = row[(columnIndex + 1) % row.length];
153
+ if (current && next) {
154
+ minimumSameRowDistance = Math.min(minimumSameRowDistance, pointDistance(current.surfacePoint, next.surfacePoint));
155
+ }
156
+ }
157
+ }
158
+ for (const cell of row) {
159
+ for (const neighborId of cell.neighborCellIds) {
160
+ const neighbor = cellById.get(neighborId);
161
+ if (!neighbor || Math.abs(neighbor.rowIndex - rowIndex) !== 1) {
162
+ continue;
163
+ }
164
+ minimumAdjacentRowDistance = Math.min(minimumAdjacentRowDistance, pointDistance(cell.surfacePoint, neighbor.surfacePoint));
165
+ }
166
+ }
167
+ const horizontalRadius = Number.isFinite(minimumSameRowDistance)
168
+ ? minimumSameRowDistance / HEX_HORIZONTAL_RADIUS_RATIO
169
+ : Number.POSITIVE_INFINITY;
170
+ const verticalRadius = Number.isFinite(minimumAdjacentRowDistance)
171
+ ? minimumAdjacentRowDistance / HEX_VERTICAL_RADIUS_RATIO
172
+ : Number.POSITIVE_INFINITY;
173
+ const unconstrainedRadius = Math.min(horizontalRadius, verticalRadius);
174
+ const safeRadius = Number.isFinite(unconstrainedRadius) && unconstrainedRadius > 0
175
+ ? unconstrainedRadius * TERRITORY_TILE_RADIUS_SAFETY_MARGIN
176
+ : 0;
177
+ radiusByRow.set(rowIndex, safeRadius);
178
+ }
179
+ return radiusByRow;
180
+ }
@@ -0,0 +1,4 @@
1
+ export * from './globe';
2
+ export * from './narration';
3
+ export * from './HexTerritoryGlobe';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/territory/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './globe';
2
+ export * from './narration';
3
+ export * from './HexTerritoryGlobe';
@@ -0,0 +1,12 @@
1
+ import type { NarrationMessage } from '../lib/narration';
2
+ export type HexwarNarrationEventType = 'claim' | 'embed_set' | 'delegation_issued' | 'delegation_revoked' | 'unlock' | 'tick_surged' | 'tick_entrenched' | 'leaderboard_flip';
3
+ export interface HexwarNarrationEvent {
4
+ id: string;
5
+ eventType: HexwarNarrationEventType;
6
+ occurredAtMs: number;
7
+ actorName?: string;
8
+ cellId?: string;
9
+ details?: Record<string, string | number | boolean | null | undefined>;
10
+ }
11
+ export declare function createHexwarNarrationAdapter(events: HexwarNarrationEvent[]): NarrationMessage[];
12
+ //# sourceMappingURL=narration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"narration.d.ts","sourceRoot":"","sources":["../../src/territory/narration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAChC,OAAO,GACP,WAAW,GACX,mBAAmB,GACnB,oBAAoB,GACpB,QAAQ,GACR,aAAa,GACb,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,wBAAwB,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACxE;AAgDD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,EAAE,GAC7B,gBAAgB,EAAE,CAmDpB"}
@@ -0,0 +1,84 @@
1
+ function priorityForEvent(eventType) {
2
+ switch (eventType) {
3
+ case 'leaderboard_flip':
4
+ case 'unlock':
5
+ return 9;
6
+ case 'tick_surged':
7
+ case 'tick_entrenched':
8
+ return 8;
9
+ case 'claim':
10
+ return 7;
11
+ case 'delegation_issued':
12
+ case 'delegation_revoked':
13
+ return 6;
14
+ case 'embed_set':
15
+ return 5;
16
+ default:
17
+ return 4;
18
+ }
19
+ }
20
+ function formatSingleEvent(event) {
21
+ const actor = event.actorName ? `${event.actorName} ` : '';
22
+ const cell = event.cellId ? ` ${event.cellId}` : '';
23
+ switch (event.eventType) {
24
+ case 'claim':
25
+ return `${actor}claimed root${cell}.`.trim();
26
+ case 'embed_set':
27
+ return `${actor}repointed the frontier payload${cell}.`.trim();
28
+ case 'delegation_issued':
29
+ return `${actor}delegated subhex control${cell}.`.trim();
30
+ case 'delegation_revoked':
31
+ return `${actor}revoked delegated control${cell}.`.trim();
32
+ case 'unlock':
33
+ return `A new latitude band unlocked${cell}.`.trim();
34
+ case 'tick_surged':
35
+ return `Hourly pressure pushed${cell} into surge state.`.trim();
36
+ case 'tick_entrenched':
37
+ return `${cell.trim()} entrenched after the latest tick.`.trim();
38
+ case 'leaderboard_flip':
39
+ return `The leaderboard flipped after the latest tick.`.trim();
40
+ default:
41
+ return 'Frontier activity updated.';
42
+ }
43
+ }
44
+ export function createHexwarNarrationAdapter(events) {
45
+ if (events.length === 0) {
46
+ return [];
47
+ }
48
+ const sorted = [...events].sort((left, right) => left.occurredAtMs - right.occurredAtMs);
49
+ const messages = [];
50
+ let currentBurst = [];
51
+ for (const event of sorted) {
52
+ const previous = currentBurst[currentBurst.length - 1];
53
+ const isBurstContinuation = previous &&
54
+ previous.eventType === event.eventType &&
55
+ event.occurredAtMs - previous.occurredAtMs <= 30000;
56
+ if (!isBurstContinuation && currentBurst.length > 0) {
57
+ const first = currentBurst[0];
58
+ messages.push({
59
+ generation: 0,
60
+ timestamp: new Date(first.occurredAtMs).toISOString(),
61
+ priority: priorityForEvent(first.eventType),
62
+ text: currentBurst.length === 1
63
+ ? formatSingleEvent(first)
64
+ : `${currentBurst.length} ${first.eventType.replace(/_/g, ' ')} events rippled across the frontier.`,
65
+ eventType: first.eventType,
66
+ });
67
+ currentBurst = [];
68
+ }
69
+ currentBurst.push(event);
70
+ }
71
+ if (currentBurst.length > 0) {
72
+ const first = currentBurst[0];
73
+ messages.push({
74
+ generation: 0,
75
+ timestamp: new Date(first.occurredAtMs).toISOString(),
76
+ priority: priorityForEvent(first.eventType),
77
+ text: currentBurst.length === 1
78
+ ? formatSingleEvent(first)
79
+ : `${currentBurst.length} ${first.eventType.replace(/_/g, ' ')} events rippled across the frontier.`,
80
+ eventType: first.eventType,
81
+ });
82
+ }
83
+ return messages;
84
+ }
package/dist/types.d.ts CHANGED
@@ -123,4 +123,169 @@ export interface WorkerDebug {
123
123
  batchPerFrame: number;
124
124
  [key: string]: any;
125
125
  }
126
+ /** Built-in 3D primitive shapes for game pieces */
127
+ export type PieceShape = 'sphere' | 'cube' | 'cone' | 'cylinder' | 'pyramid' | 'torus' | 'ring' | 'flag' | 'star' | 'diamond' | 'capsule' | 'octahedron' | 'dodecahedron' | 'icosahedron';
128
+ /** Animation presets that can be applied to game pieces */
129
+ export type PieceAnimation = 'none' | 'spin' | 'bob' | 'pulse' | 'wobble' | 'orbit' | 'glow';
130
+ /** Animation configuration */
131
+ export interface PieceAnimationConfig {
132
+ type: PieceAnimation;
133
+ speed?: number;
134
+ amplitude?: number;
135
+ axis?: [number, number, number];
136
+ phase?: number;
137
+ }
138
+ /**
139
+ * A game piece placed on a hex cell.
140
+ *
141
+ * Supports three rendering modes:
142
+ * 1. **Primitive shape** — set `shape` to a PieceShape string.
143
+ * 2. **Custom Three.js Object3D** — set `object3D` to any Object3D instance.
144
+ * The renderer will clone it and place it on the hex surface.
145
+ * 3. **GLTF/GLB model URL** — set `modelUrl` to a URL pointing to a .glb/.gltf.
146
+ * The renderer loads it asynchronously and caches the geometry.
147
+ */
148
+ export interface GamePiece {
149
+ id: string;
150
+ shape?: PieceShape;
151
+ /** Arbitrary Three.js Object3D (mesh, group, sprite, etc.) */
152
+ object3D?: unknown;
153
+ /** URL to a .glb / .gltf model */
154
+ modelUrl?: string;
155
+ color?: string;
156
+ emissive?: string;
157
+ emissiveIntensity?: number;
158
+ opacity?: number;
159
+ metalness?: number;
160
+ roughness?: number;
161
+ wireframe?: boolean;
162
+ scale?: number | [number, number, number];
163
+ offsetY?: number;
164
+ rotationY?: number;
165
+ animation?: PieceAnimation | PieceAnimationConfig;
166
+ label?: string;
167
+ labelColor?: string;
168
+ tooltip?: string;
169
+ count?: number;
170
+ stackStyle?: 'badge' | 'stack' | 'ring';
171
+ interactive?: boolean;
172
+ draggable?: boolean;
173
+ layer?: number;
174
+ group?: string;
175
+ }
176
+ /** Fog of war visibility levels */
177
+ export type FogLevel = 'visible' | 'explored' | 'dim' | 'hidden';
178
+ /** Cell highlight modes */
179
+ export type CellHighlight = 'none' | 'selected' | 'hover' | 'attack-target' | 'move-target' | 'great-circle' | 'path' | 'danger' | 'friendly' | 'contested' | string;
180
+ /** Border style for cell outlines */
181
+ export interface CellBorder {
182
+ color: string;
183
+ width?: number;
184
+ style?: 'solid' | 'dashed' | 'glow' | 'pulse';
185
+ emissive?: boolean;
186
+ }
187
+ /**
188
+ * Complete game state for a single cell on the sphere.
189
+ * Pass a `Map<number, CellGameState>` to GameSphere to overlay game state on the geodesic grid.
190
+ */
191
+ export interface CellGameState {
192
+ ownerId?: string;
193
+ ownerColor?: string;
194
+ ownerColorIntensity?: number;
195
+ pieces?: GamePiece[];
196
+ fogLevel?: FogLevel;
197
+ highlight?: CellHighlight;
198
+ highlightColor?: string;
199
+ highlightIntensity?: number;
200
+ border?: CellBorder;
201
+ terrainType?: string;
202
+ terrainColor?: string;
203
+ cellLabel?: string;
204
+ cellLabelColor?: string;
205
+ cellLabelSize?: number;
206
+ elevation?: number;
207
+ isPentagon?: boolean;
208
+ data?: Record<string, unknown>;
209
+ }
210
+ /**
211
+ * Configuration for the GameSphere's visual appearance.
212
+ */
213
+ export interface GameSphereConfig {
214
+ subdivisions?: number;
215
+ sphereRadius?: number;
216
+ cameraDistance?: number;
217
+ cameraFov?: number;
218
+ enableOrbitControls?: boolean;
219
+ autoRotate?: boolean;
220
+ autoRotateSpeed?: number;
221
+ ambientLightIntensity?: number;
222
+ directionalLightIntensity?: number;
223
+ directionalLightPosition?: [number, number, number];
224
+ hexBaseColor?: string;
225
+ hexBorderColor?: string;
226
+ hexBorderWidth?: number;
227
+ pentagonBaseColor?: string;
228
+ pentagonBorderColor?: string;
229
+ fogDimColor?: string;
230
+ fogHiddenColor?: string;
231
+ fogExploredColor?: string;
232
+ defaultPieceScale?: number;
233
+ defaultPieceColor?: string;
234
+ enableRaycasting?: boolean;
235
+ enableDragDrop?: boolean;
236
+ hoverHighlightColor?: string;
237
+ enableBloom?: boolean;
238
+ enableShadows?: boolean;
239
+ enableAntialias?: boolean;
240
+ enableInstancing?: boolean;
241
+ maxVisiblePieces?: number;
242
+ pixelRatio?: number;
243
+ }
244
+ /**
245
+ * Events emitted by the GameSphere component.
246
+ */
247
+ export interface GameSphereEvents {
248
+ /** Cell was clicked */
249
+ onCellClick?: (cellIndex: number, event: {
250
+ shiftKey: boolean;
251
+ ctrlKey: boolean;
252
+ }) => void;
253
+ /** Cell hover entered */
254
+ onCellHover?: (cellIndex: number | null) => void;
255
+ /** A piece was clicked */
256
+ onPieceClick?: (cellIndex: number, piece: GamePiece) => void;
257
+ /** A piece was dragged from one cell to another */
258
+ onPieceDrop?: (fromCell: number, toCell: number, piece: GamePiece) => void;
259
+ /** Camera moved (for syncing external UI) */
260
+ onCameraChange?: (position: [number, number, number], target: [number, number, number]) => void;
261
+ /** Render frame callback (for custom overlays) */
262
+ onFrame?: (deltaTime: number) => void;
263
+ }
264
+ /**
265
+ * Props for the GameSphere component — the 3D board game renderer.
266
+ */
267
+ export interface GameSphereProps {
268
+ /** Game state per cell. Key = cell index from GeodesicHexGrid. */
269
+ cellGameState?: Map<number, CellGameState>;
270
+ /** Visual and behavior configuration */
271
+ config?: GameSphereConfig;
272
+ /** Event callbacks */
273
+ events?: GameSphereEvents;
274
+ /** Width of the canvas (default '100%') */
275
+ width?: number | string;
276
+ /** Height of the canvas (default '100%') */
277
+ height?: number | string;
278
+ /** CSS class for the container */
279
+ className?: string;
280
+ /** Inline styles for the container */
281
+ style?: React.CSSProperties;
282
+ /** Optional ref to the Three.js renderer for external access */
283
+ rendererRef?: RefObject<unknown>;
284
+ /** Optional ref to the Three.js scene for injecting custom objects */
285
+ sceneRef?: RefObject<unknown>;
286
+ /** Pauses rendering when true (e.g. modal open) */
287
+ paused?: boolean;
288
+ /** Children rendered as React overlay on top of the canvas */
289
+ children?: React.ReactNode;
290
+ }
126
291
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,C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M,GAAG,MAAM,CAAC;IAEzB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,gEAAgE;IAChE,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAEjC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAE9B,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buley/hexgrid-3d",
3
- "version": "3.5.1",
3
+ "version": "3.6.1",
4
4
  "description": "3D hexagonal grid visualization component for React",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -65,6 +65,7 @@
65
65
  "three"
66
66
  ],
67
67
  "peerDependencies": {
68
+ "@react-three/fiber": "^9.4.2",
68
69
  "next": "^14.0.0",
69
70
  "react": "^18.0.0",
70
71
  "react-dom": "^18.0.0",
@@ -80,6 +81,7 @@
80
81
  "@types/react": "^18.3.27",
81
82
  "@types/three": "^0.183.1",
82
83
  "@types/react-dom": "^18.3.7",
84
+ "@react-three/fiber": "^9.4.2",
83
85
  "happy-dom": "^20.3.3",
84
86
  "jest": "^29.7.0",
85
87
  "jest-environment-jsdom": "^29.7.0",