- B06_Section_Router.py(824) → Router_Design.py(139) 분리 - Cross_View → Cross_View_Metrics.ts(75) 분리 - Cross_Design → Cross_Design_Surface.ts(54) 분리 - Section_View → Section_View_Panel.ts(53) 분리 - Page → Page_Common.ts(15) 분리 - Style_Cross.css → Style_Cross_Controls.css(174) 분리 - B06_Section/ 전체 700줄 초과 0건 검증: tsc --noEmit 통과 · ruff check 통과(import 정렬·포맷 적용) · prettier 적용 · pytest tmp/tests/ 148 passed, 7 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import {
|
|
MASS_HAUL_BALANCE_KEY,
|
|
MASS_HAUL_DEFAULT_VISIBLE,
|
|
normalizeVisibleBasis,
|
|
} from "@util/common_util_mass_haul";
|
|
import { MASS_HAUL_HEIGHT, MASS_HAUL_MIN_HEIGHT } from "@util/common_util_mass_haul_view";
|
|
import { LONG_HEIGHT } from "./B06_Section_UI_Section_Common";
|
|
|
|
export const PANEL_CHROME_PX = 102;
|
|
export const BASE_PANEL_HEIGHT = LONG_HEIGHT + MASS_HAUL_HEIGHT + PANEL_CHROME_PX;
|
|
export const MIN_LONG_HEIGHT = 110;
|
|
export const MIN_PANEL_HEIGHT = MIN_LONG_HEIGHT + MASS_HAUL_MIN_HEIGHT + PANEL_CHROME_PX;
|
|
export const MAX_PANEL_HEIGHT_RATIO = 0.8;
|
|
export const PANEL_HEIGHT_KEY = "b06:profile-panel-height";
|
|
export const PANEL_COLLAPSED_KEY = "b06:profile-panel-collapsed";
|
|
export const MASS_HAUL_VISIBLE_KEY = "b06:masshaul-visible-v4";
|
|
|
|
const DEFAULT_VISIBLE_KEYS = [...MASS_HAUL_DEFAULT_VISIBLE, MASS_HAUL_BALANCE_KEY];
|
|
|
|
export function readVisibleSeries(): Set<string> {
|
|
try {
|
|
const raw = sessionStorage.getItem(MASS_HAUL_VISIBLE_KEY);
|
|
if (!raw) return new Set(DEFAULT_VISIBLE_KEYS);
|
|
const parsed: unknown = JSON.parse(raw);
|
|
return Array.isArray(parsed)
|
|
? normalizeVisibleBasis(new Set(parsed.map(String)))
|
|
: new Set(DEFAULT_VISIBLE_KEYS);
|
|
} catch {
|
|
return new Set(DEFAULT_VISIBLE_KEYS);
|
|
}
|
|
}
|
|
|
|
export function chartHeights(availableHeightPx: number): { long: number; mass: number } {
|
|
if (!Number.isFinite(availableHeightPx) || availableHeightPx <= 0) {
|
|
return { long: LONG_HEIGHT, mass: MASS_HAUL_HEIGHT };
|
|
}
|
|
const available = Math.max(availableHeightPx, MIN_LONG_HEIGHT + MASS_HAUL_MIN_HEIGHT);
|
|
if (available >= LONG_HEIGHT + MASS_HAUL_HEIGHT) {
|
|
return { long: LONG_HEIGHT, mass: available - LONG_HEIGHT };
|
|
}
|
|
const ratio = available / (LONG_HEIGHT + MASS_HAUL_HEIGHT);
|
|
const mass = Math.min(
|
|
Math.max(MASS_HAUL_MIN_HEIGHT, Math.round(MASS_HAUL_HEIGHT * ratio)),
|
|
available - MIN_LONG_HEIGHT,
|
|
);
|
|
return { long: available - mass, mass };
|
|
}
|
|
|
|
export function unwrapChart(node: HTMLElement): Element {
|
|
return node.classList.contains("b06-section__chart-wrap") && node.firstElementChild
|
|
? node.firstElementChild
|
|
: node;
|
|
}
|