Skip to content

Commit ed4ac27

Browse files
committed
weekend-work
1 parent 4f33dfd commit ed4ac27

File tree

16 files changed

+264616
-2
lines changed

16 files changed

+264616
-2
lines changed

.github/workflows/gh_pages.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This GitHub actions was inspired from
2+
# https://www.reddit.com/r/rust/comments/10eiysf/comment/j4rmeum/?utm_source=share&utm_medium=web2x&context=3
3+
4+
name: CD - Deploy Examples
5+
6+
# Controls when the workflow will run
7+
on:
8+
# Triggers the workflow on push or pull request events but only for the "master" branch
9+
push:
10+
branches: ["main"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Restore cache
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
~/.cargo/bin
27+
~/.cargo/git
28+
~/.cargo/registry
29+
target
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
- name: install toolchain
32+
uses: actions-rust-lang/setup-rust-toolchain@v1
33+
with:
34+
toolchain: stable
35+
target: wasm32-unknown-unknown
36+
- name: Install Trunk
37+
uses: jetli/[email protected]
38+
with:
39+
# Optional version of trunk to install(eg. 'v0.16.0', 'latest')
40+
version: "latest"
41+
- name: Add wasm target
42+
run: |
43+
rustup target add wasm32-unknown-unknown
44+
- name: Build the Rust WASM app and all of its assets
45+
run: trunk build --public-url /${{ github.event.repository.name }} --release
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v5
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: "./dist"
52+
53+
deploy:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
57+
permissions:
58+
pages: write
59+
id-token: write
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4

Cargo.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[package]
2+
name = "minimal-table"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "A minimal overview of the table component from the yew-custom-components library"
6+
license = "MIT"
7+
repository = "https://github.com/aknarts/yew-custom-components/tree/main/examples/overview"
8+
keywords = ["yew", "web-components", "custom-elements", "wasm"]
9+
categories = ["web-programming", "wasm"]
10+
resolver = "2"
11+
12+
[dependencies]
13+
plotly = { version = "0.12.1", features = ["wasm"] }
14+
console_error_panic_hook = "0.1"
15+
gloo-storage = "0.3"
16+
lazy_static = "1.4"
17+
serde = { version = "1.0.217", features = ["derive"] }
18+
serde-value = "0.7"
19+
serde-wasm-bindgen = "0.6.5"
20+
tracing = "0.1.41"
21+
tracing-wasm = "0.2"
22+
yew = { version = "0.21.0", features = ["csr"] }
23+
yew-custom-components = { version = "0.2.2", features = ["table", "pagination"] }
24+
serde_json = "1.0.138"
25+
yew-hooks = "0.3.3"
26+
yew-router = "0.18"
27+
web-sys = { version = "0.3.77", features = ["HtmlInputElement","Document", "Window"] }
28+
reqwest = { version = "0.12.12", features = ["json"] }
29+
cached = { version = "0.54.0", features = ["async"] }
30+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
31+
tokio = { version = "1.43.0", features = ["full"] }

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
# nuclide_cross_section_plotter.rs
2-
A Rust WASM based nuclide neutron cross section plotter
1+
[Demo](https://shimwell.github.io/nuclide_cross_section_plotter.rs/)
2+
3+
Install instructions on Ubuntu 22.04
4+
```
5+
sudo apt-get update
6+
sudo apt-get install curl
7+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
8+
. "$HOME/.cargo/env"
9+
sudo apt install build-essential -y
10+
rustup target add wasm32-unknown-unknown
11+
cargo clean
12+
cargo build --target wasm32-unknown-unknown --release
13+
cargo install --locked trunk
14+
trunk serve --open
15+
```

dist/index-27c0ccd21ba5a614.css

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en" data-bs-theme="dark">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Yew Custom Components</title>
6+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
7+
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
8+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
9+
<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>
10+
<base href="/" />
11+
12+
<script type="module">
13+
import init, * as bindings from '/minimal-table-29218546157c971e.js';
14+
const wasm = await init({ module_or_path: '/minimal-table-29218546157c971e_bg.wasm' });
15+
16+
17+
window.wasmBindings = bindings;
18+
19+
20+
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
21+
22+
</script>
23+
<link rel="stylesheet" href="/index-27c0ccd21ba5a614.css" integrity="sha384&#x2D;MUtqs&#x2F;zU740Qjkm&#x2B;W3edSsY4Km8j3kgB7ukhzJeugyck8mZbfvG0jCWZ9nueFUc&#x2F;"/>
24+
<link rel="modulepreload" href="/minimal-table-29218546157c971e.js" crossorigin="anonymous" integrity="sha384-EerKwhF/HXoCuFQCmqmtKlrN4lg1EMVopfI6Qm1y0og1N9hvdpo0ftWWYvO24QmN"><link rel="preload" href="/minimal-table-29218546157c971e_bg.wasm" crossorigin="anonymous" integrity="sha384-x7bqYZAriqdNbBeGLS1xpOh8XyzuAQVIdV5I46D6x+jlcuKwdSITMc6pCeACuVj1" as="fetch" type="application/wasm"></head>
25+
</html>

0 commit comments

Comments
 (0)