native-fn 1.2.2 → 1.3.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/README.md +32 -8
- package/dist/index.d.ts +42 -21
- package/dist/native.cjs +412 -110
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +412 -110
- package/dist/native.umd.js +412 -110
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +16 -18
- package/dist/plugin/appearance/index.d.ts +2 -2
- package/dist/plugin/appearance/index.mjs +17 -19
- package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/appearance/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/appearance/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/appearance/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/appearance/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/badge/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/badge/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/badge/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/badge/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/badge/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/badge/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/badge/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/battery/index.cjs +4 -6
- package/dist/plugin/battery/index.mjs +4 -6
- package/dist/plugin/battery/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/battery/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/battery/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/battery/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/battery/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/battery/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/battery/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/clipboard/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/clipboard/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/clipboard/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/clipboard/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/dimension/index.cjs +456 -97
- package/dist/plugin/dimension/index.d.ts +45 -24
- package/dist/plugin/dimension/index.mjs +457 -97
- package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/dimension/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/dimension/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/dimension/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/dimension/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/fullscreen/index.cjs +9 -11
- package/dist/plugin/fullscreen/index.mjs +9 -11
- package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/fullscreen/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/fullscreen/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/fullscreen/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/geolocation/index.cjs +4 -6
- package/dist/plugin/geolocation/index.mjs +4 -6
- package/dist/plugin/geolocation/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/geolocation/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/geolocation/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/geolocation/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/geolocation/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/geolocation/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/geolocation/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/notification/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/notification/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/notification/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/notification/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/notification/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/notification/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/notification/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/open/index.cjs +6 -6
- package/dist/plugin/open/index.d.ts +16 -0
- package/dist/plugin/open/index.mjs +6 -6
- package/dist/plugin/open/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/open/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/open/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/open/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/open/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/open/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/open/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/open/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/permission/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/permission/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/permission/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/permission/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/permission/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/permission/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/permission/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/pip/index.cjs +9 -11
- package/dist/plugin/pip/index.mjs +9 -11
- package/dist/plugin/pip/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/pip/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/pip/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/pip/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/pip/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/pip/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/pip/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/platform/index.cjs +11 -12
- package/dist/plugin/platform/index.d.ts +17 -1
- package/dist/plugin/platform/index.mjs +5 -5
- package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/platform/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/platform/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/platform/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/platform/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/theme/index.cjs +5 -5
- package/dist/plugin/theme/index.mjs +5 -5
- package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/theme/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/theme/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/theme/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/theme/src/utils/insert-sort.d.ts +1 -0
- package/dist/plugin/vibration/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/plugin/vibration/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/plugin/vibration/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/plugin/vibration/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/plugin/vibration/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/plugin/vibration/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/plugin/vibration/src/utils/insert-sort.d.ts +1 -0
- package/dist/src/plugin/appearance/constants/index.d.ts +1 -1
- package/dist/src/plugin/dimension/constants/index.d.ts +2 -3
- package/dist/src/plugin/dimension/cores/index.d.ts +15 -0
- package/dist/src/plugin/dimension/types/dimensions.d.ts +26 -20
- package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +16 -7
- package/dist/src/plugin/dimension/utils/create-environment-observer.d.ts +33 -0
- package/dist/src/plugin/platform/constants/index.d.ts +1 -1
- package/dist/src/utils/insert-sort.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { ENV_PRESETS, Orientation } from "../constants";
|
|
2
2
|
export type EnvironmentPresetKey = keyof typeof ENV_PRESETS;
|
|
3
|
-
export type
|
|
3
|
+
export type EnvironmentPresetAttribute<K extends EnvironmentPresetKey> = keyof typeof ENV_PRESETS[K];
|
|
4
4
|
export type EnvironmentPresetValues<K extends EnvironmentPresetKey> = {
|
|
5
|
-
[P in
|
|
5
|
+
[P in EnvironmentPresetAttribute<K>]: number;
|
|
6
6
|
};
|
|
7
|
-
export declare interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export declare interface Environment {
|
|
8
|
+
safeAreaInset: EnvironmentObserver<'safe-area-inset'>;
|
|
9
|
+
safeAreaMaxInset: EnvironmentObserver<'safe-area-max-inset'>;
|
|
10
|
+
keyboardInset: EnvironmentObserver<'keyboard-inset'>;
|
|
11
|
+
titlebarArea: EnvironmentObserver<'titlebar-area'>;
|
|
12
|
+
viewportSegment: EnvironmentObserver<'viewport-segment'>;
|
|
13
|
+
}
|
|
14
|
+
export declare interface SegmentsObserver {
|
|
15
|
+
get value(): EnvironmentPresetValues<'viewport-segment'>[];
|
|
16
|
+
onChange(listener: (value: EnvironmentPresetValues<'viewport-segment'>[]) => void, options?: AddEventListenerOptions): () => void;
|
|
17
|
+
useCssVariable(prefix: string): () => void;
|
|
15
18
|
}
|
|
19
|
+
export declare type EnvironmentObserver<K extends EnvironmentPresetKey> = K extends 'viewport-segment' ? SegmentsObserver : {
|
|
20
|
+
get value(): EnvironmentPresetValues<K>;
|
|
21
|
+
onChange(listener: (value: EnvironmentPresetValues<K>) => void, options?: AddEventListenerOptions): () => void;
|
|
22
|
+
useCssVariable(prefix: string): () => void;
|
|
23
|
+
};
|
|
16
24
|
export declare interface Dimensions {
|
|
17
25
|
outerWidth: number;
|
|
18
26
|
outerHeight: number;
|
|
@@ -21,14 +29,12 @@ export declare interface Dimensions {
|
|
|
21
29
|
scale: number;
|
|
22
30
|
orientation: Orientation;
|
|
23
31
|
}
|
|
24
|
-
export declare interface
|
|
25
|
-
get value():
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
titlebarArea: EnvironmentPreset<'titlebar-area'>;
|
|
33
|
-
viewportSegment: EnvironmentPreset<'viewport-segment'>;
|
|
32
|
+
export declare interface DimensionInstance {
|
|
33
|
+
get value(): Dimensions;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
onChange(listener: (dimension: Dimensions) => void, options?: AddEventListenerOptions): () => void;
|
|
36
|
+
Constants: {
|
|
37
|
+
Orientation: typeof Orientation;
|
|
38
|
+
};
|
|
39
|
+
Errors: {};
|
|
34
40
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnvironmentObserver, EnvironmentPresetKey } from "../types";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Navigator {
|
|
4
4
|
readonly virtualKeyboard?: VirtualKeyboard;
|
|
5
|
+
readonly devicePosture?: DevicePosture;
|
|
5
6
|
}
|
|
7
|
+
var viewport: BrowsingContextViewport | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface DevicePosture extends EventTarget {
|
|
10
|
+
readonly type: 'continuous' | 'folded';
|
|
11
|
+
onchange: ((this: DevicePosture, ev: Event) => any) | null;
|
|
6
12
|
}
|
|
7
|
-
type ChangeCallback<K extends EnvironmentPresetKey> = (values: EnvironmentPresetValues<K>) => void;
|
|
8
13
|
interface VirtualKeyboardEventMap {
|
|
9
14
|
geometrychange: Event;
|
|
10
15
|
}
|
|
@@ -16,9 +21,13 @@ interface VirtualKeyboard extends EventTarget {
|
|
|
16
21
|
addEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: AddEventListenerOptions): void;
|
|
17
22
|
removeEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
interface BrowsingContextViewportEventMap {
|
|
25
|
+
change: Event;
|
|
26
|
+
}
|
|
27
|
+
interface BrowsingContextViewport extends EventTarget {
|
|
28
|
+
readonly segments: ReadonlyArray<DOMRectReadOnly> | null;
|
|
29
|
+
addEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
30
|
+
removeEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
31
|
+
}
|
|
32
|
+
export default function createEnvObserver<K extends EnvironmentPresetKey>(preset: K): EnvironmentObserver<K>;
|
|
24
33
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EnvironmentObserver, EnvironmentPresetKey } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Navigator {
|
|
4
|
+
readonly virtualKeyboard?: VirtualKeyboard;
|
|
5
|
+
readonly devicePosture?: DevicePosture;
|
|
6
|
+
}
|
|
7
|
+
var viewport: BrowsingContextViewport | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface DevicePosture extends EventTarget {
|
|
10
|
+
readonly type: 'continuous' | 'folded';
|
|
11
|
+
onchange: ((this: DevicePosture, ev: Event) => any) | null;
|
|
12
|
+
}
|
|
13
|
+
interface VirtualKeyboardEventMap {
|
|
14
|
+
geometrychange: Event;
|
|
15
|
+
}
|
|
16
|
+
interface VirtualKeyboard extends EventTarget {
|
|
17
|
+
readonly boundingRect: DOMRect;
|
|
18
|
+
overlaysContent: boolean;
|
|
19
|
+
show(): void;
|
|
20
|
+
hide(): void;
|
|
21
|
+
addEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: AddEventListenerOptions): void;
|
|
22
|
+
removeEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
23
|
+
}
|
|
24
|
+
interface BrowsingContextViewportEventMap {
|
|
25
|
+
change: Event;
|
|
26
|
+
}
|
|
27
|
+
interface BrowsingContextViewport extends EventTarget {
|
|
28
|
+
readonly segments: ReadonlyArray<DOMRectReadOnly> | null;
|
|
29
|
+
addEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
30
|
+
removeEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
31
|
+
}
|
|
32
|
+
export default function createEnvironmentObserver<K extends EnvironmentPresetKey>(preset: K): EnvironmentObserver<K>;
|
|
33
|
+
export {};
|
|
@@ -34,7 +34,7 @@ export declare enum Browsers {
|
|
|
34
34
|
IE = "IE",
|
|
35
35
|
SamsungInternet = "SamsungInternet"
|
|
36
36
|
}
|
|
37
|
-
export declare
|
|
37
|
+
export declare let USER_AGENT: string;
|
|
38
38
|
export declare const HIGH_ENTROPY_BRAND_NAME_MAP: Record<string, string>;
|
|
39
39
|
export declare const RTL_LANGUAGES: string[];
|
|
40
40
|
export declare const OS_RESOLVER_MAP: [RegExp, OS, VersionResolver?][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function insertionSort(arr: number[]): void;
|
|
@@ -233,6 +233,8 @@ function createSubscriptionManager(attach, detach) {
|
|
|
233
233
|
},
|
|
234
234
|
subscribe: function (listener, options) {
|
|
235
235
|
if (options === void 0) { options = {}; }
|
|
236
|
+
if (typeof options.signal !== 'undefined' && options.signal.aborted)
|
|
237
|
+
return function () { };
|
|
236
238
|
var entry = { fn: listener, once: false };
|
|
237
239
|
if (typeof options.once !== 'undefined')
|
|
238
240
|
entry.once = options.once;
|
|
@@ -251,12 +253,8 @@ function createSubscriptionManager(attach, detach) {
|
|
|
251
253
|
EventListener.remove(entry.signal, { type: 'abort', callback: cleanup });
|
|
252
254
|
removeEntry(entry);
|
|
253
255
|
};
|
|
254
|
-
if (typeof entry.signal !== 'undefined')
|
|
255
|
-
|
|
256
|
-
removeEntry(entry);
|
|
257
|
-
else
|
|
258
|
-
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
259
|
-
}
|
|
256
|
+
if (typeof entry.signal !== 'undefined')
|
|
257
|
+
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
260
258
|
return function unsubscribe() {
|
|
261
259
|
removeEntry(entry);
|
|
262
260
|
};
|
|
@@ -439,11 +437,11 @@ var Browsers;
|
|
|
439
437
|
Browsers["IE"] = "IE";
|
|
440
438
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
441
439
|
})(Browsers || (Browsers = {}));
|
|
442
|
-
var USER_AGENT
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
440
|
+
var USER_AGENT;
|
|
441
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
442
|
+
USER_AGENT = globalThis.navigator.userAgent;
|
|
443
|
+
else
|
|
444
|
+
USER_AGENT = '';
|
|
447
445
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
448
446
|
'Google Chrome': 'Chrome',
|
|
449
447
|
'Microsoft Edge': 'Edge',
|
|
@@ -231,6 +231,8 @@ function createSubscriptionManager(attach, detach) {
|
|
|
231
231
|
},
|
|
232
232
|
subscribe: function (listener, options) {
|
|
233
233
|
if (options === void 0) { options = {}; }
|
|
234
|
+
if (typeof options.signal !== 'undefined' && options.signal.aborted)
|
|
235
|
+
return function () { };
|
|
234
236
|
var entry = { fn: listener, once: false };
|
|
235
237
|
if (typeof options.once !== 'undefined')
|
|
236
238
|
entry.once = options.once;
|
|
@@ -249,12 +251,8 @@ function createSubscriptionManager(attach, detach) {
|
|
|
249
251
|
EventListener.remove(entry.signal, { type: 'abort', callback: cleanup });
|
|
250
252
|
removeEntry(entry);
|
|
251
253
|
};
|
|
252
|
-
if (typeof entry.signal !== 'undefined')
|
|
253
|
-
|
|
254
|
-
removeEntry(entry);
|
|
255
|
-
else
|
|
256
|
-
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
257
|
-
}
|
|
254
|
+
if (typeof entry.signal !== 'undefined')
|
|
255
|
+
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
258
256
|
return function unsubscribe() {
|
|
259
257
|
removeEntry(entry);
|
|
260
258
|
};
|
|
@@ -437,11 +435,11 @@ var Browsers;
|
|
|
437
435
|
Browsers["IE"] = "IE";
|
|
438
436
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
439
437
|
})(Browsers || (Browsers = {}));
|
|
440
|
-
var USER_AGENT
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
438
|
+
var USER_AGENT;
|
|
439
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
440
|
+
USER_AGENT = globalThis.navigator.userAgent;
|
|
441
|
+
else
|
|
442
|
+
USER_AGENT = '';
|
|
445
443
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
446
444
|
'Google Chrome': 'Chrome',
|
|
447
445
|
'Microsoft Edge': 'Edge',
|
|
@@ -3,6 +3,6 @@ export declare enum Appearances {
|
|
|
3
3
|
Light = "light",
|
|
4
4
|
Dark = "dark"
|
|
5
5
|
}
|
|
6
|
-
export declare let
|
|
6
|
+
export declare let PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST: MediaQueryList;
|
|
7
7
|
export declare const CONTEXT: CanvasRenderingContext2D | null;
|
|
8
8
|
export declare const SVG_PIXEL_DATA_URL: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Dimensions } from "../types";
|
|
2
1
|
export declare enum Orientation {
|
|
3
2
|
Portrait = "portrait",
|
|
4
3
|
Landscape = "landscape",
|
|
@@ -40,5 +39,5 @@ export declare const ENV_PRESETS: {
|
|
|
40
39
|
readonly left: "viewport-segment-left";
|
|
41
40
|
};
|
|
42
41
|
};
|
|
43
|
-
export declare
|
|
44
|
-
export declare let
|
|
42
|
+
export declare let ORIENTATION_MEDIA_QUERY_LIST: MediaQueryList;
|
|
43
|
+
export declare let DEVICE_POSTURE_MEDIA_QUERY_LIST: MediaQueryList;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { DimensionInstance } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface DOMRectReadOnly {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly width: number;
|
|
7
|
+
readonly height: number;
|
|
8
|
+
readonly top: number;
|
|
9
|
+
readonly right: number;
|
|
10
|
+
readonly bottom: number;
|
|
11
|
+
readonly left: number;
|
|
12
|
+
}
|
|
13
|
+
interface VisualViewport {
|
|
14
|
+
readonly segments?: DOMRectReadOnly[];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
declare const Dimension: DimensionInstance;
|
|
3
18
|
export default Dimension;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { ENV_PRESETS, Orientation } from "../constants";
|
|
2
2
|
export type EnvironmentPresetKey = keyof typeof ENV_PRESETS;
|
|
3
|
-
export type
|
|
3
|
+
export type EnvironmentPresetAttribute<K extends EnvironmentPresetKey> = keyof typeof ENV_PRESETS[K];
|
|
4
4
|
export type EnvironmentPresetValues<K extends EnvironmentPresetKey> = {
|
|
5
|
-
[P in
|
|
5
|
+
[P in EnvironmentPresetAttribute<K>]: number;
|
|
6
6
|
};
|
|
7
|
-
export declare interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export declare interface Environment {
|
|
8
|
+
safeAreaInset: EnvironmentObserver<'safe-area-inset'>;
|
|
9
|
+
safeAreaMaxInset: EnvironmentObserver<'safe-area-max-inset'>;
|
|
10
|
+
keyboardInset: EnvironmentObserver<'keyboard-inset'>;
|
|
11
|
+
titlebarArea: EnvironmentObserver<'titlebar-area'>;
|
|
12
|
+
viewportSegment: EnvironmentObserver<'viewport-segment'>;
|
|
13
|
+
}
|
|
14
|
+
export declare interface SegmentsObserver {
|
|
15
|
+
get value(): EnvironmentPresetValues<'viewport-segment'>[];
|
|
16
|
+
onChange(listener: (value: EnvironmentPresetValues<'viewport-segment'>[]) => void, options?: AddEventListenerOptions): () => void;
|
|
17
|
+
useCssVariable(prefix: string): () => void;
|
|
15
18
|
}
|
|
19
|
+
export declare type EnvironmentObserver<K extends EnvironmentPresetKey> = K extends 'viewport-segment' ? SegmentsObserver : {
|
|
20
|
+
get value(): EnvironmentPresetValues<K>;
|
|
21
|
+
onChange(listener: (value: EnvironmentPresetValues<K>) => void, options?: AddEventListenerOptions): () => void;
|
|
22
|
+
useCssVariable(prefix: string): () => void;
|
|
23
|
+
};
|
|
16
24
|
export declare interface Dimensions {
|
|
17
25
|
outerWidth: number;
|
|
18
26
|
outerHeight: number;
|
|
@@ -21,14 +29,12 @@ export declare interface Dimensions {
|
|
|
21
29
|
scale: number;
|
|
22
30
|
orientation: Orientation;
|
|
23
31
|
}
|
|
24
|
-
export declare interface
|
|
25
|
-
get value():
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
titlebarArea: EnvironmentPreset<'titlebar-area'>;
|
|
33
|
-
viewportSegment: EnvironmentPreset<'viewport-segment'>;
|
|
32
|
+
export declare interface DimensionInstance {
|
|
33
|
+
get value(): Dimensions;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
onChange(listener: (dimension: Dimensions) => void, options?: AddEventListenerOptions): () => void;
|
|
36
|
+
Constants: {
|
|
37
|
+
Orientation: typeof Orientation;
|
|
38
|
+
};
|
|
39
|
+
Errors: {};
|
|
34
40
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnvironmentObserver, EnvironmentPresetKey } from "../types";
|
|
2
2
|
declare global {
|
|
3
3
|
interface Navigator {
|
|
4
4
|
readonly virtualKeyboard?: VirtualKeyboard;
|
|
5
|
+
readonly devicePosture?: DevicePosture;
|
|
5
6
|
}
|
|
7
|
+
var viewport: BrowsingContextViewport | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface DevicePosture extends EventTarget {
|
|
10
|
+
readonly type: 'continuous' | 'folded';
|
|
11
|
+
onchange: ((this: DevicePosture, ev: Event) => any) | null;
|
|
6
12
|
}
|
|
7
|
-
type ChangeCallback<K extends EnvironmentPresetKey> = (values: EnvironmentPresetValues<K>) => void;
|
|
8
13
|
interface VirtualKeyboardEventMap {
|
|
9
14
|
geometrychange: Event;
|
|
10
15
|
}
|
|
@@ -16,9 +21,13 @@ interface VirtualKeyboard extends EventTarget {
|
|
|
16
21
|
addEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: AddEventListenerOptions): void;
|
|
17
22
|
removeEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
interface BrowsingContextViewportEventMap {
|
|
25
|
+
change: Event;
|
|
26
|
+
}
|
|
27
|
+
interface BrowsingContextViewport extends EventTarget {
|
|
28
|
+
readonly segments: ReadonlyArray<DOMRectReadOnly> | null;
|
|
29
|
+
addEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
30
|
+
removeEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
31
|
+
}
|
|
32
|
+
export default function createEnvObserver<K extends EnvironmentPresetKey>(preset: K): EnvironmentObserver<K>;
|
|
24
33
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EnvironmentObserver, EnvironmentPresetKey } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Navigator {
|
|
4
|
+
readonly virtualKeyboard?: VirtualKeyboard;
|
|
5
|
+
readonly devicePosture?: DevicePosture;
|
|
6
|
+
}
|
|
7
|
+
var viewport: BrowsingContextViewport | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface DevicePosture extends EventTarget {
|
|
10
|
+
readonly type: 'continuous' | 'folded';
|
|
11
|
+
onchange: ((this: DevicePosture, ev: Event) => any) | null;
|
|
12
|
+
}
|
|
13
|
+
interface VirtualKeyboardEventMap {
|
|
14
|
+
geometrychange: Event;
|
|
15
|
+
}
|
|
16
|
+
interface VirtualKeyboard extends EventTarget {
|
|
17
|
+
readonly boundingRect: DOMRect;
|
|
18
|
+
overlaysContent: boolean;
|
|
19
|
+
show(): void;
|
|
20
|
+
hide(): void;
|
|
21
|
+
addEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: AddEventListenerOptions): void;
|
|
22
|
+
removeEventListener<K extends keyof VirtualKeyboardEventMap>(type: K, listener: (this: VirtualKeyboard, ev: VirtualKeyboardEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
23
|
+
}
|
|
24
|
+
interface BrowsingContextViewportEventMap {
|
|
25
|
+
change: Event;
|
|
26
|
+
}
|
|
27
|
+
interface BrowsingContextViewport extends EventTarget {
|
|
28
|
+
readonly segments: ReadonlyArray<DOMRectReadOnly> | null;
|
|
29
|
+
addEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
30
|
+
removeEventListener<K extends keyof BrowsingContextViewportEventMap>(type: K, listener: (this: BrowsingContextViewport, ev: BrowsingContextViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
31
|
+
}
|
|
32
|
+
export default function createEnvironmentObserver<K extends EnvironmentPresetKey>(preset: K): EnvironmentObserver<K>;
|
|
33
|
+
export {};
|
|
@@ -34,7 +34,7 @@ export declare enum Browsers {
|
|
|
34
34
|
IE = "IE",
|
|
35
35
|
SamsungInternet = "SamsungInternet"
|
|
36
36
|
}
|
|
37
|
-
export declare
|
|
37
|
+
export declare let USER_AGENT: string;
|
|
38
38
|
export declare const HIGH_ENTROPY_BRAND_NAME_MAP: Record<string, string>;
|
|
39
39
|
export declare const RTL_LANGUAGES: string[];
|
|
40
40
|
export declare const OS_RESOLVER_MAP: [RegExp, OS, VersionResolver?][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function insertionSort(arr: number[]): void;
|
|
@@ -91,11 +91,11 @@ exports.Browsers = void 0;
|
|
|
91
91
|
Browsers["IE"] = "IE";
|
|
92
92
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
93
93
|
})(exports.Browsers || (exports.Browsers = {}));
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
exports.USER_AGENT = void 0;
|
|
95
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
96
|
+
exports.USER_AGENT = globalThis.navigator.userAgent;
|
|
97
|
+
else
|
|
98
|
+
exports.USER_AGENT = '';
|
|
99
99
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
100
100
|
'Google Chrome': 'Chrome',
|
|
101
101
|
'Microsoft Edge': 'Edge',
|
|
@@ -370,7 +370,7 @@ var EventListener = {
|
|
|
370
370
|
},
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
-
var currentUserAgent = USER_AGENT;
|
|
373
|
+
var currentUserAgent = exports.USER_AGENT;
|
|
374
374
|
var parsedCache = null;
|
|
375
375
|
var parsedFromHighEntropyValuesOS = {};
|
|
376
376
|
var parsedFromHighEntropyValuesBrowser = {};
|
|
@@ -457,7 +457,7 @@ function parseOS() {
|
|
|
457
457
|
result.version = version[1];
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
if (currentUserAgent === USER_AGENT) {
|
|
460
|
+
if (currentUserAgent === exports.USER_AGENT) {
|
|
461
461
|
if (typeof parsedFromHighEntropyValuesOS.name !== 'undefined')
|
|
462
462
|
result.name = parsedFromHighEntropyValuesOS.name;
|
|
463
463
|
if (typeof parsedFromHighEntropyValuesOS.version !== 'undefined')
|
|
@@ -478,7 +478,7 @@ function parseBrowser() {
|
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
if (currentUserAgent === USER_AGENT) {
|
|
481
|
+
if (currentUserAgent === exports.USER_AGENT) {
|
|
482
482
|
if (typeof parsedFromHighEntropyValuesBrowser.name !== 'undefined')
|
|
483
483
|
result.name = parsedFromHighEntropyValuesBrowser.name;
|
|
484
484
|
if (typeof parsedFromHighEntropyValuesBrowser.version !== 'undefined')
|
|
@@ -497,7 +497,7 @@ function parseEngine() {
|
|
|
497
497
|
break;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
if (currentUserAgent === USER_AGENT) {
|
|
500
|
+
if (currentUserAgent === exports.USER_AGENT) {
|
|
501
501
|
if (typeof parsedFromHighEntropyValuesEngine.name !== 'undefined')
|
|
502
502
|
result.name = parsedFromHighEntropyValuesEngine.name;
|
|
503
503
|
if (typeof parsedFromHighEntropyValuesEngine.version !== 'undefined')
|
|
@@ -596,7 +596,7 @@ function getLocale() {
|
|
|
596
596
|
return cachedLocale;
|
|
597
597
|
}
|
|
598
598
|
function getDevice() {
|
|
599
|
-
if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
599
|
+
if (currentUserAgent === exports.USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
600
600
|
return parsedFromHighEntropyValuesDevice;
|
|
601
601
|
var osName = getParsedCache().os.name;
|
|
602
602
|
if (osName === exports.OS.iOS || osName === exports.OS.Android)
|
|
@@ -734,7 +734,7 @@ var Platform = {
|
|
|
734
734
|
return;
|
|
735
735
|
currentUserAgent = value;
|
|
736
736
|
invalidateCache();
|
|
737
|
-
if (value === USER_AGENT) {
|
|
737
|
+
if (value === exports.USER_AGENT) {
|
|
738
738
|
ready = Promise.all([
|
|
739
739
|
parseFromHighEntropyValues(),
|
|
740
740
|
parseFromNavigatorGPU(),
|
|
@@ -774,5 +774,4 @@ exports.ENGINE_RESOLVER_MAP = ENGINE_RESOLVER_MAP;
|
|
|
774
774
|
exports.HIGH_ENTROPY_BRAND_NAME_MAP = HIGH_ENTROPY_BRAND_NAME_MAP;
|
|
775
775
|
exports.OS_RESOLVER_MAP = OS_RESOLVER_MAP;
|
|
776
776
|
exports.RTL_LANGUAGES = RTL_LANGUAGES;
|
|
777
|
-
exports.USER_AGENT = USER_AGENT;
|
|
778
777
|
exports.default = Platform;
|
|
@@ -33,7 +33,7 @@ declare enum Browsers {
|
|
|
33
33
|
IE = "IE",
|
|
34
34
|
SamsungInternet = "SamsungInternet"
|
|
35
35
|
}
|
|
36
|
-
declare
|
|
36
|
+
declare let USER_AGENT: string;
|
|
37
37
|
declare const HIGH_ENTROPY_BRAND_NAME_MAP: Record<string, string>;
|
|
38
38
|
declare const RTL_LANGUAGES: string[];
|
|
39
39
|
declare const OS_RESOLVER_MAP: [RegExp, OS, VersionResolver?][];
|
|
@@ -57,6 +57,22 @@ interface BatteryManager extends EventTarget {
|
|
|
57
57
|
onlevelchange: ((this: BatteryManager, ev: Event) => any) | null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
declare global {
|
|
61
|
+
interface DOMRectReadOnly {
|
|
62
|
+
readonly x: number;
|
|
63
|
+
readonly y: number;
|
|
64
|
+
readonly width: number;
|
|
65
|
+
readonly height: number;
|
|
66
|
+
readonly top: number;
|
|
67
|
+
readonly right: number;
|
|
68
|
+
readonly bottom: number;
|
|
69
|
+
readonly left: number;
|
|
70
|
+
}
|
|
71
|
+
interface VisualViewport {
|
|
72
|
+
readonly segments?: DOMRectReadOnly[];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
declare global {
|
|
61
77
|
interface HTMLVideoElement {
|
|
62
78
|
webkitEnterFullscreen?: () => void;
|
|
@@ -87,11 +87,11 @@ var Browsers;
|
|
|
87
87
|
Browsers["IE"] = "IE";
|
|
88
88
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
89
89
|
})(Browsers || (Browsers = {}));
|
|
90
|
-
var USER_AGENT
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
var USER_AGENT;
|
|
91
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
92
|
+
USER_AGENT = globalThis.navigator.userAgent;
|
|
93
|
+
else
|
|
94
|
+
USER_AGENT = '';
|
|
95
95
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
96
96
|
'Google Chrome': 'Chrome',
|
|
97
97
|
'Microsoft Edge': 'Edge',
|
|
@@ -3,6 +3,6 @@ export declare enum Appearances {
|
|
|
3
3
|
Light = "light",
|
|
4
4
|
Dark = "dark"
|
|
5
5
|
}
|
|
6
|
-
export declare let
|
|
6
|
+
export declare let PREFERS_COLOR_SCHEME_MEDIA_QUERY_LIST: MediaQueryList;
|
|
7
7
|
export declare const CONTEXT: CanvasRenderingContext2D | null;
|
|
8
8
|
export declare const SVG_PIXEL_DATA_URL: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Dimensions } from "../types";
|
|
2
1
|
export declare enum Orientation {
|
|
3
2
|
Portrait = "portrait",
|
|
4
3
|
Landscape = "landscape",
|
|
@@ -40,5 +39,5 @@ export declare const ENV_PRESETS: {
|
|
|
40
39
|
readonly left: "viewport-segment-left";
|
|
41
40
|
};
|
|
42
41
|
};
|
|
43
|
-
export declare
|
|
44
|
-
export declare let
|
|
42
|
+
export declare let ORIENTATION_MEDIA_QUERY_LIST: MediaQueryList;
|
|
43
|
+
export declare let DEVICE_POSTURE_MEDIA_QUERY_LIST: MediaQueryList;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { DimensionInstance } from "../types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface DOMRectReadOnly {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly width: number;
|
|
7
|
+
readonly height: number;
|
|
8
|
+
readonly top: number;
|
|
9
|
+
readonly right: number;
|
|
10
|
+
readonly bottom: number;
|
|
11
|
+
readonly left: number;
|
|
12
|
+
}
|
|
13
|
+
interface VisualViewport {
|
|
14
|
+
readonly segments?: DOMRectReadOnly[];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
declare const Dimension: DimensionInstance;
|
|
3
18
|
export default Dimension;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { ENV_PRESETS, Orientation } from "../constants";
|
|
2
2
|
export type EnvironmentPresetKey = keyof typeof ENV_PRESETS;
|
|
3
|
-
export type
|
|
3
|
+
export type EnvironmentPresetAttribute<K extends EnvironmentPresetKey> = keyof typeof ENV_PRESETS[K];
|
|
4
4
|
export type EnvironmentPresetValues<K extends EnvironmentPresetKey> = {
|
|
5
|
-
[P in
|
|
5
|
+
[P in EnvironmentPresetAttribute<K>]: number;
|
|
6
6
|
};
|
|
7
|
-
export declare interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export declare interface Environment {
|
|
8
|
+
safeAreaInset: EnvironmentObserver<'safe-area-inset'>;
|
|
9
|
+
safeAreaMaxInset: EnvironmentObserver<'safe-area-max-inset'>;
|
|
10
|
+
keyboardInset: EnvironmentObserver<'keyboard-inset'>;
|
|
11
|
+
titlebarArea: EnvironmentObserver<'titlebar-area'>;
|
|
12
|
+
viewportSegment: EnvironmentObserver<'viewport-segment'>;
|
|
13
|
+
}
|
|
14
|
+
export declare interface SegmentsObserver {
|
|
15
|
+
get value(): EnvironmentPresetValues<'viewport-segment'>[];
|
|
16
|
+
onChange(listener: (value: EnvironmentPresetValues<'viewport-segment'>[]) => void, options?: AddEventListenerOptions): () => void;
|
|
17
|
+
useCssVariable(prefix: string): () => void;
|
|
15
18
|
}
|
|
19
|
+
export declare type EnvironmentObserver<K extends EnvironmentPresetKey> = K extends 'viewport-segment' ? SegmentsObserver : {
|
|
20
|
+
get value(): EnvironmentPresetValues<K>;
|
|
21
|
+
onChange(listener: (value: EnvironmentPresetValues<K>) => void, options?: AddEventListenerOptions): () => void;
|
|
22
|
+
useCssVariable(prefix: string): () => void;
|
|
23
|
+
};
|
|
16
24
|
export declare interface Dimensions {
|
|
17
25
|
outerWidth: number;
|
|
18
26
|
outerHeight: number;
|
|
@@ -21,14 +29,12 @@ export declare interface Dimensions {
|
|
|
21
29
|
scale: number;
|
|
22
30
|
orientation: Orientation;
|
|
23
31
|
}
|
|
24
|
-
export declare interface
|
|
25
|
-
get value():
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
titlebarArea: EnvironmentPreset<'titlebar-area'>;
|
|
33
|
-
viewportSegment: EnvironmentPreset<'viewport-segment'>;
|
|
32
|
+
export declare interface DimensionInstance {
|
|
33
|
+
get value(): Dimensions;
|
|
34
|
+
environment: Environment;
|
|
35
|
+
onChange(listener: (dimension: Dimensions) => void, options?: AddEventListenerOptions): () => void;
|
|
36
|
+
Constants: {
|
|
37
|
+
Orientation: typeof Orientation;
|
|
38
|
+
};
|
|
39
|
+
Errors: {};
|
|
34
40
|
}
|