@unbound-app/api 0.9.0 → 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.
- package/ambient/image-modules.d.ts +58 -0
- package/package.json +30 -5
- package/src/_internal.d.ts +6110 -462
- package/src/{utils.d.ts → _types.d.ts} +10 -0
- package/src/assets.d.ts +64 -26
- package/src/builtins.d.ts +17 -0
- package/src/commands.d.ts +331 -0
- package/src/dialogs.d.ts +134 -0
- package/src/flux.d.ts +317 -0
- package/src/fonts.d.ts +51 -0
- package/src/fs.d.ts +16 -26
- package/src/global.d.ts +514 -31
- package/src/i18n.d.ts +33 -31
- package/src/iconPacks.d.ts +43 -0
- package/src/index.d.ts +16 -0
- package/src/marketplace.d.ts +50 -0
- package/src/metro/api.d.ts +10 -0
- package/src/metro/common.d.ts +34 -5
- package/src/metro/components.d.ts +100 -16
- package/src/metro/filters.d.ts +31 -16
- package/src/metro/index.d.ts +26097 -82
- package/src/metro/stores.d.ts +5 -0
- package/src/native.d.ts +123 -3
- package/src/patcher.d.ts +214 -57
- package/src/plugins.d.ts +55 -0
- package/src/settings.d.ts +9 -17
- package/src/shims.d.ts +5 -0
- package/src/storage.d.ts +80 -223
- package/src/sync.d.ts +51 -0
- package/src/themes.d.ts +43 -0
- package/src/toasts.d.ts +62 -9
- package/src/ui.d.ts +650 -0
- package/src/updates.d.ts +25 -0
- package/src/utils/index.d.ts +53 -0
- package/src/utils/react/index.d.ts +82 -0
- package/testing/fake-api.ts +256 -0
- package/testing/fake-components.ts +183 -0
- package/testing/fake-feedback.ts +258 -0
- package/testing/fake-fs.ts +54 -0
- package/testing/fake-java.ts +513 -0
- package/testing/fake-locales.ts +85 -0
- package/testing/fake-metro.ts +346 -0
- package/testing/fake-native-bridge.ts +98 -0
- package/testing/fake-native.ts +211 -0
- package/testing/fake-objc.ts +388 -0
- package/testing/fake-plugins.ts +176 -0
- package/testing/fake-react-native-modules.ts +362 -0
- package/testing/fake-react-native.ts +180 -0
- package/testing/fake-react.ts +54 -0
- package/testing/fake-settings-panel.ts +173 -0
- package/testing/fake-settings.ts +428 -0
- package/testing/fake-timers.ts +74 -0
- package/testing/fake-utils.ts +216 -0
- package/testing/icu-format.ts +132 -0
- package/testing/icu-parse.ts +277 -0
- package/testing/index.ts +42 -0
- package/testing/install-addon-globals.ts +260 -0
- package/testing/listener-registry.ts +39 -0
- package/testing/memory-storage.ts +149 -0
- package/testing/plugin-files.ts +155 -0
- package/testing/plugin-lifecycle.ts +149 -0
- package/testing/plugin-types.ts +34 -0
- package/testing/preset.ts +263 -0
- package/testing/react-patcher.ts +154 -0
- package/testing/react-value.ts +3 -0
- package/testing/recorders.ts +183 -0
- package/testing/recording-patcher.ts +173 -0
- package/testing/render.ts +84 -0
- package/testing/session.ts +77 -0
- package/testing/test-node.ts +163 -0
- package/testing/test-renderer.ts +753 -0
- package/testing/unfrozen-elements.ts +49 -0
package/src/flux.d.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import type { LiteralUnion } from './_types';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import { DependencyList } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description Sends a Flux action through Discord's dispatcher.
|
|
9
|
+
* @template A The action, whose payload is checked against {@link FluxActions} for a known type.
|
|
10
|
+
* @param action The action, with its `type` and payload.
|
|
11
|
+
* @returns A promise that settles once Discord's stores handled the action.
|
|
12
|
+
*/
|
|
13
|
+
export declare function dispatch<A extends FluxAction>(
|
|
14
|
+
action: A & FluxActionOf<A['type']>,
|
|
15
|
+
): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* @description Finds one of Discord's Flux stores by name. A store already loaded and cached is returned as itself; otherwise the
|
|
18
|
+
* search is lazy unless `{ lazy: false }` is passed, and runs on first access.
|
|
19
|
+
* @template K The store name, typed from {@link FluxStores}.
|
|
20
|
+
* @param name The store name without its `Store` suffix, like `'User'`.
|
|
21
|
+
* @param options Whether to search lazily, and whether to append `Store` to the name.
|
|
22
|
+
* @returns The store, typed from {@link FluxStores}, else as a base {@link FluxStore}.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getStore<K extends FluxStoreName>(
|
|
25
|
+
name: K,
|
|
26
|
+
options?: GetStoreOptions,
|
|
27
|
+
): FluxStoreOf<K>;
|
|
28
|
+
/**
|
|
29
|
+
* @description Runs an interceptor before Discord handles each Flux action of one type. It may change the action, or drop it by returning `true`.
|
|
30
|
+
* @template K The action type, typed from {@link FluxActions}.
|
|
31
|
+
* @param type The action type, like `'MESSAGE_CREATE'`.
|
|
32
|
+
* @param interceptor Runs with each action. An error it throws is logged and the action goes on.
|
|
33
|
+
* @returns A function that removes the interceptor.
|
|
34
|
+
*/
|
|
35
|
+
export declare function interceptAction<K extends FluxActionType>(
|
|
36
|
+
type: K,
|
|
37
|
+
interceptor: FluxActionInterceptor<K>,
|
|
38
|
+
): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* @description Runs a listener for each Flux action of one type, after Discord's stores handle it.
|
|
41
|
+
* @template K The action type, typed from {@link FluxActions}.
|
|
42
|
+
* @param type The action type, like `'MESSAGE_CREATE'`.
|
|
43
|
+
* @param listener Runs with each action. An error it throws is logged.
|
|
44
|
+
* @returns A function that removes the listener.
|
|
45
|
+
*/
|
|
46
|
+
export declare function onAction<K extends FluxActionType>(
|
|
47
|
+
type: K,
|
|
48
|
+
listener: FluxActionListener<K>,
|
|
49
|
+
): () => void;
|
|
50
|
+
/**
|
|
51
|
+
* @description Runs a listener each time a Flux store changes.
|
|
52
|
+
* @param store The store to watch.
|
|
53
|
+
* @param listener Runs after each change.
|
|
54
|
+
* @returns A function that removes the listener.
|
|
55
|
+
*/
|
|
56
|
+
export declare function onStoreChange(store: FluxStore, listener: FluxChangeListener): () => void;
|
|
57
|
+
/**
|
|
58
|
+
* @description Selects state from Flux stores in a component, re-rendering only when the selection changes.
|
|
59
|
+
* @template S The store, or tuple of stores.
|
|
60
|
+
* @template T The value the selector returns.
|
|
61
|
+
* @param stores The store, or stores, the selector reads.
|
|
62
|
+
* @param selector Reads the value from the stores, which it receives as passed.
|
|
63
|
+
* @param options The selector's `deps`, and the `isEqual` that compares two selections.
|
|
64
|
+
* @returns The selector's latest value.
|
|
65
|
+
*/
|
|
66
|
+
export declare function useStore<const S extends FluxStore | readonly FluxStore[], T>(
|
|
67
|
+
stores: S,
|
|
68
|
+
selector: (stores: S) => T,
|
|
69
|
+
{ deps, isEqual }?: UseStoreOptions<T>,
|
|
70
|
+
): T;
|
|
71
|
+
/**
|
|
72
|
+
* The payload of each Flux action, keyed by action type. Add your own with
|
|
73
|
+
* `declare module '@unbound-app/api/flux' { interface FluxActions { MY_ACTION: { id: string } } }`.
|
|
74
|
+
*/
|
|
75
|
+
export interface FluxActions {
|
|
76
|
+
/** A message arrived or was sent; `optimistic` is `true` for the local copy before Discord confirms it. */
|
|
77
|
+
MESSAGE_CREATE: {
|
|
78
|
+
channelId: string;
|
|
79
|
+
guildId?: string;
|
|
80
|
+
message: FluxMessage;
|
|
81
|
+
optimistic: boolean;
|
|
82
|
+
};
|
|
83
|
+
/** A message was edited, or Discord filled in its embeds. */
|
|
84
|
+
MESSAGE_UPDATE: {
|
|
85
|
+
guildId?: string;
|
|
86
|
+
message: FluxMessage;
|
|
87
|
+
};
|
|
88
|
+
/** The message `id` in `channelId` was deleted. */
|
|
89
|
+
MESSAGE_DELETE: {
|
|
90
|
+
id: string;
|
|
91
|
+
channelId: string;
|
|
92
|
+
guildId?: string;
|
|
93
|
+
};
|
|
94
|
+
/** The user opened a channel; `messageId` is set when they jumped to a message. */
|
|
95
|
+
CHANNEL_SELECT: {
|
|
96
|
+
channelId?: string;
|
|
97
|
+
guildId?: string;
|
|
98
|
+
messageId?: string;
|
|
99
|
+
};
|
|
100
|
+
/** A user started typing in a channel. */
|
|
101
|
+
TYPING_START: {
|
|
102
|
+
channelId: string;
|
|
103
|
+
userId: string;
|
|
104
|
+
};
|
|
105
|
+
/** A user stopped typing in a channel. */
|
|
106
|
+
TYPING_STOP: {
|
|
107
|
+
channelId: string;
|
|
108
|
+
userId: string;
|
|
109
|
+
};
|
|
110
|
+
/** The gateway connection is ready; `user` is the signed-in user. */
|
|
111
|
+
CONNECTION_OPEN: {
|
|
112
|
+
user: FluxUser;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The Flux stores `flux.getStore` knows, keyed by name without the `Store` suffix. Add your own with
|
|
117
|
+
* `declare module '@unbound-app/api/flux' { interface FluxStores { Message: MessageStore } }`.
|
|
118
|
+
*/
|
|
119
|
+
export interface FluxStores {
|
|
120
|
+
/** Users Discord has loaded, including the signed-in user. */
|
|
121
|
+
User: UserStore;
|
|
122
|
+
/** Guilds the signed-in user is in. */
|
|
123
|
+
Guild: GuildStore;
|
|
124
|
+
/** Members of each guild, as far as Discord has loaded them. */
|
|
125
|
+
GuildMember: GuildMemberStore;
|
|
126
|
+
/** Channels Discord has loaded, guild channels and DMs alike. */
|
|
127
|
+
Channel: ChannelStore;
|
|
128
|
+
/** Which channel is open, per guild. */
|
|
129
|
+
SelectedChannel: SelectedChannelStore;
|
|
130
|
+
/** Who is typing in each channel. */
|
|
131
|
+
Typing: TypingStore;
|
|
132
|
+
/** Friends, blocks and friend nicknames of the signed-in user. */
|
|
133
|
+
Relationship: RelationshipStore;
|
|
134
|
+
/** Profiles of users whose profile has been opened. */
|
|
135
|
+
UserProfile: UserProfileStore;
|
|
136
|
+
/** The state of the open server settings screen. */
|
|
137
|
+
GuildSettings: GuildSettingsStore;
|
|
138
|
+
}
|
|
139
|
+
/** Discord's `ChannelStore`. */
|
|
140
|
+
export type ChannelStore = FluxStore & {
|
|
141
|
+
getChannel(id: string): FluxChannel | undefined;
|
|
142
|
+
hasChannel(id: string): boolean;
|
|
143
|
+
getDMFromUserId(userId: string): string | undefined;
|
|
144
|
+
};
|
|
145
|
+
/** The base shape of every Flux action. */
|
|
146
|
+
export type FluxAction<T extends string = string> = {
|
|
147
|
+
/** The action type, such as `MESSAGE_CREATE`; it picks the payload from {@link FluxActions}. */
|
|
148
|
+
type: T;
|
|
149
|
+
};
|
|
150
|
+
/** Runs before Discord handles an action of one type. Returning `true` drops the action. */
|
|
151
|
+
export type FluxActionInterceptor<K extends string> = (action: FluxActionOf<K>) => boolean | void;
|
|
152
|
+
/** Runs for each dispatched action of one type. */
|
|
153
|
+
export type FluxActionListener<K extends string> = (action: FluxActionOf<K>) => void;
|
|
154
|
+
/** The action Discord dispatches for type `K`: its {@link FluxActions} payload, else {@link FluxAction}. */
|
|
155
|
+
export type FluxActionOf<K extends string> = K extends keyof FluxActions
|
|
156
|
+
? FluxAction<K> & FluxActions[K]
|
|
157
|
+
: FluxAction<K>;
|
|
158
|
+
/** An action type: one of {@link FluxActions}, or any other string. */
|
|
159
|
+
export type FluxActionType = LiteralUnion<Extract<keyof FluxActions, string>>;
|
|
160
|
+
/** Runs after a Flux store's state changed. */
|
|
161
|
+
export type FluxChangeListener = () => void;
|
|
162
|
+
/** A Discord channel record. */
|
|
163
|
+
export type FluxChannel = {
|
|
164
|
+
/** The channel's Discord snowflake id. */
|
|
165
|
+
id: string;
|
|
166
|
+
/** Discord's numeric channel type, such as `0` for a guild text channel or `1` for a DM. */
|
|
167
|
+
type: number;
|
|
168
|
+
/** The channel name; DMs may have an empty one. */
|
|
169
|
+
name: string;
|
|
170
|
+
/** The id of the guild the channel belongs to; `null` for DMs and group DMs. */
|
|
171
|
+
guild_id: string | null;
|
|
172
|
+
/** The slowmode delay in seconds; `0` when the channel has no slowmode. */
|
|
173
|
+
rateLimitPerUser?: number;
|
|
174
|
+
};
|
|
175
|
+
/** A Discord guild record. */
|
|
176
|
+
export type FluxGuild = {
|
|
177
|
+
/** The guild's Discord snowflake id. */
|
|
178
|
+
id: string;
|
|
179
|
+
/** The guild's display name. */
|
|
180
|
+
name: string;
|
|
181
|
+
/** The guild icon's image hash; `null` when the guild has no icon. */
|
|
182
|
+
icon: string | null;
|
|
183
|
+
/** The id of the user who owns the guild. */
|
|
184
|
+
ownerId: string;
|
|
185
|
+
};
|
|
186
|
+
/** A guild member record. */
|
|
187
|
+
export type FluxGuildMember = {
|
|
188
|
+
/** The id of the member's user. */
|
|
189
|
+
userId: string;
|
|
190
|
+
/** The id of the guild this membership is in. */
|
|
191
|
+
guildId: string;
|
|
192
|
+
/** The member's nickname in this guild; `null` when they have none. */
|
|
193
|
+
nick: string | null;
|
|
194
|
+
/** The ids of the member's roles in this guild. */
|
|
195
|
+
roles: string[];
|
|
196
|
+
/** The member's name colour as a hex string from their roles; `null` when no role gives one. */
|
|
197
|
+
colorString: string | null;
|
|
198
|
+
};
|
|
199
|
+
/** A Discord message record. */
|
|
200
|
+
export type FluxMessage = {
|
|
201
|
+
/** The message's Discord snowflake id. */
|
|
202
|
+
id: string;
|
|
203
|
+
/** The id of the channel the message is in. */
|
|
204
|
+
channel_id: string;
|
|
205
|
+
/** The raw Markdown text of the message; empty for a message with only attachments or embeds. */
|
|
206
|
+
content: string;
|
|
207
|
+
/** The user who sent the message. */
|
|
208
|
+
author: FluxUser;
|
|
209
|
+
};
|
|
210
|
+
/** The members every Flux store has. A store name missing from {@link FluxStores} gets this type. */
|
|
211
|
+
export type FluxStore = {
|
|
212
|
+
/** Returns the store's name, such as `UserStore`. */
|
|
213
|
+
getName(): string;
|
|
214
|
+
/** Calls `listener` after every change to the store's state, until it is removed. */
|
|
215
|
+
addChangeListener(listener: FluxChangeListener): void;
|
|
216
|
+
/** Stops calling a listener added with `addChangeListener`. */
|
|
217
|
+
removeChangeListener(listener: FluxChangeListener): void;
|
|
218
|
+
/** Calls every change listener now. Discord calls it after the store handles an action. */
|
|
219
|
+
emitChange(): void;
|
|
220
|
+
};
|
|
221
|
+
/** A store name: one of {@link FluxStores}, or any other string. */
|
|
222
|
+
export type FluxStoreName = LiteralUnion<Extract<keyof FluxStores, string>>;
|
|
223
|
+
/** The store type `flux.getStore(name)` returns: its {@link FluxStores} entry, else {@link FluxStore}. */
|
|
224
|
+
export type FluxStoreOf<K extends string> = K extends keyof FluxStores ? FluxStores[K] : FluxStore;
|
|
225
|
+
/** A Discord user record. */
|
|
226
|
+
export type FluxUser = {
|
|
227
|
+
/** The user's Discord snowflake id. */
|
|
228
|
+
id: string;
|
|
229
|
+
/** The unique account name, without the `@`. */
|
|
230
|
+
username: string;
|
|
231
|
+
/** The display name the user set; `null` when they set none. */
|
|
232
|
+
globalName: string | null;
|
|
233
|
+
/** The legacy four-digit tag; `'0'` for accounts on unique usernames. */
|
|
234
|
+
discriminator: string;
|
|
235
|
+
/** The avatar image hash; `null` when the user has the default avatar. */
|
|
236
|
+
avatar: string | null;
|
|
237
|
+
/** `true` for bot accounts. */
|
|
238
|
+
bot: boolean;
|
|
239
|
+
/** The user's Nitro tier: `1` Nitro Classic, `2` Nitro, `3` Nitro Basic; `null` or `0` without Nitro. */
|
|
240
|
+
premiumType?: number | null;
|
|
241
|
+
};
|
|
242
|
+
/** A user's profile, loaded when their profile is opened. */
|
|
243
|
+
export type FluxUserProfile = {
|
|
244
|
+
/** The id of the user the profile belongs to. */
|
|
245
|
+
userId: string;
|
|
246
|
+
/** The profile's About Me text, as Markdown. */
|
|
247
|
+
bio: string;
|
|
248
|
+
/** The pronouns the user set, as free text. */
|
|
249
|
+
pronouns: string;
|
|
250
|
+
};
|
|
251
|
+
/** Options for `flux.getStore`. */
|
|
252
|
+
export type GetStoreOptions = {
|
|
253
|
+
/** Search on first property access instead of at once. Defaults to `true`. */
|
|
254
|
+
lazy?: boolean;
|
|
255
|
+
/** Append `Store` to the name before matching. Defaults to `true`. */
|
|
256
|
+
short?: boolean;
|
|
257
|
+
};
|
|
258
|
+
/** Discord's `GuildMemberStore`. */
|
|
259
|
+
export type GuildMemberStore = FluxStore & {
|
|
260
|
+
getMember(guildId: string, userId: string): FluxGuildMember | null;
|
|
261
|
+
getMembers(guildId: string): FluxGuildMember[];
|
|
262
|
+
getNick(guildId: string, userId: string): string | null;
|
|
263
|
+
isMember(guildId: string, userId: string): boolean;
|
|
264
|
+
};
|
|
265
|
+
/** Discord's `GuildSettingsStore`, the state of the open server settings screen. */
|
|
266
|
+
export type GuildSettingsStore = FluxStore & {
|
|
267
|
+
getGuildId(): string | undefined;
|
|
268
|
+
isOpen(): boolean;
|
|
269
|
+
hasChanges(): boolean;
|
|
270
|
+
};
|
|
271
|
+
/** Discord's `GuildStore`. */
|
|
272
|
+
export type GuildStore = FluxStore & {
|
|
273
|
+
getGuild(id: string): FluxGuild | undefined;
|
|
274
|
+
getGuilds(): Record<string, FluxGuild>;
|
|
275
|
+
getGuildCount(): number;
|
|
276
|
+
};
|
|
277
|
+
/** Discord's `RelationshipStore`. */
|
|
278
|
+
export type RelationshipStore = FluxStore & {
|
|
279
|
+
isFriend(userId: string): boolean;
|
|
280
|
+
isBlocked(userId: string): boolean;
|
|
281
|
+
isIgnored(userId: string): boolean;
|
|
282
|
+
getNickname(userId: string): string | undefined;
|
|
283
|
+
getRelationshipType(userId: string): number;
|
|
284
|
+
getFriendIDs(): string[];
|
|
285
|
+
};
|
|
286
|
+
/** Discord's `SelectedChannelStore`. */
|
|
287
|
+
export type SelectedChannelStore = FluxStore & {
|
|
288
|
+
getChannelId(guildId?: string): string | undefined;
|
|
289
|
+
getLastSelectedChannelId(guildId?: string): string | undefined;
|
|
290
|
+
getVoiceChannelId(): string | null;
|
|
291
|
+
};
|
|
292
|
+
/** Discord's `TypingStore`. */
|
|
293
|
+
export type TypingStore = FluxStore & {
|
|
294
|
+
/** Maps the id of each user typing in the channel to when they started. */
|
|
295
|
+
getTypingUsers(channelId: string): Record<string, number>;
|
|
296
|
+
isTyping(channelId: string, userId: string): boolean;
|
|
297
|
+
};
|
|
298
|
+
/** Options for {@link useStore}. */
|
|
299
|
+
export type UseStoreOptions<T> = {
|
|
300
|
+
/** Values the selector closes over. While they stay the same, a render reuses the last value instead of re-running the selector. */
|
|
301
|
+
deps?: React$1.DependencyList;
|
|
302
|
+
/** Decides whether a new selection equals the last one, which skips the re-render. Defaults to `Object.is`. */
|
|
303
|
+
isEqual?: (previous: T, next: T) => boolean;
|
|
304
|
+
};
|
|
305
|
+
/** Discord's `UserProfileStore`. */
|
|
306
|
+
export type UserProfileStore = FluxStore & {
|
|
307
|
+
getUserProfile(userId: string): FluxUserProfile | undefined;
|
|
308
|
+
getGuildMemberProfile(userId: string, guildId: string): FluxUserProfile | undefined;
|
|
309
|
+
};
|
|
310
|
+
/** Discord's `UserStore`. */
|
|
311
|
+
export type UserStore = FluxStore & {
|
|
312
|
+
getCurrentUser(): FluxUser | undefined;
|
|
313
|
+
getUser(id: string): FluxUser | undefined;
|
|
314
|
+
getUsers(): Record<string, FluxUser>;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export {};
|
package/src/fonts.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import type { UnboundInstalledFont } from './_internal';
|
|
4
|
+
/** Applies a saved preset, downloading the faces it lacks. */
|
|
5
|
+
export declare const applyPreset: (id: string) => Promise<UnboundFontPresetResult | undefined>;
|
|
6
|
+
/** Gives a Discord family, or a group, back its own font. */
|
|
7
|
+
export declare const clearOverride: (key: string) => Promise<void>;
|
|
8
|
+
/** Reads one installed face by id. */
|
|
9
|
+
export declare const get: (id: PropertyKey) => UnboundInstalledFont | undefined;
|
|
10
|
+
/** Lists every installed font face. */
|
|
11
|
+
export declare const getAll: () => UnboundInstalledFont[];
|
|
12
|
+
/** Lists the saved font presets. */
|
|
13
|
+
export declare const getPresets: () => UnboundFontPreset[];
|
|
14
|
+
/** Installs a font by family name or link, optionally only some weights and styles. */
|
|
15
|
+
export declare const install: (
|
|
16
|
+
input: string,
|
|
17
|
+
variants?: UnboundFontVariant[],
|
|
18
|
+
) => Promise<UnboundFontInstallResult | undefined>;
|
|
19
|
+
/** Points a Discord family, or a group such as `PRIMARY`, at an installed face. */
|
|
20
|
+
export declare const setOverride: (key: string, fontId: string) => Promise<void>;
|
|
21
|
+
/** Removes an installed face by id. */
|
|
22
|
+
export declare const uninstall: (id: string) => Promise<void>;
|
|
23
|
+
/** What `fonts.install` installed, and the files it skipped and why. @internal */
|
|
24
|
+
type UnboundFontInstallResult = {
|
|
25
|
+
installed: UnboundInstalledFont[];
|
|
26
|
+
errors: string[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A saved snapshot of the override map, keyed by Discord family and holding sources, not files.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
type UnboundFontPreset = {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
overrides: Record<string, UnboundFontSource>;
|
|
36
|
+
};
|
|
37
|
+
/** What `fonts.applyPreset` did with each Discord family of the preset. @internal */
|
|
38
|
+
type UnboundFontPresetResult = {
|
|
39
|
+
applied: string[];
|
|
40
|
+
/** Families whose face failed to install; they keep Discord's font. */
|
|
41
|
+
unavailable: string[];
|
|
42
|
+
/** Families Discord no longer has. */
|
|
43
|
+
skipped: string[];
|
|
44
|
+
errors: string[];
|
|
45
|
+
};
|
|
46
|
+
/** A weight and style to install. @internal */
|
|
47
|
+
type UnboundFontVariant = {
|
|
48
|
+
weight: number;
|
|
49
|
+
style: UnboundFontStyle;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
package/src/fs.d.ts
CHANGED
|
@@ -1,54 +1,44 @@
|
|
|
1
1
|
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
2
|
|
|
3
|
-
declare const _default: {
|
|
4
|
-
Documents: string;
|
|
5
|
-
read: typeof read;
|
|
6
|
-
write: typeof write;
|
|
7
|
-
rm: typeof rm;
|
|
8
|
-
exists: typeof exists;
|
|
9
|
-
};
|
|
10
3
|
/** Absolute path to the platform's documents directory. */
|
|
11
|
-
export declare const
|
|
4
|
+
export declare const documentsPath: string;
|
|
12
5
|
/**
|
|
13
|
-
* @description Checks whether a file exists, resolving relative paths against {@link
|
|
14
|
-
* @param path The file path to check, relative to {@link
|
|
15
|
-
* @param inDocuments Whether to resolve `path` relative to {@link
|
|
6
|
+
* @description Checks whether a file exists, resolving relative paths against {@link documentsPath}.
|
|
7
|
+
* @param path The file path to check, relative to {@link documentsPath} unless `inDocuments` is `false`.
|
|
8
|
+
* @param inDocuments Whether to resolve `path` relative to {@link documentsPath}.
|
|
16
9
|
* @returns A promise resolving to whether the file exists.
|
|
17
10
|
*/
|
|
18
11
|
export declare function exists(path: string, inDocuments?: boolean): Promise<boolean>;
|
|
19
12
|
/**
|
|
20
|
-
* @description Reads a file's contents, resolving relative paths against {@link
|
|
21
|
-
* @param path The file path to read, relative to {@link
|
|
13
|
+
* @description Reads a file's contents, resolving relative paths against {@link documentsPath}.
|
|
14
|
+
* @param path The file path to read, relative to {@link documentsPath} unless `inDocuments` is `false`.
|
|
22
15
|
* @param encoding The encoding to read the file with.
|
|
23
|
-
* @param inDocuments Whether to resolve `path` relative to {@link
|
|
16
|
+
* @param inDocuments Whether to resolve `path` relative to {@link documentsPath}.
|
|
24
17
|
* @returns A promise resolving to the file's contents.
|
|
25
18
|
*/
|
|
26
|
-
export declare function
|
|
19
|
+
export declare function readFile(
|
|
27
20
|
path: string,
|
|
28
21
|
encoding?: DCDFileManagerEncoding,
|
|
29
22
|
inDocuments?: boolean,
|
|
30
23
|
): Promise<string>;
|
|
31
24
|
/**
|
|
32
|
-
* @description Removes a file within {@link
|
|
33
|
-
* @param path The
|
|
34
|
-
* @returns A promise resolving to whether
|
|
25
|
+
* @description Removes a file or a whole folder within {@link documentsPath}.
|
|
26
|
+
* @param path The path to remove, relative to {@link documentsPath}.
|
|
27
|
+
* @returns A promise resolving to whether anything was removed.
|
|
35
28
|
*/
|
|
36
|
-
export declare function
|
|
29
|
+
export declare function removeFile(path: string): Promise<boolean>;
|
|
37
30
|
/**
|
|
38
|
-
* @description Writes content to a file within {@link
|
|
39
|
-
* @param path The file path to write to, relative to {@link
|
|
31
|
+
* @description Writes content to a file within {@link documentsPath}.
|
|
32
|
+
* @param path The file path to write to, relative to {@link documentsPath}.
|
|
40
33
|
* @param content The content to write.
|
|
41
34
|
* @param encoding The encoding to write the file with.
|
|
42
35
|
* @returns A promise resolving once the file is written.
|
|
43
36
|
*/
|
|
44
|
-
export declare function
|
|
37
|
+
export declare function writeFile(
|
|
45
38
|
path: string,
|
|
46
39
|
content: string,
|
|
47
40
|
encoding?: DCDFileManagerEncoding,
|
|
48
41
|
): Promise<string>;
|
|
49
|
-
/**
|
|
42
|
+
/** How the native file manager encodes file contents: UTF-8 text or base64 for binary data. */
|
|
50
43
|
export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
|
|
51
|
-
|
|
52
|
-
export { _default as default };
|
|
53
|
-
|
|
54
44
|
export {};
|