@simpludify/core 0.1.4 → 0.1.6
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 +3 -3
- package/dist/foundation/version.d.ts +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1316 -36
- package/dist/index.js.map +1 -1
- package/dist/interaction/action-bindings.d.ts +18 -2
- package/dist/interaction/actions.d.ts +42 -8
- package/dist/interaction/gamepad-bindings.d.ts +100 -0
- package/dist/interaction/input-capture.d.ts +38 -0
- package/dist/interaction/input.d.ts +22 -0
- package/dist/interaction/physical-input.d.ts +32 -0
- package/dist/interaction/pointer-routing.d.ts +11 -0
- package/dist/interaction/pointer-target.d.ts +14 -0
- package/dist/interaction/virtual-control.d.ts +140 -0
- package/dist/interaction/virtual-input.d.ts +49 -0
- package/dist/interaction/virtual-regions.d.ts +68 -0
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Point, ScreenPoint, Viewport } from "../graphics/coordinates.js";
|
|
2
|
+
export type VirtualSpace = "viewport" | "screen";
|
|
3
|
+
export interface VirtualPosition extends Point {
|
|
4
|
+
/** viewport uses fractions of the current Viewport; screen uses host CSS pixels. */
|
|
5
|
+
readonly space?: VirtualSpace;
|
|
6
|
+
}
|
|
7
|
+
export interface VirtualRectRegion extends VirtualPosition {
|
|
8
|
+
readonly kind: "rect";
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
}
|
|
12
|
+
export interface VirtualCircleRegion extends VirtualPosition {
|
|
13
|
+
readonly kind: "circle";
|
|
14
|
+
/** In viewport space the radius is a fraction of its smaller dimension. */
|
|
15
|
+
readonly radius: number;
|
|
16
|
+
}
|
|
17
|
+
export interface VirtualCustomRegion {
|
|
18
|
+
readonly kind: "custom";
|
|
19
|
+
/** Conservative host CSS-pixel bounds, including every point accepted by contains. */
|
|
20
|
+
readonly bounds: (viewport: Viewport) => Viewport;
|
|
21
|
+
readonly contains: (point: ScreenPoint, viewport: Viewport) => boolean;
|
|
22
|
+
}
|
|
23
|
+
export type VirtualRegion = VirtualRectRegion | VirtualCircleRegion | VirtualCustomRegion;
|
|
24
|
+
export declare const VirtualRegions: Readonly<{
|
|
25
|
+
/** A shared edge is not an overlap. Use separate rectangles to leave a center gap. */
|
|
26
|
+
Left: Readonly<{
|
|
27
|
+
readonly kind: "rect";
|
|
28
|
+
readonly x: 0;
|
|
29
|
+
readonly y: 0;
|
|
30
|
+
readonly width: 0.5;
|
|
31
|
+
readonly height: 1;
|
|
32
|
+
}>;
|
|
33
|
+
Right: Readonly<{
|
|
34
|
+
readonly kind: "rect";
|
|
35
|
+
readonly x: 0.5;
|
|
36
|
+
readonly y: 0;
|
|
37
|
+
readonly width: 0.5;
|
|
38
|
+
readonly height: 1;
|
|
39
|
+
}>;
|
|
40
|
+
}>;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export type ResolvedVirtualRegion = {
|
|
43
|
+
readonly kind: "rect";
|
|
44
|
+
readonly bounds: Viewport;
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: "circle";
|
|
47
|
+
readonly bounds: Viewport;
|
|
48
|
+
readonly center: Point;
|
|
49
|
+
readonly radius: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "custom";
|
|
52
|
+
readonly bounds: Viewport;
|
|
53
|
+
readonly test: VirtualCustomRegion["contains"];
|
|
54
|
+
};
|
|
55
|
+
/** @internal */
|
|
56
|
+
export declare function virtualFinite(value: number, field: string): number;
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare function virtualBounds(value: Viewport): Viewport;
|
|
59
|
+
/** @internal */
|
|
60
|
+
export declare function virtualPosition(value: VirtualPosition, viewport: Viewport): Point;
|
|
61
|
+
/** @internal Copy configuration before retaining it. Predicate functions are deliberately live. */
|
|
62
|
+
export declare function checkedVirtualRegion(region: VirtualRegion): VirtualRegion;
|
|
63
|
+
/** @internal */
|
|
64
|
+
export declare function resolveVirtualRegion(region: VirtualRegion, viewport: Viewport): ResolvedVirtualRegion;
|
|
65
|
+
/** @internal Rectangles are half-open; circles exclude their circumference. */
|
|
66
|
+
export declare function virtualContains(region: ResolvedVirtualRegion, point: ScreenPoint, viewport: Viewport): boolean;
|
|
67
|
+
/** @internal Exact built-in intersection; custom bounds are conservatively ambiguous. */
|
|
68
|
+
export declare function virtualOverlap(a: ResolvedVirtualRegion, b: ResolvedVirtualRegion): boolean;
|