-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to Vite, add PWA/offline support, and fix table-of-contents bug (v2.1.0) #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1d81b5b
Vite and modularization
NellowTCS 6275ed6
test
NellowTCS 331fbca
Huh, how did that happen
NellowTCS 07bde5e
Fix table of contents bug
NellowTCS 9d0c3e0
what is that doing in here?!
NellowTCS 0e98c08
📝 Add docstrings to `v2.1.0`
coderabbitai[bot] 602a20f
Merge pull request #3 from HTMLToolkit/coderabbitai/docstrings/9d0c3e0
NellowTCS 7244da1
HTMLRunner was accidentally copied into this,removing
NellowTCS ef2b591
HTMLRunner was accidentally copied into this,removing
NellowTCS ad0bcac
Delete Build/LICENSE
NellowTCS e02a2f6
HTMLRunner was accidentally copied into this,removing
NellowTCS 593d621
HTMLRunner was accidentally copied into this,removing
NellowTCS 8a894d1
HTMLRunner was accidentally copied into this,removing
NellowTCS d432edd
HTMLRunner was accidentally copied into this,removing
NellowTCS e92c64b
HTMLRunner was accidentally copied into this, removing
NellowTCS 3189ce4
CodeRabbit Generated Unit Tests: Add Jest/Vitest tests for IndexedDB …
coderabbitai[bot] 8d9fd92
Merge pull request #4 from HTMLToolkit/coderabbitai/utg/e92c64b
NellowTCS 0ba80e9
CodeRabbit Generated Unit Tests: Add Jest/JSDOM unit tests for book, …
coderabbitai[bot] 31f1e1f
Merge pull request #7 from HTMLToolkit/coderabbitai/utg/8d9fd92
NellowTCS 934c652
Update LICENSE
NellowTCS 7a5cd9a
Fix some errors
NellowTCS f1118f6
Fixes
NellowTCS 1c17e8d
Ugh unit test are painful
NellowTCS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Node modules | ||
| node_modules/ | ||
|
|
||
| # Logs | ||
| logs/ | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Build output | ||
| dist/ | ||
| build/ | ||
| out/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.* | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
| .idea/ | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Coverage | ||
| coverage/ | ||
|
|
||
| # Optional npm cache directory | ||
| .npm/ | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import js from "@eslint/js"; | ||
| import globals from "globals"; | ||
| import json from "@eslint/json"; | ||
| import markdown from "@eslint/markdown"; | ||
| import css from "@eslint/css"; | ||
| import { defineConfig } from "eslint/config"; | ||
|
|
||
| export default defineConfig([ | ||
| js.configs.recommended, | ||
| { files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } }, | ||
| json.configs.recommended, | ||
| markdown.configs.recommended, | ||
| css.configs.recommended, | ||
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import fs from 'fs-extra'; | ||
| import path from 'path'; | ||
| import { rimrafSync } from 'rimraf'; | ||
| import { fileURLToPath } from 'url'; | ||
| import process from 'process'; | ||
|
|
||
| // ES module __dirname fix | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| const root = path.resolve(__dirname, '..'); // repo root | ||
| const dist = path.join(__dirname, 'dist'); // build folder | ||
|
|
||
| // Files/folders to keep | ||
| const keep = new Set(['README.md', 'LICENSE', 'Build']); | ||
|
|
||
| // Clean repo root (skip hidden files/folders) | ||
| fs.readdirSync(root).forEach(file => { | ||
| if (!fs.existsSync(dist) || fs.readdirSync(dist).length === 0) { | ||
| console.error('ERROR: dist is missing or empty:', dist); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| if (!keep.has(file) && !file.startsWith('.')) { // <-- skip hidden | ||
| rimrafSync(path.join(root, file)); | ||
| console.log('Deleted:', file); | ||
| } | ||
| }); | ||
|
|
||
| // Copy each item inside dist individually | ||
| fs.readdirSync(dist).forEach(item => { | ||
| const srcPath = path.join(dist, item); | ||
| const destPath = path.join(root, item); | ||
|
|
||
| // Skip copying if destination exists and is in keep set | ||
| if (keep.has(item)) { | ||
| console.log(`Skipping copy of ${item} (keep folder/file)`); | ||
| return; | ||
| } | ||
|
|
||
| fs.copySync(srcPath, destPath, { overwrite: true }); | ||
| console.log('Copied:', item); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta http-equiv="Content-Security-Policy" content=" | ||
| default-src 'self' blob: data:; | ||
| script-src 'self'; | ||
| style-src 'self' 'unsafe-inline'; | ||
| img-src 'self' blob: data:; | ||
| connect-src 'self'; | ||
| frame-src 'self' blob: data:; | ||
| worker-src 'self'; | ||
| manifest-src 'self'; | ||
| upgrade-insecure-requests; block-all-mixed-content;"> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>HTMLReader</title> | ||
| <link rel="stylesheet" href="./src/style.css" /> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <div class="title"> | ||
| <span>HTMLReader</span> | ||
| <span class="book-title" id="book-title"></span> | ||
| </div> | ||
| <div class="controls"> | ||
| <button id="toc-button" disabled>Table of Contents</button> | ||
| <button id="open-button">Open EPUB</button> | ||
| <button id="library-button">Library</button> | ||
| <input type="file" id="file-input" class="file-input" accept=".epub"> | ||
| <!-- Fallback multiple file input for library import --> | ||
| <input type="file" id="library-input" class="file-input" accept=".epub" multiple> | ||
| <button id="install-button" hidden>Install App</button> <!-- New Install Button --> | ||
| </div> | ||
| </header> | ||
| <main> | ||
| <div id="viewer"></div> | ||
| </main> | ||
| <footer> | ||
| <button id="prev-button" disabled>⬅ Previous</button> | ||
| <div class="page-info"> | ||
| <span>Page</span> | ||
| <input type="number" id="current-page" min="1" value="1"> | ||
| <span>of</span> | ||
| <span id="total-pages">1</span> | ||
| </div> | ||
| <button id="next-button" disabled>Next ➡</button> | ||
| </footer> | ||
| <!-- TOC Container --> | ||
| <div class="toc-container" id="toc-container"> | ||
| <div class="toc-header"> | ||
| <h3>Table of Contents</h3> | ||
| <button id="close-toc">Close</button> | ||
| </div> | ||
| <div class="toc-content" id="toc-content"></div> | ||
| </div> | ||
| <!-- Library Popup (hidden by default) --> | ||
| <div class="library-container" id="library-container"> | ||
| <div class="library-header"> | ||
| <h3>Library</h3> | ||
| <button id="close-library">Close</button> | ||
| </div> | ||
| <div class="library-content" id="library-content"></div> | ||
| </div> | ||
| <div class="overlay" id="overlay"></div> | ||
| <div class="message" id="loading-message"> | ||
| <h3>Loading EPUB...</h3> | ||
| <p>Please wait while your book is being processed.</p> | ||
| </div> | ||
| <div class="message" id="error-message"> | ||
| <h3>Error</h3> | ||
| <p id="error-text">There was an error processing your EPUB file.</p> | ||
| <button id="close-error">Close</button> | ||
| </div> | ||
| </body> | ||
| <script type="module" src="./src/main.js"></script> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.