@ca-plant-list/ca-plant-list 0.4.28 → 0.4.30

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/data/taxa.csv CHANGED
@@ -207,7 +207,8 @@ Balsamorhiza deltoidea,,N,1634,1047,70383,202414,true,Balsam Deltoid
207
207
  Balsamorhiza macrolepis,,N,1639,1051,69665,211633,true,California Balsamroot,,,,,350,1B.2,,,S2,G2
208
208
  Barbarea orthoceras,winter cress,N,15481,1057,52976,11356,true,American Wintercress,,yellow,3,7
209
209
  Bassia hyssopifolia,,X,15511,1060,58125,109432,true
210
- Bellardia trixago var. trixago,,X,8635,14706,1115038,416937,Bellardia trixago
210
+ Bellardia trixago var. trixago,Mediterranean lineseed,X,8635,14706,1115038,416937,Bellardia trixago,,annual,"white,pink",4,8
211
+ Bellardia viscosa,yellow glandweed,X,103729,14707,537967,206574,true,,annual,yellow,4,10
211
212
  Bellis perennis,English daisy,X,1652,1065,55563,202429,true
212
213
  Berberis aquifolium var. aquifolium,,N,71483,1068,126887,45198,Berberis aquifolium,Piper's Barberry
213
214
  Berberis aquifolium var. dictyota,,N,76967,1069,775436,45199,Berberis dictyota,Shining Netvein Barberry
@@ -225,7 +226,7 @@ Boechera breweri subsp. breweri,Brewer's rock cress,N,85519,11382,79644,41737,tr
225
226
  Bolboschoenus fluviatilis,river bulrush,N,80011,11419,64228,103271,true,River Bulrush
226
227
  Bolboschoenus maritimus subsp. paludosus,saltmarsh bulrush,N,49436,10796,79646,107348,true,Prairie Rush
227
228
  Bolboschoenus robustus,seacoast bulrush,N,77450,10798,75840,103276,true,Big Bulrush
228
- Bowlesia incana,,N,15999,1133,56822,202482,,Hoary Bowlesia
229
+ Bowlesia incana,Hoary bowlesia,N,15999,1133,56822,202482,,Hoary Bowlesia,annual,green,3,4
229
230
  Brachypodium distachyon,false-brome,X,16042,1137,57158,136941,true
230
231
  Brassica juncea,India mustard,X,16072,1142,64241,11799,true,,"annual,perennial",yellow,5,9
231
232
  Brassica nigra,black mustard,X,16079,1144,1555489,11804,true,,annual,yellow,4,9
@@ -340,10 +341,10 @@ Carpobrotus edulis,freeway iceplant,X,17975,1660,49322,112322,true
340
341
  Castilleja affinis subsp. affinis,Indian paintbrush,N,70068,1669,50043,95113,Castilleja affinis var. affinis,Coast Indian Paintbrush,,red
341
342
  Castilleja ambigua subsp. ambigua,johnny-nip,N,49732,1673,61110,95117,Castilleja ambigua var. ambigua,Johnny-nip,,,,,3361,4.2,,,S3S4,G5T4
342
343
  Castilleja applegatei subsp. martinii,,N,76733,1679,1041230,95122,Castilleja martini var. martini,Wavyleaf Indian Paintbrush
