-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add interactive VitePress homepage (#53)
* update README * update description and authors * update `configure-dms-viz` * re-run pipeline * add interative VitePress homepage
- Loading branch information
Showing
96 changed files
with
418,691 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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,35 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- run: npm ci | ||
- run: npm run docs:build | ||
- name: Deploy | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
# Change to your GitHub Pages repository | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: homepage/.vitepress/dist |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
16 changes: 11 additions & 5 deletions
16
docs/notebooks/configure_dms_viz_domainIII_CR57_escape.html
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 11 additions & 5 deletions
16
docs/notebooks/configure_dms_viz_extended_intermediate_cell_entry.html
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 11 additions & 5 deletions
16
docs/notebooks/configure_dms_viz_ph_domain_RVC20_escape.html
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 7 additions & 7 deletions
14
docs/notebooks/configure_dms_viz_prefusion_17C7_escape.html
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 7 additions & 7 deletions
14
docs/notebooks/configure_dms_viz_prefusion_RVA122_escape.html
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
|
@@ -14,4 +14,4 @@ dependencies: | |
- python=3.11 | ||
- seaborn=0.13 | ||
- pip: | ||
- configure-dms-viz==1.5.0 | ||
- configure-dms-viz==1.6.0 |
This file contains 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,22 @@ | ||
import { defineConfig } from "vitepress"; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
lang: "en-US", | ||
title: "Deep mutational scanning of rabies G (Pasteur strain)", | ||
description: | ||
"Pseudovirus deep mutational scanning to measure how rabies G mutations affect cell entry and escape from a panel of monoclonal antibodies", | ||
base: "/RABV_Pasteur_G_DMS/", | ||
appearance: false, | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: [ | ||
{ text: "Home", link: "/" }, | ||
{ text: "Appendix", link: "/appendix", target: "_self" }, | ||
], | ||
socialLinks: [{ icon: "github", link: "https://github.com/dms-vep/RABV_Pasteur_G_DMS" }], | ||
footer: { | ||
message: 'Study by Arjun Aditham, Caelan Radford, Caleb, Carr, & <a href="https://jbloomlab.org">Jesse Bloom</a>', | ||
}, | ||
}, | ||
}); |
This file contains 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,177 @@ | ||
<script> | ||
import * as vega from 'vega'; | ||
import * as vegaLite from 'vega-lite'; | ||
import vegaEmbed from 'vega-embed'; | ||
import { parseVegaSpecFromHTML } from './parseVegaSpec'; | ||
export default { | ||
name: 'VegaChart', | ||
props: { | ||
specUrl: { | ||
type: String, | ||
required: true, | ||
}, | ||
showShadow: { | ||
type: Boolean, | ||
default: true, | ||
} | ||
}, | ||
data() { | ||
return { | ||
isExpanded: false, | ||
}; | ||
}, | ||
async mounted() { | ||
await this.loadChart(this.specUrl); | ||
}, | ||
methods: { | ||
// Parse and load the chart from the URL | ||
async loadChart(url) { | ||
try { | ||
let spec; | ||
// Determine if the URL is local or remote | ||
if (!url.startsWith('http://') && !url.startsWith('https://')) { | ||
const htmlContent = await this.fetchLocalFile(url); | ||
spec = await parseVegaSpecFromHTML(htmlContent); | ||
} else { | ||
// Get the path to check the file format | ||
const urlObj = new URL(url); | ||
const path = urlObj.pathname; | ||
// Get the response from the URL | ||
const response = await fetch(url); | ||
// Check if URL ends with '.html' | ||
if (path.endsWith('.html')) { | ||
const htmlContent = await response.text(); | ||
spec = await parseVegaSpecFromHTML(htmlContent); | ||
} | ||
// Check if URL ends with '.json' | ||
else if (path.endsWith('.json')) { | ||
spec = await response.json(); | ||
} | ||
else { | ||
console.error('Unsupported file format'); | ||
return; | ||
} | ||
} | ||
this.renderChart(spec); | ||
} catch (error) { | ||
console.error('Error loading Vega spec:', error); | ||
} | ||
}, | ||
// Fetch the text from local files | ||
async fetchLocalFile(filePath) { | ||
const response = await fetch(filePath); | ||
if (!response.ok) throw new Error('Failed to fetch local file'); | ||
console.log('response.text()', response); | ||
return await response.text(); | ||
}, | ||
// Render the chart using VegaEmbed | ||
renderChart(spec) { | ||
vegaEmbed(this.$refs.vegaContainer, spec, { | ||
renderer: 'canvas', | ||
vega, | ||
vegaLite, | ||
actions: false, | ||
}).then((result) => { | ||
console.log('Chart rendered successfully'); | ||
}).catch(console.error); | ||
}, | ||
// Toggle the expanded view | ||
toggleExpand() { | ||
this.isExpanded = !this.isExpanded; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div class="vega-chart-container" :class="{ 'expanded': isExpanded, 'no-box-shadow': !showShadow }"> | ||
<div ref="vegaContainer"> | ||
</div> | ||
<button @click="toggleExpand" @keydown.esc="isExpanded = false" class="expand-btn"> | ||
<i v-if="isExpanded" class="bi bi-arrows-angle-contract"></i> | ||
<i v-else class="bi bi-arrows-angle-expand"></i> | ||
</button> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.vega-chart-container { | ||
width: 100%; | ||
height: auto; | ||
overflow: auto; | ||
padding: 20px; | ||
position: relative; | ||
background-color: white; | ||
line-height: 0%; | ||
} | ||
.vega-chart-container:not(.no-box-shadow) { | ||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5); | ||
} | ||
.expanded { | ||
width: 100vw; | ||
height: 100vh; | ||
position: fixed !important; | ||
top: 0; | ||
left: 0; | ||
z-index: 100; | ||
padding: 1%; | ||
} | ||
.expand-btn { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
outline: none !important; | ||
width: 30px; | ||
height: 30px; | ||
border-radius: 5px; | ||
border: 1px solid #aaa; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.bi { | ||
font-size: 20px; | ||
} | ||
/* Form container */ | ||
.vega-bindings { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
padding: 10px; | ||
} | ||
.vega-bind-name { | ||
flex-basis: 20%; | ||
text-align: left; | ||
font-weight: bold; | ||
margin-right: 5px; | ||
} | ||
.vega-bindings select { | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
background-color: #fff; | ||
text-align: center; | ||
} | ||
.vega-bindings input[type="select"] option { | ||
text-align: center; | ||
font-size: 14px; | ||
} | ||
.vega-bindings input[type="radio"] { | ||
margin: 5px 5px 0px 10px; | ||
} | ||
</style> |
This file contains 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,31 @@ | ||
<script> | ||
export default { | ||
props: { | ||
imageSrc: { | ||
type: String, | ||
default: '' | ||
}, | ||
caption: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
}; | ||
</script> | ||
|
||
<template> | ||
<figure> | ||
<img v-if="imageSrc" :src="imageSrc" :alt="caption" /> | ||
<slot v-else></slot> | ||
<figcaption>{{ caption }}</figcaption> | ||
</figure> | ||
</template> | ||
|
||
<style scoped> | ||
figcaption { | ||
color: grey; | ||
padding-top: 0.5em; | ||
font-size: 0.8em; | ||
text-align: center; | ||
} | ||
</style> |
This file contains 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,19 @@ | ||
import { h } from "vue"; | ||
import DefaultTheme from "vitepress/theme"; | ||
import Altair from "./Altair.vue"; | ||
import Figure from "./Figure.vue"; | ||
import "bootstrap-icons/font/bootstrap-icons.css"; | ||
import "./style.css"; | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout: () => { | ||
return h(DefaultTheme.Layout, null, { | ||
|
||
}); | ||
}, | ||
enhanceApp({ app, router, siteData }) { | ||
app.component("Altair", Altair); | ||
app.component("Figure", Figure); | ||
}, | ||
}; |
Oops, something went wrong.