캔버스 컴포넌트

셀 내용은 렌더 인스트럭션으로 표현합니다. 아래 컴포넌트는 지원됨(캔버스에 완전히 그려짐); 나머지는 추후 구현 예정 스텁입니다.

지원 컴포넌트

컴포넌트설명주요 props
Text한 줄 텍스트value, style?, color?, fontWeight?, fontSize?
Badge배경이 있는 pill/chipvalue, style?, color?, backgroundColor?, borderRadius?
FlexTaffy 호환 flex 컨테이너; 자식 레이아웃 및 그리기children, style?, flexDirection?, gap?, alignItems?, justifyContent?
Box패딩, 마진, 테두리; 자식은 콘텐츠 영역에 세로 스택children?, style?, padding?, margin?, borderWidth?, backgroundColor?
Stackgap이 있는 행/열 레이아웃children?, direction? ("row" | "column"), gap?, style?
Sparklinedata(number[])로 그리는 인라인 미니 라인 차트data, style?, color?, strokeWidth?, variant? ("line" | "area")
Color중앙 정렬 정사각형 색상 견본value (hex), borderRadius?, borderWidth?, borderColor?
Tag테두리가 있는 텍스트 (stroke + text)value, color?, borderColor?, borderRadius?, fontSize?
Rating채워진 ★과 빈 ☆ 별점value, max?, color?, emptyColor?, size?
Chip배경이 있는 pill (닫기 버튼 선택)value, color?, backgroundColor?, borderRadius?, closable?
Link링크 색상 + 밑줄 텍스트; 클릭 시 URL 열기value, href?, color?, underline?, fontSize?

모두 선택적 style 객체를 지원하며, 개별 props가 동일 키일 때 style보다 우선합니다.

Text와 Badge

import React from "react";
import { 
import Text
Text
,
import Badge
Badge
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<> <
import Text
Text
value: string
value
="Hello"
style: {
    color: string;
    fontWeight: string;
}
style
={{
color: string
color
: "#333",
fontWeight: string
fontWeight
: "bold" }} />
<
import Badge
Badge
value: string
value
="active"
style: {
    backgroundColor: string;
    color: string;
}
style
={{
backgroundColor: string
backgroundColor
: "#d1fae5",
color: string
color
: "#065f46" }} />
</> );

Flex (Taffy 레이아웃)

Flex는 레이아웃 엔진과 동일한 스타일 표면을 사용합니다: flexDirection, gap, alignItems, justifyContent, padding, margin, borderWidth, boxSizing 등.

import React from "react";
import { 
import Flex
Flex
,
import Text
Text
,
import Badge
Badge
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<
import Flex
Flex
flexDirection: string
flexDirection
="row"
gap: number
gap
={8}
alignItems: string
alignItems
="center">
<
import Text
Text
value: string
value
="Name" />
<
import Badge
Badge
value: string
value
="New" />
</
import Flex
Flex
>
);

개별 props가 style을 덮어씁니다:

import React from "react";
import { 
import Flex
Flex
,
import Text
Text
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<
import Flex
Flex
style: {
    flexDirection: string;
    gap: number;
}
style
={{
flexDirection: string
flexDirection
: "column",
gap: number
gap
: 8 }}
flexDirection: string
flexDirection
="row"
gap: number
gap
={4}>
<
import Text
Text
value: string
value
="결과: flexDirection = 'row', gap = 4" />
</
import Flex
Flex
>
);

Box와 Stack

  • Box: padding, margin, border; 자식은 콘텐츠 영역에 세로로 쌓임.
  • Stack: gap이 있는 row/column; 레이아웃 버퍼에서 오는 padding 없음.
import React from "react";
import { 
import Box
Box
,
import Stack
Stack
,
import Text
Text
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<> <
import Box
Box
padding: number
padding
={8}
borderWidth: number
borderWidth
={1}
borderColor: string
borderColor
="#eee">
<
import Text
Text
value: string
value
="Inside box" />
</
import Box
Box
>
<
import Stack
Stack
direction: string
direction
="row"
gap: number
gap
={8}>
<
import Text
Text
value: string
value
="A" />
<
import Text
Text
value: string
value
="B" />
</
import Stack
Stack
>
</> );

Sparkline

숫자 배열로 인라인 미니 차트. 캔버스에 그려집니다.

