col-browser 2.4.0 → 2.6.0
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/README.md +34 -2
- package/es/bibtex.js +1 -1
- package/es/chunks/{BibTex-79CCKAOK.js → BibTex-DRE71Hg-.js} +2 -2
- package/es/chunks/{BibTex-79CCKAOK.js.map → BibTex-DRE71Hg-.js.map} +1 -1
- package/es/chunks/{DatasetCitation-BXtAmjdZ.js → DatasetCitation-Cep2dces.js} +2 -2
- package/es/chunks/{DatasetCitation-BXtAmjdZ.js.map → DatasetCitation-Cep2dces.js.map} +1 -1
- package/es/chunks/{DatasetlogoWithFallback-Dava2uqZ.js → DatasetlogoWithFallback-Bb-kmHts.js} +2 -2
- package/es/chunks/{DatasetlogoWithFallback-Dava2uqZ.js.map → DatasetlogoWithFallback-Bb-kmHts.js.map} +1 -1
- package/es/chunks/Distributions-Czffme5Y.js +1185 -0
- package/es/chunks/Distributions-Czffme5Y.js.map +1 -0
- package/es/chunks/{MergedDataBadge-C1CgoRFz.js → MergedDataBadge-DK53L3R8.js} +2 -2
- package/es/chunks/{MergedDataBadge-C1CgoRFz.js.map → MergedDataBadge-DK53L3R8.js.map} +1 -1
- package/es/chunks/{TaxonBreakdown-DeWamLu_.js → TaxonBreakdown-DqdQ18QM.js} +2 -2
- package/es/chunks/{TaxonBreakdown-DeWamLu_.js.map → TaxonBreakdown-DqdQ18QM.js.map} +1 -1
- package/es/chunks/{XrGutter-CU7_QPAp.js → XrGutter-COJhHpia.js} +2 -2
- package/es/chunks/{XrGutter-CU7_QPAp.js.map → XrGutter-COJhHpia.js.map} +1 -1
- package/es/chunks/config--bs_09I6.js +32 -0
- package/es/chunks/config--bs_09I6.js.map +1 -0
- package/es/chunks/{dataset-BL6g4w0G.js → dataset-BZpjo3Yq.js} +2 -2
- package/es/chunks/{dataset-BL6g4w0G.js.map → dataset-BZpjo3Yq.js.map} +1 -1
- package/es/chunks/{enumeration-DM8Hb36g.js → enumeration-CV8i_q_O.js} +2 -2
- package/es/chunks/{enumeration-DM8Hb36g.js.map → enumeration-CV8i_q_O.js.map} +1 -1
- package/es/chunks/{sector-Qeo1zPxr.js → sector-ucUgPp75.js} +2 -2
- package/es/chunks/{sector-Qeo1zPxr.js.map → sector-ucUgPp75.js.map} +1 -1
- package/es/config.js +1 -1
- package/es/index.js +1 -1
- package/es/search.js +5 -5
- package/es/sourceDataset.js +4 -4
- package/es/sourceDatasetList.js +4 -4
- package/es/taxon.js +758 -754
- package/es/taxon.js.map +1 -1
- package/es/taxonBreakdown.js +2 -2
- package/es/taxonDistribution.js +21 -19
- package/es/taxonDistribution.js.map +1 -1
- package/es/tree.js +5 -5
- package/package.json +1 -1
- package/types/index.d.ts +25 -0
- package/umd/col-browser.js +67 -25
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +4 -4
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/Distributions-Bd4hFYdS.js +0 -1169
- package/es/chunks/Distributions-Bd4hFYdS.js.map +0 -1
- package/es/chunks/config-D1NH4DTr.js +0 -22
- package/es/chunks/config-D1NH4DTr.js.map +0 -1
package/es/taxonBreakdown.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { w } from "./chunks/withTheme-Dh6PRuII.js";
|
|
2
2
|
import { j as o } from "./chunks/jsx-runtime-BzflLqGi.js";
|
|
3
|
-
import { T } from "./chunks/TaxonBreakdown-
|
|
3
|
+
import { T } from "./chunks/TaxonBreakdown-DqdQ18QM.js";
|
|
4
4
|
import { useState as e, useEffect as A } from "react";
|
|
5
5
|
import { s as b, c as r, R as v, b as B } from "./chunks/router-CssZk5qZ.js";
|
|
6
|
-
import { c as s } from "./chunks/config
|
|
6
|
+
import { c as s } from "./chunks/config--bs_09I6.js";
|
|
7
7
|
import { Row as D, Col as C, Spin as E } from "antd";
|
|
8
8
|
const S = ({
|
|
9
9
|
taxonId: n,
|
package/es/taxonDistribution.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { w as
|
|
1
|
+
import { w as $ } from "./chunks/withTheme-Dh6PRuII.js";
|
|
2
2
|
import { j as n } from "./chunks/jsx-runtime-BzflLqGi.js";
|
|
3
|
-
import { useState as a, useEffect as
|
|
4
|
-
import { s as
|
|
5
|
-
import { c as l } from "./chunks/config
|
|
6
|
-
import { Row as
|
|
7
|
-
import { D as
|
|
8
|
-
const
|
|
3
|
+
import { useState as a, useEffect as D } from "react";
|
|
4
|
+
import { s as T, c as s, R as g, b as k } from "./chunks/router-CssZk5qZ.js";
|
|
5
|
+
import { c as l } from "./chunks/config--bs_09I6.js";
|
|
6
|
+
import { Row as v, Col as w, Spin as A } from "antd";
|
|
7
|
+
import { D as C } from "./chunks/Distributions-Czffme5Y.js";
|
|
8
|
+
const E = ({
|
|
9
9
|
taxonId: o,
|
|
10
10
|
datasetKey: i,
|
|
11
11
|
gbifChecklistKey: d,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
basemapStyle: x,
|
|
13
|
+
style: b,
|
|
14
|
+
auth: h,
|
|
15
|
+
...j
|
|
15
16
|
}) => {
|
|
16
|
-
|
|
17
|
-
const [u, p] = a(null), [c, m] = a(null), [f,
|
|
18
|
-
return
|
|
17
|
+
T(h);
|
|
18
|
+
const [u, p] = a(null), [c, m] = a(null), [f, R] = a([]);
|
|
19
|
+
return D(() => {
|
|
19
20
|
let r = !1;
|
|
20
21
|
if (p(null), m(null), !(!o || !i))
|
|
21
22
|
return s(`${l.dataApi}vocab/rank`).then((t) => {
|
|
22
|
-
r ||
|
|
23
|
+
r || R(t.data.map((e) => e.name));
|
|
23
24
|
}), s(
|
|
24
25
|
`${l.dataApi}dataset/${i}/taxon/${encodeURIComponent(o)}`
|
|
25
26
|
).then((t) => {
|
|
@@ -32,20 +33,21 @@ const C = ({
|
|
|
32
33
|
}), () => {
|
|
33
34
|
r = !0;
|
|
34
35
|
};
|
|
35
|
-
}, [o, i]), /* @__PURE__ */ n.jsx(
|
|
36
|
-
|
|
36
|
+
}, [o, i]), /* @__PURE__ */ n.jsx(g.Provider, { value: k(j), children: !u || c === null || f.length === 0 ? /* @__PURE__ */ n.jsx(v, { justify: "center", style: { padding: "24px" }, children: /* @__PURE__ */ n.jsx(w, { children: /* @__PURE__ */ n.jsx(A, { size: "large" }) }) }) : /* @__PURE__ */ n.jsx(
|
|
37
|
+
C,
|
|
37
38
|
{
|
|
38
39
|
data: c,
|
|
39
40
|
datasetKey: i,
|
|
40
41
|
focalTaxon: u,
|
|
41
42
|
rankOrder: f,
|
|
42
43
|
gbifChecklistKey: d,
|
|
44
|
+
basemapStyle: x,
|
|
43
45
|
showDistributionMap: !0,
|
|
44
|
-
style:
|
|
46
|
+
style: b
|
|
45
47
|
}
|
|
46
48
|
) });
|
|
47
|
-
},
|
|
49
|
+
}, q = $(E);
|
|
48
50
|
export {
|
|
49
|
-
|
|
51
|
+
q as TaxonDistribution
|
|
50
52
|
};
|
|
51
53
|
//# sourceMappingURL=taxonDistribution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taxonDistribution.js","sources":["../src/Taxon/DistributionsWrapper.js","../src/entries/taxonDistribution.js"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport client, { setAuth } from \"../api/client\";\nimport config from \"../config\";\nimport { Row, Col, Spin } from \"antd\";\nimport Distributions from \"./Distributions\";\nimport { RouterContext, buildRouter } from \"../router\";\n\n// Standalone wrapper around the Taxon page's Distributions block.\n// Loads the focal taxon, its info (which carries the distributions array),\n// and the rank vocabulary — same data the Taxon page already loads — so\n// embedders can drop the map onto any page given just (datasetKey, taxonId).\nexport const DistributionsWrapper = ({\n taxonId,\n datasetKey,\n gbifChecklistKey,\n style,\n auth,\n ...routerProps\n}) => {\n // Private candidate releases (preview/dev) require Basic auth on every call,\n // including the taxon/info/rank fetches below via `client`.\n setAuth(auth);\n const [taxon, setTaxon] = useState(null);\n const [distributions, setDistributions] = useState(null);\n const [rank, setRank] = useState([]);\n\n useEffect(() => {\n let cancelled = false;\n setTaxon(null);\n setDistributions(null);\n\n if (!taxonId || !datasetKey) return undefined;\n\n client(`${config.dataApi}vocab/rank`).then((res) => {\n if (!cancelled) setRank(res.data.map((r) => r.name));\n });\n client(\n `${config.dataApi}dataset/${datasetKey}/taxon/${encodeURIComponent(taxonId)}`\n ).then((res) => {\n if (!cancelled) setTaxon(res.data);\n });\n client(\n `${config.dataApi}dataset/${datasetKey}/taxon/${encodeURIComponent(taxonId)}/info`\n ).then((res) => {\n if (!cancelled) setDistributions(res?.data?.distributions || []);\n });\n\n return () => {\n cancelled = true;\n };\n }, [taxonId, datasetKey]);\n\n return (\n <RouterContext.Provider value={buildRouter(routerProps)}>\n {!taxon || distributions === null || rank.length === 0 ? (\n <Row justify=\"center\" style={{ padding: \"24px\" }}>\n <Col>\n <Spin size=\"large\" />\n </Col>\n </Row>\n ) : (\n <Distributions\n data={distributions}\n datasetKey={datasetKey}\n focalTaxon={taxon}\n rankOrder={rank}\n gbifChecklistKey={gbifChecklistKey}\n showDistributionMap={true}\n style={style}\n />\n )}\n </RouterContext.Provider>\n );\n};\n\nexport default DistributionsWrapper;\n","import { withTheme } from \"../withTheme\";\nimport { DistributionsWrapper } from \"../Taxon/DistributionsWrapper\";\n\nexport const TaxonDistribution = withTheme(DistributionsWrapper);\n"],"names":["DistributionsWrapper","taxonId","datasetKey","gbifChecklistKey","style","auth","routerProps","setAuth","taxon","setTaxon","useState","distributions","setDistributions","rank","setRank","useEffect","cancelled","client","config","res","r","_a","jsx","RouterContext","buildRouter","Row","Col","Spin","Distributions","TaxonDistribution","withTheme"],"mappings":";;;;;;;AAWO,MAAMA,IAAuB,CAAC;AAAA,EACnC,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AAGJ,EAAAC,EAAQF,CAAI;AACZ,QAAM,CAACG,GAAOC,CAAQ,IAAIC,EAAS,IAAI,GACjC,CAACC,GAAeC,CAAgB,IAAIF,EAAS,IAAI,GACjD,CAACG,GAAMC,CAAO,IAAIJ,EAAS,CAAA,CAAE;AAEnC,SAAAK,EAAU,MAAM;AACd,QAAIC,IAAY;AAIhB,QAHAP,EAAS,IAAI,GACbG,EAAiB,IAAI,GAEjB,
|
|
1
|
+
{"version":3,"file":"taxonDistribution.js","sources":["../src/Taxon/DistributionsWrapper.js","../src/entries/taxonDistribution.js"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport client, { setAuth } from \"../api/client\";\nimport config from \"../config\";\nimport { Row, Col, Spin } from \"antd\";\nimport Distributions from \"./Distributions\";\nimport { RouterContext, buildRouter } from \"../router\";\n\n// Standalone wrapper around the Taxon page's Distributions block.\n// Loads the focal taxon, its info (which carries the distributions array),\n// and the rank vocabulary — same data the Taxon page already loads — so\n// embedders can drop the map onto any page given just (datasetKey, taxonId).\nexport const DistributionsWrapper = ({\n taxonId,\n datasetKey,\n gbifChecklistKey,\n basemapStyle,\n style,\n auth,\n ...routerProps\n}) => {\n // Private candidate releases (preview/dev) require Basic auth on every call,\n // including the taxon/info/rank fetches below via `client`.\n setAuth(auth);\n const [taxon, setTaxon] = useState(null);\n const [distributions, setDistributions] = useState(null);\n const [rank, setRank] = useState([]);\n\n useEffect(() => {\n let cancelled = false;\n setTaxon(null);\n setDistributions(null);\n\n if (!taxonId || !datasetKey) return undefined;\n\n client(`${config.dataApi}vocab/rank`).then((res) => {\n if (!cancelled) setRank(res.data.map((r) => r.name));\n });\n client(\n `${config.dataApi}dataset/${datasetKey}/taxon/${encodeURIComponent(taxonId)}`\n ).then((res) => {\n if (!cancelled) setTaxon(res.data);\n });\n client(\n `${config.dataApi}dataset/${datasetKey}/taxon/${encodeURIComponent(taxonId)}/info`\n ).then((res) => {\n if (!cancelled) setDistributions(res?.data?.distributions || []);\n });\n\n return () => {\n cancelled = true;\n };\n }, [taxonId, datasetKey]);\n\n return (\n <RouterContext.Provider value={buildRouter(routerProps)}>\n {!taxon || distributions === null || rank.length === 0 ? (\n <Row justify=\"center\" style={{ padding: \"24px\" }}>\n <Col>\n <Spin size=\"large\" />\n </Col>\n </Row>\n ) : (\n <Distributions\n data={distributions}\n datasetKey={datasetKey}\n focalTaxon={taxon}\n rankOrder={rank}\n gbifChecklistKey={gbifChecklistKey}\n basemapStyle={basemapStyle}\n showDistributionMap={true}\n style={style}\n />\n )}\n </RouterContext.Provider>\n );\n};\n\nexport default DistributionsWrapper;\n","import { withTheme } from \"../withTheme\";\nimport { DistributionsWrapper } from \"../Taxon/DistributionsWrapper\";\n\nexport const TaxonDistribution = withTheme(DistributionsWrapper);\n"],"names":["DistributionsWrapper","taxonId","datasetKey","gbifChecklistKey","basemapStyle","style","auth","routerProps","setAuth","taxon","setTaxon","useState","distributions","setDistributions","rank","setRank","useEffect","cancelled","client","config","res","r","_a","jsx","RouterContext","buildRouter","Row","Col","Spin","Distributions","TaxonDistribution","withTheme"],"mappings":";;;;;;;AAWO,MAAMA,IAAuB,CAAC;AAAA,EACnC,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AAGJ,EAAAC,EAAQF,CAAI;AACZ,QAAM,CAACG,GAAOC,CAAQ,IAAIC,EAAS,IAAI,GACjC,CAACC,GAAeC,CAAgB,IAAIF,EAAS,IAAI,GACjD,CAACG,GAAMC,CAAO,IAAIJ,EAAS,CAAA,CAAE;AAEnC,SAAAK,EAAU,MAAM;AACd,QAAIC,IAAY;AAIhB,QAHAP,EAAS,IAAI,GACbG,EAAiB,IAAI,GAEjB,GAACZ,KAAW,CAACC;AAEjB,aAAAgB,EAAO,GAAGC,EAAO,OAAO,YAAY,EAAE,KAAK,CAACC,MAAQ;AAClD,QAAKH,KAAWF,EAAQK,EAAI,KAAK,IAAI,CAACC,MAAMA,EAAE,IAAI,CAAC;AAAA,MACrD,CAAC,GACDH;AAAA,QACE,GAAGC,EAAO,OAAO,WAAWjB,CAAU,UAAU,mBAAmBD,CAAO,CAAC;AAAA,MAAA,EAC3E,KAAK,CAACmB,MAAQ;AACd,QAAKH,KAAWP,EAASU,EAAI,IAAI;AAAA,MACnC,CAAC,GACDF;AAAA,QACE,GAAGC,EAAO,OAAO,WAAWjB,CAAU,UAAU,mBAAmBD,CAAO,CAAC;AAAA,MAAA,EAC3E,KAAK,CAACmB,MAAQ;;AACd,QAAKH,KAAWJ,IAAiBS,IAAAF,KAAA,gBAAAA,EAAK,SAAL,gBAAAE,EAAW,kBAAiB,EAAE;AAAA,MACjE,CAAC,GAEM,MAAM;AACX,QAAAL,IAAY;AAAA,MACd;AAAA,EACF,GAAG,CAAChB,GAASC,CAAU,CAAC,GAGtBqB,gBAAAA,EAAAA,IAACC,EAAc,UAAd,EAAuB,OAAOC,EAAYlB,CAAW,GACnD,UAAA,CAACE,KAASG,MAAkB,QAAQE,EAAK,WAAW,IACnDS,gBAAAA,EAAAA,IAACG,GAAA,EAAI,SAAQ,UAAS,OAAO,EAAE,SAAS,UACtC,UAAAH,gBAAAA,EAAAA,IAACI,GAAA,EACC,UAAAJ,gBAAAA,EAAAA,IAACK,GAAA,EAAK,MAAK,QAAA,CAAQ,EAAA,CACrB,GACF,IAEAL,gBAAAA,EAAAA;AAAAA,IAACM;AAAAA,IAAA;AAAA,MACC,MAAMjB;AAAA,MACN,YAAAV;AAAA,MACA,YAAYO;AAAA,MACZ,WAAWK;AAAA,MACX,kBAAAX;AAAA,MACA,cAAAC;AAAA,MACA,qBAAqB;AAAA,MACrB,OAAAC;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,GCxEayB,IAAoBC,EAAU/B,CAAoB;"}
|
package/es/tree.js
CHANGED
|
@@ -8,13 +8,13 @@ import j, { createContext as at } from "react";
|
|
|
8
8
|
import { Popover as ot, Divider as it, Spin as q, Tag as nt, Alert as w, Skeleton as rt, Tree as lt, Button as dt, Row as ht, Col as I, Checkbox as N } from "antd";
|
|
9
9
|
import { sortBy as _, get as m, isUndefined as A, flatten as ct, isArray as O } from "lodash-es";
|
|
10
10
|
import { L as P, c as K, R as H, s as ut, b as pt } from "./chunks/router-CssZk5qZ.js";
|
|
11
|
-
import { c as D } from "./chunks/config
|
|
11
|
+
import { c as D } from "./chunks/config--bs_09I6.js";
|
|
12
12
|
import L from "dataloader";
|
|
13
|
-
import { c as V, b as z, g as ft } from "./chunks/dataset-
|
|
14
|
-
import { M as xt } from "./chunks/MergedDataBadge-
|
|
13
|
+
import { c as V, b as z, g as ft } from "./chunks/dataset-BZpjo3Yq.js";
|
|
14
|
+
import { M as xt } from "./chunks/MergedDataBadge-DK53L3R8.js";
|
|
15
15
|
import { E as gt } from "./chunks/ErrorMsg-K8k5PPTp.js";
|
|
16
|
-
import { g as yt } from "./chunks/sector-
|
|
17
|
-
import { C as R, N as mt } from "./chunks/DatasetCitation-
|
|
16
|
+
import { g as yt } from "./chunks/sector-ucUgPp75.js";
|
|
17
|
+
import { C as R, N as mt } from "./chunks/DatasetCitation-Cep2dces.js";
|
|
18
18
|
import { r as F, w as M } from "./chunks/storage-BgdCo9fV.js";
|
|
19
19
|
const E = at({
|
|
20
20
|
datasetLoader: null,
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -82,6 +82,12 @@ export interface TaxonProps
|
|
|
82
82
|
identifierLabel?: string;
|
|
83
83
|
showDistributionMap?: boolean;
|
|
84
84
|
gbifChecklistKey?: string | number;
|
|
85
|
+
/**
|
|
86
|
+
* MapLibre basemap for the distribution map: a style URL (with your
|
|
87
|
+
* provider's API key baked in) or an inline style object. Overrides the
|
|
88
|
+
* global `configure({ basemapStyle })` default for this instance.
|
|
89
|
+
*/
|
|
90
|
+
basemapStyle?: string | Record<string, unknown>;
|
|
85
91
|
/** HTTP Basic Auth credentials in `user:password` form. */
|
|
86
92
|
auth?: string;
|
|
87
93
|
}
|
|
@@ -126,6 +132,12 @@ export interface TaxonDistributionProps extends ThemeProps, NavigationProps {
|
|
|
126
132
|
taxonId?: string;
|
|
127
133
|
datasetKey?: string | number;
|
|
128
134
|
gbifChecklistKey?: string | number;
|
|
135
|
+
/**
|
|
136
|
+
* MapLibre basemap for the distribution map: a style URL (with your
|
|
137
|
+
* provider's API key baked in) or an inline style object. Overrides the
|
|
138
|
+
* global `configure({ basemapStyle })` default for this instance.
|
|
139
|
+
*/
|
|
140
|
+
basemapStyle?: string | Record<string, unknown>;
|
|
129
141
|
style?: React.CSSProperties;
|
|
130
142
|
/** HTTP Basic Auth credentials in `user:password` form. */
|
|
131
143
|
auth?: string;
|
|
@@ -141,6 +153,19 @@ export interface ColBrowserConfig {
|
|
|
141
153
|
gbifApi: string;
|
|
142
154
|
/** GBIF portal the occurrence attribution link points at. */
|
|
143
155
|
gbifPortal: string;
|
|
156
|
+
/**
|
|
157
|
+
* MapLibre basemap for the distribution map: a style URL (with your
|
|
158
|
+
* provider's API key baked in) or an inline style object. Defaults to
|
|
159
|
+
* CARTO's keyless Positron CDN. Stored verbatim — not URL-normalised.
|
|
160
|
+
*/
|
|
161
|
+
basemapStyle: string | Record<string, unknown>;
|
|
162
|
+
/**
|
|
163
|
+
* CARTO Basemaps API key. When set, every cartocdn.com request the
|
|
164
|
+
* distribution map makes — style, vector tiles, glyphs, sprites — carries
|
|
165
|
+
* `?key=`. Defaults to "" (unauthenticated). Not needed if `basemapStyle`
|
|
166
|
+
* points at a non-CARTO provider.
|
|
167
|
+
*/
|
|
168
|
+
cartoKey: string;
|
|
144
169
|
}
|
|
145
170
|
|
|
146
171
|
/**
|
package/umd/col-browser.js
CHANGED
|
@@ -67804,13 +67804,24 @@ html body {
|
|
|
67804
67804
|
gbifApi: "https://api.gbif.org",
|
|
67805
67805
|
// GBIF human-facing portal where the attribution link points. The
|
|
67806
67806
|
// multitaxonomy occurrence search now ships on the production portal.
|
|
67807
|
-
gbifPortal: "https://www.gbif.org"
|
|
67807
|
+
gbifPortal: "https://www.gbif.org",
|
|
67808
|
+
// MapLibre basemap for the distribution map. Anything MapLibre accepts as
|
|
67809
|
+
// `style` works: a style URL (bake your provider's API key into it) or an
|
|
67810
|
+
// inline style object. The default is CARTO's public Positron CDN, which
|
|
67811
|
+
// needs no key.
|
|
67812
|
+
basemapStyle: "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",
|
|
67813
|
+
// CARTO Basemaps API key. Empty means unauthenticated (fine today, but
|
|
67814
|
+
// CARTO is moving to enforce keys). Set it and every cartocdn.com request
|
|
67815
|
+
// the map makes — style, vector tiles, glyphs, sprites — carries `?key=`.
|
|
67816
|
+
// Not needed when `basemapStyle` points at a non-CARTO provider.
|
|
67817
|
+
cartoKey: ""
|
|
67808
67818
|
};
|
|
67809
67819
|
const SLASH_TERMINATED = /* @__PURE__ */ new Set(["dataApi"]);
|
|
67820
|
+
const VERBATIM = /* @__PURE__ */ new Set(["basemapStyle", "cartoKey"]);
|
|
67810
67821
|
const normalize = (key2, value) => SLASH_TERMINATED.has(key2) ? value.replace(/\/*$/, "/") : value.replace(/\/+$/, "");
|
|
67811
67822
|
function configure(overrides = {}) {
|
|
67812
67823
|
Object.entries(overrides).forEach(([key2, value]) => {
|
|
67813
|
-
config[key2] = typeof value === "string" ? normalize(key2, value) : value;
|
|
67824
|
+
config[key2] = typeof value === "string" && !VERBATIM.has(key2) ? normalize(key2, value) : value;
|
|
67814
67825
|
});
|
|
67815
67826
|
return config;
|
|
67816
67827
|
}
|
|
@@ -77980,6 +77991,24 @@ html body {
|
|
|
77980
77991
|
});
|
|
77981
77992
|
return out;
|
|
77982
77993
|
};
|
|
77994
|
+
const resolveBasemapStyle = (prop) => prop ?? config.basemapStyle;
|
|
77995
|
+
const CARTO_HOST = /(^|\.)cartocdn\.com$/i;
|
|
77996
|
+
const cartoTransformRequest = (key2 = config.cartoKey) => {
|
|
77997
|
+
if (!key2) return void 0;
|
|
77998
|
+
return (url) => {
|
|
77999
|
+
let parsed;
|
|
78000
|
+
try {
|
|
78001
|
+
parsed = new URL(url);
|
|
78002
|
+
} catch {
|
|
78003
|
+
return { url };
|
|
78004
|
+
}
|
|
78005
|
+
if (!CARTO_HOST.test(parsed.hostname) || parsed.searchParams.has("key")) {
|
|
78006
|
+
return { url };
|
|
78007
|
+
}
|
|
78008
|
+
parsed.searchParams.set("key", key2);
|
|
78009
|
+
return { url: parsed.toString() };
|
|
78010
|
+
};
|
|
78011
|
+
};
|
|
77983
78012
|
const wrapStyle = {
|
|
77984
78013
|
position: "absolute",
|
|
77985
78014
|
bottom: 8,
|
|
@@ -78136,7 +78165,6 @@ html body {
|
|
|
78136
78165
|
const k = resolveKey(record);
|
|
78137
78166
|
return k == null ? MISSING_COLOR : ESTABLISHMENT_COLORS[k];
|
|
78138
78167
|
};
|
|
78139
|
-
const POSITRON_STYLE = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json";
|
|
78140
78168
|
const GBIF_VISIBLE_KEY = "gbif-visible";
|
|
78141
78169
|
const readStoredGbifVisible = (defaultValue) => readSetting(GBIF_VISIBLE_KEY, defaultValue);
|
|
78142
78170
|
const writeStoredGbifVisible = (visible) => writeSetting(GBIF_VISIBLE_KEY, visible);
|
|
@@ -78249,7 +78277,10 @@ html body {
|
|
|
78249
78277
|
// true | null → show GBIF layer; false → GBIF API returned 0 occurrences,
|
|
78250
78278
|
// grey out the toggle and skip loading tiles. Defaults to true so the
|
|
78251
78279
|
// component works without the count check.
|
|
78252
|
-
gbifAvailable = true
|
|
78280
|
+
gbifAvailable = true,
|
|
78281
|
+
// MapLibre style URL or inline style object; falls back to the global
|
|
78282
|
+
// `configure({ basemapStyle })` value. Changing it rebuilds the map.
|
|
78283
|
+
basemapStyle
|
|
78253
78284
|
}) => {
|
|
78254
78285
|
var _a2;
|
|
78255
78286
|
const containerRef = reactExports.useRef(null);
|
|
@@ -78262,7 +78293,7 @@ html body {
|
|
|
78262
78293
|
const focalAttachedRef = reactExports.useRef(false);
|
|
78263
78294
|
const gbifAttachedRef = reactExports.useRef(false);
|
|
78264
78295
|
const descendantLayersRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
78265
|
-
const [
|
|
78296
|
+
const [readyMap, setReadyMap] = reactExports.useState(null);
|
|
78266
78297
|
const [focalReady, setFocalReady] = reactExports.useState(false);
|
|
78267
78298
|
const [descendantState, setDescendantState] = reactExports.useState({
|
|
78268
78299
|
status: "idle",
|
|
@@ -78335,12 +78366,16 @@ html body {
|
|
|
78335
78366
|
return { visibleGroups, unmappableGroups };
|
|
78336
78367
|
}, [descendantState, descendantColors, visibleTaxonIds]);
|
|
78337
78368
|
const showDescendantLegend = descendantLegend.visibleGroups.length > 0;
|
|
78369
|
+
const styleSpec = resolveBasemapStyle(basemapStyle);
|
|
78370
|
+
const cartoKey = config.cartoKey;
|
|
78371
|
+
const styleKey = `${typeof styleSpec === "string" ? styleSpec : JSON.stringify(styleSpec)}|${cartoKey || ""}`;
|
|
78338
78372
|
reactExports.useEffect(() => {
|
|
78339
78373
|
if (!containerRef.current || mapRef.current) return;
|
|
78340
78374
|
if (!supported()) return;
|
|
78341
78375
|
const map = new maplibregl.Map({
|
|
78342
78376
|
container: containerRef.current,
|
|
78343
|
-
style:
|
|
78377
|
+
style: styleSpec,
|
|
78378
|
+
transformRequest: cartoTransformRequest(cartoKey),
|
|
78344
78379
|
center: [0, 20],
|
|
78345
78380
|
zoom: 1,
|
|
78346
78381
|
minZoom: 0,
|
|
@@ -78361,7 +78396,7 @@ html body {
|
|
|
78361
78396
|
);
|
|
78362
78397
|
mapRef.current = map;
|
|
78363
78398
|
map.on("load", () => {
|
|
78364
|
-
|
|
78399
|
+
setReadyMap(map);
|
|
78365
78400
|
const attrib = map.getContainer().querySelector(".maplibregl-ctrl-attrib");
|
|
78366
78401
|
if (attrib) attrib.classList.remove("maplibregl-compact-show");
|
|
78367
78402
|
});
|
|
@@ -78378,12 +78413,12 @@ html body {
|
|
|
78378
78413
|
focalAttachedRef.current = false;
|
|
78379
78414
|
gbifAttachedRef.current = false;
|
|
78380
78415
|
descendantLayersRef.current = /* @__PURE__ */ new Set();
|
|
78416
|
+
setReadyMap(null);
|
|
78381
78417
|
};
|
|
78382
|
-
}, []);
|
|
78418
|
+
}, [styleKey]);
|
|
78383
78419
|
reactExports.useEffect(() => {
|
|
78384
|
-
|
|
78385
|
-
|
|
78386
|
-
if (!map) return;
|
|
78420
|
+
const map = readyMap;
|
|
78421
|
+
if (!map || !(records == null ? void 0 : records.length)) return;
|
|
78387
78422
|
let cancelled = false;
|
|
78388
78423
|
setFocalReady(false);
|
|
78389
78424
|
Promise.allSettled(
|
|
@@ -78394,7 +78429,7 @@ html body {
|
|
|
78394
78429
|
}))
|
|
78395
78430
|
)
|
|
78396
78431
|
).then((results) => {
|
|
78397
|
-
if (cancelled) return;
|
|
78432
|
+
if (cancelled || mapRef.current !== map) return;
|
|
78398
78433
|
const features = [];
|
|
78399
78434
|
const recordMap = /* @__PURE__ */ new Map();
|
|
78400
78435
|
let failures = 0;
|
|
@@ -78464,7 +78499,7 @@ html body {
|
|
|
78464
78499
|
return () => {
|
|
78465
78500
|
cancelled = true;
|
|
78466
78501
|
};
|
|
78467
|
-
}, [
|
|
78502
|
+
}, [readyMap, records]);
|
|
78468
78503
|
const onFocalClick = (e2) => {
|
|
78469
78504
|
var _a3, _b2;
|
|
78470
78505
|
const map = mapRef.current;
|
|
@@ -78492,8 +78527,7 @@ html body {
|
|
|
78492
78527
|
if (map.getLayer(FOCAL_LINE)) map.setLayoutProperty(FOCAL_LINE, "visibility", v2);
|
|
78493
78528
|
}, [focalVisible, focalReady]);
|
|
78494
78529
|
reactExports.useEffect(() => {
|
|
78495
|
-
|
|
78496
|
-
const map = mapRef.current;
|
|
78530
|
+
const map = readyMap;
|
|
78497
78531
|
if (!map) return;
|
|
78498
78532
|
const removeGbif = () => {
|
|
78499
78533
|
if (map.getLayer(GBIF_LAYER)) map.removeLayer(GBIF_LAYER);
|
|
@@ -78519,16 +78553,16 @@ html body {
|
|
|
78519
78553
|
layout: { visibility: gbifVisible ? "visible" : "none" }
|
|
78520
78554
|
});
|
|
78521
78555
|
gbifAttachedRef.current = true;
|
|
78522
|
-
}, [
|
|
78556
|
+
}, [readyMap, gbifChecklistKey, focalTaxon == null ? void 0 : focalTaxon.id, gbifAvailable]);
|
|
78523
78557
|
reactExports.useEffect(() => {
|
|
78524
78558
|
const map = mapRef.current;
|
|
78525
78559
|
if (!map || !gbifAttachedRef.current) return;
|
|
78526
78560
|
const v2 = gbifVisible ? "visible" : "none";
|
|
78527
78561
|
if (map.getLayer(GBIF_LAYER)) map.setLayoutProperty(GBIF_LAYER, "visibility", v2);
|
|
78528
78562
|
}, [gbifVisible]);
|
|
78563
|
+
const descendantVisibility = (id) => visibleTaxonIds.has(id) ? "visible" : "none";
|
|
78529
78564
|
reactExports.useEffect(() => {
|
|
78530
|
-
|
|
78531
|
-
const map = mapRef.current;
|
|
78565
|
+
const map = readyMap;
|
|
78532
78566
|
if (!map) return;
|
|
78533
78567
|
descendantLayersRef.current.forEach((id) => {
|
|
78534
78568
|
if (map.getLayer(descendantFillId(id))) map.removeLayer(descendantFillId(id));
|
|
@@ -78551,7 +78585,7 @@ html body {
|
|
|
78551
78585
|
}))
|
|
78552
78586
|
)
|
|
78553
78587
|
).then((results) => {
|
|
78554
|
-
if (
|
|
78588
|
+
if (mapRef.current !== map) return;
|
|
78555
78589
|
const features = [];
|
|
78556
78590
|
results.forEach((res, i) => {
|
|
78557
78591
|
if (res.status !== "fulfilled" || !res.value.geojson) return;
|
|
@@ -78584,7 +78618,7 @@ html body {
|
|
|
78584
78618
|
type: "fill",
|
|
78585
78619
|
source: srcId,
|
|
78586
78620
|
paint: { "fill-color": color, "fill-opacity": 0.55 },
|
|
78587
|
-
layout: { visibility:
|
|
78621
|
+
layout: { visibility: descendantVisibility(t2.id) }
|
|
78588
78622
|
},
|
|
78589
78623
|
beforeId
|
|
78590
78624
|
);
|
|
@@ -78594,7 +78628,7 @@ html body {
|
|
|
78594
78628
|
type: "line",
|
|
78595
78629
|
source: srcId,
|
|
78596
78630
|
paint: { "line-color": color, "line-width": 2 },
|
|
78597
|
-
layout: { visibility:
|
|
78631
|
+
layout: { visibility: descendantVisibility(t2.id) }
|
|
78598
78632
|
},
|
|
78599
78633
|
beforeId
|
|
78600
78634
|
);
|
|
@@ -78605,7 +78639,7 @@ html body {
|
|
|
78605
78639
|
}
|
|
78606
78640
|
});
|
|
78607
78641
|
});
|
|
78608
|
-
}, [
|
|
78642
|
+
}, [readyMap, descendantState, descendantColors]);
|
|
78609
78643
|
const onDescendantClick = (e2) => {
|
|
78610
78644
|
var _a3, _b2;
|
|
78611
78645
|
const map = mapRef.current;
|
|
@@ -79078,6 +79112,7 @@ html body {
|
|
|
79078
79112
|
focalTaxon,
|
|
79079
79113
|
rankOrder,
|
|
79080
79114
|
gbifChecklistKey,
|
|
79115
|
+
basemapStyle,
|
|
79081
79116
|
label,
|
|
79082
79117
|
md: md2
|
|
79083
79118
|
}) => {
|
|
@@ -79156,7 +79191,8 @@ html body {
|
|
|
79156
79191
|
focalTaxon,
|
|
79157
79192
|
rankOrder,
|
|
79158
79193
|
gbifChecklistKey,
|
|
79159
|
-
gbifAvailable
|
|
79194
|
+
gbifAvailable,
|
|
79195
|
+
basemapStyle
|
|
79160
79196
|
}
|
|
79161
79197
|
),
|
|
79162
79198
|
showToggle && unmappable > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { onClick: () => setView("list"), style: { cursor: "pointer" }, children: [
|
|
@@ -88468,7 +88504,8 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88468
88504
|
const {
|
|
88469
88505
|
datasetKey,
|
|
88470
88506
|
showDistributionMap,
|
|
88471
|
-
gbifChecklistKey
|
|
88507
|
+
gbifChecklistKey,
|
|
88508
|
+
basemapStyle
|
|
88472
88509
|
} = this.props;
|
|
88473
88510
|
const {
|
|
88474
88511
|
taxon,
|
|
@@ -88776,7 +88813,8 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88776
88813
|
showDistributionMap,
|
|
88777
88814
|
focalTaxon: taxon,
|
|
88778
88815
|
rankOrder: rank,
|
|
88779
|
-
gbifChecklistKey
|
|
88816
|
+
gbifChecklistKey,
|
|
88817
|
+
basemapStyle
|
|
88780
88818
|
}
|
|
88781
88819
|
),
|
|
88782
88820
|
get(taxon, "environments") && /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md, label: "Environment(s)", children: get(taxon, "environments").join(", ") }),
|
|
@@ -88856,6 +88894,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88856
88894
|
identifierLabel,
|
|
88857
88895
|
showDistributionMap,
|
|
88858
88896
|
gbifChecklistKey,
|
|
88897
|
+
basemapStyle,
|
|
88859
88898
|
auth,
|
|
88860
88899
|
...routerProps
|
|
88861
88900
|
}) {
|
|
@@ -88868,6 +88907,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88868
88907
|
identifierLabel,
|
|
88869
88908
|
showDistributionMap,
|
|
88870
88909
|
gbifChecklistKey,
|
|
88910
|
+
basemapStyle,
|
|
88871
88911
|
auth
|
|
88872
88912
|
}
|
|
88873
88913
|
) });
|
|
@@ -89828,6 +89868,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
89828
89868
|
taxonId,
|
|
89829
89869
|
datasetKey,
|
|
89830
89870
|
gbifChecklistKey,
|
|
89871
|
+
basemapStyle,
|
|
89831
89872
|
style: style2,
|
|
89832
89873
|
auth,
|
|
89833
89874
|
...routerProps
|
|
@@ -89867,6 +89908,7 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
89867
89908
|
focalTaxon: taxon,
|
|
89868
89909
|
rankOrder: rank,
|
|
89869
89910
|
gbifChecklistKey,
|
|
89911
|
+
basemapStyle,
|
|
89870
89912
|
showDistributionMap: true,
|
|
89871
89913
|
style: style2
|
|
89872
89914
|
}
|