drawnui-react 0.1.0-preview.8 → 1.0.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.
Files changed (117) hide show
  1. package/README.md +229 -22
  2. package/SKIPPED.md +38 -29
  3. package/dist/controls/AnimatedFramesRenderer.d.ts +9 -0
  4. package/dist/controls/AnimatedFramesRenderer.js +18 -1
  5. package/dist/controls/DrawnGame.d.ts +44 -0
  6. package/dist/controls/DrawnGame.js +82 -0
  7. package/dist/controls/GridStructure.d.ts +25 -3
  8. package/dist/controls/GridStructure.js +81 -5
  9. package/dist/controls/SkiaBackdrop.d.ts +8 -2
  10. package/dist/controls/SkiaBackdrop.js +42 -14
  11. package/dist/controls/SkiaButton.d.ts +17 -3
  12. package/dist/controls/SkiaButton.js +26 -8
  13. package/dist/controls/SkiaCarousel.d.ts +22 -3
  14. package/dist/controls/SkiaCarousel.js +85 -9
  15. package/dist/controls/SkiaCheckbox.d.ts +0 -1
  16. package/dist/controls/SkiaCheckbox.js +2 -7
  17. package/dist/controls/SkiaDrawer.d.ts +15 -0
  18. package/dist/controls/SkiaDrawer.js +42 -7
  19. package/dist/controls/SkiaEditor.d.ts +51 -2
  20. package/dist/controls/SkiaEditor.js +292 -58
  21. package/dist/controls/SkiaGif.d.ts +7 -0
  22. package/dist/controls/SkiaGif.js +25 -4
  23. package/dist/controls/SkiaImage.d.ts +10 -0
  24. package/dist/controls/SkiaImage.js +80 -19
  25. package/dist/controls/SkiaLabel.d.ts +200 -11
  26. package/dist/controls/SkiaLabel.js +925 -93
  27. package/dist/controls/SkiaLabelFps.d.ts +12 -0
  28. package/dist/controls/SkiaLabelFps.js +35 -0
  29. package/dist/controls/SkiaLayout.d.ts +89 -9
  30. package/dist/controls/SkiaLayout.js +397 -23
  31. package/dist/controls/SkiaLottie.js +5 -3
  32. package/dist/controls/SkiaProgress.d.ts +2 -1
  33. package/dist/controls/SkiaProgress.js +8 -5
  34. package/dist/controls/SkiaRadioButton.d.ts +2 -0
  35. package/dist/controls/SkiaRadioButton.js +16 -4
  36. package/dist/controls/SkiaRichLabel.d.ts +1 -1
  37. package/dist/controls/SkiaRichLabel.js +11 -1
  38. package/dist/controls/SkiaScroll.d.ts +86 -7
  39. package/dist/controls/SkiaScroll.js +361 -40
  40. package/dist/controls/SkiaScrollBar.d.ts +27 -0
  41. package/dist/controls/SkiaScrollBar.js +51 -2
  42. package/dist/controls/SkiaShaderCarousel.d.ts +11 -1
  43. package/dist/controls/SkiaShaderCarousel.js +27 -5
  44. package/dist/controls/SkiaShape.d.ts +15 -2
  45. package/dist/controls/SkiaShape.js +57 -10
  46. package/dist/controls/SkiaShell.d.ts +282 -0
  47. package/dist/controls/SkiaShell.js +972 -0
  48. package/dist/controls/SkiaSlider.d.ts +20 -2
  49. package/dist/controls/SkiaSlider.js +61 -7
  50. package/dist/controls/SkiaSprite.d.ts +4 -0
  51. package/dist/controls/SkiaSprite.js +27 -11
  52. package/dist/controls/SkiaSvg.d.ts +4 -0
  53. package/dist/controls/SkiaSvg.js +28 -4
  54. package/dist/controls/SkiaSwitch.d.ts +0 -1
  55. package/dist/controls/SkiaSwitch.js +4 -8
  56. package/dist/controls/SkiaToggle.d.ts +25 -5
  57. package/dist/controls/SkiaToggle.js +58 -5
  58. package/dist/controls/SnappingLayout.d.ts +12 -1
  59. package/dist/controls/SnappingLayout.js +21 -2
  60. package/dist/controls/TooltipStyle.d.ts +52 -0
  61. package/dist/controls/TooltipStyle.js +88 -0
  62. package/dist/core/Accessibility.d.ts +162 -11
  63. package/dist/core/Accessibility.js +882 -22
  64. package/dist/core/Animators.d.ts +37 -1
  65. package/dist/core/Animators.js +102 -9
  66. package/dist/core/Canvas.d.ts +307 -8
  67. package/dist/core/Canvas.js +1202 -66
  68. package/dist/core/ControlStyle.d.ts +2 -0
  69. package/dist/core/ControlStyle.js +2 -0
  70. package/dist/core/DesignerActions.d.ts +32 -0
  71. package/dist/core/DesignerActions.js +68 -0
  72. package/dist/core/Easing.d.ts +12 -1
  73. package/dist/core/Easing.js +25 -1
  74. package/dist/core/Gestures.d.ts +86 -2
  75. package/dist/core/Gestures.js +184 -4
  76. package/dist/core/Hover.d.ts +51 -0
  77. package/dist/core/Hover.js +140 -0
  78. package/dist/core/ImageEffects.d.ts +2 -0
  79. package/dist/core/ImageEffects.js +2 -0
  80. package/dist/core/KeyboardManager.d.ts +40 -0
  81. package/dist/core/KeyboardManager.js +98 -8
  82. package/dist/core/PopupWindows.d.ts +94 -0
  83. package/dist/core/PopupWindows.js +207 -0
  84. package/dist/core/Props.d.ts +11 -0
  85. package/dist/core/Props.js +44 -0
  86. package/dist/core/ScrollAnimators.d.ts +6 -0
  87. package/dist/core/ScrollAnimators.js +16 -1
  88. package/dist/core/Shaping.d.ts +40 -0
  89. package/dist/core/Shaping.js +224 -0
  90. package/dist/core/SkiaControl.d.ts +306 -13
  91. package/dist/core/SkiaControl.js +681 -75
  92. package/dist/core/SkiaEffect.d.ts +29 -1
  93. package/dist/core/SkiaEffect.js +78 -16
  94. package/dist/core/SkiaImageManager.d.ts +101 -18
  95. package/dist/core/SkiaImageManager.js +318 -63
  96. package/dist/core/Styles.js +7 -1
  97. package/dist/core/Super.d.ts +33 -2
  98. package/dist/core/Super.js +58 -12
  99. package/dist/core/TextInputProxy.d.ts +31 -1
  100. package/dist/core/TextInputProxy.js +97 -15
  101. package/dist/core/Tooltips.d.ts +71 -0
  102. package/dist/core/Tooltips.js +205 -0
  103. package/dist/core/Types.d.ts +11 -1
  104. package/dist/core/Types.js +32 -1
  105. package/dist/core/ViewsAdapter.d.ts +7 -2
  106. package/dist/core/ViewsAdapter.js +10 -3
  107. package/dist/index.d.ts +8 -0
  108. package/dist/index.js +8 -0
  109. package/dist/react/SkiaShell.d.ts +8 -74
  110. package/dist/react/SkiaShell.js +163 -475
  111. package/dist/react/index.d.ts +48 -4
  112. package/dist/react/index.js +210 -43
  113. package/dist/react/reconciler.d.ts +32 -0
  114. package/dist/react/reconciler.js +71 -40
  115. package/dist/vite/index.d.ts +9 -0
  116. package/dist/vite/index.js +36 -3
  117. package/package.json +103 -5
