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,177 @@
|
|
|
1
|
+
/** MAUI LayoutOptions subset used by DrawnUi. */
|
|
2
|
+
export type LayoutOptions = "Start" | "Center" | "End" | "Fill";
|
|
3
|
+
/** MAUI Thickness with the same ctor overloads: (all) / (horizontal, vertical) / (l, t, r, b). */
|
|
4
|
+
export declare class Thickness {
|
|
5
|
+
Left: number;
|
|
6
|
+
Top: number;
|
|
7
|
+
Right: number;
|
|
8
|
+
Bottom: number;
|
|
9
|
+
constructor(a?: number, b?: number, c?: number, d?: number);
|
|
10
|
+
static readonly Zero: Thickness;
|
|
11
|
+
get HorizontalThickness(): number;
|
|
12
|
+
get VerticalThickness(): number;
|
|
13
|
+
}
|
|
14
|
+
/** SKRect: left/top/right/bottom in pixels. */
|
|
15
|
+
export declare class SKRect {
|
|
16
|
+
Left: number;
|
|
17
|
+
Top: number;
|
|
18
|
+
Right: number;
|
|
19
|
+
Bottom: number;
|
|
20
|
+
constructor(Left?: number, Top?: number, Right?: number, Bottom?: number);
|
|
21
|
+
get Width(): number;
|
|
22
|
+
get Height(): number;
|
|
23
|
+
static Create(x: number, y: number, w: number, h: number): SKRect;
|
|
24
|
+
static readonly Empty: SKRect;
|
|
25
|
+
}
|
|
26
|
+
/** DrawnUi ScaledSize: same size in points (Units) and pixels. */
|
|
27
|
+
export declare class ScaledSize {
|
|
28
|
+
Pixels: {
|
|
29
|
+
Width: number;
|
|
30
|
+
Height: number;
|
|
31
|
+
};
|
|
32
|
+
Units: {
|
|
33
|
+
Width: number;
|
|
34
|
+
Height: number;
|
|
35
|
+
};
|
|
36
|
+
constructor(Pixels: {
|
|
37
|
+
Width: number;
|
|
38
|
+
Height: number;
|
|
39
|
+
}, Units: {
|
|
40
|
+
Width: number;
|
|
41
|
+
Height: number;
|
|
42
|
+
});
|
|
43
|
+
static FromPixels(w: number, h: number, scale: number): ScaledSize;
|
|
44
|
+
static readonly Default: ScaledSize;
|
|
45
|
+
}
|
|
46
|
+
/** MAUI Color: a CSS "#RRGGBB" / "#RRGGBBAA" / "rgb()" / "rgba()" string (what CanvasKit parses). */
|
|
47
|
+
export type Color = string;
|
|
48
|
+
/** MAUI Colors subset. */
|
|
49
|
+
export declare const Colors: {
|
|
50
|
+
readonly Transparent: "#00000000";
|
|
51
|
+
readonly White: "#FFFFFF";
|
|
52
|
+
readonly Black: "#000000";
|
|
53
|
+
readonly Red: "#FF0000";
|
|
54
|
+
readonly Green: "#00FF00";
|
|
55
|
+
readonly Blue: "#0000FF";
|
|
56
|
+
readonly Gray: "#808080";
|
|
57
|
+
readonly DarkGray: "#A9A9A9";
|
|
58
|
+
readonly LightGray: "#D3D3D3";
|
|
59
|
+
readonly Orange: "#FFA500";
|
|
60
|
+
readonly Yellow: "#FFFF00";
|
|
61
|
+
readonly CornflowerBlue: "#6495ED";
|
|
62
|
+
readonly DarkSlateBlue: "#483D8B";
|
|
63
|
+
readonly GreenYellow: "#ADFF2F";
|
|
64
|
+
};
|
|
65
|
+
/** DrawnUi DrawTextAlignment (Fill* variants are accepted and currently align Start). */
|
|
66
|
+
export type DrawTextAlignment = "Start" | "Center" | "End" | "FillWords" | "FillWordsFull" | "FillCharacters" | "FillCharactersFull";
|
|
67
|
+
/** MAUI TextAlignment. */
|
|
68
|
+
export type TextAlignment = "Start" | "Center" | "End";
|
|
69
|
+
/** MAUI LineBreakMode. Head/Middle truncation currently behave like TailTruncation. */
|
|
70
|
+
export type LineBreakMode = "NoWrap" | "WordWrap" | "CharacterWrap" | "HeadTruncation" | "MiddleTruncation" | "TailTruncation";
|
|
71
|
+
/** MAUI FontAttributes flags. */
|
|
72
|
+
export type FontAttributes = "None" | "Bold" | "Italic" | "BoldItalic";
|
|
73
|
+
/** MAUI TextTransform. */
|
|
74
|
+
export type TextTransform = "None" | "Lowercase" | "Uppercase" | "Titlecase";
|
|
75
|
+
/** DrawnUi DrawerDirection: the edge a SkiaDrawer slides from. */
|
|
76
|
+
export type DrawerDirection = "FromBottom" | "FromTop" | "FromLeft" | "FromRight";
|
|
77
|
+
/** DrawnUi LayoutType. */
|
|
78
|
+
export type LayoutType = "Absolute" | "Column" | "Row" | "Wrap" | "Grid";
|
|
79
|
+
/** MAUI ReturnType: what the keyboard's return key means (SkiaEditor: Send submits a multiline editor). */
|
|
80
|
+
export type ReturnType = "Default" | "Done" | "Go" | "Next" | "Search" | "Send";
|
|
81
|
+
/** DrawnUi SkiaEditor.SkiaEditorKeyboard. */
|
|
82
|
+
export type SkiaEditorKeyboard = "Default" | "Numeric" | "Decimal" | "Phone" | "Email";
|
|
83
|
+
/** DrawnUi BevelType: None, Bevel (light top/left, shadow bottom/right), Emboss (the opposite). */
|
|
84
|
+
export type BevelType = "None" | "Bevel" | "Emboss";
|
|
85
|
+
/** DrawnUi SkiaBevel: bevel / emboss edge parameters of a SkiaShape (Depth in points). */
|
|
86
|
+
export declare class SkiaBevel {
|
|
87
|
+
Depth: number;
|
|
88
|
+
LightColor: Color;
|
|
89
|
+
ShadowColor: Color;
|
|
90
|
+
/** Applies to both the light and the shadow edge. */
|
|
91
|
+
Opacity: number;
|
|
92
|
+
constructor(init?: Partial<SkiaBevel>);
|
|
93
|
+
static From(v: SkiaBevel | Partial<SkiaBevel>): SkiaBevel;
|
|
94
|
+
}
|
|
95
|
+
/** DrawnUi SkiaShadow: a drop shadow painted with the shape (offset and blur in points; Color alpha 1 = use Opacity). */
|
|
96
|
+
export declare class SkiaShadow {
|
|
97
|
+
X: number;
|
|
98
|
+
Y: number;
|
|
99
|
+
/** Blur sigma, points. */
|
|
100
|
+
Blur: number;
|
|
101
|
+
Opacity: number;
|
|
102
|
+
Color: Color;
|
|
103
|
+
/** Draw only the shadow, not the shape itself. */
|
|
104
|
+
ShadowOnly: boolean;
|
|
105
|
+
constructor(init?: Partial<SkiaShadow>);
|
|
106
|
+
/** Accepts class instances or plain `{ X, Y, Blur, Opacity, Color }` literals from JSX. */
|
|
107
|
+
static From(v: SkiaShadow | Partial<SkiaShadow>): SkiaShadow;
|
|
108
|
+
}
|
|
109
|
+
/** MAUI GridLength: absolute points, "Auto", "*" or "N*" (weighted star). */
|
|
110
|
+
export type GridLength = number | "Auto" | "*" | `${number}*`;
|
|
111
|
+
/** DrawnUi ShapeType (Squricle/Custom draw as Rectangle for now). */
|
|
112
|
+
export type ShapeType = "Rectangle" | "Circle" | "Ellipse" | "Arc" | "Squricle" | "Path" | "Polygon" | "Line" | "Custom";
|
|
113
|
+
/** SKStrokeCap. */
|
|
114
|
+
export type StrokeCap = "Butt" | "Round" | "Square";
|
|
115
|
+
/** MAUI CornerRadius: uniform or per corner (points). */
|
|
116
|
+
export declare class CornerRadius {
|
|
117
|
+
readonly TopLeft: number;
|
|
118
|
+
readonly TopRight: number;
|
|
119
|
+
readonly BottomLeft: number;
|
|
120
|
+
readonly BottomRight: number;
|
|
121
|
+
constructor(topLeft: number, topRight?: number, bottomLeft?: number, bottomRight?: number);
|
|
122
|
+
static readonly Zero: CornerRadius;
|
|
123
|
+
}
|
|
124
|
+
/** DrawnUi SkiaPoint: a vertex as ratios (0..1) of the shape rect. */
|
|
125
|
+
export declare class SkiaPoint {
|
|
126
|
+
X: number;
|
|
127
|
+
Y: number;
|
|
128
|
+
constructor(X?: number, Y?: number);
|
|
129
|
+
}
|
|
130
|
+
/** DrawnUi TransformAspect: how an image/svg is scaled into its box. */
|
|
131
|
+
export type TransformAspect = "None" | "Fill" | "Fit" | "AspectFit" | "AspectFill" | "AspectFitFill" | "FitFill" | "Cover" | "AspectCover" | "Tile";
|
|
132
|
+
/** DrawnUi DrawImageAlignment. */
|
|
133
|
+
export type DrawImageAlignment = "Start" | "Center" | "End";
|
|
134
|
+
/** MAUI/DrawnUi ScrollOrientation. */
|
|
135
|
+
export type ScrollOrientation = "Vertical" | "Horizontal" | "Both" | "Neither";
|
|
136
|
+
/**
|
|
137
|
+
* DrawnUi SkiaCacheType. Operations = recorded draw commands (SkPicture) replayed each frame;
|
|
138
|
+
* Image = offscreen surface snapshot blitted each frame (GPU-backed when the canvas is WebGL).
|
|
139
|
+
* GPU / ImageDoubleBuffered / ImageComposite / ImageCompositeGPU are accepted and currently resolve to Image.
|
|
140
|
+
*/
|
|
141
|
+
export type SkiaCacheType = "None" | "Operations" | "OperationsFull" | "Image" | "ImageDoubleBuffered" | "ImageComposite" | "ImageCompositeGPU" | "GPU";
|
|
142
|
+
/** DrawnUi GradientType (Conical accepted, drawn as Circular). */
|
|
143
|
+
export type GradientType = "None" | "Linear" | "Circular" | "Oval" | "Sweep" | "Conical";
|
|
144
|
+
/** SKShaderTileMode. */
|
|
145
|
+
export type ShaderTileMode = "Clamp" | "Repeat" | "Mirror" | "Decal";
|
|
146
|
+
/**
|
|
147
|
+
* DrawnUi SkiaGradient: colors spread over the control's rect. Linear from Start to End (ratios, or `Angle` in CSS
|
|
148
|
+
* degrees), Circular / Oval centered at Start, Sweep around the center (Value1 start angle, Value2 sweep on the
|
|
149
|
+
* control). `ColorPositions` (0..1, one per color), `TileMode`, `Light` (< 1 darker, > 1 lighter), `Opacity`, `BlendMode`.
|
|
150
|
+
*/
|
|
151
|
+
export interface SkiaGradient {
|
|
152
|
+
Type?: GradientType;
|
|
153
|
+
Colors: Color[];
|
|
154
|
+
ColorPositions?: number[];
|
|
155
|
+
StartXRatio?: number;
|
|
156
|
+
StartYRatio?: number;
|
|
157
|
+
EndXRatio?: number;
|
|
158
|
+
EndYRatio?: number;
|
|
159
|
+
/** CSS-style angle in degrees; overrides the Start/End ratios for Linear. */
|
|
160
|
+
Angle?: number;
|
|
161
|
+
TileMode?: ShaderTileMode;
|
|
162
|
+
Light?: number;
|
|
163
|
+
Opacity?: number;
|
|
164
|
+
BlendMode?: string;
|
|
165
|
+
}
|
|
166
|
+
/** DrawnUi RecyclingTemplate: Enabled = pool of cells for the visible range, Disabled = one view per item. */
|
|
167
|
+
export type RecyclingTemplate = "Enabled" | "Disabled";
|
|
168
|
+
/** DrawnUi MeasuringStrategy (MeasureVisible not ported yet). */
|
|
169
|
+
export type MeasuringStrategy = "MeasureAll" | "MeasureFirst" | "MeasureVisible";
|
|
170
|
+
/** DrawnUi SnapToChildrenType: snap the scroll to a child after scrolling stops. */
|
|
171
|
+
export type SnapToChildrenType = "Disabled" | "Center" | "Side";
|
|
172
|
+
/** DrawnUi RelativePositionType for ScrollToIndex. */
|
|
173
|
+
export type RelativePositionType = "None" | "Start" | "Center" | "End";
|
|
174
|
+
/** DrawnUi SkiaTouchAnimation (Shimmer declared for parity, not ported). */
|
|
175
|
+
export type SkiaTouchAnimation = "None" | "Ripple" | "Shimmer";
|
|
176
|
+
/** DrawnUi RenderingModeType subset. */
|
|
177
|
+
export type RenderingModeType = "Default" | "Accelerated";
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Mirrors DrawnUi (.NET) value types with the same names. Units: points unless a name says Pixels.
|
|
2
|
+
/** MAUI Thickness with the same ctor overloads: (all) / (horizontal, vertical) / (l, t, r, b). */
|
|
3
|
+
export class Thickness {
|
|
4
|
+
Left;
|
|
5
|
+
Top;
|
|
6
|
+
Right;
|
|
7
|
+
Bottom;
|
|
8
|
+
constructor(a = 0, b, c, d) {
|
|
9
|
+
if (b === undefined) {
|
|
10
|
+
this.Left = this.Top = this.Right = this.Bottom = a;
|
|
11
|
+
}
|
|
12
|
+
else if (c === undefined) {
|
|
13
|
+
this.Left = this.Right = a;
|
|
14
|
+
this.Top = this.Bottom = b;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this.Left = a;
|
|
18
|
+
this.Top = b;
|
|
19
|
+
this.Right = c;
|
|
20
|
+
this.Bottom = d ?? 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static Zero = new Thickness();
|
|
24
|
+
get HorizontalThickness() { return this.Left + this.Right; }
|
|
25
|
+
get VerticalThickness() { return this.Top + this.Bottom; }
|
|
26
|
+
}
|
|
27
|
+
/** SKRect: left/top/right/bottom in pixels. */
|
|
28
|
+
export class SKRect {
|
|
29
|
+
Left;
|
|
30
|
+
Top;
|
|
31
|
+
Right;
|
|
32
|
+
Bottom;
|
|
33
|
+
constructor(Left = 0, Top = 0, Right = 0, Bottom = 0) {
|
|
34
|
+
this.Left = Left;
|
|
35
|
+
this.Top = Top;
|
|
36
|
+
this.Right = Right;
|
|
37
|
+
this.Bottom = Bottom;
|
|
38
|
+
}
|
|
39
|
+
get Width() { return this.Right - this.Left; }
|
|
40
|
+
get Height() { return this.Bottom - this.Top; }
|
|
41
|
+
static Create(x, y, w, h) { return new SKRect(x, y, x + w, y + h); }
|
|
42
|
+
static Empty = new SKRect();
|
|
43
|
+
}
|
|
44
|
+
/** DrawnUi ScaledSize: same size in points (Units) and pixels. */
|
|
45
|
+
export class ScaledSize {
|
|
46
|
+
Pixels;
|
|
47
|
+
Units;
|
|
48
|
+
constructor(Pixels, Units) {
|
|
49
|
+
this.Pixels = Pixels;
|
|
50
|
+
this.Units = Units;
|
|
51
|
+
}
|
|
52
|
+
static FromPixels(w, h, scale) {
|
|
53
|
+
return new ScaledSize({ Width: w, Height: h }, { Width: w / scale, Height: h / scale });
|
|
54
|
+
}
|
|
55
|
+
static Default = new ScaledSize({ Width: 0, Height: 0 }, { Width: 0, Height: 0 });
|
|
56
|
+
}
|
|
57
|
+
/** MAUI Colors subset. */
|
|
58
|
+
export const Colors = {
|
|
59
|
+
Transparent: "#00000000",
|
|
60
|
+
White: "#FFFFFF",
|
|
61
|
+
Black: "#000000",
|
|
62
|
+
Red: "#FF0000",
|
|
63
|
+
Green: "#00FF00",
|
|
64
|
+
Blue: "#0000FF",
|
|
65
|
+
Gray: "#808080",
|
|
66
|
+
DarkGray: "#A9A9A9",
|
|
67
|
+
LightGray: "#D3D3D3",
|
|
68
|
+
Orange: "#FFA500",
|
|
69
|
+
Yellow: "#FFFF00",
|
|
70
|
+
CornflowerBlue: "#6495ED",
|
|
71
|
+
DarkSlateBlue: "#483D8B",
|
|
72
|
+
GreenYellow: "#ADFF2F",
|
|
73
|
+
};
|
|
74
|
+
/** DrawnUi SkiaBevel: bevel / emboss edge parameters of a SkiaShape (Depth in points). */
|
|
75
|
+
export class SkiaBevel {
|
|
76
|
+
Depth = 2;
|
|
77
|
+
LightColor = "#FFFFFF";
|
|
78
|
+
ShadowColor = "#000000";
|
|
79
|
+
/** Applies to both the light and the shadow edge. */
|
|
80
|
+
Opacity = 0.5;
|
|
81
|
+
constructor(init) { if (init)
|
|
82
|
+
Object.assign(this, init); }
|
|
83
|
+
static From(v) { return v instanceof SkiaBevel ? v : new SkiaBevel(v); }
|
|
84
|
+
}
|
|
85
|
+
/** DrawnUi SkiaShadow: a drop shadow painted with the shape (offset and blur in points; Color alpha 1 = use Opacity). */
|
|
86
|
+
export class SkiaShadow {
|
|
87
|
+
X = 2;
|
|
88
|
+
Y = 2;
|
|
89
|
+
/** Blur sigma, points. */
|
|
90
|
+
Blur = 5;
|
|
91
|
+
Opacity = 0.5;
|
|
92
|
+
Color = "#00000000";
|
|
93
|
+
/** Draw only the shadow, not the shape itself. */
|
|
94
|
+
ShadowOnly = false;
|
|
95
|
+
constructor(init) { if (init)
|
|
96
|
+
Object.assign(this, init); }
|
|
97
|
+
/** Accepts class instances or plain `{ X, Y, Blur, Opacity, Color }` literals from JSX. */
|
|
98
|
+
static From(v) { return v instanceof SkiaShadow ? v : new SkiaShadow(v); }
|
|
99
|
+
}
|
|
100
|
+
/** MAUI CornerRadius: uniform or per corner (points). */
|
|
101
|
+
export class CornerRadius {
|
|
102
|
+
TopLeft;
|
|
103
|
+
TopRight;
|
|
104
|
+
BottomLeft;
|
|
105
|
+
BottomRight;
|
|
106
|
+
constructor(topLeft, topRight, bottomLeft, bottomRight) {
|
|
107
|
+
this.TopLeft = topLeft;
|
|
108
|
+
this.TopRight = topRight ?? topLeft;
|
|
109
|
+
this.BottomLeft = bottomLeft ?? topLeft;
|
|
110
|
+
this.BottomRight = bottomRight ?? topLeft;
|
|
111
|
+
}
|
|
112
|
+
static Zero = new CornerRadius(0);
|
|
113
|
+
}
|
|
114
|
+
/** DrawnUi SkiaPoint: a vertex as ratios (0..1) of the shape rect. */
|
|
115
|
+
export class SkiaPoint {
|
|
116
|
+
X;
|
|
117
|
+
Y;
|
|
118
|
+
constructor(X = 0, Y = 0) {
|
|
119
|
+
this.X = X;
|
|
120
|
+
this.Y = Y;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SkiaControl } from "./SkiaControl";
|
|
2
|
+
import type { RecyclingTemplate } from "./Types";
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors DrawnUi ViewsAdapter (ChildrenFactory): creates template instances for item indexes and,
|
|
5
|
+
* with RecyclingTemplate.Enabled, keeps a pool so a view leaving the visible range is rebound to the
|
|
6
|
+
* next index that needs one instead of being created again.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ViewsAdapter {
|
|
9
|
+
private readonly parent;
|
|
10
|
+
private readonly inUse;
|
|
11
|
+
private readonly pool;
|
|
12
|
+
private template?;
|
|
13
|
+
private items;
|
|
14
|
+
private recycling;
|
|
15
|
+
/** Views created so far (diagnostics). */
|
|
16
|
+
Created: number;
|
|
17
|
+
constructor(parent: SkiaControl);
|
|
18
|
+
get PoolSize(): number;
|
|
19
|
+
get InUseCount(): number;
|
|
20
|
+
/** New template / items / mode: every realized view is dropped (DrawnUi ApplyItemsSource). */
|
|
21
|
+
Initialize(template: (() => SkiaControl) | undefined, items: readonly unknown[], recycling: RecyclingTemplate): void;
|
|
22
|
+
/** Items array changed but the template did not: keep views, they get rebound on next use. */
|
|
23
|
+
UpdateItems(items: readonly unknown[]): void;
|
|
24
|
+
GetExistingViewAtIndex(index: number): SkiaControl | undefined;
|
|
25
|
+
/** Items were inserted at the head: realized views keep their item, only their index moves (no rebind). */
|
|
26
|
+
ShiftIndices(by: number, items: readonly unknown[]): void;
|
|
27
|
+
/** The realized view for an index, if any (no creation). */
|
|
28
|
+
GetViewForIndex(index: number): SkiaControl | undefined;
|
|
29
|
+
/** View bound to items[index]: existing, recycled from the pool, or freshly created. */
|
|
30
|
+
GetOrCreateViewForIndex(index: number): SkiaControl | undefined;
|
|
31
|
+
/** Index left the visible range: recycled views go back to the pool, non-recycled ones stay realized. */
|
|
32
|
+
ReleaseViewAt(index: number): void;
|
|
33
|
+
/** Releases every realized index outside [first, last]. */
|
|
34
|
+
ReleaseOutside(first: number, last: number): void;
|
|
35
|
+
/** Releases every realized index not in `keep` (non-contiguous sets, e.g. a looped carousel). */
|
|
36
|
+
ReleaseExcept(keep: ReadonlySet<number>): void;
|
|
37
|
+
/** Disposes every realized and pooled view (the layout is being disposed). */
|
|
38
|
+
DisposeAll(): void;
|
|
39
|
+
/** Views currently bound, in index order (gesture listeners / drawing). */
|
|
40
|
+
GetViewsInUse(): SkiaControl[];
|
|
41
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors DrawnUi ViewsAdapter (ChildrenFactory): creates template instances for item indexes and,
|
|
3
|
+
* with RecyclingTemplate.Enabled, keeps a pool so a view leaving the visible range is rebound to the
|
|
4
|
+
* next index that needs one instead of being created again.
|
|
5
|
+
*/
|
|
6
|
+
export class ViewsAdapter {
|
|
7
|
+
parent;
|
|
8
|
+
inUse = new Map();
|
|
9
|
+
pool = [];
|
|
10
|
+
template;
|
|
11
|
+
items = [];
|
|
12
|
+
recycling = "Enabled";
|
|
13
|
+
/** Views created so far (diagnostics). */
|
|
14
|
+
Created = 0;
|
|
15
|
+
constructor(parent) {
|
|
16
|
+
this.parent = parent;
|
|
17
|
+
}
|
|
18
|
+
get PoolSize() { return this.pool.length; }
|
|
19
|
+
get InUseCount() { return this.inUse.size; }
|
|
20
|
+
/** New template / items / mode: every realized view is dropped (DrawnUi ApplyItemsSource). */
|
|
21
|
+
Initialize(template, items, recycling) {
|
|
22
|
+
this.template = template;
|
|
23
|
+
this.items = items;
|
|
24
|
+
this.recycling = recycling;
|
|
25
|
+
for (const v of this.inUse.values())
|
|
26
|
+
v.Parent = undefined;
|
|
27
|
+
this.inUse.clear();
|
|
28
|
+
this.pool.length = 0;
|
|
29
|
+
}
|
|
30
|
+
/** Items array changed but the template did not: keep views, they get rebound on next use. */
|
|
31
|
+
UpdateItems(items) {
|
|
32
|
+
this.items = items;
|
|
33
|
+
for (const [index, view] of this.inUse) {
|
|
34
|
+
if (index >= items.length) {
|
|
35
|
+
this.ReleaseViewAt(index);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (view.BindingContext !== items[index])
|
|
39
|
+
view.BindingContext = items[index];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
GetExistingViewAtIndex(index) { return this.inUse.get(index); }
|
|
43
|
+
/** Items were inserted at the head: realized views keep their item, only their index moves (no rebind). */
|
|
44
|
+
ShiftIndices(by, items) {
|
|
45
|
+
this.items = items;
|
|
46
|
+
const moved = new Map();
|
|
47
|
+
for (const [index, view] of this.inUse)
|
|
48
|
+
moved.set(index + by, view);
|
|
49
|
+
this.inUse.clear();
|
|
50
|
+
for (const [index, view] of moved)
|
|
51
|
+
this.inUse.set(index, view);
|
|
52
|
+
}
|
|
53
|
+
/** The realized view for an index, if any (no creation). */
|
|
54
|
+
GetViewForIndex(index) { return this.inUse.get(index); }
|
|
55
|
+
/** View bound to items[index]: existing, recycled from the pool, or freshly created. */
|
|
56
|
+
GetOrCreateViewForIndex(index) {
|
|
57
|
+
const existing = this.inUse.get(index);
|
|
58
|
+
if (existing)
|
|
59
|
+
return existing;
|
|
60
|
+
if (!this.template || index < 0 || index >= this.items.length)
|
|
61
|
+
return undefined;
|
|
62
|
+
let view = this.recycling === "Enabled" ? this.pool.pop() : undefined;
|
|
63
|
+
if (!view) {
|
|
64
|
+
view = this.template();
|
|
65
|
+
this.Created++;
|
|
66
|
+
}
|
|
67
|
+
view.Parent = this.parent;
|
|
68
|
+
view.ContextIndex = index;
|
|
69
|
+
view.BindingContext = this.items[index];
|
|
70
|
+
this.inUse.set(index, view);
|
|
71
|
+
return view;
|
|
72
|
+
}
|
|
73
|
+
/** Index left the visible range: recycled views go back to the pool, non-recycled ones stay realized. */
|
|
74
|
+
ReleaseViewAt(index) {
|
|
75
|
+
const view = this.inUse.get(index);
|
|
76
|
+
if (!view)
|
|
77
|
+
return;
|
|
78
|
+
if (this.recycling !== "Enabled")
|
|
79
|
+
return; // Disabled = one view per item, kept alive
|
|
80
|
+
this.inUse.delete(index);
|
|
81
|
+
view.Parent = undefined; // detached until rebound: keeps pooled cells out of gestures and the accessibility tree
|
|
82
|
+
this.pool.push(view);
|
|
83
|
+
}
|
|
84
|
+
/** Releases every realized index outside [first, last]. */
|
|
85
|
+
ReleaseOutside(first, last) {
|
|
86
|
+
if (this.recycling !== "Enabled")
|
|
87
|
+
return;
|
|
88
|
+
for (const index of [...this.inUse.keys()])
|
|
89
|
+
if (index < first || index > last)
|
|
90
|
+
this.ReleaseViewAt(index);
|
|
91
|
+
}
|
|
92
|
+
/** Releases every realized index not in `keep` (non-contiguous sets, e.g. a looped carousel). */
|
|
93
|
+
ReleaseExcept(keep) {
|
|
94
|
+
if (this.recycling !== "Enabled")
|
|
95
|
+
return;
|
|
96
|
+
for (const index of [...this.inUse.keys()])
|
|
97
|
+
if (!keep.has(index))
|
|
98
|
+
this.ReleaseViewAt(index);
|
|
99
|
+
}
|
|
100
|
+
/** Disposes every realized and pooled view (the layout is being disposed). */
|
|
101
|
+
DisposeAll() {
|
|
102
|
+
for (const v of this.inUse.values())
|
|
103
|
+
v.Dispose();
|
|
104
|
+
for (const v of this.pool)
|
|
105
|
+
v.Dispose();
|
|
106
|
+
this.inUse.clear();
|
|
107
|
+
this.pool.length = 0;
|
|
108
|
+
}
|
|
109
|
+
/** Views currently bound, in index order (gesture listeners / drawing). */
|
|
110
|
+
GetViewsInUse() {
|
|
111
|
+
return [...this.inUse.entries()].sort((a, b) => a[0] - b[0]).map((e) => e[1]);
|
|
112
|
+
}
|
|
113
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from "./core/Types";
|
|
2
|
+
export * from "./core/Gestures";
|
|
3
|
+
export * from "./core/Easing";
|
|
4
|
+
export * from "./core/Animators";
|
|
5
|
+
export * from "./core/ScrollAnimators";
|
|
6
|
+
export * from "./core/Super";
|
|
7
|
+
export * from "./core/SkiaControl";
|
|
8
|
+
export * from "./core/Canvas";
|
|
9
|
+
export * from "./controls/SkiaLayout";
|
|
10
|
+
export * from "./core/Accessibility";
|
|
11
|
+
export * from "./controls/SkiaLabel";
|
|
12
|
+
export * from "./controls/TextSpan";
|
|
13
|
+
export * from "./controls/SkiaRichLabel";
|
|
14
|
+
export * from "./core/ControlStyle";
|
|
15
|
+
export * from "./core/ImageEffects";
|
|
16
|
+
export * from "./controls/SkiaToggle";
|
|
17
|
+
export * from "./controls/SkiaSwitch";
|
|
18
|
+
export * from "./controls/SkiaCheckbox";
|
|
19
|
+
export * from "./controls/SkiaRadioButton";
|
|
20
|
+
export * from "./controls/SkiaProgress";
|
|
21
|
+
export * from "./controls/SkiaSlider";
|
|
22
|
+
export * from "./controls/SnappingLayout";
|
|
23
|
+
export * from "./controls/SkiaCarousel";
|
|
24
|
+
export * from "./controls/SkiaShaderCarousel";
|
|
25
|
+
export * from "./controls/SkiaImageTiles";
|
|
26
|
+
export * from "./controls/SkiaDecoratedGrid";
|
|
27
|
+
export * from "./controls/SkiaScrollBar";
|
|
28
|
+
export * from "./controls/RefreshIndicator";
|
|
29
|
+
export * from "./core/TextInputProxy";
|
|
30
|
+
export * from "./core/SkiaEffect";
|
|
31
|
+
export * from "./controls/SkiaDrawer";
|
|
32
|
+
export * from "./controls/SkiaHotspot";
|
|
33
|
+
export * from "./controls/SkiaShape";
|
|
34
|
+
export * from "./controls/SkiaButton";
|
|
35
|
+
export * from "./core/SkiaImageManager";
|
|
36
|
+
export * from "./controls/SkiaImage";
|
|
37
|
+
export * from "./controls/SkiaSvg";
|
|
38
|
+
export * from "./controls/SkiaBackdrop";
|
|
39
|
+
export * from "./controls/SkiaEditor";
|
|
40
|
+
export * from "./controls/SkiaSprite";
|
|
41
|
+
export * from "./controls/SkiaSpriteSet";
|
|
42
|
+
export * from "./core/KeyboardManager";
|
|
43
|
+
export * from "./controls/AnimatedFramesRenderer";
|
|
44
|
+
export * from "./controls/SkiaLottie";
|
|
45
|
+
export * from "./controls/SkiaGif";
|
|
46
|
+
export * from "./controls/SkiaScroll";
|
|
47
|
+
export * from "./controls/SkiaDynamicDrawnCell";
|
|
48
|
+
export * from "./core/ViewsAdapter";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from "./core/Types";
|
|
2
|
+
export * from "./core/Gestures";
|
|
3
|
+
export * from "./core/Easing";
|
|
4
|
+
export * from "./core/Animators";
|
|
5
|
+
export * from "./core/ScrollAnimators";
|
|
6
|
+
export * from "./core/Super";
|
|
7
|
+
export * from "./core/SkiaControl";
|
|
8
|
+
export * from "./core/Canvas";
|
|
9
|
+
export * from "./controls/SkiaLayout";
|
|
10
|
+
export * from "./core/Accessibility";
|
|
11
|
+
export * from "./controls/SkiaLabel";
|
|
12
|
+
export * from "./controls/TextSpan";
|
|
13
|
+
export * from "./controls/SkiaRichLabel";
|
|
14
|
+
export * from "./core/ControlStyle";
|
|
15
|
+
export * from "./core/ImageEffects";
|
|
16
|
+
export * from "./controls/SkiaToggle";
|
|
17
|
+
export * from "./controls/SkiaSwitch";
|
|
18
|
+
export * from "./controls/SkiaCheckbox";
|
|
19
|
+
export * from "./controls/SkiaRadioButton";
|
|
20
|
+
export * from "./controls/SkiaProgress";
|
|
21
|
+
export * from "./controls/SkiaSlider";
|
|
22
|
+
export * from "./controls/SnappingLayout";
|
|
23
|
+
export * from "./controls/SkiaCarousel";
|
|
24
|
+
export * from "./controls/SkiaShaderCarousel";
|
|
25
|
+
export * from "./controls/SkiaImageTiles";
|
|
26
|
+
export * from "./controls/SkiaDecoratedGrid";
|
|
27
|
+
export * from "./controls/SkiaScrollBar";
|
|
28
|
+
export * from "./controls/RefreshIndicator";
|
|
29
|
+
export * from "./core/TextInputProxy";
|
|
30
|
+
export * from "./core/SkiaEffect";
|
|
31
|
+
export * from "./controls/SkiaDrawer";
|
|
32
|
+
export * from "./controls/SkiaHotspot";
|
|
33
|
+
export * from "./controls/SkiaShape";
|
|
34
|
+
export * from "./controls/SkiaButton";
|
|
35
|
+
export * from "./core/SkiaImageManager";
|
|
36
|
+
export * from "./controls/SkiaImage";
|
|
37
|
+
export * from "./controls/SkiaSvg";
|
|
38
|
+
export * from "./controls/SkiaBackdrop";
|
|
39
|
+
export * from "./controls/SkiaEditor";
|
|
40
|
+
export * from "./controls/SkiaSprite";
|
|
41
|
+
export * from "./controls/SkiaSpriteSet";
|
|
42
|
+
export * from "./core/KeyboardManager";
|
|
43
|
+
export * from "./controls/AnimatedFramesRenderer";
|
|
44
|
+
export * from "./controls/SkiaLottie";
|
|
45
|
+
export * from "./controls/SkiaGif";
|
|
46
|
+
export * from "./controls/SkiaScroll";
|
|
47
|
+
export * from "./controls/SkiaDynamicDrawnCell";
|
|
48
|
+
export * from "./core/ViewsAdapter";
|