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,163 @@
|
|
|
1
|
+
import { type DrawingContext, SkiaControl } from "../core/SkiaControl";
|
|
2
|
+
import { ViewsAdapter } from "../core/ViewsAdapter";
|
|
3
|
+
import { type GridLength, type LayoutType, type MeasuringStrategy, type RecyclingTemplate, ScaledSize, type ShapeType, Thickness } from "../core/Types";
|
|
4
|
+
import { SkiaGridStructure } from "./GridStructure";
|
|
5
|
+
/**
|
|
6
|
+
* Mirrors DrawnUi SkiaLayout (Absolute / Column / Row / Wrap / Grid).
|
|
7
|
+
* Column/Row give children an infinite main axis (MAUI stack semantics: Fill on the main axis = auto-sized).
|
|
8
|
+
*
|
|
9
|
+
* Templated mode (ItemsSource + ItemTemplate) is a Column only: cells are created through the ViewsAdapter for
|
|
10
|
+
* the indexes inside the visible viewport (+ VirtualisationInflated), everything else is arithmetic —
|
|
11
|
+
* MeasureFirst measures one cell and assumes uniform size, MeasureAll measures every item once.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SkiaLayout extends SkiaControl {
|
|
14
|
+
/** Layout type. SkiaShape redeclares it as ShapeType (any shape value lays out as Absolute), like the C# hidden Type. */
|
|
15
|
+
Type: LayoutType | ShapeType;
|
|
16
|
+
Spacing: number;
|
|
17
|
+
Padding: Thickness;
|
|
18
|
+
ColumnDefinitions?: string | GridLength[];
|
|
19
|
+
RowDefinitions?: string | GridLength[];
|
|
20
|
+
/** Track used for columns/rows a child references but no definition declares (C# default: Auto). */
|
|
21
|
+
DefaultColumnDefinition: GridLength;
|
|
22
|
+
DefaultRowDefinition: GridLength;
|
|
23
|
+
ColumnSpacing: number;
|
|
24
|
+
RowSpacing: number;
|
|
25
|
+
/** Structure computed by the last measure; cells are arranged from it. */
|
|
26
|
+
GridStructure?: SkiaGridStructure;
|
|
27
|
+
RecyclingTemplate: RecyclingTemplate;
|
|
28
|
+
/** Column count for Column / Wrap content and a templated Grid (0 = free flow); C# Split. */
|
|
29
|
+
Split: number;
|
|
30
|
+
/** Split > 0: every slot keeps the same width (true) or the cell keeps its measured width (C# SplitAlign). */
|
|
31
|
+
SplitAlign: boolean;
|
|
32
|
+
/** A short last row spreads over the whole width instead of keeping empty Split slots (C# DynamicColumns). */
|
|
33
|
+
DynamicColumns: boolean;
|
|
34
|
+
/** Templated Grid: fill column-major (top to bottom, then next column) instead of row-major (C# Invert). */
|
|
35
|
+
Invert: boolean;
|
|
36
|
+
MeasureItemsStrategy: MeasuringStrategy;
|
|
37
|
+
/** Realized views per item (Disabled) or a recycled pool for the visible range (Enabled). */
|
|
38
|
+
readonly ChildrenFactory: ViewsAdapter;
|
|
39
|
+
FirstVisibleIndex: number;
|
|
40
|
+
LastVisibleIndex: number;
|
|
41
|
+
private itemsSource?;
|
|
42
|
+
private itemTemplate?;
|
|
43
|
+
private structureDirty;
|
|
44
|
+
/** Per-item heights in pixels (MeasureAll) or a single uniform height (MeasureFirst). */
|
|
45
|
+
private itemHeights;
|
|
46
|
+
private uniformHeight;
|
|
47
|
+
private measuredWidthPx;
|
|
48
|
+
/** Items measured per idle slice before the estimate is refreshed (DrawnUi BackgroundMeasurementBatchSize). */
|
|
49
|
+
BackgroundMeasurementBatchSize: number;
|
|
50
|
+
/** Pixel heights of measured items (0 = not measured yet), any order: visible cells are measured on demand. */
|
|
51
|
+
private mvHeights;
|
|
52
|
+
/** mvPrefix[i] = offset of item i (inside padding, gaps included) for i <= mvMeasured; items 0..mvMeasured-1 are exact. */
|
|
53
|
+
private mvPrefix;
|
|
54
|
+
private mvMeasured;
|
|
55
|
+
private mvSum;
|
|
56
|
+
private mvCount;
|
|
57
|
+
private mvIdle;
|
|
58
|
+
/** Index of the last item measured by the background pass (DrawnUi LastMeasuredIndex); -1 = none. */
|
|
59
|
+
get LastMeasuredIndex(): number;
|
|
60
|
+
get ItemsSource(): readonly unknown[] | undefined;
|
|
61
|
+
set ItemsSource(value: readonly unknown[] | undefined);
|
|
62
|
+
/**
|
|
63
|
+
* Raised after items were inserted at the head and measured, with the inserted extent in pixels; SkiaScroll uses it to
|
|
64
|
+
* keep the visible rows where they are (DrawnUi head-insert rebase).
|
|
65
|
+
*/
|
|
66
|
+
ItemsInsertedAtStart?: (sender: SkiaLayout, insertedPx: number) => void;
|
|
67
|
+
/**
|
|
68
|
+
* DrawnUi keeps the structure on ObservableCollection Add/Insert; React apps replace the array, so the relation is
|
|
69
|
+
* detected instead: same items appended (page loaded) or prepended (chat history) keep every measured height,
|
|
70
|
+
* anything else rebuilds. Returns false when a full rebuild is needed.
|
|
71
|
+
*/
|
|
72
|
+
private ApplyIncrementalChange;
|
|
73
|
+
/** Factory creating one cell (DrawnUi DataTemplate). Cells receive the item as BindingContext. */
|
|
74
|
+
get ItemTemplate(): (() => SkiaControl) | undefined;
|
|
75
|
+
set ItemTemplate(value: (() => SkiaControl) | undefined);
|
|
76
|
+
get IsTemplated(): boolean;
|
|
77
|
+
/** The virtualized list case: a templated single-column Column. Templated Row / Wrap / Grid realize every item. */
|
|
78
|
+
private get IsTemplatedList();
|
|
79
|
+
/** Views taking part in the layout pass: static children, or every item of a templated Row / Wrap / Grid (C# non-list layouts are not virtualized). */
|
|
80
|
+
private LayoutViews;
|
|
81
|
+
/** Drops realized cells and rebuilds the structure (DrawnUi ApplyItemsSource). */
|
|
82
|
+
ApplyItemsSource(): void;
|
|
83
|
+
/** Diagnostics like DrawnUi DebugString: visible range, realized views, pool. */
|
|
84
|
+
get DebugString(): string;
|
|
85
|
+
/** A layout paints outside its box whatever its children paint outside theirs (C# aggregated effects margin). */
|
|
86
|
+
ComputeEffectsMargin(scale: number): Thickness;
|
|
87
|
+
private readonly views;
|
|
88
|
+
/** Read-only live children like DrawnUi Views: realized cells when templated, else static children. */
|
|
89
|
+
get Views(): readonly SkiaControl[];
|
|
90
|
+
/** Settable children list like DrawnUi Children (ignored while templated). */
|
|
91
|
+
get Children(): readonly SkiaControl[];
|
|
92
|
+
set Children(value: readonly SkiaControl[]);
|
|
93
|
+
private orderedViews?;
|
|
94
|
+
/** Static children sorted by ZIndex (stable), computed once per change (C# GetOrderedSubviews). */
|
|
95
|
+
protected GetOrderedSubviews(): readonly SkiaControl[];
|
|
96
|
+
InvalidateViewsOrder(): void;
|
|
97
|
+
protected GetGestureListeners(): readonly SkiaControl[];
|
|
98
|
+
protected DisposeChildren(): void;
|
|
99
|
+
AddSubView(control: SkiaControl): void;
|
|
100
|
+
InsertSubView(index: number, control: SkiaControl): void;
|
|
101
|
+
RemoveSubView(control: SkiaControl): void;
|
|
102
|
+
protected MeasureAbsolute(widthConstraint: number, heightConstraint: number, scale: number): ScaledSize;
|
|
103
|
+
/** Wrap rows computed by the last measure: [childIndex, x, y, w, h] in pixels relative to the padded box. */
|
|
104
|
+
private wrapSlots;
|
|
105
|
+
/** Wrap, or a Column with Split > 1 (C# lays a multi-column Column out like a wrap with fixed slots). */
|
|
106
|
+
private get IsWrapFlow();
|
|
107
|
+
/**
|
|
108
|
+
* Flow children left to right, wrapping when the row overflows; Spacing applies between items and rows.
|
|
109
|
+
* Split > 0: fixed column count with slot width (width - (Split - 1) * gap) / Split (`SplitAlign`), a new row every
|
|
110
|
+
* Split items; `DynamicColumns` lets a short last row spread over the width.
|
|
111
|
+
*/
|
|
112
|
+
private MeasureWrap;
|
|
113
|
+
/** Port of C# MeasureGrid: build the structure in points, stretch the last track when the grid fills, remeasure at final cells. */
|
|
114
|
+
private MeasureGrid;
|
|
115
|
+
/** Templated Column: content = padding + sum of item heights + gaps; width = the constraint (cells fill). */
|
|
116
|
+
private MeasureTemplated;
|
|
117
|
+
private MvReset;
|
|
118
|
+
/** Average item stride (height + gap) from everything measured so far. */
|
|
119
|
+
private MvStride;
|
|
120
|
+
/** DrawnUi MeasureList estimate: exact prefix + average × remaining. */
|
|
121
|
+
private MvContentHeight;
|
|
122
|
+
/** Measures one item (binding it through the adapter); release = give the cell back to the pool right away. */
|
|
123
|
+
private MvMeasure;
|
|
124
|
+
/** Grows the exact prefix over every already-measured item that follows it. */
|
|
125
|
+
private MvExtendPrefix;
|
|
126
|
+
/** Background measurement in idle time (DrawnUi StartBackgroundMeasurement): time-sliced, then the estimate is refreshed once. */
|
|
127
|
+
private MvScheduleBackground;
|
|
128
|
+
/** Binds a cell to items[index] (through the adapter, so MeasureFirst's cell 0 stays realized) and measures it. */
|
|
129
|
+
private MeasureItem;
|
|
130
|
+
/** Pixel offset of item index from the top of the layout content (inside padding). */
|
|
131
|
+
GetItemOffsetPixels(index: number): number;
|
|
132
|
+
private ItemHeightPixels;
|
|
133
|
+
protected OnLayoutChanged(): void;
|
|
134
|
+
protected Paint(ctx: DrawingContext): void;
|
|
135
|
+
protected GetCompositeChildren(): readonly SkiaControl[];
|
|
136
|
+
/** Realizes, binds, arranges and draws only the cells intersecting the visible viewport (+ inflation). */
|
|
137
|
+
private PaintTemplated;
|
|
138
|
+
/**
|
|
139
|
+
* MeasureVisible frame: the first visible index comes from the exact prefix (binary search) or the estimate,
|
|
140
|
+
* then cells are laid out contiguously with their REAL measured heights (measured on demand, kept for the prefix).
|
|
141
|
+
*/
|
|
142
|
+
private PaintMeasureVisible;
|
|
143
|
+
}
|
|
144
|
+
/** SkiaLayout Type=Column + HorizontalOptions=Fill (DrawnUi alias). */
|
|
145
|
+
export declare class SkiaStack extends SkiaLayout {
|
|
146
|
+
constructor();
|
|
147
|
+
}
|
|
148
|
+
/** SkiaLayout Type=Row (DrawnUi alias). */
|
|
149
|
+
export declare class SkiaRow extends SkiaLayout {
|
|
150
|
+
constructor();
|
|
151
|
+
}
|
|
152
|
+
/** SkiaLayout Type=Absolute + HorizontalOptions=Fill (DrawnUi alias). */
|
|
153
|
+
export declare class SkiaLayer extends SkiaLayout {
|
|
154
|
+
constructor();
|
|
155
|
+
}
|
|
156
|
+
/** SkiaLayout Type=Grid + HorizontalOptions=Fill (DrawnUi alias): MAUI Grid alternative. */
|
|
157
|
+
export declare class SkiaGrid extends SkiaLayout {
|
|
158
|
+
constructor();
|
|
159
|
+
}
|
|
160
|
+
/** SkiaLayout Type=Wrap + HorizontalOptions=Fill (DrawnUi alias): responsive flow of fixed-size children. */
|
|
161
|
+
export declare class SkiaWrap extends SkiaLayout {
|
|
162
|
+
constructor();
|
|
163
|
+
}
|