beerfyi-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 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,176 @@
1
+ # beerfyi-embed
2
+
3
+ [![npm](https://img.shields.io/npm/v/beerfyi-embed)](https://www.npmjs.com/package/beerfyi-embed)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://www.npmjs.com/package/beerfyi-embed)
6
+ [![Size](https://img.shields.io/badge/size-~10--16KB_gzipped-green)](https://bundlephobia.com/package/beerfyi-embed)
7
+
8
+ Embed **BeerFYI** beverage widgets — beer styles, recipes, glossary terms, and interactive tools — on any website. **11 widget types**, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), and live data from the [BeerFYI](https://beerfyi.com) database.
9
+
10
+ Every widget includes a "Powered by BeerFYI" backlink directing readers to the full beverage reference.
11
+
12
+ > **Try the interactive widget builder at [widget.beerfyi.com](https://widget.beerfyi.com)**
13
+
14
+ ## Quick Start
15
+
16
+ ```html
17
+ <!-- Place widget div where you want it to appear -->
18
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="light"></div>
19
+
20
+ <!-- Load the embed script once, anywhere on the page -->
21
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
22
+ ```
23
+
24
+ That's it. The widget fetches data from the BeerFYI API and renders with full style isolation.
25
+
26
+ ## Widget Types
27
+
28
+ | Type | Usage | Description |
29
+ |------|-------|-------------|
30
+ | `recipe` | `<div data-beerfyi="recipe" data-slug="..."></div>` | Recipe/entity card — ingredients, technique, ABV, glass type |
31
+ | `compare` | `<div data-beerfyi="compare" data-slug="..."></div>` | Side-by-side comparison of beverages or styles |
32
+ | `glossary` | `<div data-beerfyi="glossary" data-slug="..."></div>` | Glossary term definition with cross-references |
33
+ | `faq` | `<div data-beerfyi="faq" data-slug="..."></div>` | FAQ accordion for common beverage questions |
34
+ | `guide` | `<div data-beerfyi="guide" data-slug="..."></div>` | Tasting, brewing, or pairing guide summary |
35
+ | `ingredient` | `<div data-beerfyi="ingredient" data-slug="..."></div>` | Ingredient/variety card — spirit, grape, hop, coffee origin |
36
+ | `pairing` | `<div data-beerfyi="pairing" data-slug="..."></div>` | Food pairing suggestions — "What goes with...?" |
37
+ | `search` | `<div data-beerfyi="search" data-slug="..."></div>` | Search box linking to the full beverage database |
38
+ | `flavor-radar` | `<div data-beerfyi="flavor-radar" data-slug="..."></div>` | SVG 5D beer flavor radar chart — malty, hoppy, bitter, fruity, roasty |
39
+ | `color-swatch` | `<div data-beerfyi="color-swatch" data-slug="..."></div>` | SRM color scale visualization — 0 to 40+ beer color |
40
+ | `abv-calculator` | `<div data-beerfyi="abv-calculator" data-slug="..."></div>` | Dilution-aware ABV/IBU calculator |
41
+
42
+ ## Widget Options
43
+
44
+ | Attribute | Values | Default | Description |
45
+ |-----------|--------|---------|-------------|
46
+ | `data-beerfyi` | recipe, compare, glossary, faq, guide, ingredient, pairing, search, [tools] | required | Widget type |
47
+ | `data-slug` | e.g. "styles" | — | Entity slug from the BeerFYI database |
48
+ | `data-theme` | light, dark, sepia, auto | light | Visual theme (`auto` follows OS preference) |
49
+ | `data-style` | modern, classic | modern | Widget design style |
50
+ | `data-size` | default, compact, large | default | Widget size |
51
+ | `data-placeholder` | any string | "Search Beer Styles..." | Search box placeholder |
52
+
53
+ ## Themes
54
+
55
+ ```html
56
+ <!-- Light (default) -->
57
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="light"></div>
58
+
59
+ <!-- Dark -->
60
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="dark"></div>
61
+
62
+ <!-- Sepia -->
63
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="sepia"></div>
64
+
65
+ <!-- Auto — follows OS dark/light preference -->
66
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="auto"></div>
67
+ ```
68
+
69
+ ## Web Components (Custom Elements)
70
+
71
+ As an alternative to `data-*` attributes, you can use native HTML custom elements:
72
+
73
+ ```html
74
+ <!-- Custom element form -->
75
+ <beerfyi-recipe slug="styles" theme="light"></beerfyi-recipe>
76
+ <beerfyi-compare slugs="styles,other-slug"></beerfyi-compare>
77
+ <beerfyi-search placeholder="Search Beer Styles..."></beerfyi-search>
78
+
79
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
80
+ ```
81
+
82
+ Use `style-variant` (not `style`) to avoid conflicts with the HTML reserved `style` attribute.
83
+
84
+ ## Examples
85
+
86
+ ### Recipe Card
87
+
88
+ ```html
89
+ <div data-beerfyi="recipe" data-slug="styles" data-theme="light"></div>
90
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
91
+ ```
92
+
93
+ ### Side-by-Side Comparison
94
+
95
+ ```html
96
+ <div data-beerfyi="compare" data-slugs="styles,other-slug"></div>
97
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
98
+ ```
99
+
100
+ ### Search Box
101
+
102
+ ```html
103
+ <div data-beerfyi="search" data-placeholder="Search Beer Styles..."></div>
104
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
105
+ ```
106
+
107
+ ### Glossary Term
108
+
109
+ ```html
110
+ <div data-beerfyi="glossary" data-slug="example-term" data-theme="light"></div>
111
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
112
+ ```
113
+
114
+ ## CDN Options
115
+
116
+ ### jsDelivr (recommended — global CDN, auto-updates with npm)
117
+
118
+ ```html
119
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1/dist/embed.min.js"></script>
120
+ ```
121
+
122
+ ### Specific version (production stability)
123
+
124
+ ```html
125
+ <script src="https://cdn.jsdelivr.net/npm/beerfyi-embed@1.0.0/dist/embed.min.js"></script>
126
+ ```
127
+
128
+ ### npm (for bundlers)
129
+
130
+ ```bash
131
+ npm install beerfyi-embed
132
+ ```
133
+
134
+ ```javascript
135
+ import 'beerfyi-embed';
136
+ ```
137
+
138
+ ## Technical Details
139
+
140
+ - **Shadow DOM**: Complete style isolation — no CSS conflicts with your site
141
+ - **Zero dependencies**: No jQuery, React, or any external library
142
+ - **Geist Sans**: Body text uses Geist Sans for a clean, modern look
143
+ - **System fonts**: Fallback to system-ui — no extra font requests
144
+ - **CORS**: BeerFYI API has CORS enabled for all origins
145
+ - **MutationObserver**: Works with dynamically added elements (SPAs)
146
+ - **IntersectionObserver**: Lazy loading — widgets only fetch when entering viewport (200px margin)
147
+ - **Bundle size**: ~10-16KB gzipped (per-site build — only includes tools available on BeerFYI)
148
+
149
+ ## Learn More About Beer Styles
150
+
151
+ Visit [beerfyi.com](https://beerfyi.com) — BeerFYI is a comprehensive beer styles reference with recipes, tasting notes, interactive tools, and beverage guides.
152
+
153
+ - **API docs**: [beerfyi.com/developers/](https://beerfyi.com/developers/)
154
+ - **Widget builder**: [widget.beerfyi.com](https://widget.beerfyi.com)
155
+ - **npm package**: [npmjs.com/package/beerfyi-embed](https://www.npmjs.com/package/beerfyi-embed)
156
+ - **GitHub**: [github.com/fyipedia/beerfyi-embed](https://github.com/fyipedia/beerfyi-embed)
157
+
158
+ ## Beverage FYI Family
159
+
160
+ Part of [FYIPedia](https://fyipedia.com) — open-source developer tools ecosystem. Beverage FYI covers world beverages — cocktails, wine, beer, whiskey, sake, tea, and coffee.
161
+
162
+ | Site | Domain | Focus | Package |
163
+ |------|--------|-------|---------|
164
+ | CocktailFYI | [cocktailfyi.com](https://cocktailfyi.com) | 636 cocktails, ABV, calories, flavor profiles, glass types | [npm](https://www.npmjs.com/package/cocktailfyi-embed) |
165
+ | VinoFYI | [vinofyi.com](https://vinofyi.com) | Wines, grapes, regions, wineries, food pairings | [npm](https://www.npmjs.com/package/vinofyi-embed) |
166
+ | **BeerFYI** | [beerfyi.com](https://beerfyi.com) | 113 beer styles, hops, malts, yeast, BJCP guide | **[npm](https://www.npmjs.com/package/beerfyi-embed)** |
167
+ | BrewFYI | [brewfyi.com](https://brewfyi.com) | 72 coffee varieties, roasting, 21 brew methods | [npm](https://www.npmjs.com/package/brewfyi-embed) |
168
+ | WhiskeyFYI | [whiskeyfyi.com](https://whiskeyfyi.com) | 2,200+ whiskey expressions, distilleries, regions | [npm](https://www.npmjs.com/package/whiskeyfyi-embed) |
169
+ | TeaFYI | [teafyi.com](https://teafyi.com) | 60+ tea varieties, teaware, brewing guides | [npm](https://www.npmjs.com/package/teafyi-embed) |
170
+ | NihonshuFYI | [nihonshufyi.com](https://nihonshufyi.com) | 80 sake, rice varieties, 50 breweries | [npm](https://www.npmjs.com/package/nihonshufyi-embed) |
171
+
172
+ ## License
173
+
174
+ MIT — see [LICENSE](./LICENSE).
175
+
176
+ Built with care by [FYIPedia](https://fyipedia.com).