vanilladocs
vanillapunch.com
API / web/pane

web/pane

화면 분할 패널(Pane) 클래스.

Split panel (Pane) class.

PaneStyle

짝Counterpart: vanilla-engine PaneStyle

스타일 및 요소 생성 유틸리티.

Utility for styles and element creation.

예제Example테마 스타일이 적용된 단추 만들기Create a button with the theme style
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);
정적staticstatic apply(el, styles)#0.0.10 부터since 0.0.10소스source

엘리먼트에 여러 스타일을 한꺼번에 적용한다. (엘리먼트나 스타일이 없으면 아무것도 하지 않는다)

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

정적staticstatic create(tagName, preset = "", options = {})#0.0.10 부터since 0.0.10소스source

스타일 프리셋이 적용된 엘리먼트를 만든다.

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

짝Counterpart: vanilla-engine Pane

화면 분할 패널(Pane) 클래스.

Split panel (Pane) class.

예제Example좌우로 나누고 부모 요소에 붙이기Split left and right and attach to a parent element
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());
생성자constructorconstructor(options = {})#0.0.10 부터since 0.0.10소스source

생성.

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

메서드methodaddPane(pane)#0.0.10 부터since 0.0.10소스source

자식 추가.

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

메서드methodupdateLayout(x, y, w, h)#0.0.10 부터since 0.0.10소스source

레이아웃 엔진

Layout engine.

xnumber
왼쪽 자리. (픽셀)The left position. (pixels)
ynumber
위쪽 자리. (픽셀)The top position. (pixels)
wnumber
너비. (픽셀)Width. (pixels)
hnumber
높이. (픽셀)Height. (pixels)

짝Counterpart: vanilla-engine Pane.update_layout

메서드methodresetLayout()#0.0.10 부터since 0.0.10소스source

레이아웃 초기화 (드래그한 크기 삭제)

Resets the layout. (discards dragged sizes)

짝Counterpart: vanilla-engine Pane.reset_layout

메서드methodrefresh()#0.0.10 부터since 0.0.10소스source

부모 요소의 크기로 다시 배치. (부모가 없으면 아무것도 하지 않는다)

Lays out again with the parent element's size. (does nothing if there is no parent)

짝Counterpart: vanilla-engine Pane.refresh

메서드methodattachTo(p)#0.0.10 부터since 0.0.10소스source

부모 요소에 붙이기. (창 크기가 바뀔 때마다 다시 배치한다)

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

메서드methodsetVisible(isVisible)#0.3.2 부터since 0.3.2소스source

보이기 / 숨기기. (숨긴 패널은 자리를 차지하지 않고, 맞닿은 리사이저도 숨는다)

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

메서드methodisVisible()#0.3.2 부터since 0.3.2소스source

보이는지 반환.

Returns whether it is visible.

반환Returnsboolean 보이면 참.True if visible.

짝Counterpart: vanilla-engine Pane.is_visible

메서드methodisFlex()#0.0.10 부터since 0.0.10소스source

남는 자리를 나눠 갖는지 반환. (처음 크기가 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

메서드methodgetInitialSize()#0.0.10 부터since 0.0.10소스source

처음 크기 반환. (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

메서드methodgetFixedSize()#0.0.10 부터since 0.0.10소스source

정해진 크기 반환. (끌어서 정했거나 처음 크기가 픽셀이면 그 값, 아니면 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

메서드methodsetFixedSize(s)#0.0.10 부터since 0.0.10소스source

정해진 크기 설정. (픽셀)

Sets the decided size. (pixels)

snumber
정해 둘 크기. (픽셀)The size to decide. (pixels)

짝Counterpart: vanilla-engine Pane.set_fixed_size

메서드methodgetMinSize()#0.0.10 부터since 0.0.10소스source

가장 작은 크기 반환. (픽셀)

Returns the smallest size. (pixels)

반환Returnsnumber 가장 작은 크기. (픽셀)The smallest size. (pixels)

짝Counterpart: vanilla-engine Pane.get_min_size

메서드methodgetMaxSize()#0.0.10 부터since 0.0.10소스source

가장 큰 크기 반환. (픽셀)

Returns the largest size. (pixels)

반환Returnsnumber 가장 큰 크기. (픽셀)Largest size. (pixels)

짝Counterpart: vanilla-engine Pane.get_max_size

메서드methodgetContainer()#0.0.10 부터since 0.0.10소스source

컨테이너 요소 반환.

Returns the container element.

반환ReturnsHTMLElement 컨테이너 요소.The container element.

짝Counterpart: vanilla-engine Pane.get_container

메서드methodsetCallback(c)#0.0.10 부터since 0.0.10소스source

배치가 바뀔 때마다 부를 함수 설정.

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

메서드methodisResizable()#0.0.10 부터since 0.0.10소스source

크기를 조절할 수 있는지 반환.

Returns whether the size can be resized.

반환Returnsboolean 크기를 조절할 수 있으면 참.True if the size can be resized.

짝Counterpart: vanilla-engine Pane.is_resizable

메서드methodgetResizableEdges()#0.0.10 부터since 0.0.10소스source

조절할 수 있는 가장자리 반환. ({ 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

짝Counterpart: vanilla-engine PaneTheme

테마 상수 정의.

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.