@web-canvas-ui/angular 0.2.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-canvas-ui/angular",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Canvas UI components for angular",
5
5
  "license": "MIT",
6
6
  "author": "chunan-qiu wangqingzhou311@live.com https://github.com/Neo20161101/web-canvas-ui",
@@ -27,6 +27,7 @@ export declare class Canvas implements CanvasHandle, AfterContentChecked, AfterV
27
27
  toBlob(optionsOrType?: CanvasExportOptions | string, quality?: number): Promise<Blob>;
28
28
  pointerDown(event: PointerEvent): void;
29
29
  pointerMove(event: PointerEvent): void;
30
+ pointerLeave(event: PointerEvent): void;
30
31
  pointerUp(event: PointerEvent): void;
31
32
  pointerCancel(event: PointerEvent): void;
32
33
  wheel(event: WheelEvent): void;
@@ -1,4 +1,5 @@
1
1
  export { Canvas } from './Canvas';
2
- export { Button, Circle, Dropdown, Group, Grid, GridItem, Image, Video, Icon, Dialog, Progress, Tabs, TabItem, Collapse, CollapseItem, Input, DatePicker, Radio, Checkbox, Upload, Carousel, CarouselItem, Rect, Slider, Switch, Text, Textarea, CustomDraw, CanvasView, } from './node-directives';
2
+ export { createFormController } from '../components/Form';
3
+ export { Button, Circle, Dropdown, Group, Form, FormItem, Grid, GridItem, Image, Video, Icon, Dialog, Progress, Tabs, TabItem, Collapse, CollapseItem, Input, DatePicker, Radio, Checkbox, Upload, Carousel, CarouselItem, Rect, Slider, Switch, Text, Textarea, CustomDraw, CanvasView, } from './node-directives';
3
4
  export type { CanvasExportOptions, CanvasHandle } from '../canvas-handle';
4
- export type { ButtonProps, CircleProps, DropdownOption, DropdownProps, GroupProps, GridProps, GridItemProps, ImageProps, VideoProps, IconName, IconProps, IconVariant, DialogProps, ProgressProps, TabsProps, TabItemProps, CollapseProps, CollapseItemProps, InputProps, DatePickerProps, RadioProps, CheckboxProps, UploadProps, CarouselProps, CarouselItemProps, ChoiceOption, RectProps, SliderProps, SwitchProps, TextProps, TextareaProps, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, CanvasUIEvent, CanvasUIPointerEvent, CanvasUIWheelEvent, CanvasUIEventTarget, } from '../types';
5
+ export type { ButtonProps, CircleProps, DropdownOption, DropdownProps, GroupProps, FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, GridProps, GridItemProps, ImageProps, VideoProps, IconName, IconProps, IconVariant, DialogProps, ProgressProps, TabsProps, TabItemProps, CollapseProps, CollapseItemProps, InputProps, DatePickerProps, RadioProps, CheckboxProps, UploadProps, UploadRejection, CarouselProps, CarouselItemProps, ChoiceOption, RectProps, SliderProps, SwitchProps, TextProps, TextareaProps, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, CanvasUIEvent, CanvasUIPointerEvent, CanvasUIWheelEvent, CanvasUIEventTarget, } from '../types';
@@ -1,5 +1,5 @@
1
1
  import { ElementRef, EventEmitter } from '@angular/core';
