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