From 67f83875c1046550195433c361112c74cba5a792 Mon Sep 17 00:00:00 2001 From: artin Date: Tue, 18 Feb 2025 00:30:30 -0800 Subject: [PATCH] android loading --- package.json | 7 +- src-tauri/Cargo.toml | 3 + src-tauri/capabilities/default.json | 18 +- .../android/app/src/main/AndroidManifest.xml | 9 + .../com/nuvari/bookmobile/kotlin/BuildTask.kt | 4 +- src-tauri/src/lib.rs | 103 ++-- src-tauri/tauri.conf.json | 19 +- src/assets/javascript.svg | 1 - src/assets/tauri.svg | 6 - src/index.html | 64 ++- src/main.js | 88 ++- src/styles.css | 507 +++++++++++++++++- yarn.lock | 28 + 13 files changed, 759 insertions(+), 98 deletions(-) delete mode 100644 src/assets/javascript.svg delete mode 100644 src/assets/tauri.svg diff --git a/package.json b/package.json index 2d359bb..4c59f6a 100644 --- a/package.json +++ b/package.json @@ -9,5 +9,10 @@ "devDependencies": { "@tauri-apps/cli": "^2" }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", + "dependencies": { + "@tauri-apps/api": "^2.2.0", + "@tauri-apps/plugin-log": "~2", + "@tauri-apps/plugin-os": "~2" + } } diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 27fe82c..b148be0 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -23,4 +23,7 @@ tauri-plugin-opener = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" rusqlite = { version = "0.33.0", features = ["bundled", "blob"] } +tauri-plugin-os = "2" +tauri-plugin-log = "2" +tauri-plugin-fs = "2.2.0" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 4cdbf49..ef4025a 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -2,9 +2,21 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "Capability for the main window", - "windows": ["main"], + "windows": [ + "main" + ], "permissions": [ "core:default", - "opener:default" + "os:default", + "core:resources:default", + "core:app:default", + "fs:default", + "fs:allow-app-write-recursive", + "fs:allow-appdata-write-recursive", + "fs:allow-applocaldata-write-recursive", + "fs:allow-read-text-file", + "fs:allow-resource-read-recursive", + "fs:allow-appconfig-read-recursive", + "fs:allow-appconfig-write-recursive" ] -} +} \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 02efa1f..e1514d5 100644 --- a/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,15 @@ + + + + + + + + + diff --git a/src-tauri/gen/android/buildSrc/src/main/java/com/nuvari/bookmobile/kotlin/BuildTask.kt b/src-tauri/gen/android/buildSrc/src/main/java/com/nuvari/bookmobile/kotlin/BuildTask.kt index 667d690..ddd5bb9 100644 --- a/src-tauri/gen/android/buildSrc/src/main/java/com/nuvari/bookmobile/kotlin/BuildTask.kt +++ b/src-tauri/gen/android/buildSrc/src/main/java/com/nuvari/bookmobile/kotlin/BuildTask.kt @@ -16,7 +16,7 @@ open class BuildTask : DefaultTask() { @TaskAction fun assemble() { - val executable = """yarn"""; + val executable = """npm"""; try { runTauriCli(executable) } catch (e: Exception) { @@ -32,7 +32,7 @@ open class BuildTask : DefaultTask() { val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null") val target = target ?: throw GradleException("target cannot be null") val release = release ?: throw GradleException("release cannot be null") - val args = listOf("tauri", "android", "android-studio-script"); + val args = listOf("run", "--", "tauri", "android", "android-studio-script"); project.exec { workingDir(File(project.projectDir, rootDirRel)) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a303a6e..de44204 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,16 +1,14 @@ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ -use rusqlite::{params,Connection, Result}; -use serde::{Serialize, Deserialize}; -use std::fs::File; -use std::io::prelude::*; -use std::fmt; +use rusqlite::{params, Connection, Result}; +use serde::Serialize; +use std::{fs::File, fs::create_dir,io::Write}; -#[derive(Debug,Clone, Serialize)] +#[derive(Debug, Clone, Serialize)] struct Book { - id: i32, - title: String, - authors: String, + id: i32, + title: String, + authors: String, } #[tauri::command] @@ -18,41 +16,56 @@ fn search(q: &str) -> Vec { searchdb(q).unwrap() } #[tauri::command] -fn copybook(bookid: i32) { - println!("copygins {}",bookid); - copybook_background(bookid); +fn initdb() { + println!("initdb"); + let contents = [0; 24]; + + let mut file = match create_dir("$APPDATA") { + Ok(_) => { println!("yayd") }, + Err(e) => println!("nayd {}",e), + }; + + let mut file = match File::create("$APPDATA/test.db") { + Ok(f) => { println!("yay") }, + Err(e) => println!("nay {}",e), + }; + + //let _ = file.write_all(&contents); } -fn copybook_background(bookid: i32) -> Result<()>{ - let conn = Connection::open("/home/artin/Documents/ebooksol/index.db")?; +#[tauri::command] +fn copybook(bookid: i32) { + println!("copygins {}", bookid); + let _ = copybook_background(bookid); +} +fn copybook_background(bookid: i32) -> Result<()> { + let conn = Connection::open("/storage/emulated/0/Download/ebooks.db")?; + //let conn = Connection::open("/home/artin/Documents/ebooksol/index.db")?; let mut stmt = conn.prepare("SELECT books.title, data.format , book_content.content FROM books, book_content ,data where books.id = book_content.id and books.id = data.book and books.id = ?1 ")?; let mut rows = stmt.query([bookid])?; - while let Some(row) = rows.next()?{ - let fname: String = row.get(0)?; - let ext : String = row.get(1)?; -// let filename = format!("{}.{}", row.get(0)?, row.get(1)?); - let filename = format!("{}.{}", fname, ext); + while let Some(row) = rows.next()? { + let fname: String = row.get(0)?; + let ext: String = row.get(1)?; + // let filename = format!("{}.{}", row.get(0)?, row.get(1)?); + let filename = format!("{}.{}", fname, ext); - let mut content = Vec::new(); - println!("loading"); - content = row.get(2)?; - println!("opening"); - let mut file = File::create(filename).unwrap(); - file.write_all(&content[..]).unwrap(); - println!("done"); + let mut content = Vec::new(); + println!("loading"); + content = row.get(2)?; + println!("opening"); + let mut file = File::create(filename).unwrap(); + file.write_all(&content[..]).unwrap(); + println!("done"); } Ok(()) } -fn searchdb(q: &str) -> Result>{ - let conn = Connection::open("/home/artin/Documents/ebooksol/index.db")?; +fn searchdb(q: &str) -> Result> { + let conn = Connection::open("/storage/emulated/0/Download/ebooks.db")?; + //let conn = Connection::open("/home/artin/Documents/ebooksol/index.db")?; let mut stmt = conn.prepare("SELECT books.id, books.title, books.author_sort as authors FROM books, book_content where books.id = book_content.id and (title like ?1 or author_sort like ?2) ")?; - - let mut books_found= Vec::new(); - let books_iter = stmt.query_map(params![format!("%{}%", q), format!("%{}%", q)], |row| { - - - + let mut books_found = Vec::new(); + let books_iter = stmt.query_map(params![format!("%{}%", q), format!("%{}%", q)], |row| { Ok(Book { id: row.get(0)?, title: row.get(1)?, @@ -60,28 +73,34 @@ fn searchdb(q: &str) -> Result>{ }) })?; - //#let mut books_found= Vec::new(); + //#let mut books_found= Vec::new(); for book in books_iter { //println!("Found person {:?}", book.unwrap()); books_found.push(book.unwrap()); - } + } return Ok(books_found); } #[tauri::command] -fn greet(name: &str) -> String { - format!("Hello, {}! You've been greeted from Rust!", name) +fn getplatform() -> String { + let platform = tauri_plugin_os::platform(); + println!("Platform: {}", platform); + return platform.to_string(); } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() + .plugin(tauri_plugin_log::Builder::new().build()) + .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_opener::init()) - .invoke_handler(tauri::generate_handler![search,copybook]) + .invoke_handler(tauri::generate_handler![ + search, + copybook, + getplatform, + initdb + ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } - - - diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 2f29fa1..7483b87 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,11 +7,12 @@ "frontendDist": "../src" }, "app": { + "withGlobalTauri": true, "windows": [ { "title": "bookmobile", - "width": 800, + "width": 400, "height": 600 } ], @@ -29,5 +30,19 @@ "icons/icon.icns", "icons/icon.ico" ] + }, + "plugins": { + "fs": { + "readFile": true, + "writeFile": true, + "readDir": true, + "copyFile": true, + "createDir": true, + "removeDir": true, + "removeFile": true, + "renameFile": true, + "exists": true, + "scope": ["$APPDATA/*", "$APPCONFIG/*", "$RESOURCE/*"] + } } -} +} \ No newline at end of file diff --git a/src/assets/javascript.svg b/src/assets/javascript.svg deleted file mode 100644 index f9abb2b..0000000 --- a/src/assets/javascript.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/tauri.svg b/src/assets/tauri.svg deleted file mode 100644 index 31b62c9..0000000 --- a/src/assets/tauri.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/index.html b/src/index.html index 66ada58..8004a81 100644 --- a/src/index.html +++ b/src/index.html @@ -1,27 +1,47 @@ - - - - - BookMobile - - - -
+ + + + + BookMobile + + + + +
+

BookMobile

+
+ Details + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+

+
+
+ -
- - -
-
- - -
-

-
-
- - + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 74e9a3d..055eb78 100644 --- a/src/main.js +++ b/src/main.js @@ -1,34 +1,45 @@ const { invoke } = window.__TAURI__.core; +// when using `"withGlobalTauri": true`, you may use +// const { platform } = window.__TAURI__.os; +console.log("testing TESTING"); let greetInputEl; let greetMsgEl; let slocate; let bookid; let tb; -async function search() { - slocate = await k(); - console.log(slocate); - - tb = document.querySelector("#thebooks"); - slocate.forEach(function(book) { - let span = document.createElement("span"); -span.innerHTML += `${book['title']} ${book['authors']} ${book['id']}
`; - tb.appendChild(span); - }); - -} +let logs; +let logtext; async function k() { - return await invoke("search", {q: greetInputEl.value }); + return await invoke("search", { q: greetInputEl.value }); } async function greet() { // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value }); } +async function init_db() { + let initdb = await invoke("initdb"); +} +async function platform() { + // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ + let plat = await invoke("getplatform" ); + mylog(plat); +console.log(plat); +} +async function cb2() { + console.log(this.id); + console.log(this); + await copybook(parseInt(bookid.value)); +} +async function mylog(msg){ + logtext.value += msg + "\n"; +} async function cb() { await copybook(parseInt(bookid.value)); } async function copybook(bookid) { + console.log(`in copybook bookid: ${bookid}`); await invoke("copybook", { bookid: bookid }); } @@ -36,6 +47,8 @@ window.addEventListener("DOMContentLoaded", () => { greetInputEl = document.querySelector("#greet-input"); greetMsgEl = document.querySelector("#greet-msg"); bookid = document.querySelector("#bookid"); + logs = document.querySelector("#details"); + logtext = document.querySelector("#logtext"); document.querySelector("#greet-form").addEventListener("submit", (e) => { e.preventDefault(); search(); @@ -45,4 +58,53 @@ window.addEventListener("DOMContentLoaded", () => { e.preventDefault(); cb(); }); + document.querySelector("#init-form").addEventListener("submit", (e) => { + console.log("here"); + e.preventDefault(); + init_db(); + }); + document.querySelector("#platform-form").addEventListener("submit", (e) => { + console.log("here"); + e.preventDefault(); + platform(); + }); }); + +async function search() { + slocate = await k(); + console.log(slocate); + + tb = document.querySelector("#thebooks"); + let table = document.createElement("table"); + let th1 = document.createElement("th"); + let th2 = document.createElement("th"); + let th3 = document.createElement("th"); + th1.innerHTML = 'Title'; + th2.innerHTML = 'Author(s)'; + th3.innerHTML = 'Book Id'; + table.appendChild(th1); + table.appendChild(th2); + table.appendChild(th3); + slocate.forEach(function (book) { + let tr = document.createElement("tr"); + let td1 = document.createElement("td"); + let td2 = document.createElement("td"); + let td3 = document.createElement("td"); + td1.innerHTML = `${book['title']}`; + td2.innerHTML = `${book['authors']}`; + let button = document.createElement("input"); + button.type = "button"; + button.onclick=function(){ copybook(book['id'])}; + //td3.innerHTML = "
"; + td3.appendChild(button); + //td3.innerHTML = ``; + //let span = document.createElement("span"uu + //span.innerHTML += `${book['title']} ${book['authors']} ${book['id']}
`; + tr.appendChild(td1); + tr.appendChild(td2); + tr.appendChild(td3); + table.appendChild(tr); + }); + tb.appendChild(table); + +} diff --git a/src/styles.css b/src/styles.css index 416f9b9..855a5ca 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1,6 +1,7 @@ -.logo.vanilla:hover { +/* .logo.vanilla:hover { filter: drop-shadow(0 0 2em #ffe21c); } + :root { font-family: Inter, Avenir, Helvetica, Arial, sans-serif; font-size: 16px; @@ -19,7 +20,7 @@ .container { margin: 0; - padding-top: 10vh; + padding-top: 0vh; display: flex; flex-direction: column; justify-content: left; @@ -27,16 +28,20 @@ } .logo { - height: 6em; + height: iem; + width: auto; padding: 1.5em; will-change: filter; transition: 0.75s; + text-align: center; } -.logo.tauri:hover { - filter: drop-shadow(0 0 2em #24c8db); -} + +.rowlogo { + display: flex; + justify-content: center; +} .row { display: flex; justify-content: left; @@ -77,6 +82,7 @@ button { button:hover { border-color: #396cd8; } + button:active { border-color: #396cd8; background-color: #e8e8e8; @@ -106,7 +112,496 @@ button { color: #ffffff; background-color: #0f0f0f98; } + button:active { background-color: #0f0f0f69; } } + +details { + border: 1px solid #aaa; + border-radius: 4px; + padding: 0.5em 0.5em 0; +} + +summary { + font-weight: bold; + margin: -0.5em -0.5em 0; + padding: 0.5em; +} + +details[open] { + padding: 0.5em; +} + +details[open] summary { + border-bottom: 1px solid #aaa; + margin-bottom: 0.5em; +} + + +.header img { + float: left; + width: 125px; + height: 77px; +} + +.header h1 { + position: relative; + top: 18px; + left: 10px; +} + + */ + +@charset "UTF-8"; + +/* Import ET Book styles + adapted from https://github.com/edwardtufte/et-book/blob/gh-pages/et-book.css */ + +@font-face { + font-family: "et-book"; + src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot"); + src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf") format("svg"); + font-weight: normal; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "et-book"; + src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot"); + src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf") format("svg"); + font-weight: normal; + font-style: italic; + font-display: swap; +} + +@font-face { + font-family: "et-book"; + src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot"); + src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf") format("svg"); + font-weight: bold; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "et-book-roman-old-style"; + src: url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot"); + src: url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff") format("woff"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf") format("truetype"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.svg#etbookromanosf") format("svg"); + font-weight: normal; + font-style: normal; + font-display: swap; +} + +/* Tufte CSS styles */ +html { + font-size: 15px; +} + +body { + width: 87.5%; + margin-left: auto; + margin-right: auto; + padding-left: 12.5%; + font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif; + background-color: #fffff8; + color: #111; + max-width: 1400px; + counter-reset: sidenote-counter; +} + +/* Adds dark mode */ +@media (prefers-color-scheme: dark) { + body { + background-color: #151515; + color: #ddd; + } +} + +h1 { + font-weight: 400; + margin-top: 4rem; + margin-bottom: 1.5rem; + font-size: 3.2rem; + line-height: 1; +} + +h2 { + font-style: italic; + font-weight: 400; + margin-top: 2.1rem; + margin-bottom: 1.4rem; + font-size: 2.2rem; + line-height: 1; +} + +h3 { + font-style: italic; + font-weight: 400; + font-size: 1.7rem; + margin-top: 2rem; + margin-bottom: 1.4rem; + line-height: 1; +} + +hr { + display: block; + height: 1px; + width: 55%; + border: 0; + border-top: 1px solid #ccc; + margin: 1em 0; + padding: 0; +} + +p.subtitle { + font-style: italic; + margin-top: 1rem; + margin-bottom: 1rem; + font-size: 1.8rem; + display: block; + line-height: 1; +} + +.numeral { + font-family: et-book-roman-old-style; +} + +.danger { + color: red; +} + +article { + padding: 5rem 0rem; +} + +section { + padding-top: 1rem; + padding-bottom: 1rem; +} + +p, +dl, +ol, +ul { + font-size: 1.4rem; + line-height: 2rem; +} + +p { + margin-top: 1.4rem; + margin-bottom: 1.4rem; + padding-right: 0; + vertical-align: baseline; +} + +/* Chapter Epigraphs */ +div.epigraph { + margin: 5em 0; +} + +div.epigraph > blockquote { + margin-top: 3em; + margin-bottom: 3em; +} + +div.epigraph > blockquote, +div.epigraph > blockquote > p { + font-style: italic; +} + +div.epigraph > blockquote > footer { + font-style: normal; +} + +div.epigraph > blockquote > footer > cite { + font-style: italic; +} +/* end chapter epigraphs styles */ + +blockquote { + font-size: 1.4rem; +} + +blockquote p { + width: 55%; + margin-right: 40px; +} + +blockquote footer { + width: 55%; + font-size: 1.1rem; + text-align: right; +} + +section > p, +section > footer, +section > table { + width: 55%; +} + +/* 50 + 5 == 55, to be the same width as paragraph */ +section > dl, +section > ol, +section > ul { + width: 50%; + -webkit-padding-start: 5%; +} + +dt:not(:first-child), +li:not(:first-child) { + margin-top: 0.25rem; +} + +figure { + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + max-width: 55%; + -webkit-margin-start: 0; + -webkit-margin-end: 0; + margin: 0 0 3em 0; +} + +figcaption { + float: right; + clear: right; + margin-top: 0; + margin-bottom: 0; + font-size: 1.1rem; + line-height: 1.6; + vertical-align: baseline; + position: relative; + max-width: 40%; +} + +figure.fullwidth figcaption { + margin-right: 24%; +} + +a:link, +a:visited { + color: inherit; + text-underline-offset: 0.1em; + text-decoration-thickness: 0.05em; +} + +/* Sidenotes, margin notes, figures, captions */ +img { + max-width: 100%; +} + +.sidenote, +.marginnote { + float: right; + clear: right; + margin-right: -60%; + width: 50%; + margin-top: 0.3rem; + margin-bottom: 0; + font-size: 1.1rem; + line-height: 1.3; + vertical-align: baseline; + position: relative; +} + +.sidenote-number { + counter-increment: sidenote-counter; +} + +.sidenote-number:after, +.sidenote:before { + font-family: et-book-roman-old-style; + position: relative; + vertical-align: baseline; +} + +.sidenote-number:after { + content: counter(sidenote-counter); + font-size: 1rem; + top: -0.5rem; + left: 0.1rem; +} + +.sidenote:before { + content: counter(sidenote-counter) " "; + font-size: 1rem; + top: -0.5rem; +} + +blockquote .sidenote, +blockquote .marginnote { + margin-right: -82%; + min-width: 59%; + text-align: left; +} + +div.fullwidth, +table.fullwidth { + width: 100%; +} + +div.table-wrapper { + overflow-x: auto; + font-family: "Trebuchet MS", "Gill Sans", "Gill Sans MT", sans-serif; +} + +.sans { + font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; + letter-spacing: .03em; +} + +code, pre > code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 1.0rem; + line-height: 1.42; + -webkit-text-size-adjust: 100%; /* Prevent adjustments of font size after orientation changes in iOS. See https://github.com/edwardtufte/tufte-css/issues/81#issuecomment-261953409 */ +} + +.sans > code { + font-size: 1.2rem; +} + +h1 > code, +h2 > code, +h3 > code { + font-size: 0.80em; +} + +.marginnote > code, +.sidenote > code { + font-size: 1rem; +} + +pre > code { + font-size: 0.9rem; + width: 52.5%; + margin-left: 2.5%; + overflow-x: auto; + display: block; +} + +pre.fullwidth > code { + width: 90%; +} + +.fullwidth { + max-width: 90%; + clear:both; +} + +span.newthought { + font-variant: small-caps; + font-size: 1.2em; +} + +input.margin-toggle { + display: none; +} + +label.sidenote-number { + display: inline-block; + max-height: 2rem; /* should be less than or equal to paragraph line-height */ +} + +label.margin-toggle:not(.sidenote-number) { + display: none; +} + +.iframe-wrapper { + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + padding-top: 25px; + height: 0; +} + +.iframe-wrapper iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +@media (max-width: 760px) { + body { + width: 84%; + padding-left: 8%; + padding-right: 8%; + } + + hr, + section > p, + section > footer, + section > table { + width: 100%; + } + + pre > code { + width: 97%; + } + + section > dl, + section > ol, + section > ul { + width: 90%; + } + + figure { + max-width: 90%; + } + + figcaption, + figure.fullwidth figcaption { + margin-right: 0%; + max-width: none; + } + + blockquote { + margin-left: 1.5em; + margin-right: 0em; + } + + blockquote p, + blockquote footer { + width: 100%; + } + + label.margin-toggle:not(.sidenote-number) { + display: inline; + } + + .sidenote, + .marginnote { + display: none; + } + + .margin-toggle:checked + .sidenote, + .margin-toggle:checked + .marginnote { + display: block; + float: left; + left: 1rem; + clear: both; + width: 95%; + margin: 1rem 2.5%; + vertical-align: baseline; + position: relative; + } + + label { + cursor: pointer; + } + + div.table-wrapper, + table { + width: 85%; + } + + img { + width: 100%; + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 11e0386..397a6d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,13 @@ __metadata: version: 8 cacheKey: 10c0 +"@tauri-apps/api@npm:^2.0.0, @tauri-apps/api@npm:^2.2.0": + version: 2.2.0 + resolution: "@tauri-apps/api@npm:2.2.0" + checksum: 10c0/0ff0d9735c33d71c934e34045ef3077831fa98de25a42dc4c343120b482c8c114b87ef83dc02195923c23226fe6b8cb3e6bbaa099ab64d741346ba80c164435a + languageName: node + linkType: hard + "@tauri-apps/cli-darwin-arm64@npm:2.2.7": version: 2.2.7 resolution: "@tauri-apps/cli-darwin-arm64@npm:2.2.7" @@ -116,10 +123,31 @@ __metadata: languageName: node linkType: hard +"@tauri-apps/plugin-log@npm:~2": + version: 2.2.1 + resolution: "@tauri-apps/plugin-log@npm:2.2.1" + dependencies: + "@tauri-apps/api": "npm:^2.0.0" + checksum: 10c0/5f5128751b8f23447d6cd19749ac5f398abeec7f8ca63b1cc7632615454522b8b7fc6706572530c937df9f86a6071fdabfacf90f851c99b20e982124dddf7406 + languageName: node + linkType: hard + +"@tauri-apps/plugin-os@npm:~2": + version: 2.2.0 + resolution: "@tauri-apps/plugin-os@npm:2.2.0" + dependencies: + "@tauri-apps/api": "npm:^2.0.0" + checksum: 10c0/9440a6bc85be975a2c9f55b4da302531be68ea45d06e6d049c30395dd71749b0d975d4ec56bd6c86ceab0bbfd732dd8bc482772da63f13aa10792fa4ac7b8c64 + languageName: node + linkType: hard + "bookmobile@workspace:.": version: 0.0.0-use.local resolution: "bookmobile@workspace:." dependencies: + "@tauri-apps/api": "npm:^2.2.0" "@tauri-apps/cli": "npm:^2" + "@tauri-apps/plugin-log": "npm:~2" + "@tauri-apps/plugin-os": "npm:~2" languageName: unknown linkType: soft