drawnui-react 0.1.0-preview.1
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/LICENSE +21 -0
- package/PARITY.md +287 -0
- package/README.md +92 -0
- package/SKIPPED.md +107 -0
- package/dist/controls/AnimatedFramesRenderer.d.ts +58 -0
- package/dist/controls/AnimatedFramesRenderer.js +133 -0
- package/dist/controls/GridStructure.d.ts +79 -0
- package/dist/controls/GridStructure.js +403 -0
- package/dist/controls/RefreshIndicator.d.ts +35 -0
- package/dist/controls/RefreshIndicator.js +82 -0
- package/dist/controls/SkiaBackdrop.d.ts +25 -0
- package/dist/controls/SkiaBackdrop.js +80 -0
- package/dist/controls/SkiaButton.d.ts +58 -0
- package/dist/controls/SkiaButton.js +148 -0
- package/dist/controls/SkiaCarousel.d.ts +133 -0
- package/dist/controls/SkiaCarousel.js +603 -0
- package/dist/controls/SkiaCheckbox.d.ts +21 -0
- package/dist/controls/SkiaCheckbox.js +118 -0
- package/dist/controls/SkiaDecoratedGrid.d.ts +15 -0
- package/dist/controls/SkiaDecoratedGrid.js +46 -0
- package/dist/controls/SkiaDrawer.d.ts +46 -0
- package/dist/controls/SkiaDrawer.js +212 -0
- package/dist/controls/SkiaDynamicDrawnCell.d.ts +11 -0
- package/dist/controls/SkiaDynamicDrawnCell.js +17 -0
- package/dist/controls/SkiaEditor.d.ts +163 -0
- package/dist/controls/SkiaEditor.js +803 -0
- package/dist/controls/SkiaGif.d.ts +54 -0
- package/dist/controls/SkiaGif.js +206 -0
- package/dist/controls/SkiaHotspot.d.ts +13 -0
- package/dist/controls/SkiaHotspot.js +36 -0
- package/dist/controls/SkiaImage.d.ts +75 -0
- package/dist/controls/SkiaImage.js +222 -0
- package/dist/controls/SkiaImageTiles.d.ts +27 -0
- package/dist/controls/SkiaImageTiles.js +76 -0
- package/dist/controls/SkiaLabel.d.ts +160 -0
- package/dist/controls/SkiaLabel.js +580 -0
- package/dist/controls/SkiaLayout.d.ts +163 -0
- package/dist/controls/SkiaLayout.js +723 -0
- package/dist/controls/SkiaLottie.d.ts +75 -0
- package/dist/controls/SkiaLottie.js +290 -0
- package/dist/controls/SkiaProgress.d.ts +40 -0
- package/dist/controls/SkiaProgress.js +80 -0
- package/dist/controls/SkiaRadioButton.d.ts +32 -0
- package/dist/controls/SkiaRadioButton.js +157 -0
- package/dist/controls/SkiaRichLabel.d.ts +77 -0
- package/dist/controls/SkiaRichLabel.js +274 -0
- package/dist/controls/SkiaScroll.d.ts +231 -0
- package/dist/controls/SkiaScroll.js +958 -0
- package/dist/controls/SkiaScrollBar.d.ts +56 -0
- package/dist/controls/SkiaScrollBar.js +158 -0
- package/dist/controls/SkiaShaderCarousel.d.ts +67 -0
- package/dist/controls/SkiaShaderCarousel.js +246 -0
- package/dist/controls/SkiaShape.d.ts +63 -0
- package/dist/controls/SkiaShape.js +317 -0
- package/dist/controls/SkiaSlider.d.ts +74 -0
- package/dist/controls/SkiaSlider.js +243 -0
- package/dist/controls/SkiaSprite.d.ts +99 -0
- package/dist/controls/SkiaSprite.js +324 -0
- package/dist/controls/SkiaSpriteSet.d.ts +27 -0
- package/dist/controls/SkiaSpriteSet.js +75 -0
- package/dist/controls/SkiaSvg.d.ts +43 -0
- package/dist/controls/SkiaSvg.js +181 -0
- package/dist/controls/SkiaSwitch.d.ts +26 -0
- package/dist/controls/SkiaSwitch.js +147 -0
- package/dist/controls/SkiaToggle.d.ts +50 -0
- package/dist/controls/SkiaToggle.js +71 -0
- package/dist/controls/SnappingLayout.d.ts +78 -0
- package/dist/controls/SnappingLayout.js +217 -0
- package/dist/controls/TextSpan.d.ts +70 -0
- package/dist/controls/TextSpan.js +76 -0
- package/dist/core/Accessibility.d.ts +104 -0
- package/dist/core/Accessibility.js +150 -0
- package/dist/core/Animators.d.ts +82 -0
- package/dist/core/Animators.js +247 -0
- package/dist/core/Canvas.d.ts +89 -0
- package/dist/core/Canvas.js +328 -0
- package/dist/core/ControlStyle.d.ts +6 -0
- package/dist/core/ControlStyle.js +11 -0
- package/dist/core/Easing.d.ts +13 -0
- package/dist/core/Easing.js +15 -0
- package/dist/core/Gestures.d.ts +74 -0
- package/dist/core/Gestures.js +104 -0
- package/dist/core/ImageEffects.d.ts +29 -0
- package/dist/core/ImageEffects.js +55 -0
- package/dist/core/KeyboardManager.d.ts +25 -0
- package/dist/core/KeyboardManager.js +54 -0
- package/dist/core/ScrollAnimators.d.ts +90 -0
- package/dist/core/ScrollAnimators.js +244 -0
- package/dist/core/SkiaControl.d.ts +401 -0
- package/dist/core/SkiaControl.js +1239 -0
- package/dist/core/SkiaEffect.d.ts +216 -0
- package/dist/core/SkiaEffect.js +571 -0
- package/dist/core/SkiaImageManager.d.ts +43 -0
- package/dist/core/SkiaImageManager.js +122 -0
- package/dist/core/Super.d.ts +61 -0
- package/dist/core/Super.js +178 -0
- package/dist/core/TextInputProxy.d.ts +31 -0
- package/dist/core/TextInputProxy.js +144 -0
- package/dist/core/Types.d.ts +177 -0
- package/dist/core/Types.js +122 -0
- package/dist/core/ViewsAdapter.d.ts +41 -0
- package/dist/core/ViewsAdapter.js +113 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +48 -0
- package/dist/react/SkiaShell.d.ts +144 -0
- package/dist/react/SkiaShell.js +490 -0
- package/dist/react/index.d.ts +110 -0
- package/dist/react/index.js +158 -0
- package/dist/react/reconciler.d.ts +14 -0
- package/dist/react/reconciler.js +160 -0
- package/package.json +60 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import type { Canvas as SkCanvas, Image, Path, SkPicture, Surface } from "canvaskit-wasm";
|
|
2
|
+
import { type Color, type LayoutOptions, SKRect, ScaledSize, type SkiaCacheType, type SkiaGradient, type SkiaTouchAnimation, Thickness } from "./Types";
|
|
3
|
+
import { type IOverlayEffect } from "./Animators";
|
|
4
|
+
import { Easing } from "./Easing";
|
|
5
|
+
import type { Canvas } from "./Canvas";
|
|
6
|
+
import { ControlTappedEventArgs, GestureEventProcessingInfo, type LockTouch, SKPoint, SkiaGesturesInfo, SkiaGesturesParameters } from "./Gestures";
|
|
7
|
+
import { type CachedTexture, type IPostRendererEffect, type SkiaEffect } from "./SkiaEffect";
|
|
8
|
+
/** Mirrors DrawnUi DrawingContext: ctx.Context.Canvas / Surface, ctx.Destination (pixels), ctx.Scale. */
|
|
9
|
+
export interface DrawingContext {
|
|
10
|
+
/**
|
|
11
|
+
* Surface = where the pixels end up (an Image cache surface or the on-screen one), Origin = that surface's top-left
|
|
12
|
+
* in canvas pixels (caches are translated to their own origin), Recording = the canvas records a picture
|
|
13
|
+
* (Operations cache) that is replayed on Surface later.
|
|
14
|
+
*/
|
|
15
|
+
Context: {
|
|
16
|
+
Canvas: SkCanvas;
|
|
17
|
+
Surface?: Surface;
|
|
18
|
+
Origin?: {
|
|
19
|
+
X: number;
|
|
20
|
+
Y: number;
|
|
21
|
+
};
|
|
22
|
+
Recording?: boolean;
|
|
23
|
+
};
|
|
24
|
+
Destination: SKRect;
|
|
25
|
+
Scale: number;
|
|
26
|
+
}
|
|
27
|
+
/** Mirrors DrawnUi CachedObject: what a cached control replays instead of repainting. */
|
|
28
|
+
export declare class CachedObject {
|
|
29
|
+
readonly Type: SkiaCacheType;
|
|
30
|
+
/** Rect the content was recorded for, canvas pixels at recording time. */
|
|
31
|
+
readonly Bounds: SKRect;
|
|
32
|
+
readonly Scale: number;
|
|
33
|
+
readonly Picture?: SkPicture | undefined;
|
|
34
|
+
readonly Image?: Image | undefined;
|
|
35
|
+
constructor(Type: SkiaCacheType,
|
|
36
|
+
/** Rect the content was recorded for, canvas pixels at recording time. */
|
|
37
|
+
Bounds: SKRect, Scale: number, Picture?: SkPicture | undefined, Image?: Image | undefined);
|
|
38
|
+
/** Replays the cache with its top-left moved to (left, top). */
|
|
39
|
+
Draw(canvas: SkCanvas, left: number, top: number): void;
|
|
40
|
+
Dispose(): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Base of every drawn control. Same contract as DrawnUi SkiaControl:
|
|
44
|
+
* Measure(constraints px, scale) -> MeasuredSize (includes Margin),
|
|
45
|
+
* Arrange(destination px) -> DrawingRect,
|
|
46
|
+
* Render(ctx) -> background + Paint(ctx),
|
|
47
|
+
* ProcessGestures(args, apply) -> consumer or null.
|
|
48
|
+
*/
|
|
49
|
+
export declare class SkiaControl {
|
|
50
|
+
HorizontalOptions: LayoutOptions;
|
|
51
|
+
VerticalOptions: LayoutOptions;
|
|
52
|
+
/** -1 = auto. */
|
|
53
|
+
WidthRequest: number;
|
|
54
|
+
HeightRequest: number;
|
|
55
|
+
/** Caps the available size (points); a Fill control fills only up to it and stays start-aligned, like DrawnUi. -1 = none. */
|
|
56
|
+
MaximumWidthRequest: number;
|
|
57
|
+
MaximumHeightRequest: number;
|
|
58
|
+
/** Floors the measured size (points). -1 = none. */
|
|
59
|
+
MinimumWidthRequest: number;
|
|
60
|
+
MinimumHeightRequest: number;
|
|
61
|
+
/** Grid placement (C# attached properties SkiaLayout.Column/Row/ColumnSpan/RowSpan). */
|
|
62
|
+
Column: number;
|
|
63
|
+
Row: number;
|
|
64
|
+
ColumnSpan: number;
|
|
65
|
+
RowSpan: number;
|
|
66
|
+
Margin: Thickness;
|
|
67
|
+
/**
|
|
68
|
+
* DrawnUi LockRatio: 0 = off; positive = square of the LARGER of the two sizes (requests or constraints),
|
|
69
|
+
* negative = square of the SMALLER one. Infinite sides are ignored, so WidthRequest=150 + LockRatio=1 = 150x150.
|
|
70
|
+
*/
|
|
71
|
+
LockRatio: number;
|
|
72
|
+
BackgroundColor?: Color;
|
|
73
|
+
/** Gradient painted as the background (over BackgroundColor). */
|
|
74
|
+
FillGradient?: SkiaGradient;
|
|
75
|
+
IsVisible: boolean;
|
|
76
|
+
Tag?: string;
|
|
77
|
+
TranslationX: number;
|
|
78
|
+
TranslationY: number;
|
|
79
|
+
/** Degrees, around (AnchorX, AnchorY). */
|
|
80
|
+
Rotation: number;
|
|
81
|
+
ScaleX: number;
|
|
82
|
+
ScaleY: number;
|
|
83
|
+
/** Degrees. */
|
|
84
|
+
SkewX: number;
|
|
85
|
+
SkewY: number;
|
|
86
|
+
/** Pivot for Rotation/Scale/Skew as a fraction of the box (MAUI default 0.5). */
|
|
87
|
+
AnchorX: number;
|
|
88
|
+
AnchorY: number;
|
|
89
|
+
/** 0..1, applied as a layer alpha over the whole subtree (MAUI VisualElement.Opacity). */
|
|
90
|
+
Opacity: number;
|
|
91
|
+
/** Clip everything this control draws (content, children, effects per ClipEffects) to its DrawingRect. */
|
|
92
|
+
IsClippedToBounds: boolean;
|
|
93
|
+
/** Paint-time offset in points (C# Left/Top: moves the cached output without a matrix; here a plain translate). */
|
|
94
|
+
Left: number;
|
|
95
|
+
Top: number;
|
|
96
|
+
private zIndex;
|
|
97
|
+
/** Drawing order among siblings: higher draws later (on top) and receives gestures first (C# ZIndex). */
|
|
98
|
+
get ZIndex(): number;
|
|
99
|
+
set ZIndex(v: number);
|
|
100
|
+
/** A layout re-sorts its children by ZIndex on the next draw (C# _orderedChildren reset). */
|
|
101
|
+
InvalidateViewsOrder(): void;
|
|
102
|
+
/** Fraction of the available box a Fill control takes (C# DefineAvailableSize); alignment stays inside the full box. */
|
|
103
|
+
HorizontalFillRatio: number;
|
|
104
|
+
VerticalFillRatio: number;
|
|
105
|
+
/** Sets ScaleX and ScaleY together (MAUI Scale). */
|
|
106
|
+
get Scale(): number;
|
|
107
|
+
set Scale(v: number);
|
|
108
|
+
get HasTransform(): boolean;
|
|
109
|
+
/** Matrix applied at the last render (canvas space), undefined when none; gestures map through its inverse. */
|
|
110
|
+
RenderTransformMatrix?: number[];
|
|
111
|
+
/** Generic numeric parameters (DrawnUi Value1/Value2): SkiaShape Arc uses start angle / sweep angle in degrees. */
|
|
112
|
+
Value1: number;
|
|
113
|
+
Value2: number;
|
|
114
|
+
/** Extra points beyond the viewport a virtualized layout keeps realized (DrawnUi VirtualisationInflated). */
|
|
115
|
+
VirtualisationInflated: number;
|
|
116
|
+
private bindingContext;
|
|
117
|
+
/** Bound item; recycled cells get a new one on every rebind. */
|
|
118
|
+
get BindingContext(): unknown;
|
|
119
|
+
set BindingContext(value: unknown);
|
|
120
|
+
/** Index of the bound item inside its ItemsSource, -1 when not templated. */
|
|
121
|
+
ContextIndex: number;
|
|
122
|
+
/** Override to react to a new BindingContext (DrawnUi ContextPropertyChanged / cell SetContent). */
|
|
123
|
+
protected OnBindingContextChanged(): void;
|
|
124
|
+
/** What to cache for this subtree; see SkiaCacheType. Layouts default to None, SkiaLabel/SkiaSvg to Operations. */
|
|
125
|
+
UseCache: SkiaCacheType;
|
|
126
|
+
/** The cache type actually applied (None while caching is disabled globally). */
|
|
127
|
+
get UsingCacheType(): SkiaCacheType;
|
|
128
|
+
/** C# IsCacheComposite: the offscreen surface is kept and only the changed children are re-recorded. */
|
|
129
|
+
get IsCacheComposite(): boolean;
|
|
130
|
+
/** Children reported dirty since the last composite record (C# DirtyChildrenInternal, filled by RepaintComposition). */
|
|
131
|
+
readonly DirtyChildrenInternal: Set<SkiaControl>;
|
|
132
|
+
/** True while a composite re-record paints only the dirty children (C# IsRenderingWithComposition). */
|
|
133
|
+
IsRenderingWithComposition: boolean;
|
|
134
|
+
/** Composite surface kept across records; its size follows the expanded cache rect. */
|
|
135
|
+
private compositeSurface?;
|
|
136
|
+
/** Own content or structure changed: the next composite record is a full one. */
|
|
137
|
+
private compositeFull;
|
|
138
|
+
/** Canvas-pixel bounds this control covered when its parent last recorded it (composite erase region). */
|
|
139
|
+
private lastCompositeBounds?;
|
|
140
|
+
/** What the last composite record did (diagnostics): "full" or "partial", the number of children re-recorded and which ones. */
|
|
141
|
+
LastCompositeRecord: {
|
|
142
|
+
Mode: "full" | "partial";
|
|
143
|
+
Children: number;
|
|
144
|
+
Dirty: readonly SkiaControl[];
|
|
145
|
+
};
|
|
146
|
+
/** The children a composite record can re-record individually; layouts return their views. */
|
|
147
|
+
protected GetCompositeChildren(): readonly SkiaControl[];
|
|
148
|
+
/** C# TrackChildAsDirty (DirtyChildrenTracker): the child changed without a remeasure of this control. */
|
|
149
|
+
TrackChildAsDirty(child: SkiaControl): void;
|
|
150
|
+
/** Drawn bounds in canvas pixels including transforms and effects margins (C# GetTransformedDirtyBounds). */
|
|
151
|
+
GetTransformedDirtyBounds(): SKRect;
|
|
152
|
+
/** Current cache, if any. */
|
|
153
|
+
RenderObject?: CachedObject;
|
|
154
|
+
private cacheDirty;
|
|
155
|
+
/** Control itself ignores input (things below it still get it). */
|
|
156
|
+
InputTransparent: boolean;
|
|
157
|
+
/** Consume every gesture that lands on this control so nothing below (z-order) receives it. */
|
|
158
|
+
BlockGesturesBelow: boolean;
|
|
159
|
+
LockChildrenGestures: LockTouch;
|
|
160
|
+
TouchEffectColor: Color;
|
|
161
|
+
/** Plays a ripple (from the tap point) when Tapped fires. */
|
|
162
|
+
AnimationTapped: SkiaTouchAnimation;
|
|
163
|
+
/** Ripple duration ms, 0 = animator default (500). */
|
|
164
|
+
AnimationTappedSpeed: number;
|
|
165
|
+
/** Overlay effects drawn above this control's content every frame (ripple etc). */
|
|
166
|
+
readonly PostAnimators: IOverlayEffect[];
|
|
167
|
+
private visualEffects;
|
|
168
|
+
/** Post-renderer effects among VisualEffects (C# EffectPostRenderers). */
|
|
169
|
+
EffectPostRenderers: (SkiaEffect & IPostRendererEffect)[];
|
|
170
|
+
/** Skip every attached effect (C# DisableEffects). */
|
|
171
|
+
DisableEffects: boolean;
|
|
172
|
+
/** Effects attached to this control; assign a new array to change them (they are attached/detached here). */
|
|
173
|
+
get VisualEffects(): readonly SkiaEffect[];
|
|
174
|
+
set VisualEffects(v: readonly SkiaEffect[] | undefined);
|
|
175
|
+
protected OnVisualEffectsChanged(): void;
|
|
176
|
+
/** Post renderers that can render this frame (compiled shaders); an unready effect leaves the control drawn plainly. */
|
|
177
|
+
private ActivePostRenderers;
|
|
178
|
+
/** C# CachedImage: the cached texture and the canvas rect it was rasterized over (Image caches only). */
|
|
179
|
+
get CachedImage(): CachedTexture | undefined;
|
|
180
|
+
/** Clip overlay effects to the control's shape (CreateClip). */
|
|
181
|
+
ClipEffects: boolean;
|
|
182
|
+
Tapped?: (sender: SkiaControl, e: ControlTappedEventArgs) => void;
|
|
183
|
+
ChildTapped?: (sender: SkiaControl, e: ControlTappedEventArgs) => void;
|
|
184
|
+
/** Raw gesture hook: set e.Consumed = true to stop propagation (not for Up). */
|
|
185
|
+
ConsumeGestures?: (sender: SkiaControl, e: SkiaGesturesInfo) => void;
|
|
186
|
+
Parent?: SkiaControl;
|
|
187
|
+
/** Containers override; a leaf control cannot host children. */
|
|
188
|
+
AddSubView(_control: SkiaControl): void;
|
|
189
|
+
InsertSubView(_index: number, control: SkiaControl): void;
|
|
190
|
+
RemoveSubView(_control: SkiaControl): void;
|
|
191
|
+
/** Set by Canvas on its Content. Children resolve through Parent. */
|
|
192
|
+
_superview?: Canvas;
|
|
193
|
+
get Superview(): Canvas | undefined;
|
|
194
|
+
MeasuredSize: ScaledSize;
|
|
195
|
+
DrawingRect: SKRect;
|
|
196
|
+
RenderingScale: number;
|
|
197
|
+
NeedMeasure: boolean;
|
|
198
|
+
private lastWidthConstraint;
|
|
199
|
+
private lastHeightConstraint;
|
|
200
|
+
/**
|
|
201
|
+
* Public non-virtual entry like DrawnUi: applies Margin/requests, then MeasureAbsolute for content.
|
|
202
|
+
* A control that was not invalidated and gets the same constraints + scale returns its previous size —
|
|
203
|
+
* this is what keeps a cached tree from re-measuring text every frame.
|
|
204
|
+
*/
|
|
205
|
+
Measure(widthConstraint: number, heightConstraint: number, scale: number): ScaledSize;
|
|
206
|
+
/** Override to measure own content, constraints already exclude Margin. */
|
|
207
|
+
protected MeasureAbsolute(_widthConstraint: number, _heightConstraint: number, scale: number): ScaledSize;
|
|
208
|
+
/** Places MeasuredSize inside destination per Margin + Horizontal/VerticalOptions -> DrawingRect. */
|
|
209
|
+
Arrange(destination: SKRect, _widthRequest: number, _heightRequest: number, scale: number): void;
|
|
210
|
+
private static nextAccessibilityId;
|
|
211
|
+
/** Stable identity for the DOM overlay. */
|
|
212
|
+
readonly AccessibilityId: number;
|
|
213
|
+
private registeredWithAccessibility;
|
|
214
|
+
private accessibilityRole?;
|
|
215
|
+
private accessibilityLabel?;
|
|
216
|
+
private accessibilityHint?;
|
|
217
|
+
private accessibilityCanInteract?;
|
|
218
|
+
private accessibilityIsPressed?;
|
|
219
|
+
private accessibilityLive?;
|
|
220
|
+
/**
|
|
221
|
+
* ARIA role; setting it exposes the control to assistive technology (use `Aria` constants). Unset = the class
|
|
222
|
+
* default (`SkiaLabel.DefaultAccessibilityRole` etc.), which is itself unset unless the app opts in.
|
|
223
|
+
*/
|
|
224
|
+
get AccessibilityRole(): string | undefined;
|
|
225
|
+
set AccessibilityRole(v: string | undefined);
|
|
226
|
+
/** Per-class default role (React extension): e.g. `SkiaLabel.DefaultAccessibilityRole = Aria.RoleText` reads every label. */
|
|
227
|
+
static DefaultAccessibilityRole?: string;
|
|
228
|
+
/** Spoken label; unset = the control's own text (SkiaLabel.Text, SkiaButton.Text). */
|
|
229
|
+
get AccessibilityLabel(): string | undefined;
|
|
230
|
+
set AccessibilityLabel(v: string | undefined);
|
|
231
|
+
protected DefaultAccessibilityLabel(): string | undefined;
|
|
232
|
+
get AccessibilityHint(): string | undefined;
|
|
233
|
+
set AccessibilityHint(v: string | undefined);
|
|
234
|
+
/** Tab stop + activation; unset = true when the control handles Tapped. */
|
|
235
|
+
get AccessibilityCanInteract(): boolean;
|
|
236
|
+
set AccessibilityCanInteract(v: boolean);
|
|
237
|
+
protected DefaultAccessibilityCanInteract(): boolean;
|
|
238
|
+
/** aria-pressed for toggles; undefined = not a toggle. */
|
|
239
|
+
get AccessibilityIsPressed(): boolean | undefined;
|
|
240
|
+
set AccessibilityIsPressed(v: boolean | undefined);
|
|
241
|
+
/** aria-live: `Aria.LivePolite` / `Aria.LiveAssertive`; changes are announced immediately. */
|
|
242
|
+
get AccessibilityLive(): string | undefined;
|
|
243
|
+
set AccessibilityLive(v: string | undefined);
|
|
244
|
+
get IsAccessibilityElement(): boolean;
|
|
245
|
+
private accessibilityTextSelectable;
|
|
246
|
+
/**
|
|
247
|
+
* Opt-in (React extension, off by default): the control's text is rendered as real, invisible DOM text in the
|
|
248
|
+
* accessibility overlay with pointer events, so the browser selects / copies it like HTML. Pointer input over the
|
|
249
|
+
* text then goes to the selection, not to the drawn control — never enable it on gesture-driven controls.
|
|
250
|
+
*/
|
|
251
|
+
get AccessibilityTextSelectable(): boolean;
|
|
252
|
+
set AccessibilityTextSelectable(v: boolean);
|
|
253
|
+
/** Text lines for AccessibilityTextSelectable in CSS px relative to the node (SkiaLabel implements it). */
|
|
254
|
+
GetAccessibilityTextLines(_scale: number): import("./Accessibility").AccessibilityTextLine[];
|
|
255
|
+
/** Hit rect in canvas pixels used to position the overlay element: the drawn (transformed) bounds, like C# HitBoxWithTransforms. */
|
|
256
|
+
GetAccessibilityPixelRect(): SKRect;
|
|
257
|
+
/** Registers on first call, marks the snapshot dirty afterwards. */
|
|
258
|
+
NotifyAccessibility(): void;
|
|
259
|
+
UnregisterAccessibility(): void;
|
|
260
|
+
AccessibilityChanged(): void;
|
|
261
|
+
OnAccessibilityUnregistered(): void;
|
|
262
|
+
/** Platform layer (overlay click / Enter): injects a synthetic Tapped at the control's center into the gesture pipeline. */
|
|
263
|
+
OnAccessibilityActivated(): void;
|
|
264
|
+
/** Overlay focus arrives on / leaves this node (inputs may activate their sink here). */
|
|
265
|
+
OnAccessibilityFocused(_focused: boolean): void;
|
|
266
|
+
NotifyAccessibilityFocused(focused: boolean): void;
|
|
267
|
+
/** DrawnUi SmartMax: larger of two sizes, an infinite one loses. */
|
|
268
|
+
protected static SmartMax(a: number, b: number): number;
|
|
269
|
+
/** DrawnUi SmartMin: smaller of two sizes, an infinite one loses. */
|
|
270
|
+
protected static SmartMin(a: number, b: number): number;
|
|
271
|
+
private static Align;
|
|
272
|
+
/** Called after DrawingRect changed; layouts arrange children here. */
|
|
273
|
+
protected OnLayoutChanged(): void;
|
|
274
|
+
/** Part of DrawingRect that can actually be seen: intersected with every ancestor (a scroll's box clips its content). */
|
|
275
|
+
GetVisibleViewport(): SKRect;
|
|
276
|
+
/** Draws the control: from its cache when it has one, else background + Paint(); overlays always live. */
|
|
277
|
+
/**
|
|
278
|
+
* Pixels the control paints OUTSIDE its DrawingRect (shadows, effects): caches record that much more and the
|
|
279
|
+
* blit is offset accordingly (DrawnUi ComputeEffectsMargin / GetRenderingExpandPixels). Base: nothing.
|
|
280
|
+
*/
|
|
281
|
+
ComputeEffectsMargin(_scale: number): Thickness;
|
|
282
|
+
private effectsMarginCache?;
|
|
283
|
+
/** Cached ComputeEffectsMargin (reset by InvalidateMeasure) — C# AggregatedEffectsMarginPixels. */
|
|
284
|
+
EffectsMargin(scale: number): Thickness;
|
|
285
|
+
/** DrawingRect grown by the effects margin, in pixels — the rect a cache is recorded for. */
|
|
286
|
+
protected ExpandedCacheRect(scale: number): SKRect;
|
|
287
|
+
Render(ctx: DrawingContext): void;
|
|
288
|
+
/** Port of DrawnUi ApplyTransforms: T(-pivot) · rotation · scale/skew · T(pivot) · translation, in canvas pixels. */
|
|
289
|
+
protected CreateRenderTransformMatrix(destination: SKRect, scale: number): number[];
|
|
290
|
+
/** Maps a point given in the parent's space into this control's untransformed space (DrawnUi TransformPointToLocalSpace). */
|
|
291
|
+
TransformPointToLocalSpace(point: SKPoint): SKPoint;
|
|
292
|
+
/**
|
|
293
|
+
* Image caches are rasterized over whole device pixels: the expanded rect snapped outward to integers, so the blit
|
|
294
|
+
* lands 1:1 (no sub-pixel resample) and effects sampling the cache at `fragCoord - iOffset` hit texel centers.
|
|
295
|
+
*/
|
|
296
|
+
private AlignedCacheRect;
|
|
297
|
+
/** Cache blit or live paint, then post animators — the part a transform/opacity layer wraps. */
|
|
298
|
+
private RenderContent;
|
|
299
|
+
/** Background + Paint(): the part of the control that a cache captures. */
|
|
300
|
+
protected PaintContent(ctx: DrawingContext): void;
|
|
301
|
+
/** Subclasses whose PaintBackground has something to draw without a BackgroundColor (shape shadows). */
|
|
302
|
+
protected PaintsBackgroundWithoutColor(): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* ImageDoubleBuffered: the last cache is kept while a new one is produced and shown when producing fails
|
|
305
|
+
* (no surface yet); no background thread in the browser, so recording itself stays synchronous like DrawnUi.Blazor.
|
|
306
|
+
*/
|
|
307
|
+
RenderObjectPrevious?: CachedObject;
|
|
308
|
+
/** Drawn when a cache is expected but none exists yet (DrawnUi DrawPlaceholder, ImageDoubleBuffered only). Default: nothing. */
|
|
309
|
+
protected DrawPlaceholder(_ctx: DrawingContext): void;
|
|
310
|
+
/** Records/renders the content into a new CachedObject for the current DrawingRect. */
|
|
311
|
+
protected CreateRenderingObject(ctx: DrawingContext, cacheType: SkiaCacheType): void;
|
|
312
|
+
/**
|
|
313
|
+
* C# ImageComposite (SetupRenderingWithComposition + CreateRenderingObject reuse): the offscreen surface survives
|
|
314
|
+
* between records; when only some children changed (RepaintComposition from a child, no remeasure of this control)
|
|
315
|
+
* their old and new bounds — plus every sibling they overlap — are erased and just those children are painted
|
|
316
|
+
* again. Anything else (own content, structure, size, scale) records fully.
|
|
317
|
+
*/
|
|
318
|
+
private CreateCompositeRenderingObject;
|
|
319
|
+
private DisposePrevious;
|
|
320
|
+
/** Drops the cache (disposed after the frame, never mid-draw). */
|
|
321
|
+
DestroyRenderingObject(): void;
|
|
322
|
+
/** Marks the cache stale; re-recorded on the next frame (a composite records fully: its own content changed). */
|
|
323
|
+
InvalidateCache(): void;
|
|
324
|
+
/** Effects margin recomputed on the next use (C# InvalidateEffectsMargin). */
|
|
325
|
+
InvalidateEffectsMargin(): void;
|
|
326
|
+
/** Draws PostAnimators above content; an effect returning true asks for another frame. */
|
|
327
|
+
ExecutePostAnimators(ctx: DrawingContext): void;
|
|
328
|
+
/** Clip path of this control in canvas pixels (rect; shapes override). Caller deletes it. */
|
|
329
|
+
CreateClip(): Path;
|
|
330
|
+
/** Fills DrawingRect with BackgroundColor / FillGradient; shapes override for rounded corners etc. */
|
|
331
|
+
protected PaintBackground(ctx: DrawingContext): void;
|
|
332
|
+
/** Paint for the background: solid BackgroundColor, or FillGradient shader over the given rect. Caller deletes. */
|
|
333
|
+
protected CreateBackgroundPaint(rect: SKRect): import("canvaskit-wasm").Paint;
|
|
334
|
+
/** Whether FillGradient fills the background (C# base: yes, even without BackgroundColor; SkiaLabel: only the glyphs unless BackgroundColor is set). */
|
|
335
|
+
protected FillGradientPaintsBackground(): boolean;
|
|
336
|
+
/** Shaders built for a gradient object, keyed by the rect they were built for (C# cached SetupGradient overload). */
|
|
337
|
+
private gradientShaders?;
|
|
338
|
+
/** C# SetupGradient: white base color, the gradient's BlendMode and a (cached) shader on the paint. */
|
|
339
|
+
SetupGradient(paint: import("canvaskit-wasm").Paint, gradient: SkiaGradient, rect: SKRect): boolean;
|
|
340
|
+
/** Port of C# CreateGradient: Linear / Circular / Oval / Sweep shader over the rect (pixels); null for None. */
|
|
341
|
+
CreateGradient(rect: SKRect, g: SkiaGradient): import("canvaskit-wasm").Shader | null;
|
|
342
|
+
/** C# SkiaGradient.LinearGradientAngleToPoints (CSS angle -> start/end ratios). */
|
|
343
|
+
static LinearGradientAngleToPoints(direction: number): [number, number, number, number];
|
|
344
|
+
/** C# MakeDarker / MakeLighter: HSL lightness scaled down (light < 1) or pushed toward white (light > 1). */
|
|
345
|
+
static AdjustLightness(rgb: [number, number, number], light: number): [number, number, number];
|
|
346
|
+
/** Override to draw own content into ctx.Destination. */
|
|
347
|
+
protected Paint(_ctx: DrawingContext): void;
|
|
348
|
+
IsDisposed: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Frees what the control owns: caches, gradient shaders, running animations and overlay effects, the accessibility
|
|
351
|
+
* node, then the children. Called by the React renderer when the element leaves the tree (detachDeletedInstance).
|
|
352
|
+
*/
|
|
353
|
+
Dispose(): void;
|
|
354
|
+
/** Subclasses release their own native objects here (before the base frees caches and children). */
|
|
355
|
+
protected OnDisposing(): void;
|
|
356
|
+
/** Layouts dispose their children here. */
|
|
357
|
+
protected DisposeChildren(): void;
|
|
358
|
+
/** Content changed: cache invalidated + remeasure + redraw (bubbles to every ancestor, whose caches go stale too). */
|
|
359
|
+
Update(): void;
|
|
360
|
+
/** Redraw without remeasure and WITHOUT dropping caches (position/overlay changes). */
|
|
361
|
+
Repaint(): void;
|
|
362
|
+
/**
|
|
363
|
+
* Transform / Opacity changed: this control's own cache is still valid (content unchanged) but every ancestor
|
|
364
|
+
* cache holds its composited output, so those are staled before redrawing (DrawnUi RedrawCanvas + parent invalidation).
|
|
365
|
+
*/
|
|
366
|
+
RepaintComposition(): void;
|
|
367
|
+
/** Size or content may have changed: this control and all ancestors remeasure and re-record. */
|
|
368
|
+
InvalidateMeasure(): void;
|
|
369
|
+
/** Hit rect in pixels (no transforms in this port, so it is DrawingRect). */
|
|
370
|
+
get HitBoxAuto(): SKRect;
|
|
371
|
+
HitIsInside(x: number, y: number): boolean;
|
|
372
|
+
IsGestureForChild(child: SkiaControl, point: SKPoint): boolean;
|
|
373
|
+
/** Children that may receive gestures, top-most LAST (layouts return their Views). */
|
|
374
|
+
protected GetGestureListeners(): readonly SkiaControl[];
|
|
375
|
+
private static readonly NoListeners;
|
|
376
|
+
/** ISkiaGestureListener entry, same as DrawnUi: routes to ProcessGestures. */
|
|
377
|
+
OnSkiaGestureEvent(args: SkiaGesturesParameters, apply: GestureEventProcessingInfo): SkiaControl | null;
|
|
378
|
+
protected CheckChildrenGesturesLocked(type: SkiaGesturesParameters["Type"]): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Port of DrawnUi SkiaControl.ProcessGestures (non-render-tree branch):
|
|
381
|
+
* ConsumeGestures hook -> children top-most first -> own Tapped. Returns the consumer or null.
|
|
382
|
+
*/
|
|
383
|
+
ProcessGestures(args: SkiaGesturesParameters, apply: GestureEventProcessingInfo): SkiaControl | null;
|
|
384
|
+
/** Fires Tapped (after AnimationTapped feedback); true when a handler existed (= consumed), like DrawnUi SendTapped. */
|
|
385
|
+
protected SendTapped(args: SkiaGesturesParameters, apply: GestureEventProcessingInfo): boolean;
|
|
386
|
+
/** Canvas-pixel touch location -> points relative to this control's top-left. */
|
|
387
|
+
GetOffsetInsideControlInPoints(location: SKPoint, childOffset: SKPoint): SKPoint;
|
|
388
|
+
private ownAnimations;
|
|
389
|
+
/** Runs callback(0..1) over ms with easing on the canvas frame loop; rejects with AbortError when cancelled. */
|
|
390
|
+
AnimateAsync(callback: (value: number) => void, onCancel?: () => void, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
391
|
+
/** callback(start..end) over ms. */
|
|
392
|
+
AnimateRangeAsync(callback: (value: number) => void, start: number, end: number, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
393
|
+
/** One running animation per kind, like the per-property CancellationTokenSources in C#. */
|
|
394
|
+
private RunOwnAnimation;
|
|
395
|
+
FadeToAsync(end: number, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
396
|
+
ScaleToAsync(x: number, y: number, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
397
|
+
TranslateToAsync(x: number, y: number, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
398
|
+
RotateToAsync(end: number, ms?: number, easing?: Easing, cancel?: AbortSignal): Promise<void>;
|
|
399
|
+
/** Starts a ripple at (x, y) points inside this control; speedMs 0 = RippleAnimator default. */
|
|
400
|
+
PlayRippleAnimation(color: Color, x: number, y: number, _removePrevious?: boolean, speedMs?: number): void;
|
|
401
|
+
}
|