changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: init alik ui

changeset 399: 7963217e1d39
parent 398: 1e08f8462554
child 400: 122554547517
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 02 Jun 2024 21:58:22 -0400
files: .hgignore rust/Cargo.toml rust/ui/alik/Cargo.toml rust/ui/alik/Trunk.toml rust/ui/alik/index.html rust/ui/alik/sw.js rust/web/alik/Cargo.toml
description: init alik ui
     1.1--- a/.hgignore	Sun Jun 02 21:23:07 2024 -0400
     1.2+++ b/.hgignore	Sun Jun 02 21:58:22 2024 -0400
     1.3@@ -13,4 +13,5 @@
     1.4 .*[.]core$
     1.5 .*[.]elc$
     1.6 c/.*
     1.7+.*dist/.*
     1.8 [.]stash/.*
     1.9\ No newline at end of file
     2.1--- a/rust/Cargo.toml	Sun Jun 02 21:23:07 2024 -0400
     2.2+++ b/rust/Cargo.toml	Sun Jun 02 21:58:22 2024 -0400
     2.3@@ -1,6 +1,6 @@
     2.4 [workspace]
     2.5 resolver = "2"
     2.6-members = ["sys/*","lib/*","bin/*","web/*"]
     2.7+members = ["sys/*","lib/*","bin/*","ui/*"]
     2.8 [workspace.package]
     2.9 version = "0.1.0"
    2.10 authors = ["Richard Westhaver <ellis@rwest.io>"]
     3.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2+++ b/rust/ui/alik/Cargo.toml	Sun Jun 02 21:58:22 2024 -0400
     3.3@@ -0,0 +1,38 @@
     3.4+[package]
     3.5+name = "alik_ui"
     3.6+version.workspace = true
     3.7+authors.workspace = true
     3.8+edition.workspace = true
     3.9+[[bin]]
    3.10+name = "alik_ui"
    3.11+path = "src/main.rs"
    3.12+[dependencies]
    3.13+egui = "0.27.2"
    3.14+eframe = { version = "0.27.0", default-features = false, features = [
    3.15+    "accesskit",
    3.16+    "default_fonts", # Embed the default egui fonts.
    3.17+    "glow",          # Use the glow rendering backend. Alternative: "wgpu".
    3.18+    "persistence",   # Enable restoring app state when restarting the app.
    3.19+] }
    3.20+log = "0.4"
    3.21+# You only need serde if you want app persistence:
    3.22+serde = { version = "1", features = ["derive"] }
    3.23+
    3.24+# native:
    3.25+# [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
    3.26+
    3.27+# web:
    3.28+[target.'cfg(target_arch = "wasm32")'.dependencies]
    3.29+wasm-bindgen-futures = "0.4"
    3.30+
    3.31+[profile.release]
    3.32+opt-level = 2 # fast and small wasm
    3.33+
    3.34+# Optimize all dependencies even in debug builds:
    3.35+[profile.dev.package."*"]
    3.36+opt-level = 2
    3.37+
    3.38+
    3.39+[patch.crates-io]
    3.40+egui = { git = "https://github.com/emilk/egui", branch = "master" }
    3.41+eframe = { git = "https://github.com/emilk/egui", branch = "master" }
    3.42\ No newline at end of file
     4.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2+++ b/rust/ui/alik/Trunk.toml	Sun Jun 02 21:58:22 2024 -0400
     4.3@@ -0,0 +1,1 @@
     4.4+[build]
     4.5\ No newline at end of file
     5.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2+++ b/rust/ui/alik/index.html	Sun Jun 02 21:58:22 2024 -0400
     5.3@@ -0,0 +1,125 @@
     5.4+<!DOCTYPE html>
     5.5+<html>
     5.6+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     5.7+
     5.8+<!-- Disable zooming: -->
     5.9+<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    5.10+
    5.11+<head>
    5.12+    <!-- change this to your project name -->
    5.13+    <title>alik</title>
    5.14+
    5.15+    <!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
    5.16+    <link data-trunk rel="rust" data-wasm-opt="2" />
    5.17+    <!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
    5.18+    <base data-trunk-public-url />
    5.19+    <link data-trunk rel="copy-file" href="sw.js" />
    5.20+    <meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
    5.21+    <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">
    5.22+
    5.23+    <style>
    5.24+        html {
    5.25+            /* Remove touch delay: */
    5.26+            touch-action: manipulation;
    5.27+        }
    5.28+
    5.29+        body {
    5.30+            /* Light mode background color for what is not covered by the egui canvas,
    5.31+            or where the egui canvas is translucent. */
    5.32+            background: #909090;
    5.33+        }
    5.34+
    5.35+        @media (prefers-color-scheme: dark) {
    5.36+            body {
    5.37+                /* Dark mode background color for what is not covered by the egui canvas,
    5.38+                or where the egui canvas is translucent. */
    5.39+                background: #404040;
    5.40+            }
    5.41+        }
    5.42+
    5.43+        /* Allow canvas to fill entire web page: */
    5.44+        html,
    5.45+        body {
    5.46+            overflow: hidden;
    5.47+            margin: 0 !important;
    5.48+            padding: 0 !important;
    5.49+            height: 100%;
    5.50+            width: 100%;
    5.51+        }
    5.52+
    5.53+        /* Position canvas in center-top: */
    5.54+        canvas {
    5.55+            margin-right: auto;
    5.56+            margin-left: auto;
    5.57+            display: block;
    5.58+            position: absolute;
    5.59+            top: 0%;
    5.60+            left: 50%;
    5.61+            transform: translate(-50%, 0%);
    5.62+        }
    5.63+
    5.64+        .centered {
    5.65+            margin-right: auto;
    5.66+            margin-left: auto;
    5.67+            display: block;
    5.68+            position: absolute;
    5.69+            top: 50%;
    5.70+            left: 50%;
    5.71+            transform: translate(-50%, -50%);
    5.72+            color: #f0f0f0;
    5.73+            font-size: 24px;
    5.74+            font-family: Ubuntu-Light, Helvetica, sans-serif;
    5.75+            text-align: center;
    5.76+        }
    5.77+
    5.78+        /* ---------------------------------------------- */
    5.79+        /* Loading animation from https://loading.io/css/ */
    5.80+        .lds-dual-ring {
    5.81+            display: inline-block;
    5.82+            width: 24px;
    5.83+            height: 24px;
    5.84+        }
    5.85+
    5.86+        .lds-dual-ring:after {
    5.87+            content: " ";
    5.88+            display: block;
    5.89+            width: 24px;
    5.90+            height: 24px;
    5.91+            margin: 0px;
    5.92+            border-radius: 50%;
    5.93+            border: 3px solid #fff;
    5.94+            border-color: #fff transparent #fff transparent;
    5.95+            animation: lds-dual-ring 1.2s linear infinite;
    5.96+        }
    5.97+
    5.98+        @keyframes lds-dual-ring {
    5.99+            0% {
   5.100+                transform: rotate(0deg);
   5.101+            }
   5.102+
   5.103+            100% {
   5.104+                transform: rotate(360deg);
   5.105+            }
   5.106+        }
   5.107+
   5.108+    </style>
   5.109+</head>
   5.110+
   5.111+<body>
   5.112+    <!-- The WASM code will resize the canvas dynamically -->
   5.113+    <!-- the id is hardcoded in main.rs . so, make sure both match. -->
   5.114+    <canvas id="app_canvas"></canvas>
   5.115+
   5.116+    <!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
   5.117+    <!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files  -->
   5.118+    <script>
   5.119+        // We disable caching during development so that we always view the latest version.
   5.120+        if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
   5.121+            window.addEventListener('load', function () {
   5.122+                navigator.serviceWorker.register('sw.js');
   5.123+            });
   5.124+        }
   5.125+    </script>
   5.126+</body>
   5.127+
   5.128+</html>
     6.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2+++ b/rust/ui/alik/sw.js	Sun Jun 02 21:58:22 2024 -0400
     6.3@@ -0,0 +1,25 @@
     6.4+var cacheName = 'alik-pwa';
     6.5+var filesToCache = [
     6.6+  './',
     6.7+  './index.html',
     6.8+  './alik.js',
     6.9+  './alik_bg.wasm',
    6.10+];
    6.11+
    6.12+/* Start the service worker and cache all of the app's content */
    6.13+self.addEventListener('install', function (e) {
    6.14+  e.waitUntil(
    6.15+    caches.open(cacheName).then(function (cache) {
    6.16+      return cache.addAll(filesToCache);
    6.17+    })
    6.18+  );
    6.19+});
    6.20+
    6.21+/* Serve cached content when offline */
    6.22+self.addEventListener('fetch', function (e) {
    6.23+  e.respondWith(
    6.24+    caches.match(e.request).then(function (response) {
    6.25+      return response || fetch(e.request);
    6.26+    })
    6.27+  );
    6.28+});
     7.1--- a/rust/web/alik/Cargo.toml	Sun Jun 02 21:23:07 2024 -0400
     7.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3@@ -1,7 +0,0 @@
     7.4-[package]
     7.5-name = "alik-web"
     7.6-version.workspace = true
     7.7-authors.workspace = true
     7.8-edition.workspace = true
     7.9-[dependencies]
    7.10-egui = "0.27.2"