343
- Castilleja attenuata,valley tassels,N,18175,1683,49341,64264,true,Valley Tassels
344
- Castilleja densiflora subsp. densiflora,owl's-clover,N,49740,1691,61233,95130,Castilleja densiflora var. densiflora,Owl's Clover
345
- Castilleja exserta subsp. exserta,purple owl's-clover,N,49744,1695,59012,95134,Castilleja exserta var. exserta,Pale Purple Owlclover
346
- Castilleja exserta subsp. latifolia,,N,49745,1696,61109,95135,Castilleja exserta var. latifolia,Purple Owl's Clover
344
+ Castilleja attenuata,valley tassels,N,18175,1683,49341,64264,true,Valley Tassels,annual,white,3,5
345
+ Castilleja densiflora subsp. densiflora,owl's-clover,N,49740,1691,61233,95130,Castilleja densiflora var. densiflora,Owl's Clover,annual,purple,3,5
346
+ Castilleja exserta subsp. exserta,purple owl's-clover,N,49744,1695,59012,95134,Castilleja exserta var. exserta,Pale Purple Owlclover,annual,purple,3,5
347
+ Castilleja exserta subsp. latifolia,,N,49745,1696,61109,95135,Castilleja exserta var. latifolia,Purple Owl's Clover,annual,purple,3,5
347
348
  Castilleja foliolosa,woolly paintbrush,N,18205,1698,56760,64309,true,Texas Paintbrush,,red
348
349
  Castilleja rubicundula subsp. lithospermoides,cream sacs,N,49761,1729,57269,95159,Castilleja rubicundula var. lithospermoides,Cream Sacs
349
350
  Castilleja subinclusa subsp. franciscana,,N,76740,1733,53916,95162,Castilleja subinclusa var. franciscana,Longleaf Indian Paintbrush
@@ -502,7 +503,7 @@ Cryptantha hispidula,Napa cryptantha,N,21237,2465,57703,203175,,Napa Cryptantha,
502
503
  Cryptantha hooveri,,N,21240,2468,57701,245944,,Hoover's Cryptantha,,,,,525,1A,,,SH,GH
503
504
  Cryptantha intermedia var. intermedia,,N,71933,11568,80627,203183
504
505
  Cryptantha juniperensis,rigid cryptantha,N,103476,14557,769572,203205
505
- Cryptantha micromeres,,N,21263,2476,770232,203194,,Minute-flowered Cryptantha
506
+ Cryptantha micromeres,,N,21263,2476,53027,203194,,Minute-flowered Cryptantha
506
507
  Cryptantha microstachys,,N,21264,2477,57696,203195,,Tejon Cryptantha
507
508
  Cryptantha muricata var. jonesii,,N,57144,11572,80631,203200,,Jones' Cryptantha
508
509
  Cryptantha muricata var. muricata,,N,57145,11573,80632,203201,,Showy Prickly-nut Cryptantha
@@ -1483,11 +1484,11 @@ Pseudognaphalium ramosissimum,,N,80579,11959,53088,205661,true,Pink Cudweed
1483
1484
  Pseudognaphalium stramineum,,N,40045,11960,53089,205662,true,Chilean Cudweed
1484
1485
  Pseudognaphalium thermale,,N,81995,11049,78765,205663,true
1485
1486
  Pseudotsuga menziesii var. menziesii,Douglas Fir,N,64553,6907,63910,58841,true,Coast Douglas Fir
1486
- Psilocarphus brevissimus var. brevissimus,dwarf woolly-marbles,N,8098,6909,64159,205666,true,Dwarf Woollyheads
1487
+ Psilocarphus brevissimus var. brevissimus,dwarf woolly-marbles,N,8098,6909,64159,205666,true,Dwarf Woollyheads,annual,white,5,6
1487
1488
  Psilocarphus brevissimus var. multiflorus,,N,8099,6910,60148,205667,true,Delta Woolly-marbles,,,,,1756,4.2,,,S3,G4T3
1488
- Psilocarphus chilensis,round woolly-marbles,N,81848,11050,64158,205670,true,Round Woolly-marbles
1489
- Psilocarphus oregonus,Oregon woolly-marbles,N,4500,6912,60149,205671,true,Oregon Woollyheads
1490
- Psilocarphus tenellus,slender woolly-marbles,N,4501,6913,53188,205668,true,Slender Woolly-marbles
1489
+ Psilocarphus chilensis,round woolly-marbles,N,81848,11050,64158,205670,true,Round Woolly-marbles,annual,white,3,7
1490
+ Psilocarphus oregonus,Oregon woolly-marbles,N,4500,6912,60149,205671,true,Oregon Woollyheads,annual,white,3,7
1491
+ Psilocarphus tenellus,slender woolly-marbles,N,4501,6913,53188,205668,true,Slender Woolly-marbles,annual,white,3,7
1491
1492
  Ptelea crenulata,hop tree,N,40219,6929,50622,29077,,Western Hoptree
