react-threat-map 0.2.2 → 0.2.3
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.
- package/DECISIONS.md +22 -0
- package/dist/index.cjs +6 -2
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/DECISIONS.md
CHANGED
|
@@ -394,6 +394,28 @@ their own render there. Every one of those call sites issues a single `setState`
|
|
|
394
394
|
practical cost is nil — but a future hook that sets two pieces of state in one async
|
|
395
395
|
callback would render twice on the floor and once on 18+.
|
|
396
396
|
|
|
397
|
+
### Known behavioural differences on the floor
|
|
398
|
+
|
|
399
|
+
Each of these is invisible to a suite running on 18, so each carries a guard that fails on
|
|
400
|
+
any version. Append to this list rather than fixing quietly — the entries are the only
|
|
401
|
+
record of what the static allowlist cannot reach.
|
|
402
|
+
|
|
403
|
+
**1. Numeric style values.** React appends `px` to numeric `style` values unless the property
|
|
404
|
+
is on its unitless allowlist, and `aspectRatio` only joined that list in React 18. The
|
|
405
|
+
wrapper's fallback ratio was emitted as a number, so on 16.14/17 it serialized to
|
|
406
|
+
`aspect-ratio: 2px` — invalid, dropped by the browser, wrapper collapsed to zero height,
|
|
407
|
+
absolutely-positioned canvases gated off, **map entirely invisible**. It affected every
|
|
408
|
+
projection, not just custom ones, and the whole no-explicit-`height` default path.
|
|
409
|
+
|
|
410
|
+
Found by a consumer on React 16.14, not by CI — precisely the gap this section predicted.
|
|
411
|
+
Fixed by `aspectRatioStyleFor` in `src/render/projection.ts`, which stringifies deliberately;
|
|
412
|
+
guarded by `tests/render/projection.test.ts`, which asserts the emitted **type** rather than
|
|
413
|
+
the rendered value, since the rendered value is correct on 18 either way.
|
|
414
|
+
|
|
415
|
+
The general rule this implies: **any numeric value handed to `style` must be checked against
|
|
416
|
+
React 17's unitless allowlist, or stringified.** `lineHeight` and `flexGrow` are on that list
|
|
417
|
+
and safe; `scale`, `translate`, `rotate` and `inset` are not.
|
|
418
|
+
|
|
397
419
|
---
|
|
398
420
|
|
|
399
421
|
## 8. Package entry points: per-condition types, plus a `typesVersions` fallback
|
package/dist/index.cjs
CHANGED
|
@@ -345,6 +345,9 @@ function defaultHeightFor(spec, width) {
|
|
|
345
345
|
function aspectRatioFor(spec) {
|
|
346
346
|
return 1 / ratioFor(spec);
|
|
347
347
|
}
|
|
348
|
+
function aspectRatioStyleFor(spec) {
|
|
349
|
+
return String(aspectRatioFor(spec));
|
|
350
|
+
}
|
|
348
351
|
var SPHERE = { type: "Sphere" };
|
|
349
352
|
function createProjection(spec, width, height) {
|
|
350
353
|
const projection = typeof spec === "string" ? (factories[spec] ?? factories.naturalEarth1)() : spec;
|
|
@@ -1326,8 +1329,9 @@ function ThreatMap(props) {
|
|
|
1326
1329
|
// which gates off the canvases, which keeps it collapsed. `aspect-ratio`
|
|
1327
1330
|
// is inert the moment anything else determines the height — a CSS class,
|
|
1328
1331
|
// a flex parent, or the consumer's own `style` below — so it sets a
|
|
1329
|
-
// floor without taking the decision away from them.
|
|
1330
|
-
|
|
1332
|
+
// floor without taking the decision away from them. The value is a string
|
|
1333
|
+
// for React 16.14/17's sake; see aspectRatioStyleFor.
|
|
1334
|
+
...heightProp !== void 0 ? { height: heightProp } : { aspectRatio: aspectRatioStyleFor(projectionProp) },
|
|
1331
1335
|
...style
|
|
1332
1336
|
},
|
|
1333
1337
|
role: "img",
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,9 @@ function defaultHeightFor(spec, width) {
|
|
|
344
344
|
function aspectRatioFor(spec) {
|
|
345
345
|
return 1 / ratioFor(spec);
|
|
346
346
|
}
|
|
347
|
+
function aspectRatioStyleFor(spec) {
|
|
348
|
+
return String(aspectRatioFor(spec));
|
|
349
|
+
}
|
|
347
350
|
var SPHERE = { type: "Sphere" };
|
|
348
351
|
function createProjection(spec, width, height) {
|
|
349
352
|
const projection = typeof spec === "string" ? (factories[spec] ?? factories.naturalEarth1)() : spec;
|
|
@@ -1325,8 +1328,9 @@ function ThreatMap(props) {
|
|
|
1325
1328
|
// which gates off the canvases, which keeps it collapsed. `aspect-ratio`
|
|
1326
1329
|
// is inert the moment anything else determines the height — a CSS class,
|
|
1327
1330
|
// a flex parent, or the consumer's own `style` below — so it sets a
|
|
1328
|
-
// floor without taking the decision away from them.
|
|
1329
|
-
|
|
1331
|
+
// floor without taking the decision away from them. The value is a string
|
|
1332
|
+
// for React 16.14/17's sake; see aspectRatioStyleFor.
|
|
1333
|
+
...heightProp !== void 0 ? { height: heightProp } : { aspectRatio: aspectRatioStyleFor(projectionProp) },
|
|
1330
1334
|
...style
|
|
1331
1335
|
},
|
|
1332
1336
|
role: "img",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-threat-map",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A React component that renders animated cyberattack threats on a static world map, with intelligent per-region aggregation and first-class US state support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|