airportfyi-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,191 @@
1
+ # airportfyi-embed
2
+
3
+ [![npm](https://img.shields.io/npm/v/airportfyi-embed)](https://www.npmjs.com/package/airportfyi-embed)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://www.npmjs.com/package/airportfyi-embed)
7
+
8
+ Embed **AirportFYI** widgets — airports, glossary terms, interactive tools, and inline elements — on any website. **6 widget types**, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), 2 styles (modern, clean), and live data from the [AirportFYI](https://airportfyi.com) database.
9
+
10
+ Every widget includes a "Powered by AirportFYI" backlink directing readers to the full reference.
11
+
12
+ > **Try the interactive widget builder at [widget.airportfyi.com](https://widget.airportfyi.com)**
13
+
14
+ ## Quick Start
15
+
16
+ ```html
17
+ <!-- Place widget div where you want it to appear -->
18
+ <div data-airportfyi="entity" data-slug="airports" data-theme="light"></div>
19
+
20
+ <!-- Load the embed script once, anywhere on the page -->
21
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
22
+ ```
23
+
24
+ That's it. The widget fetches data from the AirportFYI API and renders with full style isolation.
25
+
26
+ ## Widget Types
27
+
28
+ | Type | Usage | Description |
29
+ |------|-------|-------------|
30
+ | `entity` | `<div data-airportfyi="entity" data-slug="..."></div>` | Entity detail card — airport, airline, aircraft, or station |
31
+ | `glossary` | `<div data-airportfyi="glossary" data-slug="..."></div>` | Glossary term definition with cross-references |
32
+ | `faq` | `<div data-airportfyi="faq" data-slug="..."></div>` | FAQ accordion with expand/collapse |
33
+ | `search` | `<div data-airportfyi="search" data-slug="..."></div>` | Search box linking to the full database |
34
+ | `compare` | `<div data-airportfyi="compare" data-slug="..."></div>` | Side-by-side entity comparison |
35
+ | `type-badge` | `<div data-airportfyi="type-badge" data-slug="..."></div>` | Inline airport type badge (e.g. "International", "Regional") |
36
+
37
+ ## Widget Options
38
+
39
+ | Attribute | Values | Default | Description |
40
+ |-----------|--------|---------|-------------|
41
+ | `data-airportfyi` | entity, glossary, faq, search, compare, [tools] | required | Widget type |
42
+ | `data-slug` | e.g. "airports" | — | Entity slug from the AirportFYI database |
43
+ | `data-theme` | light, dark, sepia, auto | light | Visual theme (`auto` follows OS preference) |
44
+ | `data-style` | modern, clean | modern | Widget design style |
45
+ | `data-size` | default, compact, large | default | Widget size |
46
+ | `data-placeholder` | any string | "Search Airports..." | Search box placeholder |
47
+
48
+ ## Themes
49
+
50
+ ```html
51
+ <!-- Light (default) -->
52
+ <div data-airportfyi="entity" data-slug="airports" data-theme="light"></div>
53
+
54
+ <!-- Dark -->
55
+ <div data-airportfyi="entity" data-slug="airports" data-theme="dark"></div>
56
+
57
+ <!-- Sepia -->
58
+ <div data-airportfyi="entity" data-slug="airports" data-theme="sepia"></div>
59
+
60
+ <!-- Auto — follows OS dark/light preference -->
61
+ <div data-airportfyi="entity" data-slug="airports" data-theme="auto"></div>
62
+ ```
63
+
64
+ ## Styles
65
+
66
+ ```html
67
+ <!-- Modern (default) — clean lines, rounded corners, accent gradients -->
68
+ <div data-airportfyi="entity" data-slug="airports" data-style="modern"></div>
69
+
70
+ <!-- Clean — minimal borders, utility-focused, data-first aesthetic -->
71
+ <div data-airportfyi="entity" data-slug="airports" data-style="clean"></div>
72
+ ```
73
+
74
+ ## Web Components (Custom Elements)
75
+
76
+ As an alternative to `data-*` attributes, you can use native HTML custom elements:
77
+
78
+ ```html
79
+ <!-- Custom element form -->
80
+ <airportfyi-entity slug="airports" theme="light"></airportfyi-entity>
81
+ <airportfyi-compare slugs="airports,other-slug"></airportfyi-compare>
82
+ <airportfyi-search placeholder="Search Airports..."></airportfyi-search>
83
+
84
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
85
+ ```
86
+
87
+ Use `style-variant` (not `style`) to avoid conflicts with the HTML reserved `style` attribute.
88
+
89
+ ## Examples
90
+
91
+ ### Entity Card
92
+
93
+ ```html
94
+ <div data-airportfyi="entity" data-slug="airports" data-theme="light"></div>
95
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
96
+ ```
97
+
98
+ ### Side-by-Side Comparison
99
+
100
+ ```html
101
+ <div data-airportfyi="compare" data-slugs="airports,other-slug"></div>
102
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
103
+ ```
104
+
105
+ ### Search Box
106
+
107
+ ```html
108
+ <div data-airportfyi="search" data-placeholder="Search Airports..."></div>
109
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
110
+ ```
111
+
112
+ ### Glossary Term
113
+
114
+ ```html
115
+ <div data-airportfyi="glossary" data-slug="example-term" data-theme="light"></div>
116
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
117
+ ```
118
+
119
+ ## CDN Options
120
+
121
+ ### jsDelivr (recommended — global CDN, auto-updates with npm)
122
+
123
+ ```html
124
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1/dist/embed.min.js"></script>
125
+ ```
126
+
127
+ ### Specific version (production stability)
128
+
129
+ ```html
130
+ <script src="https://cdn.jsdelivr.net/npm/airportfyi-embed@1.0.0/dist/embed.min.js"></script>
131
+ ```
132
+
133
+ ### npm (for bundlers)
134
+
135
+ ```bash
136
+ npm install airportfyi-embed
137
+ ```
138
+
139
+ ```javascript
140
+ import 'airportfyi-embed';
141
+ ```
142
+
143
+ ## Technical Details
144
+
145
+ - **Shadow DOM**: Complete style isolation — no CSS conflicts with your site
146
+ - **Zero dependencies**: No jQuery, React, or any external library
147
+ - **2 styles**: Modern (accent gradients) and Clean (minimal, data-first)
148
+ - **4 themes**: Light, Dark, Sepia, Auto (OS preference detection)
149
+ - **CORS**: AirportFYI API has CORS enabled for all origins
150
+ - **MutationObserver**: Works with dynamically added elements (SPAs)
151
+ - **IntersectionObserver**: Lazy loading — widgets only fetch when entering viewport (200px margin)
152
+ - **Rich Snippets**: DefinedTerm JSON-LD injected for glossary widgets
153
+ - **Bundle size**: Tree-shaken per site — only includes tools available on AirportFYI
154
+
155
+ ## Learn More About Airports
156
+
157
+ Visit [airportfyi.com](https://airportfyi.com) — AirportFYI is a comprehensive airports reference with interactive tools, guides, and developer resources.
158
+
159
+ - **API docs**: [airportfyi.com/developers/](https://airportfyi.com/developers/)
160
+ - **Widget builder**: [widget.airportfyi.com](https://widget.airportfyi.com)
161
+ - **npm package**: [npmjs.com/package/airportfyi-embed](https://www.npmjs.com/package/airportfyi-embed)
162
+ - **GitHub**: [github.com/fyipedia/airportfyi-embed](https://github.com/fyipedia/airportfyi-embed)
163
+
164
+ ## Transport FYI Family
165
+
166
+ Part of [FYIPedia](https://fyipedia.com) — open-source developer tools ecosystem. Transport FYI covers airports, airlines, aircraft, and railway networks. Hub: [transitfyi.com](https://transitfyi.com).
167
+
168
+ | Site | Domain | Focus | Package |
169
+ |------|--------|-------|---------|
170
+ | **AirportFYI** | [airportfyi.com](https://airportfyi.com) | 71,631 airports, IATA/ICAO codes, runways, routes | **[npm](https://www.npmjs.com/package/airportfyi-embed)** |
171
+ | AirlineFYI | [airlinefyi.com](https://airlinefyi.com) | 6,161 airlines, fleets, alliances, routes | [npm](https://www.npmjs.com/package/airlinefyi-embed) |
172
+ | PlaneFYI | [planefyi.com](https://planefyi.com) | 81 aircraft types, specs, manufacturers, fleet data | [npm](https://www.npmjs.com/package/planefyi-embed) |
173
+ | TrainFYI | [trainfyi.com](https://trainfyi.com) | 51,425 stations, operators, route pairs | [npm](https://www.npmjs.com/package/trainfyi-embed) |
174
+
175
+ ## FYIPedia Developer Tools
176
+
177
+ | Package | PyPI | npm | Description |
178
+ |---------|------|-----|-------------|
179
+ | colorfyi | [PyPI](https://pypi.org/project/colorfyi/) | [npm](https://www.npmjs.com/package/@fyipedia/colorfyi) | Color conversion, WCAG contrast, harmonies — [colorfyi.com](https://colorfyi.com) |
180
+ | emojifyi | [PyPI](https://pypi.org/project/emojifyi/) | [npm](https://www.npmjs.com/package/emojifyi) | Emoji encoding & metadata for 3,953 emojis — [emojifyi.com](https://emojifyi.com) |
181
+ | unitfyi | [PyPI](https://pypi.org/project/unitfyi/) | [npm](https://www.npmjs.com/package/unitfyi) | Unit conversion, 220 units — [unitfyi.com](https://unitfyi.com) |
182
+ | timefyi | [PyPI](https://pypi.org/project/timefyi/) | [npm](https://www.npmjs.com/package/timefyi) | Timezone ops & business hours — [timefyi.com](https://timefyi.com) |
183
+ | holidayfyi | [PyPI](https://pypi.org/project/holidayfyi/) | [npm](https://www.npmjs.com/package/holidayfyi) | Holiday dates & Easter calculation — [holidayfyi.com](https://holidayfyi.com) |
184
+ | namefyi | [PyPI](https://pypi.org/project/namefyi/) | [npm](https://www.npmjs.com/package/namefyi) | Korean romanization & Five Elements — [namefyi.com](https://namefyi.com) |
185
+ | fyipedia | [PyPI](https://pypi.org/project/fyipedia/) | — | Unified CLI for all FYI tools — [fyipedia.com](https://fyipedia.com) |
186
+
187
+ ## License
188
+
189
+ MIT — see [LICENSE](./LICENSE).
190
+
191
+ Built with care by [FYIPedia](https://fyipedia.com).