Skip to content

v1.3.0

@ers-zaes ers-zaes tagged this 29 Jul 01:04
Until now the tarball was dist/ only, and dist was built from
src/tacticalgraphics/ only - so every style function, adapter, holder and
controller stayed in the repo. A consumer got geometry plus a hostility property
and wrote their own renderer, which is why today's "hostile line work goes red"
fix could not reach anyone. Ships now as
@zaes/tactical-graphics/openlayers, with `ol` and `milsymbol` as OPTIONAL peer
dependencies: installing the package for its geometry alone still pulls in
neither.

The two-layer split survives and is now enforced instead of assumed. Layer 1
still never imports ol; build-lib.js greps the emitted dist/cjs and dist/esm and
throws if one appears. src/components/openlayers/index.ts is the subpath's
public barrel - 106 exports; the React demo and the sample gallery stay
unpublished.

Two defects had to be fixed first, both invisible until the package is actually
consumed:

- openlayerStyles.ts created its text-measuring canvas at module load, so the
  first require() from plain Node died with "document is not defined" - and so
  would a Next.js server render. Now lazy, with a zero-width fallback.
- Three `import x from './y.svg'` statements needed a webpack loader that tsc
  cannot provide. Inlined as data: URIs, with a test that decodes each and
  compares it against the .svg file so the two cannot drift.

Verified as a consumer, which is the only verification that means anything:
npm pack, install the tarball into an empty project beside ol and milsymbol,
render through getController, stamp a hostility with writeGraphicProperties, and
watch the fields-of-fire line work go from #000000 to rgba(255, 0, 0, 1),
rectangle included.

Minor, not patch: new entry point, no breaking change to the existing one.
Assets 2
Loading