@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/assets.d.ts CHANGED
@@ -47,3 +47,5 @@ export declare function getByName(name: string, type?: 'svg' | 'png'): UnboundAs
47
47
  */
48
48
  export declare function getIDByName(name: string, type?: 'svg' | 'png'): number | undefined;
49
49
  export { _default as default };
50
+
51
+ export {};
package/src/fs.d.ts CHANGED
@@ -50,3 +50,5 @@ export declare function write(
50
50
  export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
51
51
 
52
52
  export { _default as default };
53
+
54
+ export {};
package/src/global.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type {
4
+ ADDON_TYPES,
5
+ ActionSheetProps,
6
+ ActionSheetRowProps,
4
7
  Addon,
5
8
  AddonAuthor,
6
9
  AddonManifest,
7
10
  AddonResolveable,
11
+ AddonType,
12
+ AlertActionButtonProps,
13
+ AlertModalProps,
8
14
  AssetsModule,
9
15
  ButtonComponent,
10
16
  ButtonProps,
@@ -12,9 +18,12 @@ export type {
12
18
  ButtonVariant,
13
19
  CardProps,
14
20
  CheckboxProps,
21
+ ContextMenuItem,
22
+ ContextMenuProps,
15
23
  CreateStyles,
16
24
  DesignModule,
17
25
  DiscordAsset,
26
+ DiscordFunction,
18
27
  EnumLike,
19
28
  FloatingActionButtonProps,
20
29
  FontDescriptor,
@@ -27,6 +36,7 @@ export type {
27
36
  InputSize,
28
37
  InputStatus,
29
38
  InternalToastOptions,
39
+ NATIVE_PLUGIN_CAPABILITIES,
30
40
  NativeAssociationKey,
31
41
  NativeCallOptions,
32
42
  NativeClassHandle,
@@ -53,18 +63,28 @@ export type {
53
63
  NativePluginError,
54
64
  NativePluginErrorCode,
55
65
  NativePointer,
66
+ NativeSerializable,
67
+ NativeSerializableObject,
56
68
  NativeStruct,
69
+ NativeStructField,
70
+ NativeStructFields,
57
71
  NativeThreadPolicy,
58
72
  Navigation,
73
+ NavigationOptions,
59
74
  Plugin,
60
75
  PluginContext,
61
76
  PluginEntity,
62
77
  ResolvedStyles,
63
78
  RowButtonProps,
79
+ SegmentedControlItem,
80
+ SegmentedControlPagesProps,
64
81
  SegmentedControlProps,
65
82
  SegmentedControlState,
83
+ SegmentedControlStateOptions,
66
84
  SettingsEntry,
85
+ SettingsObject,
67
86
  SettingsScreen,
87
+ SettingsValue,
68
88
  SliderProps,
69
89
  SplitTextInputProps,
70
90
  StackProps,
@@ -72,6 +92,7 @@ export type {
72
92
  StyleSheetSpecOrFactory,
73
93
  SwitchProps,
74
94
  TableCheckboxRowProps,
95
+ TableRadioGroupProps,
75
96
  TableRadioRowProps,
76
97
  TableRowComponent,
77
98
  TableRowGroupProps,
@@ -98,18 +119,18 @@ export type {
98
119
  UnboundAsset,
99
120
  } from './_internal';
100
121
  import type { NativePlatformBridge } from './_internal';
122
+ import * as ReactModule from 'react';
123
+ import * as ReactNativeModule from 'react-native';
124
+
101
125
  declare global {
102
126
  /**
103
- * Build-time token, replaced with a boolean literal by the build's `transform.define`. Folds at
104
- * the module-graph level so `if ($$DEV$$)` branches (and any imports inside them) are dead-code
105
- * eliminated from production bundles entirely. Use it (not a runtime check) to gate dev-only code.
127
+ * Build-time token replaced with a boolean literal, so `if ($$DEV$$)` branches (and their
128
+ * imports) are eliminated from production bundles. Use it, not a runtime check, for dev-only code.
106
129
  */
107
130
  var $$DEV$$: boolean;
108
131
  var NativePlatform: NativePlatformBridge | undefined;
109
- var React: typeof import('react');
110
- var ReactNative: typeof import('react-native');
111
-
112
- interface Window {}
132
+ var React: typeof ReactModule;
133
+ var ReactNative: typeof ReactNativeModule;
113
134
  }
114
135
 
115
136
  export interface UnboundGlobal {
package/src/i18n.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare function format(key: string, vars?: FormatVars): string;
31
31
  * @returns A promise that resolves once the initial locales have been ensured and the subscription is wired.
32
32
  */
33
33
  export declare function init(): Promise<void>;
34
- export type FormatVars = Record<string, unknown>;
34
+ export type FormatVars = Record<string, string | number | boolean | Date>;
35
35
  export type LocaleStrings = Record<string, string>;
36
36
  export type Localizations = {
37
37
  Messages: Record<string, string>;
@@ -40,3 +40,5 @@ export type Localizations = {
40
40
  export type StringStore = Record<string, LocaleStrings>;
41
41
 
42
42
  export { _default as default };
43
+
44
+ export {};
package/src/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ export * as assets from './assets';
4
+ export * as fs from './fs';
5
+ export * as i18n from './i18n';
3
6
  export * as metro from './metro/index';
4
- export * as settings from './settings';
7
+ export * as native from './native';
5
8
  export * as patcher from './patcher';
9
+ export * as settings from './settings';
6
10
  export * as storage from './storage';
7
- export * as assets from './assets';
8
- export * as native from './native';
9
11
  export * as toasts from './toasts';
10
- export * as i18n from './i18n';
11
- export * as fs from './fs';
@@ -4,4 +4,7 @@ export declare const AsyncUsers: any;
4
4
  export declare const Invites: any;
5
5
  export declare const Linking: any;
6
6
  export declare const Messages: any;
7
+ export declare const OAuth2: any;
7
8
  export declare const Profiles: any;
9
+
10
+ export {};
@@ -9,6 +9,7 @@ export declare const Commands: any;
9
9
  export declare const Constants: any;
10
10
  export declare const Dispatcher: any;
11
11
  export declare const Flux: any;
12
+ export declare const FluxHooks: any;
12
13
  export declare const Gestures: any;
13
14
  export declare const MarkdownParser: any;
14
15
  export declare const Moment: any;
@@ -21,3 +22,5 @@ export declare const Util: any;
21
22
  export declare const i18n: any;
22
23
 
23
24
  export { Clipboard$1 as Clipboard, React$1 as React, ReactNative$1 as ReactNative };
25
+
26
+ export {};
@@ -1,17 +1,19 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type { DesignModule, SwitchProps } from '../_internal';
4
+ import type { DesignModule, SwitchProps } from '../_internal';
5
+ import * as ReactModule from 'react';
6
+ import { ComponentType, ReactNode } from 'react';
4
7
  import {
8
+ AccessibilityState,
5
9
  ImageStyle,
10
+ PressableProps,
6
11
  StyleProp,
7
12
  TextInputProps as RNTextInputProps,
8
13
  TextStyle,
9
14
  ViewProps,
10
15
  ViewStyle,
11
16
  } from 'react-native';
12
- import { ComponentType, ReactNode } from 'react';
13
-
14
- import type { DesignModule, SwitchProps } from '../_internal';
15
17
  export declare const BackdropFilters: any;
16
18
  export declare const Discord: DesignModule;
17
19
  export declare const FlashList: any;
@@ -20,4 +22,5 @@ export declare const HelpMessage: any;
20
22
  export declare const Media: any;
21
23
  export declare const Portal: any;
22
24
  export declare const SafeArea: any;
23
- export declare const Switch: ComponentType<SwitchProps>;
25
+ export declare const Switch: ReactModule.ComponentType<SwitchProps>;
26
+ export {};
@@ -21,7 +21,7 @@ export declare function byDisplayName(name: string): MetroFilter;
21
21
  * @param path The file path the module must have been imported from.
22
22
  * @returns A {@link MetroFilter} matching the module loaded from that file path.
23
23
  */
24
- export declare function byFilePath(path: string[]): MetroFilter;
24
+ export declare function byFilePath(path: string): MetroFilter;
25
25
  /**
26
26
  * @description Builds a filter matching a module whose `name` equals the given name.
27
27
  * @param name The `name` the module must have.
@@ -53,3 +53,5 @@ export type MetroFilter = ((mdl: any, id: number | string) => PredicateResult) &
53
53
  isRaw?: boolean;
54
54
  };
55
55
  export { _default as default };
56
+
57
+ export {};
@@ -1,16 +1,20 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ export type { DiscordFunction } from '../_internal';
4
+ import type { DiscordFunction } from '../_internal';
5
+ import type { PredicateResult } from '../utils';
6
+ import * as ReactModule from 'react';
7
+ import { ComponentType, ReactNode } from 'react';
3
8
  import {
9
+ AccessibilityState,
4
10
  ImageStyle,
11
+ PressableProps,
5
12
  StyleProp,
6
13
  TextInputProps as RNTextInputProps,
7
14
  TextStyle,
8
15
  ViewProps,
9
16
  ViewStyle,
10
17
  } from 'react-native';
11
- import { ComponentType, ReactNode } from 'react';
12
-
13
- import type { AnyProps, Fn, PredicateResult } from '../utils';
14
18
  /** @internal */
15
19
  declare const CACHE_KEY: unique symbol;
16
20
  export declare const off: typeof removeListener;
@@ -109,22 +113,10 @@ export declare function initializeModule(id: number): boolean;
109
113
  * @param listener The listener to remove.
110
114
  */
111
115
  export declare function removeListener(listener: (mdl: any, id: number) => void): void;
112
-
113
- /** A single entry in a {@link bulk} search: a filter plus its per-item options. */
114
- export interface MetroBulkItem extends Omit<MetroSearchOptions, 'initial' | 'cache'> {
115
- filter: MetroFilter;
116
- }
117
- /** Search options for {@link findLazy}, adding a `signal` that abandons the wait when aborted. */
118
- export interface MetroLazySearchOptions extends Omit<MetroSearchOptions, 'lazy' | 'all'> {
119
- signal?: AbortSignal;
120
- }
121
- /** Search options for {@link findStore}, adding the `short` name-matching toggle. */
122
- export interface MetroStoreOptions extends MetroSearchOptions {
123
- short?: boolean;
124
- }
125
-
116
+ /** An object of shape `T` widened with an arbitrary property index. */
117
+ export type AnyProps<T = unknown> = T & Record<PropertyKey, MetroExport>;
126
118
  /** Widens a single result to an array when the search was made with `all: true`. */
127
- export type MetroAllValues<T extends Record<PropertyKey, any>, U extends unknown> = T extends {
119
+ export type MetroAllValues<T extends MetroSearchOptions, U> = T extends {
128
120
  all: true;
129
121
  }
130
122
  ? U[]
@@ -134,6 +126,10 @@ export type MetroBulkFind<T extends string> = [
134
126
  ...AnyProps<MetroParamsBag<T>>[],
135
127
  AnyProps<MetroBulkMarker>,
136
128
  ];
129
+ /** A single entry in a {@link bulk} search: a filter plus its per-item options. */
130
+ export type MetroBulkItem = {
131
+ filter: MetroFilter;
132
+ } & Omit<MetroSearchOptions, 'initial' | 'cache'>;
137
133
  /** The marker object distinguishing a bulk find from a single one. */
138
134
  export type MetroBulkMarker = {
139
135
  bulk: true;
@@ -144,9 +140,9 @@ export type MetroBulkModuleByName<T extends any[]> = {
144
140
  interop: false;
145
141
  }
146
142
  ? {
147
- default: Fn;
143
+ default: MetroFunction;
148
144
  }
149
- : Fn;
145
+ : MetroFunction;
150
146
  };
151
147
  /** Result shape of a bulk by-property search, one record per requested item. */
152
148
  export type MetroBulkModuleByProperty<T extends any[]> = {
@@ -157,6 +153,8 @@ export type MetroFilter = ((mdl: any, id: number | string) => PredicateResult) &
157
153
  [CACHE_KEY]?: string;
158
154
  isRaw?: boolean;
159
155
  };
156
+ /** A function or class exported by a Discord module, whose signature Discord does not document. */
157
+ export type MetroFunction = DiscordFunction & (new (...args: any[]) => any);
160
158
  /** Dispatches to the bulk or single by-name result shape based on the argument tuple. */
161
159
  export type MetroFunctionSignatureOrArray<T extends any[], U extends string> =
162
160
  T extends MetroBulkFind<U> ? MetroBulkModuleByName<T> : MetroSingleModuleByName<T>;
@@ -165,6 +163,10 @@ export type MetroInternalOptions = {
165
163
  bulk?: boolean;
166
164
  lazy?: boolean;
167
165
  };
166
+ /** Search options for {@link findLazy}, adding a `signal` that abandons the wait when aborted. */
167
+ export type MetroLazySearchOptions = {
168
+ signal?: AbortSignal;
169
+ } & Omit<MetroSearchOptions, 'lazy' | 'all'>;
168
170
  /** Convenience alias for a by-property result derived from a union of prop names. */
169
171
  export type MetroModule<TProps extends string> = MetroPropertyRecordOrArray<TProps[], TProps>;
170
172
  /** A bag carrying a `params` array of prop names. */
@@ -173,14 +175,14 @@ export type MetroParamsBag<T extends string> = {
173
175
  };
174
176
  /** A record keyed by the prop names listed in a single bulk item's `params`. */
175
177
  export type MetroParamsRecord<Params extends PropertyKey[]> = {
176
- [P in Params[number]]: any;
178
+ [P in Params[number]]: MetroExport;
177
179
  };
178
180
  /** Dispatches to the bulk or single by-property result shape based on the argument tuple. */
179
181
  export type MetroPropertyRecordOrArray<T extends any[], U extends string> =
180
182
  T extends MetroBulkFind<U> ? MetroBulkModuleByProperty<T> : MetroSingleModuleByProperty<T>;
181
183
  /** A record keyed by the non-options entries of a find argument tuple. */
182
184
  export type MetroPropsRecord<T extends any[]> = {
183
- [k in Exclude<T[number], Record<PropertyKey, any>>]: any;
185
+ [k in Exclude<T[number], object>]: MetroExport;
184
186
  };
185
187
  /** Public options accepted by {@link find} and the `findBy*` family. */
186
188
  export type MetroSearchOptions = {
@@ -205,11 +207,11 @@ export type MetroSingleModuleByName<T extends any[]> = T extends [
205
207
  interop: false;
206
208
  }
207
209
  ? {
208
- default: Fn;
210
+ default: MetroFunction;
209
211
  }
210
- : Fn
212
+ : MetroFunction
211
213
  >
212
- : Fn;
214
+ : MetroFunction;
213
215
  /** Result shape of a by-property search: a record keyed by the requested props. */
214
216
  export type MetroSingleModuleByProperty<T extends any[]> = T extends [
215
217
  ...any,
@@ -217,13 +219,17 @@ export type MetroSingleModuleByProperty<T extends any[]> = T extends [
217
219
  ]
218
220
  ? MetroAllValues<O, AnyProps<MetroPropsRecord<T>>>
219
221
  : AnyProps<MetroPropsRecord<T>>;
222
+ /** Search options for {@link findStore}, adding the `short` name-matching toggle. */
223
+ export type MetroStoreOptions = {
224
+ short?: boolean;
225
+ } & MetroSearchOptions;
220
226
  /** Tuple of search terms followed by a trailing options object. */
221
227
  export type MetroStringFindWithOptions<T extends string, Options = MetroSearchOptions> = [
222
228
  ...T[],
223
229
  Options,
224
230
  ];
231
+ export * as api from './api';
232
+ export * as common from './common';
225
233
  export * as components from './components';
226
234
  export * as filters from './filters';
227
- export * as common from './common';
228
235
  export * as stores from './stores';
229
- export * as api from './api';
@@ -1,4 +1,7 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ export declare const Accessibility: any;
3
4
  export declare const Guilds: any;
4
5
  export declare const Users: any;
6
+
7
+ export {};
package/src/native.d.ts CHANGED
@@ -30,8 +30,8 @@ export type {
30
30
  PluginContext,
31
31
  } from './_internal';
32
32
  import type { NativePlatformBridge, NativePluginCapability } from './_internal';
33
- import type { Fn, PromiseFn } from './utils';
34
33
  declare const NativePlatform$1: NativePlatformBridge | undefined;
34
+
35
35
  export declare class NativePluginCapabilityError extends Error {
36
36
  readonly code = 'NATIVE_PLUGIN_CAPABILITY_DENIED';
37
37
  readonly capability: NativePluginCapability;
@@ -62,21 +62,18 @@ export declare const DeviceInfo: DeviceInfoType;
62
62
  * @param names The candidate native module names to look up, in priority order.
63
63
  * @returns The first matching native module.
64
64
  */
65
- export declare function getNativeModule<T = any>(...names: string[]): T;
65
+ export declare function getNativeModule<T>(...names: string[]): T;
66
66
  /**
67
67
  * @description Reads Hermes' runtime metadata, such as the bytecode version, GC, and build channel.
68
- * React Native types the global `HermesInternal` as `null | {}`, so this reads it via
69
- * `window.HermesInternal` where our own typing wins.
70
68
  * @returns The runtime property map, or an empty object when Hermes internals are unavailable.
71
69
  */
72
- export declare function getRuntimeProperties(): Record<string, any>;
70
+ export declare function getRuntimeProperties(): HermesRuntimeProperties;
73
71
  /**
74
72
  * @description Persists pending settings to storage, then reloads the native bundle.
75
73
  */
76
74
  export declare function reload(): Promise<void>;
77
-
78
75
  /** Build and release metadata reported by the native client info module. */
79
- export interface BundleInfoType {
76
+ export type BundleInfoType = {
80
77
  Version: string;
81
78
  ReleaseChannel: string;
82
79
  Manifest: string;
@@ -87,27 +84,29 @@ export interface BundleInfoType {
87
84
  SentryStaffDsn: string;
88
85
  Identifier: string;
89
86
  SentryAlphaBetaDsn: string;
90
- }
87
+ };
91
88
  /** The native `BundleUpdaterManager` module surface for OTA updates and reloading the bundle. */
92
- export interface DCDBundleManagerType {
93
- getInitialBundleDownloaded: PromiseFn;
94
- getInitialOtaUpdateChecked: PromiseFn;
95
- checkForUpdateAndReload: Fn;
96
- reload: Fn;
97
- getOtaRootPath: PromiseFn;
98
- getBuildOverrideCookieContents: PromiseFn;
99
- setBuildOverrideCookieHeader: PromiseFn;
100
- getManifestInfo: PromiseFn;
101
- addListener: Fn;
102
- removeListeners: Fn;
103
- }
89
+ export type DCDBundleManagerType = {
90
+ getInitialBundleDownloaded: UndocumentedNativeMethod;
91
+ getInitialOtaUpdateChecked: UndocumentedNativeMethod;
92
+ checkForUpdateAndReload(): void;
93
+ reload(): void;
94
+ getOtaRootPath: UndocumentedNativeMethod;
95
+ getBuildOverrideCookieContents: UndocumentedNativeMethod;
96
+ setBuildOverrideCookieHeader: UndocumentedNativeMethod;
97
+ getManifestInfo: UndocumentedNativeMethod;
98
+ addListener(eventName: string): void;
99
+ removeListeners(count: number): void;
100
+ };
104
101
  /** The constant directory paths exposed by the native `DCDFileManager`. */
105
- export interface DCDFileManagerConstants {
102
+ export type DCDFileManagerConstants = {
106
103
  CacheDirPath: string;
107
104
  DocumentsDirPath: string;
108
- }
105
+ };
106
+ /** The text encodings accepted by the native `DCDFileManager` read/write operations. */
107
+ export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
109
108
  /** The native `DCDFileManager` module surface for reading, writing, and inspecting files. */
110
- export interface DCDFileManagerType extends DCDFileManagerConstants {
109
+ export type DCDFileManagerType = {
111
110
  readFile(path: string, encoding: DCDFileManagerEncoding): Promise<string>;
112
111
  writeFile(
113
112
  type: 'documents' | 'cache',
@@ -115,16 +114,16 @@ export interface DCDFileManagerType extends DCDFileManagerConstants {
115
114
  data: string,
116
115
  encoding: DCDFileManagerEncoding,
117
116
  ): Promise<string>;
118
- removeFile(type: 'documents' | 'cache', path: string): Promise<any>;
119
- readAsset(): Promise<unknown>;
120
- getSize(): Promise<unknown>;
121
- getVideoDimensions(): Promise<unknown>;
117
+ removeFile(type: 'documents' | 'cache', path: string): Promise<boolean>;
118
+ readAsset: UndocumentedNativeMethod;
119
+ getSize: UndocumentedNativeMethod;
120
+ getVideoDimensions: UndocumentedNativeMethod;
122
121
  fileExists(path: string): Promise<boolean>;
123
- saveFileToGallery(): Promise<unknown>;
122
+ saveFileToGallery: UndocumentedNativeMethod;
124
123
  getConstants(): DCDFileManagerConstants;
125
- }
124
+ } & DCDFileManagerConstants;
126
125
  /** Hardware and OS details reported by the native device module. */
127
- export interface DeviceInfoType {
126
+ export type DeviceInfoType = {
128
127
  isTaskBarEnabled: boolean;
129
128
  maxCpuFreq: string;
130
129
  socName: string;
@@ -137,8 +136,10 @@ export interface DeviceInfoType {
137
136
  deviceBrand: string;
138
137
  ramSize: string;
139
138
  device: string;
140
- }
139
+ };
140
+ export type HermesRuntimeProperties = ReturnType<HermesInternalObject['getRuntimeProperties']>;
141
+ export type UndocumentedNativeMethod = () => Promise<unknown>;
141
142
 
142
- /** The text encodings accepted by the native `DCDFileManager` read/write operations. */
143
- export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
144
143
  export { NativePlatform$1 as NativePlatform };
144
+
145
+ export {};
package/src/patcher.d.ts CHANGED
@@ -1,14 +1,22 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
- //#region src/patcher.d.ts
4
- export declare const PATCH_SYMBOL: unique symbol;
5
- export declare const patches: PatchedModule[];
6
- export declare enum PatchType {
7
- Before = 0,
8
- Instead = 1,
9
- After = 2,
10
- }
11
- export declare function after<M extends PatchParent, P extends PropOf<M>>(
3
+ /**
4
+ * @description Runs a callback after a method, which can replace its result by returning a value.
5
+ * @template M The object holding the method.
6
+ * @template P The method's key.
7
+ * @param parent The object holding the method.
8
+ * @param method The method's key.
9
+ * @param callback Receives the patch context.
10
+ * @param options Patch options.
11
+ * @returns A function removing the patch.
12
+ */
13
+ declare function after$1<M extends PatchParent, P extends PropOf<M>>(
14
+ parent: M,
15
+ method: P,
16
+ callback: Parameters<typeof before<M, P>>[2],
17
+ options?: PatchOptions,
18
+ ): () => void;
19
+ declare function after<M extends PatchParent, P extends PropOf<M>>(
12
20
  parent: M,
13
21
  method: P,
14
22
  callback: PatchCallback<
@@ -18,7 +26,23 @@ export declare function after<M extends PatchParent, P extends PropOf<M>>(
18
26
  >,
19
27
  options?: PatchOptions,
20
28
  ): () => void;
21
- export declare function before<M extends PatchParent, P extends PropOf<M>>(
29
+ /**
30
+ * @description Runs a callback before a method, which can replace its arguments by returning an array.
31
+ * @template M The object holding the method.
32
+ * @template P The method's key.
33
+ * @param parent The object holding the method.
34
+ * @param method The method's key.
35
+ * @param callback Receives the patch context.
36
+ * @param options Patch options.
37
+ * @returns A function removing the patch.
38
+ */
39
+ declare function before$1<M extends PatchParent, P extends PropOf<M>>(
40
+ parent: M,
41
+ method: P,
42
+ callback: Parameters<typeof before<M, P>>[2],
43
+ options?: PatchOptions,
44
+ ): () => void;
45
+ declare function before<M extends PatchParent, P extends PropOf<M>>(
22
46
  parent: M,
23
47
  method: P,
24
48
  callback: PatchCallback<
@@ -28,8 +52,23 @@ export declare function before<M extends PatchParent, P extends PropOf<M>>(
28
52
  >,
29
53
  options?: PatchOptions,
30
54
  ): () => void;
31
- export declare function createPatcher(defaultOptions: string | PatchOptions): PatcherInstance;
32
- export declare function instead<M extends PatchParent, P extends PropOf<M>>(
55
+ /**
56
+ * @description Runs a callback in place of a method, which can call `ctx.original` and replaces its result.
57
+ * @template M The object holding the method.
58
+ * @template P The method's key.
59
+ * @param parent The object holding the method.
60
+ * @param method The method's key.
61
+ * @param callback Receives the patch context.
62
+ * @param options Patch options.
63
+ * @returns A function removing the patch.
64
+ */
65
+ declare function instead$1<M extends PatchParent, P extends PropOf<M>>(
66
+ parent: M,
67
+ method: P,
68
+ callback: Parameters<typeof before<M, P>>[2],
69
+ options?: PatchOptions,
70
+ ): () => void;
71
+ declare function instead<M extends PatchParent, P extends PropOf<M>>(
33
72
  parent: M,
34
73
  method: P,
35
74
  callback: PatchCallback<
@@ -39,7 +78,28 @@ export declare function instead<M extends PatchParent, P extends PropOf<M>>(
39
78
  >,
40
79
  options?: PatchOptions,
41
80
  ): () => void;
81
+ //#region src/patcher.d.ts
82
+ export declare const PATCH_SYMBOL: unique symbol;
83
+ export declare const patches: PatchedModule[];
84
+ export declare enum PatchType {
85
+ Before = 0,
86
+ Instead = 1,
87
+ After = 2,
88
+ }
89
+ /**
90
+ * @description Creates a patcher whose patches share default options, so they can be removed together.
91
+ * @param defaultOptions A caller id, or options merged into every patch; a caller id is generated if missing.
92
+ * @returns The scoped patcher.
93
+ */
94
+ export declare function createPatcher(defaultOptions: string | PatchOptions): PatcherInstance;
95
+ /**
96
+ * @description Removes every patch.
97
+ */
42
98
  export declare function unpatchAll(): void;
99
+ /**
100
+ * @description Removes every patch made with a caller id.
101
+ * @param caller The caller id.
102
+ */
43
103
  export declare function unpatchAllByCaller(caller: string): void;
44
104
  //#endregion
45
105
  //#region src/env.d.ts
@@ -90,3 +150,7 @@ export type PatchParent = AnyFunction | AnyObject;
90
150
  export type PropOf<M> = {
91
151
  [K in keyof M]: M[K] extends AnyFunction | AnyConstructor ? Extract<K, string> : never;
92
152
  }[keyof M];
153
+
154
+ export { after$1 as after, before$1 as before, instead$1 as instead };
155
+
156
+ export {};
package/src/settings.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type { SettingsEntry } from './_internal';
4
- import { ComponentType } from 'react';
5
-
6
4
  import type { SettingsEntry } from './_internal';
5
+ import * as ReactModule from 'react';
6
+ import { ComponentType } from 'react';
7
7
 
8
8
  declare const _default: {
9
9
  registerSettings: typeof registerSettings;
@@ -26,3 +26,5 @@ export declare function removeSettings(...keys: string[]): void;
26
26
  */
27
27
  export declare function sections(): Record<string, SettingsEntry>;
28
28
  export { _default as default };
29
+
30
+ export {};