readwhitepaper-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 dobestan
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,206 @@
1
+ # readwhitepaper-embed
2
+
3
+ [![npm](https://img.shields.io/npm/v/readwhitepaper-embed)](https://www.npmjs.com/package/readwhitepaper-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/readwhitepaper-embed)
6
+
7
+ Embed **ReadWhitepaper** widgets on any website. Display blockchain whitepaper cards, glossary terms, guides, and search on your blog, documentation, or wiki. **4 widget types**, zero dependencies, Shadow DOM style isolation, 4 built-in themes (light, dark, sepia, auto), 2 styles (modern, minimal), and live data from [readwhitepaper.com](https://readwhitepaper.com).
8
+
9
+ ReadWhitepaper is a blockchain whitepaper database featuring 30 whitepapers (Bitcoin, Ethereum, Solana, Cardano, Polkadot, and more), 163 glossary terms covering blockchain fundamentals, DeFi protocols, consensus mechanisms, and cryptographic primitives, all available in 15 languages.
10
+
11
+ Every widget includes a "Powered by ReadWhitepaper" backlink directing readers to the full reference.
12
+
13
+ > **Try the interactive widget builder at [widget.readwhitepaper.com](https://widget.readwhitepaper.com)**
14
+
15
+ ## Table of Contents
16
+
17
+ - [Quick Start](#quick-start)
18
+ - [Widget Types](#widget-types)
19
+ - [Widget Options](#widget-options)
20
+ - [Themes](#themes)
21
+ - [Styles](#styles)
22
+ - [Web Components](#web-components-custom-elements)
23
+ - [Examples](#examples)
24
+ - [CDN Options](#cdn-options)
25
+ - [What You Can Embed](#what-you-can-embed)
26
+ - [Technical Details](#technical-details)
27
+ - [Learn More About Blockchain Whitepapers](#learn-more-about-blockchain-whitepapers)
28
+ - [License](#license)
29
+
30
+ ## Quick Start
31
+
32
+ ```html
33
+ <!-- Place widget div where you want it to appear -->
34
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="light"></div>
35
+
36
+ <!-- Load the embed script once, anywhere on the page -->
37
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
38
+ ```
39
+
40
+ That's it. The widget fetches data from the ReadWhitepaper API and renders with full style isolation.
41
+
42
+ ## Widget Types
43
+
44
+ | Type | Usage | Description |
45
+ |------|-------|-------------|
46
+ | `entity` | `<div data-readwhitepaper="entity" data-slug="..."></div>` | Whitepaper card — title, authors, year, category, abstract excerpt |
47
+ | `glossary` | `<div data-readwhitepaper="glossary" data-slug="..."></div>` | Blockchain glossary term with cross-references |
48
+ | `guide` | `<div data-readwhitepaper="guide" data-slug="..."></div>` | Guide summary card with description |
49
+ | `search` | `<div data-readwhitepaper="search" data-slug="..."></div>` | Search box linking to the full whitepaper database |
50
+
51
+ ## Widget Options
52
+
53
+ | Attribute | Values | Default | Description |
54
+ |-----------|--------|---------|-------------|
55
+ | `data-readwhitepaper` | entity, glossary, guide, search | required | Widget type |
56
+ | `data-slug` | e.g. "bitcoin", "proof-of-work" | -- | Entity or term slug from ReadWhitepaper |
57
+ | `data-theme` | light, dark, sepia, auto | light | Visual theme (`auto` follows OS preference) |
58
+ | `data-styleVariant` | modern, minimal | modern | Widget design style |
59
+ | `data-size` | default, compact, large | default | Widget max-width (280/420/720px) |
60
+ | `data-placeholder` | any string | "Search Whitepapers..." | Search box placeholder text |
61
+ | `data-no-snippet` | true | -- | Disable DefinedTerm JSON-LD injection |
62
+
63
+ ## Themes
64
+
65
+ ```html
66
+ <!-- Light (default) — clean white background -->
67
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="light"></div>
68
+
69
+ <!-- Dark — dark background for dark-mode sites -->
70
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="dark"></div>
71
+
72
+ <!-- Sepia — warm paper-like tones -->
73
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="sepia"></div>
74
+
75
+ <!-- Auto — follows OS dark/light preference via matchMedia -->
76
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="auto"></div>
77
+ ```
78
+
79
+ ## Styles
80
+
81
+ ```html
82
+ <!-- Modern (default) — gradient accent header, rounded corners, spacious -->
83
+ <div data-readwhitepaper="entity" data-slug="ethereum" data-styleVariant="modern"></div>
84
+
85
+ <!-- Minimal — monospace font, thin border, flat design for dev docs -->
86
+ <div data-readwhitepaper="entity" data-slug="ethereum" data-styleVariant="minimal"></div>
87
+ ```
88
+
89
+ ## Web Components (Custom Elements)
90
+
91
+ As an alternative to `data-*` attributes, use native HTML custom elements:
92
+
93
+ ```html
94
+ <readwhitepaper-entity slug="bitcoin" theme="dark"></readwhitepaper-entity>
95
+ <readwhitepaper-glossary slug="proof-of-work"></readwhitepaper-glossary>
96
+ <readwhitepaper-search placeholder="Search whitepapers..."></readwhitepaper-search>
97
+
98
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
99
+ ```
100
+
101
+ Use `style-variant` (not `style`) to avoid conflicts with the HTML reserved `style` attribute.
102
+
103
+ ## Examples
104
+
105
+ ### Whitepaper Card
106
+
107
+ ```html
108
+ <!-- Bitcoin whitepaper card with dark theme -->
109
+ <div data-readwhitepaper="entity" data-slug="bitcoin" data-theme="dark"></div>
110
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
111
+ ```
112
+
113
+ ### Blockchain Glossary Term
114
+
115
+ ```html
116
+ <!-- Proof of Work definition with DefinedTerm JSON-LD injection -->
117
+ <div data-readwhitepaper="glossary" data-slug="proof-of-work" data-theme="light"></div>
118
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
119
+ ```
120
+
121
+ ### Search Box
122
+
123
+ ```html
124
+ <div data-readwhitepaper="search" data-placeholder="Search blockchain whitepapers..."></div>
125
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
126
+ ```
127
+
128
+ ## CDN Options
129
+
130
+ ### jsDelivr (recommended)
131
+
132
+ ```html
133
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1/dist/embed.min.js"></script>
134
+ ```
135
+
136
+ ### Specific version (production stability)
137
+
138
+ ```html
139
+ <script src="https://cdn.jsdelivr.net/npm/readwhitepaper-embed@1.0.0/dist/embed.min.js"></script>
140
+ ```
141
+
142
+ ### npm (for bundlers)
143
+
144
+ ```bash
145
+ npm install readwhitepaper-embed
146
+ ```
147
+
148
+ ```javascript
149
+ import 'readwhitepaper-embed';
150
+ ```
151
+
152
+ ## What You Can Embed
153
+
154
+ ### Blockchain Whitepapers
155
+
156
+ ReadWhitepaper hosts the foundational documents that define the blockchain ecosystem. Each whitepaper card displays the document title, authors, publication year, category, and an abstract excerpt:
157
+
158
+ - **Bitcoin** (2008) -- Satoshi Nakamoto's original peer-to-peer electronic cash system paper
159
+ - **Ethereum** (2013) -- Vitalik Buterin's proposal for a programmable blockchain with smart contracts
160
+ - **Solana** (2017) -- Proof of History consensus for high-throughput transactions
161
+ - **Cardano** (2017) -- Peer-reviewed, evidence-based blockchain platform
162
+ - **Polkadot** (2016) -- Heterogeneous multi-chain framework for cross-chain interoperability
163
+ - **Chainlink** (2017) -- Decentralized oracle network bridging on-chain and off-chain data
164
+
165
+ ### Blockchain Glossary
166
+
167
+ 163 terms covering the full spectrum of blockchain technology:
168
+
169
+ - **Consensus mechanisms**: Proof of Work, Proof of Stake, Delegated PoS, BFT
170
+ - **DeFi protocols**: AMM, liquidity pools, yield farming, flash loans, impermanent loss
171
+ - **Cryptographic primitives**: hash functions, Merkle trees, digital signatures, zero-knowledge proofs
172
+ - **Network architecture**: nodes, validators, sharding, layer 2, sidechains, rollups
173
+ - **Token standards**: ERC-20, ERC-721, ERC-1155, BEP-20
174
+
175
+ ### Guides
176
+
177
+ In-depth guides explaining blockchain concepts, protocol comparisons, and technical deep dives.
178
+
179
+ ## Technical Details
180
+
181
+ - **Shadow DOM**: Complete style isolation -- no CSS conflicts with your site
182
+ - **Zero dependencies**: No jQuery, React, or any external library
183
+ - **2 styles**: Modern (accent gradients) and Minimal (monospace, flat design)
184
+ - **4 themes**: Light, Dark, Sepia, Auto (OS preference detection with matchMedia listener)
185
+ - **CORS**: ReadWhitepaper API has CORS enabled for all origins
186
+ - **MutationObserver**: Works with dynamically added elements (SPAs, React, Vue)
187
+ - **IntersectionObserver**: Lazy loading -- widgets only fetch when entering viewport (200px margin)
188
+ - **Rich Snippets**: DefinedTerm JSON-LD injected for glossary widgets (opt-out via data-no-snippet)
189
+ - **sessionStorage cache**: 5-minute TTL reduces API calls on page navigation
190
+
191
+ ## Learn More About Blockchain Whitepapers
192
+
193
+ Visit [readwhitepaper.com](https://readwhitepaper.com) -- ReadWhitepaper is a comprehensive blockchain whitepaper database with full-text access, glossary, and multi-language translations.
194
+
195
+ - **All whitepapers**: [readwhitepaper.com](https://readwhitepaper.com)
196
+ - **Glossary**: [readwhitepaper.com/glossary/](https://readwhitepaper.com/glossary/)
197
+ - **API docs**: [readwhitepaper.com/developers/](https://readwhitepaper.com/developers/)
198
+ - **Widget builder**: [widget.readwhitepaper.com](https://widget.readwhitepaper.com)
199
+ - **npm package**: [npmjs.com/package/readwhitepaper-embed](https://www.npmjs.com/package/readwhitepaper-embed)
200
+ - **GitHub**: [github.com/dobestan/readwhitepaper-embed](https://github.com/dobestan/readwhitepaper-embed)
201
+
202
+ ## License
203
+
204
+ MIT -- see [LICENSE](./LICENSE).
205
+
206
+ Built by [dobestan](https://github.com/dobestan).