@unbound-app/api 0.6.0 → 0.8.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/src/storage.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
- import type { PredicateResult, Widen } from './utils';
4
3
  import type { EventEmitter } from './tseep';
4
+ import type { PredicateResult, Widen } from './utils';
5
+ import type { SettingsValue } from './_internal';
5
6
  declare const _default: {
6
7
  addListener: typeof addListener;
7
8
  get: typeof get;
@@ -58,15 +59,15 @@ export declare function get<T>(store: string, key: string, def: T): Widen<T>;
58
59
  * @returns An object exposing `get`, `set`, `toggle`, `remove`, `clear`, `useSettingsStore`, and `addListener` bound to the store.
59
60
  */
60
61
  export declare function getStore(store: string): {
61
- set: (key: string, value: any) => void;
62
+ set: (key: string, value: SettingsValue) => void;
62
63
  get: <T>(key: string, def: T) => Widen<T>;
63
- toggle: (key: string, def: any) => void;
64
+ toggle: (key: string, def: boolean) => void;
64
65
  remove: (key: string) => void;
65
66
  clear: () => void;
66
67
  useSettingsStore: (predicate?: (payload: SettingsPayload) => PredicateResult) => {
67
- set: (key: string, value: any) => void;
68
+ set: (key: string, value: SettingsValue) => void;
68
69
  get: <T>(key: string, def: T) => Widen<T>;
69
- toggle: (key: string, def: any) => void;
70
+ toggle: (key: string, def: boolean) => void;
70
71
  remove: (key: string) => void;
71
72
  };
72
73
  addListener: (
@@ -96,14 +97,14 @@ export declare function removeListener(callback: (payload: SettingsPayload) => v
96
97
  * @param key The dot-separated key path within the store.
97
98
  * @param value The value to store.
98
99
  */
99
- export declare function set(store: string, key: string, value: any): void;
100
+ export declare function set(store: string, key: string, value: SettingsValue): void;
100
101
  /**
101
102
  * @description Flips a boolean value at a key path against its current (or default) value, and emits `toggled`.
102
103
  * @param store The store to write to.
103
104
  * @param key The dot-separated key path within the store.
104
105
  * @param def The value to assume when the key is not yet set.
105
106
  */
106
- export declare function toggle(store: string, key: string, def: any): void;
107
+ export declare function toggle(store: string, key: string, def: boolean): void;
107
108
  /**
108
109
  * @description React hook that re-renders the component whenever a matching change occurs in the store.
109
110
  * @param store The store to subscribe to.
@@ -114,19 +115,11 @@ export declare function useSettingsStore(
114
115
  store: string,
115
116
  predicate?: (payload: SettingsPayload) => PredicateResult,
116
117
  ): {
117
- set: (key: string, value: any) => void;
118
+ set: (key: string, value: SettingsValue) => void;
118
119
  get: <T>(key: string, def: T) => Widen<T>;
119
- toggle: (key: string, def: any) => void;
120
+ toggle: (key: string, def: boolean) => void;
120
121
  remove: (key: string) => void;
121
122
  };
122
-
123
- /** Payload describing a settings change, passed to `changed` listeners and predicates. */
124
- export interface SettingsPayload {
125
- store: string;
126
- key: string | null;
127
- value: any;
128
- }
129
-
130
123
  export type ClearedPayload = {
131
124
  store: string;
132
125
  };
@@ -144,12 +137,20 @@ export type RemovedPayload = {
144
137
  export type SetPayload = {
145
138
  store: string;
146
139
  key: string;
147
- value: any;
140
+ value: SettingsValue;
141
+ };
142
+ /** Payload describing a settings change, passed to `changed` listeners and predicates. */
143
+ export type SettingsPayload = {
144
+ store: string;
145
+ key: string | null;
146
+ value: SettingsValue | undefined;
148
147
  };
149
148
  export type ToggledPayload = {
150
149
  store: string;
151
150
  key: string;
152
- prev: any;
153
- value: any;
151
+ prev: boolean;
152
+ value: boolean;
154
153
  };
155
154
  export { _default as default, clear$1 as clear };
155
+
156
+ export {};
package/src/toasts.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type { ToastHandle, ToastOptions } from './_internal';
4
- import { ImageSourcePropType } from 'react-native';
5
- import { ComponentType } from 'react';
6
-
7
4
  import type { ToastHandle, ToastOptions } from './_internal';
5
+ import * as ReactModule from 'react';
6
+ import { ComponentType } from 'react';
7
+ import { ImageSourcePropType } from 'react-native';
8
8
 
9
9
  declare const _default: {
10
10
  showToast: typeof showToast;
@@ -16,3 +16,5 @@ declare const _default: {
16
16
  */
17
17
  export declare function showToast(options: ToastOptions): ToastHandle;
18
18
  export { _default as default };
19
+
20
+ export {};
package/src/tseep.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ import * as ReactModule from 'react';
4
+ import * as ReactNativeModule from 'react-native';
5
+
3
6
  declare class TaskCollection<
4
7
  Func extends (...args: any) => void,
5
8
  AwaitTasks extends true | false = false,
@@ -173,3 +176,5 @@ export type DefaultEventMap = {
173
176
  __proto__?: never;
174
177
  };
175
178
  export type Listener = (...args: any[]) => Promise<any> | void;
179
+
180
+ export {};
package/src/utils.d.ts CHANGED
@@ -1,26 +1,20 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
- /** An object of shape `T` widened with an arbitrary string/number/symbol index. */
4
- export type AnyProps<T extends Record<PropertyKey, any> = Record<PropertyKey, any>> = T &
5
- Record<PropertyKey, any>;
3
+ import * as ReactModule from 'react';
4
+ import * as ReactNativeModule from 'react-native';
6
5
  /** Any supported colour string: a {@link HexColor} or {@link RgbaColor}. */
7
6
  export type ColorString = HexColor | RgbaColor;
8
7
  /** The set of all falsy values. */
9
8
  export type Falsy = false | 0 | '' | null | undefined;
10
- /** Any function: accepts any arguments and returns `T`. */
11
- export type Fn<T = any> = (...args: any) => T;
12
9
  /** A hexadecimal colour string prefixed with `#`. */
13
10
  export type HexColor = `#${string}`;
14
11
  /**
15
- * A string union that keeps `T`'s literals for autocomplete while still accepting any other string.
16
- * Use this for Discord's open-ended enums (typography variants, colour tokens, sizes) so newly added
17
- * values keep type-checking without an update here.
12
+ * A string union that keeps `T`'s literals for autocomplete while still accepting any other string,
13
+ * for Discord's open-ended enums (typography variants, colour tokens, sizes).
18
14
  */
19
15
  export type LiteralUnion<T extends string> = T | (string & {});
20
16
  /** The result of a predicate: any {@link Truthy} or {@link Falsy} value. */
21
- export type PredicateResult = Truthy | Falsy;
22
- /** Any function returning a promise (`T` defaults to `Promise<any>`). */
23
- export type PromiseFn<T = Promise<any>> = (...args: any) => T;
17
+ export type PredicateResult = Truthy | false | null | undefined;
24
18
  /** An `rgba(...)` colour string. */
25
19
  export type RgbaColor = `rgba(${string})`;
26
20
  /** The set of all truthy values. */
@@ -33,3 +27,5 @@ export type Widen<T> = T extends number
33
27
  : T extends boolean
34
28
  ? boolean
35
29
  : T;
30
+
31
+ export {};