diff --git a/app/assets/css/main.css b/app/assets/css/main.css index d738f2f..9c56072 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -5157,10 +5157,9 @@ button.tile:hover { .part-tabs { display: flex; + flex-wrap: wrap; gap: 2px; padding: 2px 2px 4px; - overflow-x: auto; - scrollbar-width: none; } .part-tabs button { @@ -5381,3 +5380,39 @@ button.tile:hover { -webkit-appearance: none; margin: 0; } + +/* A jump drawn once more on top of what it crosses: only for looks. */ +.wire.jump path { + pointer-events: none; +} + +.top-bar .bar-btn.here { + color: var(--text); +} + +.tile.active { + border-color: var(--accent); +} + +.part-tabs .unused-tab { + display: flex; + align-items: center; + gap: 4px; +} + +.part-slot .pin-btn.drop-btn:hover { + color: var(--danger); +} + +.part-slot .pin-btn.drop-btn.confirm { + width: auto; + gap: 3px; + padding: 0 6px; + display: flex; + align-items: center; + font-size: 11px; + font-weight: 600; + color: #fff; + background: var(--danger); + opacity: 1; +} diff --git a/app/components/editor/BottomBar.vue b/app/components/editor/BottomBar.vue index 1289889..44951cc 100644 --- a/app/components/editor/BottomBar.vue +++ b/app/components/editor/BottomBar.vue @@ -7,6 +7,7 @@ // builder's: the mouse wheel scrolls it sideways. import { shortCount } from '~/lib/logic/analyze' import { BASIC_GROUPS } from '~/composables/useParts' +import { unusedComponents } from '~/lib/logic/check' import type { ComponentDef, NodeKind } from '~/lib/logic/types' const ed = useEditor() @@ -73,10 +74,22 @@ function page(dir: number) { const placeable = (d: ComponentDef) => d.id !== ed.def.value.id && ed.canPlace(d.id) +/** Components placed nowhere (not the open one, Main, examples or challenges): a tab of their own, to clear out. */ +const UNUSED = 'unused' +const unused = computed(() => unusedComponents(ed.project.value).filter(d => d.id !== ed.def.value.id && d.id !== ed.mainId.value)) +const confirmDrop = ref(null) +function drop(d: ComponentDef) { + if (confirmDrop.value !== d.id) return (confirmDrop.value = d.id) + confirmDrop.value = null + ed.removeComponent(d.id) + ed.notify(`Deleted "${d.name}" (Ctrl+Z brings it back)`) +} + /** The component group shown; your own components first. */ const compTab = ref('') const compGroup = computed( () => + (compTab.value === UNUSED && unused.value.length ? { name: 'Unused', defs: unused.value } : undefined) ?? componentGroups.value.find(g => g.name === compTab.value) ?? // Untouched: the first group with something that can go in here. componentGroups.value.find(g => g.defs.some(placeable)) ?? @@ -241,17 +254,28 @@ onBeforeUnmount(() => window.removeEventListener('keydown', onKey, true))