2
- import type { CanvasNodePropValue, ComponentKind, CustomDrawClickEvent } from '../types';
2
+ import type { CanvasNodePropValue, ComponentKind, CustomDrawClickEvent, FormValues, FormErrors, UploadRejection } from '../types';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare abstract class CanvasNodeDirective {
5
5
  readonly marker = "";
@@ -9,6 +9,18 @@ export declare abstract class CanvasNodeDirective {
9
9
  scaleX?: CanvasNodePropValue<'scaleX'>;
10
10
  scaleY?: CanvasNodePropValue<'scaleY'>;
11
11
  visible?: CanvasNodePropValue<'visible'>;
12
+ ariaLabel?: CanvasNodePropValue<'ariaLabel'>;
13
+ initialValues?: CanvasNodePropValue<'initialValues'>;
14
+ controller?: CanvasNodePropValue<'controller'>;
15
+ rules?: CanvasNodePropValue<'rules'>;
16
+ errorY?: CanvasNodePropValue<'errorY'>;
17
+ errorColor?: CanvasNodePropValue<'errorColor'>;
18
+ errorFontSize?: CanvasNodePropValue<'errorFontSize'>;
19
+ formAction?: CanvasNodePropValue<'formAction'>;
20
+ onSubmit?: CanvasNodePropValue<'onSubmit'>;
21
+ onInvalid?: CanvasNodePropValue<'onInvalid'>;
22
+ onValuesChange?: CanvasNodePropValue<'onValuesChange'>;
23
+ onReset?: CanvasNodePropValue<'onReset'>;
12
24
  key?: string | number;
13
25
  size?: CanvasNodePropValue<'size'>;
14
26
  width?: CanvasNodePropValue<'width'>;
@@ -81,6 +93,8 @@ export declare abstract class CanvasNodeDirective {
81
93
  onScroll?: CanvasNodePropValue<'onScroll'>;
82
94
  accept?: CanvasNodePropValue<'accept'>;
83
95
  multiple?: CanvasNodePropValue<'multiple'>;
96
+ maxSize?: CanvasNodePropValue<'maxSize'>;
97
+ onReject?: CanvasNodePropValue<'onReject'>;
84
98
  icon?: CanvasNodePropValue<'icon'>;
85
99
  iconSize?: CanvasNodePropValue<'iconSize'>;
86
100
  activeIndex?: CanvasNodePropValue<'activeIndex'>;
@@ -104,12 +118,20 @@ export declare abstract class CanvasNodeDirective {
104
118
  muted?: CanvasNodePropValue<'muted'>;
105
119
  paused?: CanvasNodePropValue<'paused'>;
106
120
  currentTime?: CanvasNodePropValue<'currentTime'>;
121
+ controls?: CanvasNodePropValue<'controls'>;
122
+ controlsOnHover?: CanvasNodePropValue<'controlsOnHover'>;
123
+ controlsBarColor?: CanvasNodePropValue<'controlsBarColor'>;
124
+ controlsColor?: CanvasNodePropValue<'controlsColor'>;
125
+ controlsTrackColor?: CanvasNodePropValue<'controlsTrackColor'>;
107
126
  onTimeUpdate?: CanvasNodePropValue<'onTimeUpdate'>;
127
+ onPausedChange?: CanvasNodePropValue<'onPausedChange'>;
128
+ onSeek?: CanvasNodePropValue<'onSeek'>;
108
129
  onChange?: CanvasNodePropValue<'onChange'>;
109
130
  onClick?: CanvasNodePropValue<'onClick'>;
110
131
  onFocus?: () => void;
111
132
  onBlur?: () => void;
112
133
  readonly change: EventEmitter<string | number | boolean | string[] | File[]>;
134
+ readonly reject: EventEmitter<UploadRejection[]>;
113
135
  readonly valueChange: EventEmitter<string | number>;
114
136
  readonly checkedChange: EventEmitter<boolean>;
115
137
  readonly activeKeyChange: EventEmitter<string>;
@@ -123,9 +145,18 @@ export declare abstract class CanvasNodeDirective {
123
145
  currentTime: number;
124
146
  duration: number;
125
147
  }>;
148
+ readonly pausedChange: EventEmitter<boolean>;
149
+ readonly seek: EventEmitter<number>;
126
150
  readonly click: EventEmitter<void | CustomDrawClickEvent>;
127
151
  readonly focus: EventEmitter<void>;
128
152
  readonly blur: EventEmitter<void>;
153
+ readonly formSubmit: EventEmitter<FormValues>;
154
+ readonly formInvalid: EventEmitter<{
155
+ errors: FormErrors;
156
+ values: FormValues;
157
+ }>;
158
+ readonly valuesChange: EventEmitter<FormValues>;
159
+ readonly formReset: EventEmitter<void>;
129
160
  protected constructor(elementRef: ElementRef<HTMLElement>);
130
161
  abstract readonly kind: ComponentKind;
131
162
  getProps(): Record<string, unknown>;
@@ -133,12 +164,31 @@ export declare abstract class CanvasNodeDirective {
133
164
  readonly dispatchClick: (event?: CustomDrawClickEvent) => void;
134
165
  readonly dispatchFocus: () => void;
135
166
  readonly dispatchBlur: () => void;
167
+ readonly dispatchReject: (rejections: UploadRejection[]) => void;
136
168
  readonly dispatchConfirm: () => void;
137
169
  readonly dispatchCancel: () => void;
138
170
  readonly dispatchMediaError: (error: Error) => void;
139
171
  readonly dispatchTimeUpdate: (currentTime: number, duration: number) => void;
172
+ readonly dispatchPausedChange: (paused: boolean) => void;
173
+ readonly dispatchSeek: (currentTime: number) => void;
174
+ readonly dispatchFormSubmit: (values: FormValues) => void;
175
+ readonly dispatchFormInvalid: (errors: FormErrors, values: FormValues) => void;
176
+ readonly dispatchValuesChange: (values: FormValues) => void;
177
+ readonly dispatchFormReset: () => void;
140
178
  static ɵfac: i0.ɵɵFactoryDeclaration<CanvasNodeDirective, never>;
141
- static ɵdir: i0.ɵɵDirectiveDeclaration<CanvasNodeDirective, never, never, { "x": { "alias": "x"; "required": false; }; "y": { "alias": "y"; "required": false; }; "rotation": { "alias": "rotation"; "required": false; }; "scaleX": { "alias": "scaleX"; "required": false; }; "scaleY": { "alias": "scaleY"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; "key": { "alias": "key"; "required": false; }; "size": { "alias": "size"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "color": { "alias": "color"; "required": false; }; "radius": { "alias": "radius"; "required": false; }; "stroke": { "alias": "stroke"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; "text": { "alias": "text"; "required": false; }; "fontSize": { "alias": "fontSize"; "required": false; }; "fontFamily": { "alias": "fontFamily"; "required": false; }; "baseline": { "alias": "baseline"; "required": false; }; "textAlign": { "alias": "textAlign"; "required": false; }; "maxLines": { "alias": "maxLines"; "required": false; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "bgColor": { "alias": "bgColor"; "required": false; }; "borderColor": { "alias": "borderColor"; "required": false; }; "focusBorderColor": { "alias": "focusBorderColor"; "required": false; }; "borderRadius": { "alias": "borderRadius"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "type": { "alias": "type"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "options": { "alias": "options"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "step": { "alias": "step"; "required": false; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "onColor": { "alias": "onColor"; "required": false; }; "offColor": { "alias": "offColor"; "required": false; }; "thumbColor": { "alias": "thumbColor"; "required": false; }; "trackColor": { "alias": "trackColor"; "required": false; }; "activeColor": { "alias": "activeColor"; "required": false; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; }; "textColor": { "alias": "textColor"; "required": false; }; "fontColor": { "alias": "fontColor"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "cellWidth": { "alias": "cellWidth"; "required": false; }; "cellHeight": { "alias": "cellHeight"; "required": false; }; "virtual": { "alias": "virtual"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "columnSpan": { "alias": "columnSpan"; "required": false; }; "rowSpan": { "alias": "rowSpan"; "required": false; }; "src": { "alias": "src"; "required": false; }; "objectFit": { "alias": "objectFit"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "confirmText": { "alias": "confirmText"; "required": false; }; "cancelText": { "alias": "cancelText"; "required": false; }; "closeOnBackdrop": { "alias": "closeOnBackdrop"; "required": false; }; "onConfirm": { "alias": "onConfirm"; "required": false; }; "onCancel": { "alias": "onCancel"; "required": false; }; "showText": { "alias": "showText"; "required": false; }; "activeKey": { "alias": "activeKey"; "required": false; }; "defaultActiveKey": { "alias": "defaultActiveKey"; "required": false; }; "headerHeight": { "alias": "headerHeight"; "required": false; }; "indicatorColor": { "alias": "indicatorColor"; "required": false; }; "id": { "alias": "id"; "required": false; }; "activeKeys": { "alias": "activeKeys"; "required": false; }; "defaultActiveKeys": { "alias": "defaultActiveKeys"; "required": false; }; "accordion": { "alias": "accordion"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "optionHeight": { "alias": "optionHeight"; "required": false; }; "disabledColor": { "alias": "disabledColor"; "required": false; }; "onScroll": { "alias": "onScroll"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "activeIndex": { "alias": "activeIndex"; "required": false; }; "defaultActiveIndex": { "alias": "defaultActiveIndex"; "required": false; }; "autoplay": { "alias": "autoplay"; "required": false; }; "interval": { "alias": "interval"; "required": false; }; "transitionDuration": { "alias": "transitionDuration"; "required": false; }; "loop": { "alias": "loop"; "required": false; }; "showArrows": { "alias": "showArrows"; "required": false; }; "showDots": { "alias": "showDots"; "required": false; }; "arrowColor": { "alias": "arrowColor"; "required": false; }; "dotColor": { "alias": "dotColor"; "required": false; }; "activeDotColor": { "alias": "activeDotColor"; "required": false; }; "draw": { "alias": "draw"; "required": false; }; "hitTest": { "alias": "hitTest"; "required": false; }; "source": { "alias": "source"; "required": false; }; "fit": { "alias": "fit"; "required": false; }; "name": { "alias": "name"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "onPointerEvent": { "alias": "onPointerEvent"; "required": false; }; "muted": { "alias": "muted"; "required": false; }; "paused": { "alias": "paused"; "required": false; }; "currentTime": { "alias": "currentTime"; "required": false; }; "onTimeUpdate": { "alias": "onTimeUpdate"; "required": false; }; "onChange": { "alias": "onChange"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "onFocus": { "alias": "onFocus"; "required": false; }; "onBlur": { "alias": "onBlur"; "required": false; }; }, { "change": "change"; "valueChange": "valueChange"; "checkedChange": "checkedChange"; "activeKeyChange": "activeKeyChange"; "activeIndexChange": "activeIndexChange"; "activeKeysChange": "activeKeysChange"; "confirm": "confirm"; "cancel": "cancel"; "imageError": "imageError"; "videoError": "videoError"; "timeUpdate": "timeUpdate"; "click": "click"; "focus": "focus"; "blur": "blur"; }, never, never, false, never>;
179
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CanvasNodeDirective, never, never, { "x": { "alias": "x"; "required": false; }; "y": { "alias": "y"; "required": false; }; "rotation": { "alias": "rotation"; "required": false; }; "scaleX": { "alias": "scaleX"; "required": false; }; "scaleY": { "alias": "scaleY"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "rules": { "alias": "rules"; "required": false; }; "errorY": { "alias": "errorY"; "required": false; }; "errorColor": { "alias": "errorColor"; "required": false; }; "errorFontSize": { "alias": "errorFontSize"; "required": false; }; "formAction": { "alias": "formAction"; "required": false; }; "onSubmit": { "alias": "onSubmit"; "required": false; }; "onInvalid": { "alias": "onInvalid"; "required": false; }; "onValuesChange": { "alias": "onValuesChange"; "required": false; }; "onReset": { "alias": "onReset"; "required": false; }; "key": { "alias": "key"; "required": false; }; "size": { "alias": "size"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "color": { "alias": "color"; "required": false; }; "radius": { "alias": "radius"; "required": false; }; "stroke": { "alias": "stroke"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; "text": { "alias": "text"; "required": false; }; "fontSize": { "alias": "fontSize"; "required": false; }; "fontFamily": { "alias": "fontFamily"; "required": false; }; "baseline": { "alias": "baseline"; "required": false; }; "textAlign": { "alias": "textAlign"; "required": false; }; "maxLines": { "alias": "maxLines"; "required": false; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "bgColor": { "alias": "bgColor"; "required": false; }; "borderColor": { "alias": "borderColor"; "required": false; }; "focusBorderColor": { "alias": "focusBorderColor"; "required": false; }; "borderRadius": { "alias": "borderRadius"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "type": { "alias": "type"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "options": { "alias": "options"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "step": { "alias": "step"; "required": false; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "onColor": { "alias": "onColor"; "required": false; }; "offColor": { "alias": "offColor"; "required": false; }; "thumbColor": { "alias": "thumbColor"; "required": false; }; "trackColor": { "alias": "trackColor"; "required": false; }; "activeColor": { "alias": "activeColor"; "required": false; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; }; "textColor": { "alias": "textColor"; "required": false; }; "fontColor": { "alias": "fontColor"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "cellWidth": { "alias": "cellWidth"; "required": false; }; "cellHeight": { "alias": "cellHeight"; "required": false; }; "virtual": { "alias": "virtual"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "columnSpan": { "alias": "columnSpan"; "required": false; }; "rowSpan": { "alias": "rowSpan"; "required": false; }; "src": { "alias": "src"; "required": false; }; "objectFit": { "alias": "objectFit"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "confirmText": { "alias": "confirmText"; "required": false; }; "cancelText": { "alias": "cancelText"; "required": false; }; "closeOnBackdrop": { "alias": "closeOnBackdrop"; "required": false; }; "onConfirm": { "alias": "onConfirm"; "required": false; }; "onCancel": { "alias": "onCancel"; "required": false; }; "showText": { "alias": "showText"; "required": false; }; "activeKey": { "alias": "activeKey"; "required": false; }; "defaultActiveKey": { "alias": "defaultActiveKey"; "required": false; }; "headerHeight": { "alias": "headerHeight"; "required": false; }; "indicatorColor": { "alias": "indicatorColor"; "required": false; }; "id": { "alias": "id"; "required": false; }; "activeKeys": { "alias": "activeKeys"; "required": false; }; "defaultActiveKeys": { "alias": "defaultActiveKeys"; "required": false; }; "accordion": { "alias": "accordion"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "optionHeight": { "alias": "optionHeight"; "required": false; }; "disabledColor": { "alias": "disabledColor"; "required": false; }; "onScroll": { "alias": "onScroll"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "maxSize": { "alias": "maxSize"; "required": false; }; "onReject": { "alias": "onReject"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "activeIndex": { "alias": "activeIndex"; "required": false; }; "defaultActiveIndex": { "alias": "defaultActiveIndex"; "required": false; }; "autoplay": { "alias": "autoplay"; "required": false; }; "interval": { "alias": "interval"; "required": false; }; "transitionDuration": { "alias": "transitionDuration"; "required": false; }; "loop": { "alias": "loop"; "required": false; }; "showArrows": { "alias": "showArrows"; "required": false; }; "showDots": { "alias": "showDots"; "required": false; }; "arrowColor": { "alias": "arrowColor"; "required": false; }; "dotColor": { "alias": "dotColor"; "required": false; }; "activeDotColor": { "alias": "activeDotColor"; "required": false; }; "draw": { "alias": "draw"; "required": false; }; "hitTest": { "alias": "hitTest"; "required": false; }; "source": { "alias": "source"; "required": false; }; "fit": { "alias": "fit"; "required": false; }; "name": { "alias": "name"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "onPointerEvent": { "alias": "onPointerEvent"; "required": false; }; "muted": { "alias": "muted"; "required": false; }; "paused": { "alias": "paused"; "required": false; }; "currentTime": { "alias": "currentTime"; "required": false; }; "controls": { "alias": "controls"; "required": false; }; "controlsOnHover": { "alias": "controlsOnHover"; "required": false; }; "controlsBarColor": { "alias": "controlsBarColor"; "required": false; }; "controlsColor": { "alias": "controlsColor"; "required": false; }; "controlsTrackColor": { "alias": "controlsTrackColor"; "required": false; }; "onTimeUpdate": { "alias": "onTimeUpdate"; "required": false; }; "onPausedChange": { "alias": "onPausedChange"; "required": false; }; "onSeek": { "alias": "onSeek"; "required": false; }; "onChange": { "alias": "onChange"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "onFocus": { "alias": "onFocus"; "required": false; }; "onBlur": { "alias": "onBlur"; "required": false; }; }, { "change": "change"; "reject": "reject"; "valueChange": "valueChange"; "checkedChange": "checkedChange"; "activeKeyChange": "activeKeyChange"; "activeIndexChange": "activeIndexChange"; "activeKeysChange": "activeKeysChange"; "confirm": "confirm"; "cancel": "cancel"; "imageError": "imageError"; "videoError": "videoError"; "timeUpdate": "timeUpdate"; "pausedChange": "pausedChange"; "seek": "seek"; "click": "click"; "focus": "focus"; "blur": "blur"; "formSubmit": "formSubmit"; "formInvalid": "formInvalid"; "valuesChange": "valuesChange"; "formReset": "formReset"; }, never, never, false, never>;
180
+ }
181
+ export declare class Form extends CanvasNodeDirective {
182
+ readonly kind = "form";
183
+ constructor(elementRef: ElementRef<HTMLElement>);
184
+ static ɵfac: i0.ɵɵFactoryDeclaration<Form, never>;
185
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Form, "canvas-form", never, {}, {}, never, never, true, never>;
186
+ }
187
+ export declare class FormItem extends CanvasNodeDirective {
188
+ readonly kind = "formItem";
189
+ constructor(elementRef: ElementRef<HTMLElement>);
190
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormItem, never>;
191
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormItem, "canvas-form-item", never, {}, {}, never, never, true, never>;
142
192
  }
143
193
  export declare class Group extends CanvasNodeDirective {
144
194
  readonly kind = "group";
@@ -5,6 +5,8 @@ export interface ButtonProps extends TransformProps {
5
5
  width?: number;
6
6
  height?: number;
7
7
  disabled?: boolean;
8
+ /** Submit or reset the nearest Form. */
9
+ formAction?: 'submit' | 'reset';
8
10
  backgroundColor?: string;
9
11
  fontColor?: string;
10
12
  borderColor?: string;
@@ -31,3 +31,8 @@ export declare function choiceGroupSize(props: Record<string, unknown>): {
31
31
  };
32
32
  export declare function drawChoiceGroup(context: CanvasRenderingContext2D, props: ChoiceGroupProps, kind: 'radio' | 'checkbox'): void;
33
33
  export declare function choiceAt(props: Record<string, unknown>, x: number, y: number): ChoiceOption | undefined;
34
+ /**
35
+ * The horizontal footprint an option occupies (control + label + trailing padding).
36
+ * Uses the shared real `measureText` so draw, hit-test and layout never diverge.
37
+ */
38
+ export declare function optionLayoutWidth(label: string, fontSize: number): number;
@@ -1,3 +1,3 @@
1
- export { choiceAt, choiceGroupSize, choiceOptions, drawChoiceGroup } from './choiceGroup';
1
+ export { choiceAt, choiceGroupSize, choiceOptions, drawChoiceGroup, optionLayoutWidth, } from './choiceGroup';
2
2
  export type { ChoiceGroupProps, ChoiceOption } from './choiceGroup';
3
3
  export { checkboxSelection, radioSelection } from './logic';
@@ -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,2 @@
1
+ export { Form, FormItem, createFormController } from './form';
2
+ export type { FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, } from './form';
@@ -1,2 +1,2 @@
1
- export { Upload, drawUpload } from './upload';
2
- export type { UploadProps } from './upload';
1
+ export { Upload, drawUpload, uploadHeight, UPLOAD_ROW_HEIGHT } from './upload';
2
+ export type { UploadProps, UploadRejection } from './upload';
@@ -8,6 +8,9 @@ export interface UploadProps extends TransformProps {
8
8
  iconSize?: number;
9
9
  accept?: string;
10
10
  multiple?: boolean;
11
+ value?: File[];
12
+ defaultValue?: File[];
13
+ maxSize?: number;
11
14
  disabled?: boolean;
12
15
  backgroundColor?: string;
13
16
  textColor?: string;
@@ -15,6 +18,13 @@ export interface UploadProps extends TransformProps {
15
18
  borderRadius?: number;
16
19
  fontSize?: number;
17
20
  onChange?: (files: File[]) => void;
21
+ onReject?: (files: UploadRejection[]) => void;
18
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;
19
29
  export declare const Upload: import("../shared").MarkedComponent<UploadProps>;
20
30
  export declare function drawUpload(context: CanvasRenderingContext2D, props: UploadProps): void;
@@ -1,2 +1,4 @@
1
- export { Video, drawVideo } from './video';
2
- export type { VideoProps } from './video';
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;
@@ -9,12 +9,46 @@ export interface VideoProps extends TransformProps {
9
9
  autoplay?: boolean;
10
10
  loop?: boolean;
11
11
  muted?: boolean;
12
- /** Declarative play/pause: `paused: false` plays, `paused: true` pauses, omitted leaves control to `autoplay`. */
12
+ /** Declarative play/pause: `false` plays, `true` pauses; native fullscreen controls take precedence. */
13
13
  paused?: boolean;
14
- /** Seek target in seconds; set once (e.g. in `onTimeUpdate`) to jump, not every frame. */
14
+ /** Seek target in seconds; set once, not every frame. Native fullscreen controls take precedence. */
15
15
  currentTime?: number;
16
+ /** Shows playback, seek and fullscreen controls. */
17
+ controls?: boolean;
18
+ /** Show controls on hover, or after a tap on touch devices. */
19
+ controlsOnHover?: boolean;
20
+ /** Background of the controls bar. Default: a translucent dark scrim over the frames. */
21
+ controlsBarColor?: string;
22
+ /** Foreground of the controls bar: play/pause icon, played track, thumb and time text. */
23
+ controlsColor?: string;
24
+ /** Idle (not yet played) part of the seek track. */
25
+ controlsTrackColor?: string;
16
26
  onError?: (error: Error) => void;
17
27
  onTimeUpdate?: (currentTime: number, duration: number) => void;
28
+ /** Fires when the user toggles playback through the controls bar. */
29
+ onPausedChange?: (paused: boolean) => void;
30
+ /** Fires when the user seeks through the controls bar (press or drag on the track). */
31
+ onSeek?: (currentTime: number) => void;
18
32
  }
19
33
  export declare const Video: import("../shared").MarkedComponent<VideoProps>;
20
- export declare function drawVideo(context: CanvasRenderingContext2D, props: VideoProps): void;
34
+ /**
35
+ * Scene-private draw prop injected by `syncVideos`: the node's dedicated element, so each
36
+ * `<Video>` paints (and is controlled) independently of other same-src nodes. Absent when
37
+ * `drawVideo` runs outside the engine, which then falls back to the shared src pool.
38
+ */
39
+ export interface VideoDrawProps extends VideoProps {
40
+ _videoElement?: HTMLVideoElement;
41
+ _videoFrame?: HTMLCanvasElement;
42
+ _videoControlsVisible?: boolean;
43
+ /** Pending seek ratio while the user drags the track: the bar previews this position and
44
+ * the element is only seeked once, on pointer release. Written by the engine's seek
45
+ * gesture handlers; absent outside a gesture. */
46
+ _videoScrubRatio?: number;
47
+ }
48
+ /**
49
+ * Applies the declarative playback control (`muted`/`loop`/`currentTime`/`paused`/`autoplay`)
50
+ * to the pooled element. Runs in the engine's per-frame advance pass — never in the draw path —
51
+ * so painting (including image export through `renderTo`) cannot mutate playback state.
52
+ */
53
+ export declare function applyVideoControl(video: HTMLVideoElement, props: VideoProps, beforeSeek?: () => void): void;
54
+ export declare function drawVideo(context: CanvasRenderingContext2D, props: VideoDrawProps): void;
@@ -2,6 +2,7 @@ export type { ButtonProps } from './Button';
2
2
  export type { CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, } from './CanvasView';
3
3
  export type { CarouselItemProps, CarouselProps } from './Carousel';
4
4
  export type { CheckboxProps } from './Checkbox';
5
+ export type { FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, } from './Form';
5
6
  export type { ChoiceGroupProps, ChoiceOption } from './ChoiceGroup';
6
7
  export type { CircleProps } from './Circle';
7
8
  export type { CollapseItemProps, CollapseProps } from './Collapse';
@@ -23,6 +24,6 @@ export type { SwitchProps } from './Switch';
23
24
  export type { TabItemProps, TabsProps } from './Tabs';
24
25
  export type { TextProps } from './Text';
25
26
  export type { TextareaProps } from './Textarea';
26
- export type { UploadProps } from './Upload';
27
+ export type { UploadProps, UploadRejection } from './Upload';
27
28
  export type { VideoProps } from './Video';
28
29
  export type { ComponentSize } from './size';
@@ -0,0 +1,5 @@
1
+ import type { SceneNode } from '../scene';
2
+ import type { AccessibilitySnapshot } from '../types';
3
+ import type { EngineCore } from './state';
4
+ export declare function accessibilityId(node: SceneNode): string;
5
+ export declare function accessibilitySnapshot(core: EngineCore, changed: () => void): AccessibilitySnapshot;
@@ -7,4 +7,4 @@ import type { CarouselTransition, EngineCore, EngineState } from './state';
7
7
  */
8
8
  export declare function transitionProgress(transition: CarouselTransition, time: number): number;
9
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;
10
+ export declare function advanceCarousels(core: EngineCore, state: EngineState, time: number): boolean;
@@ -0,0 +1,21 @@
1
+ import type { FormController, FormErrors, FormRule, FormValue, FormValues } from '../components/Form';
2
+ import { type FormBinding } from '../components/Form/form';
3
+ import type { VNode } from '../types';
4
+ import type { EngineCore, EngineState } from './state';
5
+ export interface FormState {
6
+ values: FormValues;
7
+ errors: FormErrors;
8
+ attempted: boolean;
9
+ revision: number;
10
+ submission: number;
11
+ resetVersion: number;
12
+ validationEpoch: number;
13
+ fieldValidations: Map<string, number>;
14
+ controller?: FormController;
15
+ attachedController?: FormController;
16
+ binding?: FormBinding;
17
+ }
18
+ export declare function disposeForm(form: FormState): void;
19
+ export declare function attachForm(form: FormState): void;
20
+ export declare function validateFormField(value: FormValue, rules: FormRule[], values: Readonly<FormValues>): string | undefined | Promise<string | undefined>;
21
+ export declare function prepareForm(core: EngineCore, state: EngineState, vnode: VNode, path: string): VNode[];
@@ -8,4 +8,5 @@ import type { EngineCore, EngineState } from './state';
8
8
  export declare function pointerDown(core: EngineCore, state: EngineState, event: CanvasPointerEvent): void;
9
9
  export declare function pointerMove(core: EngineCore, state: EngineState, event: CanvasPointerEvent): void;
10
10
  export declare function pointerUp(core: EngineCore, state: EngineState, event: CanvasPointerEvent, cancelled?: boolean): void;
11
+ export declare function pointerLeave(state: EngineState, pointerType: string): void;
11
12
  export declare function wheel(core: EngineCore, state: EngineState, event: CanvasWheelEvent): void;
@@ -1,5 +1,5 @@
1
1
  import type { SceneNode } from '../scene';
2
- import type { Transform, VNode } from '../types';
2
+ import { type Transform, type VNode } from '../types';
3
3
  import type { EngineCore, EngineState, TextControlDescription } from './state';
4
4
  export declare function activeCollapseKeys(state: EngineState, stateKey: string, props: Record<string, unknown>): Set<string>;
5
5
  export declare function layoutCollapseNodes(parent: SceneNode, active: Set<string>): void;
@@ -5,7 +5,7 @@ import type { CanvasUIEventTarget, InputLayout } from '../types';
5
5
  * None of these read engine-level mutable state — they only inspect nodes.
6
6
  */
7
7
  export declare function hasVisibleAncestors(node: SceneNode): boolean;
8
- export declare function hasVisibleOpenDialog(node: SceneNode, parentVisible: boolean): boolean;
8
+ export declare function activeDialog(root: SceneNode): SceneNode | null;
9
9
  export declare function eventTarget(node: SceneNode): CanvasUIEventTarget;
10
10
  export declare function isCanvasElement(value: unknown): value is HTMLCanvasElement;
11
11
  export declare function isInteractive(type: string): boolean;
@@ -15,4 +15,5 @@ export declare function controlSize(node: SceneNode): {
15
15
  width: number;
16
16
  height: number;
17
17
  };
18
- export declare function isTextControlVisible(node: SceneNode, layout: InputLayout): boolean;
18
+ export declare function isTextControlVisible(node: SceneNode, layout: InputLayout, modal?: SceneNode | null): boolean;
19
+ export declare function textControlLayout(node: SceneNode, layout: InputLayout, modal: SceneNode | null): InputLayout;
@@ -1,7 +1,9 @@
1
1
  import type { SceneNode } from '../scene';
2
2
  import type { CanvasRenderer } from '../renderer';
3
3
  import type { CanvasUIEvent, InputLayout, TextControlProps, WebInputBridge } from '../types';
4
+ import type { ManagedVideo } from '../video-assets';
4
5
  import type { VirtualGridLayout } from './vnodes';
6
+ import type { FormState } from './forms';
5
7
  /** A text input/date/textarea currently mirrored into the DOM overlay bridge. */
6
8
  export interface MountedTextControl {
7
9
  node: SceneNode;
@@ -62,8 +64,12 @@ export declare class EngineState {
62
64
  readonly textControls: Map<string, MountedTextControl>;
63
65
  readonly inputValues: Map<string, string>;
64
66
  readonly imageSubscriptions: Map<string, () => void>;
65
- readonly videoSubscriptions: Map<string, () => void>;
67
+ /** Dedicated video element per scene node, so same-src nodes stay independently controllable. */
68
+ readonly videoElements: Map<SceneNode, ManagedVideo>;
66
69
  readonly videoFrames: Map<SceneNode, VideoFrameTracker>;
70
+ /** Video nodes with a usable `src`, collected by the last `syncVideos` pass, so the
71
+ * per-frame advance loop walks this cache instead of traversing the whole scene. */
72
+ readonly videoNodes: SceneNode[];
67
73
  readonly tabSelections: Map<string, string>;
68
74
  readonly carouselSelections: Map<string, number>;
69
75
  readonly carouselFrameTimes: Map<string, number>;
@@ -72,9 +78,14 @@ export declare class EngineState {
72
78
  readonly gridScrollPositions: Map<string, number>;
73
79
  readonly virtualGridLayouts: Map<string, VirtualGridLayout>;
74
80
  readonly activeVirtualGridKeys: Set<string>;
81
+ readonly forms: Map<string, FormState>;
82
+ readonly activeFormKeys: Set<string>;
75
83
  readonly pointerSequences: Map<number, PointerSequence>;
76
84
  activeSlider: SceneNode | null;
77
85
  activeButton: SceneNode | null;
78
86
  activeGridScroll: GridScrollGesture | null;
87
+ /** The video node whose seek track is being scrubbed, mirroring the slider drag gesture. */
88
+ activeVideo: SceneNode | null;
89
+ hoveredVideo: SceneNode | null;
79
90
  currentFrameTime: number;
80
91
  }
@@ -0,0 +1,5 @@
1
+ import type { SceneNode } from '../scene';
2
+ import type { EngineCore } from './state';
3
+ export declare function chooseUploadFiles(node: SceneNode, core: EngineCore): void;
4
+ export declare function removeUploadFile(node: SceneNode, core: EngineCore, index: number): void;
5
+ export declare function uploadRowAt(node: SceneNode, x: number, y: number): number | undefined;
@@ -1,14 +1,28 @@
1
+ import type { ManagedVideo } from '../video-assets';
2
+ import type { SceneNode } from '../scene';
1
3
  import type { EngineCore, EngineState } from './state';
4
+ export declare function enterVideoFullscreen(managed: ManagedVideo, node: SceneNode): void;
2
5
  /**
3
- * Subscribes the engine to the shared video pool for every `video` source in the scene,
4
- * tearing down (and unloading) subscriptions for sources that disappear. Load events mark
5
- * the scene dirty and forward to each video node's `onError`/`onTimeUpdate` callbacks.
6
+ * Rebuilds the cached list of `video` scene nodes and gives every node a dedicated
7
+ * `<video>` element, tearing down (and unloading) elements for nodes that leave the scene or
8
+ * switch `src`. Each element reports load errors and `timeupdate` directly to its own node's
9
+ * callbacks, and is injected as the `_videoElement` draw prop so the draw path paints the node's
10
+ * element — same-src nodes therefore never share playback state.
11
+ *
12
+ * <p>Called from `reconcile()` after the scene children synced, so the cache stays accurate:
13
+ * nodes only enter or leave the scene during a reconcile, which always runs this pass.</p>
6
14
  */
7
15
  export declare function syncVideos(core: EngineCore, state: EngineState): void;
8
16
  /**
9
17
  * Keeps the scene dirty exactly while a video advances: a drawn frame is worth one repaint,
10
- * so a new frame (or a video that just started playing) dirties the scene once. Paused,
11
- * ended and hidden videos cost nothing, and the loop survives seeks and playback-rate
12
- * changes because it watches `currentTime` rather than a paused flag.
18
+ * so a new frame (or a video that just started playing) dirties the scene once. Paused, ended
19
+ * and hidden videos cost nothing, and the loop survives seeks and playback-rate changes
20
+ * because it watches `currentTime` rather than a paused flag.
21
+ *
22
+ * <p>Walks the node list cached by {@link syncVideos} instead of traversing the scene, so this
23
+ * per-frame pass costs O(video nodes) rather than O(scene nodes); recycling of trackers for
24
+ * removed nodes also happens once per reconcile instead of once per frame. Each node's
25
+ * declarative playback control is applied to its own dedicated element here — the draw path
26
+ * (including image export via `renderTo`) never mutates playback state.</p>
13
27
  */
14
28
  export declare function advanceVideos(core: EngineCore, state: EngineState): void;
package/types/engine.d.ts CHANGED
@@ -25,11 +25,13 @@ export declare class CanvasEngine {
25
25
  update(tree: VNode[]): void;
26
26
  private reconcile;
27
27
  render(): void;
28
+ private syncAccessibility;
28
29
  requestRender(): void;
29
30
  renderTo(context: CanvasRenderingContext2D, scaleX: number, scaleY: number): void;
30
31
  start(): void;
31
32
  pointerDown(event: CanvasPointerEvent): void;
32
33
  pointerMove(event: CanvasPointerEvent): void;
34
+ pointerLeave(pointerType: string): void;
33
35
  pointerUp(event: CanvasPointerEvent, cancelled?: boolean): void;
34
36
  wheel(event: CanvasWheelEvent): void;
35
37
  destroy(): void;