@web-canvas-ui/angular 0.0.0-stage → 0.2.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.
Files changed (93) hide show
  1. package/README.md +1084 -2
  2. package/index.js +4224 -0
  3. package/package.json +40 -5
  4. package/theme.css +327 -0
  5. package/types/angular/Canvas.d.ts +41 -0
  6. package/types/angular/index.d.ts +4 -0
  7. package/types/angular/node-directives.d.ts +317 -0
  8. package/types/canvas-handle.d.ts +22 -0
  9. package/types/components/Button/button.d.ts +20 -0
  10. package/types/components/Button/index.d.ts +3 -0
  11. package/types/components/Button/logic.d.ts +3 -0
  12. package/types/components/CanvasView/canvasView.d.ts +28 -0
  13. package/types/components/CanvasView/index.d.ts +2 -0
  14. package/types/components/Carousel/carousel.d.ts +31 -0
  15. package/types/components/Carousel/index.d.ts +3 -0
  16. package/types/components/Carousel/logic.d.ts +2 -0
  17. package/types/components/Checkbox/checkbox.d.ts +8 -0
  18. package/types/components/Checkbox/index.d.ts +2 -0
  19. package/types/components/ChoiceGroup/choiceGroup.d.ts +33 -0
  20. package/types/components/ChoiceGroup/index.d.ts +3 -0
  21. package/types/components/ChoiceGroup/logic.d.ts +3 -0
  22. package/types/components/Circle/circle.d.ts +9 -0
  23. package/types/components/Circle/index.d.ts +2 -0
  24. package/types/components/Collapse/collapse.d.ts +32 -0
  25. package/types/components/Collapse/index.d.ts +3 -0
  26. package/types/components/Collapse/logic.d.ts +1 -0
  27. package/types/components/CustomDraw/customDraw.d.ts +22 -0
  28. package/types/components/CustomDraw/index.d.ts +2 -0
  29. package/types/components/DatePicker/datePicker.d.ts +24 -0
  30. package/types/components/DatePicker/index.d.ts +2 -0
  31. package/types/components/Dialog/dialog.d.ts +20 -0
  32. package/types/components/Dialog/index.d.ts +2 -0
  33. package/types/components/Dropdown/dropdown.d.ts +30 -0
  34. package/types/components/Dropdown/index.d.ts +3 -0
  35. package/types/components/Dropdown/logic.d.ts +5 -0
  36. package/types/components/Grid/grid.d.ts +14 -0
  37. package/types/components/Grid/index.d.ts +2 -0
  38. package/types/components/GridItem/gridItem.d.ts +8 -0
  39. package/types/components/GridItem/index.d.ts +2 -0
  40. package/types/components/Group/group.d.ts +5 -0
  41. package/types/components/Group/index.d.ts +2 -0
  42. package/types/components/Icon/icon.d.ts +14 -0
  43. package/types/components/Icon/index.d.ts +2 -0
  44. package/types/components/Image/image.d.ts +12 -0
  45. package/types/components/Image/index.d.ts +2 -0
  46. package/types/components/Input/index.d.ts +2 -0
  47. package/types/components/Input/input.d.ts +32 -0
  48. package/types/components/Progress/index.d.ts +2 -0
  49. package/types/components/Progress/progress.d.ts +15 -0
  50. package/types/components/Radio/index.d.ts +2 -0
  51. package/types/components/Radio/radio.d.ts +8 -0
  52. package/types/components/Rect/index.d.ts +2 -0
  53. package/types/components/Rect/rect.d.ts +11 -0
  54. package/types/components/Slider/index.d.ts +3 -0
  55. package/types/components/Slider/logic.d.ts +1 -0
  56. package/types/components/Slider/slider.d.ts +17 -0
  57. package/types/components/Switch/index.d.ts +3 -0
  58. package/types/components/Switch/logic.d.ts +2 -0
  59. package/types/components/Switch/switch.d.ts +14 -0
  60. package/types/components/Tabs/index.d.ts +3 -0
  61. package/types/components/Tabs/logic.d.ts +2 -0
  62. package/types/components/Tabs/tabs.d.ts +35 -0
  63. package/types/components/Text/index.d.ts +2 -0
  64. package/types/components/Text/text.d.ts +39 -0
  65. package/types/components/Textarea/index.d.ts +2 -0
  66. package/types/components/Textarea/textarea.d.ts +10 -0
  67. package/types/components/Upload/index.d.ts +2 -0
  68. package/types/components/Upload/upload.d.ts +20 -0
  69. package/types/components/Video/index.d.ts +2 -0
  70. package/types/components/Video/video.d.ts +20 -0
  71. package/types/components/draw-utils.d.ts +48 -0
  72. package/types/components/shared.d.ts +7 -0
  73. package/types/components/size.d.ts +6 -0
  74. package/types/components/types.d.ts +28 -0
  75. package/types/engine/carousel.d.ts +10 -0
  76. package/types/engine/events.d.ts +14 -0
  77. package/types/engine/hit-test.d.ts +31 -0
  78. package/types/engine/images.d.ts +8 -0
  79. package/types/engine/interaction.d.ts +11 -0
  80. package/types/engine/layout.d.ts +6 -0
  81. package/types/engine/nodes.d.ts +18 -0
  82. package/types/engine/state.d.ts +80 -0
  83. package/types/engine/text-controls.d.ts +10 -0
  84. package/types/engine/transform.d.ts +13 -0
  85. package/types/engine/videos.d.ts +14 -0
  86. package/types/engine/vnodes.d.ts +36 -0
  87. package/types/engine.d.ts +36 -0
  88. package/types/image-assets.d.ts +2 -0
  89. package/types/input-bridge.d.ts +40 -0
  90. package/types/renderer.d.ts +20 -0
  91. package/types/scene.d.ts +15 -0
  92. package/types/types.d.ts +124 -0
  93. package/types/video-assets.d.ts +11 -0
