Files
wehub-resource-sync adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:17:32 +08:00

109 lines
1.9 KiB
Svelte

<script lang="ts">
let {
position,
coords,
on_click = null
}: {
position: "column" | "row";
coords: [number, number];
on_click?: (() => void) | null;
} = $props();
let is_first_position = $derived(
position === "column" ? coords[0] === 0 : coords[1] === 0
);
let direction = $derived(
position === "column"
? is_first_position
? "down"
: "up"
: is_first_position
? "right"
: "left"
);
</script>
<button
class="selection-button selection-button-{position} {is_first_position
? `move-${direction}`
: ''}"
onclick={(e: MouseEvent) => {
e.stopPropagation();
on_click && on_click();
}}
aria-label={`Select ${position}`}
>
<span class={direction}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path
d="m16.707 13.293-4-4a1 1 0 0 0-1.414 0l-4 4A1 1 0 0 0 8 15h8a1 1 0 0 0 .707-1.707z"
data-name={direction}
/>
</svg>
</span>
</button>
<style>
.selection-button {
position: absolute;
background: var(--color-accent);
width: var(--size-3);
height: var(--size-5);
color: var(--background-fill-primary);
}
.selection-button-column {
top: -15px;
left: 50%;
transform: translateX(-50%) rotate(90deg);
border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.selection-button-row {
left: calc(var(--size-2-5) * -1);
top: 50%;
transform: translateY(-50%);
border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.move-down {
bottom: -14px;
top: auto;
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.move-right {
left: auto;
right: calc(var(--size-2-5) * -1);
top: 50%;
transform: translateY(-50%);
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
svg {
fill: currentColor;
}
span {
display: flex;
width: 100%;
height: 100%;
}
.up {
transform: rotate(-90deg);
}
.down {
transform: rotate(90deg);
}
.left {
transform: rotate(-90deg);
}
.right {
transform: rotate(90deg);
}
</style>