drawnui-react 0.1.0-preview.42 → 0.1.0-preview.43
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 +42 -7
- package/SKIPPED.md +6 -6
- package/dist/controls/GridStructure.d.ts +9 -1
- package/dist/controls/GridStructure.js +41 -1
- package/dist/controls/SkiaEditor.d.ts +4 -1
- package/dist/controls/SkiaEditor.js +20 -2
- package/dist/controls/SkiaLabel.d.ts +68 -2
- package/dist/controls/SkiaLabel.js +368 -8
- package/dist/controls/SkiaScroll.d.ts +34 -2
- package/dist/controls/SkiaScroll.js +99 -3
- package/dist/controls/SkiaShape.d.ts +2 -0
- package/dist/controls/SkiaShape.js +7 -0
- package/dist/core/Accessibility.d.ts +18 -13
- package/dist/core/Accessibility.js +175 -29
- package/dist/core/Canvas.d.ts +91 -6
- package/dist/core/Canvas.js +500 -29
- package/dist/core/Gestures.d.ts +10 -1
- package/dist/core/Gestures.js +12 -1
- package/dist/core/PopupWindows.js +2 -0
- package/dist/core/ScrollAnimators.d.ts +6 -0
- package/dist/core/ScrollAnimators.js +7 -1
- package/dist/core/SkiaControl.d.ts +3 -2
- package/dist/core/SkiaControl.js +4 -2
- package/dist/core/SkiaImageManager.d.ts +7 -6
- package/dist/core/SkiaImageManager.js +20 -10
- package/dist/core/Super.d.ts +2 -0
- package/dist/core/Super.js +2 -9
- package/dist/core/TextInputProxy.d.ts +31 -1
- package/dist/core/TextInputProxy.js +97 -15
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +43 -36
- package/package.json +20 -4
|
@@ -61,17 +61,6 @@ export declare const Aria: {
|
|
|
61
61
|
*/
|
|
62
62
|
readonly IsInteractiveRole: (role?: string) => boolean;
|
|
63
63
|
};
|
|
64
|
-
/** One laid-out text line exposed for native selection (AccessibilityTextSelectable): CSS px relative to the node. */
|
|
65
|
-
export interface AccessibilityTextLine {
|
|
66
|
-
Text: string;
|
|
67
|
-
Left: number;
|
|
68
|
-
Top: number;
|
|
69
|
-
Width: number;
|
|
70
|
-
Height: number;
|
|
71
|
-
FontFamily: string;
|
|
72
|
-
FontWeight: number;
|
|
73
|
-
FontSize: number;
|
|
74
|
-
}
|
|
75
64
|
/**
|
|
76
65
|
* The value of a range control (a slider, a progress bar): what a screen reader reads and adjusts (drawnui-cross 6c,
|
|
77
66
|
* C# AccessibilityValue): aria-valuenow / min / max, and aria-valuetext when Text is not empty ("65%", "20 – 80").
|
|
@@ -100,8 +89,6 @@ export interface AccessibilityNode {
|
|
|
100
89
|
Source: SkiaControl;
|
|
101
90
|
/** A range control's value (aria-valuenow / min / max / valuetext); its name stays the app's label. */
|
|
102
91
|
Value?: AccessibilityValue;
|
|
103
|
-
/** Real text lines rendered into the overlay so the browser can select / copy them (opt-in per control). */
|
|
104
|
-
TextLines?: AccessibilityTextLine[];
|
|
105
92
|
}
|
|
106
93
|
/**
|
|
107
94
|
* Mirrors DrawnUi SkiaAccessibilityManager: registry of accessible controls + a rate-limited snapshot
|
|
@@ -222,6 +209,14 @@ export declare class SkiaAccessibilityManager {
|
|
|
222
209
|
private UpdateActiveModal;
|
|
223
210
|
/** The Tab stop after (or before) `from` in reading order; inside a KeyboardScope it goes round, never leaving. */
|
|
224
211
|
NextTabStop(from: SkiaControl | undefined, forward: boolean): SkiaControl | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Tab and Shift+Tab through a templated list whose cells are made on demand (DrawnUi.Net ac70a1d9): from a cell the
|
|
214
|
+
* keyboard goes to the next (previous) item, scrolled in and focused once drawn, unless the next stop is in the same
|
|
215
|
+
* cell; at the list's end it leaves the list. Entering the list it goes to its first (last) item. The overlay's DOM order
|
|
216
|
+
* lags the cells made while the list scrolls, so inside a list the browser's own Tab order is not used. True when it
|
|
217
|
+
* took the key.
|
|
218
|
+
*/
|
|
219
|
+
TabThroughList(from: SkiaControl, forward: boolean): boolean;
|
|
225
220
|
/**
|
|
226
221
|
* A popup window just opened: at the end of the frame that draws it, the keyboard goes to its arrow-key group's current
|
|
227
222
|
* choice (a checked radio, menuitemradio, option or tab), else to its first interactive item, however it was opened.
|
|
@@ -238,6 +233,16 @@ export declare class SkiaAccessibilityManager {
|
|
|
238
233
|
private readonly liveSaid;
|
|
239
234
|
private LiveChanged;
|
|
240
235
|
ForceRebuildOnNextFrame(): void;
|
|
236
|
+
/** The scrolls moving the keyboard's control into view, and when each was asked (FollowScroll). */
|
|
237
|
+
private readonly following;
|
|
238
|
+
/**
|
|
239
|
+
* Scrolls are bringing the keyboard's control into view: every frame they draw rebuilds the overlay until each has
|
|
240
|
+
* stopped, so the overlay's rects are where the controls are and the controls they bring near are there for the next
|
|
241
|
+
* Tab (the timed rebuild could come a second later, and Tab would fall out of the canvas).
|
|
242
|
+
*/
|
|
243
|
+
FollowScroll(scrolls: {
|
|
244
|
+
IsScrolling: boolean;
|
|
245
|
+
}[]): void;
|
|
241
246
|
Unregister(node: SkiaControl): void;
|
|
242
247
|
UnregisterSubtree(root: SkiaControl): void;
|
|
243
248
|
/**
|
|
@@ -396,6 +396,42 @@ export class SkiaAccessibilityManager {
|
|
|
396
396
|
return stops[(next + stops.length) % stops.length];
|
|
397
397
|
return next >= 0 && next < stops.length ? stops[next] : undefined;
|
|
398
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Tab and Shift+Tab through a templated list whose cells are made on demand (DrawnUi.Net ac70a1d9): from a cell the
|
|
401
|
+
* keyboard goes to the next (previous) item, scrolled in and focused once drawn, unless the next stop is in the same
|
|
402
|
+
* cell; at the list's end it leaves the list. Entering the list it goes to its first (last) item. The overlay's DOM order
|
|
403
|
+
* lags the cells made while the list scrolls, so inside a list the browser's own Tab order is not used. True when it
|
|
404
|
+
* took the key.
|
|
405
|
+
*/
|
|
406
|
+
TabThroughList(from, forward) {
|
|
407
|
+
if (this.KeyboardScope)
|
|
408
|
+
return false;
|
|
409
|
+
const next = this.NextTabStop(from, forward);
|
|
410
|
+
const here = TemplatedCellOf(from), there = next ? TemplatedCellOf(next) : undefined;
|
|
411
|
+
let list, target;
|
|
412
|
+
if (here) {
|
|
413
|
+
const step = forward ? 1 : -1;
|
|
414
|
+
if (there && there.Cell === here.Cell)
|
|
415
|
+
return false; // the next stop is in the same cell: the usual order
|
|
416
|
+
// a Tab while the previous one is still scrolling its item in goes on from that item (as the arrow keys)
|
|
417
|
+
const pending = this.groupRequest?.Group === here.List ? this.groupRequest.Index : undefined;
|
|
418
|
+
list = here.List;
|
|
419
|
+
target = (pending ?? here.Cell.ContextIndex) + step;
|
|
420
|
+
}
|
|
421
|
+
else if (there) {
|
|
422
|
+
list = there.List;
|
|
423
|
+
target = forward ? 0 : ItemCount(list) - 1;
|
|
424
|
+
if (there.Cell.ContextIndex === target)
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
else
|
|
428
|
+
return false;
|
|
429
|
+
if (target < 0 || target >= ItemCount(list))
|
|
430
|
+
return false;
|
|
431
|
+
this.groupRequest = { Group: list, Scroll: FindScroll(list), Index: target, Step: forward ? 1 : -1, Deadline: performance.now() + 3000, ScrollIssued: false };
|
|
432
|
+
list.Superview?.Update();
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
399
435
|
/**
|
|
400
436
|
* A popup window just opened: at the end of the frame that draws it, the keyboard goes to its arrow-key group's current
|
|
401
437
|
* choice (a checked radio, menuitemradio, option or tab), else to its first interactive item, however it was opened.
|
|
@@ -498,6 +534,20 @@ export class SkiaAccessibilityManager {
|
|
|
498
534
|
return false;
|
|
499
535
|
}
|
|
500
536
|
ForceRebuildOnNextFrame() { this.lastRebuild = -Infinity; this.dirty = true; }
|
|
537
|
+
/** The scrolls moving the keyboard's control into view, and when each was asked (FollowScroll). */
|
|
538
|
+
following = new Map();
|
|
539
|
+
/**
|
|
540
|
+
* Scrolls are bringing the keyboard's control into view: every frame they draw rebuilds the overlay until each has
|
|
541
|
+
* stopped, so the overlay's rects are where the controls are and the controls they bring near are there for the next
|
|
542
|
+
* Tab (the timed rebuild could come a second later, and Tab would fall out of the canvas).
|
|
543
|
+
*/
|
|
544
|
+
FollowScroll(scrolls) {
|
|
545
|
+
const now = performance.now();
|
|
546
|
+
for (const s of scrolls)
|
|
547
|
+
this.following.set(s, now);
|
|
548
|
+
if (scrolls.length)
|
|
549
|
+
this.dirty = true;
|
|
550
|
+
}
|
|
501
551
|
Unregister(node) {
|
|
502
552
|
if (this.nodes.delete(node)) {
|
|
503
553
|
node.OnAccessibilityUnregistered();
|
|
@@ -535,6 +585,14 @@ export class SkiaAccessibilityManager {
|
|
|
535
585
|
if (this.nodes.size === 0 && this.Snapshot.length === 0)
|
|
536
586
|
return;
|
|
537
587
|
const now = performance.now();
|
|
588
|
+
if (this.following.size > 0) {
|
|
589
|
+
this.Rebuild(scale, canvasWidthPx, canvasHeightPx);
|
|
590
|
+
// a scroll is followed until it stopped (its animation starts with the next frame; 3 s at most)
|
|
591
|
+
for (const [s, at] of this.following)
|
|
592
|
+
if ((!s.IsScrolling && now - at > 50) || now - at > 3000)
|
|
593
|
+
this.following.delete(s);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
538
596
|
const wait = this.MinUpdateIntervalMs - (now - this.lastRebuild);
|
|
539
597
|
// a live region whose text changed is read on the next frame, not at the next timed rebuild (accessibility-plan B2)
|
|
540
598
|
if (wait > 0 && this.liveSaid.size > 0 && this.LiveChanged()) {
|
|
@@ -579,26 +637,11 @@ export class SkiaAccessibilityManager {
|
|
|
579
637
|
Rect: new SKRect(px.Left / scale, px.Top / scale, px.Right / scale, px.Bottom / scale),
|
|
580
638
|
CanInteract: n.AccessibilityCanInteract, IsPressed: n.AccessibilityIsPressed, Expanded: n.AccessibilityExpanded, Live: n.AccessibilityLive, Source: n,
|
|
581
639
|
Disabled: !n.AccessibilityCanInteract && Aria.IsInteractiveRole(n.AccessibilityRole),
|
|
582
|
-
TextLines: n.AccessibilityTextSelectable ? n.GetAccessibilityTextLines(scale) : undefined,
|
|
583
640
|
});
|
|
584
641
|
}
|
|
642
|
+
list = PresentationalChildren(list);
|
|
585
643
|
list = SayNamesOnce(list);
|
|
586
|
-
list
|
|
587
|
-
// reading order: nodes whose tops are within half the smaller height form one row, read left to right, so a row of
|
|
588
|
-
// vertically centered controls of different heights keeps its visual order (C# RectComparer + LeftComparer)
|
|
589
|
-
for (let start = 0, i = 1; i <= list.length; i++) {
|
|
590
|
-
if (i < list.length) {
|
|
591
|
-
const first = list[start].Rect, next = list[i].Rect;
|
|
592
|
-
if (next.Top - first.Top < Math.min(first.Height, next.Height) / 2)
|
|
593
|
-
continue;
|
|
594
|
-
}
|
|
595
|
-
if (i - start > 1) {
|
|
596
|
-
const row = list.slice(start, i).sort((a, b) => a.Rect.Left - b.Rect.Left);
|
|
597
|
-
for (let k = 0; k < row.length; k++)
|
|
598
|
-
list[start + k] = row[k];
|
|
599
|
-
}
|
|
600
|
-
start = i;
|
|
601
|
-
}
|
|
644
|
+
list = PageOrder(list, scale);
|
|
602
645
|
this.liveSaid.clear();
|
|
603
646
|
// the control's own name (a name given to a child that says it is no change)
|
|
604
647
|
for (const n of list)
|
|
@@ -620,16 +663,6 @@ export class SkiaAccessibilityManager {
|
|
|
620
663
|
|| Math.abs(x.Rect.Left - y.Rect.Left) > 0.5 || Math.abs(x.Rect.Top - y.Rect.Top) > 0.5
|
|
621
664
|
|| Math.abs(x.Rect.Right - y.Rect.Right) > 0.5 || Math.abs(x.Rect.Bottom - y.Rect.Bottom) > 0.5)
|
|
622
665
|
return false;
|
|
623
|
-
const tx = x.TextLines, ty = y.TextLines;
|
|
624
|
-
if (!!tx !== !!ty)
|
|
625
|
-
return false;
|
|
626
|
-
if (tx && ty) {
|
|
627
|
-
if (tx.length !== ty.length)
|
|
628
|
-
return false;
|
|
629
|
-
for (let j = 0; j < tx.length; j++)
|
|
630
|
-
if (tx[j].Text !== ty[j].Text || Math.abs(tx[j].Left - ty[j].Left) > 0.5 || Math.abs(tx[j].Top - ty[j].Top) > 0.5 || tx[j].FontSize !== ty[j].FontSize)
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
666
|
}
|
|
634
667
|
return true;
|
|
635
668
|
}
|
|
@@ -638,13 +671,34 @@ export class SkiaAccessibilityManager {
|
|
|
638
671
|
* Each name is said once in the flat overlay (DrawnUi.Rust said_by_child): a text or a heading whose label repeats the
|
|
639
672
|
* label of the node it is in (its nearest ancestor node) is said by one of them. Under an interactive node (a card
|
|
640
673
|
* button) the child is left out, the button keeps its name; under any other node (a group card and its title) the
|
|
641
|
-
* node loses its name and the heading says it.
|
|
674
|
+
* node loses its name and the heading says it.
|
|
642
675
|
*/
|
|
676
|
+
/** Roles whose content is their look, not more nodes (ARIA "children presentational", C# Aria.ChildrenArePresentational). */
|
|
677
|
+
const PresentationalChildrenRoles = new Set(["button", "checkbox", "radio", "switch", "tab", "option", "slider", "progressbar", "meter", "scrollbar", "separator", "img", "menuitemcheckbox", "menuitemradio"]);
|
|
678
|
+
/**
|
|
679
|
+
* The texts inside a button, a radio, a tab, a slider, an image... are its look: its name says them, so they are no nodes
|
|
680
|
+
* (C# SkiaAccessibilityManager.InsidePresentational). A control nested in it and selectable text stay; a link, a group,
|
|
681
|
+
* a list keep their content.
|
|
682
|
+
*/
|
|
683
|
+
function PresentationalChildren(list) {
|
|
684
|
+
const bySource = new Map(list.map((x) => [x.Source, x]));
|
|
685
|
+
const inside = (x) => {
|
|
686
|
+
if (Aria.IsInteractiveRole(x.Role) || x.Source.AccessibilityTextSelectable)
|
|
687
|
+
return false;
|
|
688
|
+
for (let p = x.Source.Parent; p; p = p.Parent) {
|
|
689
|
+
const up = bySource.get(p);
|
|
690
|
+
if (up && PresentationalChildrenRoles.has(up.Role))
|
|
691
|
+
return true;
|
|
692
|
+
}
|
|
693
|
+
return false;
|
|
694
|
+
};
|
|
695
|
+
return list.some(inside) ? list.filter((x) => !inside(x)) : list;
|
|
696
|
+
}
|
|
643
697
|
function SayNamesOnce(list) {
|
|
644
698
|
const bySource = new Map(list.map((x) => [x.Source, x]));
|
|
645
699
|
const said = new Set();
|
|
646
700
|
for (const x of list) {
|
|
647
|
-
if (!x.Label ||
|
|
701
|
+
if (!x.Label || (x.Role !== Aria.RoleText && x.Role !== Aria.RoleHeading))
|
|
648
702
|
continue;
|
|
649
703
|
let owner;
|
|
650
704
|
for (let p = x.Source.Parent; p && !owner; p = p.Parent)
|
|
@@ -852,6 +906,98 @@ function FindTarget(item) {
|
|
|
852
906
|
}
|
|
853
907
|
return undefined;
|
|
854
908
|
}
|
|
909
|
+
/** The cell of a templated layout that holds a control, and that layout. */
|
|
910
|
+
function TemplatedCellOf(control) {
|
|
911
|
+
for (let c = control; c?.Parent; c = c.Parent)
|
|
912
|
+
if (asLayout(c.Parent)?.IsTemplated)
|
|
913
|
+
return { List: c.Parent, Cell: c };
|
|
914
|
+
return undefined;
|
|
915
|
+
}
|
|
916
|
+
/** The scrolls a control is inside, outermost first. */
|
|
917
|
+
/**
|
|
918
|
+
* Page order (as DrawnUi.Net SkiaAccessibilityManager.OrderLocked and DrawnUi.Rust): the nodes of a scroll take the scroll's
|
|
919
|
+
* place among the others and are ordered inside it, so content scrolled above or below the viewport never lands before a
|
|
920
|
+
* fixed header or after a footer. Outside scrolls: by top, a row (tops within half the smaller height) read left to right.
|
|
921
|
+
* Inside a scroll: tree order, the order of its content (the Tab order of browsers is the document order too), so a 3D
|
|
922
|
+
* viewer's dots never interleave with the controls beside it.
|
|
923
|
+
*/
|
|
924
|
+
function PageOrder(list, scale) {
|
|
925
|
+
const groups = new Map();
|
|
926
|
+
const tops = [];
|
|
927
|
+
for (const n of list) {
|
|
928
|
+
const scroll = OutermostDrawnScroll(n.Source);
|
|
929
|
+
if (!scroll) {
|
|
930
|
+
tops.push({ Rect: n.Rect, Node: n });
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
let members = groups.get(scroll);
|
|
934
|
+
if (!members) {
|
|
935
|
+
groups.set(scroll, members = []);
|
|
936
|
+
const r = scroll.GetAccessibilityPixelRect();
|
|
937
|
+
tops.push({ Rect: { Top: r.Top / scale, Left: r.Left / scale, Height: r.Height / scale }, Scroll: scroll });
|
|
938
|
+
}
|
|
939
|
+
members.push(n);
|
|
940
|
+
}
|
|
941
|
+
tops.sort((a, b) => a.Rect.Top - b.Rect.Top || a.Rect.Left - b.Rect.Left);
|
|
942
|
+
// reading order: tops within half the smaller height form one row, read left to right (C# RectComparer + LeftComparer)
|
|
943
|
+
for (let start = 0, i = 1; i <= tops.length; i++) {
|
|
944
|
+
if (i < tops.length) {
|
|
945
|
+
const first = tops[start].Rect, next = tops[i].Rect;
|
|
946
|
+
if (next.Top - first.Top < Math.min(first.Height, next.Height) / 2)
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
949
|
+
if (i - start > 1) {
|
|
950
|
+
const row = tops.slice(start, i).sort((a, b) => a.Rect.Left - b.Rect.Left);
|
|
951
|
+
for (let k = 0; k < row.length; k++)
|
|
952
|
+
tops[start + k] = row[k];
|
|
953
|
+
}
|
|
954
|
+
start = i;
|
|
955
|
+
}
|
|
956
|
+
const out = [];
|
|
957
|
+
for (const t of tops) {
|
|
958
|
+
if (t.Node) {
|
|
959
|
+
out.push(t.Node);
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
const members = groups.get(t.Scroll);
|
|
963
|
+
if (members.length > 1) {
|
|
964
|
+
const paths = new Map(members.map((m) => [m, TreePath(m.Source, t.Scroll)]));
|
|
965
|
+
members.sort((a, b) => ComparePaths(paths.get(a), paths.get(b)));
|
|
966
|
+
}
|
|
967
|
+
out.push(...members);
|
|
968
|
+
}
|
|
969
|
+
return out;
|
|
970
|
+
}
|
|
971
|
+
/** The outermost scroll around a control that is on screen (has a drawn rect), undefined when none is. */
|
|
972
|
+
function OutermostDrawnScroll(control) {
|
|
973
|
+
let found;
|
|
974
|
+
for (let p = control.Parent; p; p = p.Parent) {
|
|
975
|
+
if (!asScroll(p))
|
|
976
|
+
continue;
|
|
977
|
+
const r = p.GetAccessibilityPixelRect();
|
|
978
|
+
if (r.Width > 0 && r.Height > 0)
|
|
979
|
+
found = p;
|
|
980
|
+
}
|
|
981
|
+
return found;
|
|
982
|
+
}
|
|
983
|
+
/** Child indices from root down to control; a recycled cell counts by its item (C# TreePath). */
|
|
984
|
+
function TreePath(control, root) {
|
|
985
|
+
const path = [];
|
|
986
|
+
for (let c = control; c && c !== root; c = c.Parent) {
|
|
987
|
+
const parent = c.Parent;
|
|
988
|
+
if (!parent)
|
|
989
|
+
break;
|
|
990
|
+
const layout = asLayout(parent);
|
|
991
|
+
path.push(layout?.IsTemplated ? c.ContextIndex : ViewsOf(parent).indexOf(c));
|
|
992
|
+
}
|
|
993
|
+
return path.reverse();
|
|
994
|
+
}
|
|
995
|
+
function ComparePaths(a, b) {
|
|
996
|
+
for (let i = 0; i < Math.min(a.length, b.length); i++)
|
|
997
|
+
if (a[i] !== b[i])
|
|
998
|
+
return a[i] - b[i];
|
|
999
|
+
return a.length - b.length; // a container before what it holds
|
|
1000
|
+
}
|
|
855
1001
|
/** True when any ancestor is hidden (IsVisible false or Opacity 0): the subtree is not drawn, so it gets no nodes. */
|
|
856
1002
|
function AccessibilityManagerHiddenByAncestor(control) {
|
|
857
1003
|
let p = control.Parent;
|
package/dist/core/Canvas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Surface } from "canvaskit-wasm";
|
|
2
|
-
import { type DrawingContext,
|
|
2
|
+
import { type DrawingContext, SkiaControl } from "./SkiaControl";
|
|
3
3
|
import type { AnimatorBase } from "./Animators";
|
|
4
4
|
import { SkiaAccessibilityManager } from "./Accessibility";
|
|
5
5
|
import { HoverManager } from "./Hover";
|
|
@@ -19,11 +19,9 @@ export declare class Canvas {
|
|
|
19
19
|
readonly Element: HTMLCanvasElement;
|
|
20
20
|
/** Points a pointer may travel between Down and Up and still count as a tap (AppoMobi TouchEffect default). */
|
|
21
21
|
static TappedCancelMoveThresholdPoints: number;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
static LongPressTimeMs: number;
|
|
22
|
+
/** Alias of TouchEffect.LongPressTimeMsDefault: how long a press is held still to be a LongPressing. */
|
|
23
|
+
static get LongPressTimeMs(): number;
|
|
24
|
+
static set LongPressTimeMs(ms: number);
|
|
27
25
|
BackgroundColor: Color;
|
|
28
26
|
/** Accelerated = WebGL surface, Default = software. Read once at first frame. */
|
|
29
27
|
RenderingMode: RenderingModeType;
|
|
@@ -221,6 +219,18 @@ export declare class Canvas {
|
|
|
221
219
|
ControlLeft(root: SkiaControl, disposed: boolean): void;
|
|
222
220
|
private static readonly reportedAnimators;
|
|
223
221
|
/** An animator's callback threw: logged once for that animator, the frame goes on. */
|
|
222
|
+
/**
|
|
223
|
+
* One exception never stops the frame loop (drawnui-cross 6ch, DrawnUi.Net 3db4eba3): app code the frame runs (a
|
|
224
|
+
* listener, a gesture handler) is called through this; a throw is logged once per source and the frame goes on.
|
|
225
|
+
*/
|
|
226
|
+
private static Guard;
|
|
227
|
+
private static readonly reportedSources;
|
|
228
|
+
/**
|
|
229
|
+
* Draws a frame and always shows it: a throw inside it (app drawing code) is logged once, the canvas state is reset and
|
|
230
|
+
* the frame loop goes on (a running animation or game keeps asking for frames).
|
|
231
|
+
*/
|
|
232
|
+
private DrawGuarded;
|
|
233
|
+
private static reportedFrameError;
|
|
224
234
|
private static ReportAnimatorError;
|
|
225
235
|
/** Ticks every registered animator once; returns how many ran. */
|
|
226
236
|
protected ExecuteAnimators(frameTimeNanos: number): number;
|
|
@@ -260,10 +270,69 @@ export declare class Canvas {
|
|
|
260
270
|
private readonly pointerDownArgs;
|
|
261
271
|
private readonly previousTouchArgs;
|
|
262
272
|
private readonly pendingGestures;
|
|
273
|
+
private textDrag?;
|
|
274
|
+
private readonly pageSelection;
|
|
275
|
+
private pageSelectionKeys;
|
|
276
|
+
/**
|
|
277
|
+
* The text selected on the page: the labels a mouse drag selected, joined with new lines, in page order; else the
|
|
278
|
+
* selection of the label in focus. Empty when nothing is selected.
|
|
279
|
+
*/
|
|
280
|
+
get SelectedText(): string;
|
|
281
|
+
/** True while a mouse drag selection holds page text: the page, not a label, owns Ctrl+C. */
|
|
282
|
+
get OwnsTextSelectionKeys(): boolean;
|
|
283
|
+
/** Puts SelectedText on the clipboard through Super.SetClipboardText. False when nothing is selected. */
|
|
284
|
+
CopyTextSelection(): boolean;
|
|
285
|
+
/** Drops the page text selection (every label a drag selected) and the selection of the label in focus. */
|
|
286
|
+
ClearTextSelection(): void;
|
|
287
|
+
/**
|
|
288
|
+
* Before a gesture goes to the controls: a mouse drag that is selecting text keeps its moves (a scroll under it does
|
|
289
|
+
* not scroll), a main-button press drops the previous page selection. True when the gesture was used here.
|
|
290
|
+
*/
|
|
291
|
+
private PreviewTextSelectionGesture;
|
|
292
|
+
/**
|
|
293
|
+
* After a mouse main-button press went to the controls: when it landed on no interactive control (empty space, a
|
|
294
|
+
* scroll's empty area, a selectable label), a drag from here selects text. Not inside a scroll that holds no
|
|
295
|
+
* selectable text: that one keeps scrolling by mouse drag.
|
|
296
|
+
*/
|
|
297
|
+
private AfterTextSelectionDown;
|
|
298
|
+
/** Frame start: while a drag holds the pointer past a scroll's top or bottom edge, the scroll follows it. */
|
|
299
|
+
private ProcessTextSelectionFrame;
|
|
300
|
+
private UpdateTextDrag;
|
|
301
|
+
private AttachPageSelectionKeys;
|
|
302
|
+
private static readonly noChar;
|
|
303
|
+
private readonly onPageSelectionKey;
|
|
263
304
|
private readonly onPointer;
|
|
264
305
|
/** The mouse left the canvas: hover ends at once, also while content moves. */
|
|
265
306
|
private readonly onPointerLeave;
|
|
266
307
|
private readonly preventTouch;
|
|
308
|
+
/** Points of this canvas, up from its bottom, that the on-screen keyboard covers (0 when none). */
|
|
309
|
+
KeyboardCovered: number;
|
|
310
|
+
private keyboardScroll?;
|
|
311
|
+
private readonly onViewportResize;
|
|
312
|
+
/**
|
|
313
|
+
* Measures the part the keyboard covers (the visual viewport shrinks when it opens) and, when the focused text field sits
|
|
314
|
+
* in a scroll with AdaptToKeyboardAuto, hands that scroll the field and the covered height; the scroll it adapted lets go
|
|
315
|
+
* when the keyboard closes or the field moves to another scroll. Runs on viewport resizes and focus changes only.
|
|
316
|
+
*/
|
|
317
|
+
private ApplyKeyboard;
|
|
318
|
+
/** When the last touch releases came (ms), at most two. */
|
|
319
|
+
private readonly touchUps;
|
|
320
|
+
private replayingTap;
|
|
321
|
+
/**
|
|
322
|
+
* iOS Safari (measured on an iPhone, iOS 26.6.1) takes the second tap of a double tap for itself: it sends no pointer or
|
|
323
|
+
* touch event for it, only click, click and dblclick. A dblclick that follows ONE touch release (the other browsers
|
|
324
|
+
* deliver both taps first) brings that tap back as a touch tap at its place, so a double tap reaches the controls (a 3D
|
|
325
|
+
* viewer's reset).
|
|
326
|
+
*/
|
|
327
|
+
private readonly onDoubleClick;
|
|
328
|
+
/**
|
|
329
|
+
* The end of a touch is the user gesture iOS opens the soft keyboard from (a focus() in pointerup does not open it): the
|
|
330
|
+
* press's gestures run now, inside it, so a field they focus focuses its input here, and a tap on the focused field gives
|
|
331
|
+
* its input focus again.
|
|
332
|
+
*/
|
|
333
|
+
/** A finger or a pen is down on the canvas: a text field focused now takes its input focus in the touchend (onTouchEnd). */
|
|
334
|
+
get TouchPressed(): boolean;
|
|
335
|
+
private readonly onTouchEnd;
|
|
267
336
|
/** Gestures="Enabled": touch / pen pointers whose Down a control used (see OnTouchAction). */
|
|
268
337
|
private readonly claimedTouches;
|
|
269
338
|
/** Gestures="Enabled": while a claimed touch is down the page may not take its drag. */
|
|
@@ -272,6 +341,20 @@ export declare class Canvas {
|
|
|
272
341
|
ContextMenu?: (sender: Canvas, e: ContextMenuEventArgs) => boolean | void;
|
|
273
342
|
/** DOM contextmenu (right click / long press / Menu key) -> ContextMenuEventArgs routed through the tree like a tap. */
|
|
274
343
|
private readonly onContextMenu;
|
|
344
|
+
/** A context-menu request at a point of the page (client CSS px), routed through the tree like a tap; true when one took it. */
|
|
345
|
+
private RaiseContextMenu;
|
|
346
|
+
/** The touch or pen press going on: its context menu is raised once, by the browser's contextmenu or after its long press. */
|
|
347
|
+
private touchMenu?;
|
|
348
|
+
/** The long press of a touch press was just queued: its context menu follows the LongPressing (client CSS px). */
|
|
349
|
+
private touchMenuDue?;
|
|
350
|
+
/** A touch or pen press starts (on the canvas, or on selectable text of the overlay): its context menu is still to come. */
|
|
351
|
+
StartTouchPress(): void;
|
|
352
|
+
/**
|
|
353
|
+
* The context menu of the touch press now (Source "touch"), raised once per press whoever asks first: the browser's own
|
|
354
|
+
* contextmenu (Android Chrome fires one on a long press) or the press's long press (iOS Safari fires none). True when a
|
|
355
|
+
* handler took it: the browser's own menu is then suppressed where it can be.
|
|
356
|
+
*/
|
|
357
|
+
RaiseTouchContextMenu(clientX: number, clientY: number, native?: MouseEvent): boolean;
|
|
275
358
|
/**
|
|
276
359
|
* The Menu key, Shift+F10 or a screen reader's context-menu command on the control in keyboard focus (the DOM
|
|
277
360
|
* `contextmenu` of its overlay node): its context menu opens at its center, from it or the first control above it with
|
|
@@ -331,6 +414,8 @@ export declare class Canvas {
|
|
|
331
414
|
private readonly longPressed;
|
|
332
415
|
/** The long press of a new press: due LongPressTimeMs later unless the pointer moves away or lets go. */
|
|
333
416
|
private ArmLongPress;
|
|
417
|
+
/** The long press of a held touch, now (the browser's context menu came first): queued gestures first, then it; its timer is off. */
|
|
418
|
+
private LongPressNow;
|
|
334
419
|
private DisarmLongPress;
|
|
335
420
|
private OnGestureEvent;
|
|
336
421
|
private ProcessPendingGestures;
|