drawnui-react 0.1.0-preview.4 → 0.1.0-preview.40
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 +119 -14
- package/SKIPPED.md +36 -26
- package/dist/controls/AnimatedFramesRenderer.d.ts +9 -0
- package/dist/controls/AnimatedFramesRenderer.js +18 -1
- package/dist/controls/DrawnGame.d.ts +44 -0
- package/dist/controls/DrawnGame.js +82 -0
- package/dist/controls/GridStructure.d.ts +16 -2
- package/dist/controls/GridStructure.js +40 -4
- package/dist/controls/SkiaBackdrop.d.ts +8 -2
- package/dist/controls/SkiaBackdrop.js +42 -14
- package/dist/controls/SkiaButton.d.ts +17 -3
- package/dist/controls/SkiaButton.js +26 -8
- package/dist/controls/SkiaCarousel.d.ts +22 -3
- package/dist/controls/SkiaCarousel.js +85 -9
- package/dist/controls/SkiaCheckbox.d.ts +0 -1
- package/dist/controls/SkiaCheckbox.js +2 -7
- package/dist/controls/SkiaDrawer.d.ts +15 -0
- package/dist/controls/SkiaDrawer.js +42 -7
- package/dist/controls/SkiaEditor.d.ts +48 -2
- package/dist/controls/SkiaEditor.js +268 -53
- package/dist/controls/SkiaGif.d.ts +7 -0
- package/dist/controls/SkiaGif.js +25 -4
- package/dist/controls/SkiaImage.d.ts +5 -0
- package/dist/controls/SkiaImage.js +48 -14
- package/dist/controls/SkiaLabel.d.ts +117 -9
- package/dist/controls/SkiaLabel.js +526 -80
- package/dist/controls/SkiaLabelFps.d.ts +16 -0
- package/dist/controls/SkiaLabelFps.js +41 -0
- package/dist/controls/SkiaLayout.d.ts +89 -9
- package/dist/controls/SkiaLayout.js +364 -21
- package/dist/controls/SkiaLottie.js +5 -3
- package/dist/controls/SkiaProgress.d.ts +2 -1
- package/dist/controls/SkiaProgress.js +8 -5
- package/dist/controls/SkiaRadioButton.d.ts +2 -0
- package/dist/controls/SkiaRadioButton.js +16 -4
- package/dist/controls/SkiaRichLabel.d.ts +1 -1
- package/dist/controls/SkiaRichLabel.js +11 -1
- package/dist/controls/SkiaScroll.d.ts +35 -5
- package/dist/controls/SkiaScroll.js +252 -32
- package/dist/controls/SkiaScrollBar.d.ts +27 -0
- package/dist/controls/SkiaScrollBar.js +51 -2
- package/dist/controls/SkiaShaderCarousel.d.ts +11 -1
- package/dist/controls/SkiaShaderCarousel.js +27 -5
- package/dist/controls/SkiaShape.d.ts +13 -2
- package/dist/controls/SkiaShape.js +50 -10
- package/dist/controls/SkiaSlider.d.ts +20 -2
- package/dist/controls/SkiaSlider.js +61 -7
- package/dist/controls/SkiaSprite.d.ts +4 -0
- package/dist/controls/SkiaSprite.js +22 -10
- package/dist/controls/SkiaSvg.d.ts +4 -0
- package/dist/controls/SkiaSvg.js +28 -4
- package/dist/controls/SkiaSwitch.d.ts +0 -1
- package/dist/controls/SkiaSwitch.js +4 -8
- package/dist/controls/SkiaToggle.d.ts +25 -5
- package/dist/controls/SkiaToggle.js +58 -5
- package/dist/controls/SnappingLayout.d.ts +12 -1
- package/dist/controls/SnappingLayout.js +21 -2
- package/dist/controls/TooltipStyle.d.ts +52 -0
- package/dist/controls/TooltipStyle.js +88 -0
- package/dist/core/Accessibility.d.ts +134 -0
- package/dist/core/Accessibility.js +675 -9
- package/dist/core/Animators.d.ts +37 -1
- package/dist/core/Animators.js +102 -9
- package/dist/core/Canvas.d.ts +222 -10
- package/dist/core/Canvas.js +698 -37
- package/dist/core/ControlStyle.d.ts +2 -0
- package/dist/core/ControlStyle.js +2 -0
- package/dist/core/Easing.d.ts +12 -1
- package/dist/core/Easing.js +25 -1
- package/dist/core/Gestures.d.ts +81 -2
- package/dist/core/Gestures.js +177 -3
- package/dist/core/Hover.d.ts +51 -0
- package/dist/core/Hover.js +140 -0
- package/dist/core/ImageEffects.d.ts +2 -0
- package/dist/core/ImageEffects.js +2 -0
- package/dist/core/KeyboardManager.d.ts +40 -0
- package/dist/core/KeyboardManager.js +98 -8
- package/dist/core/PopupWindows.d.ts +94 -0
- package/dist/core/PopupWindows.js +205 -0
- package/dist/core/ScrollAnimators.js +9 -0
- package/dist/core/Shaping.d.ts +40 -0
- package/dist/core/Shaping.js +224 -0
- package/dist/core/SkiaControl.d.ts +279 -10
- package/dist/core/SkiaControl.js +621 -64
- package/dist/core/SkiaEffect.d.ts +17 -0
- package/dist/core/SkiaEffect.js +43 -8
- package/dist/core/SkiaImageManager.js +1 -1
- package/dist/core/Super.d.ts +29 -2
- package/dist/core/Super.js +54 -3
- package/dist/core/Tooltips.d.ts +71 -0
- package/dist/core/Tooltips.js +205 -0
- package/dist/core/Types.d.ts +11 -1
- package/dist/core/Types.js +32 -1
- package/dist/core/ViewsAdapter.d.ts +7 -2
- package/dist/core/ViewsAdapter.js +10 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/react/SkiaShell.js +65 -26
- package/dist/react/index.d.ts +33 -4
- package/dist/react/index.js +157 -18
- package/dist/react/reconciler.d.ts +20 -0
- package/dist/react/reconciler.js +69 -14
- package/dist/vite/index.d.ts +9 -0
- package/dist/vite/index.js +36 -3
- package/package.json +61 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { InputKey } from "./KeyboardManager";
|
|
1
2
|
import type { SkiaControl } from "./SkiaControl";
|
|
2
3
|
import { SKRect } from "./Types";
|
|
4
|
+
/** Controls with `AccessibilityModal` set, on every canvas (drawnui-cross 6av). Empty: no modal work at all. */
|
|
5
|
+
export declare const AccessibilityModals: Set<SkiaControl>;
|
|
3
6
|
/** ARIA role constants (DrawnUi.Models.Aria) for `AccessibilityRole`. */
|
|
4
7
|
export declare const Aria: {
|
|
5
8
|
readonly RoleButton: "button";
|
|
@@ -38,10 +41,25 @@ export declare const Aria: {
|
|
|
38
41
|
readonly RoleRegion: "region";
|
|
39
42
|
readonly RoleNavigation: "navigation";
|
|
40
43
|
readonly RoleMain: "main";
|
|
44
|
+
readonly RoleGrid: "grid";
|
|
45
|
+
readonly RoleToolbar: "toolbar";
|
|
46
|
+
readonly RoleRadioGroup: "radiogroup";
|
|
47
|
+
readonly RoleMenuBar: "menubar";
|
|
41
48
|
/** Removes the control from the accessibility tree even when a default role would apply (inner label of a button). */
|
|
42
49
|
readonly RolePresentation: "presentation";
|
|
43
50
|
readonly LivePolite: "polite";
|
|
44
51
|
readonly LiveAssertive: "assertive";
|
|
52
|
+
/**
|
|
53
|
+
* Container roles whose items the arrow keys walk (C# Aria.IsCompositeRole): a layout with one of them is one Tab stop,
|
|
54
|
+
* its current item, and the arrow keys move between its items.
|
|
55
|
+
*/
|
|
56
|
+
readonly IsCompositeRole: (role?: string) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Roles a user operates (C# Aria.IsInteractiveRole, as DrawnUi.Rust is_control_role): a node with one of them that
|
|
59
|
+
* cannot take input is read as disabled (aria-disabled). C# also lists listbox and scrollbar; here a listbox is an
|
|
60
|
+
* arrow-key group and groups are never disabled.
|
|
61
|
+
*/
|
|
62
|
+
readonly IsInteractiveRole: (role?: string) => boolean;
|
|
45
63
|
};
|
|
46
64
|
/** One laid-out text line exposed for native selection (AccessibilityTextSelectable): CSS px relative to the node. */
|
|
47
65
|
export interface AccessibilityTextLine {
|
|
@@ -54,6 +72,17 @@ export interface AccessibilityTextLine {
|
|
|
54
72
|
FontWeight: number;
|
|
55
73
|
FontSize: number;
|
|
56
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The value of a range control (a slider, a progress bar): what a screen reader reads and adjusts (drawnui-cross 6c,
|
|
77
|
+
* C# AccessibilityValue): aria-valuenow / min / max, and aria-valuetext when Text is not empty ("65%", "20 – 80").
|
|
78
|
+
*/
|
|
79
|
+
export interface AccessibilityValue {
|
|
80
|
+
Now: number;
|
|
81
|
+
Min: number;
|
|
82
|
+
Max: number;
|
|
83
|
+
Step: number;
|
|
84
|
+
Text: string;
|
|
85
|
+
}
|
|
57
86
|
/** One entry of the accessibility snapshot (DrawnUi AccessibilityNode). Rect is CSS pixels relative to the canvas. */
|
|
58
87
|
export interface AccessibilityNode {
|
|
59
88
|
Id: number;
|
|
@@ -62,9 +91,15 @@ export interface AccessibilityNode {
|
|
|
62
91
|
Role: string;
|
|
63
92
|
Rect: SKRect;
|
|
64
93
|
CanInteract: boolean;
|
|
94
|
+
/** A role a user operates (Aria.IsInteractiveRole) that cannot take input: aria-disabled, no tab stop. */
|
|
95
|
+
Disabled: boolean;
|
|
65
96
|
IsPressed?: boolean;
|
|
97
|
+
/** A control that opens something (a menu title): open or closed (aria-expanded); undefined when it opens nothing. */
|
|
98
|
+
Expanded?: boolean;
|
|
66
99
|
Live?: string;
|
|
67
100
|
Source: SkiaControl;
|
|
101
|
+
/** A range control's value (aria-valuenow / min / max / valuetext); its name stays the app's label. */
|
|
102
|
+
Value?: AccessibilityValue;
|
|
68
103
|
/** Real text lines rendered into the overlay so the browser can select / copy them (opt-in per control). */
|
|
69
104
|
TextLines?: AccessibilityTextLine[];
|
|
70
105
|
}
|
|
@@ -81,6 +116,7 @@ export declare class SkiaAccessibilityManager {
|
|
|
81
116
|
private pending;
|
|
82
117
|
private readonly changed;
|
|
83
118
|
private readonly liveUpdated;
|
|
119
|
+
private readonly keyboardFocusRequested;
|
|
84
120
|
/** Minimum milliseconds between snapshot rebuilds. */
|
|
85
121
|
MinUpdateIntervalMs: number;
|
|
86
122
|
Snapshot: AccessibilityNode[];
|
|
@@ -89,9 +125,106 @@ export declare class SkiaAccessibilityManager {
|
|
|
89
125
|
OnChanged(cb: () => void): () => void;
|
|
90
126
|
/** Fired immediately (bypassing the rate limit) when a live-region node's value changes. */
|
|
91
127
|
OnLiveRegionUpdated(cb: (node: SkiaControl) => void): () => void;
|
|
128
|
+
/**
|
|
129
|
+
* Keyboard focus moved by the manager itself (arrow keys in a group): the overlay moves DOM focus to that node's
|
|
130
|
+
* element (C# KeyboardFocusRequested). Returns the unsubscribe function.
|
|
131
|
+
*/
|
|
132
|
+
OnKeyboardFocusRequested(cb: (node: SkiaControl | undefined) => void): () => void;
|
|
92
133
|
NotifyFocused(node?: SkiaControl): void;
|
|
134
|
+
/**
|
|
135
|
+
* Enter / Space from keyboard navigation or a screen reader: activates the node only while a tap could reach it
|
|
136
|
+
* (AccessibilityCanInteract), the rule every head applies.
|
|
137
|
+
*/
|
|
138
|
+
static Activate(node?: SkiaControl): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Arrow keys, Home / End, PageUp / PageDown for the node in keyboard focus: the control gets them first, only while a
|
|
141
|
+
* pan could reach it (a slider steps its value); keys it does not use move keyboard focus between the items of the
|
|
142
|
+
* group around it (MoveInGroup). True when the key was used.
|
|
143
|
+
*/
|
|
144
|
+
static Key(node: SkiaControl | undefined, key: InputKey): boolean;
|
|
145
|
+
/** Last focused node of each group: where Tab enters the group. */
|
|
146
|
+
private readonly groupFocus;
|
|
147
|
+
private groupRequest?;
|
|
148
|
+
/**
|
|
149
|
+
* The arrow-key group around `control`: its nearest ancestor with a composite role (Aria.IsCompositeRole, e.g.
|
|
150
|
+
* Aria.RoleList on a SkiaStack), and the item of that group holding the control (one of its children, a cell).
|
|
151
|
+
*/
|
|
152
|
+
static TryFindGroup(control: SkiaControl): {
|
|
153
|
+
Group: SkiaControl;
|
|
154
|
+
Item: SkiaControl;
|
|
155
|
+
Holder: SkiaControl;
|
|
156
|
+
} | undefined;
|
|
157
|
+
/** Remembers where keyboard focus is inside its group, so the next Tab into the group lands there. */
|
|
158
|
+
private NoteFocus;
|
|
159
|
+
/**
|
|
160
|
+
* Whether Tab / Shift+Tab stop on this node. A group of items is one Tab stop, like a native list: its current item
|
|
161
|
+
* (the one keyboard focus last had there, else the group's first usable node) plus the controls inside that same
|
|
162
|
+
* item; the arrow keys move between items. Every node outside a group is a stop.
|
|
163
|
+
*/
|
|
164
|
+
IsTabStop(node: SkiaControl): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Moves keyboard focus between the items of the group around `focused`, by item index like a native list: Down / Up in
|
|
167
|
+
* a Column, Right / Left in a Row, all four in a Wrap, a Grid or a Split layout (Up / Down by one row), Home / End to the
|
|
168
|
+
* first / last item, PageDown / PageUp by one viewport of the scroll around it. The ends stop the arrows, unless the group has KeyboardWrap. The target is the
|
|
169
|
+
* item itself when it is an interactive node, else its first interactive node; items the pointer cannot use are
|
|
170
|
+
* skipped. An item not realized (recycled cells) is scrolled in with ScrollToIndex when the group is the scroll's
|
|
171
|
+
* content, and focused once drawn. True when the key belongs to the group.
|
|
172
|
+
*/
|
|
173
|
+
MoveInGroup(focused: SkiaControl, key: InputKey): boolean;
|
|
174
|
+
private focusRequest?;
|
|
175
|
+
private popupFocusRoot?;
|
|
176
|
+
private focusAnyInside;
|
|
177
|
+
/** The keyboard goes to this control at the end of the next frame (a popup closed: back to what opened it). */
|
|
178
|
+
RequestKeyboardFocus(control: SkiaControl): void;
|
|
179
|
+
private appFocus?;
|
|
180
|
+
private appFocusDeadline;
|
|
181
|
+
private appFocusThisFrame;
|
|
182
|
+
private clearFocusRequest;
|
|
183
|
+
/**
|
|
184
|
+
* App code moves the keyboard and screen-reader focus at the end of the next frame (C# DrawnView.SetAccessibilityFocus,
|
|
185
|
+
* Rust `Cx::set_accessibility_focus`), for a custom menu that moves its highlight: to `control`, which gets it once
|
|
186
|
+
* drawn, within 3 seconds. It wins over the library's own moves in the same frame (a group's arrow move, a closed popup
|
|
187
|
+
* window giving the keyboard back to its opener); undefined cancels a move still waiting, the focus stays where it is.
|
|
188
|
+
* The focus ring shows only if the keyboard is in use (the browser's focus-visible).
|
|
189
|
+
*/
|
|
190
|
+
SetAccessibilityFocus(control?: SkiaControl): void;
|
|
191
|
+
/**
|
|
192
|
+
* No drawn control keeps the keyboard and screen-reader focus (C# KeyboardFocusNode = null): at the end of the next
|
|
193
|
+
* frame the DOM focus goes back to the canvas and the keys belong to the app again.
|
|
194
|
+
*/
|
|
195
|
+
ClearKeyboardFocus(): void;
|
|
196
|
+
private ProcessAppFocus;
|
|
197
|
+
private popupScope?;
|
|
198
|
+
/**
|
|
199
|
+
* While set, Tab stays inside this control: only its nodes are Tab stops and Tab / Shift+Tab go round them: the top
|
|
200
|
+
* popup window that takes input (a menu, a dropdown; set by the canvas), else the active modal.
|
|
201
|
+
*/
|
|
202
|
+
get KeyboardScope(): SkiaControl | undefined;
|
|
203
|
+
set KeyboardScope(v: SkiaControl | undefined);
|
|
204
|
+
/** The modal that accessibility is limited to: the topmost `AccessibilityModal` control that shows. Undefined when none. */
|
|
205
|
+
ActiveModal?: SkiaControl;
|
|
206
|
+
private readonly modalReturns;
|
|
207
|
+
/** A control behind the active modal (not in it, not in a popup window over it): no focus for navigation. */
|
|
208
|
+
IsOutsideModal(control: SkiaControl): boolean;
|
|
209
|
+
/** Frame end, only while some control is flagged modal or one was active: follows the top modal. */
|
|
210
|
+
private UpdateActiveModal;
|
|
211
|
+
/** The Tab stop after (or before) `from` in reading order; inside a KeyboardScope it goes round, never leaving. */
|
|
212
|
+
NextTabStop(from: SkiaControl | undefined, forward: boolean): SkiaControl | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* A popup window just opened: at the end of the frame that draws it, the keyboard goes to its arrow-key group's current
|
|
215
|
+
* choice (a checked radio, menuitemradio, option or tab), else to its first interactive item, however it was opened.
|
|
216
|
+
*/
|
|
217
|
+
FocusOpenedPopup(root: SkiaControl): void;
|
|
218
|
+
private ProcessFocusRequests;
|
|
219
|
+
/** Frame end: focus the requested item once it is drawn, skipping items that cannot take input. */
|
|
220
|
+
private ProcessGroupFocus;
|
|
221
|
+
private FocusFromKeyboard;
|
|
222
|
+
private Focus;
|
|
93
223
|
Register(node: SkiaControl): void;
|
|
94
224
|
NotifyUpdated(node: SkiaControl): void;
|
|
225
|
+
/** What the last snapshot says for each live region, to rebuild on the next frame when that changes. */
|
|
226
|
+
private readonly liveSaid;
|
|
227
|
+
private LiveChanged;
|
|
95
228
|
ForceRebuildOnNextFrame(): void;
|
|
96
229
|
Unregister(node: SkiaControl): void;
|
|
97
230
|
UnregisterSubtree(root: SkiaControl): void;
|
|
@@ -100,5 +233,6 @@ export declare class SkiaAccessibilityManager {
|
|
|
100
233
|
* per MinUpdateIntervalMs otherwise (keeps rects in sync with scrolling); notifies only when the snapshot differs.
|
|
101
234
|
*/
|
|
102
235
|
OnFrameEnd(scale: number, canvasWidthPx: number, canvasHeightPx: number, requestFrame: () => void): void;
|
|
236
|
+
private Rebuild;
|
|
103
237
|
private static Same;
|
|
104
238
|
}
|