diff --git a/src/components/Editor.vue b/src/components/Editor.vue index dfe4400..f0a428a 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -29,7 +29,7 @@ import { useAutosave } from "@/composables/useAutosave" import { usePlayback } from "@/composables/usePlayback" import { parseModel, serializeModel } from "@/model/io" import { project } from "@/model/projection" -import { type Sample, SAMPLES } from "@/model/samples" +import type { Sample } from "@/model/samples" import { canConnect } from "@/model/validation" import { useModelStore } from "@/store/model" import { NODE_DND_MIME, type PlaceableKind } from "./palette-dnd" @@ -38,6 +38,7 @@ import Inspector from "./Inspector.vue" import LoopOverlay from "./LoopOverlay.vue" import Palette from "./Palette.vue" import ResultsPanel from "./ResultsPanel.vue" +import SampleBrowser from "./SampleBrowser.vue" import InfoLinkEdge from "./edges/InfoLinkEdge.vue" import PipeEdge from "./edges/PipeEdge.vue" import CloudNode from "./nodes/CloudNode.vue" @@ -55,6 +56,9 @@ const edges = computed(() => graph.value.edges) // the Model and recomputes reactively while open. const showResults = ref(false) +// The sample-browser modal (opened from the header "Samples" button). +const browserOpen = ref(false) + // The playback clock that advances the playhead while a run is playing (mounted // once here; the simulation store holds the state it drives). usePlayback() @@ -270,12 +274,12 @@ function onDragOver(event: DragEvent): void { */ function loadSample(sample: Sample): void { if (store.nodeCount > 0 && !window.confirm(`Replace the current model with “${sample.title}”?`)) { + // Cancelled: leave the model untouched and the browser open to pick again. return } fitAfterInit = true store.setModel(sample.build()) - // Close the DaisyUI dropdown (it stays open while the trigger keeps focus). - ;(document.activeElement as HTMLElement | null)?.blur() + browserOpen.value = false } const fileInput = useTemplateRef("fileInput") @@ -397,20 +401,7 @@ onBeforeUnmount(() => { {{ store.nodeCount }} {{ store.nodeCount === 1 ? "element" : "elements" }}
- +