1492
1493
  Pteridium aquilinum var. pubescens,bracken fern,N,64626,6930,52684,201716,true,Hairy Brackenfern
1493
1494
  Pterostegia drymarioides,,N,40273,6935,53191,118523,true,Woodland Threadstem
@@ -1843,7 +1844,7 @@ Typha domingensis,southern cattail,N,47463,8177,58392,174864,true,Southern Catta
1843
1844
  Typha latifolia,cattail,N,47466,8178,48685,174865,true,Broadleaf Cattail
1844
1845
  Ulmus minor,English elm,X,47478,8180,79461,34372,Ulmus procera
1845
1846
  Umbellularia californica,California bay,N,47489,8183,48807,34384,true,California Laurel,perennial,yellow,11,5
1846
- Uropappus lindleyi,silver puffs,N,76212,8184,50806,206299,true,Uropappus
1847
+ Uropappus lindleyi,silver puffs,N,76212,8184,50806,206299,true,Silverpuffs
1847
1848
  Urospermum picroides,false hawkbit,X,5477,8185,59361,206301,true
1848
1849
  Urtica gracilis subsp. gracilis,American stinging nettle,N,70675,8186,1074432,207397,Urtica dioica subsp. gracilis
1849
1850
  Urtica gracilis subsp. holosericea,hoary nettle,N,53304,8187,141851,44056,Urtica dioica subsp. holosericea
@@ -1864,17 +1865,17 @@ Veronica catenata,chain speedwell,N,47944,8246,79496,78637,true
1864
1865
  Veronica peregrina subsp. xalapensis,purslane speedwell,N,53337,8252,491173,206335,,Purslane Speedwell
1865
1866
  Veronica persica,Persian speedwell,X,47976,8253,55666,78667,true
1866
1867
  Viburnum ellipticum,western viburnum,N,48020,8259,79500,211467,,Common Viburnum,,,,,2056,2B.3,,,S3,G4G5
1867
- Vicia americana subsp. americana,American vetch,N,53345,10448,53321,44061,,American Vetch
1868
- Vicia benghalensis,purple vetch,X,48060,8261,53333,34506
1869
- Vicia disperma,,X,48066,8263,79502,34518
1870
- Vicia gigantea,giant vetch,N,48092,8265,53322,34529,,Giant Vetch
1868
+ Vicia americana subsp. americana,American vetch,N,53345,10448,53321,44061,,American Vetch,perennial,blue,4,6
1869
+ Vicia benghalensis,purple vetch,X,48060,8261,53333,34506,,,annual,red,purple,3,6
1870
+ Vicia disperma,,X,48066,8263,79502,34518,,,annual,blue,3,5
1871
+ Vicia gigantea,giant vetch,N,48092,8265,53322,34529,,Giant Vetch,perennial,red,3,8
1871
1872
  Vicia hassei,slender vetch,N,48071,8266,57313,34535,,Slender Vetch
1872
- Vicia sativa subsp. nigra,common vetch,X,53355,8272,710103,44080
1873
+ Vicia sativa subsp. nigra,common vetch,X,53355,8272,710103,44080,,,annual,pink,3,6
1873
1874
  Vicia sativa subsp. sativa,spring vetch,X,53356,8273,53334,44081
1874
1875
  Vicia villosa subsp. varia,winter vetch,X,53358,8275,57316,44085
1875
1876
  Vicia villosa subsp. villosa,hairy vetch,X,53359,8276,57315,44086
1876
1877
  Vinca major,greater periwinkle,X,48131,8280,53326,78696