@@ -0,0 +1,12 @@
1
+ import type { DrawingContext } from "../core/SkiaControl";
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. It shows the value on every frame it draws and asks for the next one, so while it is on
6
+ * screen the canvas keeps drawing and the number is the frame rate the canvas reaches (as DrawnUi.Net and Rust). Not
7
+ * ported: ForceRefresh, Format, MonoForDigits.
8
+ */
9
+ export declare class SkiaLabelFps extends SkiaLabel {
10
+ constructor();
11
+ Render(ctx: DrawingContext): void;
12
+ }
@@ -0,0 +1,35 @@
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. It shows the value on every frame it draws and asks for the next one, so while it is on
6
+ * screen the canvas keeps drawing and the number is the frame rate the canvas reaches (as DrawnUi.Net and Rust). Not
7
+ * ported: ForceRefresh, Format, MonoForDigits.
8
+ */
9
+ export class SkiaLabelFps extends SkiaLabel {
10
+ constructor() {
11
+ super();
12
+ this.IsParentIndependent = true;
13
+ this.AccessibilityRole = Aria.RolePresentation;
14
+ this.Tag = "FPS";
15
+ this.Text = "FPS --";
16
+ this.MaxLines = 1;
17
+ this.BackgroundColor = "#000000";
18
+ this.TextColor = "#32CD32"; // LimeGreen
19
+ this.InputTransparent = true;
20
+ this.ZIndex = Number.MAX_SAFE_INTEGER;
21
+ }
22
+ Render(ctx) {
23
+ const view = this.Superview;
24
+ // as SkiaControl.Render: a hidden or transparent label draws nothing and asks for nothing
25
+ if (view && this.IsVisible && this.Opacity > 0 && !this.IsDisposed) {
26
+ const shown = `FPS ${view.FPS.toFixed(1).padStart(4, "0")}`;
27
+ if (shown !== this.Text)
28
+ this.Text = shown;
29
+ // the next frame (C#'s ever-changing value asks for it the same way): the counter shows what the canvas reaches
30
+ view.Update();
31
+ }
32
+ // parent-independent: it measures itself again in its slot as it draws (SkiaControl.Render)
33
+ super.Render(ctx);
34
+ }
35
+ }
@@ -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) 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.
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
- Padding: Thickness;
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
- RecyclingTemplate: RecyclingTemplate;
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;
@@ -84,9 +93,16 @@ export declare class SkiaLayout extends SkiaControl {
84
93
  get ItemTemplate(): (() => SkiaControl) | undefined;
85
94
  set ItemTemplate(value: (() => SkiaControl) | undefined);
86
95
  get IsTemplated(): boolean;
87
- /** The virtualized list case: a templated single-column Column. Templated Row / Wrap / Grid realize every item. */
96
+ /** The virtualized list case: a templated single-column Column. */
88
97
  private get IsTemplatedList();
89
- /** 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). */
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
+ */
90
106
  private LayoutViews;
91
107
  /** Drops realized cells and rebuilds the structure (DrawnUi ApplyItemsSource). */
92
108
  ApplyItemsSource(): void;
@@ -99,7 +115,24 @@ export declare class SkiaLayout extends SkiaControl {
99
115
  get Views(): readonly SkiaControl[];
100
116
  /** Settable children list like DrawnUi Children (ignored while templated). */
101
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
+ */
102
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
+ /** A child showing text (a caption inside a button) is text of its own: the accessibility label then makes no tooltip. */
133
+ ShowsText(): boolean;
134
+ /** C# ClearChildren: removes every subview, the control's own parts included. */
135
+ ClearChildren(): void;
103
136
  private orderedViews?;
104
137
  /** Static children sorted by ZIndex (stable), computed once per change (C# GetOrderedSubviews). */
105
138
  protected GetOrderedSubviews(): readonly SkiaControl[];
@@ -120,6 +153,30 @@ export declare class SkiaLayout extends SkiaControl {
120
153
  * Split items; `DynamicColumns` lets a short last row spread over the width.
121
154
  */
122
155
  private MeasureWrap;
156
+ private get IsMasonry();
157
+ /**
158
+ * C# MeasureMasonry / BuildMasonryLayout: Split columns of equal width, every item measured unbounded at the column
159
+ * width and put at the bottom of the shortest column (the first on a tie), so items of different heights leave no
160
+ * gaps; Spacing between columns and between items. Every item is laid out (no items window). A templated slot keeps
161
+ * the size of its item, so an appended page or an item that asked to be measured again (an image arrived) is the only
162
+ * one measured, and every item is placed again from the sizes known.
163
+ */
164
+ private MeasureMasonry;
165
+ /**
166
+ * Where item `index` of a recycled templated Row / Wrap / Grid / split Column / Masonry was arranged (pixels), from
167
+ * its slot, also while no view shows it (ScrollToIndex to an item off screen); undefined otherwise.
168
+ */
169
+ GetItemRect(index: number): SKRect | undefined;
170
+ /**
171
+ * Masonry: every placed item with its rect (pixels), in item order: what keyboard navigation follows, since the
172
+ * columns have uneven heights and the item `Split` places later is rarely under the focused one.
173
+ */
174
+ GetMasonryPlacement(): {
175
+ Index: number;
176
+ Rect: SKRect;
177
+ }[];
178
+ /** Masonry: where the slot of item `index` was arranged (pixels); see GetItemRect. */
179
+ GetMasonryItemRect(index: number): SKRect | undefined;
123
180
  /** Port of C# MeasureGrid: build the structure in points, stretch the last track when the grid fills, remeasure at final cells. */
124
181
  private MeasureGrid;
125
182
  /** Templated Column: content = padding + sum of item heights + gaps; width = the constraint (cells fill). */
@@ -137,12 +194,31 @@ export declare class SkiaLayout extends SkiaControl {
137
194
  private MvScheduleBackground;
138
195
  /** Binds a cell to items[index] (through the adapter, so MeasureFirst's cell 0 stays realized) and measures it. */
139
196
  private MeasureItem;
197
+ /**
198
+ * The item's offset and height are real, not estimated (C# LastMeasuredIndexLocal >= index): MeasureVisible knows
199
+ * them once the measured prefix passed the item; the other strategies always do.
200
+ */
201
+ IsItemMeasured(index: number): boolean;
140
202
  /** Pixel offset of item index from the top of the layout content (inside padding). */
141
203
  GetItemOffsetPixels(index: number): number;
142
204
  private ItemHeightPixels;
143
205
  protected OnLayoutChanged(): void;
206
+ /** Static children and realized views are arranged; the slots of a recycled layout record where their item goes. */
207
+ private ArrangeChildren;
144
208
  protected Paint(ctx: DrawingContext): void;
145
209
  protected GetCompositeChildren(): readonly SkiaControl[];
210
+ private readonly drawnSlots;
211
+ /**
212
+ * Recycled templated layout (C# DrawStack): a view from the pool is bound to each slot that can be seen and drawn
213
+ * there; the views of the other slots go back to the pool.
214
+ */
215
+ private PaintSlots;
216
+ /**
217
+ * Where slots are drawn (C# GetOnScreenVisibleArea): what can be seen, inflated by VirtualisationInflated. Under a
218
+ * cache (this layout's or an ancestor's, below the nearest scroll) every slot, because the cache is blitted later at
219
+ * other offsets.
220
+ */
221
+ private SlotsArea;
146
222
  /** Realizes, binds, arranges and draws only the cells intersecting the visible viewport (+ inflation). */
147
223
  private PaintTemplated;
148
224
  /**
@@ -167,6 +243,10 @@ export declare class SkiaLayer extends SkiaLayout {
167
243
  export declare class SkiaGrid extends SkiaLayout {
168
244
  constructor();
169
245
  }
246
+ /** SkiaLayout Type=Masonry + Split 2 + HorizontalOptions=Fill (DrawnUi alias): columns, each item to the shortest one. */
247
+ export declare class SkiaMasonry extends SkiaLayout {
248
+ constructor();
249
+ }
170
250
  /** SkiaLayout Type=Wrap + HorizontalOptions=Fill (DrawnUi alias): responsive flow of fixed-size children. */
171
251
  export declare class SkiaWrap extends SkiaLayout {
172
252
  constructor();