drawnui-react 0.1.0-preview.40 → 0.1.0-preview.42
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 +57 -0
- package/SKIPPED.md +2 -2
- package/dist/controls/SkiaEditor.js +5 -4
- package/dist/controls/SkiaImage.d.ts +5 -0
- package/dist/controls/SkiaImage.js +32 -5
- package/dist/controls/SkiaLabel.d.ts +17 -2
- package/dist/controls/SkiaLabel.js +38 -12
- package/dist/controls/SkiaLabelFps.d.ts +0 -3
- package/dist/controls/SkiaLabelFps.js +1 -11
- package/dist/controls/SkiaLayout.js +33 -2
- package/dist/controls/SkiaScroll.d.ts +17 -0
- package/dist/controls/SkiaScroll.js +51 -6
- package/dist/controls/SkiaShell.d.ts +282 -0
- package/dist/controls/SkiaShell.js +972 -0
- package/dist/controls/SkiaSprite.js +5 -1
- package/dist/core/Accessibility.d.ts +12 -0
- package/dist/core/Accessibility.js +62 -14
- package/dist/core/Canvas.d.ts +50 -8
- package/dist/core/Canvas.js +126 -25
- package/dist/core/DesignerActions.d.ts +32 -0
- package/dist/core/DesignerActions.js +68 -0
- package/dist/core/Gestures.d.ts +1 -0
- package/dist/core/Props.d.ts +11 -0
- package/dist/core/Props.js +44 -0
- package/dist/core/SkiaControl.d.ts +26 -3
- package/dist/core/SkiaControl.js +64 -13
- package/dist/core/SkiaEffect.d.ts +12 -1
- package/dist/core/SkiaEffect.js +35 -8
- package/dist/core/SkiaImageManager.d.ts +100 -18
- package/dist/core/SkiaImageManager.js +309 -64
- package/dist/core/Styles.js +7 -1
- package/dist/core/Super.d.ts +2 -0
- package/dist/core/Super.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/react/SkiaShell.d.ts +8 -74
- package/dist/react/SkiaShell.js +163 -514
- package/dist/react/index.d.ts +24 -1
- package/dist/react/index.js +32 -5
- package/dist/react/reconciler.d.ts +12 -0
- package/dist/react/reconciler.js +22 -46
- package/package.json +24 -2
package/dist/react/index.d.ts
CHANGED
|
@@ -37,6 +37,24 @@ import type { SkiaShape as SkiaShapeCtrl } from "../controls/SkiaShape";
|
|
|
37
37
|
import type { Color, RenderingModeType } from "../core/Types";
|
|
38
38
|
import type { GesturesMode } from "../core/Gestures";
|
|
39
39
|
export { DesignerSourceOf, type DesignerSource } from "./reconciler";
|
|
40
|
+
/** JSX tag name -> engine class: add-on packages register their controls here. */
|
|
41
|
+
export { Registry } from "./reconciler";
|
|
42
|
+
import { DesignerActions, designerAction } from "../core/DesignerActions";
|
|
43
|
+
export { DesignerActions, designerAction };
|
|
44
|
+
/**
|
|
45
|
+
* A Designer action that exists while the component is mounted (DesignerActions): `path` is its groups and name,
|
|
46
|
+
* slash-separated ("Levels/Level 3"); `run` is called when the designer runs it (always the latest `run` passed). It is
|
|
47
|
+
* registered again when the path or one of `deps` changes. Nothing runs without a designer attached.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useDesignerAction(path: string, run: () => void, deps?: readonly unknown[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* A Designer action as an element (for JSX and NX): declared while it is mounted, `onRun` called when the designer runs
|
|
52
|
+
* it. Draws nothing. `<DesignerAction Name="Levels/Level 3" onRun={() => startLevel(3)} />`
|
|
53
|
+
*/
|
|
54
|
+
export declare function DesignerAction({ Name, onRun }: {
|
|
55
|
+
Name: string;
|
|
56
|
+
onRun: () => void;
|
|
57
|
+
}): null;
|
|
40
58
|
/**
|
|
41
59
|
* Public settable properties of a control become its JSX props, same PascalCase names as C#.
|
|
42
60
|
*
|
|
@@ -49,6 +67,8 @@ export { DesignerSourceOf, type DesignerSource } from "./reconciler";
|
|
|
49
67
|
type PropsOf<T> = Partial<{
|
|
50
68
|
[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];
|
|
51
69
|
}>;
|
|
70
|
+
/** The JSX props of an engine control class (for add-on packages that declare their own tags). */
|
|
71
|
+
export type DrawnProps<T> = PropsOf<T>;
|
|
52
72
|
/** `ref` receives the engine control instance (react-reconciler getPublicInstance). */
|
|
53
73
|
type LeafProps<T> = PropsOf<T> & {
|
|
54
74
|
ref?: Ref<T>;
|
|
@@ -128,6 +148,8 @@ export interface CanvasProps {
|
|
|
128
148
|
WillFirstTimeDraw?: CanvasView["WillFirstTimeDraw"];
|
|
129
149
|
/** DrawnView.WasDrawn: after every drawn frame. */
|
|
130
150
|
WasDrawn?: CanvasView["WasDrawn"];
|
|
151
|
+
/** The system light / dark appearance: once when known (at creation), then once per change. */
|
|
152
|
+
SystemThemeChanged?: CanvasView["SystemThemeChanged"];
|
|
131
153
|
}
|
|
132
154
|
/**
|
|
133
155
|
* Opens a popup window (drawnui-cross 6at) whose content is drawn elements, e.g. a menu:
|
|
@@ -143,7 +165,8 @@ export declare function OpenPopupWindow(canvas: CanvasView, content: ReactNode,
|
|
|
143
165
|
* Mirrors DrawnUi Canvas: the bridge between the DOM (react-dom) and the drawn tree (DrawnUi reconciler).
|
|
144
166
|
* Requires Super.UseDrawnUi()...BuildAsync() to have completed.
|
|
145
167
|
*/
|
|
146
|
-
export declare function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKeyboardNavigation, children, style, className, ref: viewRef, ContextMenu, WillFirstTimeDraw, WasDrawn }: CanvasProps): import("react").JSX.Element;
|
|
168
|
+
export declare function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKeyboardNavigation, children, style, className, ref: viewRef, ContextMenu, WillFirstTimeDraw, WasDrawn, SystemThemeChanged }: CanvasProps): import("react").JSX.Element;
|
|
147
169
|
export type { SkiaControl };
|
|
148
170
|
export * from "../index";
|
|
149
171
|
export * from "./SkiaShell";
|
|
172
|
+
export { SkiaShell } from "./SkiaShell";
|
package/dist/react/index.js
CHANGED
|
@@ -8,6 +8,29 @@ import { SkiaEditor as SkiaEditorCtrl } from "../controls/SkiaEditor";
|
|
|
8
8
|
import { SkiaScroll as SkiaScrollCtrl } from "../controls/SkiaScroll";
|
|
9
9
|
import { createDrawnRoot } from "./reconciler";
|
|
10
10
|
export { DesignerSourceOf } from "./reconciler";
|
|
11
|
+
/** JSX tag name -> engine class: add-on packages register their controls here. */
|
|
12
|
+
export { Registry } from "./reconciler";
|
|
13
|
+
import { DesignerActions, designerAction } from "../core/DesignerActions";
|
|
14
|
+
export { DesignerActions, designerAction };
|
|
15
|
+
/**
|
|
16
|
+
* A Designer action that exists while the component is mounted (DesignerActions): `path` is its groups and name,
|
|
17
|
+
* slash-separated ("Levels/Level 3"); `run` is called when the designer runs it (always the latest `run` passed). It is
|
|
18
|
+
* registered again when the path or one of `deps` changes. Nothing runs without a designer attached.
|
|
19
|
+
*/
|
|
20
|
+
export function useDesignerAction(path, run, deps = []) {
|
|
21
|
+
const latest = useRef(run);
|
|
22
|
+
latest.current = run;
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
useEffect(() => designerAction(path, () => latest.current()), [path, ...deps]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A Designer action as an element (for JSX and NX): declared while it is mounted, `onRun` called when the designer runs
|
|
28
|
+
* it. Draws nothing. `<DesignerAction Name="Levels/Level 3" onRun={() => startLevel(3)} />`
|
|
29
|
+
*/
|
|
30
|
+
export function DesignerAction({ Name, onRun }) {
|
|
31
|
+
useDesignerAction(Name, onRun);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
11
34
|
/** Typed JSX tags resolved by the reconciler Registry. */
|
|
12
35
|
export const SkiaLayout = "SkiaLayout";
|
|
13
36
|
export const SkiaStack = "SkiaStack";
|
|
@@ -99,7 +122,7 @@ export function OpenPopupWindow(canvas, content, anchor, options) {
|
|
|
99
122
|
* Mirrors DrawnUi Canvas: the bridge between the DOM (react-dom) and the drawn tree (DrawnUi reconciler).
|
|
100
123
|
* Requires Super.UseDrawnUi()...BuildAsync() to have completed.
|
|
101
124
|
*/
|
|
102
|
-
export function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKeyboardNavigation, children, style, className, ref: viewRef, ContextMenu, WillFirstTimeDraw, WasDrawn }) {
|
|
125
|
+
export function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKeyboardNavigation, children, style, className, ref: viewRef, ContextMenu, WillFirstTimeDraw, WasDrawn, SystemThemeChanged }) {
|
|
103
126
|
const ref = useRef(null);
|
|
104
127
|
const view = useRef(null);
|
|
105
128
|
const root = useRef(null);
|
|
@@ -111,6 +134,7 @@ export function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKe
|
|
|
111
134
|
c.RenderingMode = RenderingMode;
|
|
112
135
|
c.WillFirstTimeDraw = WillFirstTimeDraw;
|
|
113
136
|
c.WasDrawn = WasDrawn;
|
|
137
|
+
c.SystemThemeChanged = SystemThemeChanged;
|
|
114
138
|
});
|
|
115
139
|
view.current = v;
|
|
116
140
|
root.current = createDrawnRoot(v);
|
|
@@ -133,6 +157,7 @@ export function Canvas({ BackgroundColor, RenderingMode, Gestures, ArrowsStartKe
|
|
|
133
157
|
v.ContextMenu = ContextMenu;
|
|
134
158
|
v.WillFirstTimeDraw = WillFirstTimeDraw;
|
|
135
159
|
v.WasDrawn = WasDrawn;
|
|
160
|
+
v.SystemThemeChanged = SystemThemeChanged;
|
|
136
161
|
root.current.render(children);
|
|
137
162
|
});
|
|
138
163
|
// The drawn surface is aria-hidden; the overlay is the accessibility tree (DrawnUi.Blazor pattern). The host takes the
|
|
@@ -254,11 +279,12 @@ function AccessibilityOverlay({ view }) {
|
|
|
254
279
|
// the browser scrolls an overflow:hidden container to reveal a focused child; the overlay must stay pinned to the canvas
|
|
255
280
|
const pin = (e) => { e.currentTarget.scrollTop = 0; e.currentTarget.scrollLeft = 0; };
|
|
256
281
|
// an active modal (drawnui-cross 6av): the overlay itself is the dialog (role, name, aria-modal) around the dialog's
|
|
257
|
-
// controls, which are its elements; aria-modal on a separate element of this flat overlay would hide them
|
|
282
|
+
// controls, which are its elements; aria-modal on a separate element of this flat overlay would hide them. A nameless
|
|
283
|
+
// modal (a popup host) takes the role and name of the dialog inside it: one dialog for readers (6bs)
|
|
258
284
|
const modal = view.AccessibilityManager.ActiveModal;
|
|
259
|
-
const modalNode = modal ?
|
|
285
|
+
const modalNode = modal ? view.AccessibilityManager.ActiveModalNode : undefined;
|
|
260
286
|
return (_jsxs("div", { className: "drawnui-a11y-overlay", onScroll: pin, ref: overlayRef, role: modal ? modalNode?.Role ?? "dialog" : undefined, "aria-label": modalNode?.Label, "aria-modal": modal ? true : undefined, children: [_jsx("style", { children: A11Y_CSS }), nodes.map((n) => {
|
|
261
|
-
if (n === modalNode)
|
|
287
|
+
if (n === modalNode || (modal && n.Source === modal))
|
|
262
288
|
return null;
|
|
263
289
|
const pos = { left: n.Rect.Left, top: n.Rect.Top, width: n.Rect.Width, height: n.Rect.Height };
|
|
264
290
|
const activate = () => SkiaAccessibilityManager.Activate(n.Source);
|
|
@@ -308,5 +334,6 @@ function AccessibilityOverlay({ view }) {
|
|
|
308
334
|
// One import for apps: React tags + every engine type (Colors, Thickness, Super, gestures, animators...).
|
|
309
335
|
// The engine `Canvas` class is shadowed by the React <Canvas> above; reach it via "drawnui-react/core".
|
|
310
336
|
export * from "../index";
|
|
311
|
-
//
|
|
337
|
+
// SkiaShell with JSX pages, popups and modals (useShell()); the engine SkiaShell is in "drawnui-react/core"
|
|
312
338
|
export * from "./SkiaShell";
|
|
339
|
+
export { SkiaShell } from "./SkiaShell";
|
|
@@ -24,6 +24,18 @@ export interface DesignerSource {
|
|
|
24
24
|
* from the fiber's stack only when asked). Undefined in production builds and for controls made outside React.
|
|
25
25
|
*/
|
|
26
26
|
export declare function DesignerSourceOf(control: SkiaControl): DesignerSource | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* A portal target other than the canvas: JSX rendered into a place an engine control made for it (the shell's pages,
|
|
29
|
+
* popups, modals). Its top-level controls are handed to it in order.
|
|
30
|
+
*/
|
|
31
|
+
export interface DrawnContainer {
|
|
32
|
+
appendChild(child: SkiaControl): void;
|
|
33
|
+
insertBefore(child: SkiaControl, before: SkiaControl): void;
|
|
34
|
+
removeChild(child: SkiaControl): void;
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
/** Renders `children` into `container` from inside another React tree (contexts reach it), as react-dom createPortal. */
|
|
38
|
+
export declare function createDrawnPortal(children: ReactNode, container: DrawnContainer, key?: string): ReactNode;
|
|
27
39
|
/** Creates a React root whose container is an engine Canvas. */
|
|
28
40
|
export declare function createDrawnRoot(canvas: Canvas): {
|
|
29
41
|
render(children: ReactNode): void;
|
package/dist/react/reconciler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
import Reconciler from "react-reconciler";
|
|
3
3
|
import { ConcurrentRoot, DefaultEventPriority } from "react-reconciler/constants";
|
|
4
|
-
import {
|
|
4
|
+
import { ApplyProps as applyProps } from "../core/Props";
|
|
5
5
|
import { SkiaLabel } from "../controls/SkiaLabel";
|
|
6
6
|
import { TextSpan } from "../controls/TextSpan";
|
|
7
7
|
import { SkiaRichLabel } from "../controls/SkiaRichLabel";
|
|
@@ -36,46 +36,6 @@ export const Registry = {
|
|
|
36
36
|
SkiaLayout, SkiaStack, SkiaRow, SkiaLayer, SkiaWrap, SkiaMasonry, SkiaGrid, SkiaDecoratedGrid, SkiaBackdrop, SkiaEditor, SkiaSprite, SkiaSpriteSet, SkiaLabel, SkiaLabelFps, SkiaRichLabel, TextSpan, SkiaHotspot, SkiaButton, SkiaImage, SkiaImageTiles, SkiaSvg, SkiaLottie, SkiaGif, SkiaScroll, SkiaScrollBar, RefreshIndicator, SkiaShape, SkiaFrame,
|
|
37
37
|
SkiaSwitch, SkiaCheckbox, SkiaRadioButton, SkiaProgress, SkiaSlider, SkiaCarousel, SkiaShaderCarousel, SkiaDrawer,
|
|
38
38
|
};
|
|
39
|
-
const SKIP = new Set(["children", "key", "ref"]);
|
|
40
|
-
/** Props that change how the subtree is composited, not what it contains: repaint, keep caches (DrawnUi RedrawCanvas). */
|
|
41
|
-
const REPAINT_ONLY = new Set(["TranslationX", "TranslationY", "TranslationZ", "Rotation", "RotationX", "RotationY", "RotationZ", "ScaleX", "ScaleY", "Scale", "SkewX", "SkewY", "AnchorX", "AnchorY", "Opacity"]);
|
|
42
|
-
/** Props that change only how a control looks, never its size (C# NeedDraw): an ImageComposite above redraws only its area. */
|
|
43
|
-
const isDrawOnly = (k) => k.endsWith("Color") || k === "FillGradient" || k === "StrokeGradient";
|
|
44
|
-
/**
|
|
45
|
-
* Assigns changed props straight onto the control (same names as the C# properties).
|
|
46
|
-
* Handler props (functions) are swapped without invalidating: inline arrows change identity every render.
|
|
47
|
-
*/
|
|
48
|
-
function applyProps(inst, prev, next) {
|
|
49
|
-
let changed = false, repaint = false, layout = false;
|
|
50
|
-
for (const k in next) {
|
|
51
|
-
if (SKIP.has(k) || (prev && prev[k] === next[k]))
|
|
52
|
-
continue;
|
|
53
|
-
inst[k] = next[k];
|
|
54
|
-
if (typeof next[k] === "function")
|
|
55
|
-
continue;
|
|
56
|
-
if (REPAINT_ONLY.has(k))
|
|
57
|
-
repaint = true;
|
|
58
|
-
else {
|
|
59
|
-
changed = true;
|
|
60
|
-
if (!isDrawOnly(k))
|
|
61
|
-
layout = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (prev)
|
|
65
|
-
for (const k in prev)
|
|
66
|
-
if (!SKIP.has(k) && !(k in next)) {
|
|
67
|
-
inst[k] = new inst.constructor()[k];
|
|
68
|
-
changed = layout = true;
|
|
69
|
-
}
|
|
70
|
-
if (changed && prev) {
|
|
71
|
-
if (layout || !(inst instanceof SkiaControl))
|
|
72
|
-
inst.Update();
|
|
73
|
-
else
|
|
74
|
-
inst.UpdateDraw();
|
|
75
|
-
}
|
|
76
|
-
else if (repaint && prev)
|
|
77
|
-
inst.RepaintComposition?.();
|
|
78
|
-
}
|
|
79
39
|
// DrawnUI Designer, dev builds only: the React fiber that created each control (DesignerSourceOf). Vite replaces
|
|
80
40
|
// import.meta.env.DEV, false in production builds, so the map and its use compile away; without Vite it is undefined
|
|
81
41
|
// and nothing is kept.
|
|
@@ -113,6 +73,7 @@ function appendChild(parent, child) {
|
|
|
113
73
|
child.IsChildrenItem = true;
|
|
114
74
|
parent.AddSubView(child);
|
|
115
75
|
}
|
|
76
|
+
const IsDrawnContainer = (c) => typeof c.appendChild === "function";
|
|
116
77
|
// Record<string, unknown> absorbs members that react-reconciler 0.33 reads but @types 0.32 does not declare yet.
|
|
117
78
|
const hostConfig = {
|
|
118
79
|
supportsMutation: true,
|
|
@@ -151,11 +112,22 @@ const hostConfig = {
|
|
|
151
112
|
parent.InsertSubView(parent instanceof SkiaLabel ? parent.Spans.indexOf(before) : 0, child);
|
|
152
113
|
},
|
|
153
114
|
removeChild: (parent, child) => parent.RemoveSubView(child),
|
|
154
|
-
appendChildToContainer: (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
115
|
+
appendChildToContainer: (c, child) => { if (IsDrawnContainer(c))
|
|
116
|
+
c.appendChild(child);
|
|
117
|
+
else
|
|
118
|
+
c.Content = child; },
|
|
119
|
+
insertInContainerBefore: (c, child, before) => { if (IsDrawnContainer(c))
|
|
120
|
+
c.insertBefore(child, before);
|
|
121
|
+
else
|
|
122
|
+
c.Content = child; },
|
|
123
|
+
removeChildFromContainer: (c, child) => { if (IsDrawnContainer(c))
|
|
124
|
+
c.removeChild(child);
|
|
125
|
+
else if (c.Content === child)
|
|
126
|
+
c.Content = undefined; },
|
|
127
|
+
clearContainer: (c) => { if (IsDrawnContainer(c))
|
|
128
|
+
c.clear();
|
|
129
|
+
else
|
|
130
|
+
c.Content = undefined; },
|
|
159
131
|
commitUpdate: (inst, _type, prev, next) => applyProps(inst, prev, next),
|
|
160
132
|
commitTextUpdate: noop,
|
|
161
133
|
commitMount: noop,
|
|
@@ -202,6 +174,10 @@ const hostConfig = {
|
|
|
202
174
|
};
|
|
203
175
|
const reconciler = Reconciler(hostConfig);
|
|
204
176
|
const onError = (e) => console.error("DrawnUi.React:", e);
|
|
177
|
+
/** Renders `children` into `container` from inside another React tree (contexts reach it), as react-dom createPortal. */
|
|
178
|
+
export function createDrawnPortal(children, container, key) {
|
|
179
|
+
return reconciler.createPortal(children, container, null, key);
|
|
180
|
+
}
|
|
205
181
|
/** Creates a React root whose container is an engine Canvas. */
|
|
206
182
|
export function createDrawnRoot(canvas) {
|
|
207
183
|
const container = reconciler.createContainer(canvas, ConcurrentRoot, null, false, null, "", onError, onError, onError, noop, null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drawnui-react",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.42",
|
|
4
4
|
"description": "DrawnUi for React: the DrawnUi (.NET) drawn-UI engine in TypeScript on CanvasKit (Skia WASM). Same controls, same PascalCase API as DrawnUi.Net.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nick Kovalsky (AppoMobi)",
|
|
@@ -65,19 +65,23 @@
|
|
|
65
65
|
"check:animation": "node dev/check.mjs dev/check-animation.ts",
|
|
66
66
|
"check:shape": "node dev/check.mjs dev/check-shape.ts",
|
|
67
67
|
"check:label": "node dev/check.mjs dev/check-label.ts",
|
|
68
|
+
"check:label-baseline": "node dev/check.mjs dev/check-label-baseline.ts",
|
|
68
69
|
"check:image": "node dev/check.mjs dev/check-image.ts",
|
|
69
70
|
"check:longpress": "node dev/check.mjs dev/check-longpress.ts",
|
|
70
71
|
"check:hidden": "node dev/check.mjs dev/check-hidden.ts",
|
|
71
72
|
"check:shell": "node dev/check.mjs dev/check-shell.tsx",
|
|
73
|
+
"check:shell-core": "node dev/check.mjs dev/check-shell-core.ts",
|
|
72
74
|
"check:wheel-routing": "node dev/check.mjs dev/check-wheel-routing.ts",
|
|
73
75
|
"check:velocity": "node dev/check.mjs dev/check-velocity.ts",
|
|
74
76
|
"check:scroll-index": "node dev/check.mjs dev/check-scroll-index.ts",
|
|
77
|
+
"check:scroll-chaining": "node dev/check.mjs dev/check-scroll-chaining.ts",
|
|
75
78
|
"check:culling": "node dev/check.mjs dev/check-culling.ts",
|
|
76
79
|
"check:responds": "node dev/check.mjs dev/check-responds.ts",
|
|
77
80
|
"check:3d": "node dev/check.mjs dev/check-3d.ts",
|
|
78
81
|
"check:gesture-owner": "node dev/check.mjs dev/check-gesture-owner.ts",
|
|
79
82
|
"check:shader-cache": "node dev/check.mjs dev/check-shader-cache.ts",
|
|
80
83
|
"check:shader-content": "node dev/check.mjs dev/check-shader-content.ts",
|
|
84
|
+
"check:shader-time": "node dev/check.mjs dev/check-shader-time.ts",
|
|
81
85
|
"check:backdrop": "node dev/check.mjs dev/check-backdrop.ts",
|
|
82
86
|
"check:masonry": "node dev/check.mjs dev/check-masonry.ts",
|
|
83
87
|
"check:thickness": "node dev/check.mjs dev/check-thickness.ts",
|
|
@@ -85,11 +89,13 @@
|
|
|
85
89
|
"check:masonry-keys": "node dev/check.mjs dev/check-masonry-keys.ts",
|
|
86
90
|
"check:carousel-swipe": "node dev/check.mjs dev/check-carousel-swipe.ts",
|
|
87
91
|
"check:editor-focus": "node dev/check.mjs dev/check-editor-focus.ts",
|
|
92
|
+
"check:editor-lines": "node dev/check.mjs dev/check-editor-lines.ts",
|
|
88
93
|
"check:shaping": "node dev/check.mjs dev/check-shaping.ts",
|
|
89
94
|
"check:editor-rtl": "node dev/check.mjs dev/check-editor-rtl.ts",
|
|
90
95
|
"check:label-direction": "node dev/check.mjs dev/check-label-direction.ts",
|
|
91
96
|
"check:stack-fit": "node dev/check.mjs dev/check-stack-fit.ts",
|
|
92
97
|
"check:label-reuse": "node dev/check.mjs dev/check-label-reuse.ts",
|
|
98
|
+
"check:layout-rules": "node dev/check.mjs dev/check-layout-rules.ts",
|
|
93
99
|
"check:popups-tooltips": "node dev/check.mjs dev/check-popups-tooltips.ts",
|
|
94
100
|
"check:carousel-loop": "node dev/check.mjs dev/check-carousel-loop.ts",
|
|
95
101
|
"check:release": "node dev/check.mjs dev/check-release.tsx",
|
|
@@ -103,6 +109,7 @@
|
|
|
103
109
|
"check:shader-carousel-interrupted": "node dev/check.mjs dev/check-shader-carousel-interrupted.ts",
|
|
104
110
|
"check:shell-modal": "node dev/check.mjs dev/check-shell-modal.tsx",
|
|
105
111
|
"check:multitouch": "node dev/check.mjs dev/check-multitouch.ts",
|
|
112
|
+
"check:openlink-nonstop": "node dev/check.mjs dev/check-openlink-nonstop.ts",
|
|
106
113
|
"check:scroll-size": "node dev/check.mjs dev/check-scroll-size.ts",
|
|
107
114
|
"check:ripple-primary": "node dev/check.mjs dev/check-ripple-primary.ts",
|
|
108
115
|
"check:stack-margins": "node dev/check.mjs dev/check-stack-margins.ts",
|
|
@@ -110,12 +117,27 @@
|
|
|
110
117
|
"check:composite-effect": "node dev/check.mjs dev/check-composite-effect.ts",
|
|
111
118
|
"check:keyboard-contextmenu": "node dev/check.mjs dev/check-keyboard-contextmenu.ts",
|
|
112
119
|
"check:editor-window": "node dev/check.mjs dev/check-editor-window.ts",
|
|
120
|
+
"check:system-theme": "node dev/check.mjs dev/check-system-theme.ts",
|
|
121
|
+
"check:designer-actions": "node dev/check.mjs dev/check-designer-actions.tsx",
|
|
122
|
+
"check:dialog-a11y": "node dev/check.mjs dev/check-dialog-a11y.ts",
|
|
123
|
+
"check:label-span-effects": "node dev/check.mjs dev/check-label-span-effects.ts",
|
|
124
|
+
"check:animator-isolation": "node dev/check.mjs dev/check-animator-isolation.ts",
|
|
125
|
+
"check:a11y-opacity": "node dev/check.mjs dev/check-a11y-opacity.ts",
|
|
126
|
+
"check:quiet-animations": "node dev/check.mjs dev/check-quiet-animations.ts",
|
|
127
|
+
"check:skew-sign": "node dev/check.mjs dev/check-skew-sign.ts",
|
|
128
|
+
"check:styles-code": "node dev/check.mjs dev/check-styles-code.ts",
|
|
129
|
+
"check:composite-removed": "node dev/check.mjs dev/check-composite-removed.ts",
|
|
113
130
|
"audit:a11y": "node dev/audit-a11y.mjs",
|
|
114
131
|
"bench:relayout": "node dev/check.mjs dev/bench-relayout.ts",
|
|
115
132
|
"site:extras": "node dev/site-extras.mjs dist/demo",
|
|
116
133
|
"build:lib": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
117
134
|
"prepublishOnly": "npm run build:lib",
|
|
118
|
-
"preview": "vite preview samples/demo"
|
|
135
|
+
"preview": "vite preview samples/demo",
|
|
136
|
+
"check:add3d": "node dev/check.mjs dev/check-add3d.ts",
|
|
137
|
+
"check:parent-independent": "node dev/check.mjs dev/check-parent-independent.ts",
|
|
138
|
+
"check:update-while-recording": "node dev/check.mjs dev/check-update-while-recording.ts",
|
|
139
|
+
"check:image-cache": "node dev/check.mjs dev/check-image-cache.ts",
|
|
140
|
+
"browser:canvas-contexts": "node dev/check-canvas-contexts.mjs"
|
|
119
141
|
},
|
|
120
142
|
"peerDependencies": {
|
|
121
143
|
"playwright-core": ">=1.40",
|