Skip to content

Commit

Permalink
update gitignore and pyproject files
Browse files Browse the repository at this point in the history
  • Loading branch information
waltermwaniki committed Feb 4, 2025
1 parent d70ba39 commit 1be46c1
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 64 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
9 changes: 1 addition & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ dependencies = [
]

[project.optional-dependencies]
# voxel = ['voxel']
gui = [
"fastapi[standard]",
"uvicorn",
]
gui = ["fastapi[standard]", "uvicorn"]
dev = [
'pytest',
'black',
Expand All @@ -40,9 +36,6 @@ dev = [
]
build = ["setuptools>=42", "setuptools-scm"]

[tool.uv.sources]
voxel = { git = "https://github.com/AllenNeuralDynamics/voxel" }

[project.scripts]
cohrhops = "coherent_lasers.hops.app:cli"
genesis-mx = "coherent_lasers.genesis_mx.app:cli"
Expand Down
55 changes: 0 additions & 55 deletions src/coherent_lasers/genesis_mx/voxel.py

This file was deleted.

10 changes: 10 additions & 0 deletions webgui/src/lib/Counter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
let count: number = $state(0)
const increment = () => {
count += 1
}
</script>

<button onclick={increment}>
count is {count}
</button>
142 changes: 142 additions & 0 deletions webgui/src/lib/DeliminatedInput.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<script lang="ts">
interface DeliminatedInputProps {
value: number;
onChange?: (value: number) => void;
min?: number;
max?: number;
step?: number;
}
let {
value = $bindable(),
onChange,
min,
max,
step,
}: DeliminatedInputProps = $props();
function enforceDelimination(value: number) {
if (min !== undefined) {
if (value < min) {
return min;
} else if (step) {
const distanceFromMin = value - min;
const numSteps = Math.round(distanceFromMin / step);
value = min + numSteps * step;
}
}
if (max !== undefined && value > max) return max;
return value;
}
function updateValue(e: Event) {
const target = e.target as HTMLInputElement;
let newValue = Number(target.value);
if (isNaN(newValue)) return;
value = enforceDelimination(newValue);
return value;
}
function handleValueChange(e: Event) {
const newValue = updateValue(e);
onChange && newValue && onChange(newValue);
}
</script>

<div class="deliminated-input">
<input type="text" {value} onchange={handleValueChange} />
<input
type="range"
{min}
{max}
{step}
{value}
oninput={updateValue}
onchange={handleValueChange}
/>
</div>

<style>
.deliminated-input {
--hover-color: var(--zinc-600);
--transition: var(--transition-duration, 0.3s) ease-in-out;
--thumb-size: 0.75rem;
--slider-thickness: calc(var(--thumb-size) * 1.5);
--track-thickness: calc(var(--thumb-size) * 0.5);
/* --track-bg: var(--zinc-800); */
/* --border-color: var(--zinc-800); */
--track-bg: var(--border-color, var(--zinc-800));
--border: 1px solid var(--track-bg);
display: flex;
flex-direction: column;
background-color: var(--zinc-900);
padding-bottom: calc((0.75rem - 0.375rem) * 0.5);
input[type="text"] {
width: 100%;
margin-inline: auto;
text-align: center;
font-family: monospace;
font-size: var(--font-sm);
color: var(--zinc-400);
padding-block: 0.25rem;
background-color: var(--bg-color, var(--zinc-900));
border: var(--border);
border-bottom: none;
transition: all var(--transition);
outline: none;
}
input[type="range"] {
/* style the track */
-webkit-appearance: none;
appearance: none;
outline: none;
width: 100%;
height: var(--track-thickness);
background-color: var(--track-bg);
border-left: var(--border);
border-right: var(--border);
transition: all var(--transition);
/* style the thumb */
&::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: var(--thumb-size);
height: var(--thumb-size);
background-color: var(--thumb-color, var(--zinc-500));
opacity: 0.75;
border-radius: 50%;
cursor: pointer;
transition: all var(--transition);
}
&:hover,
&:focus,
&:focus-within {
&::-webkit-slider-thumb {
background-color: var(
--thumb-hover-color,
var(--thumb-color, var(--zinc-400))
);
}
}
}
&:hover,
&:focus,
&:focus-within {
--track-bg: var(--border-hover-color, var(--zinc-700));
input[type="range"] {
&::-webkit-slider-thumb {
opacity: 1;
}
}
}
}
</style>
Loading

0 comments on commit 1be46c1

Please sign in to comment.