Packages@accelint/ntds
Overview
NTDS-compliant SVG icon components and spritesheet for tactical military displays
Overview
The @accelint/ntds package provides two rendering approaches for NTDS tactical symbols:
- React SVG Components - Individual components for flexible UI integration
- Spritesheet Constants - Numeric IDs for efficient canvas/WebGL rendering
All symbols follow NTDS (Naval Tactical Data System) standards for military tactical displays.
Installation
pnpm add @accelint/ntds react react-domQuick Start
Using SVG Components
import { SvgAirFriend } from '@accelint/ntds/core/air-friend';
import { NTDS_COLOR_FRIEND } from '@accelint/ntds/constants';
function TacticalIcon() {
return (
<SvgAirFriend
fill={NTDS_COLOR_FRIEND}
width={32}
height={32}
title="Friendly F-16"
/>
);
}Using Spritesheet Constants
import { AIR_FRIEND, SURFACE_HOSTILE } from '@accelint/ntds/spritesheets/masked';
// Use sprite IDs with your rendering engine
const friendlyAircraftSprite = spritesheet.getFrame(AIR_FRIEND);
const hostileShipSprite = spritesheet.getFrame(SURFACE_HOSTILE);Package Exports
Color Constants
Standard NTDS affiliation colors:
import {
NTDS_COLOR_FRIEND, // Blue (#1484F4)
NTDS_COLOR_HOSTILE, // Red (#FF0033)
NTDS_COLOR_UNKNOWN, // Yellow (#EDDA0A)
NTDS_COLOR_NEUTRAL, // Purple (#5B137A)
NTDS_COLOR_ASSUMED_FRIEND, // Green (#0E8F37)
NTDS_COLOR_SUSPECT, // Orange (#FFAD38)
NTDS_COLOR_PENDING, // Dark gray (#404040)
} from '@accelint/ntds/constants';SVG Components
47 React components for NTDS tactical symbols:
Air Domain:
SvgAirFriend,SvgAirHostile,SvgAirUnknownSvgAirBaseFriend,SvgAirBaseHostile,SvgAirBaseUnknownSvgAirGroupFriend,SvgAirGroupHostile,SvgAirGroupUnknownSvgHelicopterFriend,SvgHelicopterHostile,SvgHelicopterUnknown
Surface Domain:
SvgSurfaceFriend,SvgSurfaceHostile,SvgSurfaceUnknownSvgSurfaceGroupFriend,SvgSurfaceGroupHostile,SvgSurfaceGroupUnknownSvgCarrierFriend,SvgCarrierHostile,SvgCarrierUnknown
Subsurface Domain:
SvgSubSurfaceFriend,SvgSubSurfaceHostile,SvgSubSurfaceUnknownSvgSubGroupFriend,SvgSubGroupHostile,SvgSubGroupUnknown
Land Domain:
SvgLandFriend,SvgLandHostile,SvgLandUnknownSvgBaseFriend,SvgBaseHostile,SvgBaseUnknown
Weapons & Infrastructure:
SvgMissileFriend,SvgMissileHostile,SvgMissileUnknownSvgTorpedoFriend,SvgTorpedoHostile,SvgTorpedoUnknownSvgTarget,SvgSam,SvgMineFieldSvgPort,SvgRunway,SvgStructure,SvgPol,SvgCommunications
Spritesheet Constants
64 numeric string identifiers for sprite-based rendering:
import {
AIR_FRIEND,
AIR_HOSTILE,
SURFACE_FRIEND,
SURFACE_HOSTILE,
// ... and 60 more constants
} from '@accelint/ntds/spritesheets/masked';Usage Patterns
Pattern: Dynamic Entity Rendering
import { NTDS_COLOR_FRIEND, NTDS_COLOR_HOSTILE } from '@accelint/ntds/constants';
import { SvgAirFriend } from '@accelint/ntds/core/air-friend';
import { SvgAirHostile } from '@accelint/ntds/core/air-hostile';
type Entity = {
id: string;
type: 'air' | 'surface' | 'subsurface';
affiliation: 'friend' | 'hostile';
position: { x: number; y: number };
};
function EntityIcon({ entity }: { entity: Entity }) {
const Component = entity.affiliation === 'friend'
? SvgAirFriend
: SvgAirHostile;
const color = entity.affiliation === 'friend'
? NTDS_COLOR_FRIEND
: NTDS_COLOR_HOSTILE;
return <Component fill={color} title={entity.id} />;
}Pattern: Tactical Map with Multiple Entities
import { SvgAirFriend, SvgSurfaceHostile } from '@accelint/ntds';
import { NTDS_COLOR_FRIEND, NTDS_COLOR_HOSTILE } from '@accelint/ntds/constants';
function TacticalMap({ entities }) {
return (
<svg width={800} height={600} viewBox="0 0 800 600">
{entities.map((entity) => (
<g
key={entity.id}
transform={`translate(${entity.x}, ${entity.y})`}
>
{entity.type === 'air' && entity.affiliation === 'friend' && (
<SvgAirFriend fill={NTDS_COLOR_FRIEND} />
)}
{entity.type === 'surface' && entity.affiliation === 'hostile' && (
<SvgSurfaceHostile fill={NTDS_COLOR_HOSTILE} />
)}
</g>
))}
</svg>
);
}Pattern: Spritesheet Rendering for Performance
import { AIR_FRIEND, SURFACE_HOSTILE } from '@accelint/ntds/spritesheets/masked';
class HighPerformanceCop {
private spritesheet: HTMLImageElement;
private spriteData: SpritesheetData;
renderEntities(entities: Entity[], ctx: CanvasRenderingContext2D): void {
for (const entity of entities) {
const spriteId = this.getSpriteId(entity);
const sprite = this.spriteData.frames[spriteId];
ctx.drawImage(
this.spritesheet,
sprite.frame.x,
sprite.frame.y,
sprite.frame.w,
sprite.frame.h,
entity.x,
entity.y,
24,
24
);
}
}
}Type Safety
All exports are fully typed:
import type { SVGProps } from 'react';
// Component props type
type IconProps = SVGProps<SVGSVGElement> & {
title?: string;
titleId?: string;
};
// Sprite ID type (from constants)
type SpriteId = string;
// Color type (from constants)
type NtdsColor = string; // hex color stringsBrowser Support
- Modern browsers with SVG support
- React 19+
- Canvas/WebGL for spritesheet rendering
Performance Considerations
Use SVG Components when:
- Building React UIs with moderate entity counts (< 100 entities)
- Need interactive icons with hover states, clicks
- Styling flexibility is important
- Accessibility features (titles, ARIA labels) are required
Use Spritesheet Constants when:
- Rendering hundreds or thousands of entities
- Building canvas/WebGL-based tactical displays
- Performance is critical
- COP or real-time tracking applications
Examples
Example: Legend Component
import { SvgAirFriend, SvgSurfaceHostile } from '@accelint/ntds';
import { NTDS_COLOR_FRIEND, NTDS_COLOR_HOSTILE } from '@accelint/ntds/constants';
function TacticalLegend() {
return (
<div className="legend">
<h3>Entity Types</h3>
<div className="legend-item">
<SvgAirFriend fill={NTDS_COLOR_FRIEND} />
<span>Friendly Aircraft</span>
</div>
<div className="legend-item">
<SvgSurfaceHostile fill={NTDS_COLOR_HOSTILE} />
<span>Hostile Surface Vessel</span>
</div>
</div>
);
}Example: Interactive Selectable Entity
import { useState } from 'react';
import { SvgHelicopterFriend } from '@accelint/ntds/core/helicopter-friend';
import { NTDS_COLOR_FRIEND } from '@accelint/ntds/constants';
function SelectableEntity({ entity, onSelect }) {
const [isHovered, setIsHovered] = useState(false);
return (
<SvgHelicopterFriend
fill={isHovered ? '#00A0FF' : NTDS_COLOR_FRIEND}
width={32}
height={32}
title={entity.callsign}
onClick={() => onSelect(entity)}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
style={{
cursor: 'pointer',
transition: 'fill 0.2s',
}}
/>
);
}Contributing
This package is generated from NTDS-compliant SVG source files using the smeegl tool. To add new symbols:
- Add SVG files to
packages/ntds/icons/core/orpackages/ntds/icons/masked/ - Run
pnpm buildto regenerate components and spritesheet - Run
pnpm indexto update package exports
License
Apache-2.0
Related Packages
@accelint/design-toolkit- UI component library@accelint/icons- General purpose icon library