plantfyi-embed 1.0.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/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/embed.esm.js +2333 -0
- package/dist/embed.min.js +1167 -0
- package/dist/index.d.ts +27 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FYIPedia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# plantfyi-embed
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/plantfyi-embed)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.npmjs.com/package/plantfyi-embed)
|
|
6
|
+
|
|
7
|
+
Embed **PlantFYI** widgets — plants, glossary terms, interactive tools, and inline elements — on any website. **10 widget types**, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), 2 styles (modern, organic), and live data from the [PlantFYI](https://plantfyi.com) database.
|
|
8
|
+
|
|
9
|
+
Every widget includes a "Powered by PlantFYI" backlink directing readers to the full reference.
|
|
10
|
+
|
|
11
|
+
> **Try the interactive widget builder at [widget.plantfyi.com](https://widget.plantfyi.com)**
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<!-- Place widget div where you want it to appear -->
|
|
17
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="light"></div>
|
|
18
|
+
|
|
19
|
+
<!-- Load the embed script once, anywhere on the page -->
|
|
20
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. The widget fetches data from the PlantFYI API and renders with full style isolation.
|
|
24
|
+
|
|
25
|
+
## Widget Types
|
|
26
|
+
|
|
27
|
+
| Type | Usage | Description |
|
|
28
|
+
|------|-------|-------------|
|
|
29
|
+
| `entity` | `<div data-plantfyi="entity" data-slug="..."></div>` | Entity detail card — species, bird, fish, plant, or dinosaur |
|
|
30
|
+
| `glossary` | `<div data-plantfyi="glossary" data-slug="..."></div>` | Glossary term definition with cross-references |
|
|
31
|
+
| `guide` | `<div data-plantfyi="guide" data-slug="..."></div>` | Guide summary card with key takeaways |
|
|
32
|
+
| `compare` | `<div data-plantfyi="compare" data-slug="..."></div>` | Side-by-side entity comparison |
|
|
33
|
+
| `search` | `<div data-plantfyi="search" data-slug="..."></div>` | Search box linking to the full database |
|
|
34
|
+
| `iucn-badge` | `<div data-plantfyi="iucn-badge" data-slug="..."></div>` | IUCN conservation status badge with 9 status levels |
|
|
35
|
+
| `hardiness-zone` | `<div data-plantfyi="hardiness-zone" data-slug="..."></div>` | USDA hardiness zone indicator with color scale |
|
|
36
|
+
| `bloom-calendar` | `<div data-plantfyi="bloom-calendar" data-slug="..."></div>` | 12-month bloom season visualization |
|
|
37
|
+
| `iucn-inline` | `<div data-plantfyi="iucn-inline" data-slug="..."></div>` | Inline IUCN status colored pill |
|
|
38
|
+
| `taxonomy-inline` | `<div data-plantfyi="taxonomy-inline" data-slug="..."></div>` | Italic scientific binomial name |
|
|
39
|
+
|
|
40
|
+
## Widget Options
|
|
41
|
+
|
|
42
|
+
| Attribute | Values | Default | Description |
|
|
43
|
+
|-----------|--------|---------|-------------|
|
|
44
|
+
| `data-plantfyi` | entity, compare, glossary, guide, search, [tools] | required | Widget type |
|
|
45
|
+
| `data-slug` | e.g. "plants" | — | Entity slug from the PlantFYI database |
|
|
46
|
+
| `data-theme` | light, dark, sepia, auto | light | Visual theme (`auto` follows OS preference) |
|
|
47
|
+
| `data-style` | modern, organic | modern | Widget design style |
|
|
48
|
+
| `data-size` | default, compact, large | default | Widget size |
|
|
49
|
+
| `data-placeholder` | any string | "Search Plants..." | Search box placeholder |
|
|
50
|
+
|
|
51
|
+
## Themes
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<!-- Light (default) -->
|
|
55
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="light"></div>
|
|
56
|
+
|
|
57
|
+
<!-- Dark -->
|
|
58
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="dark"></div>
|
|
59
|
+
|
|
60
|
+
<!-- Sepia -->
|
|
61
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="sepia"></div>
|
|
62
|
+
|
|
63
|
+
<!-- Auto — follows OS dark/light preference -->
|
|
64
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="auto"></div>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Styles
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<!-- Modern (default) — clean lines, rounded corners, accent gradients -->
|
|
71
|
+
<div data-plantfyi="entity" data-slug="plants" data-style="modern"></div>
|
|
72
|
+
|
|
73
|
+
<!-- Organic — natural curves, earth-tone aesthetics, field-guide look -->
|
|
74
|
+
<div data-plantfyi="entity" data-slug="plants" data-style="organic"></div>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Web Components (Custom Elements)
|
|
78
|
+
|
|
79
|
+
As an alternative to `data-*` attributes, you can use native HTML custom elements:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Custom element form -->
|
|
83
|
+
<plantfyi-entity slug="plants" theme="light"></plantfyi-entity>
|
|
84
|
+
<plantfyi-compare slugs="plants,other-slug"></plantfyi-compare>
|
|
85
|
+
<plantfyi-search placeholder="Search Plants..."></plantfyi-search>
|
|
86
|
+
|
|
87
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use `style-variant` (not `style`) to avoid conflicts with the HTML reserved `style` attribute.
|
|
91
|
+
|
|
92
|
+
## Examples
|
|
93
|
+
|
|
94
|
+
### Entity Card
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<div data-plantfyi="entity" data-slug="plants" data-theme="light"></div>
|
|
98
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Side-by-Side Comparison
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div data-plantfyi="compare" data-slugs="plants,other-slug"></div>
|
|
105
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Search Box
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<div data-plantfyi="search" data-placeholder="Search Plants..."></div>
|
|
112
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Glossary Term
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<div data-plantfyi="glossary" data-slug="example-term" data-theme="light"></div>
|
|
119
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## CDN Options
|
|
123
|
+
|
|
124
|
+
### jsDelivr (recommended — global CDN, auto-updates with npm)
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1/dist/embed.min.js"></script>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Specific version (production stability)
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<script src="https://cdn.jsdelivr.net/npm/plantfyi-embed@1.0.0/dist/embed.min.js"></script>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### npm (for bundlers)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm install plantfyi-embed
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
import 'plantfyi-embed';
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Technical Details
|
|
147
|
+
|
|
148
|
+
- **Shadow DOM**: Complete style isolation — no CSS conflicts with your site
|
|
149
|
+
- **Zero dependencies**: No jQuery, React, or any external library
|
|
150
|
+
- **2 styles**: Modern (accent gradients) and Organic (natural curves, field-guide aesthetic)
|
|
151
|
+
- **4 themes**: Light, Dark, Sepia, Auto (OS preference detection)
|
|
152
|
+
- **CORS**: PlantFYI API has CORS enabled for all origins
|
|
153
|
+
- **MutationObserver**: Works with dynamically added elements (SPAs)
|
|
154
|
+
- **IntersectionObserver**: Lazy loading — widgets only fetch when entering viewport (200px margin)
|
|
155
|
+
- **Rich Snippets**: DefinedTerm JSON-LD injected for glossary widgets
|
|
156
|
+
- **Bundle size**: Tree-shaken per site — only includes tools available on PlantFYI
|
|
157
|
+
|
|
158
|
+
## Learn More About Plants
|
|
159
|
+
|
|
160
|
+
Visit [plantfyi.com](https://plantfyi.com) — PlantFYI is a comprehensive plants reference with interactive tools, guides, and developer resources.
|
|
161
|
+
|
|
162
|
+
- **API docs**: [plantfyi.com/developers/](https://plantfyi.com/developers/)
|
|
163
|
+
- **Widget builder**: [widget.plantfyi.com](https://widget.plantfyi.com)
|
|
164
|
+
- **npm package**: [npmjs.com/package/plantfyi-embed](https://www.npmjs.com/package/plantfyi-embed)
|
|
165
|
+
- **GitHub**: [github.com/fyipedia/plantfyi-embed](https://github.com/fyipedia/plantfyi-embed)
|
|
166
|
+
|
|
167
|
+
## Nature FYI Family
|
|
168
|
+
|
|
169
|
+
Part of [FYIPedia](https://fyipedia.com) — open-source developer tools ecosystem. Nature FYI covers species taxonomy, ornithology, marine biology, botany, and paleontology. Hub: [naturefyi.com](https://naturefyi.com).
|
|
170
|
+
|
|
171
|
+
| Site | Domain | Focus | Package |
|
|
172
|
+
|------|--------|-------|---------|
|
|
173
|
+
| SpeciesFYI | [speciesfyi.com](https://speciesfyi.com) | Species taxonomy, biodiversity, IUCN conservation status | [npm](https://www.npmjs.com/package/speciesfyi-embed) |
|
|
174
|
+
| BirdFYI | [birdfyi.com](https://birdfyi.com) | 11,251 birds, biometrics, conservation, habitats | [npm](https://www.npmjs.com/package/birdfyi-embed) |
|
|
175
|
+
| FishFYI | [fishfyi.com](https://fishfyi.com) | 35,729 fish, game fishing, aquarium care, compatibility | [npm](https://www.npmjs.com/package/fishfyi-embed) |
|
|
176
|
+
| **PlantFYI** | [plantfyi.com](https://plantfyi.com) | 379,774 plants, hardiness zones, bloom seasons, gardening | **[npm](https://www.npmjs.com/package/plantfyi-embed)** |
|
|
177
|
+
| DinoFYI | [dinofyi.com](https://dinofyi.com) | 6,142 dinosaurs, geological periods, paleontology | [npm](https://www.npmjs.com/package/dinofyi-embed) |
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT — see [LICENSE](./LICENSE).
|
|
182
|
+
|
|
183
|
+
Built with care by [FYIPedia](https://fyipedia.com).
|