import React from "react";
import { 
import Sparkline
Sparkline
} from "@ohah/react-wasm-table";
Cannot find module '@ohah/react-wasm-table' or its corresponding type declarations.
const
const series: number[]
series
= [10, 20, 15, 30, 25, 40];
export const
const Example: () => React.JSX.Element
Example
= () => (
<
import Sparkline
Sparkline
data: number[]
data
={
const series: number[]
series
}
variant: string
variant
="line"
color: string
color
="#2563eb"
strokeWidth: number
strokeWidth
={2} />
);
import React from "react";
import { 
import Color
Color
,
import Tag
Tag
,
import Rating
Rating
,
import Chip
Chip
,
import Link
Link
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<> <
import Color
Color
value: string
value
="#e53935"
borderRadius: number
borderRadius
={4} />
<
import Tag
Tag
value: string
value
="frontend"
color: string
color
="#1565c0"
borderColor: string
borderColor
="#1565c0" />
<
import Rating
Rating
value: number
value
={4}
max: number
max
={5}
color: string
color
="#f59e0b" />
<
import Chip
Chip
value: string
value
="React"
backgroundColor: string
backgroundColor
="#1976d2"
color: string
color
="#fff" />
<
import Link
Link
value: string
value
="Docs"
href: string
href
="https://example.com"
underline: true
underline
/>
</> );

이벤트 핸들러

모든 캔버스 컴포넌트는 CanvasEventHandlers 인터페이스를 통해 HTMLElement과 동일한 이벤트 핸들러를 지원합니다. 이벤트는 컴포넌트별로 발생하며, 셀 좌표와 네이티브 MouseEvent를 포함하는 GridCellEvent를 받습니다.

핸들러발생 시점
onClick컴포넌트 셀 클릭
onDoubleClick컴포넌트 셀 더블클릭
onMouseDown컴포넌트 셀에서 마우스 버튼 누름
onMouseUp컴포넌트 셀에서 마우스 버튼 놓음
onMouseEnter커서가 컴포넌트 셀에 진입
onMouseLeave커서가 컴포넌트 셀에서 벗어남

실행 순서

이벤트 핸들러는 DOM 시맨틱스를 따르는 3단계 실행 순서로 동작합니다:

  1. 컴포넌트 레벨 — 컴포넌트의 onClick (요소 핸들러)
  2. Grid 레벨 — Grid의 onCellClick prop (부모/버블링)
  3. 렌더러 기본 동작 — 예: Link가 URL 열기

어느 레벨에서든 e.preventDefault()를 호출하면 하위 단계가 차단됩니다.

예제

import React from "react";
import { 
import Link
Link
,
import Chip
Chip
, type
import GridCellEvent
GridCellEvent
} from "@ohah/react-wasm-table";
export const
const Example: () => React.JSX.Element
Example
= () => (
<> {/* preventDefault()로 Link 렌더러의 URL 열기를 차단 */} <
import Link
Link
value: string
value
="Click me"
href: string
href
="https://example.com"
onClick: (e: any) => void
onClick
={(
e: any
e
) => {
e: any
e
.preventDefault();
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("clicked link at",
e: any
e
.cell);
}} /> {/* 호버 이벤트 */} <
import Chip
Chip
value: string
value
="Hover me"
backgroundColor: string
backgroundColor
="#e3f2fd"
color: string
color
="#1565c0"
onMouseEnter: (e: any) => void
onMouseEnter
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("enter",
e: any
e
.cell)}
onMouseLeave: (e: any) => void
onMouseLeave
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("leave",
e: any
e
.cell)}
/> {/* 하나의 컴포넌트에 여러 이벤트 */} <
import Chip
Chip
value: string
value
="All events"
backgroundColor: string
backgroundColor
="#e8f5e9"
color: string
color
="#2e7d32"
onClick: (e: any) => void
onClick
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("click",
e: any
e
.cell)}
onDoubleClick: (e: any) => void
onDoubleClick
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("dblclick",
e: any
e
.cell)}
onMouseDown: (e: any) => void
onMouseDown
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("mousedown",
e: any
e
.cell)}
onMouseUp: (e: any) => void
onMouseUp
={(
e: any
e
) =>
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
  • A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:

console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints error message and stack trace to stderr:
//   Error: Whoops, something bad happened
//     at [eval]:5:15
//     at Script.runInThisContext (node:vm:132:18)
//     at Object.runInThisContext (node:vm:309:38)
//     at node:internal/process/execution:77:19
//     at [eval]-wrapper:6:22
//     at evalScript (node:internal/process/execution:76:60)
//     at node:internal/main/eval_string:23:3

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr

Example using the Console class:

const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

myConsole.log('hello world');
// Prints: hello world, to out
myConsole.log('hello %s', 'world');
// Prints: hello world, to out
myConsole.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err
@seesource
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const count = 5;
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout

See util.format() for more information.

@sincev0 .1.100
log
("mouseup",
e: any
e
.cell)}
/> </> );

인터랙티브 컴포넌트

아래 컴포넌트는 사용자 상호작용을 위해 DOM 오버레이와 통합됩니다:

컴포넌트설명주요 props
Avatar이미지 또는 이니셜이 있는 원형 아바타value, src?, size?, borderRadius?, color?
DatePickerDOM 오버레이 피커가 있는 날짜 입력value, onChange?, format?, style?
DropdownDOM 오버레이 드롭다운이 있는 선택 입력value, options, onChange?, style?