Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Unpredictability committed Feb 5, 2025
1 parent f192402 commit a97d92c
Show file tree
Hide file tree
Showing 31 changed files with 2,286 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/tex2typst-UI.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[package]
name = "tex2typst-UI"
version = "0.1.0"
authors = ["Jamie <bdmundxyang@gmail.com>"]
edition = "2021"
license = "GPL-3.0-or-later"
repository = "https://github.com/Unpredictability/tex2typst-UI"
description = "A GUI for tex2typst-rs"
categories = ["text-processing", "parsing", "mathematics"]
keywords = ["latex", "tex", "math", "typst", "converting"]
readme = "README.md"

[dependencies]
tex2typst-rs = "0.3.1"
egui = "0.31.0"
eframe = { version = "0.31", default-features = false, features = [
"accesskit", # Make egui compatible with screen readers. NOTE: adds a lot of dependencies.
"default_fonts", # Embed the default egui fonts.
"glow", # Use the glow rendering backend. Alternative: "wgpu".
"persistence", # Enable restoring app state when restarting the app.
"wayland", # To support Linux (and CI)
] }
log = "0.4.25"
serde = { version = "1.0.217", features = ["derive"] }

# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "0.11.6"

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4.50"
web-sys = "0.3.77" # to access the DOM (to hide the loading text)

[profile.release]
opt-level = 2

# Optimize all dependencies even in debug builds:
[profile.dev.package."*"]
opt-level = 2
2 changes: 2 additions & 0 deletions Trunk.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
filehash = false
Binary file added assets/NotoSansSC-Regular.ttf
Binary file not shown.
Binary file added assets/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon.ico
Binary file not shown.
38 changes: 38 additions & 0 deletions assets/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "tex2typst UI PWA",
"short_name": "tex2typst-UI-pwa",
"icons": [
{
"src": "./assets/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./assets/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "./assets/apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
},
{
"src": "./assets/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "./assets/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
}
],
"lang": "en-US",
"id": "/index.html",
"start_url": "./index.html",
"display": "standalone",
"background_color": "white",
"theme_color": "white"
}
25 changes: 25 additions & 0 deletions assets/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var cacheName = 'tex2typst-UI-pwa';
var filesToCache = [
'./',
'./index.html',
'./eframe_template.js',
'./eframe_template_bg.wasm',
];

/* Start the service worker and cache all the app's content */
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open(cacheName).then(function (cache) {
return cache.addAll(filesToCache);
})
);
});

/* Serve cached content when offline */
self.addEventListener('fetch', function (e) {
e.respondWith(
caches.match(e.request).then(function (response) {
return response || fetch(e.request);
})
);
});
Binary file added dist/assets/NotoSansSC-Regular.ttf
Binary file not shown.
Binary file added dist/assets/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/favicon.ico
Binary file not shown.
159 changes: 159 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<!-- Disable zooming: -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<head>
<title>TeX to Typst UI</title>

<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->

<script type="module">
import init, * as bindings from '/tex2typst-UI.js';
const wasm = await init({ module_or_path: '/tex2typst-UI_bg.wasm' });


window.wasmBindings = bindings;


dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));

</script>
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
<base href="/" />

<link rel="icon" href="/favicon.ico" integrity="sha384&#x2D;igWOu8oy7cclmLsxgcSg&#x2B;pzEI7g2f05k0ej2qgEE1AWsLX0Mg2rlDZw8R5i9lqLI"/>













<link rel="manifest" href="assets/manifest.json">
<link rel="apple-touch-icon" href="assets/apple-touch-icon.png">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">

<style>
html {
/* Remove touch delay: */
touch-action: manipulation;
}

body {
/* Light mode background color for what is not covered by the egui canvas,
or where the egui canvas is translucent. */
background: #909090;
}

@media (prefers-color-scheme: dark) {
body {
/* Dark mode background color for what is not covered by the egui canvas,
or where the egui canvas is translucent. */
background: #404040;
}
}

/* Allow canvas to fill entire web page: */
html,
body {
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
height: 100%;
width: 100%;
}

/* Make canvas fill entire document: */
canvas {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.centered {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #f0f0f0;
font-size: 24px;
font-family: Ubuntu-Light, Helvetica, sans-serif;
text-align: center;
}

/* ---------------------------------------------- */
/* Loading animation from https://loading.io/css/ */
.lds-dual-ring {
display: inline-block;
width: 24px;
height: 24px;
}

.lds-dual-ring:after {
content: " ";
display: block;
width: 24px;
height: 24px;
margin: 0px;
border-radius: 50%;
border: 3px solid #fff;
border-color: #fff transparent #fff transparent;
animation: lds-dual-ring 1.2s linear infinite;
}

@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}
</style>
<link rel="modulepreload" href="/tex2typst-UI.js" crossorigin="anonymous" integrity="sha384-OJgmMuFIiBjD5HhkGrGdLy1AFUNCSJJ+9zHUFvmYRV9XQE2/IAx7trZ1pIzCMhHz"><link rel="preload" href="/tex2typst-UI_bg.wasm" crossorigin="anonymous" integrity="sha384-eEOfYpiUxCX6cICUlJAF3OB1/KuXFNiCcBeG1evI6aYtG8JFFXl4mcpcXcw3Rz16" as="fetch" type="application/wasm"></head>

<body>
<!-- The WASM code will resize the canvas dynamically -->
<!-- the id is hardcoded in main.rs . so, make sure both match. -->
<canvas id="the_canvas_id"></canvas>

<!-- the loading spinner will be removed in main.rs -->
<div class="centered" id="loading_text">
<p style="font-size:16px">
Loading…
</p>
<div class="lds-dual-ring"></div>
</div>

<!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
<!--<script>-->
<!-- // We disable caching during development so that we always view the latest version.-->
<!-- if ('serviceWorker' in navigator && window.location.hash !== "#dev") {-->
<!-- window.addEventListener('load', function () {-->
<!-- navigator.serviceWorker.register('sw.js');-->
<!-- });-->
<!-- }-->
<!--</script>-->
</body>

</html>
38 changes: 38 additions & 0 deletions dist/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "tex2typst UI PWA",
"short_name": "tex2typst-UI-pwa",
"icons": [
{
"src": "./assets/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./assets/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "./assets/apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
},
{
"src": "./assets/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "./assets/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
}
],
"lang": "en-US",
"id": "/index.html",
"start_url": "./index.html",
"display": "standalone",
"background_color": "white",
"theme_color": "white"
}
Loading

0 comments on commit a97d92c

Please sign in to comment.