1877
- Viola adunca subsp. adunca,western blue violet,N,79074,11116,53339,207979,Viola adunca var. adunca,Hookedspur Violet
1878
+ Viola adunca subsp. adunca,western blue violet,N,79074,11116,53328,207979,Viola adunca var. adunca,Hookedspur Violet
1878
1879
  Viola douglasii,Douglas violet,N,48202,8288,79508,34682,true,Douglas' Violet,,yellow,2,7
1879
1880
  Viola glabella,stream violet,N,48214,8289,71113,34696,true,Pioneer Violet
1880
1881
  Viola ocellata,western heart's ease,N,48259,8297,61782,34736,true,Western Heart's Ease,,white,3,7
@@ -0,0 +1 @@
1
+ Small flowers in leaf axils.
@@ -0,0 +1 @@
1
+ Tip of corolla beak not hooked.
@@ -0,0 +1 @@
1
+ Tip of corolla beak not hooked.
@@ -0,0 +1 @@
1
+ Tip of corolla beak hooked.
@@ -0,0 +1 @@
1
+ Tip of corolla beak hooked. Inflorescence with alternate light and dark bands.
@@ -1 +1 @@
1
- Raceme with 8-15 flowers.
1
+ [Style](./g/style.html) flattened (_Vicia_ is not flattened). Raceme with 8-15 flowers. Tendril at end of leaf branched and coiled.
@@ -0,0 +1 @@
1
+ Largest heads 6–9 mm. On drying edges of wet areas.
@@ -0,0 +1 @@
1
+ Largest heads 3-5.5 mm. Upper leaves close to inflorescence and not spoon-shaped. Disc flower corolla with 4 lobes. Uncommon; in vernal pools.
@@ -0,0 +1 @@
1
+ Largest heads 4-6 mm. Upper leaves narrow, extending well beyone head. In drying parts of moist areas.
@@ -0,0 +1 @@
1
+ Largest heads 3-5.5 mm. Upper leaves usually spoon-shaped and spreading. Disc flower corolla with 5 lobes. Common, in wide variety of habitats including trails.
@@ -1 +1 @@
1
- Stems with spines. Anthers extending beyond petals. [Styles](./g/style.html) not hairy at base. Lower side of leaf not glandular. Sepals green- or red-tinged.
1
+ Stems with spines primarily at nodes. Anthers extending beyond petals. [Styles](./g/style.html) not hairy at base; protruding beyond anthers. Lower side of leaf not glandular. Sepals green- or red-tinged. Fruit red and bristly.
@@ -1 +1 @@
1
- Stems with spines. Anthers extending beyond petals. [Styles](./g/style.html) not hairy at base. Lower side of leaf glandular. Sepals purple.
1
+ Stems with spines at nodes and smaller spines between nodes. Anthers extending beyond petals. [Styles](./g/style.html) not hairy at base. Lower side of leaf glandular. Sepals purple. Fruit purple with dense bristles.
@@ -1 +1 @@
1
- Raceme with 3-9 flowers, not grouped on one side.
1
+ [Style](./g/style.html) not flattened (_Lathyrus_ is flattened). Raceme with 3-9 flowers, not grouped on one side. Flowers generally pale purple/lavender. Leaf usually < 10cm; [stipules](./g/stipule.html) generally with sharp points.
@@ -0,0 +1 @@
1
+ Flowers usually on one side of raceme; usually 3-12 reddish-purple flowers. Fruit very hairy.
@@ -0,0 +1 @@
1
+ Raceme with 2-6 flowers.
@@ -0,0 +1 @@
1
+ Leaf usually at least 10cm long. Flowers usually on one side of raceme, usually pinkish-red.
@@ -0,0 +1 @@
1
+ 1-4 flowers, not on a raceme.
package/lib/csv.js CHANGED
@@ -5,7 +5,7 @@ import { parse as parseSync } from "csv-parse/sync";
5
5
  import { parse } from "csv-parse";
6
6
  import { stringify } from "csv-stringify/sync";
7
7
 
