@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.
@@ -1,4 +1,4 @@
1
- import type { InputEvents, InputLayout, TextControlProps, WebInputBridge as WebInputBridgeContract } from './types';
1
+ import type { AccessibilitySnapshot, InputEvents, InputLayout, TextControlProps, WebInputBridge as WebInputBridgeContract } from './types';
2
2
  /**
3
3
  * The CSS that makes the transparent element lay its text out where the Canvas drawing puts it: same
4
4
  * font metrics, same horizontal inset. Left to the browser default font, a click is converted into a
@@ -8,17 +8,31 @@ import type { InputEvents, InputLayout, TextControlProps, WebInputBridge as WebI
8
8
  export declare function overlayTextStyle(props: TextControlProps, multiline: boolean): Record<string, string>;
9
9
  export declare class WebInputBridge implements WebInputBridgeContract {
10
10
  private readonly mounted;
11
+ private readonly accessible;
12
+ private readonly errors;
11
13
  private readonly fileInputs;
12
14
  private readonly originalDisplay;
13
15
  private overlayHidden;
14
16
  private selectionTracked;
15
17
  private readonly overlay;
18
+ private dialogElement;
19
+ private dialogId;
20
+ private returnFocus;
21
+ private returnFocusId;
22
+ private dialogCancel;
16
23
  constructor(overlay: HTMLElement);
17
24
  mount(id: string, props: TextControlProps, layout: InputLayout, events: InputEvents): () => void;
18
25
  update(id: string, props: TextControlProps, layout: InputLayout): void;
19
26
  pickFiles(accept: string | undefined, multiple: boolean, onChange: (files: File[]) => void): void;
20
27
  focus(id: string): void;
21
28
  setOverlayVisible(visible: boolean): void;
29
+ prepareAccessibility(dialogId: string | undefined): void;
30
+ syncAccessibility(snapshot: AccessibilitySnapshot): void;
31
+ private updateAccessible;
32
+ private setError;
33
+ private removeError;
34
+ private dialogFocusable;
35
+ private readonly handleDialogKey;
22
36
  private unmount;
23
37
  destroy(): void;
24
38
  private find;
package/types/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, CircleProps, CollapseItemProps, CollapseProps, CustomDrawProps, CanvasViewProps, DatePickerProps, DialogProps, DropdownProps, GridItemProps, GridProps, GroupProps, IconProps, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, VideoProps } from './components/types';
2
- export type ComponentKind = 'group' | 'grid' | 'gridItem' | 'rect' | 'circle' | 'text' | 'input' | 'datePicker' | 'radio' | 'checkbox' | 'upload' | 'carousel' | 'carouselItem' | 'textarea' | 'dropdown' | 'slider' | 'switch' | 'button' | 'image' | 'icon' | 'dialog' | 'progress' | 'tabs' | 'tabItem' | 'collapse' | 'collapseItem' | 'customDraw' | 'canvasView' | 'video';
1
+ import type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, CircleProps, CollapseItemProps, CollapseProps, CustomDrawProps, CanvasViewProps, DatePickerProps, DialogProps, DropdownProps, GridItemProps, GridProps, GroupProps, FormProps, FormItemProps, IconProps, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, VideoProps } from './components/types';
2
+ export type ComponentKind = 'group' | 'form' | 'formItem' | 'grid' | 'gridItem' | 'rect' | 'circle' | 'text' | 'input' | 'datePicker' | 'radio' | 'checkbox' | 'upload' | 'carousel' | 'carouselItem' | 'textarea' | 'dropdown' | 'slider' | 'switch' | 'button' | 'image' | 'icon' | 'dialog' | 'progress' | 'tabs' | 'tabItem' | 'collapse' | 'collapseItem' | 'customDraw' | 'canvasView' | 'video';
3
3
  export type Transform = readonly [number, number, number, number, number, number];
4
4
  export interface TransformProps {
5
5
  x?: number;
@@ -8,6 +8,8 @@ export interface TransformProps {
8
8
  scaleX?: number;
9
9
  scaleY?: number;
10
10
  visible?: boolean;
11
+ /** Accessible name for interactive controls. */
12
+ ariaLabel?: string;
11
13
  }