@@ -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,2 @@
1
+ export { Dialog, drawDialog } from './dialog';
2
+ export type { DialogProps, DialogDrawProps } from './dialog';
@@ -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,3 @@
1
+ export { Dropdown, drawDropdown, drawDropdownOptions } from './dropdown';
2
+ export type { DropdownOption, DropdownProps, DropdownDrawProps } from './dropdown';
3
+ export { dropdownOptionAt, normalizeDropdownOptions, selectDropdownOption } from './logic';
@@ -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,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,2 @@
1
+ export { Grid } from './grid';
2
+ export type { GridProps } from './grid';
@@ -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,2 @@
1
+ export { GridItem } from './gridItem';
2
+ export type { GridItemProps } from './gridItem';
@@ -0,0 +1,5 @@
1
+ import type { TransformProps } from '../../types';
2
+ export interface GroupProps extends TransformProps {
3
+ children?: unknown;
4
+ }
5
+ export declare const Group: import("../shared").MarkedComponent<GroupProps>;
@@ -0,0 +1,2 @@
1
+ export { Group } from './group';
2
+ export type { GroupProps } from './group';
@@ -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,2 @@
1
+ export { Icon, ICON_NAMES, drawIcon } from './icon';
2
+ export type { IconName, IconProps, IconVariant } from './icon';
@@ -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,2 @@
1
+ export { Image, drawImage } from './image';
2
+ export type { ImageProps } from './image';
@@ -0,0 +1,2 @@
1
+ export { Input, drawInput } from './input';
2
+ export type { InputProps, InputDrawProps } from './input';
@@ -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,2 @@
1
+ export { Progress, drawProgress } from './progress';
2
+ export type { ProgressProps } from './progress';
@@ -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,2 @@
1
+ export { Radio, drawRadio } from './radio';
2
+ export type { RadioProps } from './radio';
@@ -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,2 @@
1
+ export { Rect, drawRect } from './rect';
2
+ export type { RectProps } from './rect';
@@ -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,3 @@
1
+ export { Slider, drawSlider } from './slider';
2
+ export type { SliderProps } from './slider';
3
+ export { sliderValueAt } from './logic';
@@ -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,3 @@
1
+ export { Switch, drawSwitch } from './switch';
2
+ export type { SwitchProps } from './switch';
3
+ export { toggleSwitch } from './logic';
@@ -0,0 +1,2 @@
1
+ import type { SceneNode } from '../../scene';
2
+ export declare function toggleSwitch(node: SceneNode): 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,3 @@
1
+ export { Tabs, TabItem, drawTabs } from './tabs';
2
+ export type { TabItemProps, TabsProps, TabsDrawProps } from './tabs';
3
+ export { tabKeyAt } from './logic';
@@ -0,0 +1,2 @@
1
+ import type { SceneNode } from '../../scene';
2
+ export declare function tabKeyAt(items: readonly SceneNode[], x: number, y: number, width: number, headerHeight: number): string | undefined;
@@ -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,2 @@
1
+ export { Text, drawText, measureTextBox } from './text';
2
+ export type { TextBox, TextDrawProps, TextProps } from './text';
@@ -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,2 @@
1
+ export { Textarea, drawTextarea } from './textarea';
2
+ export type { TextareaProps, TextareaDrawProps } from './textarea';
@@ -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,2 @@
1
+ export { Upload, drawUpload } from './upload';
2
+ export type { UploadProps } from './upload';
@@ -0,0 +1,20 @@
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
+ disabled?: boolean;
12
+ backgroundColor?: string;
13
+ textColor?: string;
14
+ borderColor?: string;
15
+ borderRadius?: number;
16
+ fontSize?: number;
17
+ onChange?: (files: File[]) => void;
18
+ }
19
+ export declare const Upload: import("../shared").MarkedComponent<UploadProps>;
20
+ export declare function drawUpload(context: CanvasRenderingContext2D, props: UploadProps): void;
@@ -0,0 +1,2 @@
1
+ export { Video, drawVideo } from './video';
2
+ export type { VideoProps } from './video';
@@ -0,0 +1,20 @@
1
+ import type { TransformProps } from '../../types';
2
+ import { type MediaObjectFit } from '../draw-utils';
3
+ export interface VideoProps extends TransformProps {
4
+ src: string;
5
+ width?: number;
6
+ height?: number;
7
+ objectFit?: MediaObjectFit;
8
+ /** Start playback as soon as the frame draws; browsers still require `muted` for autoplay. */
9
+ autoplay?: boolean;
10
+ loop?: boolean;
11
+ muted?: boolean;
12
+ /** Declarative play/pause: `paused: false` plays, `paused: true` pauses, omitted leaves control to `autoplay`. */
13
+ paused?: boolean;
14
+ /** Seek target in seconds; set once (e.g. in `onTimeUpdate`) to jump, not every frame. */
15
+ currentTime?: number;
16
+ onError?: (error: Error) => void;
17
+ onTimeUpdate?: (currentTime: number, duration: number) => void;
18
+ }
19
+ export declare const Video: import("../shared").MarkedComponent<VideoProps>;
20
+ export declare function drawVideo(context: CanvasRenderingContext2D, props: VideoProps): void;
@@ -0,0 +1,48 @@
1
+ export declare function number(value: unknown, fallback: number): number;
2
+ export declare function string(value: unknown, fallback: string): string;
3
+ /** Measures rendered text width; drawing passes a context, layout passes `measureTextWidth`. */
4
+ export type TextMeasurer = (text: string) => number;
5
+ /** Baseline-to-baseline multiplier, shared by Text drawing and the pass that sizes it. */
6
+ export declare const TEXT_LINE_HEIGHT = 1.2;
7
+ /**
8
+ * Wraps `text` into lines at most `width` wide, keeping at most `maxLines` of them; a clamped
9
+ * block ends with an ellipsis instead of silently losing the rest. `maxLines` <= 0 means "no
10
+ * limit"; any positive limit keeps at least one line. Callers supply the measurer so that drawing
11
+ * (live context) and layout ({@link measureTextWidth}) share one algorithm and therefore one result.
12
+ */
13
+ export declare function measureLines(measure: TextMeasurer, text: string, width: number, maxLines?: number): string[];
14
+ export declare function wrapText(context: CanvasRenderingContext2D, text: string, width: number): string[];
15
+ /**
16
+ * Truncates `text` with a trailing ellipsis so it fits within `maxWidth` for the
17
+ * context's current font. Display-only labels (buttons, tabs, dropdown rows…) use
18
+ * this to stay inside their box; editable controls clip instead.
19
+ */
20
+ export declare function fitText(context: CanvasRenderingContext2D, text: string, maxWidth: number): string;
21
+ /**
22
+ * Measures the rendered width of `text` for a given CSS `font` string using a
23
+ * shared offscreen context. Draw, hit-test and layout code must all go through
24
+ * this helper so their width calculations stay byte-for-byte identical.
25
+ * Falls back to a deterministic estimate when no canvas is available (SSR/tests).
26
+ */
27
+ export declare function measureTextWidth(text: string, font: string): number;
28
+ /** How a media source is fitted into its box; shared by the `<Image>` and `<Video>` draw paths. */
29
+ export type MediaObjectFit = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
30
+ /**
31
+ * Draws a raster source (image or video frame) into the `width`x`height` box at the current
32
+ * origin under the CSS `objectFit` semantics, clipping to the box. Shared so `<Image>` and
33
+ * `<Video>` scale identically; the caller saves/restores the context around the clip.
34
+ */
35
+ export declare function drawFitMedia(context: CanvasRenderingContext2D, source: CanvasImageSource, sourceWidth: number, sourceHeight: number, width: number, height: number, fit: MediaObjectFit): void;
36
+ /**
37
+ * Width a classic vertical scrollbar occupies, 0 on platforms that float scrollbars over the
38
+ * content. Measured once from a throwaway scroller and cached, the same way the measurement context
39
+ * is; without a document (SSR, unit tests) there is nothing to reserve.
40
+ */
41
+ export declare function verticalScrollbarWidth(): number;
42
+ export declare function setThemeCanvasSource(canvas: HTMLCanvasElement, source: HTMLCanvasElement): void;
43
+ /**
44
+ * Drops every cached theme colour so the next read recomputes it. Call this whenever the theme can
45
+ * change (for example from a MutationObserver watching the canvas / ancestor `class` or `style`).
46
+ */
47
+ export declare function invalidateThemeColors(): void;
48
+ export declare function themeColor(context: CanvasRenderingContext2D, token: string, fallback: string): string;
@@ -0,0 +1,7 @@
1
+ import type { ComponentKind } from '../types';
2
+ export declare const kindSymbol: unique symbol;
3
+ export type MarkedComponent<Props = Record<string, unknown>> = ((props: Props) => null) & {
4
+ displayName?: string;
5
+ [kindSymbol]?: ComponentKind;
6
+ };
7
+ export declare function createComponent<Props>(kind: ComponentKind): MarkedComponent<Props>;
@@ -0,0 +1,6 @@
1
+ export interface ComponentSize {
2
+ width?: number;
3
+ height?: number;
4
+ }
5
+ export declare function componentWidth(props: Record<string, unknown>, fallback: number): number;
6
+ export declare function componentHeight(props: Record<string, unknown>, fallback: number): number;
@@ -0,0 +1,28 @@
1
+ export type { ButtonProps } from './Button';
2
+ export type { CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, } from './CanvasView';
3
+ export type { CarouselItemProps, CarouselProps } from './Carousel';
4
+ export type { CheckboxProps } from './Checkbox';
5
+ export type { ChoiceGroupProps, ChoiceOption } from './ChoiceGroup';
6
+ export type { CircleProps } from './Circle';
7
+ export type { CollapseItemProps, CollapseProps } from './Collapse';
8
+ export type { CustomDrawClickEvent, CustomDrawHitTest, CustomDrawProps, CustomDrawSize, } from './CustomDraw';
9
+ export type { DatePickerProps } from './DatePicker';
10
+ export type { DialogProps } from './Dialog';
11
+ export type { DropdownOption, DropdownProps } from './Dropdown';
12
+ export type { GridItemProps } from './GridItem';
13
+ export type { GridProps } from './Grid';
14
+ export type { GroupProps } from './Group';
15
+ export type { ImageProps } from './Image';
16
+ export type { IconName, IconProps, IconVariant } from './Icon';
17
+ export type { InputProps } from './Input';
18
+ export type { ProgressProps } from './Progress';
19
+ export type { RadioProps } from './Radio';
20
+ export type { RectProps } from './Rect';
21
+ export type { SliderProps } from './Slider';
22
+ export type { SwitchProps } from './Switch';
23
+ export type { TabItemProps, TabsProps } from './Tabs';
24
+ export type { TextProps } from './Text';
25
+ export type { TextareaProps } from './Textarea';
26
+ export type { UploadProps } from './Upload';
27
+ export type { VideoProps } from './Video';
28
+ export type { ComponentSize } from './size';
@@ -0,0 +1,10 @@
1
+ import type { SceneNode } from '../scene';
2
+ import type { CarouselTransition, EngineCore, EngineState } from './state';
3
+ /**
4
+ * The carousel state machine: autoplay timing, index transitions and the
5
+ * per-frame easing that slides items. Driven by {@link advanceCarousels} from the
6
+ * render loop and {@link changeCarousel} from pointer interaction.
7
+ */
8
+ export declare function transitionProgress(transition: CarouselTransition, time: number): number;
9
+ export declare function changeCarousel(core: EngineCore, state: EngineState, node: SceneNode, requestedIndex: number): void;
10
+ export declare function advanceCarousels(core: EngineCore, state: EngineState, time: number): void;
@@ -0,0 +1,14 @@
1
+ import type { SceneNode } from '../scene';
2
+ import type { CanvasPointerEvent } from '../types';
3
+ import type { CanvasViewPointerEvent } from '../components/CanvasView';
4
+ import type { HitResult } from './hit-test';
5
+ import type { EngineCore } from './state';
6
+ /**
7
+ * Translates resolved pointer geometry into the public {@link CanvasUIEvent}
8
+ * stream and the per-node `canvasView` pointer callbacks.
9
+ */
10
+ export declare function emitPointerEvent(core: EngineCore, type: 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel', event: CanvasPointerEvent, hit: HitResult | null, point: {
11
+ x: number;
12
+ y: number;
13
+ }): void;
14
+ export declare function emitCanvasViewPointerEvent(type: CanvasViewPointerEvent['type'], node: SceneNode, x: number, y: number, event: CanvasPointerEvent): void;
@@ -0,0 +1,31 @@
1
+ import type { SceneNode } from '../scene';
2
+ import type { EngineCore } from './state';
3
+ /**
4
+ * Geometry: resolve client (viewport) coordinates to canvas / node-local space and
5
+ * determine which interactive node, if any, is under a pointer, honouring modal
6
+ * dialogs and grid/carousel clipping. Pure apart from reading the live scene graph.
7
+ */
8
+ export interface HitResult {
9
+ node: SceneNode;
10
+ x: number;
11
+ y: number;
12
+ }
13
+ export declare function canvasPoint(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number): {
14
+ x: number;
15
+ y: number;
16
+ } | null;
17
+ export declare function localPoint(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number, target: SceneNode): {
18
+ x: number;
19
+ y: number;
20
+ } | null;
21
+ export declare function isWithinClip(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number, node: SceneNode): boolean;
22
+ export declare function findHit(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number): HitResult | null;
23
+ export declare function findCarouselControlHit(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number): {
24
+ node: SceneNode;
25
+ index: number;
26
+ } | null;
27
+ export declare function findGridScrollbarHit(core: EngineCore, canvas: HTMLCanvasElement, clientX: number, clientY: number): {
28
+ node: SceneNode;
29
+ pointerY: number;
30
+ scrollTop: number;
31
+ } | null;
@@ -0,0 +1,8 @@
1
+ import type { VNode } from '../types';
2
+ import type { EngineCore, EngineState } from './state';
3
+ /**
4
+ * Subscribes the engine to the shared image cache for every `image` source in the
5
+ * tree, tearing down subscriptions for sources that disappear. Load errors mark the
6
+ * scene dirty and forward to each image node's `onError` callback.
7
+ */
8
+ export declare function syncImages(core: EngineCore, state: EngineState, tree: VNode[]): void;
@@ -0,0 +1,11 @@
1
+ import type { CanvasPointerEvent, CanvasWheelEvent } from '../types';
2
+ import type { EngineCore, EngineState } from './state';
3
+ /**
4
+ * Turns raw pointer/wheel events into state mutations on the scene graph: routes a
5
+ * press to the correct component, drives sliders, buttons, tabs, collapses, dropdowns,
6
+ * dialogs and grid scrolling, and emits the public event stream.
7
+ */
8
+ export declare function pointerDown(core: EngineCore, state: EngineState, event: CanvasPointerEvent): void;
9
+ export declare function pointerMove(core: EngineCore, state: EngineState, event: CanvasPointerEvent): void;
10
+ export declare function pointerUp(core: EngineCore, state: EngineState, event: CanvasPointerEvent, cancelled?: boolean): void;
11
+ export declare function wheel(core: EngineCore, state: EngineState, event: CanvasWheelEvent): void;