gps-plus-slam-app-framework 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +222 -0
- package/dist/alignment-lerper-D9BeDwZX.d.ts +29 -0
- package/dist/app-selectors-DyMzxCEC.d.ts +140 -0
- package/dist/ar/camera-blit-capture.d.ts +2 -0
- package/dist/ar/camera-blit-capture.js +253 -0
- package/dist/ar/capture-failure-tracker.d.ts +2 -0
- package/dist/ar/capture-failure-tracker.js +45 -0
- package/dist/ar/chromium-camera-access-workaround.d.ts +2 -0
- package/dist/ar/chromium-camera-access-workaround.js +32 -0
- package/dist/ar/depth-sampler.d.ts +3 -0
- package/dist/ar/depth-sampler.js +147 -0
- package/dist/ar/image-capture.d.ts +2 -0
- package/dist/ar/image-capture.js +152 -0
- package/dist/ar/index.d.ts +12 -0
- package/dist/ar/index.js +12 -0
- package/dist/ar/replay-scene.d.ts +2 -0
- package/dist/ar/replay-scene.js +325 -0
- package/dist/ar/scene-node-names.d.ts +2 -0
- package/dist/ar/scene-node-names.js +16 -0
- package/dist/ar/tracking-state.d.ts +2 -0
- package/dist/ar/tracking-state.js +164 -0
- package/dist/ar/webxr-session.d.ts +4 -0
- package/dist/ar/webxr-session.js +890 -0
- package/dist/ar/xr-camera-texture.d.ts +2 -0
- package/dist/ar/xr-camera-texture.js +39 -0
- package/dist/ar/xr-error-handler.d.ts +2 -0
- package/dist/ar/xr-error-handler.js +37 -0
- package/dist/ar-types-B-ORgk6Z.d.ts +82 -0
- package/dist/camera-blit-capture-DHuyrrxr.d.ts +108 -0
- package/dist/camera-follower-BMqPddxx.d.ts +29 -0
- package/dist/capture-failure-tracker-2Q6oI2uQ.d.ts +52 -0
- package/dist/chromium-camera-access-workaround-CU5zSKNr.d.ts +61 -0
- package/dist/community-license-key-ChZLCJyO.d.ts +21 -0
- package/dist/concurrency-p6gB30fT.d.ts +24 -0
- package/dist/css3d-renderer-manager-rgLMVAvd.d.ts +23 -0
- package/dist/depth-sampler-BNCtnEoP.d.ts +108 -0
- package/dist/failure-tracker-1sQ_Cgyw.d.ts +49 -0
- package/dist/file-system-BsQgYCU3.d.ts +128 -0
- package/dist/file-system-utils-5cWO8Xyv.d.ts +24 -0
- package/dist/format-file-size-onGq0k1Q.d.ts +24 -0
- package/dist/fused-path-DtqCSqJh.d.ts +25 -0
- package/dist/geo-types-Xx-LVcnw.d.ts +29 -0
- package/dist/gps-Ddzr2KlX.d.ts +54 -0
- package/dist/gps-compass-cubes-C-6JEnpR.d.ts +22 -0
- package/dist/gps-error-handler-VPuNOuf8.d.ts +40 -0
- package/dist/gps-event-markers-DpEy2qRd.d.ts +67 -0
- package/dist/h3-ref-point-CFhayNSZ.d.ts +59 -0
- package/dist/image-capture-2pKjYUS6.d.ts +130 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +61 -0
- package/dist/leaflet-map-overlay-CvfQXTye.d.ts +114 -0
- package/dist/lerp-utils-87NWjUOD.d.ts +20 -0
- package/dist/licensing/community-license-key.d.ts +2 -0
- package/dist/licensing/community-license-key.js +21 -0
- package/dist/licensing/index.d.ts +2 -0
- package/dist/licensing/index.js +2 -0
- package/dist/list-formatter-DKQQVLcl.d.ts +14 -0
- package/dist/logger-B81iwxx0.d.ts +74 -0
- package/dist/map-overlay-DuiZuCTx.d.ts +153 -0
- package/dist/null-storage-backend-CsWvQwN8.d.ts +11 -0
- package/dist/opfs-storage-ChOzF_Wp.d.ts +181 -0
- package/dist/opfs-storage-backend-CVcmfJHN.d.ts +11 -0
- package/dist/permission-checker-jO2ziCWC.d.ts +146 -0
- package/dist/persistence-middleware-DrptY02i.d.ts +31 -0
- package/dist/recorder-slice-fcwAXrsh.d.ts +35 -0
- package/dist/recording-coordinator-DzflP07_.d.ts +81 -0
- package/dist/recording-options-BYUFX8iU.d.ts +166 -0
- package/dist/recording-replayer-oOzPITrd.d.ts +32 -0
- package/dist/ref-point-importer-B_wn5ABk.d.ts +62 -0
- package/dist/ref-point-loader-Pt1smgHS.d.ts +117 -0
- package/dist/ref-points/h3-ref-point.d.ts +2 -0
- package/dist/ref-points/h3-ref-point.js +74 -0
- package/dist/ref-points/index.d.ts +2 -0
- package/dist/ref-points/index.js +2 -0
- package/dist/ref-points-slice-tC-Wd6XJ.d.ts +48 -0
- package/dist/reference-points-CFWy8_wj.d.ts +68 -0
- package/dist/replay-engine-DuX316ae.d.ts +103 -0
- package/dist/replay-scene-DtUm6bsr.d.ts +109 -0
- package/dist/routing-slice-BlHTM8eh.d.ts +23 -0
- package/dist/scene-node-names-DPsaE2z3.d.ts +14 -0
- package/dist/sensors/gps-error-handler.d.ts +2 -0
- package/dist/sensors/gps-error-handler.js +53 -0
- package/dist/sensors/gps.d.ts +2 -0
- package/dist/sensors/gps.js +93 -0
- package/dist/sensors/index.d.ts +4 -0
- package/dist/sensors/index.js +4 -0
- package/dist/sensors/permission-checker.d.ts +2 -0
- package/dist/sensors/permission-checker.js +397 -0
- package/dist/state/app-selectors.d.ts +2 -0
- package/dist/state/app-selectors.js +35 -0
- package/dist/state/index.d.ts +17 -0
- package/dist/state/index.js +13 -0
- package/dist/state/persistence-middleware.d.ts +2 -0
- package/dist/state/persistence-middleware.js +71 -0
- package/dist/state/recorder-slice.d.ts +2 -0
- package/dist/state/recorder-slice.js +47 -0
- package/dist/state/recording-coordinator.d.ts +2 -0
- package/dist/state/recording-coordinator.js +150 -0
- package/dist/state/recording-options.d.ts +2 -0
- package/dist/state/recording-options.js +192 -0
- package/dist/state/recording-replayer.d.ts +2 -0
- package/dist/state/recording-replayer.js +39 -0
- package/dist/state/ref-points-slice.d.ts +2 -0
- package/dist/state/ref-points-slice.js +44 -0
- package/dist/state/replay-engine.d.ts +2 -0
- package/dist/state/replay-engine.js +230 -0
- package/dist/state/routing-slice.d.ts +2 -0
- package/dist/state/routing-slice.js +13 -0
- package/dist/state/store-subscribers.d.ts +3 -0
- package/dist/state/store-subscribers.js +97 -0
- package/dist/state/store.d.ts +9 -0
- package/dist/state/store.js +71 -0
- package/dist/state/subscribe-to-selector.d.ts +2 -0
- package/dist/state/subscribe-to-selector.js +26 -0
- package/dist/storage/file-system-utils.d.ts +2 -0
- package/dist/storage/file-system-utils.js +31 -0
- package/dist/storage/file-system.d.ts +2 -0
- package/dist/storage/file-system.js +229 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/null-storage-backend.d.ts +2 -0
- package/dist/storage/null-storage-backend.js +8 -0
- package/dist/storage/opfs-storage-backend.d.ts +2 -0
- package/dist/storage/opfs-storage-backend.js +15 -0
- package/dist/storage/opfs-storage.d.ts +2 -0
- package/dist/storage/opfs-storage.js +242 -0
- package/dist/storage/ref-point-importer.d.ts +2 -0
- package/dist/storage/ref-point-importer.js +163 -0
- package/dist/storage/ref-point-loader.d.ts +2 -0
- package/dist/storage/ref-point-loader.js +248 -0
- package/dist/storage/ref-point-recovery.d.ts +28 -0
- package/dist/storage/ref-point-recovery.js +159 -0
- package/dist/storage/storage-backend.d.ts +2 -0
- package/dist/storage/storage-backend.js +1 -0
- package/dist/storage/zip-export.d.ts +2 -0
- package/dist/storage/zip-export.js +214 -0
- package/dist/storage/zip-reader.d.ts +2 -0
- package/dist/storage/zip-reader.js +190 -0
- package/dist/storage-backend-BcEItnFr.d.ts +20 -0
- package/dist/store-C7PKOj8S.d.ts +96 -0
- package/dist/store-subscribers-CuoIzB5T.d.ts +77 -0
- package/dist/subscribe-to-selector-UTZ0KkAc.d.ts +26 -0
- package/dist/test-utils/browser-mocks.d.ts +294 -0
- package/dist/test-utils/browser-mocks.js +568 -0
- package/dist/test-utils/zip-round-trip-helpers.d.ts +60 -0
- package/dist/test-utils/zip-round-trip-helpers.js +207 -0
- package/dist/three-dispose-CCBHjE_a.d.ts +30 -0
- package/dist/tracking-state-B9QfuZCg.d.ts +101 -0
- package/dist/types/ar-types.d.ts +2 -0
- package/dist/types/ar-types.js +1 -0
- package/dist/types/geo-types.d.ts +2 -0
- package/dist/types/geo-types.js +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/concurrency.d.ts +2 -0
- package/dist/utils/concurrency.js +40 -0
- package/dist/utils/failure-tracker.d.ts +2 -0
- package/dist/utils/failure-tracker.js +48 -0
- package/dist/utils/format-file-size.d.ts +2 -0
- package/dist/utils/format-file-size.js +41 -0
- package/dist/utils/fused-path.d.ts +2 -0
- package/dist/utils/fused-path.js +44 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/list-formatter.d.ts +2 -0
- package/dist/utils/list-formatter.js +17 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +226 -0
- package/dist/vis-colors-Qi2vlRGt.d.ts +63 -0
- package/dist/visualization/alignment-lerper.d.ts +2 -0
- package/dist/visualization/alignment-lerper.js +68 -0
- package/dist/visualization/camera-follower.d.ts +2 -0
- package/dist/visualization/camera-follower.js +51 -0
- package/dist/visualization/css3d-renderer-manager.d.ts +2 -0
- package/dist/visualization/css3d-renderer-manager.js +41 -0
- package/dist/visualization/gps-compass-cubes.d.ts +2 -0
- package/dist/visualization/gps-compass-cubes.js +129 -0
- package/dist/visualization/gps-event-markers.d.ts +2 -0
- package/dist/visualization/gps-event-markers.js +159 -0
- package/dist/visualization/index.d.ts +12 -0
- package/dist/visualization/index.js +12 -0
- package/dist/visualization/leaflet-map-overlay.d.ts +2 -0
- package/dist/visualization/leaflet-map-overlay.js +313 -0
- package/dist/visualization/lerp-utils.d.ts +2 -0
- package/dist/visualization/lerp-utils.js +22 -0
- package/dist/visualization/map-overlay.d.ts +2 -0
- package/dist/visualization/map-overlay.js +241 -0
- package/dist/visualization/reference-points.d.ts +2 -0
- package/dist/visualization/reference-points.js +160 -0
- package/dist/visualization/three-dispose.d.ts +2 -0
- package/dist/visualization/three-dispose.js +55 -0
- package/dist/visualization/vis-colors.d.ts +2 -0
- package/dist/visualization/vis-colors.js +74 -0
- package/dist/webxr-session-COlSrXdL.d.ts +316 -0
- package/dist/xr-camera-texture-BbukNE79.d.ts +53 -0
- package/dist/xr-error-handler-DTHfmvrl.d.ts +24 -0
- package/dist/zip-export-Rtpi75JJ.d.ts +87 -0
- package/dist/zip-reader-D7pkpX8K.d.ts +97 -0
- package/package.json +104 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { a as WebXRQuaternion, o as WebXRVec3 } from "../ar-types-B-ORgk6Z.js";
|
|
2
|
+
import { Mock } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region ../src/test-utils/browser-mocks.d.ts
|
|
5
|
+
interface MockXRViewerPose {
|
|
6
|
+
views: MockXRView[];
|
|
7
|
+
transform?: {
|
|
8
|
+
matrix: Float32Array;
|
|
9
|
+
position: DOMPointReadOnly;
|
|
10
|
+
orientation: DOMPointReadOnly;
|
|
11
|
+
inverse: XRRigidTransform | null;
|
|
12
|
+
};
|
|
13
|
+
emulatedPosition?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface MockXRView {
|
|
16
|
+
transform: {
|
|
17
|
+
position: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
w: number;
|
|
22
|
+
};
|
|
23
|
+
orientation: WebXRQuaternion;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface MockXRFrame {
|
|
27
|
+
getViewerPose: Mock<(space: unknown) => MockXRViewerPose | null>;
|
|
28
|
+
getDepthInformation?: Mock<(view: unknown) => MockDepthInfo | null>;
|
|
29
|
+
}
|
|
30
|
+
interface MockDepthInfo {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
getDepthInMeters: (x: number, y: number) => number;
|
|
34
|
+
}
|
|
35
|
+
interface MockXRSession {
|
|
36
|
+
addEventListener: Mock;
|
|
37
|
+
removeEventListener: Mock;
|
|
38
|
+
end: Mock<() => Promise<void>>;
|
|
39
|
+
requestReferenceSpace: Mock<(type: string) => Promise<unknown>>;
|
|
40
|
+
}
|
|
41
|
+
interface MockXR {
|
|
42
|
+
isSessionSupported: Mock<(mode: string) => Promise<boolean>>;
|
|
43
|
+
requestSession: Mock<(mode: string, options?: unknown) => Promise<MockXRSession>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a mock XRViewerPose with specified position and orientation.
|
|
47
|
+
*/
|
|
48
|
+
declare function createMockPose(position: WebXRVec3, orientation: WebXRQuaternion): MockXRViewerPose;
|
|
49
|
+
/**
|
|
50
|
+
* Create a mock XRFrame that returns the specified pose.
|
|
51
|
+
*/
|
|
52
|
+
declare function createMockFrame(pose: MockXRViewerPose | null): MockXRFrame;
|
|
53
|
+
/**
|
|
54
|
+
* Create a mock depth info object with configurable depth function.
|
|
55
|
+
*/
|
|
56
|
+
declare function createMockDepthInfo(depthFn?: (x: number, y: number) => number): MockDepthInfo;
|
|
57
|
+
/**
|
|
58
|
+
* Create a mock XRSession.
|
|
59
|
+
*/
|
|
60
|
+
declare function createMockXRSession(): MockXRSession;
|
|
61
|
+
/**
|
|
62
|
+
* Create a mock navigator.xr object.
|
|
63
|
+
*/
|
|
64
|
+
declare function createMockXR(supported?: boolean): MockXR;
|
|
65
|
+
/**
|
|
66
|
+
* Install WebXR mocks on the global navigator object.
|
|
67
|
+
* Returns cleanup function.
|
|
68
|
+
*/
|
|
69
|
+
declare function installWebXRMocks(supported?: boolean): () => void;
|
|
70
|
+
interface MockGeolocationPosition {
|
|
71
|
+
coords: {
|
|
72
|
+
latitude: number;
|
|
73
|
+
longitude: number;
|
|
74
|
+
altitude: number | null;
|
|
75
|
+
accuracy: number;
|
|
76
|
+
altitudeAccuracy: number | null;
|
|
77
|
+
heading: number | null;
|
|
78
|
+
speed: number | null;
|
|
79
|
+
toJSON: () => GeolocationCoordinates;
|
|
80
|
+
};
|
|
81
|
+
timestamp: number;
|
|
82
|
+
toJSON: () => GeolocationPosition;
|
|
83
|
+
}
|
|
84
|
+
interface MockGeolocation {
|
|
85
|
+
watchPosition: Mock<(success: PositionCallback, error?: PositionErrorCallback | null, options?: PositionOptions) => number>;
|
|
86
|
+
clearWatch: Mock<(id: number) => void>;
|
|
87
|
+
getCurrentPosition: Mock<(success: PositionCallback, error?: PositionErrorCallback | null, options?: PositionOptions) => void>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a mock geolocation position.
|
|
91
|
+
*/
|
|
92
|
+
declare function createMockGeoPosition(lat: number, lon: number, altitude?: number | null, accuracy?: number): MockGeolocationPosition;
|
|
93
|
+
/**
|
|
94
|
+
* Create a mock geolocation object.
|
|
95
|
+
*/
|
|
96
|
+
declare function createMockGeolocation(): MockGeolocation;
|
|
97
|
+
/**
|
|
98
|
+
* Install geolocation mocks on the global navigator object.
|
|
99
|
+
* Returns cleanup function.
|
|
100
|
+
*/
|
|
101
|
+
declare function installGeolocationMocks(): () => void;
|
|
102
|
+
interface MockDeviceOrientationEvent {
|
|
103
|
+
alpha: number | null;
|
|
104
|
+
beta: number | null;
|
|
105
|
+
gamma: number | null;
|
|
106
|
+
absolute: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create a mock DeviceOrientationEvent.
|
|
110
|
+
*/
|
|
111
|
+
declare function createMockOrientationEvent(alpha: number, beta: number, gamma: number, absolute?: boolean): MockDeviceOrientationEvent;
|
|
112
|
+
/**
|
|
113
|
+
* Create a mock DeviceOrientationEvent class with requestPermission support.
|
|
114
|
+
*/
|
|
115
|
+
declare function createMockDeviceOrientationEventClass(permissionGranted?: boolean): typeof DeviceOrientationEvent & {
|
|
116
|
+
requestPermission?: () => Promise<'granted' | 'denied'>;
|
|
117
|
+
};
|
|
118
|
+
interface MockFileSystemFileHandle {
|
|
119
|
+
kind: 'file';
|
|
120
|
+
name: string;
|
|
121
|
+
getFile: Mock<() => Promise<File>>;
|
|
122
|
+
createWritable: Mock<() => Promise<MockFileSystemWritableFileStream>>;
|
|
123
|
+
}
|
|
124
|
+
interface MockFileSystemWritableFileStream {
|
|
125
|
+
write: Mock<(data: unknown) => Promise<void>>;
|
|
126
|
+
close: Mock<() => Promise<void>>;
|
|
127
|
+
}
|
|
128
|
+
interface MockFileSystemDirectoryHandle {
|
|
129
|
+
kind: 'directory';
|
|
130
|
+
name: string;
|
|
131
|
+
entries: Mock<() => AsyncIterable<[string, MockFileSystemFileHandle | MockFileSystemDirectoryHandle]>>;
|
|
132
|
+
getFileHandle: Mock<(name: string, options?: {
|
|
133
|
+
create?: boolean;
|
|
134
|
+
}) => Promise<MockFileSystemFileHandle>>;
|
|
135
|
+
getDirectoryHandle: Mock<(name: string, options?: {
|
|
136
|
+
create?: boolean;
|
|
137
|
+
}) => Promise<MockFileSystemDirectoryHandle>>;
|
|
138
|
+
removeEntry: Mock<(name: string, options?: {
|
|
139
|
+
recursive?: boolean;
|
|
140
|
+
}) => Promise<void>>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create a mock file handle.
|
|
144
|
+
*/
|
|
145
|
+
declare function createMockFileHandle(name: string, content?: string): MockFileSystemFileHandle;
|
|
146
|
+
/**
|
|
147
|
+
* Create a mock directory handle with specified files.
|
|
148
|
+
*/
|
|
149
|
+
declare function createMockDirectoryHandle(name: string, files?: Map<string, string>, subdirs?: Map<string, MockFileSystemDirectoryHandle>): MockFileSystemDirectoryHandle;
|
|
150
|
+
/**
|
|
151
|
+
* Class-based mock FileSystemFileHandle for tests requiring mutable state.
|
|
152
|
+
* Use this when you need to modify file contents during tests.
|
|
153
|
+
*/
|
|
154
|
+
declare class MockFSFileHandle implements FileSystemFileHandle {
|
|
155
|
+
kind: "file";
|
|
156
|
+
name: string;
|
|
157
|
+
private content;
|
|
158
|
+
constructor(name: string, content?: string | Uint8Array);
|
|
159
|
+
getFile(): Promise<File>;
|
|
160
|
+
createWritable(): Promise<FileSystemWritableFileStream>;
|
|
161
|
+
createSyncAccessHandle(): Promise<unknown>;
|
|
162
|
+
isSameEntry(): Promise<boolean>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Class-based mock FileSystemDirectoryHandle for tests requiring addFile/addDirectory.
|
|
166
|
+
* Implements the full FileSystemDirectoryHandle interface.
|
|
167
|
+
*/
|
|
168
|
+
declare class MockFSDirectoryHandle implements FileSystemDirectoryHandle {
|
|
169
|
+
kind: "directory";
|
|
170
|
+
name: string;
|
|
171
|
+
private contents;
|
|
172
|
+
constructor(name: string);
|
|
173
|
+
/**
|
|
174
|
+
* Add a file to this directory.
|
|
175
|
+
* Accepts string content (for JSON etc) or Uint8Array (for zip bytes).
|
|
176
|
+
*/
|
|
177
|
+
addFile(name: string, content: string | Uint8Array): void;
|
|
178
|
+
/**
|
|
179
|
+
* Add a subdirectory to this directory.
|
|
180
|
+
*/
|
|
181
|
+
addDirectory(name: string, handle: FileSystemDirectoryHandle): void;
|
|
182
|
+
entries(): AsyncGenerator<[string, FileSystemDirectoryHandle | FileSystemFileHandle], undefined, unknown>;
|
|
183
|
+
[Symbol.asyncIterator](): AsyncGenerator<[string, FileSystemDirectoryHandle | FileSystemFileHandle], undefined, unknown>;
|
|
184
|
+
getDirectoryHandle(name: string, options?: {
|
|
185
|
+
create?: boolean;
|
|
186
|
+
}): Promise<FileSystemDirectoryHandle>;
|
|
187
|
+
getFileHandle(name: string, options?: {
|
|
188
|
+
create?: boolean;
|
|
189
|
+
}): Promise<FileSystemFileHandle>;
|
|
190
|
+
removeEntry(name: string): Promise<void>;
|
|
191
|
+
resolve(): Promise<string[] | null>;
|
|
192
|
+
isSameEntry(): Promise<boolean>;
|
|
193
|
+
values(): AsyncGenerator<FileSystemDirectoryHandle | FileSystemFileHandle, undefined, unknown>;
|
|
194
|
+
keys(): AsyncGenerator<string, undefined, unknown>;
|
|
195
|
+
queryPermission(_descriptor?: {
|
|
196
|
+
mode?: 'read' | 'readwrite';
|
|
197
|
+
}): Promise<PermissionState>;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Install File System Access API mocks on the global window object.
|
|
201
|
+
* Returns cleanup function.
|
|
202
|
+
*/
|
|
203
|
+
declare function installFileSystemMocks(rootDir?: MockFileSystemDirectoryHandle): () => void;
|
|
204
|
+
/**
|
|
205
|
+
* Install all browser mocks at once.
|
|
206
|
+
* Returns cleanup function.
|
|
207
|
+
*/
|
|
208
|
+
declare function installAllBrowserMocks(options?: {
|
|
209
|
+
webxrSupported?: boolean;
|
|
210
|
+
geolocation?: boolean;
|
|
211
|
+
fileSystem?: boolean;
|
|
212
|
+
rootDir?: MockFileSystemDirectoryHandle;
|
|
213
|
+
}): () => void;
|
|
214
|
+
/**
|
|
215
|
+
* In-memory file system for OPFS mocking.
|
|
216
|
+
* Stores file contents as ArrayBuffer for binary compatibility.
|
|
217
|
+
*/
|
|
218
|
+
declare class MockOPFSDirectoryHandle implements FileSystemDirectoryHandle {
|
|
219
|
+
kind: "directory";
|
|
220
|
+
name: string;
|
|
221
|
+
private contents;
|
|
222
|
+
private fileContents;
|
|
223
|
+
constructor(name: string);
|
|
224
|
+
/**
|
|
225
|
+
* Get stored file content (for test assertions).
|
|
226
|
+
*/
|
|
227
|
+
getStoredContent(fileName: string): ArrayBuffer | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* Get stored file content as string (for test assertions).
|
|
230
|
+
*/
|
|
231
|
+
getStoredContentAsString(fileName: string): string | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Set file content directly (for test setup).
|
|
234
|
+
* Also ensures a corresponding file handle exists in contents map
|
|
235
|
+
* so that getFileHandle() and iterators work correctly.
|
|
236
|
+
*/
|
|
237
|
+
setStoredContent(fileName: string, content: string | ArrayBuffer): void;
|
|
238
|
+
entries(): AsyncGenerator<[string, FileSystemDirectoryHandle | FileSystemFileHandle], undefined, unknown>;
|
|
239
|
+
[Symbol.asyncIterator](): AsyncGenerator<[string, FileSystemDirectoryHandle | FileSystemFileHandle], undefined, unknown>;
|
|
240
|
+
getDirectoryHandle(name: string, options?: {
|
|
241
|
+
create?: boolean;
|
|
242
|
+
}): Promise<FileSystemDirectoryHandle>;
|
|
243
|
+
getFileHandle(name: string, options?: {
|
|
244
|
+
create?: boolean;
|
|
245
|
+
}): Promise<FileSystemFileHandle>;
|
|
246
|
+
removeEntry(name: string): Promise<void>;
|
|
247
|
+
resolve(): Promise<string[] | null>;
|
|
248
|
+
isSameEntry(): Promise<boolean>;
|
|
249
|
+
values(): AsyncGenerator<FileSystemDirectoryHandle | FileSystemFileHandle, undefined, unknown>;
|
|
250
|
+
keys(): AsyncGenerator<string, undefined, unknown>;
|
|
251
|
+
queryPermission(_descriptor?: {
|
|
252
|
+
mode?: 'read' | 'readwrite';
|
|
253
|
+
}): Promise<PermissionState>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Mock OPFS file handle with writable stream support.
|
|
257
|
+
*/
|
|
258
|
+
declare class MockOPFSFileHandle implements FileSystemFileHandle {
|
|
259
|
+
kind: "file";
|
|
260
|
+
name: string;
|
|
261
|
+
private parentDir;
|
|
262
|
+
private storageKey;
|
|
263
|
+
constructor(name: string, parentDir: MockOPFSDirectoryHandle, storageKey: string);
|
|
264
|
+
getFile(): Promise<File>;
|
|
265
|
+
createWritable(): Promise<FileSystemWritableFileStream>;
|
|
266
|
+
createSyncAccessHandle(): Promise<unknown>;
|
|
267
|
+
isSameEntry(): Promise<boolean>;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Mock navigator.storage for OPFS support.
|
|
271
|
+
*/
|
|
272
|
+
interface MockStorageManager {
|
|
273
|
+
getDirectory: () => Promise<FileSystemDirectoryHandle>;
|
|
274
|
+
estimate: () => Promise<{
|
|
275
|
+
quota: number;
|
|
276
|
+
usage: number;
|
|
277
|
+
}>;
|
|
278
|
+
persist: () => Promise<boolean>;
|
|
279
|
+
persisted: () => Promise<boolean>;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Create a mock StorageManager with OPFS support.
|
|
283
|
+
*/
|
|
284
|
+
declare function createMockStorageManager(opfsRoot?: MockOPFSDirectoryHandle): MockStorageManager;
|
|
285
|
+
/**
|
|
286
|
+
* Install OPFS mocks on the global navigator object.
|
|
287
|
+
* Returns the mock OPFS root directory for test assertions and cleanup function.
|
|
288
|
+
*/
|
|
289
|
+
declare function installOPFSMocks(opfsRoot?: MockOPFSDirectoryHandle): {
|
|
290
|
+
root: MockOPFSDirectoryHandle;
|
|
291
|
+
cleanup: () => void;
|
|
292
|
+
};
|
|
293
|
+
//#endregion
|
|
294
|
+
export { MockDepthInfo, MockDeviceOrientationEvent, MockFSDirectoryHandle, MockFSFileHandle, MockFileSystemDirectoryHandle, MockFileSystemFileHandle, MockFileSystemWritableFileStream, MockGeolocation, MockGeolocationPosition, MockOPFSDirectoryHandle, MockOPFSFileHandle, MockStorageManager, MockXR, MockXRFrame, MockXRSession, MockXRView, MockXRViewerPose, createMockDepthInfo, createMockDeviceOrientationEventClass, createMockDirectoryHandle, createMockFileHandle, createMockFrame, createMockGeoPosition, createMockGeolocation, createMockOrientationEvent, createMockPose, createMockStorageManager, createMockXR, createMockXRSession, installAllBrowserMocks, installFileSystemMocks, installGeolocationMocks, installOPFSMocks, installWebXRMocks };
|