web/pane
화면 분할 패널(Pane) 클래스.
Split panel (Pane) class.
PaneStyle
스타일 및 요소 생성 유틸리티.
Utility for styles and element creation.
import { PaneStyle, PaneTheme } from "./build/vanilla.js";
const button = PaneStyle.create("button", "button", { text: "OK", accent: true });
PaneStyle.apply(button, { margin: "8px" });
document.body.appendChild(button);
console.log(button.style.margin, PaneTheme.color.accent);엘리먼트에 여러 스타일을 한꺼번에 적용한다. (엘리먼트나 스타일이 없으면 아무것도 하지 않는다)
Applies several styles to an element at once. (does nothing if the element or the styles are missing)
- elHTMLElement
- 스타일을 적용할 엘리먼트.The element to apply the styles to.
- stylesObject
- 적용할 CSS 속성 이름과 값. (camelCase)CSS property names and values to apply. (camelCase)
짝Counterpart: vanilla-engine PaneStyle.apply
스타일 프리셋이 적용된 엘리먼트를 만든다.
Creates an element with a style preset applied.
- tagNamestring
- 만들 태그 이름.The tag name to create.
- presetstring
- 프리셋 이름. ("panel", "toolbar", "button", "input", "textarea", "text", 빈 글이면 공통 스타일만)The preset name. ("panel", "toolbar", "button", "input", "textarea", "text", or empty for the common style only)
- optionsObject
- { id, text, style, type, placeholder, accent, warning }. (accent 나 warning 이 참인 단추는 그 색 바탕){ id, text, style, type, placeholder, accent, warning }. (a button with accent or warning true gets that color as its background)
반환ReturnsHTMLElement 만든 엘리먼트.The created element.
짝Counterpart: vanilla-engine PaneStyle.create
Pane
화면 분할 패널(Pane) 클래스.
Split panel (Pane) class.
import { Pane } from "./build/vanilla.js";
const rootPane = new Pane({ direction: "horizontal" });
const leftPane = new Pane({ size: 200, minSize: 100 });
const rightPane = new Pane({ size: "flex" });
rootPane.addPane(leftPane);
rootPane.addPane(rightPane);
rootPane.attachTo(document.body);
console.log(leftPane.getInitialSize(), rightPane.isFlex(), leftPane.getMinSize());생성.
Constructor.
- options{ direction?: string, size?: number | string, minSize?: number, maxSize?: number, isResizable?: boolean, resizableEdges?: { top: boolean, bottom: boolean, left: boolean, right: boolean } }
- 나누는 방향(horizontal 이나 vertical), 처음 크기(픽셀, 1 이하의 비율, 퍼센트 글, flex), 가장 작고 큰 크기, 조절 가능 여부와 가장자리.The split direction (horizontal or vertical), the initial size (pixels, a ratio of 1 or less, a percent string, or flex), the smallest and largest size, whether it can be resized and which edges.
짝Counterpart: vanilla-engine Pane.new
자식 추가.
Adds a child.
- panePane
- 자식으로 붙일 패널. (앞 자식과의 사이에 리사이저가 생긴다)The panel to attach as a child. (a resizer appears between it and the previous child)
짝Counterpart: vanilla-engine Pane.add_pane
레이아웃 엔진
Layout engine.
- xnumber
- 왼쪽 자리. (픽셀)The left position. (pixels)
- ynumber
- 위쪽 자리. (픽셀)The top position. (pixels)
- wnumber
- 너비. (픽셀)Width. (pixels)
- hnumber
- 높이. (픽셀)Height. (pixels)
짝Counterpart: vanilla-engine Pane.update_layout
레이아웃 초기화 (드래그한 크기 삭제)
Resets the layout. (discards dragged sizes)
짝Counterpart: vanilla-engine Pane.reset_layout
부모 요소의 크기로 다시 배치. (부모가 없으면 아무것도 하지 않는다)
Lays out again with the parent element's size. (does nothing if there is no parent)
짝Counterpart: vanilla-engine Pane.refresh
부모 요소에 붙이기. (창 크기가 바뀔 때마다 다시 배치한다)
Attaches to a parent element. (lays out again every time the window size changes)
- pHTMLElement
- 붙일 부모 요소.The parent element to attach to.
짝Counterpart: vanilla-engine Pane.attach_to
보이기 / 숨기기. (숨긴 패널은 자리를 차지하지 않고, 맞닿은 리사이저도 숨는다)
Shows and hides. (a hidden panel takes no space, and the resizers next to it hide too)
- isVisibleboolean
- 보이면 참, 숨기면 거짓.True to show, false to hide.
짝Counterpart: vanilla-engine Pane.set_visible
보이는지 반환.
Returns whether it is visible.
반환Returnsboolean 보이면 참.True if visible.
짝Counterpart: vanilla-engine Pane.is_visible
남는 자리를 나눠 갖는지 반환. (처음 크기가 0 이면 참)
Returns whether it shares the remaining space. (true when the initial size is 0)
반환Returnsboolean 남는 자리를 나눠 가지면 참.True if it shares the remaining space.
짝Counterpart: vanilla-engine Pane.is_flex
처음 크기 반환. (1 이하이면 부모에 대한 비율, 넘으면 픽셀)
Returns the initial size. (a ratio of the parent if 1 or less, pixels if more)
반환Returnsnumber 처음 크기. (1 이하이면 부모에 대한 비율, 넘으면 픽셀)The initial size. (a ratio of the parent if 1 or less, pixels if more)
짝Counterpart: vanilla-engine Pane.get_initial_size
정해진 크기 반환. (끌어서 정했거나 처음 크기가 픽셀이면 그 값, 아니면 0)
Returns the decided size. (the value if it was set by dragging or the initial size is in pixels, otherwise 0)
반환Returnsnumber 정해진 크기. (픽셀, 정해진 것이 없으면 0)The decided size. (pixels, 0 if none is decided)
짝Counterpart: vanilla-engine Pane.get_fixed_size
정해진 크기 설정. (픽셀)
Sets the decided size. (pixels)
- snumber
- 정해 둘 크기. (픽셀)The size to decide. (pixels)
짝Counterpart: vanilla-engine Pane.set_fixed_size
가장 작은 크기 반환. (픽셀)
Returns the smallest size. (pixels)
반환Returnsnumber 가장 작은 크기. (픽셀)The smallest size. (pixels)
짝Counterpart: vanilla-engine Pane.get_min_size
가장 큰 크기 반환. (픽셀)
Returns the largest size. (pixels)
반환Returnsnumber 가장 큰 크기. (픽셀)Largest size. (pixels)
짝Counterpart: vanilla-engine Pane.get_max_size
컨테이너 요소 반환.
Returns the container element.
반환ReturnsHTMLElement 컨테이너 요소.The container element.
짝Counterpart: vanilla-engine Pane.get_container
배치가 바뀔 때마다 부를 함수 설정.
Sets the function to call every time the layout changes.
- cFunction | null
- 배치가 바뀔 때마다 부를 함수.The function to call every time the layout changes.
짝Counterpart: vanilla-engine Pane.set_callback
크기를 조절할 수 있는지 반환.
Returns whether the size can be resized.
반환Returnsboolean 크기를 조절할 수 있으면 참.True if the size can be resized.
짝Counterpart: vanilla-engine Pane.is_resizable
조절할 수 있는 가장자리 반환. ({ top, right, bottom, left })
Returns the edges that can be resized. ({ top, right, bottom, left })
반환Returns{ top: boolean, bottom: boolean, left: boolean, right: boolean } 조절할 수 있는 가장자리.The edges that can be resized.
짝Counterpart: vanilla-engine Pane.get_resizable_edges
PaneThemeenum
테마 상수 정의.
Theme constants.
| 이름Name | 값Value | 설명Description |
|---|---|---|
color | { background: "#1e1e1e", panel: "#252526", toolbar: "#2d2d30", border: "#444", text: "#ccc", textDim: "#aaaaaa", accent: "#0e639c", accentHover: "#1177bb", warning: "#d97706", warningHover: "#f59e0b", error: "#f44336", success: "#4CAF50", inputBg: "#3c3c3c", resizer: "#333", resizerHover: "#007acc" } | 색. (CSS 색 글)Colors. (CSS color strings) |
size | { resizer: 5 } | 크기. (픽셀)Size. (pixels) |
font | { family: "sans-serif", mono: "\"Consolas\", monospace", size: "13px", sizeSmall: "12px" } | 글꼴과 글 크기.Font and font size. |