native-fn 1.0.90 → 1.1.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.
Files changed (92) hide show
  1. package/dist/index.d.ts +751 -4
  2. package/dist/native.cjs +3509 -1995
  3. package/dist/native.min.cjs +1 -1
  4. package/dist/native.min.mjs +1 -1
  5. package/dist/native.mjs +3509 -1995
  6. package/dist/native.umd.js +3509 -1995
  7. package/dist/native.umd.min.js +1 -1
  8. package/dist/src/constants/index.d.ts +1 -0
  9. package/dist/src/errors/not-supported-error.d.ts +2 -0
  10. package/dist/src/errors/permission-not-granted-error.d.ts +2 -0
  11. package/dist/src/plugin/app/constants/index.d.ts +8 -0
  12. package/dist/src/plugin/app/cores/index.d.ts +0 -1
  13. package/dist/src/plugin/app/types/app.d.ts +53 -5
  14. package/dist/src/plugin/appearance/constants/index.d.ts +1 -4
  15. package/dist/src/plugin/appearance/cores/index.d.ts +2 -2
  16. package/dist/src/plugin/appearance/types/appearance.d.ts +2 -2
  17. package/dist/src/plugin/appearance/types/appearanceInstance.d.ts +9 -0
  18. package/dist/src/plugin/badge/cores/index.d.ts +3 -0
  19. package/dist/src/plugin/badge/index.d.ts +3 -0
  20. package/dist/src/plugin/badge/types/badge.d.ts +10 -0
  21. package/dist/src/plugin/badge/types/index.d.ts +1 -0
  22. package/dist/src/plugin/battery/cores/index.d.ts +3 -0
  23. package/dist/src/plugin/battery/index.d.ts +3 -0
  24. package/dist/src/plugin/battery/types/battery.d.ts +26 -0
  25. package/dist/src/plugin/battery/types/index.d.ts +1 -0
  26. package/dist/src/plugin/clipboard/cores/index.d.ts +2 -2
  27. package/dist/src/plugin/clipboard/types/clipboard.d.ts +1 -1
  28. package/dist/src/plugin/dimension/constants/index.d.ts +42 -2
  29. package/dist/src/plugin/dimension/cores/index.d.ts +2 -2
  30. package/dist/src/plugin/dimension/types/dimensions.d.ts +24 -3
  31. package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +24 -0
  32. package/dist/src/plugin/fullscreen/cores/index.d.ts +4 -2
  33. package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +8 -5
  34. package/dist/src/plugin/geolocation/constants/index.d.ts +2 -0
  35. package/dist/src/plugin/geolocation/cores/index.d.ts +3 -0
  36. package/dist/src/plugin/geolocation/index.d.ts +3 -0
  37. package/dist/src/plugin/geolocation/types/geolocation.d.ts +12 -0
  38. package/dist/src/plugin/geolocation/types/index.d.ts +1 -0
  39. package/dist/src/plugin/notification/cores/index.d.ts +3 -0
  40. package/dist/src/plugin/notification/index.d.ts +3 -0
  41. package/dist/src/plugin/notification/types/index.d.ts +1 -0
  42. package/dist/src/plugin/notification/types/notification.d.ts +27 -0
  43. package/dist/src/plugin/open/constants/index.d.ts +28 -0
  44. package/dist/src/plugin/open/cores/index.d.ts +55 -0
  45. package/dist/src/plugin/open/errors/not-supported-error.d.ts +2 -0
  46. package/dist/src/plugin/open/errors/url-open-error.d.ts +2 -0
  47. package/dist/src/plugin/open/errors/user-cancel-error.d.ts +2 -0
  48. package/dist/src/plugin/open/index.d.ts +3 -0
  49. package/dist/src/plugin/open/types/index.d.ts +1 -0
  50. package/dist/src/plugin/open/types/open.d.ts +187 -0
  51. package/dist/src/plugin/permission/constants/index.d.ts +22 -0
  52. package/dist/src/plugin/permission/cores/index.d.ts +3 -0
  53. package/dist/src/plugin/permission/index.d.ts +3 -0
  54. package/dist/src/plugin/permission/types/index.d.ts +1 -0
  55. package/dist/src/plugin/permission/types/permission.d.ts +10 -0
  56. package/dist/src/plugin/pip/cores/index.d.ts +12 -0
  57. package/dist/src/plugin/pip/index.d.ts +3 -0
  58. package/dist/src/plugin/pip/types/index.d.ts +1 -0
  59. package/dist/src/plugin/pip/types/pip.d.ts +15 -0
  60. package/dist/src/plugin/platform/constants/index.d.ts +0 -1
  61. package/dist/src/plugin/platform/cores/index.d.ts +15 -2
  62. package/dist/src/plugin/platform/types/platform.d.ts +12 -3
  63. package/dist/src/plugin/pwa/cores/index.d.ts +3 -0
  64. package/dist/src/plugin/pwa/index.d.ts +3 -0
  65. package/dist/src/plugin/pwa/types/index.d.ts +1 -0
  66. package/dist/src/plugin/pwa/types/pwa.d.ts +8 -0
  67. package/dist/src/plugin/speech/cores/index.d.ts +53 -0
  68. package/dist/src/plugin/speech/index.d.ts +3 -0
  69. package/dist/src/plugin/speech/types/index.d.ts +1 -0
  70. package/dist/src/plugin/speech/types/speech.d.ts +9 -0
  71. package/dist/src/plugin/theme/cores/index.d.ts +2 -2
  72. package/dist/src/plugin/theme/types/theme.d.ts +1 -1
  73. package/dist/src/plugin/vibration/cores/index.d.ts +3 -0
  74. package/dist/src/plugin/vibration/index.d.ts +3 -0
  75. package/dist/src/plugin/vibration/types/index.d.ts +1 -0
  76. package/dist/src/plugin/vibration/types/vibration.d.ts +9 -0
  77. package/dist/src/types/event-listener.d.ts +35 -0
  78. package/dist/src/types/index.d.ts +3 -0
  79. package/dist/src/types/listener-entry.d.ts +0 -1
  80. package/dist/src/types/native.d.ts +30 -16
  81. package/dist/src/types/subscription-manager.d.ts +4 -0
  82. package/dist/src/utils/create-env-observer.d.ts +8 -0
  83. package/dist/src/utils/create-hidden-element.d.ts +1 -1
  84. package/dist/src/utils/create-subscription-manager.d.ts +2 -0
  85. package/dist/src/utils/defer.d.ts +1 -0
  86. package/dist/src/utils/event-listener.d.ts +3 -0
  87. package/dist/src/utils/keys.d.ts +1 -0
  88. package/dist/src/utils/now.d.ts +1 -0
  89. package/dist/src/utils/pad-start.d.ts +1 -0
  90. package/dist/src/utils/random-string.d.ts +1 -0
  91. package/dist/src/utils/set-style.d.ts +3 -0
  92. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { NotSupportedError } from "../../../errors/not-supported-error";