8
- class CSV {
8
+ export class CSV {
9
9
  /**
10
10
  * @param {string} fileName
11
11
  * @param {import("csv-parse").ColumnOption[]|boolean|function (string[]):string[]} columns
@@ -95,10 +95,11 @@ class CSV {
95
95
  }
96
96
 
97
97
  /**
98
+ * @template T
98
99
  * @param {string} fileName
99
100
  * @param {boolean|import("csv-parse").ColumnOption[]|function (string[]):string[]} [columns]
100
101
  * @param {string} [delimiter]
101
- * @returns {Object<string,string>[]}
102
+ * @returns {T[]}
102
103
  */
103
104
  static readFile(fileName, columns = true, delimiter) {
104
105
  const content = fs.readFileSync(fileName);
@@ -155,5 +156,3 @@ class CSV {
155
156
  fs.writeFileSync(fileName, content.replaceAll(/,+\n/g, "\n"));
156
157
  }
157
158
  }
158
-
159
- export { CSV };
@@ -1,6 +1,6 @@
1
1
  import { TextUtils } from "./textutils.js";
2
2
 
3
- class FlowerColor {
3
+ export class FlowerColor {
4
4
  #colorName;
5
5
  #colorCode;
6
6
  /** @type {import("./types.js").Taxon[]} */
@@ -38,5 +38,3 @@ class FlowerColor {
38
38
  return this.#taxa;
39
39
  }
40
40
  }
41
-
42
- export { FlowerColor };
package/lib/index.d.ts CHANGED
@@ -82,10 +82,7 @@ export class Config {
82
82
  }
83
83
 
84
84
  export class CSV {
85
- static readFile(
86
- fileName: string,
87
- delimeter?: string,
88
- ): Record<string, string>[];
85
+ static readFile<T>(fileName: string, delimeter?: string): T[];
89
86
  static writeFileObject(
90
87
  fileName: string,
91
88
  data: Record<string, any>[],
@@ -129,6 +126,21 @@ export class Files {
129
126
 
130
127
  export class Genera {}
131
128
 
129
+ export class GenericPage {
130
+ constructor(
131
+ siteGenerator: SiteGenerator,
132
+ title: string,
133
+ baseFileName: string,
134
+ js?: string,
135
+ );
136
+ getBaseFileName(): string;
137
+ getFrontMatter(): string;
138
+ getOutputDir(): string;
139
+ getSiteGenerator(): SiteGenerator;
140
+ getTitle(): string;
141
+ writeFile(content: string): void;
142
+ }
143
+
132
144
  export class Genus<T extends Taxon> {
133
145
  getTaxa(): T[];
134
146
  }
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ import { Exceptions } from "./exceptions.js";
6
6
  import { ExternalSites } from "./externalsites.js";
7
7
  import { Families } from "./taxonomy/families.js";
8
8
  import { Files } from "./files.js";
9
+ import { GenericPage } from "./web/pageGeneric.js";
9
10
  import { HTML } from "./html.js";
10
11
  import { HTMLFragments } from "./utils/htmlFragments.js";
11
12
  import { HTMLTaxon } from "./htmltaxon.js";
@@ -24,6 +25,7 @@ export {
24
25
  ExternalSites,
25
26
  Families,
26
27
  Files,
28
+ GenericPage,
27
29
  HTML,
28
30
  HTMLFragments,
29
31
  HTMLTaxon,
package/lib/photo.js CHANGED
@@ -60,6 +60,15 @@ export class Photo {
60
60
  * @returns {string} The URL to retrieve the image file.
61
61
  */
62
62
  getUrl() {
63
- return `https://inaturalist-open-data.s3.amazonaws.com/photos/${this.#id}/medium.${this.#ext}`;
63
+ return Photo.getUrl(this.#id, this.#ext);
64
+ }
65
+
66
+ /**
67
+ * @param {number|string} id
68
+ * @param {string} ext
69
+ * @returns {string} The URL to retrieve the image file.
70
+ */
71
+ static getUrl(id, ext) {
72
+ return `https://inaturalist-open-data.s3.amazonaws.com/photos/${id}/medium.${ext}`;
64
73
  }
65
74
  }
package/lib/util.js CHANGED
@@ -1,16 +1,19 @@
1
1
  /**
2
2
  * Break an array into chunks of a desired size
3
3
  * https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore?tab=readme-ov-file#_chunk
4
- * @param {any[]} input
4
+ * @template T
5
+ * @param {T[]} input
5
6
  * @param {number} size
6
- * @returns {any[][]}
7
+ * @returns {T[][]}
7
8
  */
8
9
  export function chunk(input, size) {
10
+ /** @type {T[][]} */
11
+ const result = [];
9
12
  return input.reduce((arr, item, idx) => {
10
13
  return idx % size === 0
11
14
  ? [...arr, [item]]
12
15
  : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
13
- }, []);
16
+ }, result);
14
17
  }
15
18
 
16
19
  /**
@@ -0,0 +1,10 @@
1
+ export class HttpUtils {
2
+ /**
3
+ * @param {URL|string} url
4
+ * @returns {Promise<boolean>}
5
+ */
6
+ static async UrlExists(url) {
7
+ const response = await fetch(url, { method: "HEAD" });
8
+ return response.status === 200;
9
+ }
10
+ }
@@ -41,11 +41,10 @@ import { chunk, sleep } from "../util.js";
41
41
  const ALLOWED_LICENSE_CODES = ["cc0", "cc-by", "cc-by-nc"];
42
42
 
43
43
  /**
44
- * @param {import("../types.js").Taxon[]} taxa
44
+ * @param {string[]} inatTaxonIDs
45
45
  * @return {Promise<InatApiTaxon[]>}
46
46
  */
47
- async function fetchInatTaxa(taxa) {
48
- const inatTaxonIDs = taxa.map((taxon) => taxon.getINatID()).filter(Boolean);
47
+ async function fetchInatTaxa(inatTaxonIDs) {
49
48
  const url = `https://api.inaturalist.org/v2/taxa/${inatTaxonIDs.join(",")}?fields=(taxon_photos:(photo:(medium_url:!t,attribution:!t,license_code:!t)))`;
50
49
  const resp = await fetch(url);
51
50
  if (!resp.ok) {
@@ -77,13 +76,11 @@ export async function getTaxonPhotos(taxaToUpdate) {
77
76
  let taxaRetrieved = 0;
78
77
 
79
78
  for (const batch of chunk(taxaToUpdate, 30)) {
80
- const inatTaxa = await fetchInatTaxa(batch);
79
+ const inatTaxa = await fetchInatTaxa(batch.map((t) => t.getINatID()));
81
80
  for (const iNatTaxon of inatTaxa) {
82
- const iNatTaxonPhotos = iNatTaxon.taxon_photos
83
- .filter((tp) =>
84
- ALLOWED_LICENSE_CODES.includes(tp.photo.license_code),
85
- )
86
- .slice(0, 5);
81
+ const iNatTaxonPhotos = iNatTaxon.taxon_photos.filter((tp) =>
82
+ ALLOWED_LICENSE_CODES.includes(tp.photo.license_code),
83
+ );
87
84
 
88
85
  const taxonName = idMap.get(iNatTaxon.id.toString());
89
86
  if (!taxonName) {
@@ -27,8 +27,7 @@ export class GenericPage {
27
27
  }
28
28
 
29
29
  getDefaultIntro() {
30
- let html = this.getFrontMatter();
31
- return html + this.getMarkdown();
30
+ return this.getFrontMatter() + this.getMarkdown();
32
31
  }
33
32
 
34
33
  getFrontMatter() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ca-plant-list/ca-plant-list",
3
- "version": "0.4.28",
3
+ "version": "0.4.30",
4
4
  "description": "Tools to create files for a website listing plants in an area of California.",
5
5
  "license": "MIT",
6
6
  "repository": {