Files
clickhouse-agx/src/lib/PanelState.svelte.ts
2025-01-16 17:22:11 +01:00

23 lines
523 B
TypeScript

import type { Length } from '@rich_harris/svelte-split-pane';
export class PanelState {
open = $state<boolean>()!;
#position = $state<Length>()!;
#disabledPosition: Length;
constructor(pos: Length, open: boolean = true, disabledPosition: Length = '0px') {
this.open = open;
this.#position = pos;
this.#disabledPosition = disabledPosition;
}
get position() {
if (this.open) return this.#position;
return this.#disabledPosition;
}
set position(pos: Length) {
if (this.open) this.#position = pos;
}
}