2
+ export declare interface PWAInstance {
3
+ show(): void;
4
+ Constants: {};
5
+ Errors: {
6
+ NotSupportedError: typeof NotSupportedError;
7
+ };
8
+ }
@@ -0,0 +1,53 @@
1
+ import { SpeechInstance } from "../types";
2
+ declare const Speech: SpeechInstance;
3
+ interface SpeechRecognition extends EventTarget {
4
+ lang: string;
5
+ continuous: boolean;
6
+ interimResults: boolean;
7
+ maxAlternatives: number;
8
+ processLocally?: boolean;
9
+ onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
10
+ onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
11
+ onend: ((this: SpeechRecognition, ev: Event) => any) | null;
12
+ onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
13
+ onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
14
+ onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
15
+ onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
16
+ onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
17
+ onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
18
+ onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
19
+ onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
20
+ start(audioTrack?: MediaStreamTrack): void;
21
+ stop(): void;
22
+ abort(): void;
23
+ addEventListener(type: "audiostart" | "audioend" | "end" | "error" | "nomatch" | "result" | "soundstart" | "soundend" | "speechstart" | "speechend" | "start", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
24
+ removeEventListener(type: "audiostart" | "audioend" | "end" | "error" | "nomatch" | "result" | "soundstart" | "soundend" | "speechstart" | "speechend" | "start", listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
25
+ }
26
+ interface SpeechRecognitionConstructor {
27
+ new (): SpeechRecognition;
28
+ available?: (options?: {
29
+ langs?: string[];
30
+ processLocally?: boolean;
31
+ }) => Promise<boolean>;
32
+ install?: (options?: {
33
+ langs?: string[];
34
+ }) => Promise<void>;
35
+ }
36
+ interface SpeechRecognitionEvent extends Event {
37
+ readonly resultIndex: number;
38
+ readonly results: SpeechRecognitionResultList;
39
+ }
40
+ interface SpeechRecognitionErrorEvent extends Event {
41
+ readonly error: string;
42
+ readonly message: string;
43
+ }
44
+ declare global {
45
+ var webkitSpeechRecognition: SpeechRecognitionConstructor;
46
+ var SpeechRecognition: SpeechRecognitionConstructor;
47
+ interface HTMLAudioElement {
48
+ captureStream?(): MediaStream;
49
+ mozCaptureStream?(): MediaStream;
50
+ }
51
+ }
52
+ declare const SpeechRecognition: SpeechRecognitionConstructor;
53
+ export default Speech;
@@ -0,0 +1,3 @@
1
+ import Speech from "./cores";
2
+ export * from "./types";
3
+ export default Speech;
@@ -0,0 +1 @@
1
+ export * from "./speech";
@@ -0,0 +1,9 @@
1
+ import { NotSupportedError } from "../../../errors/not-supported-error";
2
+ export declare interface SpeechInstance {
3
+ tts(text: string, language?: string): Promise<Blob>;
4
+ stt(blob: Blob, language?: string): Promise<string>;
5
+ Constants: {};
6
+ Errors: {
7
+ NotSupportedError: typeof NotSupportedError;
8
+ };
9
+ }
@@ -1,3 +1,3 @@
1
- import type { Theme } from "../types";
2
- declare const Theme: Theme;
1
+ import type { ThemeInstance } from "../types";
2
+ declare const Theme: ThemeInstance;
3
3
  export default Theme;
@@ -1,4 +1,4 @@
1
- export declare interface Theme {
1
+ export declare interface ThemeInstance {
2
2
  get value(): string | undefined;
3
3
  set value(color: string | undefined);
4
4
  Constants: {};
@@ -0,0 +1,3 @@
1
+ import { VibrationInstance } from "../types";
2
+ declare const Vibration: VibrationInstance;
3
+ export default Vibration;
@@ -0,0 +1,3 @@
1
+ import Vibration from "./cores";
2
+ export * from "./types";
3
+ export default Vibration;
@@ -0,0 +1 @@
1
+ export * from "./vibration";
@@ -0,0 +1,9 @@
1
+ import { NotSupportedError } from "../../../errors/not-supported-error";
2
+ export declare interface VibrationInstance {
3
+ run(pattern: number | number[]): boolean;
4
+ get supported(): boolean;
5
+ Constants: {};
6
+ Errors: {
7
+ NotSupportedError: typeof NotSupportedError;
8
+ };
9
+ }
@@ -0,0 +1,35 @@
1
+ export type EventTargetLike = EventTarget & {
2
+ attachEvent?(type: string, listener: (event: Event) => void): void;
3
+ detachEvent?(type: string, listener: (event: Event) => void): void;
4
+ webkitEnterFullscreen?(): void;
5
+ media?: string;
6
+ matches?: boolean | ((selectors: string) => boolean);
7
+ addListener?(callback: MediaQueryListCallback | null): void;
8
+ removeListener?(callback: MediaQueryListCallback | null): void;
9
+ };
10
+ export type MediaQueryListCallback = ((this: MediaQueryList, ev: MediaQueryListEvent) => any);
11
+ export type AnyCallback = EventListenerOrEventListenerObject | MediaQueryListCallback;
12
+ export declare interface EventListenerOptions<E extends Event = Event> {
13
+ type?: string;
14
+ callback: EventListenerOrEventListenerObject | MediaQueryListCallback | ((this: any, event: E) => void);
15
+ options?: AddEventListenerOptions | boolean;
16
+ }
17
+ export interface EventListenerInstance {
18
+ useStd: boolean;
19
+ add<E extends Event = Event>(target: EventTargetLike | undefined, eventListenerOptions: EventListenerOptions<E>): void;
20
+ remove<E extends Event = Event>(target: EventTargetLike | undefined, eventListenerOptions: EventListenerOptions<E>): void;
21
+ }
22
+ export type IEWrapper = (event: Event) => void;
23
+ export type IEWrapperRecord = {
24
+ target: EventTarget;
25
+ type: string;
26
+ callback: AnyCallback;
27
+ wrapper: IEWrapper;
28
+ };
29
+ export type MediaQueryListWrapper = (this: MediaQueryList, ev: MediaQueryListEvent) => void;
30
+ export type MediaQueryListWrapperRecord = {
31
+ target: MediaQueryList;
32
+ type: string;
33
+ callback: AnyCallback;
34
+ wrapper: MediaQueryListWrapper;
35
+ };
@@ -1 +1,4 @@
1
1
  export * from "./native";
2
+ export type Writeable<T> = {
3
+ -readonly [P in keyof T]: T[P];
4
+ };
@@ -1,6 +1,5 @@
1
1
  export declare interface ListenerEntry<T> {
2
2
  fn: (appearance: T) => any;
3
- capture: boolean;
4
3
  once: boolean;
5
4
  signal?: AbortSignal;
6
5
  }
@@ -1,17 +1,31 @@
1
- import App from "../plugin/app";
2
- import Appearance from "../plugin/appearance";
3
- import Clipboard from "../plugin/clipboard";
4
- import Dimension from "../plugin/dimension";
5
- import Fullscreen from "../plugin/fullscreen";
6
- import Platform from "../plugin/platform";
7
- import Theme from "../plugin/theme";
8
- export declare interface Native {
9
- Version: string;
10
- App: App;
11
- Appearance: Appearance;
12
- Clipboard: Clipboard;
13
- Dimension: Dimension;
14
- Fullscreen: Fullscreen;
15
- Platform: Platform;
16
- Theme: Theme;
1
+ import AppearanceInstance from "../plugin/appearance";
2
+ import BadgeInstance from "../plugin/badge";
3
+ import ClipboardInstance from "../plugin/clipboard";
4
+ import DimensionInstance from "../plugin/dimension";
5
+ import FullscreenInstance from "../plugin/fullscreen";
6
+ import GeoLocationInstance from "../plugin/geolocation";
7
+ import NotificationInstance from "../plugin/notification";
8
+ import OpenInstance from "../plugin/open";
9
+ import PlatformInstance from "../plugin/platform";
10
+ import ThemeInstance from "../plugin/theme";
11
+ import VibrationInstance from "../plugin/vibration";
12
+ import PermissionInstance from "../plugin/permission";
13
+ import PipInstance from "../plugin/pip";
14
+ import BatteryInstance from "../plugin/battery";
15
+ export declare interface NativeInstance {
16
+ version: string;
17
+ appearance: typeof AppearanceInstance;
18
+ badge: typeof BadgeInstance;
19
+ battery: typeof BatteryInstance;
20
+ clipboard: typeof ClipboardInstance;
21
+ dimension: typeof DimensionInstance;
22
+ fullscreen: typeof FullscreenInstance;
23
+ geolocation: typeof GeoLocationInstance;
24
+ notification: typeof NotificationInstance;
25
+ open: typeof OpenInstance;
26
+ permission: typeof PermissionInstance;
27
+ platform: typeof PlatformInstance;
28
+ pip: typeof PipInstance;
29
+ theme: typeof ThemeInstance;
30
+ vibration: typeof VibrationInstance;
17
31
  }
@@ -0,0 +1,4 @@
1
+ export declare interface SubscriptionManager<T, U> {
2
+ emit: (value: U) => void;
3
+ subscribe: (this: T, listener: (value: U) => void, options?: AddEventListenerOptions) => () => void;
4
+ }
@@ -0,0 +1,8 @@
1
+ import { EnvironmentPresetKey, EnvironmentPresetValues } from "../plugin/dimension";
2
+ type ChangeCallback<K extends EnvironmentPresetKey> = (values: EnvironmentPresetValues<K>) => void;
3
+ export type EnvObserver<K extends EnvironmentPresetKey> = {
4
+ get(): EnvironmentPresetValues<K>;
5
+ onChange(callback: ChangeCallback<K>, options?: AddEventListenerOptions): () => void;
6
+ };
7
+ export default function createEnvObserver<K extends EnvironmentPresetKey>(preset: K): EnvObserver<K>;
8
+ export {};
@@ -1 +1 @@
1
- export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K] | undefined;
1
+ export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K];
@@ -0,0 +1,2 @@
1
+ import { SubscriptionManager } from "../types/subscription-manager";
2
+ export default function createSubscriptionManager<T, U>(attach: () => void, detach: () => void): SubscriptionManager<T, U>;
@@ -0,0 +1 @@
1
+ export default function defer(task: () => void): void;
@@ -0,0 +1,3 @@
1
+ import { EventListenerInstance } from "../types/event-listener";
2
+ declare const EventListener: EventListenerInstance;
3
+ export default EventListener;
@@ -0,0 +1 @@
1
+ export default function keys(object: object): string[];
@@ -0,0 +1 @@
1
+ export default function now(): number;
@@ -0,0 +1 @@
1
+ export default function padStart(string: any, length: number, pad: string): any;
@@ -0,0 +1 @@
1
+ export default function randomString(length: number): string;
@@ -0,0 +1,3 @@
1
+ export default function setStyle(element: HTMLElement, styles: {
2
+ [K in keyof CSSStyleDeclaration]?: string;
3
+ }): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-fn",
3
- "version": "1.0.90",
3
+ "version": "1.1.0",
4
4
  "description": " ",
5
5
  "type": "module",
6
6