@web-canvas-ui/angular 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1198 -2
- package/index.js +5349 -0
- package/package.json +40 -5
- package/theme.css +327 -0
- package/types/angular/Canvas.d.ts +42 -0
- package/types/angular/index.d.ts +5 -0
- package/types/angular/node-directives.d.ts +367 -0
- package/types/canvas-handle.d.ts +22 -0
- package/types/components/Button/button.d.ts +22 -0
- package/types/components/Button/index.d.ts +3 -0
- package/types/components/Button/logic.d.ts +3 -0
- package/types/components/CanvasView/canvasView.d.ts +28 -0
- package/types/components/CanvasView/index.d.ts +2 -0
- package/types/components/Carousel/carousel.d.ts +31 -0
- package/types/components/Carousel/index.d.ts +3 -0
- package/types/components/Carousel/logic.d.ts +2 -0
- package/types/components/Checkbox/checkbox.d.ts +8 -0
- package/types/components/Checkbox/index.d.ts +2 -0
- package/types/components/ChoiceGroup/choiceGroup.d.ts +38 -0
- package/types/components/ChoiceGroup/index.d.ts +3 -0
- package/types/components/ChoiceGroup/logic.d.ts +3 -0
- package/types/components/Circle/circle.d.ts +9 -0
- package/types/components/Circle/index.d.ts +2 -0
- package/types/components/Collapse/collapse.d.ts +32 -0
- package/types/components/Collapse/index.d.ts +3 -0
- package/types/components/Collapse/logic.d.ts +1 -0
- package/types/components/CustomDraw/customDraw.d.ts +22 -0
- package/types/components/CustomDraw/index.d.ts +2 -0
- package/types/components/DatePicker/datePicker.d.ts +24 -0
- package/types/components/DatePicker/index.d.ts +2 -0
- package/types/components/Dialog/dialog.d.ts +20 -0
- package/types/components/Dialog/index.d.ts +2 -0
- package/types/components/Dropdown/dropdown.d.ts +30 -0
- package/types/components/Dropdown/index.d.ts +3 -0
- package/types/components/Dropdown/logic.d.ts +5 -0
- package/types/components/Form/form.d.ts +42 -0
- package/types/components/Form/index.d.ts +2 -0
- package/types/components/Grid/grid.d.ts +14 -0
- package/types/components/Grid/index.d.ts +2 -0
- package/types/components/GridItem/gridItem.d.ts +8 -0
- package/types/components/GridItem/index.d.ts +2 -0
- package/types/components/Group/group.d.ts +5 -0
- package/types/components/Group/index.d.ts +2 -0
- package/types/components/Icon/icon.d.ts +14 -0
- package/types/components/Icon/index.d.ts +2 -0
- package/types/components/Image/image.d.ts +12 -0
- package/types/components/Image/index.d.ts +2 -0
- package/types/components/Input/index.d.ts +2 -0
- package/types/components/Input/input.d.ts +32 -0
- package/types/components/Progress/index.d.ts +2 -0
- package/types/components/Progress/progress.d.ts +15 -0
- package/types/components/Radio/index.d.ts +2 -0
- package/types/components/Radio/radio.d.ts +8 -0
- package/types/components/Rect/index.d.ts +2 -0
- package/types/components/Rect/rect.d.ts +11 -0
- package/types/components/Slider/index.d.ts +3 -0
- package/types/components/Slider/logic.d.ts +1 -0
- package/types/components/Slider/slider.d.ts +17 -0
- package/types/components/Switch/index.d.ts +3 -0
- package/types/components/Switch/logic.d.ts +2 -0
- package/types/components/Switch/switch.d.ts +14 -0
- package/types/components/Tabs/index.d.ts +3 -0
- package/types/components/Tabs/logic.d.ts +2 -0
- package/types/components/Tabs/tabs.d.ts +35 -0
- package/types/components/Text/index.d.ts +2 -0
- package/types/components/Text/text.d.ts +39 -0
- package/types/components/Textarea/index.d.ts +2 -0
- package/types/components/Textarea/textarea.d.ts +10 -0
- package/types/components/Upload/index.d.ts +2 -0
- package/types/components/Upload/upload.d.ts +30 -0
- package/types/components/Video/index.d.ts +4 -0
- package/types/components/Video/logic.d.ts +56 -0
- package/types/components/Video/video.d.ts +54 -0
- package/types/components/draw-utils.d.ts +48 -0
- package/types/components/shared.d.ts +7 -0
- package/types/components/size.d.ts +6 -0
- package/types/components/types.d.ts +29 -0
- package/types/engine/accessibility.d.ts +5 -0
- package/types/engine/carousel.d.ts +10 -0
- package/types/engine/events.d.ts +14 -0
- package/types/engine/forms.d.ts +21 -0
- package/types/engine/hit-test.d.ts +31 -0
- package/types/engine/images.d.ts +8 -0
- package/types/engine/interaction.d.ts +12 -0
- package/types/engine/layout.d.ts +6 -0
- package/types/engine/nodes.d.ts +19 -0
- package/types/engine/state.d.ts +91 -0
- package/types/engine/text-controls.d.ts +10 -0
- package/types/engine/transform.d.ts +13 -0
- package/types/engine/uploads.d.ts +5 -0
- package/types/engine/videos.d.ts +28 -0
- package/types/engine/vnodes.d.ts +36 -0
- package/types/engine.d.ts +38 -0
- package/types/image-assets.d.ts +2 -0
- package/types/input-bridge.d.ts +54 -0
- package/types/renderer.d.ts +20 -0
- package/types/scene.d.ts +15 -0
- package/types/types.d.ts +162 -0
- package/types/video-assets.d.ts +28 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface CustomDrawSize {
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CustomDrawClickEvent extends CustomDrawSize {
|
|
7
|
+
readonly x: number;
|
|
8
|
+
readonly y: number;
|
|
9
|
+
readonly canvasX: number;
|
|
10
|
+
readonly canvasY: number;
|
|
11
|
+
readonly pointerId: number;
|
|
12
|
+
}
|
|
13
|
+
export type CustomDrawHitTest = (x: number, y: number, size: CustomDrawSize) => boolean;
|
|
14
|
+
export interface CustomDrawProps extends TransformProps {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
draw: (context: CanvasRenderingContext2D, size: CustomDrawSize) => void;
|
|
18
|
+
onClick?: (event: CustomDrawClickEvent) => void;
|
|
19
|
+
hitTest?: CustomDrawHitTest;
|
|
20
|
+
}
|
|
21
|
+
export declare const CustomDraw: import("../shared").MarkedComponent<CustomDrawProps>;
|
|
22
|
+
export declare function drawCustomDraw(context: CanvasRenderingContext2D, props: CustomDrawProps): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface DatePickerProps extends TransformProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
fontSize?: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
focusBorderColor?: string;
|
|
13
|
+
borderRadius?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
onFocus?: () => void;
|
|
17
|
+
onBlur?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const DatePicker: import("../shared").MarkedComponent<DatePickerProps>;
|
|
20
|
+
/** Public props plus the engine-injected focus state consumed by the draw layer. */
|
|
21
|
+
export type DatePickerDrawProps = DatePickerProps & {
|
|
22
|
+
focused?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function drawDatePicker(context: CanvasRenderingContext2D, props: DatePickerDrawProps): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface DialogProps extends TransformProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
title?: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
closeOnBackdrop?: boolean;
|
|
10
|
+
children?: unknown;
|
|
11
|
+
onConfirm?: () => void;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const Dialog: import("../shared").MarkedComponent<DialogProps>;
|
|
15
|
+
/** Public props plus the engine-injected viewport size consumed by the draw layer. */
|
|
16
|
+
export type DialogDrawProps = DialogProps & {
|
|
17
|
+
_viewportWidth?: number;
|
|
18
|
+
_viewportHeight?: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function drawDialog(context: CanvasRenderingContext2D, props: DialogDrawProps): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface DropdownOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DropdownProps extends TransformProps {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
options: Array<string | DropdownOption>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
color?: string;
|
|
17
|
+
bgColor?: string;
|
|
18
|
+
borderColor?: string;
|
|
19
|
+
focusBorderColor?: string;
|
|
20
|
+
borderRadius?: number;
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const Dropdown: import("../shared").MarkedComponent<DropdownProps>;
|
|
24
|
+
/** Public props plus the engine-injected focus/open state consumed by the draw layer. */
|
|
25
|
+
export type DropdownDrawProps = DropdownProps & {
|
|
26
|
+
focused?: boolean;
|
|
27
|
+
open?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function drawDropdown(context: CanvasRenderingContext2D, props: DropdownDrawProps): void;
|
|
30
|
+
export declare function drawDropdownOptions(context: CanvasRenderingContext2D, props: DropdownDrawProps): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DropdownOption } from './dropdown';
|
|
2
|
+
import type { SceneNode } from '../../scene';
|
|
3
|
+
export declare function normalizeDropdownOptions(value: unknown): DropdownOption[];
|
|
4
|
+
export declare function dropdownOptionAt(value: unknown, index: number): DropdownOption | undefined;
|
|
5
|
+
export declare function selectDropdownOption(node: SceneNode, option: DropdownOption): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export type FormValue = string | number | boolean | string[] | File[];
|
|
3
|
+
export type FormValues = Record<string, FormValue>;
|
|
4
|
+
export type FormErrors = Record<string, string>;
|
|
5
|
+
export interface FormController {
|
|
6
|
+
getValues(): FormValues;
|
|
7
|
+
getFieldValue(name: string): FormValue;
|
|
8
|
+
setFieldValue(name: string, value: FormValue): void;
|
|
9
|
+
}
|
|
10
|
+
export interface FormBinding extends FormController {
|
|
11
|
+
owner: object;
|
|
12
|
+
}
|
|
13
|
+
export declare function createFormController(): FormController;
|
|
14
|
+
export declare function bindFormController(controller: FormController, binding: FormBinding): void;
|
|
15
|
+
export declare function unbindFormController(controller: FormController, owner: object): void;
|
|
16
|
+
export interface FormRule {
|
|
17
|
+
required?: boolean;
|
|
18
|
+
minLength?: number;
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
pattern?: RegExp;
|
|
21
|
+
validator?: (value: FormValue, values: Readonly<FormValues>) => string | undefined | Promise<string | undefined>;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FormProps extends TransformProps {
|
|
25
|
+
children?: unknown;
|
|
26
|
+
initialValues?: FormValues;
|
|
27
|
+
controller?: FormController;
|
|
28
|
+
onSubmit?: (values: FormValues) => void;
|
|
29
|
+
onInvalid?: (errors: FormErrors, values: FormValues) => void;
|
|
30
|
+
onValuesChange?: (values: FormValues) => void;
|
|
31
|
+
onReset?: () => void;
|
|
32
|
+
}
|
|
33
|
+
export interface FormItemProps extends TransformProps {
|
|
34
|
+
children?: unknown;
|
|
35
|
+
name: string;
|
|
36
|
+
rules?: FormRule[];
|
|
37
|
+
errorY?: number;
|
|
38
|
+
errorColor?: string;
|
|
39
|
+
errorFontSize?: number;
|
|
40
|
+
}
|
|
41
|
+
export declare const Form: import("../shared").MarkedComponent<FormProps>;
|
|
42
|
+
export declare const FormItem: import("../shared").MarkedComponent<FormItemProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface GridProps extends TransformProps {
|
|
3
|
+
columns: number;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
cellWidth?: number;
|
|
7
|
+
cellHeight: number;
|
|
8
|
+
gap?: number;
|
|
9
|
+
/** Render only items near the viewport. Requires height; offscreen items are unmounted. */
|
|
10
|
+
virtual?: boolean;
|
|
11
|
+
children?: unknown;
|
|
12
|
+
onScroll?: (scrollTop: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const Grid: import("../shared").MarkedComponent<GridProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface GridItemProps extends TransformProps {
|
|
3
|
+
columnSpan?: number;
|
|
4
|
+
rowSpan?: number;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
children?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare const GridItem: import("../shared").MarkedComponent<GridItemProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export declare const ICON_NAMES: readonly ["home", "house", "building", "apartment", "store", "mapPin", "map", "globe", "compass", "navigation", "flag", "mountain", "tree", "leaf", "flower", "sun", "moon", "cloud", "rain", "snow", "fire", "water", "wind", "car", "bus", "train", "plane", "bicycle", "ship", "rocket", "truck", "walk", "phone", "message", "mail", "bell", "calendar", "clock", "alarm", "camera", "image", "video", "music", "microphone", "headphones", "play", "pause", "stop", "record", "volume", "wifi", "bluetooth", "battery", "signal", "power", "monitor", "laptop", "tablet", "keyboard", "mouse", "printer", "folder", "file", "document", "download", "upload", "share", "link", "search", "settings", "sliders", "menu", "close", "check", "plus", "minus", "edit", "trash", "copy", "save", "lock", "unlock", "key", "user", "users", "heart", "star", "bookmark", "cart", "bag", "gift", "creditCard", "wallet", "chart", "pieChart", "barChart", "analytics", "shield", "warning", "info", "help", "question", "tag", "puzzle", "code", "database", "cloudDownload"];
|
|
3
|
+
export type IconName = (typeof ICON_NAMES)[number];
|
|
4
|
+
export type IconVariant = 'outline' | 'solid';
|
|
5
|
+
export interface IconProps extends TransformProps {
|
|
6
|
+
name: IconName;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
variant?: IconVariant;
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const Icon: import("../shared").MarkedComponent<IconProps>;
|
|
14
|
+
export declare function drawIcon(context: CanvasRenderingContext2D, props: IconProps): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
import { type MediaObjectFit } from '../draw-utils';
|
|
3
|
+
export interface ImageProps extends TransformProps {
|
|
4
|
+
src: string;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
objectFit?: MediaObjectFit;
|
|
8
|
+
onError?: (error: Error) => void;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Image: import("../shared").MarkedComponent<ImageProps>;
|
|
12
|
+
export declare function drawImage(context: CanvasRenderingContext2D, props: ImageProps): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface InputProps extends TransformProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
fontSize?: number;
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
bgColor?: string;
|
|
12
|
+
borderColor?: string;
|
|
13
|
+
focusBorderColor?: string;
|
|
14
|
+
borderRadius?: number;
|
|
15
|
+
padding?: number;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
maxLength?: number;
|
|
18
|
+
type?: 'text' | 'password' | 'number';
|
|
19
|
+
onChange?: (value: string) => void;
|
|
20
|
+
onFocus?: () => void;
|
|
21
|
+
onBlur?: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const Input: import("../shared").MarkedComponent<InputProps>;
|
|
24
|
+
/** Public props plus the engine-injected caret/scroll state consumed by the draw layer. */
|
|
25
|
+
export type InputDrawProps = InputProps & {
|
|
26
|
+
focused?: boolean;
|
|
27
|
+
cursorPos?: number;
|
|
28
|
+
_scrollTop?: number;
|
|
29
|
+
_scrollHeight?: number;
|
|
30
|
+
_scrollClientWidth?: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function drawInput(context: CanvasRenderingContext2D, props: InputDrawProps, multiline?: boolean): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface ProgressProps extends TransformProps {
|
|
3
|
+
value: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
trackColor?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
borderRadius?: number;
|
|
12
|
+
showText?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Progress: import("../shared").MarkedComponent<ProgressProps>;
|
|
15
|
+
export declare function drawProgress(context: CanvasRenderingContext2D, props: ProgressProps): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ChoiceGroupProps } from '../ChoiceGroup';
|
|
2
|
+
export interface RadioProps extends ChoiceGroupProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Radio: import("../shared").MarkedComponent<RadioProps>;
|
|
8
|
+
export declare function drawRadio(context: CanvasRenderingContext2D, props: RadioProps): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface RectProps extends TransformProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
radius?: number;
|
|
7
|
+
stroke?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const Rect: import("../shared").MarkedComponent<RectProps>;
|
|
11
|
+
export declare function drawRect(context: CanvasRenderingContext2D, props: RectProps): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sliderValueAt(props: Record<string, unknown>, width: number, localX: number): number | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface SliderProps extends TransformProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
value?: number;
|
|
9
|
+
defaultValue?: number;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
trackColor?: string;
|
|
12
|
+
activeColor?: string;
|
|
13
|
+
thumbColor?: string;
|
|
14
|
+
onChange?: (value: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const Slider: import("../shared").MarkedComponent<SliderProps>;
|
|
17
|
+
export declare function drawSlider(context: CanvasRenderingContext2D, props: SliderProps): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface SwitchProps extends TransformProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
onColor?: string;
|
|
9
|
+
offColor?: string;
|
|
10
|
+
thumbColor?: string;
|
|
11
|
+
onChange?: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const Switch: import("../shared").MarkedComponent<SwitchProps>;
|
|
14
|
+
export declare function drawSwitch(context: CanvasRenderingContext2D, props: SwitchProps): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
import type { ComponentSize } from '../size';
|
|
3
|
+
export interface TabsProps extends TransformProps {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
activeKey?: string;
|
|
7
|
+
defaultActiveKey?: string;
|
|
8
|
+
headerHeight?: number;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
activeColor?: string;
|
|
12
|
+
indicatorColor?: string;
|
|
13
|
+
children?: unknown;
|
|
14
|
+
onChange?: (key: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface TabItemProps extends TransformProps {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
size?: ComponentSize;
|
|
21
|
+
children?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export declare const Tabs: import("../shared").MarkedComponent<TabsProps>;
|
|
24
|
+
export declare const TabItem: import("../shared").MarkedComponent<TabItemProps>;
|
|
25
|
+
/** A tab header entry injected by the engine for the draw layer. */
|
|
26
|
+
export interface TabItemView {
|
|
27
|
+
title: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
selected?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Public props plus the engine-injected header model consumed by the draw layer. */
|
|
32
|
+
export type TabsDrawProps = TabsProps & {
|
|
33
|
+
_tabItems?: TabItemView[];
|
|
34
|
+
};
|
|
35
|
+
export declare function drawTabs(context: CanvasRenderingContext2D, props: TabsDrawProps): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
export interface TextProps extends TransformProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
children?: never;
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
/** Wrap width. Falls back to the box the parent container hands down when unset. */
|
|
7
|
+
width?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of wrapped lines; the last one is cut with an ellipsis. Falls back to the number
|
|
10
|
+
* of lines that fit the container's box, and to "no limit" when neither is declared.
|
|
11
|
+
*/
|
|
12
|
+
maxLines?: number;
|
|
13
|
+
fontFamily?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
baseline?: CanvasTextBaseline;
|
|
16
|
+
textAlign?: CanvasTextAlign;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface TextBox {
|
|
20
|
+
lines: string[];
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
/** Public props plus the content box a parent container hands down to this node. */
|
|
25
|
+
export type TextDrawProps = TextProps & {
|
|
26
|
+
_availableWidth?: number;
|
|
27
|
+
_availableHeight?: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const Text: import("../shared").MarkedComponent<TextProps>;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves `props` into the lines it renders and the box they occupy. {@link drawText} paints these
|
|
32
|
+
* lines and the layout pass sizes the node from the same result, so a Text node's reported height can
|
|
33
|
+
* never disagree with the glyphs it actually draws.
|
|
34
|
+
*
|
|
35
|
+
* A box handed down by the container is the fallback, not the override: declaring `width` or
|
|
36
|
+
* `maxLines` keeps the author in charge, so a node can stay narrower than its cell on purpose.
|
|
37
|
+
*/
|
|
38
|
+
export declare function measureTextBox(props: TextDrawProps): TextBox;
|
|
39
|
+
export declare function drawText(context: CanvasRenderingContext2D, props: TextDrawProps): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InputProps, InputDrawProps } from '../Input';
|
|
2
|
+
export interface TextareaProps extends Omit<InputProps, 'type'> {
|
|
3
|
+
rows?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const Textarea: import("../shared").MarkedComponent<TextareaProps>;
|
|
6
|
+
/** Public props plus the engine-injected caret/scroll state consumed by the draw layer. */
|
|
7
|
+
export type TextareaDrawProps = Omit<InputDrawProps, 'type'> & {
|
|
8
|
+
rows?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function drawTextarea(context: CanvasRenderingContext2D, props: TextareaDrawProps): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TransformProps } from '../../types';
|
|
2
|
+
import { type IconName } from '../Icon';
|
|
3
|
+
export interface UploadProps extends TransformProps {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
text?: string;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
iconSize?: number;
|
|
9
|
+
accept?: string;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
value?: File[];
|
|
12
|
+
defaultValue?: File[];
|
|
13
|
+
maxSize?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
textColor?: string;
|
|
17
|
+
borderColor?: string;
|
|
18
|
+
borderRadius?: number;
|
|
19
|
+
fontSize?: number;
|
|
20
|
+
onChange?: (files: File[]) => void;
|
|
21
|
+
onReject?: (files: UploadRejection[]) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface UploadRejection {
|
|
24
|
+
file: File;
|
|
25
|
+
reason: 'type' | 'size';
|
|
26
|
+
}
|
|
27
|
+
export declare const UPLOAD_ROW_HEIGHT = 28;
|
|
28
|
+
export declare function uploadHeight(props: Record<string, unknown>): number;
|
|
29
|
+
export declare const Upload: import("../shared").MarkedComponent<UploadProps>;
|
|
30
|
+
export declare function drawUpload(context: CanvasRenderingContext2D, props: UploadProps): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Video, drawVideo, applyVideoControl } from './video';
|
|
2
|
+
export { formatVideoTime, seekVideoTime, toggleVideoPlayback, videoControlsLayout, videoControlsRegion, videoSeekRatio, VIDEO_CONTROLS_FONT, } from './logic';
|
|
3
|
+
export type { VideoProps, VideoDrawProps } from './video';
|
|
4
|
+
export type { VideoControlsLayout } from './logic';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure geometry and playback helpers for the `<Video>` controls bar. Drawing, hit testing and
|
|
3
|
+
* pointer handling all resolve the same rectangles from here, so what the user sees is exactly
|
|
4
|
+
* what the user clicks.
|
|
5
|
+
*/
|
|
6
|
+
/** Font of the controls bar's time text; every pass that measures it must share this string so
|
|
7
|
+
* the text width (and therefore the seek track extent) is identical in draw and hit-test. */
|
|
8
|
+
export declare const VIDEO_CONTROLS_FONT = "11px sans-serif";
|
|
9
|
+
export interface VideoControlsLayout {
|
|
10
|
+
/** Bottom-aligned bar the controls sit on, in node-local coordinates. */
|
|
11
|
+
bar: {
|
|
12
|
+
y: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
/** Hit rectangle of the play/pause toggle. */
|
|
16
|
+
play: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** Fullscreen toggle at the right edge of the bar. */
|
|
23
|
+
fullscreen: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
/** Visual rectangle of the seek track; its x extent doubles as the seek hit range. */
|
|
30
|
+
track: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Formats seconds as `M:SS`, growing to `H:MM:SS` once an hour is reached. */
|
|
38
|
+
export declare function formatVideoTime(seconds: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Layout of the controls bar for a `width` x `height` video, given the measured width of its
|
|
41
|
+
* time text. The bar height follows the video height between 24 and 32 pixels, and the track
|
|
42
|
+
* fills whatever the play toggle and the time text leave free.
|
|
43
|
+
*/
|
|
44
|
+
export declare function videoControlsLayout(width: number, height: number, textWidth: number): VideoControlsLayout;
|
|
45
|
+
/** Which interactive controls region (if any) a node-local point lands on. */
|
|
46
|
+
export declare function videoControlsRegion(layout: VideoControlsLayout, x: number, y: number): 'play' | 'track' | 'fullscreen' | null;
|
|
47
|
+
/** Seek ratio (0..1) a node-local x maps to on the track. */
|
|
48
|
+
export declare function videoSeekRatio(layout: VideoControlsLayout, x: number): number;
|
|
49
|
+
/**
|
|
50
|
+
* Toggles playback of a dedicated element and reports the resulting state, mirroring how the
|
|
51
|
+
* declarative `paused` prop reads. `play()` rejects under autoplay policies; the rejection just
|
|
52
|
+
* leaves the element paused and is swallowed like in {@link applyVideoControl}.
|
|
53
|
+
*/
|
|
54
|
+
export declare function toggleVideoPlayback(video: HTMLVideoElement, onPausedChange?: (paused: boolean) => void): void;
|
|
55
|
+
/** Seeks an element to `ratio` of its duration and reports the resulting time. */
|
|
56
|
+
export declare function seekVideoTime(video: HTMLVideoElement, ratio: number, onSeek?: (currentTime: number) => void, beforeSeek?: () => void): void;
|