@vanduo-oss/vd3-cbun 1.3.2 → 1.4.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +24 -9
  3. package/SKILL.md +42 -15
  4. package/dist/charts/core.d.ts +4 -0
  5. package/dist/charts/index.cjs +197 -10
  6. package/dist/charts/index.cjs.map +3 -3
  7. package/dist/charts/index.js +197 -10
  8. package/dist/charts/index.js.map +3 -3
  9. package/dist/charts/vd3-charts.css +82 -0
  10. package/dist/charts/vue.d.ts +4 -0
  11. package/dist/code-editor/core.d.ts +19 -2
  12. package/dist/code-editor/highlight.cjs +1242 -0
  13. package/dist/code-editor/highlight.cjs.map +7 -0
  14. package/dist/code-editor/highlight.d.ts +6 -0
  15. package/dist/code-editor/highlight.js +1219 -0
  16. package/dist/code-editor/highlight.js.map +7 -0
  17. package/dist/code-editor/index.cjs +694 -70
  18. package/dist/code-editor/index.cjs.map +4 -4
  19. package/dist/code-editor/index.d.ts +2 -0
  20. package/dist/code-editor/index.js +694 -70
  21. package/dist/code-editor/index.js.map +4 -4
  22. package/dist/code-editor/vd3-code-editor.css +5 -0
  23. package/dist/draw/core.d.ts +7 -1
  24. package/dist/draw/index.cjs +470 -52
  25. package/dist/draw/index.cjs.map +2 -2
  26. package/dist/draw/index.js +470 -52
  27. package/dist/draw/index.js.map +2 -2
  28. package/dist/draw/vd3-draw.css +45 -0
  29. package/dist/draw/vue.d.ts +4 -0
  30. package/dist/hex-grid/core.d.ts +41 -0
  31. package/dist/hex-grid/index.cjs +308 -13
  32. package/dist/hex-grid/index.cjs.map +3 -3
  33. package/dist/hex-grid/index.d.ts +1 -0
  34. package/dist/hex-grid/index.js +308 -13
  35. package/dist/hex-grid/index.js.map +3 -3
  36. package/dist/hex-grid/vue.d.ts +4 -0
  37. package/dist/index.js +2 -2
  38. package/dist/index.js.map +2 -2
  39. package/dist/meta.json +177 -66
  40. package/package.json +15 -10
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hex-grid/vue.js", "../../src/hex-grid/hex-math.js", "../../src/hex-grid/core.js"],
4
- "sourcesContent": ["/**\n * Vue 3 bindings for the hex-grid component of @vanduo-oss/vd3-cbun.\n *\n * import { VdHexGrid } from '@vanduo-oss/vd3-cbun/hex-grid';\n * <VdHexGrid :size=\"30\" :width=\"15\" :height=\"10\" @select=\"onSelect\" />\n *\n * The canvas core stays framework-agnostic. SSR-safe: the canvas grid\n * is created on mount (client) into a plain container the server can pre-render.\n */\nimport { defineComponent, h, ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport { VdHexGrid as VdHexGridCore } from './core.js';\n\nconst FORWARDED_EVENTS = ['select', 'zoom', 'pan'];\n\nexport const VdHexGrid = defineComponent({\n name: 'VdHexGrid',\n props: {\n /** Hexagon size (px). */\n size: { type: Number, default: 30 },\n /** Grid columns (number of hexes). */\n width: { type: Number, default: 10 },\n /** Grid rows (number of hexes). */\n height: { type: Number, default: 10 },\n /** Grid rotation (radians). */\n rotation: { type: Number, default: 0 },\n },\n emits: ['select', 'zoom', 'pan', 'ready'],\n setup(props, { emit, expose }) {\n const el = ref(null);\n let instance = null;\n\n const create = () => {\n instance = new VdHexGridCore({\n element: el.value,\n size: props.size,\n width: props.width,\n height: props.height,\n rotation: props.rotation,\n });\n FORWARDED_EVENTS.forEach((name) => {\n instance.on(name, (data) => emit(name, data));\n });\n emit('ready', instance);\n };\n\n onMounted(() => {\n if (typeof window === 'undefined' || !el.value) return;\n create();\n });\n\n // Drive prop changes through the instance setters (no recreate needed).\n watch(\n () => props.size,\n (v) => instance && instance.setSize(v),\n );\n watch(\n () => [props.width, props.height],\n ([w, hgt]) => instance && instance.setDimensions(w, hgt),\n );\n watch(\n () => props.rotation,\n (v) => instance && instance.setRotation(v),\n );\n\n onBeforeUnmount(() => {\n if (instance) {\n instance.destroy();\n instance = null;\n }\n });\n\n expose({ getInstance: () => instance });\n\n return () =>\n h('div', { ref: el, class: 'vd-hex-grid', style: { width: '100%', height: '100%' } }, [\n h('canvas', { style: { width: '100%', height: '100%', display: 'block', cursor: 'grab' } }),\n ]);\n },\n});\n", "// Hex math utilities adapted for Vanduo framework\n// Based on web-civ utils/hex-math.js\n\n/**\n * Rotate a point around the origin\n * @param {number} x - X coordinate\n * @param {number} y - Y coordinate\n * @param {number} [rotation=0] - Rotation in radians\n * @returns {{x: number, y: number}} Rotated point\n */\nexport function rotatePoint(x, y, rotation = 0) {\n if (!rotation) {\n return { x, y };\n }\n\n const cosRot = Math.cos(rotation);\n const sinRot = Math.sin(rotation);\n\n return {\n x: x * cosRot - y * sinRot,\n y: x * sinRot + y * cosRot,\n };\n}\n\n/**\n * Apply the inverse of a rotation to a point\n * @param {number} x - X coordinate\n * @param {number} y - Y coordinate\n * @param {number} [rotation=0] - Rotation in radians\n * @returns {{x: number, y: number}} Unrotated point\n */\nexport function unrotatePoint(x, y, rotation = 0) {\n return rotatePoint(x, y, -rotation);\n}\n\n/**\n * Convert hex axial coordinates to pixel coordinates (flat-top orientation)\n * @param {number} q - Hex column coordinate\n * @param {number} r - Hex row coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional grid rotation in radians\n * @returns {{x: number, y: number}} Pixel coordinates\n */\nexport function hexToPixel(q, r, size, rotation = 0) {\n const baseX = size * 1.5 * q;\n const baseY = size * Math.sqrt(3) * (r + q * 0.5);\n return rotatePoint(baseX, baseY, rotation);\n}\n\n/**\n * Convert pixel coordinates to hex axial coordinates (flat-top orientation)\n * @param {number} px - Pixel X coordinate\n * @param {number} py - Pixel Y coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional grid rotation in radians\n * @returns {{q: number, r: number}} Hex coordinates (rounded)\n */\nexport function pixelToHex(px, py, size, rotation = 0) {\n const point = unrotatePoint(px, py, rotation);\n const q = ((2 / 3) * point.x) / size;\n const r = ((-1 / 3) * point.x + (Math.sqrt(3) / 3) * point.y) / size;\n return axialRound(q, r);\n}\n\n/**\n * Round fractional axial coordinates to nearest hex\n * @param {number} q - Fractional q coordinate\n * @param {number} r - Fractional r coordinate\n * @returns {{q: number, r: number}} Rounded hex coordinates\n */\nexport function axialRound(q, r) {\n const s = -q - r;\n let rq = Math.round(q);\n let rr = Math.round(r);\n const rs = Math.round(s);\n const qDiff = Math.abs(rq - q);\n const rDiff = Math.abs(rr - r);\n const sDiff = Math.abs(rs - s);\n if (qDiff > rDiff && qDiff > sDiff) {\n rq = -rr - rs;\n } else if (rDiff > sDiff) {\n rr = -rq - rs;\n }\n return { q: rq, r: rr };\n}\n\n/**\n * Get the 6 corner points of a flat-top hexagon\n * @param {number} x - Center X coordinate\n * @param {number} y - Center Y coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional hex rotation in radians\n * @returns {Array<{x: number, y: number}>} Array of 6 corner points\n */\nexport function getHexCorners(x, y, size, rotation = 0) {\n const corners = [];\n for (let i = 0; i < 6; i++) {\n const angleRad = (Math.PI / 180) * (60 * i) + rotation;\n corners.push({\n x: x + size * Math.cos(angleRad),\n y: y + size * Math.sin(angleRad),\n });\n }\n return corners;\n}\n\n/**\n * Get the 6 adjacent hex coordinates from a given hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Array<{q: number, r: number}>} Array of 6 adjacent hex coordinates\n */\nexport function getAdjacentHexes(q, r) {\n return [\n { q: q + 1, r: r },\n { q: q + 1, r: r - 1 },\n { q: q, r: r - 1 },\n { q: q - 1, r: r },\n { q: q - 1, r: r + 1 },\n { q: q, r: r + 1 },\n ];\n}\n\n/**\n * Calculate distance between two hexes using axial coordinates\n * @param {number} q1 - First hex q coordinate\n * @param {number} r1 - First hex r coordinate\n * @param {number} q2 - Second hex q coordinate\n * @param {number} r2 - Second hex r coordinate\n * @returns {number} Distance in hex steps\n */\nexport function hexDistance(q1, r1, q2, r2) {\n return (Math.abs(q1 - q2) + Math.abs(q1 + r1 - q2 - r2) + Math.abs(r1 - r2)) / 2;\n}\n\n/**\n * Terrain types available in the system\n */\nexport const TerrainType = Object.freeze({\n GRASSLAND: 'Grassland',\n PLAINS: 'Plains',\n DESERT: 'Desert',\n TUNDRA: 'Tundra',\n SNOW: 'Snow',\n MOUNTAIN: 'Mountain',\n OCEAN: 'Ocean',\n COAST: 'Coast',\n});\n\n/**\n * Terrain colors for rendering\n */\nexport const TERRAIN_COLORS = Object.freeze({\n [TerrainType.GRASSLAND]: '#47602f',\n [TerrainType.PLAINS]: '#6e6838',\n [TerrainType.DESERT]: '#bd9a60',\n [TerrainType.TUNDRA]: '#75787b',\n [TerrainType.SNOW]: '#cfdce4',\n [TerrainType.MOUNTAIN]: '#464543',\n [TerrainType.OCEAN]: '#1d354c',\n [TerrainType.COAST]: '#295170',\n});\n\n/**\n * Default terrain color for unknown types\n */\nexport const DEFAULT_TERRAIN_COLOR = '#FF00FF';\n\n/**\n * Terrain yields - resources generated per turn from each terrain type\n */\nexport const TERRAIN_YIELDS = Object.freeze({\n [TerrainType.GRASSLAND]: { food: 2, production: 0, gold: 0 },\n [TerrainType.PLAINS]: { food: 1, production: 1, gold: 0 },\n [TerrainType.DESERT]: { food: 0, production: 1, gold: 0 },\n [TerrainType.TUNDRA]: { food: 1, production: 0, gold: 0 },\n [TerrainType.SNOW]: { food: 0, production: 0, gold: 0 },\n [TerrainType.COAST]: { food: 1, production: 0, gold: 0 },\n [TerrainType.OCEAN]: { food: 0, production: 0, gold: 0 },\n [TerrainType.MOUNTAIN]: { food: 0, production: 0, gold: 0 },\n});\n\n/**\n * Movement costs for units based on terrain\n * Higher cost = harder to move through\n */\nexport const TERRAIN_MOVEMENT_COSTS = Object.freeze({\n [TerrainType.GRASSLAND]: 1,\n [TerrainType.PLAINS]: 1,\n [TerrainType.DESERT]: 1,\n [TerrainType.TUNDRA]: 1,\n [TerrainType.SNOW]: 2,\n [TerrainType.COAST]: 1,\n [TerrainType.OCEAN]: 999, // Impassable for land units\n [TerrainType.MOUNTAIN]: 999, // Impassable\n});\n\n/**\n * Check if terrain is passable for land units\n * @param {string} terrainType - Terrain type\n * @returns {boolean} True if passable\n */\nexport function isPassable(terrainType) {\n const cost = TERRAIN_MOVEMENT_COSTS[terrainType];\n return cost !== undefined && cost < 999;\n}\n\n/**\n * Get movement cost for terrain\n * @param {string} terrainType - Terrain type\n * @returns {number} Movement cost\n */\nexport function getMovementCost(terrainType) {\n return TERRAIN_MOVEMENT_COSTS[terrainType] ?? 999;\n}\n\n/**\n * Get terrain yields\n * @param {string} terrainType - Terrain type\n * @returns {Object} Yields object {food, production, gold}\n */\nexport function getTerrainYields(terrainType) {\n return TERRAIN_YIELDS[terrainType] || { food: 0, production: 0, gold: 0 };\n}\n\n/**\n * Get terrain color\n * @param {string} terrainType - Terrain type\n * @returns {string} Hex color string\n */\nexport function getTerrainColor(terrainType) {\n return TERRAIN_COLORS[terrainType] || DEFAULT_TERRAIN_COLOR;\n}\n", "// VdHexGrid - Dynamic controllable Hex Grid API for Vanduo framework\n// Based on web-civ HexGrid implementation\n// Enables developers to use hex grids as components and game devs creating web civ-like games\n\nimport {\n hexToPixel,\n pixelToHex,\n getHexCorners,\n getAdjacentHexes,\n hexDistance,\n TerrainType,\n isPassable,\n getMovementCost,\n getTerrainYields,\n getTerrainColor,\n} from './hex-math.js';\n\n// Constants\nexport const VD_HEX_VERSION = '1.0.1';\nconst ZOOM_MIN = 0.3;\nconst ZOOM_MAX = 3.0;\nconst ZOOM_FACTOR = 0.1;\nconst DRAG_THRESHOLD = 2;\n\n/**\n * VdHexGrid - A dynamic controllable hex grid component\n *\n * @example\n * const grid = new VdHexGrid({\n * element: document.getElementById('container'),\n * canvas: document.getElementById('canvas'),\n * size: 30,\n * width: 15,\n * height: 10,\n * rotation: 0 // Optional rotation in radians\n * });\n *\n * grid.on('select', (hex) => {\n * console.log('Selected:', hex.q, hex.r);\n * });\n */\nexport class VdHexGrid {\n static VERSION = VD_HEX_VERSION;\n\n constructor({ element, canvas, size = 30, width = 10, height = 10, rotation = 0 }) {\n this.element = element;\n this.canvas = canvas;\n this.size = size;\n this.width = width;\n this.height = height;\n this.rotation = rotation;\n this.hexes = new Map();\n this.selectedHex = null;\n this.listeners = {};\n\n // Transform state for pan/zoom\n this.transform = { x: 0, y: 0, scale: 1 };\n\n // Drag state\n this.dragging = false;\n this.lastPos = null;\n this.hasMoved = false;\n\n // Theme colors\n this.themeColors = this._getThemeColors();\n\n // Custom render callback\n this.customRenderCallback = null;\n\n // Set up canvas if not already done\n if (!this.canvas) {\n this.canvas = element.querySelector('canvas') || document.createElement('canvas');\n if (!element.contains(this.canvas)) {\n element.appendChild(this.canvas);\n }\n }\n\n this.ctx = this.canvas.getContext('2d');\n\n // Generate the grid\n this._generateGrid();\n this._render();\n this._setupEvents();\n\n // Observe theme changes\n this._observeThemeChanges();\n }\n\n /**\n * Get theme colors from CSS custom properties\n */\n _getThemeColors() {\n const root = document.documentElement;\n const style = getComputedStyle(root);\n\n // Prefer Vanduo's canonical --vd-* tokens; fall back to the legacy\n // unprefixed names, then to a hardcoded default.\n const read = (token, legacy, fallback) =>\n style.getPropertyValue(token).trim() || style.getPropertyValue(legacy).trim() || fallback;\n\n return {\n bgPrimary: read('--vd-bg-primary', '--bg-primary', '#ffffff'),\n bgSecondary: read('--vd-bg-secondary', '--bg-secondary', '#f5f5f5'),\n borderColor: read('--vd-border-color', '--border-color', '#e0e0e0'),\n colorPrimary: read('--vd-color-primary', '--color-primary', '#3b82f6'),\n textColor: read('--vd-text-primary', '--text-primary', '#1f2937'),\n textMuted: read('--vd-text-muted', '--text-muted', '#6b7280'),\n };\n }\n\n /**\n * Observe theme changes and re-render when theme changes\n */\n _observeThemeChanges() {\n const reTheme = () => {\n this.themeColors = this._getThemeColors();\n this._render();\n };\n\n // Re-render when the document theme attribute flips (e.g. data-theme).\n this._themeObserver = new MutationObserver(reTheme);\n this._themeObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme'],\n });\n\n // Also follow OS-level light/dark changes that flip token values through a\n // prefers-color-scheme media query without touching any attribute.\n if (typeof window !== 'undefined' && window.matchMedia) {\n this._themeMedia = window.matchMedia('(prefers-color-scheme: dark)');\n this._themeMediaHandler = reTheme;\n this._themeMedia.addEventListener('change', this._themeMediaHandler);\n }\n }\n\n /**\n * Disconnect theme listeners. Call before discarding the instance (for example\n * on SPA navigation) to avoid leaking observers and media-query listeners.\n */\n destroy() {\n this._teardownEvents();\n if (this._themeObserver) {\n this._themeObserver.disconnect();\n this._themeObserver = null;\n }\n if (this._themeMedia && this._themeMediaHandler) {\n this._themeMedia.removeEventListener('change', this._themeMediaHandler);\n this._themeMedia = null;\n this._themeMediaHandler = null;\n }\n }\n\n /**\n * Convert screen coordinates to world coordinates\n */\n _screenToWorld(screenX, screenY) {\n const rect = this.canvas.getBoundingClientRect();\n const canvasX = screenX - rect.left;\n const canvasY = screenY - rect.top;\n\n return {\n x: (canvasX - this.transform.x) / this.transform.scale,\n y: (canvasY - this.transform.y) / this.transform.scale,\n };\n }\n\n /**\n * Convert client coordinates to canvas-local coordinates\n */\n _clientToCanvas(clientX, clientY) {\n const rect = this.canvas.getBoundingClientRect();\n return {\n x: clientX - rect.left,\n y: clientY - rect.top,\n };\n }\n\n /**\n * Generate hex grid data\n */\n _generateGrid() {\n this.hexes.clear();\n\n for (let r = 0; r < this.height; r++) {\n const qOffset = Math.floor(r / 2);\n for (let q = -qOffset; q < this.width - qOffset; q++) {\n const pixel = hexToPixel(q, r, this.size, this.rotation);\n\n const hex = {\n q,\n r,\n x: pixel.x,\n y: pixel.y,\n fill: this.themeColors.bgSecondary,\n stroke: this.themeColors.borderColor,\n adjacent: getAdjacentHexes(q, r),\n terrain: null,\n data: {},\n };\n this.hexes.set(`${q},${r}`, hex);\n }\n }\n }\n\n /**\n * Keep selected hex reference in sync after grid regeneration\n */\n _resyncSelectedHex() {\n if (!this.selectedHex) return;\n this.selectedHex = this.hexes.get(`${this.selectedHex.q},${this.selectedHex.r}`) ?? null;\n }\n\n /**\n * Render the hex grid on canvas\n */\n _render() {\n // Get canvas displayed size\n const rect = this.canvas.getBoundingClientRect();\n const displayWidth = rect.width || 800;\n const displayHeight = rect.height || 400;\n\n // Set canvas internal resolution to match display\n this.canvas.width = displayWidth;\n this.canvas.height = displayHeight;\n\n // Clear canvas with theme background\n this.ctx.fillStyle = this.themeColors.bgPrimary;\n this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\n // Apply transform\n this.ctx.save();\n this.ctx.translate(this.transform.x, this.transform.y);\n this.ctx.scale(this.transform.scale, this.transform.scale);\n\n // Draw all hexes\n this.hexes.forEach((hex) => {\n this._drawHex(hex);\n\n // Call custom render callback if set\n if (this.customRenderCallback) {\n this.customRenderCallback(this.ctx, hex, this.size);\n }\n });\n\n // Redraw selected hex if any\n if (this.selectedHex) {\n this._drawHex(this.selectedHex, true);\n }\n\n this.ctx.restore();\n }\n\n /**\n * Draw a single hex\n */\n _drawHex(hex, isSelected = false) {\n const corners = getHexCorners(hex.x, hex.y, this.size, this.rotation);\n\n this.ctx.beginPath();\n this.ctx.moveTo(corners[0].x, corners[0].y);\n for (let i = 1; i < corners.length; i++) {\n this.ctx.lineTo(corners[i].x, corners[i].y);\n }\n this.ctx.closePath();\n\n // Determine fill color: terrain > custom fill > theme\n let fill;\n if (isSelected) {\n fill = this.themeColors.colorPrimary;\n } else if (hex.terrain) {\n fill = getTerrainColor(hex.terrain);\n } else if (hex.fill) {\n fill = hex.fill;\n } else {\n fill = this.themeColors.bgSecondary;\n }\n this.ctx.fillStyle = fill;\n this.ctx.fill();\n\n // Stroke with theme color\n const stroke = isSelected\n ? this.themeColors.colorPrimary\n : hex.stroke || this.themeColors.borderColor;\n this.ctx.strokeStyle = stroke;\n this.ctx.lineWidth = isSelected ? 3 : 1;\n this.ctx.stroke();\n\n // Draw coordinates for selected hex\n if (isSelected) {\n this.ctx.fillStyle = '#ffffff';\n this.ctx.font = '10px monospace';\n this.ctx.textAlign = 'center';\n this.ctx.textBaseline = 'middle';\n this.ctx.fillText(`${hex.q},${hex.r}`, hex.x, hex.y);\n }\n }\n\n /**\n * Set up mouse/touch events for hex selection, pan, and zoom\n */\n _setupEvents() {\n // Touch state for pinch-to-zoom\n this.touchState = {\n initialDistance: 0,\n initialScale: 1,\n touches: [],\n };\n\n // Handlers are stored as named references so destroy() can remove every one\n // of them. The canvas may be caller-supplied and reused across grid\n // instances, so anonymous listeners left attached would leak.\n this._canvasHandlers = {\n // Pan - pointer down\n pointerdown: (e) => {\n this.dragging = true;\n this.hasMoved = false;\n this.lastPos = { x: e.clientX, y: e.clientY };\n this.canvas.style.cursor = 'grabbing';\n },\n\n // Pan - pointer move\n pointermove: (e) => {\n if (!this.dragging) return;\n\n const cur = { x: e.clientX, y: e.clientY };\n const dx = cur.x - this.lastPos.x;\n const dy = cur.y - this.lastPos.y;\n\n if (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) {\n this.hasMoved = true;\n }\n\n this.transform.x += dx;\n this.transform.y += dy;\n this.lastPos = cur;\n this._render();\n },\n\n // Pan - pointer up / leave (shared stopDrag)\n pointerup: () => {\n this.dragging = false;\n if (!this.hasMoved) {\n this.canvas.style.cursor = 'pointer';\n }\n },\n\n // Click (tap without drag)\n click: (e) => {\n if (this.hasMoved) return;\n\n const worldPos = this._screenToWorld(e.clientX, e.clientY);\n const hexCoords = pixelToHex(worldPos.x, worldPos.y, this.size, this.rotation);\n const hex = this.hexes.get(`${hexCoords.q},${hexCoords.r}`);\n\n if (hex) {\n this.selectedHex = hex;\n this._render();\n this._emit('select', hex);\n }\n },\n\n // Zoom - mouse wheel\n wheel: (e) => {\n e.preventDefault();\n\n const zoomFactor = e.deltaY > 0 ? 1 - ZOOM_FACTOR : 1 + ZOOM_FACTOR;\n const newScale = Math.max(ZOOM_MIN, Math.min(this.transform.scale * zoomFactor, ZOOM_MAX));\n\n // Zoom toward cursor\n const mouse = this._clientToCanvas(e.clientX, e.clientY);\n\n const scaleDiff = newScale / this.transform.scale;\n this.transform.x = mouse.x - (mouse.x - this.transform.x) * scaleDiff;\n this.transform.y = mouse.y - (mouse.y - this.transform.y) * scaleDiff;\n this.transform.scale = newScale;\n\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n },\n\n // Touch events for pinch-to-zoom\n touchstart: (e) => {\n if (e.touches.length === 2) {\n e.preventDefault();\n this.touchState.touches = Array.from(e.touches);\n this.touchState.initialDistance = this._getTouchDistance(e.touches);\n this.touchState.initialScale = this.transform.scale;\n }\n },\n\n touchmove: (e) => {\n if (e.touches.length === 2) {\n e.preventDefault();\n const currentDistance = this._getTouchDistance(e.touches);\n const scale =\n (currentDistance / this.touchState.initialDistance) * this.touchState.initialScale;\n const newScale = Math.max(ZOOM_MIN, Math.min(scale, ZOOM_MAX));\n\n // Zoom toward center of pinch\n const centerClientX = (e.touches[0].clientX + e.touches[1].clientX) / 2;\n const centerClientY = (e.touches[0].clientY + e.touches[1].clientY) / 2;\n const center = this._clientToCanvas(centerClientX, centerClientY);\n\n const scaleDiff = newScale / this.transform.scale;\n this.transform.x = center.x - (center.x - this.transform.x) * scaleDiff;\n this.transform.y = center.y - (center.y - this.transform.y) * scaleDiff;\n this.transform.scale = newScale;\n\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n }\n },\n\n touchend: () => {\n this.touchState.touches = [];\n },\n\n // Cursor style\n mouseenter: () => {\n this.canvas.style.cursor = 'grab';\n },\n\n mouseleave: () => {\n this.canvas.style.cursor = 'default';\n },\n };\n\n const h = this._canvasHandlers;\n this.canvas.addEventListener('pointerdown', h.pointerdown);\n this.canvas.addEventListener('pointermove', h.pointermove);\n this.canvas.addEventListener('pointerup', h.pointerup);\n this.canvas.addEventListener('pointerleave', h.pointerup);\n this.canvas.addEventListener('click', h.click);\n this.canvas.addEventListener('wheel', h.wheel, { passive: false });\n this.canvas.addEventListener('touchstart', h.touchstart, { passive: false });\n this.canvas.addEventListener('touchmove', h.touchmove, { passive: false });\n this.canvas.addEventListener('touchend', h.touchend);\n this.canvas.addEventListener('mouseenter', h.mouseenter);\n this.canvas.addEventListener('mouseleave', h.mouseleave);\n }\n\n /**\n * Remove every canvas listener attached by _setupEvents(). Called from\n * destroy() so a caller-supplied, reused canvas does not accumulate handlers.\n */\n _teardownEvents() {\n const h = this._canvasHandlers;\n if (!h || !this.canvas) return;\n this.canvas.removeEventListener('pointerdown', h.pointerdown);\n this.canvas.removeEventListener('pointermove', h.pointermove);\n this.canvas.removeEventListener('pointerup', h.pointerup);\n this.canvas.removeEventListener('pointerleave', h.pointerup);\n this.canvas.removeEventListener('click', h.click);\n this.canvas.removeEventListener('wheel', h.wheel);\n this.canvas.removeEventListener('touchstart', h.touchstart);\n this.canvas.removeEventListener('touchmove', h.touchmove);\n this.canvas.removeEventListener('touchend', h.touchend);\n this.canvas.removeEventListener('mouseenter', h.mouseenter);\n this.canvas.removeEventListener('mouseleave', h.mouseleave);\n this._canvasHandlers = null;\n }\n\n /**\n * Calculate distance between two touch points\n * @param {TouchList} touches - Touch list\n * @returns {number} Distance in pixels\n */\n _getTouchDistance(touches) {\n if (touches.length < 2) return 0;\n const dx = touches[0].clientX - touches[1].clientX;\n const dy = touches[0].clientY - touches[1].clientY;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * Set hex size\n */\n setSize(size) {\n this.size = size;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Set grid dimensions\n */\n setDimensions(width, height) {\n this.width = width;\n this.height = height;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Reset grid to defaults\n */\n reset() {\n this.size = 30;\n this.width = 15;\n this.height = 10;\n this.rotation = 0;\n this.selectedHex = null;\n this.transform = { x: 0, y: 0, scale: 1 };\n this._generateGrid();\n this._render();\n }\n\n /**\n * Fill hexes with random colors\n */\n fillRandom() {\n const colors = [\n '#f0f0f0',\n '#d4e5d4',\n '#e5d4d4',\n '#d4d4e5',\n '#e5e5d4',\n '#d4e5e5',\n '#e8e8e8',\n '#d0d0d0',\n ];\n this.hexes.forEach((hex) => {\n hex.fill = colors[Math.floor(Math.random() * colors.length)];\n });\n this._render();\n }\n\n /**\n * Get hex by coordinates\n */\n getHex(q, r) {\n return this.hexes.get(`${q},${r}`);\n }\n\n /**\n * Get all hexes\n */\n getAllHexes() {\n return Array.from(this.hexes.values());\n }\n\n /**\n * Set hex fill color\n */\n setHexFill(q, r, color) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.fill = color;\n this._render();\n }\n }\n\n /**\n * Reset view to default position\n */\n resetView() {\n this.transform = { x: 0, y: 0, scale: 1 };\n this._render();\n this._emit('pan', { x: 0, y: 0 });\n this._emit('zoom', { scale: 1 });\n }\n\n /**\n * Zoom in\n */\n zoomIn() {\n const newScale = Math.min(this.transform.scale * (1 + ZOOM_FACTOR), ZOOM_MAX);\n this.transform.scale = newScale;\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n }\n\n /**\n * Zoom out\n */\n zoomOut() {\n const newScale = Math.max(this.transform.scale * (1 - ZOOM_FACTOR), ZOOM_MIN);\n this.transform.scale = newScale;\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n }\n\n /**\n * Get current transform state\n */\n getTransform() {\n return { ...this.transform };\n }\n\n /**\n * Subscribe to events\n */\n on(event, callback) {\n if (!this.listeners[event]) {\n this.listeners[event] = [];\n }\n this.listeners[event].push(callback);\n }\n\n /**\n * Emit events\n */\n _emit(event, data) {\n if (this.listeners[event]) {\n this.listeners[event].forEach((callback) => callback(data));\n }\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Terrain System\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set terrain type for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @param {string} terrainType - Terrain type (e.g., 'GRASSLAND', 'OCEAN')\n */\n setHexTerrain(q, r, terrainType) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.terrain = terrainType;\n this._render();\n }\n }\n\n /**\n * Get terrain type for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {string|null} Terrain type or null\n */\n getHexTerrain(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n return hex ? hex.terrain : null;\n }\n\n /**\n * Generate random terrain for all hexes\n */\n generateRandomTerrain() {\n const terrainTypes = Object.values(TerrainType);\n this.hexes.forEach((hex) => {\n hex.terrain = terrainTypes[Math.floor(Math.random() * terrainTypes.length)];\n });\n this._render();\n }\n\n /**\n * Get terrain yields for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Object} Yields object {food, production, gold}\n */\n getHexYields(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? getTerrainYields(terrain) : { food: 0, production: 0, gold: 0 };\n }\n\n /**\n * Get movement cost for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {number} Movement cost\n */\n getHexMovementCost(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? getMovementCost(terrain) : 999;\n }\n\n /**\n * Check if hex is passable\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {boolean} True if passable\n */\n isHexPassable(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? isPassable(terrain) : false;\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Hex Data Attachment\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @param {Object} data - Custom data object\n */\n setHexData(q, r, data) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.data = { ...hex.data, ...data };\n }\n }\n\n /**\n * Get custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Object} Custom data object\n */\n getHexData(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n return hex ? hex.data : {};\n }\n\n /**\n * Clear custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n */\n clearHexData(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.data = {};\n }\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Distance & Pathfinding\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Calculate distance between two hexes\n * @param {number} q1 - First hex q coordinate\n * @param {number} r1 - First hex r coordinate\n * @param {number} q2 - Second hex q coordinate\n * @param {number} r2 - Second hex r coordinate\n * @returns {number} Distance in hex steps\n */\n hexDistance(q1, r1, q2, r2) {\n return hexDistance(q1, r1, q2, r2);\n }\n\n /**\n * Get valid moves from a hex within movement points\n * @param {number} q - Starting hex column\n * @param {number} r - Starting hex row\n * @param {number} movementPoints - Available movement points\n * @returns {Array<{q: number, r: number}>} Array of valid hex coordinates\n */\n getValidMoves(q, r, movementPoints) {\n const validHexes = [];\n const adjacent = getAdjacentHexes(q, r);\n\n for (const hex of adjacent) {\n if (!this.hexes.has(`${hex.q},${hex.r}`)) continue;\n\n const cost = this.getHexMovementCost(hex.q, hex.r);\n if (cost < 999 && movementPoints >= cost) {\n validHexes.push(hex);\n }\n }\n\n return validHexes;\n }\n\n /**\n * Get path between two hexes (simple BFS)\n * @param {number} startQ - Starting hex column\n * @param {number} startR - Starting hex row\n * @param {number} endQ - Ending hex column\n * @param {number} endR - Ending hex row\n * @returns {Array<{q: number, r: number}>} Array of hex coordinates forming path\n */\n getPath(startQ, startR, endQ, endR) {\n const startKey = `${startQ},${startR}`;\n const endKey = `${endQ},${endR}`;\n\n if (!this.hexes.has(startKey) || !this.hexes.has(endKey)) {\n return [];\n }\n\n const queue = [[startQ, startR]];\n const visited = new Set([startKey]);\n const parent = new Map();\n\n while (queue.length > 0) {\n const [currentQ, currentR] = queue.shift();\n const currentKey = `${currentQ},${currentR}`;\n\n if (currentKey === endKey) {\n // Reconstruct path\n const path = [];\n let key = endKey;\n while (key) {\n const [q, r] = key.split(',').map(Number);\n path.unshift({ q, r });\n key = parent.get(key);\n }\n return path;\n }\n\n const adjacent = getAdjacentHexes(currentQ, currentR);\n for (const neighbor of adjacent) {\n const neighborKey = `${neighbor.q},${neighbor.r}`;\n if (this.hexes.has(neighborKey) && !visited.has(neighborKey)) {\n if (this.isHexPassable(neighbor.q, neighbor.r)) {\n visited.add(neighborKey);\n parent.set(neighborKey, currentKey);\n queue.push([neighbor.q, neighbor.r]);\n }\n }\n }\n }\n\n return []; // No path found\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Grid Rotation\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set grid rotation\n * @param {number} rotation - Rotation in radians\n */\n setRotation(rotation) {\n this.rotation = rotation;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Get current grid rotation\n * @returns {number} Rotation in radians\n */\n getRotation() {\n return this.rotation;\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Custom Rendering\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set custom render callback for each hex\n * @param {function} callback - Called with (ctx, hex, size) for each hex\n */\n setCustomRender(callback) {\n this.customRenderCallback = callback;\n this._render();\n }\n\n /**\n * Clear custom render callback\n */\n clearCustomRender() {\n this.customRenderCallback = null;\n this._render();\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Utility Methods\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Check if hex exists at coordinates\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {boolean}\n */\n hasHex(q, r) {\n return this.hexes.has(`${q},${r}`);\n }\n\n /**\n * Get hex count\n * @returns {number} Number of hexes in grid\n */\n getHexCount() {\n return this.hexes.size;\n }\n\n /**\n * Export terrain data as JSON\n * @returns {Object} Terrain data object\n */\n exportTerrainData() {\n const data = {};\n this.hexes.forEach((hex, key) => {\n if (hex.terrain) {\n data[key] = hex.terrain;\n }\n });\n return data;\n }\n\n /**\n * Import terrain data from JSON\n * @param {Object} data - Terrain data object\n */\n importTerrainData(data) {\n Object.entries(data).forEach(([key, terrain]) => {\n const [q, r] = key.split(',').map(Number);\n this.setHexTerrain(q, r, terrain);\n });\n }\n}\n"],
5
- "mappings": ";;;;;AASA,SAAS,iBAAiB,GAAG,KAAK,WAAW,iBAAiB,aAAa;;;ACCpE,SAAS,YAAY,GAAG,GAAG,WAAW,GAAG;AAC9C,MAAI,CAAC,UAAU;AACb,WAAO,EAAE,GAAG,EAAE;AAAA,EAChB;AAEA,QAAM,SAAS,KAAK,IAAI,QAAQ;AAChC,QAAM,SAAS,KAAK,IAAI,QAAQ;AAEhC,SAAO;AAAA,IACL,GAAG,IAAI,SAAS,IAAI;AAAA,IACpB,GAAG,IAAI,SAAS,IAAI;AAAA,EACtB;AACF;AASO,SAAS,cAAc,GAAG,GAAG,WAAW,GAAG;AAChD,SAAO,YAAY,GAAG,GAAG,CAAC,QAAQ;AACpC;AAUO,SAAS,WAAW,GAAG,GAAG,MAAM,WAAW,GAAG;AACnD,QAAM,QAAQ,OAAO,MAAM;AAC3B,QAAM,QAAQ,OAAO,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI;AAC7C,SAAO,YAAY,OAAO,OAAO,QAAQ;AAC3C;AAUO,SAAS,WAAW,IAAI,IAAI,MAAM,WAAW,GAAG;AACrD,QAAM,QAAQ,cAAc,IAAI,IAAI,QAAQ;AAC5C,QAAM,IAAM,IAAI,IAAK,MAAM,IAAK;AA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M;AAAA,MAClB,CAAC;AACD,uBAAiB,QAAQ,CAAC,SAAS;AACjC,iBAAS,GAAG,MAAM,CAAC,SAAS,KAAK,MAAM,IAAI,CAAC;AAAA,MAC9C,CAAC;AACD,WAAK,SAAS,QAAQ;AAAA,IACxB;AAEA,cAAU,MAAM;AACd,UAAI,OAAO,WAAW,eAAe,CAAC,GAAG,MAAO;AAChD,aAAO;AAAA,IACT,CAAC;AAGD;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,MAAM,YAAY,SAAS,QAAQ,CAAC;AAAA,IACvC;AACA;AAAA,MACE,MAAM,CAAC,MAAM,OAAO,MAAM,MAAM;AAAA,MAChC,CAAC,CAAC,GAAG,GAAG,MAAM,YAAY,SAAS,cAAc,GAAG,GAAG;AAAA,IACzD;AACA;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,MAAM,YAAY,SAAS,YAAY,CAAC;AAAA,IAC3C;AAEA,oBAAgB,MAAM;AACpB,UAAI,UAAU;AACZ,iBAAS,QAAQ;AACjB,mBAAW;AAAA,MACb;AAAA,IACF,CAAC;AAED,WAAO,EAAE,aAAa,MAAM,SAAS,CAAC;AAEtC,WAAO,MACL,EAAE,OAAO,EAAE,KAAK,IAAI,OAAO,eAAe,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO,EAAE,GAAG;AAAA,MACpF,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,SAAS,SAAS,QAAQ,OAAO,EAAE,CAAC;AAAA,IAC5F,CAAC;AAAA,EACL;AACF,CAAC;",
6
- "names": ["h", "VdHexGrid"]
4
+ "sourcesContent": ["/**\n * Vue 3 bindings for the hex-grid component of @vanduo-oss/vd3-cbun.\n *\n * import { VdHexGrid } from '@vanduo-oss/vd3-cbun/hex-grid';\n * <VdHexGrid :size=\"30\" :width=\"15\" :height=\"10\" @select=\"onSelect\" />\n *\n * The canvas core stays framework-agnostic. SSR-safe: the canvas grid\n * is created on mount (client) into a plain container the server can pre-render.\n */\nimport { defineComponent, h, ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport { VdHexGrid as VdHexGridCore } from './core.js';\n\nconst FORWARDED_EVENTS = ['select', 'zoom', 'pan'];\n\nexport const VdHexGrid = defineComponent({\n name: 'VdHexGrid',\n props: {\n /** Hexagon size (px). */\n size: { type: Number, default: 30 },\n /** Grid columns (number of hexes). */\n width: { type: Number, default: 10 },\n /** Grid rows (number of hexes). */\n height: { type: Number, default: 10 },\n /** Grid rotation (radians). */\n rotation: { type: Number, default: 0 },\n /** Canvas backing-store multiplier: a number or `'auto'` (default). */\n pixelRatio: { type: [Number, String], default: 'auto' },\n /** Viewport culling (default true). */\n cull: { type: Boolean, default: true },\n },\n emits: ['select', 'zoom', 'pan', 'ready'],\n setup(props, { emit, expose }) {\n const el = ref(null);\n let instance = null;\n\n const create = () => {\n instance = new VdHexGridCore({\n element: el.value,\n size: props.size,\n width: props.width,\n height: props.height,\n rotation: props.rotation,\n pixelRatio: props.pixelRatio,\n cull: props.cull,\n });\n FORWARDED_EVENTS.forEach((name) => {\n instance.on(name, (data) => emit(name, data));\n });\n emit('ready', instance);\n };\n\n onMounted(() => {\n if (typeof window === 'undefined' || !el.value) return;\n create();\n });\n\n // Drive prop changes through the instance setters (no recreate needed).\n watch(\n () => props.size,\n (v) => instance && instance.setSize(v),\n );\n watch(\n () => [props.width, props.height],\n ([w, hgt]) => instance && instance.setDimensions(w, hgt),\n );\n watch(\n () => props.rotation,\n (v) => instance && instance.setRotation(v),\n );\n watch(\n () => props.pixelRatio,\n (v) => instance && instance.setPixelRatio(v),\n );\n watch(\n () => props.cull,\n (v) => instance && instance.setCull(v),\n );\n\n onBeforeUnmount(() => {\n if (instance) {\n instance.destroy();\n instance = null;\n }\n });\n\n expose({ getInstance: () => instance });\n\n return () =>\n h('div', { ref: el, class: 'vd-hex-grid', style: { width: '100%', height: '100%' } }, [\n h('canvas', { style: { width: '100%', height: '100%', display: 'block', cursor: 'grab' } }),\n ]);\n },\n});\n", "// Hex math utilities adapted for Vanduo framework\n// Based on web-civ utils/hex-math.js\n\n/**\n * Rotate a point around the origin\n * @param {number} x - X coordinate\n * @param {number} y - Y coordinate\n * @param {number} [rotation=0] - Rotation in radians\n * @returns {{x: number, y: number}} Rotated point\n */\nexport function rotatePoint(x, y, rotation = 0) {\n if (!rotation) {\n return { x, y };\n }\n\n const cosRot = Math.cos(rotation);\n const sinRot = Math.sin(rotation);\n\n return {\n x: x * cosRot - y * sinRot,\n y: x * sinRot + y * cosRot,\n };\n}\n\n/**\n * Apply the inverse of a rotation to a point\n * @param {number} x - X coordinate\n * @param {number} y - Y coordinate\n * @param {number} [rotation=0] - Rotation in radians\n * @returns {{x: number, y: number}} Unrotated point\n */\nexport function unrotatePoint(x, y, rotation = 0) {\n return rotatePoint(x, y, -rotation);\n}\n\n/**\n * Convert hex axial coordinates to pixel coordinates (flat-top orientation)\n * @param {number} q - Hex column coordinate\n * @param {number} r - Hex row coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional grid rotation in radians\n * @returns {{x: number, y: number}} Pixel coordinates\n */\nexport function hexToPixel(q, r, size, rotation = 0) {\n const baseX = size * 1.5 * q;\n const baseY = size * Math.sqrt(3) * (r + q * 0.5);\n return rotatePoint(baseX, baseY, rotation);\n}\n\n/**\n * Convert pixel coordinates to hex axial coordinates (flat-top orientation)\n * @param {number} px - Pixel X coordinate\n * @param {number} py - Pixel Y coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional grid rotation in radians\n * @returns {{q: number, r: number}} Hex coordinates (rounded)\n */\nexport function pixelToHex(px, py, size, rotation = 0) {\n const point = unrotatePoint(px, py, rotation);\n const q = ((2 / 3) * point.x) / size;\n const r = ((-1 / 3) * point.x + (Math.sqrt(3) / 3) * point.y) / size;\n return axialRound(q, r);\n}\n\n/**\n * Round fractional axial coordinates to nearest hex\n * @param {number} q - Fractional q coordinate\n * @param {number} r - Fractional r coordinate\n * @returns {{q: number, r: number}} Rounded hex coordinates\n */\nexport function axialRound(q, r) {\n const s = -q - r;\n let rq = Math.round(q);\n let rr = Math.round(r);\n const rs = Math.round(s);\n const qDiff = Math.abs(rq - q);\n const rDiff = Math.abs(rr - r);\n const sDiff = Math.abs(rs - s);\n if (qDiff > rDiff && qDiff > sDiff) {\n rq = -rr - rs;\n } else if (rDiff > sDiff) {\n rr = -rq - rs;\n }\n return { q: rq, r: rr };\n}\n\n/**\n * Get the 6 corner points of a flat-top hexagon\n * @param {number} x - Center X coordinate\n * @param {number} y - Center Y coordinate\n * @param {number} size - Hex radius\n * @param {number} [rotation=0] - Optional hex rotation in radians\n * @returns {Array<{x: number, y: number}>} Array of 6 corner points\n */\nexport function getHexCorners(x, y, size, rotation = 0) {\n const corners = [];\n for (let i = 0; i < 6; i++) {\n const angleRad = (Math.PI / 180) * (60 * i) + rotation;\n corners.push({\n x: x + size * Math.cos(angleRad),\n y: y + size * Math.sin(angleRad),\n });\n }\n return corners;\n}\n\n/**\n * Get the 6 adjacent hex coordinates from a given hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Array<{q: number, r: number}>} Array of 6 adjacent hex coordinates\n */\nexport function getAdjacentHexes(q, r) {\n return [\n { q: q + 1, r: r },\n { q: q + 1, r: r - 1 },\n { q: q, r: r - 1 },\n { q: q - 1, r: r },\n { q: q - 1, r: r + 1 },\n { q: q, r: r + 1 },\n ];\n}\n\n/**\n * Calculate distance between two hexes using axial coordinates\n * @param {number} q1 - First hex q coordinate\n * @param {number} r1 - First hex r coordinate\n * @param {number} q2 - Second hex q coordinate\n * @param {number} r2 - Second hex r coordinate\n * @returns {number} Distance in hex steps\n */\nexport function hexDistance(q1, r1, q2, r2) {\n return (Math.abs(q1 - q2) + Math.abs(q1 + r1 - q2 - r2) + Math.abs(r1 - r2)) / 2;\n}\n\n/**\n * Terrain types available in the system\n */\nexport const TerrainType = Object.freeze({\n GRASSLAND: 'Grassland',\n PLAINS: 'Plains',\n DESERT: 'Desert',\n TUNDRA: 'Tundra',\n SNOW: 'Snow',\n MOUNTAIN: 'Mountain',\n OCEAN: 'Ocean',\n COAST: 'Coast',\n});\n\n/**\n * Terrain colors for rendering\n */\nexport const TERRAIN_COLORS = Object.freeze({\n [TerrainType.GRASSLAND]: '#47602f',\n [TerrainType.PLAINS]: '#6e6838',\n [TerrainType.DESERT]: '#bd9a60',\n [TerrainType.TUNDRA]: '#75787b',\n [TerrainType.SNOW]: '#cfdce4',\n [TerrainType.MOUNTAIN]: '#464543',\n [TerrainType.OCEAN]: '#1d354c',\n [TerrainType.COAST]: '#295170',\n});\n\n/**\n * Default terrain color for unknown types\n */\nexport const DEFAULT_TERRAIN_COLOR = '#FF00FF';\n\n/**\n * Terrain yields - resources generated per turn from each terrain type\n */\nexport const TERRAIN_YIELDS = Object.freeze({\n [TerrainType.GRASSLAND]: { food: 2, production: 0, gold: 0 },\n [TerrainType.PLAINS]: { food: 1, production: 1, gold: 0 },\n [TerrainType.DESERT]: { food: 0, production: 1, gold: 0 },\n [TerrainType.TUNDRA]: { food: 1, production: 0, gold: 0 },\n [TerrainType.SNOW]: { food: 0, production: 0, gold: 0 },\n [TerrainType.COAST]: { food: 1, production: 0, gold: 0 },\n [TerrainType.OCEAN]: { food: 0, production: 0, gold: 0 },\n [TerrainType.MOUNTAIN]: { food: 0, production: 0, gold: 0 },\n});\n\n/**\n * Movement costs for units based on terrain\n * Higher cost = harder to move through\n */\nexport const TERRAIN_MOVEMENT_COSTS = Object.freeze({\n [TerrainType.GRASSLAND]: 1,\n [TerrainType.PLAINS]: 1,\n [TerrainType.DESERT]: 1,\n [TerrainType.TUNDRA]: 1,\n [TerrainType.SNOW]: 2,\n [TerrainType.COAST]: 1,\n [TerrainType.OCEAN]: 999, // Impassable for land units\n [TerrainType.MOUNTAIN]: 999, // Impassable\n});\n\n/**\n * Check if terrain is passable for land units\n * @param {string} terrainType - Terrain type\n * @returns {boolean} True if passable\n */\nexport function isPassable(terrainType) {\n const cost = TERRAIN_MOVEMENT_COSTS[terrainType];\n return cost !== undefined && cost < 999;\n}\n\n/**\n * Get movement cost for terrain\n * @param {string} terrainType - Terrain type\n * @returns {number} Movement cost\n */\nexport function getMovementCost(terrainType) {\n return TERRAIN_MOVEMENT_COSTS[terrainType] ?? 999;\n}\n\n/**\n * Get terrain yields\n * @param {string} terrainType - Terrain type\n * @returns {Object} Yields object {food, production, gold}\n */\nexport function getTerrainYields(terrainType) {\n return TERRAIN_YIELDS[terrainType] || { food: 0, production: 0, gold: 0 };\n}\n\n/**\n * Get terrain color\n * @param {string} terrainType - Terrain type\n * @returns {string} Hex color string\n */\nexport function getTerrainColor(terrainType) {\n return TERRAIN_COLORS[terrainType] || DEFAULT_TERRAIN_COLOR;\n}\n", "// VdHexGrid - Dynamic controllable Hex Grid API for Vanduo framework\n// Based on web-civ HexGrid implementation\n// Enables developers to use hex grids as components and game devs creating web civ-like games\n\nimport {\n hexToPixel,\n pixelToHex,\n getHexCorners,\n getAdjacentHexes,\n hexDistance,\n TerrainType,\n isPassable,\n getMovementCost,\n getTerrainYields,\n getTerrainColor,\n} from './hex-math.js';\n\n// Constants\nexport const VD_HEX_VERSION = '1.1.0';\nconst ZOOM_MIN = 0.3;\nconst ZOOM_MAX = 3.0;\nconst ZOOM_FACTOR = 0.1;\nconst DRAG_THRESHOLD = 2;\n\n// Adaptive rendering: above this many visible cells a gesture (pan/zoom) blits\n// the last sharp frame instead of rebuilding the grid each frame; a sharp\n// culled re-render follows after this idle window (or on pointer up).\nconst FAST_RENDER_LIMIT = 8000;\nconst SHARP_IDLE_MS = 120;\n// Cap the device-pixel-ratio multiplier to bound frame-buffer memory\n// (a 1500x670 pane at 2x is ~16 MB).\nconst MAX_PIXEL_RATIO = 2;\n// Minimum spatial bucket edge in world units.\nconst MIN_BUCKET_SIZE = 64;\n\nconst now = () =>\n typeof performance !== 'undefined' && typeof performance.now === 'function'\n ? performance.now()\n : Date.now();\n\n/**\n * VdHexGrid - A dynamic controllable hex grid component\n *\n * @example\n * const grid = new VdHexGrid({\n * element: document.getElementById('container'),\n * canvas: document.getElementById('canvas'),\n * size: 30,\n * width: 15,\n * height: 10,\n * rotation: 0 // Optional rotation in radians\n * });\n *\n * grid.on('select', (hex) => {\n * console.log('Selected:', hex.q, hex.r);\n * });\n */\nexport class VdHexGrid {\n static VERSION = VD_HEX_VERSION;\n\n constructor({\n element,\n canvas,\n size = 30,\n width = 10,\n height = 10,\n rotation = 0,\n pixelRatio = 'auto',\n cull = true,\n }) {\n this.element = element;\n this.canvas = canvas;\n this.size = size;\n this.width = width;\n this.height = height;\n this.rotation = rotation;\n /** `number | 'auto'` \u2014 canvas backing-store multiplier. */\n this.pixelRatio = pixelRatio;\n /** Viewport culling on/off. */\n this.cull = cull;\n this.hexes = new Map();\n this.selectedHex = null;\n this.listeners = {};\n\n // Spatial bucket index: Map<\"bx,by\", HexCell[]> rebuilt by _generateGrid().\n this._bucketSize = Math.max(size * 2, MIN_BUCKET_SIZE);\n this._index = new Map();\n\n // Adaptive gesture-render state.\n this._gestureCancel = null;\n this._sharpTimer = null;\n this._frameCanvas = null;\n this._frameCtx = null;\n this._frameTransform = null;\n this._stats = {\n total: 0,\n visible: 0,\n drawn: 0,\n mode: 'sharp',\n lastRenderMs: 0,\n pixelRatio: 1,\n scale: 1,\n };\n\n // Transform state for pan/zoom\n this.transform = { x: 0, y: 0, scale: 1 };\n\n // Drag state\n this.dragging = false;\n this.lastPos = null;\n this.hasMoved = false;\n\n // Theme colors\n this.themeColors = this._getThemeColors();\n\n // Custom render callback\n this.customRenderCallback = null;\n\n // Set up canvas if not already done\n if (!this.canvas) {\n this.canvas = element.querySelector('canvas') || document.createElement('canvas');\n if (!element.contains(this.canvas)) {\n element.appendChild(this.canvas);\n }\n }\n\n this.ctx = this.canvas.getContext('2d');\n\n // Generate the grid\n this._generateGrid();\n this._render();\n this._setupEvents();\n\n // Observe theme changes\n this._observeThemeChanges();\n }\n\n /**\n * Get theme colors from CSS custom properties\n */\n _getThemeColors() {\n const root = document.documentElement;\n const style = getComputedStyle(root);\n\n // Prefer Vanduo's canonical --vd-* tokens; fall back to the legacy\n // unprefixed names, then to a hardcoded default.\n const read = (token, legacy, fallback) =>\n style.getPropertyValue(token).trim() || style.getPropertyValue(legacy).trim() || fallback;\n\n return {\n bgPrimary: read('--vd-bg-primary', '--bg-primary', '#ffffff'),\n bgSecondary: read('--vd-bg-secondary', '--bg-secondary', '#f5f5f5'),\n borderColor: read('--vd-border-color', '--border-color', '#e0e0e0'),\n colorPrimary: read('--vd-color-primary', '--color-primary', '#3b82f6'),\n textColor: read('--vd-text-primary', '--text-primary', '#1f2937'),\n textMuted: read('--vd-text-muted', '--text-muted', '#6b7280'),\n };\n }\n\n /**\n * Observe theme changes and re-render when theme changes\n */\n _observeThemeChanges() {\n const reTheme = () => {\n this.themeColors = this._getThemeColors();\n this._render();\n };\n\n // Re-render when the document theme attribute flips (e.g. data-theme).\n this._themeObserver = new MutationObserver(reTheme);\n this._themeObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme'],\n });\n\n // Also follow OS-level light/dark changes that flip token values through a\n // prefers-color-scheme media query without touching any attribute.\n if (typeof window !== 'undefined' && window.matchMedia) {\n this._themeMedia = window.matchMedia('(prefers-color-scheme: dark)');\n this._themeMediaHandler = reTheme;\n this._themeMedia.addEventListener('change', this._themeMediaHandler);\n }\n }\n\n /**\n * Disconnect theme listeners. Call before discarding the instance (for example\n * on SPA navigation) to avoid leaking observers and media-query listeners.\n */\n destroy() {\n this._teardownEvents();\n this._cancelGestureRender();\n if (this._sharpTimer) {\n clearTimeout(this._sharpTimer);\n this._sharpTimer = null;\n }\n this._frameCanvas = null;\n this._frameCtx = null;\n this._frameTransform = null;\n if (this._themeObserver) {\n this._themeObserver.disconnect();\n this._themeObserver = null;\n }\n if (this._themeMedia && this._themeMediaHandler) {\n this._themeMedia.removeEventListener('change', this._themeMediaHandler);\n this._themeMedia = null;\n this._themeMediaHandler = null;\n }\n }\n\n /**\n * Resolve the effective device-pixel-ratio multiplier.\n * @returns {number}\n */\n _resolvePixelRatio() {\n const requested = this.pixelRatio;\n if (requested === 'auto' || requested == null) {\n const dpr =\n typeof window !== 'undefined' && typeof window.devicePixelRatio === 'number'\n ? window.devicePixelRatio\n : 1;\n return Math.max(1, Math.min(dpr || 1, MAX_PIXEL_RATIO));\n }\n const n = Number(requested);\n return Number.isFinite(n) && n > 0 ? n : 1;\n }\n\n /** Request an animation frame, returning a cancel function. */\n _requestFrame(callback) {\n if (typeof requestAnimationFrame === 'function') {\n const id = requestAnimationFrame(callback);\n return () => cancelAnimationFrame(id);\n }\n const id = setTimeout(callback, 16);\n return () => clearTimeout(id);\n }\n\n /** Cancel a pending gesture frame, if any. */\n _cancelGestureRender() {\n if (this._gestureCancel) {\n this._gestureCancel();\n this._gestureCancel = null;\n }\n }\n\n /**\n * Coalesce gesture-driven transform changes into at most one render/frame.\n */\n _scheduleGestureRender() {\n if (this._gestureCancel) return;\n this._gestureCancel = this._requestFrame(() => {\n this._gestureCancel = null;\n this._renderGesture();\n });\n }\n\n /**\n * Schedule a sharp culled re-render after the gesture goes idle.\n */\n _scheduleSharpRender() {\n if (this._sharpTimer) clearTimeout(this._sharpTimer);\n this._sharpTimer = setTimeout(() => {\n this._sharpTimer = null;\n this._render();\n }, SHARP_IDLE_MS);\n }\n\n /** Render the current gesture frame (fast blit or sharp, adaptively). */\n _renderGesture() {\n const visible = this.cull ? this._computeVisibleHexes() : null;\n const count = visible ? visible.length : this.hexes.size;\n if (count > FAST_RENDER_LIMIT && this._frameCanvas) {\n this._blitFrame();\n } else {\n this._render(visible);\n }\n this._scheduleSharpRender();\n }\n\n /**\n * Blit the last sharp frame snapshot offset/scaled for the current transform.\n * The snapshot is in screen (CSS) space at `_frameTransform`; this maps the\n * pixel under the old transform to its position under the current transform.\n */\n _blitFrame() {\n const frame = this._frameCanvas;\n const from = this._frameTransform;\n if (!frame || !from || !frame.width || !frame.height) {\n this._render();\n return;\n }\n const rect = this.canvas.getBoundingClientRect();\n const displayWidth = rect.width || 800;\n const displayHeight = rect.height || 400;\n const ratio = this._resolvePixelRatio();\n const { x, y, scale } = this.transform;\n const k = scale / (from.scale || 1);\n const bx = x - k * from.x;\n const by = y - k * from.y;\n\n this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n this.ctx.fillStyle = this.themeColors.bgPrimary;\n this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);\n this.ctx.setTransform(ratio, 0, 0, ratio, 0, 0);\n this.ctx.drawImage(\n frame,\n 0,\n 0,\n frame.width,\n frame.height,\n bx,\n by,\n displayWidth * k,\n displayHeight * k,\n );\n this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n\n this._stats.mode = 'fast';\n this._stats.pixelRatio = ratio;\n this._stats.scale = scale;\n this._stats.lastRenderMs = 0;\n }\n\n /**\n * Capture the current canvas into the offscreen frame snapshot.\n */\n _captureFrame() {\n const w = this.canvas.width;\n const h = this.canvas.height;\n if (!w || !h) return;\n if (!this._frameCanvas) {\n this._frameCanvas = typeof document !== 'undefined' ? document.createElement('canvas') : null;\n if (!this._frameCanvas) return;\n }\n const frame = this._frameCanvas;\n if (frame.width !== w) frame.width = w;\n if (frame.height !== h) frame.height = h;\n const fctx = frame.getContext('2d');\n if (!fctx) return;\n this._frameCtx = fctx;\n fctx.setTransform(1, 0, 0, 1, 0, 0);\n fctx.clearRect(0, 0, w, h);\n fctx.drawImage(this.canvas, 0, 0);\n this._frameTransform = { ...this.transform };\n }\n\n /**\n * Compute the cells intersecting the current viewport (always culled by the\n * viewport, independent of the `cull` render switch). Uses the spatial bucket\n * index when present.\n * @returns {HexCell[]}\n */\n _computeVisibleHexes() {\n const rect = this.canvas.getBoundingClientRect();\n const displayWidth = rect.width || 800;\n const displayHeight = rect.height || 400;\n const { x, y, scale } = this.transform;\n const minX = -x / scale - this.size;\n const maxX = (displayWidth - x) / scale + this.size;\n const minY = -y / scale - this.size;\n const maxY = (displayHeight - y) / scale + this.size;\n\n if (!this._index || this._index.size === 0) return this.getAllHexes();\n\n const bs = this._bucketSize;\n const bx0 = Math.floor(minX / bs);\n const bx1 = Math.floor(maxX / bs);\n const by0 = Math.floor(minY / bs);\n const by1 = Math.floor(maxY / bs);\n const out = [];\n for (let by = by0; by <= by1; by++) {\n for (let bx = bx0; bx <= bx1; bx++) {\n const bucket = this._index.get(`${bx},${by}`);\n if (!bucket) continue;\n for (let i = 0; i < bucket.length; i++) {\n const hex = bucket[i];\n if (hex.x >= minX && hex.x <= maxX && hex.y >= minY && hex.y <= maxY) {\n out.push(hex);\n }\n }\n }\n }\n return out;\n }\n\n /**\n * Get the cells intersecting the current viewport, sorted by row then column.\n * @returns {HexCell[]}\n */\n getVisibleHexes() {\n return this._computeVisibleHexes().sort((a, b) => a.r - b.r || a.q - b.q);\n }\n\n /**\n * Last-frame render metrics.\n * @returns {{total: number, visible: number, drawn: number, mode: string, lastRenderMs: number, pixelRatio: number, scale: number}}\n */\n getRenderStats() {\n return { ...this._stats };\n }\n\n /**\n * Set the device-pixel-ratio multiplier and re-render (no grid regeneration).\n * @param {number|'auto'} ratio\n */\n setPixelRatio(ratio) {\n this.pixelRatio = ratio;\n this._render();\n }\n\n /**\n * Toggle viewport culling and re-render (no grid regeneration).\n * @param {boolean} cull\n */\n setCull(cull) {\n this.cull = !!cull;\n this._render();\n }\n\n /**\n * Convert screen coordinates to world coordinates\n */\n _screenToWorld(screenX, screenY) {\n const rect = this.canvas.getBoundingClientRect();\n const canvasX = screenX - rect.left;\n const canvasY = screenY - rect.top;\n\n return {\n x: (canvasX - this.transform.x) / this.transform.scale,\n y: (canvasY - this.transform.y) / this.transform.scale,\n };\n }\n\n /**\n * Convert client coordinates to canvas-local coordinates\n */\n _clientToCanvas(clientX, clientY) {\n const rect = this.canvas.getBoundingClientRect();\n return {\n x: clientX - rect.left,\n y: clientY - rect.top,\n };\n }\n\n /**\n * Generate hex grid data\n */\n _generateGrid() {\n this.hexes.clear();\n this._bucketSize = Math.max(this.size * 2, MIN_BUCKET_SIZE);\n this._index = new Map();\n\n for (let r = 0; r < this.height; r++) {\n const qOffset = Math.floor(r / 2);\n for (let q = -qOffset; q < this.width - qOffset; q++) {\n const pixel = hexToPixel(q, r, this.size, this.rotation);\n\n const hex = {\n q,\n r,\n x: pixel.x,\n y: pixel.y,\n fill: this.themeColors.bgSecondary,\n stroke: this.themeColors.borderColor,\n adjacent: getAdjacentHexes(q, r),\n terrain: null,\n data: {},\n };\n this.hexes.set(`${q},${r}`, hex);\n\n const bx = Math.floor(hex.x / this._bucketSize);\n const by = Math.floor(hex.y / this._bucketSize);\n const key = `${bx},${by}`;\n let bucket = this._index.get(key);\n if (!bucket) {\n bucket = [];\n this._index.set(key, bucket);\n }\n bucket.push(hex);\n }\n }\n }\n\n /**\n * Keep selected hex reference in sync after grid regeneration\n */\n _resyncSelectedHex() {\n if (!this.selectedHex) return;\n this.selectedHex = this.hexes.get(`${this.selectedHex.q},${this.selectedHex.r}`) ?? null;\n }\n\n /**\n * Render the hex grid on canvas (synchronous sharp render).\n *\n * @param {HexCell[]|null} [precomputedVisible] - Visible cells to draw when\n * culling is on; computed from the viewport when omitted.\n */\n _render(precomputedVisible) {\n const started = now();\n // Get canvas displayed size\n const rect = this.canvas.getBoundingClientRect();\n const displayWidth = rect.width || 800;\n const displayHeight = rect.height || 400;\n\n // Set canvas internal resolution to CSS size x device-pixel-ratio.\n const ratio = this._resolvePixelRatio();\n const bufferWidth = Math.max(1, Math.round(displayWidth * ratio));\n const bufferHeight = Math.max(1, Math.round(displayHeight * ratio));\n if (this.canvas.width !== bufferWidth) this.canvas.width = bufferWidth;\n if (this.canvas.height !== bufferHeight) this.canvas.height = bufferHeight;\n\n // Clear canvas with theme background (in device pixels).\n this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n this.ctx.fillStyle = this.themeColors.bgPrimary;\n this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\n // Draw in CSS/world coordinates on top of the DPR scale.\n this.ctx.setTransform(ratio, 0, 0, ratio, 0, 0);\n this.ctx.save();\n this.ctx.translate(this.transform.x, this.transform.y);\n this.ctx.scale(this.transform.scale, this.transform.scale);\n\n const visible =\n this.cull && this._index && this._index.size > 0\n ? precomputedVisible || this._computeVisibleHexes()\n : null;\n\n let drawn = 0;\n const drawHex = (hex) => {\n this._drawHex(hex);\n drawn += 1;\n // Call custom render callback if set\n if (this.customRenderCallback) {\n this.customRenderCallback(this.ctx, hex, this.size);\n }\n };\n\n if (visible) {\n for (let i = 0; i < visible.length; i++) drawHex(visible[i]);\n } else {\n this.hexes.forEach(drawHex);\n }\n\n // Redraw selected hex if any (always, even when culled off-screen)\n if (this.selectedHex) {\n this._drawHex(this.selectedHex, true);\n }\n\n this.ctx.restore();\n this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n\n this._stats.total = this.hexes.size;\n this._stats.visible = visible ? visible.length : this.hexes.size;\n this._stats.drawn = drawn;\n this._stats.mode = 'sharp';\n this._stats.pixelRatio = ratio;\n this._stats.scale = this.transform.scale;\n this._stats.lastRenderMs = now() - started;\n\n this._captureFrame();\n }\n\n /**\n * Draw a single hex\n */\n _drawHex(hex, isSelected = false) {\n const corners = getHexCorners(hex.x, hex.y, this.size, this.rotation);\n\n this.ctx.beginPath();\n this.ctx.moveTo(corners[0].x, corners[0].y);\n for (let i = 1; i < corners.length; i++) {\n this.ctx.lineTo(corners[i].x, corners[i].y);\n }\n this.ctx.closePath();\n\n // Determine fill color: terrain > custom fill > theme\n let fill;\n if (isSelected) {\n fill = this.themeColors.colorPrimary;\n } else if (hex.terrain) {\n fill = getTerrainColor(hex.terrain);\n } else if (hex.fill) {\n fill = hex.fill;\n } else {\n fill = this.themeColors.bgSecondary;\n }\n this.ctx.fillStyle = fill;\n this.ctx.fill();\n\n // Stroke with theme color\n const stroke = isSelected\n ? this.themeColors.colorPrimary\n : hex.stroke || this.themeColors.borderColor;\n this.ctx.strokeStyle = stroke;\n this.ctx.lineWidth = isSelected ? 3 : 1;\n this.ctx.stroke();\n\n // Draw coordinates for selected hex\n if (isSelected) {\n this.ctx.fillStyle = '#ffffff';\n this.ctx.font = '10px monospace';\n this.ctx.textAlign = 'center';\n this.ctx.textBaseline = 'middle';\n this.ctx.fillText(`${hex.q},${hex.r}`, hex.x, hex.y);\n }\n }\n\n /**\n * Set up mouse/touch events for hex selection, pan, and zoom\n */\n _setupEvents() {\n // Touch state for pinch-to-zoom\n this.touchState = {\n initialDistance: 0,\n initialScale: 1,\n touches: [],\n };\n\n // Handlers are stored as named references so destroy() can remove every one\n // of them. The canvas may be caller-supplied and reused across grid\n // instances, so anonymous listeners left attached would leak.\n this._canvasHandlers = {\n // Pan - pointer down\n pointerdown: (e) => {\n this.dragging = true;\n this.hasMoved = false;\n this.lastPos = { x: e.clientX, y: e.clientY };\n this.canvas.style.cursor = 'grabbing';\n },\n\n // Pan - pointer move\n pointermove: (e) => {\n if (!this.dragging) return;\n\n const cur = { x: e.clientX, y: e.clientY };\n const dx = cur.x - this.lastPos.x;\n const dy = cur.y - this.lastPos.y;\n\n if (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) {\n this.hasMoved = true;\n }\n\n this.transform.x += dx;\n this.transform.y += dy;\n this.lastPos = cur;\n this._scheduleGestureRender();\n },\n\n // Pan - pointer up / leave (shared stopDrag)\n pointerup: () => {\n const wasDragging = this.dragging;\n this.dragging = false;\n if (wasDragging) {\n // Finish the gesture with a synchronous sharp frame.\n this._cancelGestureRender();\n if (this._sharpTimer) {\n clearTimeout(this._sharpTimer);\n this._sharpTimer = null;\n }\n this._render();\n }\n if (!this.hasMoved) {\n this.canvas.style.cursor = 'pointer';\n }\n },\n\n // Click (tap without drag)\n click: (e) => {\n if (this.hasMoved) return;\n\n const worldPos = this._screenToWorld(e.clientX, e.clientY);\n const hexCoords = pixelToHex(worldPos.x, worldPos.y, this.size, this.rotation);\n const hex = this.hexes.get(`${hexCoords.q},${hexCoords.r}`);\n\n if (hex) {\n this.selectedHex = hex;\n this._render();\n this._emit('select', hex);\n }\n },\n\n // Zoom - mouse wheel\n wheel: (e) => {\n e.preventDefault();\n\n const zoomFactor = e.deltaY > 0 ? 1 - ZOOM_FACTOR : 1 + ZOOM_FACTOR;\n const newScale = Math.max(ZOOM_MIN, Math.min(this.transform.scale * zoomFactor, ZOOM_MAX));\n\n // Zoom toward cursor\n const mouse = this._clientToCanvas(e.clientX, e.clientY);\n\n const scaleDiff = newScale / this.transform.scale;\n this.transform.x = mouse.x - (mouse.x - this.transform.x) * scaleDiff;\n this.transform.y = mouse.y - (mouse.y - this.transform.y) * scaleDiff;\n this.transform.scale = newScale;\n\n this._scheduleGestureRender();\n this._emit('zoom', { scale: this.transform.scale });\n },\n\n // Touch events for pinch-to-zoom\n touchstart: (e) => {\n if (e.touches.length === 2) {\n e.preventDefault();\n this.touchState.touches = Array.from(e.touches);\n this.touchState.initialDistance = this._getTouchDistance(e.touches);\n this.touchState.initialScale = this.transform.scale;\n }\n },\n\n touchmove: (e) => {\n if (e.touches.length === 2) {\n e.preventDefault();\n const currentDistance = this._getTouchDistance(e.touches);\n const scale =\n (currentDistance / this.touchState.initialDistance) * this.touchState.initialScale;\n const newScale = Math.max(ZOOM_MIN, Math.min(scale, ZOOM_MAX));\n\n // Zoom toward center of pinch\n const centerClientX = (e.touches[0].clientX + e.touches[1].clientX) / 2;\n const centerClientY = (e.touches[0].clientY + e.touches[1].clientY) / 2;\n const center = this._clientToCanvas(centerClientX, centerClientY);\n\n const scaleDiff = newScale / this.transform.scale;\n this.transform.x = center.x - (center.x - this.transform.x) * scaleDiff;\n this.transform.y = center.y - (center.y - this.transform.y) * scaleDiff;\n this.transform.scale = newScale;\n\n this._scheduleGestureRender();\n this._emit('zoom', { scale: this.transform.scale });\n }\n },\n\n touchend: () => {\n this.touchState.touches = [];\n this._cancelGestureRender();\n if (this._sharpTimer) {\n clearTimeout(this._sharpTimer);\n this._sharpTimer = null;\n }\n this._render();\n },\n\n // Cursor style\n mouseenter: () => {\n this.canvas.style.cursor = 'grab';\n },\n\n mouseleave: () => {\n this.canvas.style.cursor = 'default';\n },\n };\n\n const h = this._canvasHandlers;\n this.canvas.addEventListener('pointerdown', h.pointerdown);\n this.canvas.addEventListener('pointermove', h.pointermove);\n this.canvas.addEventListener('pointerup', h.pointerup);\n this.canvas.addEventListener('pointerleave', h.pointerup);\n this.canvas.addEventListener('click', h.click);\n this.canvas.addEventListener('wheel', h.wheel, { passive: false });\n this.canvas.addEventListener('touchstart', h.touchstart, { passive: false });\n this.canvas.addEventListener('touchmove', h.touchmove, { passive: false });\n this.canvas.addEventListener('touchend', h.touchend);\n this.canvas.addEventListener('mouseenter', h.mouseenter);\n this.canvas.addEventListener('mouseleave', h.mouseleave);\n }\n\n /**\n * Remove every canvas listener attached by _setupEvents(). Called from\n * destroy() so a caller-supplied, reused canvas does not accumulate handlers.\n */\n _teardownEvents() {\n const h = this._canvasHandlers;\n if (!h || !this.canvas) return;\n this.canvas.removeEventListener('pointerdown', h.pointerdown);\n this.canvas.removeEventListener('pointermove', h.pointermove);\n this.canvas.removeEventListener('pointerup', h.pointerup);\n this.canvas.removeEventListener('pointerleave', h.pointerup);\n this.canvas.removeEventListener('click', h.click);\n this.canvas.removeEventListener('wheel', h.wheel);\n this.canvas.removeEventListener('touchstart', h.touchstart);\n this.canvas.removeEventListener('touchmove', h.touchmove);\n this.canvas.removeEventListener('touchend', h.touchend);\n this.canvas.removeEventListener('mouseenter', h.mouseenter);\n this.canvas.removeEventListener('mouseleave', h.mouseleave);\n this._canvasHandlers = null;\n }\n\n /**\n * Calculate distance between two touch points\n * @param {TouchList} touches - Touch list\n * @returns {number} Distance in pixels\n */\n _getTouchDistance(touches) {\n if (touches.length < 2) return 0;\n const dx = touches[0].clientX - touches[1].clientX;\n const dy = touches[0].clientY - touches[1].clientY;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * Set hex size\n */\n setSize(size) {\n this.size = size;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Set grid dimensions\n */\n setDimensions(width, height) {\n this.width = width;\n this.height = height;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Reset grid to defaults\n */\n reset() {\n this.size = 30;\n this.width = 15;\n this.height = 10;\n this.rotation = 0;\n this.selectedHex = null;\n this.transform = { x: 0, y: 0, scale: 1 };\n this._generateGrid();\n this._render();\n }\n\n /**\n * Fill hexes with random colors\n */\n fillRandom() {\n const colors = [\n '#f0f0f0',\n '#d4e5d4',\n '#e5d4d4',\n '#d4d4e5',\n '#e5e5d4',\n '#d4e5e5',\n '#e8e8e8',\n '#d0d0d0',\n ];\n this.hexes.forEach((hex) => {\n hex.fill = colors[Math.floor(Math.random() * colors.length)];\n });\n this._render();\n }\n\n /**\n * Get hex by coordinates\n */\n getHex(q, r) {\n return this.hexes.get(`${q},${r}`);\n }\n\n /**\n * Get all hexes\n */\n getAllHexes() {\n return Array.from(this.hexes.values());\n }\n\n /**\n * Set hex fill color\n */\n setHexFill(q, r, color) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.fill = color;\n this._render();\n }\n }\n\n /**\n * Reset view to default position\n */\n resetView() {\n this.transform = { x: 0, y: 0, scale: 1 };\n this._render();\n this._emit('pan', { x: 0, y: 0 });\n this._emit('zoom', { scale: 1 });\n }\n\n /**\n * Zoom in\n */\n zoomIn() {\n const newScale = Math.min(this.transform.scale * (1 + ZOOM_FACTOR), ZOOM_MAX);\n this.transform.scale = newScale;\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n }\n\n /**\n * Zoom out\n */\n zoomOut() {\n const newScale = Math.max(this.transform.scale * (1 - ZOOM_FACTOR), ZOOM_MIN);\n this.transform.scale = newScale;\n this._render();\n this._emit('zoom', { scale: this.transform.scale });\n }\n\n /**\n * Get current transform state\n */\n getTransform() {\n return { ...this.transform };\n }\n\n /**\n * Subscribe to events\n */\n on(event, callback) {\n if (!this.listeners[event]) {\n this.listeners[event] = [];\n }\n this.listeners[event].push(callback);\n }\n\n /**\n * Emit events\n */\n _emit(event, data) {\n if (this.listeners[event]) {\n this.listeners[event].forEach((callback) => callback(data));\n }\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Terrain System\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set terrain type for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @param {string} terrainType - Terrain type (e.g., 'GRASSLAND', 'OCEAN')\n */\n setHexTerrain(q, r, terrainType) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.terrain = terrainType;\n this._render();\n }\n }\n\n /**\n * Get terrain type for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {string|null} Terrain type or null\n */\n getHexTerrain(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n return hex ? hex.terrain : null;\n }\n\n /**\n * Generate random terrain for all hexes\n */\n generateRandomTerrain() {\n const terrainTypes = Object.values(TerrainType);\n this.hexes.forEach((hex) => {\n hex.terrain = terrainTypes[Math.floor(Math.random() * terrainTypes.length)];\n });\n this._render();\n }\n\n /**\n * Get terrain yields for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Object} Yields object {food, production, gold}\n */\n getHexYields(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? getTerrainYields(terrain) : { food: 0, production: 0, gold: 0 };\n }\n\n /**\n * Get movement cost for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {number} Movement cost\n */\n getHexMovementCost(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? getMovementCost(terrain) : 999;\n }\n\n /**\n * Check if hex is passable\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {boolean} True if passable\n */\n isHexPassable(q, r) {\n const terrain = this.getHexTerrain(q, r);\n return terrain ? isPassable(terrain) : false;\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Hex Data Attachment\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @param {Object} data - Custom data object\n */\n setHexData(q, r, data) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.data = { ...hex.data, ...data };\n }\n }\n\n /**\n * Get custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {Object} Custom data object\n */\n getHexData(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n return hex ? hex.data : {};\n }\n\n /**\n * Clear custom data for a hex\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n */\n clearHexData(q, r) {\n const hex = this.hexes.get(`${q},${r}`);\n if (hex) {\n hex.data = {};\n }\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Distance & Pathfinding\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Calculate distance between two hexes\n * @param {number} q1 - First hex q coordinate\n * @param {number} r1 - First hex r coordinate\n * @param {number} q2 - Second hex q coordinate\n * @param {number} r2 - Second hex r coordinate\n * @returns {number} Distance in hex steps\n */\n hexDistance(q1, r1, q2, r2) {\n return hexDistance(q1, r1, q2, r2);\n }\n\n /**\n * Get valid moves from a hex within movement points\n * @param {number} q - Starting hex column\n * @param {number} r - Starting hex row\n * @param {number} movementPoints - Available movement points\n * @returns {Array<{q: number, r: number}>} Array of valid hex coordinates\n */\n getValidMoves(q, r, movementPoints) {\n const validHexes = [];\n const adjacent = getAdjacentHexes(q, r);\n\n for (const hex of adjacent) {\n if (!this.hexes.has(`${hex.q},${hex.r}`)) continue;\n\n const cost = this.getHexMovementCost(hex.q, hex.r);\n if (cost < 999 && movementPoints >= cost) {\n validHexes.push(hex);\n }\n }\n\n return validHexes;\n }\n\n /**\n * Get path between two hexes (simple BFS)\n * @param {number} startQ - Starting hex column\n * @param {number} startR - Starting hex row\n * @param {number} endQ - Ending hex column\n * @param {number} endR - Ending hex row\n * @returns {Array<{q: number, r: number}>} Array of hex coordinates forming path\n */\n getPath(startQ, startR, endQ, endR) {\n const startKey = `${startQ},${startR}`;\n const endKey = `${endQ},${endR}`;\n\n if (!this.hexes.has(startKey) || !this.hexes.has(endKey)) {\n return [];\n }\n\n const queue = [[startQ, startR]];\n const visited = new Set([startKey]);\n const parent = new Map();\n\n while (queue.length > 0) {\n const [currentQ, currentR] = queue.shift();\n const currentKey = `${currentQ},${currentR}`;\n\n if (currentKey === endKey) {\n // Reconstruct path\n const path = [];\n let key = endKey;\n while (key) {\n const [q, r] = key.split(',').map(Number);\n path.unshift({ q, r });\n key = parent.get(key);\n }\n return path;\n }\n\n const adjacent = getAdjacentHexes(currentQ, currentR);\n for (const neighbor of adjacent) {\n const neighborKey = `${neighbor.q},${neighbor.r}`;\n if (this.hexes.has(neighborKey) && !visited.has(neighborKey)) {\n if (this.isHexPassable(neighbor.q, neighbor.r)) {\n visited.add(neighborKey);\n parent.set(neighborKey, currentKey);\n queue.push([neighbor.q, neighbor.r]);\n }\n }\n }\n }\n\n return []; // No path found\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Grid Rotation\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set grid rotation\n * @param {number} rotation - Rotation in radians\n */\n setRotation(rotation) {\n this.rotation = rotation;\n this._generateGrid();\n this._resyncSelectedHex();\n this._render();\n }\n\n /**\n * Get current grid rotation\n * @returns {number} Rotation in radians\n */\n getRotation() {\n return this.rotation;\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Custom Rendering\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Set custom render callback for each hex\n * @param {function} callback - Called with (ctx, hex, size) for each hex\n */\n setCustomRender(callback) {\n this.customRenderCallback = callback;\n this._render();\n }\n\n /**\n * Clear custom render callback\n */\n clearCustomRender() {\n this.customRenderCallback = null;\n this._render();\n }\n\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n // Utility Methods\n // \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n /**\n * Check if hex exists at coordinates\n * @param {number} q - Hex column\n * @param {number} r - Hex row\n * @returns {boolean}\n */\n hasHex(q, r) {\n return this.hexes.has(`${q},${r}`);\n }\n\n /**\n * Get hex count\n * @returns {number} Number of hexes in grid\n */\n getHexCount() {\n return this.hexes.size;\n }\n\n /**\n * Export terrain data as JSON\n * @returns {Object} Terrain data object\n */\n exportTerrainData() {\n const data = {};\n this.hexes.forEach((hex, key) => {\n if (hex.terrain) {\n data[key] = hex.terrain;\n }\n });\n return data;\n }\n\n /**\n * Import terrain data from JSON\n * @param {Object} data - Terrain data object\n */\n importTerrainData(data) {\n Object.entries(data).forEach(([key, terrain]) => {\n const [q, r] = key.split(',').map(Number);\n this.setHexTerrain(q, r, terrain);\n });\n }\n}\n"],
5
+ "mappings": ";;;;;AASA,SAAS,iBAAiB,GAAG,KAAK,WAAW,iBAAiB,aAAa;;;ACCpE,SAAS,YAAY,GAAG,GAAG,WAAW,GAAG;AAC9C,MAAI,CAAC,UAAU;AACb,WAAO,EAAE,GAAG,EAAE;AAAA,EAChB;AAEA,QAAM,SAAS,KAAK,IAAI,QAAQ;AAChC,QAAM,SAAS,KAAK,IAAI,QAAQ;AAEhC,SAAO;AAAA,IACL,GAAG,IAAI,SAAS,IAAI;AAAA,IACpB,GAAG,IAAI,SAAS,IAAI;AAAA,EACtB;AACF;AASO,SAAS,cAAc,GAAG,GAAG,WAAW,GAAG;AAChD,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AA,MACpF,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,SAAS,SAAS,QAAQ,OAAO,EAAE,CAAC;AAAA,IAC5F,CAAC;AAAA,EACL;AACF,CAAC;",
6
+ "names": ["id", "h", "VdHexGrid"]
7
7
  }
