drawnui-react 0.1.0-preview.4 → 0.1.0-preview.41
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 +129 -14
- package/SKIPPED.md +36 -26
- package/dist/controls/AnimatedFramesRenderer.d.ts +9 -0
- package/dist/controls/AnimatedFramesRenderer.js +18 -1
- package/dist/controls/DrawnGame.d.ts +44 -0
- package/dist/controls/DrawnGame.js +82 -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 +17 -3
- package/dist/controls/SkiaButton.js +26 -8
- package/dist/controls/SkiaCarousel.d.ts +22 -3
- package/dist/controls/SkiaCarousel.js +85 -9
- package/dist/controls/SkiaCheckbox.d.ts +0 -1
- package/dist/controls/SkiaCheckbox.js +2 -7
- package/dist/controls/SkiaDrawer.d.ts +15 -0
- package/dist/controls/SkiaDrawer.js +42 -7
- package/dist/controls/SkiaEditor.d.ts +48 -2
- package/dist/controls/SkiaEditor.js +268 -53
- package/dist/controls/SkiaGif.d.ts +7 -0
- package/dist/controls/SkiaGif.js +25 -4
- package/dist/controls/SkiaImage.d.ts +5 -0
- package/dist/controls/SkiaImage.js +48 -14
- package/dist/controls/SkiaLabel.d.ts +117 -9
- package/dist/controls/SkiaLabel.js +526 -80
- package/dist/controls/SkiaLabelFps.d.ts +16 -0
- package/dist/controls/SkiaLabelFps.js +41 -0
- package/dist/controls/SkiaLayout.d.ts +89 -9
- package/dist/controls/SkiaLayout.js +364 -21
- package/dist/controls/SkiaLottie.js +5 -3
- package/dist/controls/SkiaProgress.d.ts +2 -1
- package/dist/controls/SkiaProgress.js +8 -5
- package/dist/controls/SkiaRadioButton.d.ts +2 -0
- package/dist/controls/SkiaRadioButton.js +16 -4
- 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 +252 -32
- package/dist/controls/SkiaScrollBar.d.ts +27 -0
- package/dist/controls/SkiaScrollBar.js +51 -2
- package/dist/controls/SkiaShaderCarousel.d.ts +11 -1
- package/dist/controls/SkiaShaderCarousel.js +27 -5
- 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 +61 -7
- package/dist/controls/SkiaSprite.d.ts +4 -0
- package/dist/controls/SkiaSprite.js +22 -10
- package/dist/controls/SkiaSvg.d.ts +4 -0
- package/dist/controls/SkiaSvg.js +28 -4
- package/dist/controls/SkiaSwitch.d.ts +0 -1
- package/dist/controls/SkiaSwitch.js +4 -8
- 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 +21 -2
- package/dist/controls/TooltipStyle.d.ts +52 -0
- package/dist/controls/TooltipStyle.js +88 -0
- package/dist/core/Accessibility.d.ts +134 -0
- package/dist/core/Accessibility.js +675 -9
- package/dist/core/Animators.d.ts +37 -1
- package/dist/core/Animators.js +102 -9
- package/dist/core/Canvas.d.ts +241 -10
- package/dist/core/Canvas.js +739 -44
- package/dist/core/ControlStyle.d.ts +2 -0
- package/dist/core/ControlStyle.js +2 -0
- package/dist/core/DesignerActions.d.ts +32 -0
- package/dist/core/DesignerActions.js +68 -0
- package/dist/core/Easing.d.ts +12 -1
- package/dist/core/Easing.js +25 -1
- package/dist/core/Gestures.d.ts +81 -2
- package/dist/core/Gestures.js +177 -3
- package/dist/core/Hover.d.ts +51 -0
- package/dist/core/Hover.js +140 -0
- package/dist/core/ImageEffects.d.ts +2 -0
- package/dist/core/ImageEffects.js +2 -0
- package/dist/core/KeyboardManager.d.ts +40 -0
- package/dist/core/KeyboardManager.js +98 -8
- package/dist/core/PopupWindows.d.ts +94 -0
- package/dist/core/PopupWindows.js +205 -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 +284 -11
- package/dist/core/SkiaControl.js +630 -66
- 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 +29 -2
- package/dist/core/Super.js +54 -3
- package/dist/core/Tooltips.d.ts +71 -0
- package/dist/core/Tooltips.js +205 -0
- 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 +7 -0
- package/dist/index.js +7 -0
- package/dist/react/SkiaShell.js +65 -26
- package/dist/react/index.d.ts +51 -4
- package/dist/react/index.js +180 -18
- package/dist/react/reconciler.d.ts +20 -0
- package/dist/react/reconciler.js +69 -14
- package/dist/vite/index.d.ts +9 -0
- package/dist/vite/index.js +36 -3
- package/package.json +66 -2
package/dist/core/Types.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
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
2
|
export class Thickness {
|
|
4
3
|
Left;
|
|
5
4
|
Top;
|
|
@@ -21,6 +20,38 @@ export class Thickness {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
static Zero = new Thickness();
|
|
23
|
+
static warned;
|
|
24
|
+
/**
|
|
25
|
+
* What a Thickness-typed property (Margin, Padding) is given, as a Thickness: a number is the same on every side
|
|
26
|
+
* (C# XAML `Padding="12"`), the C# string forms "12", "12,6" (horizontal, vertical) and "1,2,3,4" (left, top, right,
|
|
27
|
+
* bottom) are read the same way. Anything else is Zero with a one-time console warning: never NaN, which would
|
|
28
|
+
* blank the control.
|
|
29
|
+
*/
|
|
30
|
+
static From(value) {
|
|
31
|
+
if (value instanceof Thickness)
|
|
32
|
+
return value;
|
|
33
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
34
|
+
return new Thickness(value);
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
const n = value.split(",").map((s) => Number(s.trim()));
|
|
37
|
+
if (n.every((x) => Number.isFinite(x))) {
|
|
38
|
+
if (n.length === 1)
|
|
39
|
+
return new Thickness(n[0]);
|
|
40
|
+
if (n.length === 2)
|
|
41
|
+
return new Thickness(n[0], n[1]);
|
|
42
|
+
if (n.length === 4)
|
|
43
|
+
return new Thickness(n[0], n[1], n[2], n[3]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (value == null)
|
|
47
|
+
return Thickness.Zero;
|
|
48
|
+
const key = String(value);
|
|
49
|
+
if (!(Thickness.warned ??= new Set()).has(key)) {
|
|
50
|
+
Thickness.warned.add(key);
|
|
51
|
+
console.warn(`[DrawnUi] ${key} is not a thickness (a Thickness, a number, or "h,v" / "l,t,r,b"): 0 is used.`);
|
|
52
|
+
}
|
|
53
|
+
return Thickness.Zero;
|
|
54
|
+
}
|
|
24
55
|
get HorizontalThickness() { return this.Left + this.Right; }
|
|
25
56
|
get VerticalThickness() { return this.Top + this.Bottom; }
|
|
26
57
|
}
|
|
@@ -16,6 +16,8 @@ export declare class ViewsAdapter {
|
|
|
16
16
|
Created: number;
|
|
17
17
|
constructor(parent: SkiaControl);
|
|
18
18
|
get PoolSize(): number;
|
|
19
|
+
/** The items views are bound to. */
|
|
20
|
+
get Items(): readonly unknown[];
|
|
19
21
|
get InUseCount(): number;
|
|
20
22
|
/** New template / items / mode: every realized view is dropped (DrawnUi ApplyItemsSource). */
|
|
21
23
|
Initialize(template: (() => SkiaControl) | undefined, items: readonly unknown[], recycling: RecyclingTemplate): void;
|
|
@@ -26,8 +28,11 @@ export declare class ViewsAdapter {
|
|
|
26
28
|
ShiftIndices(by: number, items: readonly unknown[]): void;
|
|
27
29
|
/** The realized view for an index, if any (no creation). */
|
|
28
30
|
GetViewForIndex(index: number): SkiaControl | undefined;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* View bound to items[index]: existing, recycled from the pool, or freshly created. `quiet`: bound before it is
|
|
33
|
+
* attached, so the rebind invalidates the view alone and not the layout, which measures or draws it right away.
|
|
34
|
+
*/
|
|
35
|
+
GetOrCreateViewForIndex(index: number, quiet?: boolean): SkiaControl | undefined;
|
|
31
36
|
/** Index left the visible range: recycled views go back to the pool, non-recycled ones stay realized. */
|
|
32
37
|
ReleaseViewAt(index: number): void;
|
|
33
38
|
/** Releases every realized index outside [first, last]. */
|
|
@@ -16,6 +16,8 @@ export class ViewsAdapter {
|
|
|
16
16
|
this.parent = parent;
|
|
17
17
|
}
|
|
18
18
|
get PoolSize() { return this.pool.length; }
|
|
19
|
+
/** The items views are bound to. */
|
|
20
|
+
get Items() { return this.items; }
|
|
19
21
|
get InUseCount() { return this.inUse.size; }
|
|
20
22
|
/** New template / items / mode: every realized view is dropped (DrawnUi ApplyItemsSource). */
|
|
21
23
|
Initialize(template, items, recycling) {
|
|
@@ -52,8 +54,11 @@ export class ViewsAdapter {
|
|
|
52
54
|
}
|
|
53
55
|
/** The realized view for an index, if any (no creation). */
|
|
54
56
|
GetViewForIndex(index) { return this.inUse.get(index); }
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
+
/**
|
|
58
|
+
* View bound to items[index]: existing, recycled from the pool, or freshly created. `quiet`: bound before it is
|
|
59
|
+
* attached, so the rebind invalidates the view alone and not the layout, which measures or draws it right away.
|
|
60
|
+
*/
|
|
61
|
+
GetOrCreateViewForIndex(index, quiet = false) {
|
|
57
62
|
const existing = this.inUse.get(index);
|
|
58
63
|
if (existing)
|
|
59
64
|
return existing;
|
|
@@ -64,9 +69,11 @@ export class ViewsAdapter {
|
|
|
64
69
|
view = this.template();
|
|
65
70
|
this.Created++;
|
|
66
71
|
}
|
|
67
|
-
|
|
72
|
+
if (!quiet)
|
|
73
|
+
view.Parent = this.parent;
|
|
68
74
|
view.ContextIndex = index;
|
|
69
75
|
view.BindingContext = this.items[index];
|
|
76
|
+
view.Parent = this.parent;
|
|
70
77
|
this.inUse.set(index, view);
|
|
71
78
|
return view;
|
|
72
79
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,9 +9,14 @@ export * from "./core/SkiaControl";
|
|
|
9
9
|
export * from "./core/Canvas";
|
|
10
10
|
export * from "./controls/SkiaLayout";
|
|
11
11
|
export * from "./core/Accessibility";
|
|
12
|
+
export * from "./core/Hover";
|
|
13
|
+
export * from "./core/Tooltips";
|
|
14
|
+
export * from "./core/PopupWindows";
|
|
12
15
|
export * from "./controls/SkiaLabel";
|
|
13
16
|
export * from "./controls/TextSpan";
|
|
14
17
|
export * from "./controls/SkiaRichLabel";
|
|
18
|
+
export * from "./controls/SkiaLabelFps";
|
|
19
|
+
export * from "./controls/TooltipStyle";
|
|
15
20
|
export * from "./core/ControlStyle";
|
|
16
21
|
export * from "./core/ImageEffects";
|
|
17
22
|
export * from "./controls/SkiaToggle";
|
|
@@ -40,6 +45,7 @@ export * from "./controls/SkiaBackdrop";
|
|
|
40
45
|
export * from "./controls/SkiaEditor";
|
|
41
46
|
export * from "./controls/SkiaSprite";
|
|
42
47
|
export * from "./controls/SkiaSpriteSet";
|
|
48
|
+
export * from "./controls/DrawnGame";
|
|
43
49
|
export * from "./core/KeyboardManager";
|
|
44
50
|
export * from "./controls/AnimatedFramesRenderer";
|
|
45
51
|
export * from "./controls/SkiaLottie";
|
|
@@ -47,3 +53,4 @@ export * from "./controls/SkiaGif";
|
|
|
47
53
|
export * from "./controls/SkiaScroll";
|
|
48
54
|
export * from "./controls/SkiaDynamicDrawnCell";
|
|
49
55
|
export * from "./core/ViewsAdapter";
|
|
56
|
+
export * from "./core/DesignerActions";
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,14 @@ export * from "./core/SkiaControl";
|
|
|
9
9
|
export * from "./core/Canvas";
|
|
10
10
|
export * from "./controls/SkiaLayout";
|
|
11
11
|
export * from "./core/Accessibility";
|
|
12
|
+
export * from "./core/Hover";
|
|
13
|
+
export * from "./core/Tooltips";
|
|
14
|
+
export * from "./core/PopupWindows";
|
|
12
15
|
export * from "./controls/SkiaLabel";
|
|
13
16
|
export * from "./controls/TextSpan";
|
|
14
17
|
export * from "./controls/SkiaRichLabel";
|
|
18
|
+
export * from "./controls/SkiaLabelFps";
|
|
19
|
+
export * from "./controls/TooltipStyle";
|
|
15
20
|
export * from "./core/ControlStyle";
|
|
16
21
|
export * from "./core/ImageEffects";
|
|
17
22
|
export * from "./controls/SkiaToggle";
|
|
@@ -40,6 +45,7 @@ export * from "./controls/SkiaBackdrop";
|
|
|
40
45
|
export * from "./controls/SkiaEditor";
|
|
41
46
|
export * from "./controls/SkiaSprite";
|
|
42
47
|
export * from "./controls/SkiaSpriteSet";
|
|
48
|
+
export * from "./controls/DrawnGame";
|
|
43
49
|
export * from "./core/KeyboardManager";
|
|
44
50
|
export * from "./controls/AnimatedFramesRenderer";
|
|
45
51
|
export * from "./controls/SkiaLottie";
|
|
@@ -47,3 +53,4 @@ export * from "./controls/SkiaGif";
|
|
|
47
53
|
export * from "./controls/SkiaScroll";
|
|
48
54
|
export * from "./controls/SkiaDynamicDrawnCell";
|
|
49
55
|
export * from "./core/ViewsAdapter";
|
|
56
|
+
export * from "./core/DesignerActions";
|
package/dist/react/SkiaShell.js
CHANGED
|
@@ -213,7 +213,10 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
213
213
|
const closeWhenBackgroundTapped = options?.closeWhenBackgroundTapped ?? true;
|
|
214
214
|
const showOverlay = options?.showOverlay ?? true;
|
|
215
215
|
const overlay = options?.backgroundColor ?? ShellDefaults.PopupBackgroundColor;
|
|
216
|
-
entry.node = (
|
|
216
|
+
entry.node = (
|
|
217
|
+
// a dialog for screen readers and the keyboard while open (drawnui-cross 6av, C# 2be842b8): its outside-tap close
|
|
218
|
+
// stays, but the wrapper is no Tab stop; the backdrop is no node
|
|
219
|
+
_jsxs(SkiaLayer, { VerticalOptions: "Fill", HorizontalOptions: "Fill", ZIndex: ShellDefaults.ZIndexPopups + entry.id, BlockGesturesBelow: true, Opacity: animated ? 0.1 : 1, AccessibilityModal: true, AccessibilityCanInteract: false, ref: (c) => { if (c)
|
|
217
220
|
entry.ctrl = c; }, Tapped: (_, e) => {
|
|
218
221
|
// C# PopupWrapper: a tap outside the content closes it
|
|
219
222
|
const c = entry.content;
|
|
@@ -236,12 +239,28 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
236
239
|
await closePopup(p, false); }, [closePopup]);
|
|
237
240
|
// ---- modals ----
|
|
238
241
|
const removeModal = useCallback((m) => setModals((list) => list.filter((x) => x !== m)), []);
|
|
242
|
+
/**
|
|
243
|
+
* A modal leaves the modal stack the moment its close starts, whatever started it (PopModalAsync, a swipe, IsOpen =
|
|
244
|
+
* false): ModalsCount and CanGoBack drop it and Navigated Pop is raised; its drawer takes no more pans. It stays on
|
|
245
|
+
* screen until its slide ends (drawnui-cross 6s, C# SkiaShell.LeaveModalStack).
|
|
246
|
+
*/
|
|
247
|
+
const [, setStackChanged] = useState(0);
|
|
248
|
+
const leaveModalStack = useCallback((m) => {
|
|
249
|
+
if (m.left)
|
|
250
|
+
return;
|
|
251
|
+
m.left = true;
|
|
252
|
+
if (m.drawer)
|
|
253
|
+
m.drawer.RespondsToGestures = false;
|
|
254
|
+
setStackChanged((t) => t + 1);
|
|
255
|
+
navigated(live.current.stack[live.current.stack.length - 1] ?? "", "Pop");
|
|
256
|
+
}, [navigated]);
|
|
239
257
|
const popModalNow = useCallback(async (top, animated) => {
|
|
240
258
|
if (top.closing)
|
|
241
259
|
return false;
|
|
242
260
|
if (!canNavigate(live.current.stack[live.current.stack.length - 1] ?? "", "Pop", top.drawer, top.drawer))
|
|
243
261
|
return false;
|
|
244
262
|
top.closing = true;
|
|
263
|
+
leaveModalStack(top);
|
|
245
264
|
if (top.drawer && top.drawer.IsOpen) {
|
|
246
265
|
top.drawer.Animated = animated;
|
|
247
266
|
const done = new Promise((r) => { const prev = top.drawer.StateTransitionComplete; top.drawer.StateTransitionComplete = (d, o) => { prev?.(d, o); if (!o)
|
|
@@ -251,9 +270,8 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
251
270
|
await AnimateWithTimeout(done);
|
|
252
271
|
}
|
|
253
272
|
removeModal(top);
|
|
254
|
-
navigated(live.current.stack[live.current.stack.length - 1] ?? "", "Pop");
|
|
255
273
|
return true;
|
|
256
|
-
}, [removeModal, canNavigate,
|
|
274
|
+
}, [removeModal, canNavigate, leaveModalStack]);
|
|
257
275
|
const PushModalAsync = useCallback(async (content, options) => {
|
|
258
276
|
const animated = options?.animated ?? true;
|
|
259
277
|
if (!canNavigate(live.current.stack[live.current.stack.length - 1] ?? "", "Push"))
|
|
@@ -270,8 +288,10 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
270
288
|
entry.closing = true;
|
|
271
289
|
removeModal(entry);
|
|
272
290
|
} };
|
|
273
|
-
entry.node = (
|
|
274
|
-
|
|
291
|
+
entry.node = (
|
|
292
|
+
// a dialog for screen readers and the keyboard while open (drawnui-cross 6av, C# 2be842b8)
|
|
293
|
+
_jsxs(SkiaLayer, { VerticalOptions: "Fill", HorizontalOptions: "Fill", ZIndex: ShellDefaults.ZIndexModals + entry.id, BlockGesturesBelow: true, AccessibilityModal: true, children: [overlay && _jsx(SkiaBackdrop, { Blur: ShellDefaults.PopupsBackgroundBlur, BackgroundColor: overlay, InputTransparent: true }), _jsx(SkiaDrawer, { ref: (d) => { if (d)
|
|
294
|
+
entry.drawer = d; }, Direction: "FromBottom", HeaderSize: 0, HorizontalOptions: "Fill", VerticalOptions: "Fill", RespondsToGestures: options?.useGestures ?? false, Animated: animated, Bounces: false, BlockGesturesBelow: true, ClosingStarted: () => leaveModalStack(entry), StateTransitionComplete: (d, isOpen) => { if (isOpen)
|
|
275
295
|
opened();
|
|
276
296
|
else if (!d.IsOpen)
|
|
277
297
|
userClosed(); }, IsOpenChanged: (_, isOpen) => { if (!isOpen && !animated)
|
|
@@ -288,10 +308,9 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
288
308
|
}
|
|
289
309
|
await AnimateWithTimeout(openedPromise);
|
|
290
310
|
navigated(live.current.stack[live.current.stack.length - 1] ?? "", "Push", drawer);
|
|
291
|
-
}, [removeModal, pushHistory, backThroughHistory, canNavigate, navigated]);
|
|
311
|
+
}, [removeModal, pushHistory, backThroughHistory, canNavigate, navigated, leaveModalStack]);
|
|
292
312
|
const PopModalAsync = useCallback(async (animated = true) => {
|
|
293
|
-
const
|
|
294
|
-
const top = list[list.length - 1];
|
|
313
|
+
const top = [...live.current.modals].reverse().find((m) => !m.left); // a modal sliding out has left the stack
|
|
295
314
|
if (!top || top.closing)
|
|
296
315
|
return;
|
|
297
316
|
if (top.history && backThroughHistory("modal")) {
|
|
@@ -340,7 +359,7 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
340
359
|
await closePopup(ps[ps.length - 1], animated);
|
|
341
360
|
return;
|
|
342
361
|
}
|
|
343
|
-
if (ms.
|
|
362
|
+
if (ms.some((m) => !m.left)) {
|
|
344
363
|
await PopModalAsync(animated);
|
|
345
364
|
return;
|
|
346
365
|
}
|
|
@@ -389,6 +408,12 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
389
408
|
prev ? prev.TranslateToAsync(-dir * w, 0, TabsAnimationSpeed, TabsEasing) : Promise.resolve(),
|
|
390
409
|
]), TabsAnimationSpeed + 500);
|
|
391
410
|
}
|
|
411
|
+
// the tab left stays mounted (its state kept): hidden first, then back in place for its next turn
|
|
412
|
+
if (prev) {
|
|
413
|
+
prev.IsVisible = false;
|
|
414
|
+
prev.TranslationX = 0;
|
|
415
|
+
prev.TranslationY = 0;
|
|
416
|
+
}
|
|
392
417
|
setTabTransition(null);
|
|
393
418
|
}, [hasTabs, Tabs, AnimateTabs, TabsAnimationSpeed]);
|
|
394
419
|
// popstate: the browser popped OUR last entry (back) — or moved forward to a hash we can rebuild
|
|
@@ -405,7 +430,13 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
405
430
|
}
|
|
406
431
|
const onPop = () => {
|
|
407
432
|
const depth = window.history.state?.[HISTORY_KEY] ?? 0;
|
|
408
|
-
|
|
433
|
+
const target = parseHash();
|
|
434
|
+
// a Back lands on one of OUR entries: its hash is the stack it was pushed with (the first N pages, N = the page
|
|
435
|
+
// entries below it). A typed hash or a plain <a href="#/route"> makes a new entry with no state (depth 0):
|
|
436
|
+
// that is a navigation to the hash, not a Back to the root
|
|
437
|
+
const pagesBelow = history.current.slice(0, depth).filter((k) => k === "page").length;
|
|
438
|
+
const back = depth < history.current.length && target.join("/") === live.current.stack.slice(0, pagesBelow).join("/");
|
|
439
|
+
if (back) {
|
|
409
440
|
// back: unwind our entries down to depth
|
|
410
441
|
void (async () => {
|
|
411
442
|
while (history.current.length > depth) {
|
|
@@ -441,9 +472,8 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
441
472
|
})();
|
|
442
473
|
}
|
|
443
474
|
else {
|
|
444
|
-
// forward (depth grew), or
|
|
475
|
+
// forward (depth grew), or another hash = a plain <a href="#/route"> link or a typed hash:
|
|
445
476
|
// the hash names the pages, rebuild the stack without animation (overlays cannot be restored)
|
|
446
|
-
const target = parseHash();
|
|
447
477
|
if (depth === history.current.length && target.join("/") === live.current.stack.join("/"))
|
|
448
478
|
return;
|
|
449
479
|
history.current = target.map(() => "page");
|
|
@@ -454,40 +484,49 @@ export const SkiaShell = forwardRef(function SkiaShell({ Routes, children, NavBa
|
|
|
454
484
|
window.addEventListener("popstate", onPop);
|
|
455
485
|
return () => window.removeEventListener("popstate", onPop);
|
|
456
486
|
}, [historyOn, Routes, closePopupNow, popModalNow, popPage]);
|
|
487
|
+
const inStack = modals.filter((m) => !m.left).length; // modals sliding out have left the stack
|
|
457
488
|
const nav = useMemo(() => ({
|
|
458
|
-
GoToAsync, GoBackAsync, PopToRootAsync, NavigationStack: stack, CanGoBack: stack.length > 0 || popups.length > 0 ||
|
|
489
|
+
GoToAsync, GoBackAsync, PopToRootAsync, NavigationStack: stack, CanGoBack: stack.length > 0 || popups.length > 0 || inStack > 0, Route: route, Arguments: { ...SplitRoute(route).args, ...argsInMemory.current.get(route) },
|
|
459
490
|
OpenPopupAsync, ClosePopupAsync, CloseAllPopups, PushModalAsync, PopModalAsync, ShowToast, CloseAllToasts,
|
|
460
|
-
PopupsCount: popups.length, ModalsCount:
|
|
491
|
+
PopupsCount: popups.length, ModalsCount: inStack, ToastsCount: toasts.length,
|
|
461
492
|
SelectedTab: selectedTab, SelectTabAsync, PopTabToRootAsync,
|
|
462
|
-
}), [GoToAsync, GoBackAsync, PopToRootAsync, stack, route, OpenPopupAsync, ClosePopupAsync, CloseAllPopups, PushModalAsync, PopModalAsync, ShowToast, CloseAllToasts, popups.length,
|
|
493
|
+
}), [GoToAsync, GoBackAsync, PopToRootAsync, stack, route, OpenPopupAsync, ClosePopupAsync, CloseAllPopups, PushModalAsync, PopModalAsync, ShowToast, CloseAllToasts, popups.length, inStack, toasts.length, selectedTab, SelectTabAsync, PopTabToRootAsync]);
|
|
463
494
|
useImperativeHandle(ref, () => nav, [nav]);
|
|
464
495
|
const visiblePages = leaving && !stack.includes(leaving) ? [...stack, leaving] : stack;
|
|
465
496
|
const topRoute = visiblePages[visiblePages.length - 1] ?? "";
|
|
466
497
|
const transitioning = transitions > 0 || leaving !== null;
|
|
467
498
|
const rootBottom = hasTabs ? TabBarHeight + insets.Bottom : 0;
|
|
468
499
|
const navTop = NavBarHeight + insets.Top;
|
|
469
|
-
|
|
500
|
+
// every tab keeps its root and its pages mounted (state, scroll positions), only the selected one shows (C# tab
|
|
501
|
+
// views, DrawnUi.Rust "tabs keep their stacks")
|
|
502
|
+
const tabIndexes = hasTabs ? Tabs.map((_, i) => i) : [0];
|
|
470
503
|
const entering = tabTransition ? { TranslationX: tabTransition.dir * 0.75 * (typeof window !== "undefined" ? window.innerWidth : 0), Opacity: 0.001, ZIndex: 1 } : {};
|
|
471
|
-
return (_jsx(ShellContext.Provider, { value: nav, children: _jsxs(SkiaLayer, { VerticalOptions: "Fill", children: [
|
|
472
|
-
|
|
473
|
-
|
|
504
|
+
return (_jsx(ShellContext.Provider, { value: nav, children: _jsxs(SkiaLayer, { VerticalOptions: "Fill", children: [tabIndexes.map((t) => {
|
|
505
|
+
const selected = t === selectedTab;
|
|
506
|
+
return (_jsx(SkiaLayer, { VerticalOptions: "Fill", Margin: new Thickness(0, 0, 0, rootBottom), BackgroundColor: hasTabs ? PageBackgroundColor : undefined, IsVisible: selected ? visiblePages.length === 0 || transitioning : tabTransition?.from === t, ZIndex: 0, ...(selected ? entering : {}), ref: (c) => { if (c)
|
|
507
|
+
tabRoots.current.set(t, c); }, children: hasTabs ? RenderRoute(Tabs[t]?.route ?? "") : children }, hasTabs ? `tab-${t}` : "root"));
|
|
508
|
+
}), tabIndexes.flatMap((t) => (t === selectedTab ? visiblePages : stacks[t] ?? []).map((r, i) => (_jsxs(PageHost, { route: r, speed: PagesAnimationSpeed, active: t === selectedTab, visible: t === selectedTab && (r === topRoute || transitioning), background: PageBackgroundColor, bottom: rootBottom, register: (c) => { if (c)
|
|
474
509
|
pageCtrls.current.set(r, c);
|
|
475
510
|
else
|
|
476
|
-
pageCtrls.current.delete(r); }, children: [_jsx(SkiaLayer, { VerticalOptions: "Fill", Margin: new Thickness(0, navTop, 0, 0), children: RenderRoute(r) }), _jsxs(SkiaLayer, { HeightRequest: navTop, BackgroundColor: NavBarColor, Padding: new Thickness(0, insets.Top, 0, 0), children: [_jsx(SkiaButton, { Text: "\u2039 Back", BackgroundColor: "#00000000", TextColor: "#6EA8FE", FontSize: 16, VerticalOptions: "Center", Margin: new Thickness(8, 0), ApplyEffect: "Ripple", Tapped: () => void GoBackAsync(), AccessibilityRole: "button", AccessibilityLabel: "Back" }), _jsx(SkiaLabel, { Text: Titles?.[RouteName(r)] ?? RouteName(r), FontSize: 18, FontFamily: "FontTextBold", TextColor: Colors.White, HorizontalOptions: "Fill", HorizontalTextAlignment: "Center", VerticalOptions: "Center", MaxLines: 1, Margin: new Thickness(96, 0), AccessibilityRole: "heading" }), _jsx(SkiaButton, { Text: "Home", BackgroundColor: "#00000000", TextColor: "#6EA8FE", FontSize: 16, HorizontalOptions: "End", VerticalOptions: "Center", Margin: new Thickness(0, 0, 8, 0), ApplyEffect: "Ripple", Tapped: () => void PopToRootAsync(), AccessibilityRole: "button", AccessibilityLabel: "Home" }), _jsx(SkiaLayer, { HeightRequest: 1, VerticalOptions: "End", BackgroundColor: "#343A40" })] })] }, `${
|
|
511
|
+
pageCtrls.current.delete(r); }, children: [_jsx(SkiaLayer, { VerticalOptions: "Fill", Margin: new Thickness(0, navTop, 0, 0), children: RenderRoute(r) }), _jsxs(SkiaLayer, { HeightRequest: navTop, BackgroundColor: NavBarColor, Padding: new Thickness(0, insets.Top, 0, 0), children: [_jsx(SkiaButton, { Text: "\u2039 Back", BackgroundColor: "#00000000", TextColor: "#6EA8FE", FontSize: 16, VerticalOptions: "Center", Margin: new Thickness(8, 0), ApplyEffect: "Ripple", Tapped: () => void GoBackAsync(), AccessibilityRole: "button", AccessibilityLabel: "Back" }), _jsx(SkiaLabel, { Text: Titles?.[RouteName(r)] ?? RouteName(r), FontSize: 18, FontFamily: "FontTextBold", TextColor: Colors.White, HorizontalOptions: "Fill", HorizontalTextAlignment: "Center", VerticalOptions: "Center", MaxLines: 1, Margin: new Thickness(96, 0), AccessibilityRole: "heading" }), _jsx(SkiaButton, { Text: "Home", BackgroundColor: "#00000000", TextColor: "#6EA8FE", FontSize: 16, HorizontalOptions: "End", VerticalOptions: "Center", Margin: new Thickness(0, 0, 8, 0), ApplyEffect: "Ripple", Tapped: () => void PopToRootAsync(), AccessibilityRole: "button", AccessibilityLabel: "Home" }), _jsx(SkiaLayer, { HeightRequest: 1, VerticalOptions: "End", BackgroundColor: "#343A40" })] })] }, `${t}:${r}#${i}`)))), hasTabs && (_jsxs(SkiaLayer, { HeightRequest: TabBarHeight + insets.Bottom, VerticalOptions: "End", BackgroundColor: TabBarColor, ZIndex: ShellDefaults.ZIndexModals - 1, BlockGesturesBelow: true, Padding: new Thickness(0, 0, 0, insets.Bottom), children: [_jsx(SkiaLayer, { HeightRequest: 1, BackgroundColor: "#343A40" }), _jsx(SkiaGrid, { ColumnDefinitions: Tabs.map(() => "*").join(","), HorizontalOptions: "Fill", VerticalOptions: "Fill", children: Tabs.map((t, i) => (_jsxs(SkiaLayer, { Column: i, HorizontalOptions: "Fill", VerticalOptions: "Fill", AnimationTapped: "Ripple", Tapped: () => void SelectTabAsync(i), AccessibilityRole: "button", AccessibilityLabel: t.title, children: [_jsx(SkiaLabel, { Text: t.title, FontSize: 13, FontFamily: i === selectedTab ? "FontTextBold" : undefined, TextColor: i === selectedTab ? ShellDefaults.TabSelectedColor : ShellDefaults.TabColor, HorizontalOptions: "Center", VerticalOptions: "Center", AccessibilityRole: "presentation" }), i === selectedTab && _jsx(SkiaShape, { Type: "Rectangle", HeightRequest: 3, WidthRequest: 36, CornerRadius: 2, BackgroundColor: ShellDefaults.TabSelectedColor, HorizontalOptions: "Center", VerticalOptions: "End" })] }, t.route))) })] })), modals.map((m) => m.node), popups.map((p) => p.node), toasts.map((t) => t.node)] }) }));
|
|
477
512
|
});
|
|
478
513
|
/** A pushed page: slides in from the right on mount (C# SkiaViewSwitcher PushView), covers what is below. */
|
|
479
|
-
function PageHost({ route, speed, visible, background, bottom, register, children }) {
|
|
514
|
+
function PageHost({ route, speed, active, visible, background, bottom, register, children }) {
|
|
480
515
|
const ctrl = useRef(null);
|
|
516
|
+
// slides in once, when pushed; a page of another tab stays mounted and is registered only while its tab is selected
|
|
481
517
|
useEffect(() => {
|
|
482
518
|
const c = ctrl.current;
|
|
483
|
-
if (
|
|
484
|
-
return;
|
|
485
|
-
register(c);
|
|
486
|
-
if (speed > 0) {
|
|
519
|
+
if (c && speed > 0) {
|
|
487
520
|
c.TranslationX = CanvasWidthPts(c);
|
|
488
521
|
void c.TranslateToAsync(0, 0, speed);
|
|
489
522
|
}
|
|
490
|
-
return () => register(null);
|
|
491
523
|
}, [route]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
524
|
+
useEffect(() => {
|
|
525
|
+
const c = ctrl.current;
|
|
526
|
+
if (!c || !active)
|
|
527
|
+
return;
|
|
528
|
+
register(c);
|
|
529
|
+
return () => register(null);
|
|
530
|
+
}, [route, active]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
492
531
|
return (_jsx(SkiaLayer, { ref: (c) => { ctrl.current = c; }, VerticalOptions: "Fill", HorizontalOptions: "Fill", Margin: new Thickness(0, 0, 0, bottom), BackgroundColor: background, IsVisible: visible, BlockGesturesBelow: true, children: children }));
|
|
493
532
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type CSSProperties, type FC, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { Canvas as CanvasView } from "../core/Canvas";
|
|
3
3
|
import type { SkiaControl } from "../core/SkiaControl";
|
|
4
|
+
import type { PopupAnchor, PopupId, PopupWindowOptions } from "../core/PopupWindows";
|
|
5
|
+
import type { SKPoint } from "../core/Gestures";
|
|
6
|
+
import type { SKRect } from "../core/Types";
|
|
7
|
+
import type { Thickness, ThicknessValue } from "../core/Types";
|
|
4
8
|
import type { SkiaLabel as SkiaLabelCtrl } from "../controls/SkiaLabel";
|
|
5
9
|
import type { TextSpan as TextSpanCtrl } from "../controls/TextSpan";
|
|
6
10
|
import type { SkiaRichLabel as SkiaRichLabelCtrl } from "../controls/SkiaRichLabel";
|
|
11
|
+
import type { SkiaLabelFps as SkiaLabelFpsCtrl } from "../controls/SkiaLabelFps";
|
|
7
12
|
import type { SkiaSwitch as SkiaSwitchCtrl } from "../controls/SkiaSwitch";
|
|
8
13
|
import type { SkiaCheckbox as SkiaCheckboxCtrl } from "../controls/SkiaCheckbox";
|
|
9
14
|
import type { SkiaRadioButton as SkiaRadioButtonCtrl } from "../controls/SkiaRadioButton";
|
|
@@ -22,7 +27,7 @@ import type { SkiaScrollBar as SkiaScrollBarCtrl } from "../controls/SkiaScrollB
|
|
|
22
27
|
import type { RefreshIndicator as RefreshIndicatorCtrl } from "../controls/RefreshIndicator";
|
|
23
28
|
import type { SkiaSvg as SkiaSvgCtrl } from "../controls/SkiaSvg";
|
|
24
29
|
import type { SkiaBackdrop as SkiaBackdropCtrl } from "../controls/SkiaBackdrop";
|
|
25
|
-
import
|
|
30
|
+
import { SkiaEditor as SkiaEditorCtrl } from "../controls/SkiaEditor";
|
|
26
31
|
import type { SkiaSprite as SkiaSpriteCtrl } from "../controls/SkiaSprite";
|
|
27
32
|
import type { SkiaSpriteSet as SkiaSpriteSetCtrl } from "../controls/SkiaSpriteSet";
|
|
28
33
|
import type { SkiaLottie as SkiaLottieCtrl } from "../controls/SkiaLottie";
|
|
@@ -31,6 +36,23 @@ import { SkiaScroll as SkiaScrollCtrl } from "../controls/SkiaScroll";
|
|
|
31
36
|
import type { SkiaShape as SkiaShapeCtrl } from "../controls/SkiaShape";
|
|
32
37
|
import type { Color, RenderingModeType } from "../core/Types";
|
|
33
38
|
import type { GesturesMode } from "../core/Gestures";
|
|
39
|
+
export { DesignerSourceOf, type DesignerSource } from "./reconciler";
|
|
40
|
+
import { DesignerActions, designerAction } from "../core/DesignerActions";
|
|
41
|
+
export { DesignerActions, designerAction };
|
|
42
|
+
/**
|
|
43
|
+
* A Designer action that exists while the component is mounted (DesignerActions): `path` is its groups and name,
|
|
44
|
+
* slash-separated ("Levels/Level 3"); `run` is called when the designer runs it (always the latest `run` passed). It is
|
|
45
|
+
* registered again when the path or one of `deps` changes. Nothing runs without a designer attached.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useDesignerAction(path: string, run: () => void, deps?: readonly unknown[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* A Designer action as an element (for JSX and NX): declared while it is mounted, `onRun` called when the designer runs
|
|
50
|
+
* it. Draws nothing. `<DesignerAction Name="Levels/Level 3" onRun={() => startLevel(3)} />`
|
|
51
|
+
*/
|
|
52
|
+
export declare function DesignerAction({ Name, onRun }: {
|
|
53
|
+
Name: string;
|
|
54
|
+
onRun: () => void;
|
|
55
|
+
}): null;
|
|
34
56
|
/**
|
|
35
57
|
* Public settable properties of a control become its JSX props, same PascalCase names as C#.
|
|
36
58
|
*
|
|
@@ -41,7 +63,7 @@ import type { GesturesMode } from "../core/Gestures";
|
|
|
41
63
|
* and never appeared in completion.
|
|
42
64
|
*/
|
|
43
65
|
type PropsOf<T> = Partial<{
|
|
44
|
-
[K in keyof T as T[K] extends Function ? (undefined extends T[K] ? K : never) : K extends "Children" | "Views" | "Parent" | "Spans" | "GridStructure" | "AccessibilityId" | "IsAccessibilityElement" | "HasTransform" | "RenderTransformMatrix" | "RenderObjectPrevious" | "LastMeasuredIndex" | "ItemsInsertedAtStart" | "UsingControlStyle" | "Track" | "Thumb" | "FrameOn" | "FrameOff" | "ViewCheckOn" | "ViewOn" | "ViewText" | "Ratio" | "StartThumbX" | "EndThumbX" | "SnapPoints" | "CurrentPosition" | "CurrentSnap" | "ContentOffsetBounds" | "InTransition" | "CanAnimate" | "MaxIndex" | "ChildrenTotal" | "IsAtStart" | "IsAtEnd" | "ScrollProgress" | "ScrollAmount" | "TransitionProgress" | "LastIndex" | "ChildrenCount" | "Horizontal" | "Animator" | "Animation" | "IsPlaying" | "PlayWhenAvailable" | "TotalFrames" | "HasEffects" | "IsDisposed" | "Label" | "IsMultiline" | "HasSelection" | "LayoutVersion" | "LinesCount" | "MeasuredLineHeight" | "Focused" | "SpriteSheet" | "FrameWidth" | "FrameHeight" | "DurationMs" | "FrameDurationMs" | "CurrentSprite" | "Rects" | "HasTapHandler" | "HasDecorations" | "LinesCount" | "Superview" | "DrawingRect" | "MeasuredSize" | "RenderingScale" | "NeedMeasure" | "_superview" | "HitBoxAuto" | "TotalDown" | "TotalTapped" | "TouchDown" | "PostAnimators" | "LoadedSource" | "IsLoading" | "DisplayRect" | "AspectScale" | "Content" | "ContentSize" | "ContentOffsetBounds" | "OverscrollDistance" | "OverScrolled" | "IsUserPanning" | "IsUserFocused" | "IsScrolling" | "IsTemplated" | "FirstVisibleIndex" | "LastVisibleIndex" | "DebugString" | "ChildrenFactory" | "ContextIndex" | "RenderObject" | "UsingCacheType" | "TransitionEffect" | "TransitionFromIndex" | "TransitionToIndex" | "EffectPostRenderers" | "CachedImage" | "ImageBitmap" | "ShouldSubmitOnEnter" | "Header" | "Footer" | "RefreshIndicator" | "ScrollBar" | "ScrollBarHorizontal" | "IsRunning" | "VisibleRatio" | "CurrentIndex" | "LastCompositeRecord" | "DirtyChildrenInternal" | "IsRenderingWithComposition" ? never : K]: T[K];
|
|
66
|
+
[K in keyof T as T[K] extends Function ? (undefined extends T[K] ? K : never) : K extends "Children" | "Views" | "Parent" | "Spans" | "GridStructure" | "AccessibilityId" | "IsAccessibilityElement" | "HasTransform" | "RenderTransformMatrix" | "RenderObjectPrevious" | "LastMeasuredIndex" | "ItemsInsertedAtStart" | "UsingControlStyle" | "Track" | "Thumb" | "FrameOn" | "FrameOff" | "ViewCheckOn" | "ViewOn" | "ViewText" | "Ratio" | "StartThumbX" | "EndThumbX" | "SnapPoints" | "CurrentPosition" | "CurrentSnap" | "ContentOffsetBounds" | "InTransition" | "CanAnimate" | "MaxIndex" | "ChildrenTotal" | "IsAtStart" | "IsAtEnd" | "ScrollProgress" | "ScrollAmount" | "TransitionProgress" | "LastIndex" | "ChildrenCount" | "Horizontal" | "Animator" | "Animation" | "IsPlaying" | "PlayWhenAvailable" | "TotalFrames" | "HasEffects" | "IsDisposed" | "Label" | "IsMultiline" | "HasSelection" | "LayoutVersion" | "LinesCount" | "MeasuredLineHeight" | "Focused" | "SpriteSheet" | "FrameWidth" | "FrameHeight" | "DurationMs" | "FrameDurationMs" | "CurrentSprite" | "Rects" | "HasTapHandler" | "HasDecorations" | "LinesCount" | "Superview" | "DrawingRect" | "MeasuredSize" | "RenderingScale" | "NeedMeasure" | "_superview" | "HitBoxAuto" | "TotalDown" | "TotalTapped" | "TouchDown" | "PostAnimators" | "LoadedSource" | "IsLoading" | "DisplayRect" | "AspectScale" | "Content" | "ContentSize" | "ContentOffsetBounds" | "OverscrollDistance" | "OverScrolled" | "IsUserPanning" | "IsUserFocused" | "IsScrolling" | "IsTemplated" | "FirstVisibleIndex" | "LastVisibleIndex" | "DebugString" | "ChildrenFactory" | "ContextIndex" | "RenderObject" | "UsingCacheType" | "TransitionEffect" | "TransitionFromIndex" | "TransitionToIndex" | "EffectPostRenderers" | "CachedImage" | "ImageBitmap" | "ShouldSubmitOnEnter" | "Header" | "Footer" | "RefreshIndicator" | "ScrollBar" | "ScrollBarHorizontal" | "IsRunning" | "VisibleRatio" | "CurrentIndex" | "LastCompositeRecord" | "DirtyChildrenInternal" | "IsRenderingWithComposition" | "IsHovered" ? never : K]: T[K] extends Thickness ? ThicknessValue : T[K];
|
|
45
67
|
}>;
|
|
46
68
|
/** `ref` receives the engine control instance (react-reconciler getPublicInstance). */
|
|
47
69
|
type LeafProps<T> = PropsOf<T> & {
|
|
@@ -57,10 +79,13 @@ export declare const SkiaStack: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
|
57
79
|
export declare const SkiaRow: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
58
80
|
export declare const SkiaLayer: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
59
81
|
export declare const SkiaWrap: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
82
|
+
export declare const SkiaMasonry: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
60
83
|
export declare const SkiaGrid: FC<LayoutProps<SkiaLayoutCtrl>>;
|
|
61
84
|
/** Grid drawing gradient separator lines in its spacing (C# SkiaDecoratedGrid). */
|
|
62
85
|
export declare const SkiaDecoratedGrid: FC<LayoutProps<SkiaDecoratedGridCtrl>>;
|
|
63
86
|
export declare const SkiaLabel: FC<LayoutProps<SkiaLabelCtrl>>;
|
|
87
|
+
/** Canvas FPS counter (C# SkiaLabelFps); its value changes only on frames running animators request anyway. */
|
|
88
|
+
export declare const SkiaLabelFps: FC<LeafProps<SkiaLabelFpsCtrl>>;
|
|
64
89
|
/** Markdown label (C# SkiaRichLabel): Text is markdown, rendered as spans; LinkTapped for [text](url). */
|
|
65
90
|
export declare const SkiaRichLabel: FC<LeafProps<SkiaRichLabelCtrl>>;
|
|
66
91
|
/** Child of <SkiaLabel>: a styled fragment (C# TextSpan). */
|
|
@@ -100,8 +125,14 @@ export declare const SkiaDrawer: FC<LayoutProps<SkiaDrawerCtrl>>;
|
|
|
100
125
|
export interface CanvasProps {
|
|
101
126
|
BackgroundColor?: Color;
|
|
102
127
|
RenderingMode?: RenderingModeType;
|
|
103
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Disabled (default) / Enabled / Lock, like DrawnUi Canvas.Gestures. Enabled shares input with the page like MAUI's
|
|
130
|
+
* Enabled inside a native scroll view: a touch pan along an axis the page can scroll scrolls the page, and the wheel
|
|
131
|
+
* scrolls it unless a control used the wheel. A page that cannot scroll keeps every touch. Lock keeps all input.
|
|
132
|
+
*/
|
|
104
133
|
Gestures?: GesturesMode;
|
|
134
|
+
/** While nothing has keyboard focus, an arrow key starts keyboard navigation as the first Tab does (off by default: games keep their arrows). */
|
|
135
|
+
ArrowsStartKeyboardNavigation?: boolean;
|
|
105
136
|
children?: ReactNode;
|
|
106
137
|
style?: CSSProperties;
|
|
107
138
|
className?: string;
|
|
@@ -109,12 +140,28 @@ export interface CanvasProps {
|
|
|
109
140
|
ref?: Ref<CanvasView>;
|
|
110
141
|
/** Context-menu request (right click / long press / Menu key) no control handled; return true to suppress the browser menu. */
|
|
111
142
|
ContextMenu?: CanvasView["ContextMenu"];
|
|
143
|
+
/** DrawnView.WillFirstTimeDraw: once, right before the first frame is drawn, with its drawing context. */
|
|
144
|
+
WillFirstTimeDraw?: CanvasView["WillFirstTimeDraw"];
|
|
145
|
+
/** DrawnView.WasDrawn: after every drawn frame. */
|
|
146
|
+
WasDrawn?: CanvasView["WasDrawn"];
|
|
147
|
+
/** The system light / dark appearance: once when known (at creation), then once per change. */
|
|
148
|
+
SystemThemeChanged?: CanvasView["SystemThemeChanged"];
|
|
112
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Opens a popup window (drawnui-cross 6at) whose content is drawn elements, e.g. a menu:
|
|
152
|
+
* `OpenPopupWindow(canvas, <SkiaShape ...>...</SkiaShape>, e.Location)`. The elements are rendered at once in a React
|
|
153
|
+
* root of their own and unmounted when the popup closes; the anchor is a point (canvas points), a rect, a control or a
|
|
154
|
+
* `PopupAnchor`. Returns the popup's id (for `canvas.ClosePopupWindow`).
|
|
155
|
+
*/
|
|
156
|
+
export declare function OpenPopupWindow(canvas: CanvasView, content: ReactNode, anchor: PopupAnchor | SKPoint | SKRect | SkiaControl | {
|
|
157
|
+
X: number;
|
|
158
|
+
Y: number;
|
|
159
|
+
}, options?: PopupWindowOptions): PopupId;
|
|
113
160
|
/**
|
|
114
161
|
* Mirrors DrawnUi Canvas: the bridge between the DOM (react-dom) and the drawn tree (DrawnUi reconciler).
|
|
115
162
|
* Requires Super.UseDrawnUi()...BuildAsync() to have completed.
|
|
116
163
|
*/
|
|
117
|
-
export declare function Canvas({ BackgroundColor, RenderingMode, Gestures, children, style, className, ref: viewRef, ContextMenu }: CanvasProps): import("react").JSX.Element;
|
|
164
|
+
export declare function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKeyboardNavigation, children, style, className, ref: viewRef, ContextMenu, WillFirstTimeDraw, WasDrawn, SystemThemeChanged }: CanvasProps): import("react").JSX.Element;
|
|
118
165
|
export type { SkiaControl };
|
|
119
166
|
export * from "../index";
|
|
120
167
|
export * from "./SkiaShell";
|