milsymbol is distributed as a single JavaScript package with no runtime dependencies. It ships with CommonJS, ES module, and browser-global builds, plus a bundled TypeScript declaration file. You can install it from the npm registry or load it directly in an HTML page via aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/spatialillusions/milsymbol/llms.txt
Use this file to discover all available pages before exploring further.
<script> tag.
Package Installation
Module Formats
milsymbol supports all common JavaScript module formats. Choose the one that matches your build environment.- ES Modules
- CommonJS
- Browser Script Tag
- AMD / Dojo
Use the named default import in any ESM-capable environment — modern browsers, bundlers (Webpack, Rollup, Vite), or Node.js with The ESM entry point is
"type": "module".index.js, which re-exports the fully assembled ms namespace including all built-in standard icon sets (APP-6 B, 2525B, 2525C, APP-6 D, 2525D, 2525E).TypeScript Support
milsymbol ships with a bundledindex.d.ts declaration file. No additional @types package is required. The "types" field in package.json points to ./index.d.ts, so TypeScript resolves types automatically.
| Type | Description |
|---|---|
SymbolOptions | Interface for all constructor and setOptions arguments |
SymbolMetadata | Return type of sym.getMetadata() |
SymbolColors | Return type of sym.getColors() |
ColorMode | Color object with per-affiliation color strings |
DrawInstruction | Union type for all JSON draw instruction shapes |
ExtensionFunction | Function signature for ms.addSymbolPart extensions |
Extending TypeScript Types
If you are building an extension that introduces custom symbol options, you can augment theSymbolOptions interface using TypeScript module augmentation. Create a declaration file in your project:
Node.js Usage
milsymbol works in Node.js without any additional setup for SVG output. The.asSVG() and .asDOM() methods have no browser DOM dependency. The .asCanvas() method requires a Canvas implementation — libraries such as node-canvas or canvas can be used to polyfill HTMLCanvasElement in a Node.js environment.
Entry point summary:
index.js— ES module entry point (used when bundlers or Node.js resolve the"import"condition). Import withimport ms from "milsymbol".dist/milsymbol.js— Minified UMD bundle (used byrequire("milsymbol"), browser<script>tags, and AMD loaders). Thedist/folder contains apackage.jsonwith"type": "commonjs"to ensure correct resolution in Node.js.index.d.ts— TypeScript declarations, shared by both entry points.
