drawnui-react 0.1.0-preview.21 → 0.1.0-preview.22
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/SKIPPED.md
CHANGED
|
@@ -15,7 +15,7 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
|
|
|
15
15
|
| `Opacity`, `TranslationX/Y`, `Rotation`, `ScaleX/Y` (+`Scale`), `SkewX/Y`, `RotationX/Y/Z`, `TranslationZ`, `AnchorX/Y`, `HasTransform`, `RenderTransformMatrix`, `TransformPointToLocalSpace` | ported | Same matrix order as C# `ApplyTransforms` (pivot → rotation → scale/skew → 3D → translation; 3D = C# `Create3dMatrix`, camera 576 px, TranslationZ as depth), image caches drawn smooth once the final matrix distorts them (C# `WillDrawDistorted`, a picture holding image blits records again when its playback turns distorted or straight), opacity = `saveLayer` alpha over the subtree, gestures mapped through the inverse matrix (`IsGestureForChild`, child receives the local point), accessibility rect = transformed bounds. Animations: `AnimateAsync`, `AnimateRangeAsync`, `FadeToAsync`, `ScaleToAsync`, `TranslateToAsync`, `RotateToAsync` as Promises with `AbortSignal` (one running per kind, like the C# per-property cancellation). Not ported: `Perspective1/2`, `CameraAngle`, `LinkTransforms`, `AddTranslationX/Y`, `UseTranslation*` overrides, `CustomizeLayerPaint`, `SkipRenderingOutOfBounds`. |
|
|
16
16
|
| `Left` / `Top` | ported (as a translate) | Same paint-time offset in points, but folded into the render matrix (a `canvas.translate`, hit-testing follows) for every control, cached or not; C# applies them only when blitting a cache. |
|
|
17
17
|
| `AnimatedFramesRenderer` / `SkiaLottie` / `SkiaGif` | ported | `AutoPlay`, `Repeat`, `SpeedRatio`, `DefaultFrame` (-1 = last), `Start(delay)`/`Stop`/`Seek`, `IsPlaying`, `Started`/`Finished`, `PlayWhenAvailable`, `GetFrameAt`. Lottie on CanvasKit Skottie (needs the `full` build, +0.9 MB raw wasm): `Source` (URL / app path, JSON cached per source, in-flight dedup), `ColorTint` / `Colors` (C# `ApplyTint` JSON rewrite), `IsOn` + `DefaultFrameWhenOn` + `ApplyIsOnWhenNotPlaying`, `StopAtCurrentFrame`, `ProcessJson`, `GoToStart`/`GoToEnd`, `SetAnimation`, `LoadSource`, `CreateAnimation`, `TotalFrames`; default cache `Operations` (C# ImageDoubleBuffered, see PARITY "Lottie and GIF default caches"). GIF on CanvasKit AnimatedImage: every frame decoded once (`GifAnimation`: `SeekFrame`, `GetFrameNumber`, `DurationMs`, `TotalFrames`), `Aspect` (AspectFitFill), alignment, `Success`/`Error`, default cache `None` (C# ImageDoubleBuffered). Not ported: `SkiaGif.Display` inner SkiaImage (frames are drawn directly), custom-control ctor `SkiaGif(display)`, `SkiaLottie` Skottie property/slot editing, sound, `ReloadSource` sync file paths, `Dispose` wiring on unmount (no engine hook from the reconciler yet). |
|
|
18
|
-
| `SkiaBackdrop` | ported | `Blur` (5), `Brightness` (gamma), `UseContext`, `BackgroundColor` tint, `HasEffects`, `GetImage`; copies the area it covers through every ancestor transform, drawn back 1:1 (C# 6fd3bae3);
|
|
18
|
+
| `SkiaBackdrop` | ported | `Blur` (5), `Brightness` (gamma), `UseContext`, `BackgroundColor` tint, `HasEffects`, `GetImage`; copies the area it covers through every ancestor transform, drawn back 1:1 (C# 6fd3bae3); recorded into a parent's picture cache it warns once ("Set UseCache = None on its picture-cached parents"; the library never changes a parent's cache, C# cf18cf29; the bcce0739 / fa5956ae guard was ported and reverted); inside an Image-cached ancestor it copies that cache's surface (no warning: C# reverted 9d6ae911, a valid use when what shows through is inside that cache); children drawn first and blurred with the snapshot (C# order); `UseContext` snapshots the surface the pixels end up on (on-screen, or the nearest Image cache surface through its `Origin`), also while an Operations picture is being recorded, since caches record inline; after each paint the ancestors' caches are staled for the next frame (no frame requested) so content that changes beneath without invalidating this branch (an image loading later) is picked up by the next frame. Used by the shell popups/modals (`ShellDefaults.PopupsBackgroundBlur`). Not ported: `CacheSource`, the ghost mode. |
|
|
19
19
|
| Disposal (`Dispose` / `OnDisposing`) | ported | The React renderer calls `Dispose()` when an element leaves the tree (`detachDeletedInstance`): caches, gradient shaders, running `*ToAsync` animations, overlay effects, the accessibility node, then the children (static and templated pool); `SkiaScroll`/`SnappingLayout` stop their animators, `SkiaSvg` drops its raster, `SkiaLottie`/`SkiaGif` free the Skottie animation / frames; `Canvas.Dispose` disposes the content. Not ported: `IsDisposing` staged disposal, `Disposing` event, `OnWillDisposeWithChildren`. |
|
|
20
20
|
| Hover: `ReceivesHover` (opt-in; on by default in SkiaButton, SkiaSlider, the toggles, SkiaRadioButton, SkiaCarousel, SkiaDrawer), `IsHovered`, `HoverChanged` (turns `ReceivesHover` on, as C# `OnHovered`) | ported | drawnui-cross 6m: every opted-in control under the mouse is hovered; nothing changes while a scroll, carousel or drawer moves its content, one check at the last pointer position when it stops and after an add / remove, a rebind, a hidden hovered control or an instant scroll jump; pointerleave clears at once; touch never hovers (`Canvas.Hover`, a `HoverManager`). Not ported: C# `SetHover`, `CheckHovered` / `OnHover` / `IsPointerOver` (no Pointer gestures are routed), SkiaSpinner / wheel picker (no such controls). |
|
|
21
21
|
| `KeyboardManager` | ported | Window-level keydown / keyup capture listeners like `drawnui-keyboard.js`: `KeyDown` / `KeyUp` with the DOM `event.code` ("KeyA", "ArrowLeft"; C# maps the same codes to `InputKey`), `KeyChar` for printable keys without Ctrl / Alt / Meta, `IsShiftPressed` / `IsControlPressed` / `IsAltPressed`, `AttachToKeyboard` (idempotent, pointerdown pulls window focus inside iframes), `BlurExternalTextInput`, `IsOwnedByElement` / `IsInputMethodKey` (React additions: a handler acting on keys skips keys a focused DOM element or the input method owns, C# 845b26e9); `Subscribe` / `Unsubscribe` instead of C# events. Not ported: `InputKey` enum (codes are strings). |
|
|
@@ -5,8 +5,9 @@ import { SkiaLayout } from "./SkiaLayout";
|
|
|
5
5
|
* Mirrors DrawnUi SkiaBackdrop: draws what is already painted beneath its box through `Blur` (points, default 5)
|
|
6
6
|
* and `Brightness` (gamma, 1 = unchanged), tinted by `BackgroundColor`; children draw first and are blurred too.
|
|
7
7
|
* The snapshot comes from the surface being drawn (`UseContext`, the area it covers there through every ancestor
|
|
8
|
-
* transform) or the on-screen surface. Not cached (re-blurs on every frame it is drawn in)
|
|
9
|
-
*
|
|
8
|
+
* transform) or the on-screen surface. Not cached (re-blurs on every frame it is drawn in). Its picture-cached parents
|
|
9
|
+
* should use `UseCache = None` (the app sets it, the library never changes a parent's cache; a one-time console warning
|
|
10
|
+
* names the case); inside an Image-cached ancestor it copies that cache's surface
|
|
10
11
|
* (right when what shows through the glass is inside that cache, wrong when it should show content outside it).
|
|
11
12
|
*/
|
|
12
13
|
export declare class SkiaBackdrop extends SkiaLayout {
|
|
@@ -17,6 +18,7 @@ export declare class SkiaBackdrop extends SkiaLayout {
|
|
|
17
18
|
/** Snapshot the surface currently drawn into (true) or the on-screen surface (false). */
|
|
18
19
|
UseContext: boolean;
|
|
19
20
|
private snapshot?;
|
|
21
|
+
private warnedPicture;
|
|
20
22
|
constructor();
|
|
21
23
|
get HasEffects(): boolean;
|
|
22
24
|
/** The last snapshot taken (C# GetImage hands it over: the caller owns it afterwards). */
|
|
@@ -25,7 +27,5 @@ export declare class SkiaBackdrop extends SkiaLayout {
|
|
|
25
27
|
protected PaintBackground(_ctx: DrawingContext): void;
|
|
26
28
|
protected PaintsBackgroundWithoutColor(): boolean;
|
|
27
29
|
protected Paint(ctx: DrawingContext): void;
|
|
28
|
-
/** C# StopPictureCachesAbove: the picture-cached ancestors draw live from the next frame, which this asks for. */
|
|
29
|
-
protected StopPictureCachesAbove(): void;
|
|
30
30
|
protected OnDisposing(): void;
|
|
31
31
|
}
|
|
@@ -5,8 +5,9 @@ import { SkiaLayout } from "./SkiaLayout";
|
|
|
5
5
|
* Mirrors DrawnUi SkiaBackdrop: draws what is already painted beneath its box through `Blur` (points, default 5)
|
|
6
6
|
* and `Brightness` (gamma, 1 = unchanged), tinted by `BackgroundColor`; children draw first and are blurred too.
|
|
7
7
|
* The snapshot comes from the surface being drawn (`UseContext`, the area it covers there through every ancestor
|
|
8
|
-
* transform) or the on-screen surface. Not cached (re-blurs on every frame it is drawn in)
|
|
9
|
-
*
|
|
8
|
+
* transform) or the on-screen surface. Not cached (re-blurs on every frame it is drawn in). Its picture-cached parents
|
|
9
|
+
* should use `UseCache = None` (the app sets it, the library never changes a parent's cache; a one-time console warning
|
|
10
|
+
* names the case); inside an Image-cached ancestor it copies that cache's surface
|
|
10
11
|
* (right when what shows through the glass is inside that cache, wrong when it should show content outside it).
|
|
11
12
|
*/
|
|
12
13
|
export class SkiaBackdrop extends SkiaLayout {
|
|
@@ -17,6 +18,7 @@ export class SkiaBackdrop extends SkiaLayout {
|
|
|
17
18
|
/** Snapshot the surface currently drawn into (true) or the on-screen surface (false). */
|
|
18
19
|
UseContext = true;
|
|
19
20
|
snapshot;
|
|
21
|
+
warnedPicture = false;
|
|
20
22
|
constructor() {
|
|
21
23
|
super();
|
|
22
24
|
this.HorizontalOptions = "Fill";
|
|
@@ -42,11 +44,11 @@ export class SkiaBackdrop extends SkiaLayout {
|
|
|
42
44
|
}
|
|
43
45
|
if (!this.HasEffects)
|
|
44
46
|
return;
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
if (ctx.Context.Recording) {
|
|
48
|
-
this.
|
|
49
|
-
|
|
47
|
+
// recorded into a parent's picture cache: its copy of what is behind goes into the picture. The library never
|
|
48
|
+
// changes a parent's cache (Nick, C# cf18cf29): it says so once, the app sets UseCache = None on those parents
|
|
49
|
+
if (ctx.Context.Recording && !this.warnedPicture) {
|
|
50
|
+
this.warnedPicture = true;
|
|
51
|
+
console.warn(`[SkiaBackdrop]${this.Tag ? ` ${this.Tag}` : ""} is recorded into a parent's picture cache (Operations / OperationsFull, the default of SkiaShape): its copy of what is behind goes into the picture. Set UseCache = None on its picture-cached parents.`);
|
|
50
52
|
}
|
|
51
53
|
// C# UseContext: snapshot the surface the pixels end up on — the on-screen surface or the nearest Image cache
|
|
52
54
|
// surface. Copied where the backdrop really is on that surface: its rect through the canvas matrix (ancestor
|
|
@@ -99,22 +101,8 @@ export class SkiaBackdrop extends SkiaLayout {
|
|
|
99
101
|
const kill = this.snapshot;
|
|
100
102
|
this.snapshot = image;
|
|
101
103
|
kill?.delete();
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
queueMicrotask(() => { let p = this.Parent; while (p) {
|
|
105
|
-
p.InvalidateCache();
|
|
106
|
-
p = p.Parent;
|
|
107
|
-
} });
|
|
108
|
-
}
|
|
109
|
-
/** C# StopPictureCachesAbove: the picture-cached ancestors draw live from the next frame, which this asks for. */
|
|
110
|
-
StopPictureCachesAbove() {
|
|
111
|
-
for (let p = this.Parent; p; p = p.Parent) {
|
|
112
|
-
if (p.UsingCacheType === "Operations") {
|
|
113
|
-
p.HostsBackdrop = true;
|
|
114
|
-
p.InvalidateCache();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
queueMicrotask(() => this.Update());
|
|
104
|
+
// the library never changes how a parent's cache behaves (Nick, 2026-10-25): a cached parent replays the copy it
|
|
105
|
+
// recorded, as in C#; the app sets UseCache = None on the parents of a backdrop that must follow what is behind
|
|
118
106
|
}
|
|
119
107
|
OnDisposing() { this.snapshot?.delete(); this.snapshot = undefined; }
|
|
120
108
|
}
|
|
@@ -157,11 +157,6 @@ export declare class SkiaControl {
|
|
|
157
157
|
/** What to cache for this subtree; see SkiaCacheType. Layouts default to None, SkiaLabel/SkiaSvg to Operations. */
|
|
158
158
|
UseCache: SkiaCacheType;
|
|
159
159
|
/** The cache type actually applied (None while caching is disabled globally). */
|
|
160
|
-
/**
|
|
161
|
-
* C# HostsBackdrop: a SkiaBackdrop inside asked this picture-cached control to draw live (a picture would replay
|
|
162
|
-
* the backdrop's screen copy frozen). Stays set after the backdrop is removed: the control just keeps drawing live.
|
|
163
|
-
*/
|
|
164
|
-
HostsBackdrop: boolean;
|
|
165
160
|
get UsingCacheType(): SkiaCacheType;
|
|
166
161
|
/** C# IsCacheComposite: the offscreen surface is kept and only the changed children are re-recorded. */
|
|
167
162
|
get IsCacheComposite(): boolean;
|
package/dist/core/SkiaControl.js
CHANGED
|
@@ -195,18 +195,13 @@ export class SkiaControl {
|
|
|
195
195
|
/** What to cache for this subtree; see SkiaCacheType. Layouts default to None, SkiaLabel/SkiaSvg to Operations. */
|
|
196
196
|
UseCache = "None";
|
|
197
197
|
/** The cache type actually applied (None while caching is disabled globally). */
|
|
198
|
-
/**
|
|
199
|
-
* C# HostsBackdrop: a SkiaBackdrop inside asked this picture-cached control to draw live (a picture would replay
|
|
200
|
-
* the backdrop's screen copy frozen). Stays set after the backdrop is removed: the control just keeps drawing live.
|
|
201
|
-
*/
|
|
202
|
-
HostsBackdrop = false;
|
|
203
198
|
get UsingCacheType() {
|
|
204
199
|
if (!Super.CacheEnabled)
|
|
205
200
|
return "None";
|
|
206
201
|
switch (this.UseCache) {
|
|
207
202
|
case "None": return "None";
|
|
208
203
|
case "Operations":
|
|
209
|
-
case "OperationsFull": return
|
|
204
|
+
case "OperationsFull": return "Operations";
|
|
210
205
|
case "ImageDoubleBuffered": return "ImageDoubleBuffered";
|
|
211
206
|
case "ImageComposite":
|
|
212
207
|
case "ImageCompositeGPU": return "ImageComposite";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drawnui-react",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.22",
|
|
4
4
|
"description": "DrawnUi for React: the DrawnUi (.NET) drawn-UI engine in TypeScript on CanvasKit (Skia WASM). Same controls, same PascalCase API as DrawnUi.Net.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nick Kovalsky (AppoMobi)",
|