drawnui-react 0.1.0-preview.3 → 0.1.0-preview.30
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 +15 -1
- package/SKIPPED.md +32 -25
- package/dist/controls/AnimatedFramesRenderer.d.ts +7 -0
- package/dist/controls/AnimatedFramesRenderer.js +16 -1
- package/dist/controls/DrawnGame.d.ts +40 -0
- package/dist/controls/DrawnGame.js +64 -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 +15 -1
- package/dist/controls/SkiaButton.js +21 -4
- package/dist/controls/SkiaCarousel.d.ts +21 -2
- package/dist/controls/SkiaCarousel.js +49 -5
- package/dist/controls/SkiaCheckbox.d.ts +0 -1
- package/dist/controls/SkiaCheckbox.js +0 -6
- package/dist/controls/SkiaDrawer.d.ts +2 -0
- package/dist/controls/SkiaDrawer.js +2 -0
- package/dist/controls/SkiaEditor.d.ts +38 -1
- package/dist/controls/SkiaEditor.js +223 -49
- package/dist/controls/SkiaGif.d.ts +3 -0
- package/dist/controls/SkiaGif.js +12 -2
- package/dist/controls/SkiaImage.js +15 -10
- package/dist/controls/SkiaLabel.d.ts +78 -7
- package/dist/controls/SkiaLabel.js +379 -60
- package/dist/controls/SkiaLabelFps.d.ts +16 -0
- package/dist/controls/SkiaLabelFps.js +41 -0
- package/dist/controls/SkiaLayout.d.ts +97 -9
- package/dist/controls/SkiaLayout.js +387 -22
- package/dist/controls/SkiaLottie.js +4 -2
- package/dist/controls/SkiaProgress.d.ts +2 -1
- package/dist/controls/SkiaProgress.js +6 -3
- package/dist/controls/SkiaRadioButton.js +4 -3
- 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 +234 -23
- package/dist/controls/SkiaScrollBar.d.ts +27 -0
- package/dist/controls/SkiaScrollBar.js +51 -2
- package/dist/controls/SkiaShaderCarousel.d.ts +5 -0
- package/dist/controls/SkiaShaderCarousel.js +5 -0
- 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 +59 -5
- package/dist/controls/SkiaSprite.d.ts +1 -0
- package/dist/controls/SkiaSprite.js +4 -0
- package/dist/controls/SkiaSvg.js +1 -1
- package/dist/controls/SkiaSwitch.d.ts +0 -1
- package/dist/controls/SkiaSwitch.js +0 -6
- 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 +19 -1
- package/dist/core/Accessibility.d.ts +80 -0
- package/dist/core/Accessibility.js +421 -8
- package/dist/core/Animators.d.ts +37 -1
- package/dist/core/Animators.js +102 -9
- package/dist/core/Canvas.d.ts +108 -7
- package/dist/core/Canvas.js +353 -29
- package/dist/core/Easing.d.ts +12 -1
- package/dist/core/Easing.js +25 -1
- package/dist/core/Gestures.d.ts +34 -2
- package/dist/core/Gestures.js +84 -3
- package/dist/core/Hover.d.ts +47 -0
- package/dist/core/Hover.js +134 -0
- package/dist/core/KeyboardManager.d.ts +13 -0
- package/dist/core/KeyboardManager.js +18 -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 +209 -9
- package/dist/core/SkiaControl.js +500 -59
- 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 +22 -2
- package/dist/core/Super.js +47 -3
- 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 +3 -0
- package/dist/index.js +3 -0
- package/dist/react/SkiaShell.js +33 -14
- package/dist/react/index.d.ts +17 -4
- package/dist/react/index.js +103 -15
- package/dist/react/reconciler.js +33 -13
- package/dist/vite/index.d.ts +9 -0
- package/dist/vite/index.js +36 -3
- package/package.json +41 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DrawingContext } from "../core/SkiaControl";
|
|
2
|
+
import type { SKRect } from "../core/Types";
|
|
3
|
+
import { SkiaLabel } from "./SkiaLabel";
|
|
4
|
+
/**
|
|
5
|
+
* Mirrors DrawnUi SkiaLabelFps: a label showing the canvas FPS, drawn above its siblings, input-transparent, never
|
|
6
|
+
* re-laying out its parent. Divergence: C# sets Text on every draw, and each new value asks for another frame, so
|
|
7
|
+
* the counter keeps an idle canvas redrawing. Here the value changes only on frames that running animators already
|
|
8
|
+
* request (scroll inertia, transitions, Lottie, game loops): the counter never asks for a frame itself, and an idle
|
|
9
|
+
* canvas keeps the last value measured. Not ported: ForceRefresh, Format, MonoForDigits.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SkiaLabelFps extends SkiaLabel {
|
|
12
|
+
constructor();
|
|
13
|
+
private arrangedIn?;
|
|
14
|
+
Arrange(destination: SKRect, widthRequest: number, heightRequest: number, scale: number): void;
|
|
15
|
+
Render(ctx: DrawingContext): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Aria } from "../core/Accessibility";
|
|
2
|
+
import { SkiaLabel } from "./SkiaLabel";
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors DrawnUi SkiaLabelFps: a label showing the canvas FPS, drawn above its siblings, input-transparent, never
|
|
5
|
+
* re-laying out its parent. Divergence: C# sets Text on every draw, and each new value asks for another frame, so
|
|
6
|
+
* the counter keeps an idle canvas redrawing. Here the value changes only on frames that running animators already
|
|
7
|
+
* request (scroll inertia, transitions, Lottie, game loops): the counter never asks for a frame itself, and an idle
|
|
8
|
+
* canvas keeps the last value measured. Not ported: ForceRefresh, Format, MonoForDigits.
|
|
9
|
+
*/
|
|
10
|
+
export class SkiaLabelFps extends SkiaLabel {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.IsParentIndependent = true;
|
|
14
|
+
this.AccessibilityRole = Aria.RolePresentation;
|
|
15
|
+
this.Tag = "FPS";
|
|
16
|
+
this.Text = "FPS --";
|
|
17
|
+
this.MaxLines = 1;
|
|
18
|
+
this.BackgroundColor = "#000000";
|
|
19
|
+
this.TextColor = "#32CD32"; // LimeGreen
|
|
20
|
+
this.InputTransparent = true;
|
|
21
|
+
this.ZIndex = Number.MAX_SAFE_INTEGER;
|
|
22
|
+
}
|
|
23
|
+
arrangedIn;
|
|
24
|
+
Arrange(destination, widthRequest, heightRequest, scale) {
|
|
25
|
+
this.arrangedIn = destination;
|
|
26
|
+
super.Arrange(destination, widthRequest, heightRequest, scale);
|
|
27
|
+
}
|
|
28
|
+
Render(ctx) {
|
|
29
|
+
const view = this.Superview;
|
|
30
|
+
// the frame this asks for is requested anyway by the running animators
|
|
31
|
+
if (view && view.AnimatingControls.size > 0)
|
|
32
|
+
this.Text = `FPS ${view.FPS.toFixed(1).padStart(4, "0")}`;
|
|
33
|
+
// parent-independent: the parent does not re-lay out for it, so it re-measures itself here (as SkiaScroll does for its bars)
|
|
34
|
+
const d = this.arrangedIn;
|
|
35
|
+
if (this.NeedMeasure && d) {
|
|
36
|
+
this.Measure(d.Width, d.Height, ctx.Scale);
|
|
37
|
+
this.Arrange(d, this.WidthRequest, this.HeightRequest, ctx.Scale);
|
|
38
|
+
}
|
|
39
|
+
super.Render(ctx);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { type DrawingContext, SkiaControl } from "../core/SkiaControl";
|
|
2
2
|
import { ViewsAdapter } from "../core/ViewsAdapter";
|
|
3
|
-
import { type GridLength, type LayoutType, type MeasuringStrategy, type RecyclingTemplate, ScaledSize, type ShapeType, Thickness } from "../core/Types";
|
|
3
|
+
import { type GridLength, type LayoutType, type MeasuringStrategy, type RecyclingTemplate, SKRect, ScaledSize, type ShapeType, Thickness, type ThicknessValue } from "../core/Types";
|
|
4
4
|
import { SkiaGridStructure } from "./GridStructure";
|
|
5
5
|
/**
|
|
6
6
|
* Mirrors DrawnUi SkiaLayout (Absolute / Column / Row / Wrap / Grid).
|
|
7
7
|
* Column/Row give children an infinite main axis (MAUI stack semantics: Fill on the main axis = auto-sized).
|
|
8
8
|
*
|
|
9
|
-
* Templated mode (ItemsSource + ItemTemplate)
|
|
10
|
-
* the indexes inside the visible viewport (+ VirtualisationInflated), everything else is arithmetic —
|
|
11
|
-
* MeasureFirst measures one cell and assumes uniform size
|
|
9
|
+
* Templated mode (ItemsSource + ItemTemplate): a single-column Column is the virtualized list, cells are created through
|
|
10
|
+
* the ViewsAdapter for the indexes inside the visible viewport (+ VirtualisationInflated), everything else is arithmetic —
|
|
11
|
+
* MeasureAll (default) measures every item once, MeasureFirst measures one cell and assumes uniform size. A templated
|
|
12
|
+
* Row / Wrap / Grid / split Column follows RecyclingTemplate: Enabled measures every item on pooled views and binds views
|
|
13
|
+
* only to the slots drawn, Disabled keeps one view per item.
|
|
12
14
|
*/
|
|
13
15
|
export declare class SkiaLayout extends SkiaControl {
|
|
14
16
|
/** Layout type. SkiaShape redeclares it as ShapeType (any shape value lays out as Absolute), like the C# hidden Type. */
|
|
15
17
|
Type: LayoutType | ShapeType;
|
|
16
18
|
Spacing: number;
|
|
17
|
-
|
|
19
|
+
private padding;
|
|
20
|
+
/** Space inside the layout around its children (points); a number is the same on every side (`Thickness.From`). */
|
|
21
|
+
get Padding(): Thickness;
|
|
22
|
+
set Padding(v: ThicknessValue);
|
|
18
23
|
ColumnDefinitions?: string | GridLength[];
|
|
19
24
|
RowDefinitions?: string | GridLength[];
|
|
20
25
|
/** Track used for columns/rows a child references but no definition declares (C# default: Auto). */
|
|
@@ -24,7 +29,10 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
24
29
|
RowSpacing: number;
|
|
25
30
|
/** Structure computed by the last measure; cells are arranged from it. */
|
|
26
31
|
GridStructure?: SkiaGridStructure;
|
|
27
|
-
|
|
32
|
+
private recyclingTemplate;
|
|
33
|
+
/** Enabled: views come from a pool and are bound to the items being drawn; Disabled: one view per item, never rebound. */
|
|
34
|
+
get RecyclingTemplate(): RecyclingTemplate;
|
|
35
|
+
set RecyclingTemplate(value: RecyclingTemplate);
|
|
28
36
|
/** Column count for Column / Wrap content and a templated Grid (0 = free flow); C# Split. */
|
|
29
37
|
Split: number;
|
|
30
38
|
/** Split > 0: every slot keeps the same width (true) or the cell keeps its measured width (C# SplitAlign). */
|
|
@@ -33,6 +41,7 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
33
41
|
DynamicColumns: boolean;
|
|
34
42
|
/** Templated Grid: fill column-major (top to bottom, then next column) instead of row-major (C# Invert). */
|
|
35
43
|
Invert: boolean;
|
|
44
|
+
/** Default MeasureAll (DrawnUi 1.10.6.20): every item keeps its own size; MeasureFirst is explicit uniform rows. */
|
|
36
45
|
MeasureItemsStrategy: MeasuringStrategy;
|
|
37
46
|
/** Realized views per item (Disabled) or a recycled pool for the visible range (Enabled). */
|
|
38
47
|
readonly ChildrenFactory: ViewsAdapter;
|
|
@@ -41,7 +50,7 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
41
50
|
private itemsSource?;
|
|
42
51
|
private itemTemplate?;
|
|
43
52
|
private structureDirty;
|
|
44
|
-
/** Per-item heights in pixels (MeasureAll) or a single uniform height (MeasureFirst). */
|
|
53
|
+
/** Per-item heights in pixels (MeasureAll, the default) or a single uniform height (MeasureFirst). */
|
|
45
54
|
private itemHeights;
|
|
46
55
|
private uniformHeight;
|
|
47
56
|
private measuredWidthPx;
|
|
@@ -70,13 +79,30 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
70
79
|
* anything else rebuilds. Returns false when a full rebuild is needed.
|
|
71
80
|
*/
|
|
72
81
|
private ApplyIncrementalChange;
|
|
82
|
+
/**
|
|
83
|
+
* Same items in another order — a drag-to-reorder, or any code writing a permuted array. DrawnUi handles the
|
|
84
|
+
* matching `ObservableCollection.Move` by keeping the structure and only rebinding the contexts, because its
|
|
85
|
+
* arrange re-flows each row from its bound view (`HandleStructurePreservingMove` / `ApplyMoveChange`, 2026-09-08).
|
|
86
|
+
* The measured heights here are index-keyed and authoritative, so they travel with their items instead: nothing is
|
|
87
|
+
* remeasured, the extent cannot change, and the scroll keeps its offset. Rebuilding instead would reset
|
|
88
|
+
* `MeasureVisible` to "exact for the first screen, estimated after" and throw a scrolled list back towards the top.
|
|
89
|
+
* Returns false when the two arrays are not a permutation of each other, so a real content change still rebuilds.
|
|
90
|
+
*/
|
|
91
|
+
private ApplyReorderChange;
|
|
73
92
|
/** Factory creating one cell (DrawnUi DataTemplate). Cells receive the item as BindingContext. */
|
|
74
93
|
get ItemTemplate(): (() => SkiaControl) | undefined;
|
|
75
94
|
set ItemTemplate(value: (() => SkiaControl) | undefined);
|
|
76
95
|
get IsTemplated(): boolean;
|
|
77
|
-
/** The virtualized list case: a templated single-column Column.
|
|
96
|
+
/** The virtualized list case: a templated single-column Column. */
|
|
78
97
|
private get IsTemplatedList();
|
|
79
|
-
/**
|
|
98
|
+
/** A templated Row / Wrap / Grid / split Column with RecyclingTemplate Enabled: slots measured on pooled views, views bound to the slots drawn. */
|
|
99
|
+
private get IsRecycledLayout();
|
|
100
|
+
/** Slots of a recycled layout, one per item. */
|
|
101
|
+
private slots?;
|
|
102
|
+
/**
|
|
103
|
+
* What the layout pass measures and arranges: static children; the slots of a recycled templated layout; or, with
|
|
104
|
+
* RecyclingTemplate Disabled, one realized view per item.
|
|
105
|
+
*/
|
|
80
106
|
private LayoutViews;
|
|
81
107
|
/** Drops realized cells and rebuilds the structure (DrawnUi ApplyItemsSource). */
|
|
82
108
|
ApplyItemsSource(): void;
|
|
@@ -89,7 +115,22 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
89
115
|
get Views(): readonly SkiaControl[];
|
|
90
116
|
/** Settable children list like DrawnUi Children (ignored while templated). */
|
|
91
117
|
get Children(): readonly SkiaControl[];
|
|
118
|
+
/**
|
|
119
|
+
* C# Children reset (ChildrenCollectionSync, 66a1eb02): the app's children the new list no longer holds are removed,
|
|
120
|
+
* the ones it gained are added, then all of them take the list's order inside the slots app children occupy, so the
|
|
121
|
+
* parts a control made itself keep their place.
|
|
122
|
+
*/
|
|
92
123
|
set Children(value: readonly SkiaControl[]);
|
|
124
|
+
/**
|
|
125
|
+
* C# Insert / Move of a Children collection (the reconciler's appendChild / insertBefore): `child` goes before
|
|
126
|
+
* `before` among the app's children, or last without it. A new child is attached at the end of the views and an
|
|
127
|
+
* append stops there; otherwise the app's children take their new order inside the slots they occupy.
|
|
128
|
+
*/
|
|
129
|
+
InsertChild(child: SkiaControl, before?: SkiaControl): void;
|
|
130
|
+
/** C# OrderViews: the given children, in their order, inside the slots they occupy in the views; nothing else moves. */
|
|
131
|
+
private OrderChildren;
|
|
132
|
+
/** C# ClearChildren: removes every subview, the control's own parts included. */
|
|
133
|
+
ClearChildren(): void;
|
|
93
134
|
private orderedViews?;
|
|
94
135
|
/** Static children sorted by ZIndex (stable), computed once per change (C# GetOrderedSubviews). */
|
|
95
136
|
protected GetOrderedSubviews(): readonly SkiaControl[];
|
|
@@ -110,6 +151,30 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
110
151
|
* Split items; `DynamicColumns` lets a short last row spread over the width.
|
|
111
152
|
*/
|
|
112
153
|
private MeasureWrap;
|
|
154
|
+
private get IsMasonry();
|
|
155
|
+
/**
|
|
156
|
+
* C# MeasureMasonry / BuildMasonryLayout: Split columns of equal width, every item measured unbounded at the column
|
|
157
|
+
* width and put at the bottom of the shortest column (the first on a tie), so items of different heights leave no
|
|
158
|
+
* gaps; Spacing between columns and between items. Every item is laid out (no items window). A templated slot keeps
|
|
159
|
+
* the size of its item, so an appended page or an item that asked to be measured again (an image arrived) is the only
|
|
160
|
+
* one measured, and every item is placed again from the sizes known.
|
|
161
|
+
*/
|
|
162
|
+
private MeasureMasonry;
|
|
163
|
+
/**
|
|
164
|
+
* Where item `index` of a recycled templated Row / Wrap / Grid / split Column / Masonry was arranged (pixels), from
|
|
165
|
+
* its slot, also while no view shows it (ScrollToIndex to an item off screen); undefined otherwise.
|
|
166
|
+
*/
|
|
167
|
+
GetItemRect(index: number): SKRect | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Masonry: every placed item with its rect (pixels), in item order: what keyboard navigation follows, since the
|
|
170
|
+
* columns have uneven heights and the item `Split` places later is rarely under the focused one.
|
|
171
|
+
*/
|
|
172
|
+
GetMasonryPlacement(): {
|
|
173
|
+
Index: number;
|
|
174
|
+
Rect: SKRect;
|
|
175
|
+
}[];
|
|
176
|
+
/** Masonry: where the slot of item `index` was arranged (pixels); see GetItemRect. */
|
|
177
|
+
GetMasonryItemRect(index: number): SKRect | undefined;
|
|
113
178
|
/** Port of C# MeasureGrid: build the structure in points, stretch the last track when the grid fills, remeasure at final cells. */
|
|
114
179
|
private MeasureGrid;
|
|
115
180
|
/** Templated Column: content = padding + sum of item heights + gaps; width = the constraint (cells fill). */
|
|
@@ -127,12 +192,31 @@ export declare class SkiaLayout extends SkiaControl {
|
|
|
127
192
|
private MvScheduleBackground;
|
|
128
193
|
/** Binds a cell to items[index] (through the adapter, so MeasureFirst's cell 0 stays realized) and measures it. */
|
|
129
194
|
private MeasureItem;
|
|
195
|
+
/**
|
|
196
|
+
* The item's offset and height are real, not estimated (C# LastMeasuredIndexLocal >= index): MeasureVisible knows
|
|
197
|
+
* them once the measured prefix passed the item; the other strategies always do.
|
|
198
|
+
*/
|
|
199
|
+
IsItemMeasured(index: number): boolean;
|
|
130
200
|
/** Pixel offset of item index from the top of the layout content (inside padding). */
|
|
131
201
|
GetItemOffsetPixels(index: number): number;
|
|
132
202
|
private ItemHeightPixels;
|
|
133
203
|
protected OnLayoutChanged(): void;
|
|
204
|
+
/** Static children and realized views are arranged; the slots of a recycled layout record where their item goes. */
|
|
205
|
+
private ArrangeChildren;
|
|
134
206
|
protected Paint(ctx: DrawingContext): void;
|
|
135
207
|
protected GetCompositeChildren(): readonly SkiaControl[];
|
|
208
|
+
private readonly drawnSlots;
|
|
209
|
+
/**
|
|
210
|
+
* Recycled templated layout (C# DrawStack): a view from the pool is bound to each slot that can be seen and drawn
|
|
211
|
+
* there; the views of the other slots go back to the pool.
|
|
212
|
+
*/
|
|
213
|
+
private PaintSlots;
|
|
214
|
+
/**
|
|
215
|
+
* Where slots are drawn (C# GetOnScreenVisibleArea): what can be seen, inflated by VirtualisationInflated. Under a
|
|
216
|
+
* cache (this layout's or an ancestor's, below the nearest scroll) every slot, because the cache is blitted later at
|
|
217
|
+
* other offsets.
|
|
218
|
+
*/
|
|
219
|
+
private SlotsArea;
|
|
136
220
|
/** Realizes, binds, arranges and draws only the cells intersecting the visible viewport (+ inflation). */
|
|
137
221
|
private PaintTemplated;
|
|
138
222
|
/**
|
|
@@ -157,6 +241,10 @@ export declare class SkiaLayer extends SkiaLayout {
|
|
|
157
241
|
export declare class SkiaGrid extends SkiaLayout {
|
|
158
242
|
constructor();
|
|
159
243
|
}
|
|
244
|
+
/** SkiaLayout Type=Masonry + Split 2 + HorizontalOptions=Fill (DrawnUi alias): columns, each item to the shortest one. */
|
|
245
|
+
export declare class SkiaMasonry extends SkiaLayout {
|
|
246
|
+
constructor();
|
|
247
|
+
}
|
|
160
248
|
/** SkiaLayout Type=Wrap + HorizontalOptions=Fill (DrawnUi alias): responsive flow of fixed-size children. */
|
|
161
249
|
export declare class SkiaWrap extends SkiaLayout {
|
|
162
250
|
constructor();
|