col-browser 2.6.6 → 2.7.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.
@@ -1,210 +0,0 @@
1
- import { j as l } from "./jsx-runtime-BzflLqGi.js";
2
- import { useState as _, useEffect as R } from "react";
3
- import { c as S } from "./config--bs_09I6.js";
4
- import { u as K, c as A } from "./router-CssZk5qZ.js";
5
- import I from "highcharts";
6
- import "highcharts/modules/exporting";
7
- import ee from "highcharts-react-official";
8
- import { get as d, keyBy as te } from "lodash-es";
9
- import { Row as ne, Col as L, Spin as se, Switch as ie } from "antd";
10
- import { r as oe, w as re } from "./storage-BgdCo9fV.js";
11
- const T = "breakdown-level", z = 100, ae = [
12
- "kingdom",
13
- "phylum",
14
- "class",
15
- "order",
16
- "family",
17
- "genus",
18
- "species"
19
- ], B = (t) => t ? `Not assigned ${t}` : "Not assigned", W = (t) => {
20
- if (!t || t.length === 0) return [];
21
- const i = [...t].sort((o, n) => (n.species || 0) - (o.species || 0));
22
- return i.length <= z ? i : i.slice(0, z);
23
- }, ce = (t, i) => {
24
- const o = W(t || []), n = o.reduce((u, c) => u + (c.species || 0), 0);
25
- return n >= i ? o : [
26
- ...o,
27
- {
28
- name: B(d(o, "[0].rank", "")),
29
- species: i - n,
30
- children: []
31
- }
32
- ];
33
- }, ve = ({
34
- taxon: t,
35
- datasetKey: i,
36
- rank: o = [],
37
- dataset: n,
38
- level: u = 1,
39
- showLevelSwitch: c = !1,
40
- darkMode: w
41
- }) => {
42
- const G = K("taxon"), [D, H] = _(null), [M, x] = _(!1), [V, X] = _(!1), [f, E] = _(
43
- () => c ? oe(T, u) : u
44
- );
45
- R(() => {
46
- c || E(u);
47
- }, [u, c]), R(() => {
48
- c && re(T, f);
49
- }, [f, c]), R(() => {
50
- t != null && t.id && i && U();
51
- }, [t, i, f]);
52
- const P = async () => {
53
- const a = await A(
54
- `${S.dataApi}dataset/${i}/nameusage/search?TAXON_ID=${encodeURIComponent(
55
- t.id
56
- )}&facet=rank&status=accepted&status=provisionally%20accepted&limit=0`
57
- );
58
- return te(d(a, "data.facets.rank", []), "value");
59
- }, U = async () => {
60
- x(!0);
61
- try {
62
- const a = await P(), p = ae;
63
- let h = p.indexOf(d(t, "name.rank"));
64
- if (h === -1) {
65
- let s = o.indexOf(d(t, "name.rank")) + 1;
66
- for (; h === -1 && s < o.length - 1; ) {
67
- const g = p.indexOf(o[s]);
68
- g > -1 && (h = g - 1), s++;
69
- }
70
- }
71
- let m, y = h + 1;
72
- for (; !m && y < p.length; ) {
73
- const s = d(p, `[${y}]`);
74
- s && d(a, `${s}.count`, 0) > 0 ? m = s : y++;
75
- }
76
- if (!m) {
77
- X(!0), x(!1);
78
- return;
79
- }
80
- const v = (await A(
81
- `${S.dataApi}dataset/${i}/taxon/${t.id}/breakdown?level=${f}`
82
- )).data || [], j = d(a, "species.count", 0);
83
- x(!1), Y(v, j);
84
- } catch {
85
- x(!1);
86
- }
87
- }, Y = (a, p) => {
88
- const h = n.doi ? "https://doi.org/" + n.doi : null, m = I.getOptions().colors, $ = (typeof w == "boolean" ? w : typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches) ? "#1f1f1f" : "#ffffff", v = {
89
- click: (e) => {
90
- e.point._id && G(e.point._id);
91
- }
92
- }, s = ce(a, p).map((e, r) => ({
93
- name: e.name,
94
- y: e.species,
95
- _id: e.id,
96
- color: m[r % m.length],
97
- _kids: e.children
98
- })), g = [], b = f >= 2 && s.some((e) => e._kids && e._kids.length > 0);
99
- b && s.forEach((e) => {
100
- const r = W(e._kids || []), O = r.reduce((k, C) => k + (C.species || 0), 0);
101
- r.forEach((k, C) => {
102
- const Z = -0.1 + (r.length > 1 ? C / (r.length - 1) : 0) * 0.4;
103
- g.push({
104
- name: k.name,
105
- y: k.species,
106
- _id: k.id,
107
- color: I.color(e.color).brighten(Z).get()
108
- });
109
- }), O < e.y && g.push({
110
- name: B(d(r, "[0].rank", "")),
111
- y: e.y - O,
112
- color: $,
113
- borderColor: $,
114
- borderWidth: 0,
115
- dataLabels: { enabled: !1 }
116
- });
117
- });
118
- const F = (e) => e.map(({ _kids: r, ...O }) => O), J = p || s.reduce((e, r) => e + r.y, 0), Q = b ? {
119
- formatter: function() {
120
- return this.y > J / 10 ? this.point.name : null;
121
- },
122
- distance: -30,
123
- style: {
124
- color: "contrast",
125
- textOutline: "1px contrast",
126
- fontWeight: "bold"
127
- }
128
- } : {
129
- formatter: function() {
130
- return this.y > 1 ? "<b>" + this.point.name + ":</b> " + this.y.toLocaleString("en-GB") : null;
131
- }
132
- }, N = [
133
- {
134
- name: "Species",
135
- data: F(s),
136
- size: b ? "60%" : "85%",
137
- dataLabels: Q,
138
- point: { events: v }
139
- }
140
- ];
141
- b && N.push({
142
- name: "Species",
143
- data: g,
144
- size: "85%",
145
- innerSize: "60%",
146
- dataLabels: {
147
- formatter: function() {
148
- return this.y > 1 ? "<b>" + this.point.name + ":</b> " + this.y.toLocaleString("en-GB") : null;
149
- }
150
- },
151
- point: { events: v }
152
- }), H({
153
- chart: { type: "pie" },
154
- credits: {
155
- text: `${t.name.scientificName} in ${n.title}${n.version ? " (" + n.version + ")" : ""}. ${(n.doi ? "DOI:" + n.doi : null) || n.url || ""}`,
156
- href: h || n.url || ""
157
- },
158
- title: { text: "" },
159
- plotOptions: { pie: { shadow: !1, center: ["50%", "50%"] } },
160
- tooltip: {},
161
- series: N,
162
- responsive: {
163
- rules: [
164
- {
165
- condition: { maxWidth: 400 },
166
- chartOptions: {
167
- series: b ? [{}, { dataLabels: { enabled: !1 } }] : [{}]
168
- }
169
- }
170
- ]
171
- },
172
- exporting: {
173
- chartOptions: {
174
- plotOptions: { series: { dataLabels: { enabled: !0 } } }
175
- },
176
- fallbackToExportServer: !1
177
- }
178
- });
179
- };
180
- if (V) return null;
181
- const q = c ? /* @__PURE__ */ l.jsx(
182
- ie,
183
- {
184
- size: "small",
185
- checked: f === 2,
186
- onChange: (a) => E(a ? 2 : 1),
187
- checkedChildren: "lvl2",
188
- unCheckedChildren: "lvl1",
189
- style: {
190
- position: "absolute",
191
- top: 11,
192
- right: 44,
193
- zIndex: 2,
194
- background: f === 2 ? "#8c8c8c" : "#bfbfbf"
195
- }
196
- }
197
- ) : null;
198
- return /* @__PURE__ */ l.jsxs("div", { style: { position: "relative" }, children: [
199
- q,
200
- M || !D ? /* @__PURE__ */ l.jsxs(ne, { style: { padding: "48px" }, children: [
201
- /* @__PURE__ */ l.jsx(L, { flex: "auto" }),
202
- /* @__PURE__ */ l.jsx(L, { children: /* @__PURE__ */ l.jsx(se, { size: "large" }) }),
203
- /* @__PURE__ */ l.jsx(L, { flex: "auto" })
204
- ] }) : /* @__PURE__ */ l.jsx(ee, { highcharts: I, options: D })
205
- ] });
206
- };
207
- export {
208
- ve as T
209
- };
210
- //# sourceMappingURL=TaxonBreakdown-DqdQ18QM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TaxonBreakdown-DqdQ18QM.js","sources":["../../src/Taxon/TaxonBreakdown.js"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport config from \"../config\";\nimport client from \"../api/client\";\nimport Highcharts from \"highcharts\";\nimport \"highcharts/modules/exporting\";\nimport HighchartsReact from \"highcharts-react-official\";\nimport { get, keyBy } from \"lodash-es\";\nimport { Spin, Row, Col, Switch } from \"antd\";\nimport { useNavigateTo } from \"../router\";\nimport { readSetting, writeSetting } from \"../storage\";\n\nconst BREAKDOWN_LEVEL_KEY = \"breakdown-level\";\n\nconst MAX_SLICES_PER_RING = 100;\nconst canonicalRanks = [\n \"kingdom\",\n \"phylum\",\n \"class\",\n \"order\",\n \"family\",\n \"genus\",\n \"species\",\n];\n\nconst notAssignedLabel = (rk) => (rk ? `Not assigned ${rk}` : \"Not assigned\");\n\nconst sortAndClip = (nodes) => {\n if (!nodes || nodes.length === 0) return [];\n const sorted = [...nodes].sort((a, b) => (b.species || 0) - (a.species || 0));\n return sorted.length <= MAX_SLICES_PER_RING\n ? sorted\n : sorted.slice(0, MAX_SLICES_PER_RING);\n};\n\n// Append a \"Not assigned <rank>\" slice for the difference between a parent's\n// total species count and the sum of its visible children. Covers two cases:\n// 1. species that sit directly under the parent without an intermediate rank\n// 2. species under children that were clipped out by sortAndClip\nconst padNotAssigned = (kids, parentSpecies) => {\n const sorted = sortAndClip(kids || []);\n const sum = sorted.reduce((a, n) => a + (n.species || 0), 0);\n if (sum >= parentSpecies) return sorted;\n return [\n ...sorted,\n {\n name: notAssignedLabel(get(sorted, \"[0].rank\", \"\")),\n species: parentSpecies - sum,\n children: [],\n },\n ];\n};\n\nconst TaxonBreakdown = ({\n taxon,\n datasetKey,\n rank = [],\n dataset,\n level = 1,\n showLevelSwitch = false,\n darkMode,\n}) => {\n const navigateToTaxon = useNavigateTo(\"taxon\");\n const [options, setOptions] = useState(null);\n const [loading, setLoading] = useState(false);\n const [invalid, setInvalid] = useState(false);\n // The chart's effective level is controlled internally when the switch\n // is enabled, so toggling can refetch + re-render the chart. Otherwise\n // the prop drives directly.\n const [activeLevel, setActiveLevel] = useState(() =>\n showLevelSwitch ? readSetting(BREAKDOWN_LEVEL_KEY, level) : level\n );\n useEffect(() => {\n // When the 1/2 switch is shown the remembered choice owns the level, so a\n // (usually static) `level` prop must not clobber it; otherwise the prop\n // drives directly.\n if (!showLevelSwitch) setActiveLevel(level);\n }, [level, showLevelSwitch]);\n useEffect(() => {\n if (showLevelSwitch) writeSetting(BREAKDOWN_LEVEL_KEY, activeLevel);\n }, [activeLevel, showLevelSwitch]);\n useEffect(() => {\n if (taxon?.id && datasetKey) {\n getData();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [taxon, datasetKey, activeLevel]);\n\n const getOverView = async () => {\n const res = await client(\n `${\n config.dataApi\n }dataset/${datasetKey}/nameusage/search?TAXON_ID=${encodeURIComponent(\n taxon.id\n )}&facet=rank&status=accepted&status=provisionally%20accepted&limit=0`\n );\n return keyBy(get(res, \"data.facets.rank\", []), \"value\");\n };\n\n const getData = async () => {\n setLoading(true);\n try {\n const counts = await getOverView();\n\n // confirm the focal taxon has at least one child rank with content\n const ranks = canonicalRanks;\n let taxonRankIdx = ranks.indexOf(get(taxon, \"name.rank\"));\n if (taxonRankIdx === -1) {\n let rankIndex = rank.indexOf(get(taxon, \"name.rank\")) + 1;\n while (taxonRankIdx === -1 && rankIndex < rank.length - 1) {\n const canonicalRankIndex = ranks.indexOf(rank[rankIndex]);\n if (canonicalRankIndex > -1) {\n taxonRankIdx = canonicalRankIndex - 1;\n }\n rankIndex++;\n }\n }\n let childRank;\n let childRankIndex = taxonRankIdx + 1;\n while (!childRank && childRankIndex < ranks.length) {\n const nextRank = get(ranks, `[${childRankIndex}]`);\n if (nextRank && get(counts, `${nextRank}.count`, 0) > 0) {\n childRank = nextRank;\n } else {\n childRankIndex++;\n }\n }\n if (!childRank) {\n setInvalid(true);\n setLoading(false);\n return;\n }\n\n const res = await client(\n `${config.dataApi}dataset/${datasetKey}/taxon/${taxon.id}/breakdown?level=${activeLevel}`\n );\n const children = res.data || [];\n const totalSpecies = get(counts, \"species.count\", 0);\n\n setLoading(false);\n buildChart(children, totalSpecies);\n } catch (err) {\n setLoading(false);\n }\n };\n\n const buildChart = (children, totalSpecies) => {\n const DOI = dataset.doi ? \"https://doi.org/\" + dataset.doi : null;\n const baseColors = Highcharts.getOptions().colors;\n // Colour used for outer-ring \"gap\" slices: match the page background so\n // the wedge reads as empty space rather than overlapping the inner pie.\n // Follows the explicit `darkMode` prop if given, otherwise prefers-color-scheme.\n const prefersDark =\n typeof darkMode === \"boolean\"\n ? darkMode\n : typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n const gapColor = prefersDark ? \"#1f1f1f\" : \"#ffffff\";\n const taxonClickHandler = {\n click: (e) => {\n if (e.point._id) {\n navigateToTaxon(e.point._id);\n }\n },\n };\n\n // Inner pie: direct children of the focal taxon. Pad with a single\n // \"Not assigned <rank>\" slice if focal-taxon species don't fully sum up.\n const innerNodes = padNotAssigned(children, totalSpecies);\n const innerData = innerNodes.map((n, i) => ({\n name: n.name,\n y: n.species,\n _id: n.id,\n color: baseColors[i % baseColors.length],\n _kids: n.children,\n }));\n\n // Outer ring: children of each inner slice (grandchildren of focal),\n // coloured as a monochrome brightness shift of the parent so each\n // family of arcs reads as one hue group. Only rendered when level >= 2\n // AND the response actually carries that depth. With level=1 we draw\n // a single-ring pie even if the API returned nested children.\n const outerData = [];\n const hasOuterData =\n activeLevel >= 2 && innerData.some((s) => s._kids && s._kids.length > 0);\n if (hasOuterData) {\n innerData.forEach((slice) => {\n const sorted = sortAndClip(slice._kids || []);\n const sum = sorted.reduce((a, n) => a + (n.species || 0), 0);\n sorted.forEach((g, j) => {\n const t = sorted.length > 1 ? j / (sorted.length - 1) : 0;\n const shift = -0.1 + t * 0.4;\n outerData.push({\n name: g.name,\n y: g.species,\n _id: g.id,\n color: Highcharts.color(slice.color).brighten(shift).get(),\n });\n });\n // Where children don't fully account for the inner slice, add a\n // transparent gap slice so the outer ring stays angularly aligned\n // with the inner pie but the missing portion reads as empty space\n // (rather than a labelled \"Not assigned\" wedge).\n if (sum < slice.y) {\n outerData.push({\n name: notAssignedLabel(get(sorted, \"[0].rank\", \"\")),\n y: slice.y - sum,\n color: gapColor,\n borderColor: gapColor,\n borderWidth: 0,\n dataLabels: { enabled: false },\n });\n }\n });\n }\n\n const clean = (rows) => rows.map(({ _kids, ...rest }) => rest);\n const grandTotal = totalSpecies || innerData.reduce((a, s) => a + s.y, 0);\n\n const innerLabelStyle = {\n color: \"contrast\",\n textOutline: \"1px contrast\",\n fontWeight: \"bold\",\n };\n\n // Inner-ring data labels: only positioned inside the ring when there's\n // an outer ring fighting for the external label gutter. With just one\n // ring (level=1) the labels live outside the chart, same as the outer\n // ring at level=2, with the slice name + species count.\n const innerDataLabels = hasOuterData\n ? {\n formatter: function () {\n return this.y > grandTotal / 10 ? this.point.name : null;\n },\n distance: -30,\n style: innerLabelStyle,\n }\n : {\n formatter: function () {\n return this.y > 1\n ? \"<b>\" +\n this.point.name +\n \":</b> \" +\n this.y.toLocaleString(\"en-GB\")\n : null;\n },\n };\n\n const series = [\n {\n name: \"Species\",\n data: clean(innerData),\n size: hasOuterData ? \"60%\" : \"85%\",\n dataLabels: innerDataLabels,\n point: { events: taxonClickHandler },\n },\n ];\n if (hasOuterData) {\n series.push({\n name: \"Species\",\n data: outerData,\n size: \"85%\",\n innerSize: \"60%\",\n dataLabels: {\n formatter: function () {\n return this.y > 1\n ? \"<b>\" +\n this.point.name +\n \":</b> \" +\n this.y.toLocaleString(\"en-GB\")\n : null;\n },\n },\n point: { events: taxonClickHandler },\n });\n }\n\n setOptions({\n chart: { type: \"pie\" },\n credits: {\n text: `${taxon.name.scientificName} in ${dataset.title}${\n dataset.version ? \" (\" + dataset.version + \")\" : \"\"\n }. ${(dataset.doi ? \"DOI:\" + dataset.doi : null) || dataset.url || \"\"}`,\n href: DOI || dataset.url || \"\",\n },\n title: { text: \"\" },\n plotOptions: { pie: { shadow: false, center: [\"50%\", \"50%\"] } },\n tooltip: {},\n series,\n responsive: {\n rules: [\n {\n condition: { maxWidth: 400 },\n chartOptions: {\n series: hasOuterData\n ? [{}, { dataLabels: { enabled: false } }]\n : [{}],\n },\n },\n ],\n },\n exporting: {\n chartOptions: {\n plotOptions: { series: { dataLabels: { enabled: true } } },\n },\n fallbackToExportServer: false,\n },\n });\n };\n\n if (invalid) return null;\n\n // Place the level toggle inside the chart's top-right area, just left of\n // the Highcharts context-menu (≡) icon, so it doesn't consume an extra\n // row. Colourless switch with lvl1 / lvl2 labels.\n const levelSwitch = showLevelSwitch ? (\n <Switch\n size=\"small\"\n checked={activeLevel === 2}\n onChange={(checked) => setActiveLevel(checked ? 2 : 1)}\n checkedChildren=\"lvl2\"\n unCheckedChildren=\"lvl1\"\n style={{\n position: \"absolute\",\n top: 11,\n right: 44,\n zIndex: 2,\n background: activeLevel === 2 ? \"#8c8c8c\" : \"#bfbfbf\",\n }}\n />\n ) : null;\n\n return (\n <div style={{ position: \"relative\" }}>\n {levelSwitch}\n {loading || !options ? (\n <Row style={{ padding: \"48px\" }}>\n <Col flex=\"auto\"></Col>\n <Col>\n <Spin size=\"large\" />\n </Col>\n <Col flex=\"auto\"></Col>\n </Row>\n ) : (\n <HighchartsReact highcharts={Highcharts} options={options} />\n )}\n </div>\n );\n};\n\nexport default TaxonBreakdown;\n"],"names":["BREAKDOWN_LEVEL_KEY","MAX_SLICES_PER_RING","canonicalRanks","notAssignedLabel","rk","sortAndClip","nodes","sorted","a","b","padNotAssigned","kids","parentSpecies","sum","n","get","TaxonBreakdown","taxon","datasetKey","rank","dataset","level","showLevelSwitch","darkMode","navigateToTaxon","useNavigateTo","options","setOptions","useState","loading","setLoading","invalid","setInvalid","activeLevel","setActiveLevel","readSetting","useEffect","writeSetting","getData","getOverView","res","client","config","keyBy","counts","ranks","taxonRankIdx","rankIndex","canonicalRankIndex","childRank","childRankIndex","nextRank","children","totalSpecies","buildChart","DOI","baseColors","Highcharts","gapColor","taxonClickHandler","innerData","i","outerData","hasOuterData","s","slice","g","j","shift","clean","rows","_kids","rest","grandTotal","innerDataLabels","series","levelSwitch","jsx","Switch","checked","jsxs","Row","Col","Spin","HighchartsReact"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAsB,mBAEtBC,IAAsB,KACtBC,KAAiB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MAAQA,IAAK,gBAAgBA,CAAE,KAAK,gBAExDC,IAAc,CAACC,MAAU;AAC7B,MAAI,CAACA,KAASA,EAAM,WAAW,UAAU,CAAA;AACzC,QAAMC,IAAS,CAAC,GAAGD,CAAK,EAAE,KAAK,CAACE,GAAGC,OAAOA,EAAE,WAAW,MAAMD,EAAE,WAAW,EAAE;AAC5E,SAAOD,EAAO,UAAUN,IACpBM,IACAA,EAA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