@guardian/interactive-component-library 0.2.0-rc2 → 0.2.0-rc3
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/dist/components/molecules/canvas-map/lib/Map.js +2 -2
- package/dist/components/molecules/canvas-map/lib/projection/index.js +1 -1
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +1 -1
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +2 -2
- package/dist/components/molecules/modal/index.js +2 -2
- package/dist/components/molecules/result-summary/index.js +3 -1
- package/dist/components/molecules/svg-map/index.js +2 -1
- package/dist/components/molecules/svg-map/layers/Polygon.js +1 -1
- package/dist/components/particles/relative-time-sentence/index.js +2 -2
- package/package.json +1 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -8
- package/dist/_virtual/dayjs.min.js +0 -4
- package/dist/_virtual/relativeTime.js +0 -4
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/albersUk.js +0 -108
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/bounds.js +0 -24
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/fit.js +0 -18
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/math.js +0 -4
- package/dist/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +0 -70
- package/dist/node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js +0 -6
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js +0 -24
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js +0 -4
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js +0 -8
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js +0 -20
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js +0 -43
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js +0 -28
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js +0 -59
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js +0 -18
- package/dist/node_modules/.pnpm/d3-path@2.0.0/node_modules/d3-path/src/path.js +0 -73
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js +0 -13
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +0 -96
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js +0 -21
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js +0 -5
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js +0 -9
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js +0 -39
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js +0 -55
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js +0 -42
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js +0 -14
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js +0 -15
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js +0 -23
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js +0 -16
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js +0 -68
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js +0 -11
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js +0 -23
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js +0 -13
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js +0 -125
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js +0 -20
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js +0 -24
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js +0 -8
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js +0 -47
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js +0 -25
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js +0 -18
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js +0 -25
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js +0 -22
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js +0 -64
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/dayjs.min.js +0 -282
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/plugin/relativeTime.js +0 -48
- package/dist/node_modules/.pnpm/flatbush@4.4.0/node_modules/flatbush/index.js +0 -339
- package/dist/node_modules/.pnpm/flatqueue@2.0.3/node_modules/flatqueue/index.js +0 -67
- package/dist/node_modules/.pnpm/preact-merge-refs@1.0.2_preact@10.21.0/node_modules/preact-merge-refs/lib/preact-merge-refs.modern.js +0 -10
- package/dist/node_modules/.pnpm/preact-transitioning@1.4.1_preact@10.21.0/node_modules/preact-transitioning/lib/preact-transitioning.modern.js +0 -63
- package/dist/node_modules/.pnpm/quickselect@2.0.0/node_modules/quickselect/index.js +0 -47
- package/dist/node_modules/.pnpm/rbush-knn@4.0.0/node_modules/rbush-knn/index.js +0 -42
- package/dist/node_modules/.pnpm/rbush@4.0.0/node_modules/rbush/index.js +0 -378
- package/dist/node_modules/.pnpm/tinyqueue@2.0.3/node_modules/tinyqueue/index.js +0 -65
|
@@ -5,10 +5,10 @@ import { containsCoordinate } from "./util/extent.js";
|
|
|
5
5
|
import { MapRenderer } from "./renderers/MapRenderer.js";
|
|
6
6
|
import { zoomIdentity, zoom } from "d3-zoom";
|
|
7
7
|
import { select } from "d3-selection";
|
|
8
|
+
import { timer } from "d3-timer";
|
|
8
9
|
import { Dispatcher } from "./events/Dispatcher.js";
|
|
9
10
|
import { MapEvent } from "./events/MapEvent.js";
|
|
10
|
-
import "
|
|
11
|
-
import { timer } from "../../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js";
|
|
11
|
+
import "d3-transition";
|
|
12
12
|
class Map {
|
|
13
13
|
constructor(config) {
|
|
14
14
|
if (config.debug) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { geoIdentity, geoMercator, geoAlbersUsa, geoAlbers } from "d3-geo";
|
|
2
|
-
import geoAlbersUk from "
|
|
2
|
+
import { geoAlbersUk } from "d3-composite-projections";
|
|
3
3
|
const Projection = {
|
|
4
4
|
geoIdentity: geoIdentity(),
|
|
5
5
|
geoMercator: geoMercator(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import RBush from "
|
|
2
|
-
import knn from "
|
|
1
|
+
import RBush from "rbush";
|
|
2
|
+
import knn from "rbush-knn";
|
|
3
3
|
import { Dispatcher } from "../events/Dispatcher.js";
|
|
4
4
|
import { MapEvent } from "../events/MapEvent.js";
|
|
5
5
|
class VectorSource {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "preact/jsx-runtime";
|
|
2
2
|
import { useRef, useCallback, useEffect } from "preact/hooks";
|
|
3
|
-
import { CSSTransition
|
|
3
|
+
import { CSSTransition } from "preact-transitioning";
|
|
4
4
|
import defaultStyles from "./style.module.css.js";
|
|
5
5
|
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
6
6
|
function Modal({
|
|
@@ -33,7 +33,7 @@ function Modal({
|
|
|
33
33
|
}, [onClick, visible]);
|
|
34
34
|
if (typeof document === "undefined") return;
|
|
35
35
|
return /* @__PURE__ */ jsx(
|
|
36
|
-
|
|
36
|
+
CSSTransition,
|
|
37
37
|
{
|
|
38
38
|
in: visible,
|
|
39
39
|
duration: 300,
|
|
@@ -10,11 +10,13 @@ import "../../particles/info-button/index.js";
|
|
|
10
10
|
import { RelativeTimeSentence } from "../../particles/relative-time-sentence/index.js";
|
|
11
11
|
import defaultStyles from "./style.module.css.js";
|
|
12
12
|
import "preact";
|
|
13
|
-
import "
|
|
13
|
+
import "preact-transitioning";
|
|
14
14
|
import "../svg-map/index.js";
|
|
15
15
|
import "../canvas-map/Map.js";
|
|
16
16
|
import "d3-geo";
|
|
17
17
|
import "../canvas-map/lib/projection/index.js";
|
|
18
|
+
import "rbush";
|
|
19
|
+
import "rbush-knn";
|
|
18
20
|
import "../canvas-map/context/MapContext.js";
|
|
19
21
|
function ResultSummary({
|
|
20
22
|
previous,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "preact/jsx-runtime";
|
|
2
2
|
import { geoAlbers, geoMercator } from "d3-geo";
|
|
3
|
-
import geoAlbersUk from "
|
|
3
|
+
import { geoAlbersUk } from "d3-composite-projections";
|
|
4
4
|
import { SVGMapProvider } from "./context/SVGMapProvider.js";
|
|
5
5
|
import { SVGRenderer } from "./renderers/SVGRenderer.js";
|
|
6
6
|
import { cloneElement } from "preact";
|
|
@@ -10,6 +10,7 @@ import { useThrowIfNonLayerChildren } from "./hooks/useThrowIfNonLayerChildren.j
|
|
|
10
10
|
import { useContainerSize } from "../../../shared/hooks/useContainerSize.js";
|
|
11
11
|
import styles from "./style.module.css.js";
|
|
12
12
|
import "./context/MapContext.js";
|
|
13
|
+
import "flatbush";
|
|
13
14
|
const _Projection = {
|
|
14
15
|
geoAlbersUKComposite: geoAlbersUk(),
|
|
15
16
|
geoAlbersEngland: geoAlbers().center([0, 52.7]).rotate([1.1743, 0]).parallels([50, 54]),
|
|
@@ -3,7 +3,7 @@ import { useContext, useState, useEffect, useCallback } from "preact/hooks";
|
|
|
3
3
|
import { MapContext } from "../context/MapContext.js";
|
|
4
4
|
import { dynamicPropValue } from "../helpers/dynamicPropValue.js";
|
|
5
5
|
import { geoContains } from "d3-geo";
|
|
6
|
-
import Flatbush from "
|
|
6
|
+
import Flatbush from "flatbush";
|
|
7
7
|
function Polygon({
|
|
8
8
|
id,
|
|
9
9
|
features,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "preact/jsx-runtime";
|
|
2
2
|
import defaultStyles from "./style.module.css.js";
|
|
3
3
|
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
4
|
-
import dayjs from "
|
|
5
|
-
import relativeTime from "
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
6
6
|
dayjs.extend(relativeTime);
|
|
7
7
|
const RelativeTimeSentence = ({ timeStamp, styles }) => {
|
|
8
8
|
styles = mergeStyles({ ...defaultStyles }, styles);
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
-
function getDefaultExportFromCjs(x) {
|
|
3
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
commonjsGlobal,
|
|
7
|
-
getDefaultExportFromCjs
|
|
8
|
-
};
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import define, { extend } from "./define.js";
|
|
2
|
-
function Color() {
|
|
3
|
-
}
|
|
4
|
-
var darker = 0.7;
|
|
5
|
-
var brighter = 1 / darker;
|
|
6
|
-
var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
7
|
-
var named = {
|
|
8
|
-
aliceblue: 15792383,
|
|
9
|
-
antiquewhite: 16444375,
|
|
10
|
-
aqua: 65535,
|
|
11
|
-
aquamarine: 8388564,
|
|
12
|
-
azure: 15794175,
|
|
13
|
-
beige: 16119260,
|
|
14
|
-
bisque: 16770244,
|
|
15
|
-
black: 0,
|
|
16
|
-
blanchedalmond: 16772045,
|
|
17
|
-
blue: 255,
|
|
18
|
-
blueviolet: 9055202,
|
|
19
|
-
brown: 10824234,
|
|
20
|
-
burlywood: 14596231,
|
|
21
|
-
cadetblue: 6266528,
|
|
22
|
-
chartreuse: 8388352,
|
|
23
|
-
chocolate: 13789470,
|
|
24
|
-
coral: 16744272,
|
|
25
|
-
cornflowerblue: 6591981,
|
|
26
|
-
cornsilk: 16775388,
|
|
27
|
-
crimson: 14423100,
|
|
28
|
-
cyan: 65535,
|
|
29
|
-
darkblue: 139,
|
|
30
|
-
darkcyan: 35723,
|
|
31
|
-
darkgoldenrod: 12092939,
|
|
32
|
-
darkgray: 11119017,
|
|
33
|
-
darkgreen: 25600,
|
|
34
|
-
darkgrey: 11119017,
|
|
35
|
-
darkkhaki: 12433259,
|
|
36
|
-
darkmagenta: 9109643,
|
|
37
|
-
darkolivegreen: 5597999,
|
|
38
|
-
darkorange: 16747520,
|
|
39
|
-
darkorchid: 10040012,
|
|
40
|
-
darkred: 9109504,
|
|
41
|
-
darksalmon: 15308410,
|
|
42
|
-
darkseagreen: 9419919,
|
|
43
|
-
darkslateblue: 4734347,
|
|
44
|
-
darkslategray: 3100495,
|
|
45
|
-
darkslategrey: 3100495,
|
|
46
|
-
darkturquoise: 52945,
|
|
47
|
-
darkviolet: 9699539,
|
|
48
|
-
deeppink: 16716947,
|
|
49
|
-
deepskyblue: 49151,
|
|
50
|
-
dimgray: 6908265,
|
|
51
|
-
dimgrey: 6908265,
|
|
52
|
-
dodgerblue: 2003199,
|
|
53
|
-
firebrick: 11674146,
|
|
54
|
-
floralwhite: 16775920,
|
|
55
|
-
forestgreen: 2263842,
|
|
56
|
-
fuchsia: 16711935,
|
|
57
|
-
gainsboro: 14474460,
|
|
58
|
-
ghostwhite: 16316671,
|
|
59
|
-
gold: 16766720,
|
|
60
|
-
goldenrod: 14329120,
|
|
61
|
-
gray: 8421504,
|
|
62
|
-
green: 32768,
|
|
63
|
-
greenyellow: 11403055,
|
|
64
|
-
grey: 8421504,
|
|
65
|
-
honeydew: 15794160,
|
|
66
|
-
hotpink: 16738740,
|
|
67
|
-
indianred: 13458524,
|
|
68
|
-
indigo: 4915330,
|
|
69
|
-
ivory: 16777200,
|
|
70
|
-
khaki: 15787660,
|
|
71
|
-
lavender: 15132410,
|
|
72
|
-
lavenderblush: 16773365,
|
|
73
|
-
lawngreen: 8190976,
|
|
74
|
-
lemonchiffon: 16775885,
|
|
75
|
-
lightblue: 11393254,
|
|
76
|
-
lightcoral: 15761536,
|
|
77
|
-
lightcyan: 14745599,
|
|
78
|
-
lightgoldenrodyellow: 16448210,
|
|
79
|
-
lightgray: 13882323,
|
|
80
|
-
lightgreen: 9498256,
|
|
81
|
-
lightgrey: 13882323,
|
|
82
|
-
lightpink: 16758465,
|
|
83
|
-
lightsalmon: 16752762,
|
|
84
|
-
lightseagreen: 2142890,
|
|
85
|
-
lightskyblue: 8900346,
|
|
86
|
-
lightslategray: 7833753,
|
|
87
|
-
lightslategrey: 7833753,
|
|
88
|
-
lightsteelblue: 11584734,
|
|
89
|
-
lightyellow: 16777184,
|
|
90
|
-
lime: 65280,
|
|
91
|
-
limegreen: 3329330,
|
|
92
|
-
linen: 16445670,
|
|
93
|
-
magenta: 16711935,
|
|
94
|
-
maroon: 8388608,
|
|
95
|
-
mediumaquamarine: 6737322,
|
|
96
|
-
mediumblue: 205,
|
|
97
|
-
mediumorchid: 12211667,
|
|
98
|
-
mediumpurple: 9662683,
|
|
99
|
-
mediumseagreen: 3978097,
|
|
100
|
-
mediumslateblue: 8087790,
|
|
101
|
-
mediumspringgreen: 64154,
|
|
102
|
-
mediumturquoise: 4772300,
|
|
103
|
-
mediumvioletred: 13047173,
|
|
104
|
-
midnightblue: 1644912,
|
|
105
|
-
mintcream: 16121850,
|
|
106
|
-
mistyrose: 16770273,
|
|
107
|
-
moccasin: 16770229,
|
|
108
|
-
navajowhite: 16768685,
|
|
109
|
-
navy: 128,
|
|
110
|
-
oldlace: 16643558,
|
|
111
|
-
olive: 8421376,
|
|
112
|
-
olivedrab: 7048739,
|
|
113
|
-
orange: 16753920,
|
|
114
|
-
orangered: 16729344,
|
|
115
|
-
orchid: 14315734,
|
|
116
|
-
palegoldenrod: 15657130,
|
|
117
|
-
palegreen: 10025880,
|
|
118
|
-
paleturquoise: 11529966,
|
|
119
|
-
palevioletred: 14381203,
|
|
120
|
-
papayawhip: 16773077,
|
|
121
|
-
peachpuff: 16767673,
|
|
122
|
-
peru: 13468991,
|
|
123
|
-
pink: 16761035,
|
|
124
|
-
plum: 14524637,
|
|
125
|
-
powderblue: 11591910,
|
|
126
|
-
purple: 8388736,
|
|
127
|
-
rebeccapurple: 6697881,
|
|
128
|
-
red: 16711680,
|
|
129
|
-
rosybrown: 12357519,
|
|
130
|
-
royalblue: 4286945,
|
|
131
|
-
saddlebrown: 9127187,
|
|
132
|
-
salmon: 16416882,
|
|
133
|
-
sandybrown: 16032864,
|
|
134
|
-
seagreen: 3050327,
|
|
135
|
-
seashell: 16774638,
|
|
136
|
-
sienna: 10506797,
|
|
137
|
-
silver: 12632256,
|
|
138
|
-
skyblue: 8900331,
|
|
139
|
-
slateblue: 6970061,
|
|
140
|
-
slategray: 7372944,
|
|
141
|
-
slategrey: 7372944,
|
|
142
|
-
snow: 16775930,
|
|
143
|
-
springgreen: 65407,
|
|
144
|
-
steelblue: 4620980,
|
|
145
|
-
tan: 13808780,
|
|
146
|
-
teal: 32896,
|
|
147
|
-
thistle: 14204888,
|
|
148
|
-
tomato: 16737095,
|
|
149
|
-
turquoise: 4251856,
|
|
150
|
-
violet: 15631086,
|
|
151
|
-
wheat: 16113331,
|
|
152
|
-
white: 16777215,
|
|
153
|
-
whitesmoke: 16119285,
|
|
154
|
-
yellow: 16776960,
|
|
155
|
-
yellowgreen: 10145074
|
|
156
|
-
};
|
|
157
|
-
define(Color, color, {
|
|
158
|
-
copy(channels) {
|
|
159
|
-
return Object.assign(new this.constructor(), this, channels);
|
|
160
|
-
},
|
|
161
|
-
displayable() {
|
|
162
|
-
return this.rgb().displayable();
|
|
163
|
-
},
|
|
164
|
-
hex: color_formatHex,
|
|
165
|
-
// Deprecated! Use color.formatHex.
|
|
166
|
-
formatHex: color_formatHex,
|
|
167
|
-
formatHex8: color_formatHex8,
|
|
168
|
-
formatHsl: color_formatHsl,
|
|
169
|
-
formatRgb: color_formatRgb,
|
|
170
|
-
toString: color_formatRgb
|
|
171
|
-
});
|
|
172
|
-
function color_formatHex() {
|
|
173
|
-
return this.rgb().formatHex();
|
|
174
|
-
}
|
|
175
|
-
function color_formatHex8() {
|
|
176
|
-
return this.rgb().formatHex8();
|
|
177
|
-
}
|
|
178
|
-
function color_formatHsl() {
|
|
179
|
-
return hslConvert(this).formatHsl();
|
|
180
|
-
}
|
|
181
|
-
function color_formatRgb() {
|
|
182
|
-
return this.rgb().formatRgb();
|
|
183
|
-
}
|
|
184
|
-
function color(format) {
|
|
185
|
-
var m, l;
|
|
186
|
-
format = (format + "").trim().toLowerCase();
|
|
187
|
-
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
|
188
|
-
}
|
|
189
|
-
function rgbn(n) {
|
|
190
|
-
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
|
191
|
-
}
|
|
192
|
-
function rgba(r, g, b, a) {
|
|
193
|
-
if (a <= 0) r = g = b = NaN;
|
|
194
|
-
return new Rgb(r, g, b, a);
|
|
195
|
-
}
|
|
196
|
-
function rgbConvert(o) {
|
|
197
|
-
if (!(o instanceof Color)) o = color(o);
|
|
198
|
-
if (!o) return new Rgb();
|
|
199
|
-
o = o.rgb();
|
|
200
|
-
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
201
|
-
}
|
|
202
|
-
function rgb(r, g, b, opacity) {
|
|
203
|
-
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
204
|
-
}
|
|
205
|
-
function Rgb(r, g, b, opacity) {
|
|
206
|
-
this.r = +r;
|
|
207
|
-
this.g = +g;
|
|
208
|
-
this.b = +b;
|
|
209
|
-
this.opacity = +opacity;
|
|
210
|
-
}
|
|
211
|
-
define(Rgb, rgb, extend(Color, {
|
|
212
|
-
brighter(k) {
|
|
213
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
214
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
215
|
-
},
|
|
216
|
-
darker(k) {
|
|
217
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
218
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
219
|
-
},
|
|
220
|
-
rgb() {
|
|
221
|
-
return this;
|
|
222
|
-
},
|
|
223
|
-
clamp() {
|
|
224
|
-
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
225
|
-
},
|
|
226
|
-
displayable() {
|
|
227
|
-
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
|
|
228
|
-
},
|
|
229
|
-
hex: rgb_formatHex,
|
|
230
|
-
// Deprecated! Use color.formatHex.
|
|
231
|
-
formatHex: rgb_formatHex,
|
|
232
|
-
formatHex8: rgb_formatHex8,
|
|
233
|
-
formatRgb: rgb_formatRgb,
|
|
234
|
-
toString: rgb_formatRgb
|
|
235
|
-
}));
|
|
236
|
-
function rgb_formatHex() {
|
|
237
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
238
|
-
}
|
|
239
|
-
function rgb_formatHex8() {
|
|
240
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
241
|
-
}
|
|
242
|
-
function rgb_formatRgb() {
|
|
243
|
-
const a = clampa(this.opacity);
|
|
244
|
-
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
245
|
-
}
|
|
246
|
-
function clampa(opacity) {
|
|
247
|
-
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
248
|
-
}
|
|
249
|
-
function clampi(value) {
|
|
250
|
-
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
251
|
-
}
|
|
252
|
-
function hex(value) {
|
|
253
|
-
value = clampi(value);
|
|
254
|
-
return (value < 16 ? "0" : "") + value.toString(16);
|
|
255
|
-
}
|
|
256
|
-
function hsla(h, s, l, a) {
|
|
257
|
-
if (a <= 0) h = s = l = NaN;
|
|
258
|
-
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
259
|
-
else if (s <= 0) h = NaN;
|
|
260
|
-
return new Hsl(h, s, l, a);
|
|
261
|
-
}
|
|
262
|
-
function hslConvert(o) {
|
|
263
|
-
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
264
|
-
if (!(o instanceof Color)) o = color(o);
|
|
265
|
-
if (!o) return new Hsl();
|
|
266
|
-
if (o instanceof Hsl) return o;
|
|
267
|
-
o = o.rgb();
|
|
268
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
|
|
269
|
-
if (s) {
|
|
270
|
-
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
271
|
-
else if (g === max) h = (b - r) / s + 2;
|
|
272
|
-
else h = (r - g) / s + 4;
|
|
273
|
-
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
274
|
-
h *= 60;
|
|
275
|
-
} else {
|
|
276
|
-
s = l > 0 && l < 1 ? 0 : h;
|
|
277
|
-
}
|
|
278
|
-
return new Hsl(h, s, l, o.opacity);
|
|
279
|
-
}
|
|
280
|
-
function hsl(h, s, l, opacity) {
|
|
281
|
-
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
282
|
-
}
|
|
283
|
-
function Hsl(h, s, l, opacity) {
|
|
284
|
-
this.h = +h;
|
|
285
|
-
this.s = +s;
|
|
286
|
-
this.l = +l;
|
|
287
|
-
this.opacity = +opacity;
|
|
288
|
-
}
|
|
289
|
-
define(Hsl, hsl, extend(Color, {
|
|
290
|
-
brighter(k) {
|
|
291
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
292
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
293
|
-
},
|
|
294
|
-
darker(k) {
|
|
295
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
296
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
297
|
-
},
|
|
298
|
-
rgb() {
|
|
299
|
-
var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
|
300
|
-
return new Rgb(
|
|
301
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
302
|
-
hsl2rgb(h, m1, m2),
|
|
303
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
304
|
-
this.opacity
|
|
305
|
-
);
|
|
306
|
-
},
|
|
307
|
-
clamp() {
|
|
308
|
-
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
309
|
-
},
|
|
310
|
-
displayable() {
|
|
311
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
|
312
|
-
},
|
|
313
|
-
formatHsl() {
|
|
314
|
-
const a = clampa(this.opacity);
|
|
315
|
-
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
316
|
-
}
|
|
317
|
-
}));
|
|
318
|
-
function clamph(value) {
|
|
319
|
-
value = (value || 0) % 360;
|
|
320
|
-
return value < 0 ? value + 360 : value;
|
|
321
|
-
}
|
|
322
|
-
function clampt(value) {
|
|
323
|
-
return Math.max(0, Math.min(1, value || 0));
|
|
324
|
-
}
|
|
325
|
-
function hsl2rgb(h, m1, m2) {
|
|
326
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
|
327
|
-
}
|
|
328
|
-
export {
|
|
329
|
-
Color,
|
|
330
|
-
Rgb,
|
|
331
|
-
brighter,
|
|
332
|
-
darker,
|
|
333
|
-
color as default,
|
|
334
|
-
hsl,
|
|
335
|
-
hslConvert,
|
|
336
|
-
rgb,
|
|
337
|
-
rgbConvert
|
|
338
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function define(constructor, factory, prototype) {
|
|
2
|
-
constructor.prototype = factory.prototype = prototype;
|
|
3
|
-
prototype.constructor = constructor;
|
|
4
|
-
}
|
|
5
|
-
function extend(parent, definition) {
|
|
6
|
-
var prototype = Object.create(parent.prototype);
|
|
7
|
-
for (var key in definition) prototype[key] = definition[key];
|
|
8
|
-
return prototype;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
define as default,
|
|
12
|
-
extend
|
|
13
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { epsilon } from "./math.js";
|
|
2
|
-
import { geoAlbers } from "d3-geo";
|
|
3
|
-
import { fitExtent, fitSize } from "./fit.js";
|
|
4
|
-
import path from "../../../../d3-path@2.0.0/node_modules/d3-path/src/path.js";
|
|
5
|
-
function multiplex(streams) {
|
|
6
|
-
var n = streams.length;
|
|
7
|
-
return {
|
|
8
|
-
point: function(x, y) {
|
|
9
|
-
var i = -1;
|
|
10
|
-
while (++i < n) streams[i].point(x, y);
|
|
11
|
-
},
|
|
12
|
-
sphere: function() {
|
|
13
|
-
var i = -1;
|
|
14
|
-
while (++i < n) streams[i].sphere();
|
|
15
|
-
},
|
|
16
|
-
lineStart: function() {
|
|
17
|
-
var i = -1;
|
|
18
|
-
while (++i < n) streams[i].lineStart();
|
|
19
|
-
},
|
|
20
|
-
lineEnd: function() {
|
|
21
|
-
var i = -1;
|
|
22
|
-
while (++i < n) streams[i].lineEnd();
|
|
23
|
-
},
|
|
24
|
-
polygonStart: function() {
|
|
25
|
-
var i = -1;
|
|
26
|
-
while (++i < n) streams[i].polygonStart();
|
|
27
|
-
},
|
|
28
|
-
polygonEnd: function() {
|
|
29
|
-
var i = -1;
|
|
30
|
-
while (++i < n) streams[i].polygonEnd();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function geoAlbersUk() {
|
|
35
|
-
var cache, cacheStream, main = geoAlbers().rotate([4.4, 0.8]).center([0, 55.4]).parallels([50, 60]), mainPoint, shetland = geoAlbers().rotate([4.4, 0.8]).center([0, 55.4]).parallels([50, 60]), shetlandPoint, point, pointStream = {
|
|
36
|
-
point: function(x, y) {
|
|
37
|
-
point = [x, y];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
function albersUk(coordinates) {
|
|
41
|
-
var x = coordinates[0], y = coordinates[1];
|
|
42
|
-
return point = null, (mainPoint.point(x, y), point) || (shetlandPoint.point(x, y), point);
|
|
43
|
-
}
|
|
44
|
-
albersUk.invert = function(coordinates) {
|
|
45
|
-
var k = main.scale(), t = main.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
|
|
46
|
-
return (y >= -0.089 && y < 0.06 && x >= 0.029 && x < 0.046 ? shetland : main).invert(coordinates);
|
|
47
|
-
};
|
|
48
|
-
albersUk.stream = function(stream) {
|
|
49
|
-
return cache && cacheStream === stream ? cache : cache = multiplex([
|
|
50
|
-
main.stream(cacheStream = stream),
|
|
51
|
-
shetland.stream(stream)
|
|
52
|
-
]);
|
|
53
|
-
};
|
|
54
|
-
albersUk.precision = function(_) {
|
|
55
|
-
if (!arguments.length) return main.precision();
|
|
56
|
-
main.precision(_), shetland.precision(_);
|
|
57
|
-
return reset();
|
|
58
|
-
};
|
|
59
|
-
albersUk.scale = function(_) {
|
|
60
|
-
if (!arguments.length) return main.scale();
|
|
61
|
-
main.scale(_), shetland.scale(_);
|
|
62
|
-
return albersUk.translate(main.translate());
|
|
63
|
-
};
|
|
64
|
-
albersUk.translate = function(_) {
|
|
65
|
-
if (!arguments.length) return main.translate();
|
|
66
|
-
var k = main.scale(), x = +_[0], y = +_[1];
|
|
67
|
-
mainPoint = main.translate(_).clipExtent([
|
|
68
|
-
[x - 0.065 * k, y - 0.089 * k],
|
|
69
|
-
[x + 0.075 * k, y + 0.089 * k]
|
|
70
|
-
]).stream(pointStream);
|
|
71
|
-
shetlandPoint = shetland.translate([x + 0.01 * k, y + 0.025 * k]).clipExtent([
|
|
72
|
-
[x + 0.029 * k + epsilon, y - 0.089 * k + epsilon],
|
|
73
|
-
[x + 0.046 * k - epsilon, y - 0.06 * k - epsilon]
|
|
74
|
-
]).stream(pointStream);
|
|
75
|
-
return reset();
|
|
76
|
-
};
|
|
77
|
-
albersUk.fitExtent = function(extent, object) {
|
|
78
|
-
return fitExtent(albersUk, extent, object);
|
|
79
|
-
};
|
|
80
|
-
albersUk.fitSize = function(size, object) {
|
|
81
|
-
return fitSize(albersUk, size, object);
|
|
82
|
-
};
|
|
83
|
-
function reset() {
|
|
84
|
-
cache = cacheStream = null;
|
|
85
|
-
return albersUk;
|
|
86
|
-
}
|
|
87
|
-
albersUk.drawCompositionBorders = function(context) {
|
|
88
|
-
var ul, ur, ld, ll;
|
|
89
|
-
ul = main([-1.113205870242365, 59.64920050773357]);
|
|
90
|
-
ur = main([0.807899092399606, 59.59085836472269]);
|
|
91
|
-
ld = main([0.5778611961420386, 57.93467822832577]);
|
|
92
|
-
ll = main([-1.25867782078448, 57.99029450085142]);
|
|
93
|
-
context.moveTo(ul[0], ul[1]);
|
|
94
|
-
context.lineTo(ur[0], ur[1]);
|
|
95
|
-
context.lineTo(ld[0], ld[1]);
|
|
96
|
-
context.lineTo(ll[0], ll[1]);
|
|
97
|
-
context.closePath();
|
|
98
|
-
};
|
|
99
|
-
albersUk.getCompositionBorders = function() {
|
|
100
|
-
var context = path();
|
|
101
|
-
this.drawCompositionBorders(context);
|
|
102
|
-
return context.toString();
|
|
103
|
-
};
|
|
104
|
-
return albersUk.scale(2800);
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
geoAlbersUk as default
|
|
108
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
function noop() {
|
|
2
|
-
}
|
|
3
|
-
var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1;
|
|
4
|
-
var boundsStream = {
|
|
5
|
-
point: boundsPoint,
|
|
6
|
-
lineStart: noop,
|
|
7
|
-
lineEnd: noop,
|
|
8
|
-
polygonStart: noop,
|
|
9
|
-
polygonEnd: noop,
|
|
10
|
-
result: function() {
|
|
11
|
-
var bounds = [[x0, y0], [x1, y1]];
|
|
12
|
-
x1 = y1 = -(y0 = x0 = Infinity);
|
|
13
|
-
return bounds;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
function boundsPoint(x, y) {
|
|
17
|
-
if (x < x0) x0 = x;
|
|
18
|
-
if (x > x1) x1 = x;
|
|
19
|
-
if (y < y0) y0 = y;
|
|
20
|
-
if (y > y1) y1 = y;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
boundsStream as default
|
|
24
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { geoStream } from "d3-geo";
|
|
2
|
-
import boundsStream from "./bounds.js";
|
|
3
|
-
function fitExtent(projection, extent, object) {
|
|
4
|
-
var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], clip = projection.clipExtent && projection.clipExtent();
|
|
5
|
-
projection.scale(150).translate([0, 0]);
|
|
6
|
-
if (clip != null) projection.clipExtent(null);
|
|
7
|
-
geoStream(object, projection.stream(boundsStream));
|
|
8
|
-
var b = boundsStream.result(), k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
|
|
9
|
-
if (clip != null) projection.clipExtent(clip);
|
|
10
|
-
return projection.scale(k * 150).translate([x, y]);
|
|
11
|
-
}
|
|
12
|
-
function fitSize(projection, size, object) {
|
|
13
|
-
return fitExtent(projection, [[0, 0], size], object);
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
fitExtent,
|
|
17
|
-
fitSize
|
|
18
|
-
};
|