@@ -10,6 +10,10 @@ export interface VdHexGridProps {
10
10
  height?: number;
11
11
  /** Grid rotation in radians. Default 0. */
12
12
  rotation?: number;
13
+ /** Canvas backing-store multiplier: a number or `'auto'` (default). */
14
+ pixelRatio?: number | 'auto';
15
+ /** Viewport culling. Default true. */
16
+ cull?: boolean;
13
17
  }
14
18
 
15
19
  /**
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // src/index.js
2
2
  var VD3_CBUN_VERSIONS = Object.freeze({
3
3
  charts: "1.1.0",
4
- "code-editor": "1.0.1",
4
+ "code-editor": "1.1.0",
5
5
  draw: "1.1.0",
6
6
  flowchart: "1.2.0",
7
- "hex-grid": "1.0.1",
7
+ "hex-grid": "1.1.0",
8
8
  "music-player": "1.0.1"
9
9
  });
10
10
  export {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
- "sourcesContent": ["// Root entry of @vanduo-oss/vd3-cbun.\n//\n// Exposes ONLY the per-component VERSION-constants map. Component APIs live on\n// the subpath exports (./charts, ./code-editor, ./draw, ./flowchart, ./hex-grid,\n// ./music-player) so importing one component never pulls in another\n// (tree-shaking contract).\n//\n// The values below are hardcoded mirrors of component-versions.json (the\n// manifest is the source of truth). The version-consistency check \u2014\n// tests/smoke.spec.ts \u2014 asserts the two stay in sync; bump both together.\n// Note: `flowchart` continues the old-line 1.2.0 lineage because\n// VD_FLOWCHART_VERSION is serialized into user documents via toJSON().version.\n\nexport const VD3_CBUN_VERSIONS = Object.freeze({\n charts: '1.1.0',\n 'code-editor': '1.0.1',\n draw: '1.1.0',\n flowchart: '1.2.0',\n 'hex-grid': '1.0.1',\n 'music-player': '1.0.1',\n});\n"],
5
- "mappings": ";AAaO,IAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,gBAAgB;AAClB,CAAC;",
4
+ "sourcesContent": ["// Root entry of @vanduo-oss/vd3-cbun.\n//\n// Exposes ONLY the per-component VERSION-constants map. Component APIs live on\n// the subpath exports (./charts, ./code-editor, ./code-editor/highlight, ./draw,\n// ./flowchart, ./hex-grid, ./music-player) so importing one component never\n// pulls in another\n// (tree-shaking contract).\n//\n// The values below are hardcoded mirrors of component-versions.json (the\n// manifest is the source of truth). The version-consistency check \u2014\n// tests/smoke.spec.ts \u2014 asserts the two stay in sync; bump both together.\n// Note: `flowchart` continues the old-line 1.2.0 lineage because\n// VD_FLOWCHART_VERSION is serialized into user documents via toJSON().version.\n\nexport const VD3_CBUN_VERSIONS = Object.freeze({\n charts: '1.1.0',\n 'code-editor': '1.1.0',\n draw: '1.1.0',\n flowchart: '1.2.0',\n 'hex-grid': '1.1.0',\n 'music-player': '1.0.1',\n});\n"],
5
+ "mappings": ";AAcO,IAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,gBAAgB;AAClB,CAAC;",
6
6
  "names": []
7
7
  }