12
14
  export interface CanvasWheelEvent {
13
15
  currentTarget: HTMLCanvasElement;
@@ -16,9 +18,11 @@ export interface CanvasWheelEvent {
16
18
  deltaY: number;
17
19
  preventDefault(): void;
18
20
  }
19
- export type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, ChoiceOption, CircleProps, CollapseItemProps, CollapseProps, ComponentSize, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, DatePickerProps, DialogProps, DropdownOption, DropdownProps, GridItemProps, GridProps, GroupProps, IconName, IconProps, IconVariant, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, VideoProps, } from './components/types';
21
+ export type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, ChoiceOption, CircleProps, CollapseItemProps, CollapseProps, ComponentSize, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, DatePickerProps, DialogProps, DropdownOption, DropdownProps, GridItemProps, GridProps, GroupProps, FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, IconName, IconProps, IconVariant, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, UploadRejection, VideoProps, } from './components/types';
20
22
  export interface CanvasComponentProps {
21
23
  group: Omit<GroupProps, 'children'>;
24
+ form: Omit<FormProps, 'children'>;
25
+ formItem: Omit<FormItemProps, 'children'>;
22
26
  grid: Omit<GridProps, 'children'>;
23
27
  gridItem: Omit<GridItemProps, 'children'>;
24
28
  rect: RectProps;
@@ -63,6 +67,7 @@ export interface InputLayout {
63
67
  height: number;
64
68
  transform: Transform;
65
69
  visible: boolean;
70
+ clipPath?: string;
66
71
  }
67
72
  export type TextControlProps = InputProps | DatePickerProps | TextareaProps;
68
73
  export interface InputEvents {
@@ -72,11 +77,44 @@ export interface InputEvents {
72
77
  blur: () => void;
73
78
  scroll: (scrollTop: number, scrollHeight: number, clientHeight: number, clientWidth: number) => void;
74
79
  }
80
+ export interface AccessibleControl {
81
+ id: string;
82
+ kind: 'button' | 'switch' | 'checkbox' | 'radio' | 'slider' | 'select';
83
+ label: string;
84
+ layout: InputLayout;
85
+ disabled: boolean;
86
+ checked?: boolean;
87
+ group?: string;
88
+ value?: string | number;
89
+ min?: number;
90
+ max?: number;
91
+ step?: number;
92
+ options?: Array<{
93
+ label: string;
94
+ value: string;
95
+ disabled?: boolean;
96
+ }>;
97
+ error?: string;
98
+ activate?: () => void;
99
+ change?: (value: string) => void;
100
+ blur?: () => void;
101
+ }
102
+ export interface AccessibilitySnapshot {
103
+ controls: AccessibleControl[];
104
+ order: string[];
105
+ dialog?: {
106
+ id: string;
107
+ label: string;
108
+ cancel: () => void;
109
+ };
110
+ }
75
111
  export interface WebInputBridge {
76
112
  mount(id: string, props: TextControlProps, layout: InputLayout, events: InputEvents): () => void;
77
113
  update(id: string, props: TextControlProps, layout: InputLayout): void;
78
114
  pickFiles(accept: string | undefined, multiple: boolean, onChange: (files: File[]) => void): void;
79
115
  setOverlayVisible(visible: boolean): void;
116
+ prepareAccessibility?(dialogId: string | undefined): void;
117
+ syncAccessibility?(snapshot: AccessibilitySnapshot): void;
80
118
  destroy(): void;
81
119
  }
82
120
  export interface CanvasProps {
@@ -9,3 +9,20 @@ export declare function peekCanvasVideo(src: string): HTMLVideoElement | null;
9
9
  export declare function subscribeCanvasVideo(src: string, onLoad: VideoLoadListener, onTime: VideoTimeListener): () => void;
10
10
  /** Drops one node reference; unloads the shared element once no node holds it. */
11
11
  export declare function releaseCanvasVideo(src: string): void;
12
+ /** A dedicated `<video>` element owned by one scene node. */
13
+ export interface ManagedVideo {
14
+ src: string;
15
+ video: HTMLVideoElement;
16
+ frame: HTMLCanvasElement | undefined;
17
+ captureFrame: () => void;
18
+ fullscreenCleanup?: () => void;
19
+ /** Detaches the listeners, pauses and unloads the element. */
20
+ dispose: () => void;
21
+ }
22
+ /**
23
+ * Creates an element bound to a single consumer instead of the shared pool: playback state
24
+ * (paused/currentTime/muted/loop) belongs to this element alone, so same-src nodes can be
25
+ * controlled independently. `onLoad` reports readiness or a definitive load failure, `onTime`
26
+ * forwards `timeupdate`.
27
+ */
28
+ export declare function createCanvasVideo(src: string, onLoad: VideoLoadListener, onTime: VideoTimeListener, onSeeked?: () => void): ManagedVideo;