@unbound-app/api 0.11.0 → 1.1.1

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 (72) hide show
  1. package/ambient/image-modules.d.ts +58 -0
  2. package/package.json +27 -4
  3. package/src/_internal.d.ts +2775 -139
  4. package/src/{utils.d.ts → _types.d.ts} +10 -0
  5. package/src/assets.d.ts +64 -26
  6. package/src/builtins.d.ts +17 -0
  7. package/src/commands.d.ts +101 -25
  8. package/src/dialogs.d.ts +90 -25
  9. package/src/flux.d.ts +317 -0
  10. package/src/fonts.d.ts +51 -0
  11. package/src/fs.d.ts +15 -24
  12. package/src/global.d.ts +173 -11
  13. package/src/i18n.d.ts +33 -31
  14. package/src/iconPacks.d.ts +43 -0
  15. package/src/index.d.ts +14 -0
  16. package/src/marketplace.d.ts +50 -0
  17. package/src/metro/api.d.ts +8 -0
  18. package/src/metro/common.d.ts +34 -5
  19. package/src/metro/components.d.ts +34 -25
  20. package/src/metro/filters.d.ts +31 -16
  21. package/src/metro/index.d.ts +26079 -83
  22. package/src/metro/stores.d.ts +5 -0
  23. package/src/native.d.ts +77 -5
  24. package/src/patcher.d.ts +214 -57
  25. package/src/plugins.d.ts +55 -0
  26. package/src/settings.d.ts +8 -16
  27. package/src/shims.d.ts +5 -0
  28. package/src/storage.d.ts +80 -224
  29. package/src/sync.d.ts +51 -0
  30. package/src/themes.d.ts +43 -0
  31. package/src/toasts.d.ts +62 -9
  32. package/src/ui.d.ts +650 -0
  33. package/src/updates.d.ts +25 -0
  34. package/src/utils/index.d.ts +53 -0
  35. package/src/utils/react/index.d.ts +82 -0
  36. package/testing/fake-api.ts +256 -0
  37. package/testing/fake-components.ts +183 -0
  38. package/testing/fake-feedback.ts +258 -0
  39. package/testing/fake-fs.ts +54 -0
  40. package/testing/fake-java.ts +513 -0
  41. package/testing/fake-locales.ts +85 -0
  42. package/testing/fake-metro.ts +346 -0
  43. package/testing/fake-native-bridge.ts +98 -0
  44. package/testing/fake-native.ts +211 -0
  45. package/testing/fake-objc.ts +388 -0
  46. package/testing/fake-plugins.ts +176 -0
  47. package/testing/fake-react-native-modules.ts +362 -0
  48. package/testing/fake-react-native.ts +180 -0
  49. package/testing/fake-react.ts +54 -0
  50. package/testing/fake-settings-panel.ts +173 -0
  51. package/testing/fake-settings.ts +428 -0
  52. package/testing/fake-timers.ts +74 -0
  53. package/testing/fake-utils.ts +216 -0
  54. package/testing/icu-format.ts +132 -0
  55. package/testing/icu-parse.ts +277 -0
  56. package/testing/index.ts +42 -0
  57. package/testing/install-addon-globals.ts +260 -0
  58. package/testing/listener-registry.ts +39 -0
  59. package/testing/memory-storage.ts +149 -0
  60. package/testing/plugin-files.ts +155 -0
  61. package/testing/plugin-lifecycle.ts +149 -0
  62. package/testing/plugin-types.ts +34 -0
  63. package/testing/preset.ts +263 -0
  64. package/testing/react-patcher.ts +154 -0
  65. package/testing/react-value.ts +3 -0
  66. package/testing/recorders.ts +183 -0
  67. package/testing/recording-patcher.ts +173 -0
  68. package/testing/render.ts +84 -0
  69. package/testing/session.ts +77 -0
  70. package/testing/test-node.ts +163 -0
  71. package/testing/test-renderer.ts +753 -0
  72. package/testing/unfrozen-elements.ts +49 -0
package/src/global.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ /// <reference path="../ambient/image-modules.d.ts" />
4
+
3
5
  export type {
4
- ADDON_TYPES,
6
+ ADDON_KINDS,
7
+ ADDON_SCOPE_GLOBALS,
5
8
  AIGlyphTextProps,
6
9
  AILoaderComponent,
7
10
  AILoaderProps,
@@ -33,12 +36,15 @@ export type {
33
36
  ActionSheetRowStatics,
34
37
  ActionSheetSwitchRowComponent,
35
38
  ActionSheetSwitchRowProps,
36
- Addon,
39
+ AddonAsset,
37
40
  AddonAuthor,
41
+ AddonHandle,
42
+ AddonKind,
43
+ AddonLogger,
38
44
  AddonManifest,
39
- AddonResolveable,
45
+ AddonPlatform,
46
+ AddonPlatforms,
40
47
  AddonTrust,
41
- AddonType,
42
48
  AlertActionButtonComponent,
43
49
  AlertActionButtonProps,
44
50
  AlertActionsProps,
@@ -46,7 +52,10 @@ export type {
46
52
  AlertModalContainerComponent,
47
53
  AlertModalContainerProps,
48
54
  AlertModalProps,
55
+ AssetName,
56
+ AssetType,
49
57
  AssetsModule,
58
+ AuthoredAddonManifest,
50
59
  AvatarDuoPileComponent,
51
60
  AvatarDuoPileProps,
52
61
  AvatarPileComponent,
@@ -57,6 +66,8 @@ export type {
57
66
  BackgroundBlurFillWithPressProps,
58
67
  BackgroundBlurViewComponentComponent,
59
68
  BackgroundBlurViewComponentProps,
69
+ BadgeProps,
70
+ BadgeVariant,
60
71
  BaseIconButtonProps,
61
72
  BaseNavigationContainerProps,
62
73
  BaseTextButtonComponent,
@@ -77,9 +88,13 @@ export type {
77
88
  ButtonIconButtonComponent,
78
89
  ButtonIconButtonProps,
79
90
  ButtonPillProps,
91
+ ButtonSchema,
80
92
  ButtonShineProps,
93
+ CORE_SETTINGS_STORE,
94
+ Callback,
81
95
  CameraLottieComponent,
82
96
  CameraLottieProps,
97
+ ChoiceSettingSchema,
83
98
  CoachmarkComponent,
84
99
  CoachmarkProps,
85
100
  CollapsingTextProps,
@@ -113,8 +128,15 @@ export type {
113
128
  DisableCustomThemeComponent,
114
129
  DisableCustomThemeProps,
115
130
  DiscordAsset,
131
+ DiscordAssetName,
132
+ DiscordAssetNames,
133
+ DiscordAssetType,
116
134
  DiscordFunction,
135
+ DiscordIconProps,
136
+ DiscordIconSize,
137
+ DurationUnit,
117
138
  EllipsisCircleProps,
139
+ EntityDisplay,
118
140
  EnumLike,
119
141
  ErrorTextProps,
120
142
  ExpressiveGradientComponent,
@@ -123,7 +145,6 @@ export type {
123
145
  FauxHeaderProps,
124
146
  FloatingActionButtonComponent,
125
147
  FloatingActionButtonProps,
126
- FontDescriptor,
127
148
  FontEntity,
128
149
  FormLabelProps,
129
150
  FormRowProps,
@@ -145,6 +166,7 @@ export type {
145
166
  HeaderBackImageProps,
146
167
  HeaderSubmittingIndicatorComponent,
147
168
  HeaderSubmittingIndicatorProps,
169
+ IconInput,
148
170
  IconPack,
149
171
  IconPackManifest,
150
172
  ImageButtonComponent,
@@ -159,10 +181,23 @@ export type {
159
181
  InternalToastOptions,
160
182
  LayerScopeComponent,
161
183
  LayerScopeProps,
184
+ LoaderObjCBridge,
162
185
  LoadingButtonPillProps,
186
+ LooseComponent,
187
+ LooseModule,
188
+ LoosePropValue,
189
+ LooseProps,
163
190
  LottieIconProps,
164
191
  ManaContextProviderComponent,
165
192
  ManaContextProviderProps,
193
+ MarkdownNestedParse,
194
+ MarkdownNode,
195
+ MarkdownOutput,
196
+ MarkdownParserModule,
197
+ MarkdownReactParser,
198
+ MarkdownRule,
199
+ MarkdownRules,
200
+ MarkdownState,
166
201
  MenuComponent,
167
202
  MenuGroupComponent,
168
203
  MenuGroupProps,
@@ -194,8 +229,16 @@ export type {
194
229
  ModalStepIndicatorComponent,
195
230
  ModalStepIndicatorProps,
196
231
  NATIVE_PLUGIN_CAPABILITIES,
232
+ NATIVE_PLUGIN_METHOD_CAPABILITIES,
233
+ NATIVE_PLUGIN_PLATFORMS,
197
234
  NATIVE_PLUGIN_PLATFORM_CAPABILITIES,
235
+ NEWER_DESIGN_COMPONENTS,
198
236
  NativeAddonVerification,
237
+ NativeAndroidInstallPhase,
238
+ NativeAndroidInstallProgress,
239
+ NativeAndroidInstallSplit,
240
+ NativeAndroidInstallerAvailability,
241
+ NativeAndroidInstallerStatus,
199
242
  NativeAssociationKey,
200
243
  NativeBatchReference,
201
244
  NativeBatchStep,
@@ -207,26 +250,32 @@ export type {
207
250
  NativeCrashedAddon,
208
251
  NativeDebugBridge,
209
252
  NativeDebugEnvironment,
253
+ NativeDebugEnvironmentOptions,
210
254
  NativeDebugEvaluation,
255
+ NativeDebugEvaluationLog,
211
256
  NativeFFIBridge,
212
257
  NativeFFISignature,
213
258
  NativeFFIType,
214
259
  NativeFFITypeName,
215
260
  NativeFabricBridge,
216
261
  NativeFabricFrame,
262
+ NativeFabricMountOptions,
217
263
  NativeFabricSize,
218
264
  NativeFabricSurface,
219
265
  NativeFontEntry,
220
266
  NativeFontSource,
267
+ NativeGarbageCollection,
221
268
  NativeHandle,
222
269
  NativeHookContext,
223
270
  NativeHookHandlers,
224
271
  NativeHookOptions,
272
+ NativeHookPayload,
225
273
  NativeHookToken,
226
274
  NativeJavaArgument,
227
275
  NativeJavaAssociationKey,
228
276
  NativeJavaBatchOperation,
229
277
  NativeJavaBridge,
278
+ NativeJavaCallPlan,
230
279
  NativeJavaClassDescription,
231
280
  NativeJavaFieldDescription,
232
281
  NativeJavaHandle,
@@ -238,9 +287,15 @@ export type {
238
287
  NativeJavaMethodDescription,
239
288
  NativeJavaReference,
240
289
  NativeJavaValue,
290
+ NativeMainWaitCounts,
291
+ NativeMainWorkCounts,
241
292
  NativeObjCBridge,
293
+ NativeObjCCallPlan,
294
+ NativeObjCResult,
242
295
  NativeObjectHandle,
243
296
  NativePlatformAddons,
297
+ NativePlatformAndroidBridge,
298
+ NativePlatformAndroidInstaller,
244
299
  NativePlatformApp,
245
300
  NativePlatformBridge,
246
301
  NativePlatformCrashGuard,
@@ -248,12 +303,16 @@ export type {
248
303
  NativePlatformFiles,
249
304
  NativePlatformFonts,
250
305
  NativePlatformIOSBridge,
306
+ NativePlatformProfiler,
251
307
  NativePlatformSettings,
252
308
  NativePluginBridge,
253
309
  NativePluginCapability,
254
310
  NativePluginError,
255
311
  NativePluginErrorCode,
312
+ NativePluginMethod,
313
+ NativePluginNamespace,
256
314
  NativePluginPlatform,
315
+ NativePluginPlatformCapability,
257
316
  NativePluginRuntimeBridge,
258
317
  NativePointer,
259
318
  NativeResourceCounts,
@@ -267,6 +326,11 @@ export type {
267
326
  NativeStructField,
268
327
  NativeStructFields,
269
328
  NativeThreadPolicy,
329
+ NativeUIArgument,
330
+ NativeUIBridge,
331
+ NativeUICallback,
332
+ NativeUIScope,
333
+ NativeUIScopeFactory,
270
334
  NativeViewSearchOptions,
271
335
  NativeViewSnapshotNode,
272
336
  NativeViewSnapshotOptions,
@@ -283,6 +347,7 @@ export type {
283
347
  NavigatorScreenComponent,
284
348
  NavigatorScreenProps,
285
349
  NewInlineNoticeProps,
350
+ NewerDesignComponents,
286
351
  NitroGem12LottieComponent,
287
352
  NitroGem12LottieProps,
288
353
  NitroGem15LottieComponent,
@@ -301,6 +366,7 @@ export type {
301
366
  NitroGem6LottieProps,
302
367
  NitroGem9LottieComponent,
303
368
  NitroGem9LottieProps,
369
+ NoticeSchema,
304
370
  NotificationsTabLottieComponent,
305
371
  NotificationsTabLottieProps,
306
372
  PileComponent,
@@ -312,13 +378,15 @@ export type {
312
378
  PlainTextExperimentProviderProps,
313
379
  Plugin,
314
380
  PluginContext,
315
- PluginEntity,
381
+ PluginSelfTestResult,
316
382
  PostponeRenderProps,
317
383
  PressableBaseProps,
318
384
  PressableHighlightProps,
319
385
  PressableOpacityProps,
386
+ Primitive,
320
387
  PromoSheetComponent,
321
388
  PromoSheetProps,
389
+ PushedManifest,
322
390
  RedesignBottomSheetTitleHeaderBaseProps,
323
391
  RedesignCompatComponent,
324
392
  RedesignCompatProps,
@@ -342,8 +410,16 @@ export type {
342
410
  SemanticColorToken,
343
411
  ServerTabLottieComponent,
344
412
  ServerTabLottieProps,
413
+ SettingChoice,
414
+ SettingCommon,
415
+ SettingCondition,
416
+ SettingPrimitive,
417
+ SettingSchema,
418
+ SettingValue,
345
419
  SettingsEntry,
420
+ SettingsGroupSchema,
346
421
  SettingsObject,
422
+ SettingsSchema,
347
423
  SettingsScreen,
348
424
  SettingsValue,
349
425
  SheetBottomSheetComponent,
@@ -352,6 +428,8 @@ export type {
352
428
  ShimmerTextSlotProps,
353
429
  SimpleActionSheetComponent,
354
430
  SimpleActionSheetProps,
431
+ SimpleMarkdownModule,
432
+ SimpleMarkdownParser,
355
433
  SliderComponent,
356
434
  SliderProps,
357
435
  SlotProps,
@@ -365,6 +443,9 @@ export type {
365
443
  StepPillProps,
366
444
  StickyWrapperComponent,
367
445
  StickyWrapperProps,
446
+ StorelessSchema,
447
+ StringDisplay,
448
+ StringSettingSchema,
368
449
  StyleSheetSpec,
369
450
  StyleSheetSpecOrFactory,
370
451
  SubtitleProps,
@@ -412,7 +493,6 @@ export type {
412
493
  Theme,
413
494
  ThemeContextProviderRootThemeContextProviderComponent,
414
495
  ThemeContextProviderRootThemeContextProviderProps,
415
- ThemeEntity,
416
496
  ThemeProviderProps,
417
497
  ThemeSemanticColor,
418
498
  TitleProps,
@@ -429,7 +509,9 @@ export type {
429
509
  ToggleIconButtonComponent,
430
510
  ToggleIconButtonProps,
431
511
  TransitionState,
512
+ UnboundAppIcon,
432
513
  UnboundAsset,
514
+ UncertainValue,
433
515
  VisualEffectViewProps,
434
516
  VoidIconProps,
435
517
  VoidTextInputProps,
@@ -437,7 +519,7 @@ export type {
437
519
  YouTabLottieComponent,
438
520
  YouTabLottieProps,
439
521
  } from './_internal';
440
- import type { NativePlatformBridge } from './_internal';
522
+ import type { AddonHandle, AddonLogger, NativePlatformBridge } from './_internal';
441
523
  import * as React$1 from 'react';
442
524
  import * as RN from 'react-native';
443
525
 
@@ -448,28 +530,108 @@ declare global {
448
530
  */
449
531
  var $$DEV$$: boolean;
450
532
  var NativePlatform: NativePlatformBridge | undefined;
533
+ /**
534
+ * The message keys command text takes, one member per key. A plugin's generated `src/unbound-i18n.d.ts` fills it
535
+ * from its `i18n/en-US.json` and the client from Unbound's; an interface so each declaration merges into it.
536
+ */
537
+ // oxlint-disable-next-line typescript/consistent-type-definitions -- only an interface merges across files.
538
+ interface UnboundMessageKeys {}
539
+
451
540
  var React: typeof React$1;
452
541
  var ReactNative: typeof RN;
453
542
  }
454
543
 
455
- export interface UnboundGlobal {
544
+ /** The globals a plugin runs with, keyed by name. Plugin code reads them without an import. */
545
+ export type AddonScope = {
546
+ /** Discord's React, whose `createElement` keeps a reloaded plugin's components matched to their mounted ones. */ React: typeof React;
547
+ /** The Unbound API, with the `metro`, `storage`, `flux`, `patcher`, `commands`, `settings` and `assets` registrations scoped to this plugin, and `toasts`, `dialogs` and `i18n` reading its own messages. */ unbound: UnboundGlobal;
548
+ /** This plugin's handle: its manifest and state. */ addon: AddonHandle;
549
+ /** The patcher, tagging each patch with this plugin's id; Unbound removes them when it stops. */ patcher: UnboundGlobal['patcher'];
550
+ /** A logger that prefixes each line with this plugin's name. */ logger: AddonLogger;
551
+ /** `setTimeout`, cleared when this plugin stops. */ setTimeout: typeof setTimeout;
552
+ /** `setInterval`, cleared when this plugin stops. */ setInterval: typeof setInterval;
553
+ /** Clears a timer this plugin set with `setTimeout`. */ clearTimeout: typeof clearTimeout;
554
+ /** Clears a timer this plugin set with `setInterval`. */ clearInterval: typeof clearInterval;
555
+ /** The commands API, registering each command under this plugin's id; Unbound removes them when it stops. */ commands: Omit<
556
+ ReturnType<UnboundGlobal['commands']['createCommands']>,
557
+ keyof UnboundGlobal['commands']
558
+ > &
559
+ UnboundGlobal['commands'];
560
+ };
561
+
562
+ /** The lifecycle entry points, all the global `unbound` object keeps after {@link shutdown}. */
563
+ export interface UnboundLifecycle {
564
+ /**
565
+ * @description Brings up the client, initialising the built-ins, plugins, and themes managers in turn. Twin of
566
+ * {@link shutdown}.
567
+ */
568
+ initialize(): void;
569
+ /**
570
+ * @description Tears the client back down, shutting down the built-ins, plugins, and themes managers and persisting
571
+ * settings before clearing the global down to the lifecycle entry points. Twin of {@link initialize}.
572
+ * @returns A promise that resolves once settings have been persisted and shutdown is complete.
573
+ */
574
+ shutdown(): Promise<void>;
575
+ }
576
+
577
+ /** The global `unbound` object while the client is initialized: the API plus the lifecycle. */
578
+ export interface UnboundGlobal extends UnboundLifecycle {
579
+ /** The `assets` module, which plugins also import from `@unbound-app/api/assets`. */
456
580
  assets: typeof import('./assets.d.ts');
581
+ /** The `builtins` module, which plugins also import from `@unbound-app/api/builtins`. */
582
+ builtins: typeof import('./builtins.d.ts');
583
+ /** The `commands` module, which plugins also import from `@unbound-app/api/commands`. */
457
584
  commands: typeof import('./commands.d.ts');
585
+ /** The `dialogs` module, which plugins also import from `@unbound-app/api/dialogs`. */
458
586
  dialogs: typeof import('./dialogs.d.ts');
587
+ /** The `flux` module, which plugins also import from `@unbound-app/api/flux`. */
588
+ flux: typeof import('./flux.d.ts');
589
+ /** The `fonts` module, which plugins also import from `@unbound-app/api/fonts`. */
590
+ fonts: typeof import('./fonts.d.ts');
591
+ /** The `fs` module, which plugins also import from `@unbound-app/api/fs`. */
459
592
  fs: typeof import('./fs.d.ts');
593
+ /** The `i18n` module, which plugins also import from `@unbound-app/api/i18n`. */
460
594
  i18n: typeof import('./i18n.d.ts');
595
+ /** The `iconPacks` module, which plugins also import from `@unbound-app/api/iconPacks`. */
596
+ iconPacks: typeof import('./iconPacks.d.ts');
597
+ /** The `marketplace` module, which plugins also import from `@unbound-app/api/marketplace`. */
598
+ marketplace: typeof import('./marketplace.d.ts');
599
+ /** The `metro` module, which plugins also import from `@unbound-app/api/metro`. */
461
600
  metro: typeof import('./metro/index.d.ts');
601
+ /** The `native` module, which plugins also import from `@unbound-app/api/native`. */
462
602
  native: typeof import('./native.d.ts');
603
+ /** The `patcher` module, which plugins also import from `@unbound-app/api/patcher`. */
463
604
  patcher: typeof import('./patcher.d.ts');
605
+ /** The `plugins` module, which plugins also import from `@unbound-app/api/plugins`. */
606
+ plugins: typeof import('./plugins.d.ts');
607
+ /** The `settings` module, which plugins also import from `@unbound-app/api/settings`. */
464
608
  settings: typeof import('./settings.d.ts');
609
+ /** The `shims` module, which plugins also import from `@unbound-app/api/shims`. */
610
+ shims: typeof import('./shims.d.ts');
611
+ /** The `storage` module, which plugins also import from `@unbound-app/api/storage`. */
465
612
  storage: typeof import('./storage.d.ts');
613
+ /** The `sync` module, which plugins also import from `@unbound-app/api/sync`. */
614
+ sync: typeof import('./sync.d.ts');
615
+ /** The `themes` module, which plugins also import from `@unbound-app/api/themes`. */
616
+ themes: typeof import('./themes.d.ts');
617
+ /** The `toasts` module, which plugins also import from `@unbound-app/api/toasts`. */
466
618
  toasts: typeof import('./toasts.d.ts');
619
+ /** The `ui` module, which plugins also import from `@unbound-app/api/ui`. */
620
+ ui: typeof import('./ui.d.ts');
621
+ /** The `updates` module, which plugins also import from `@unbound-app/api/updates`. */
622
+ updates: typeof import('./updates.d.ts');
623
+ /** The `utils` module, which plugins also import from `@unbound-app/api/utils`. */
624
+ utils: typeof import('./utils/index.d.ts');
467
625
  }
468
626
 
469
627
  declare global {
470
628
  interface Window {
471
- unbound: UnboundGlobal;
629
+ unbound: UnboundGlobal | UnboundLifecycle;
472
630
  }
473
631
 
474
- const unbound: Window['unbound'];
632
+ const unbound: AddonScope['unbound'];
633
+ const addon: AddonScope['addon'];
634
+ const patcher: AddonScope['patcher'];
635
+ const logger: AddonScope['logger'];
636
+ const commands: AddonScope['commands'];
475
637
  }
package/src/i18n.d.ts CHANGED
@@ -1,24 +1,7 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
- declare const _default: {
4
- Messages: Record<string, string>;
5
- format: typeof format;
6
- defineLocalizations: typeof defineLocalizations;
7
- init: typeof init;
8
- destroy: typeof destroy;
9
- };
10
- /** The core `Messages` proxy, resolving Unbound's own UI strings against the active Discord locale. */
11
- export declare const Messages: Record<string, string>;
12
- /**
13
- * @description Creates an isolated, in-memory `Messages`/`format` pair over an addon-supplied string table, sharing the active locale with core.
14
- * @param table The addon's string store, keyed by locale then message key.
15
- * @returns A `Messages` proxy and `format` function scoped to the supplied table.
16
- */
17
- export declare function defineLocalizations(table: StringStore): Localizations;
18
- /**
19
- * @description Drains every active locale-change subscription. Idempotent. Twin of {@link init}.
20
- */
21
- export declare function destroy(): void;
3
+ /** The core messages proxy, resolving Unbound's own UI strings against the active Discord locale. */
4
+ export declare const messages: Record<string, string>;
22
5
  /**
23
6
  * @description Formats a localized string, interpolating ICU `MessageFormat` placeholders.
24
7
  * @param key The message key to resolve and format.
@@ -26,19 +9,38 @@ export declare function destroy(): void;
26
9
  * @returns The formatted string.
27
10
  */
28
11
  export declare function format(key: string, vars?: FormatVars): string;
29
- /**
30
- * @description Loads the fallback and active locales, then subscribes to Discord locale changes. Fire-and-forget; never blocks startup. Twin of {@link destroy}.
31
- * @returns A promise that resolves once the initial locales have been ensured and the subscription is wired.
32
- */
33
- export declare function init(): Promise<void>;
34
- export type FormatVars = Record<string, string | number | boolean | Date>;
35
- export type LocaleStrings = Record<string, string>;
36
- export type Localizations = {
37
- Messages: Record<string, string>;
12
+ /** An addon's `messages`, `format` and `useMessages`, over en-US and at most one other locale. */
13
+ export type AddonLocales = {
14
+ /** Each message in the active locale, falling back to en-US, then the key itself. */
15
+ messages: LocaleStrings;
16
+ /** Formats a message in the active locale, filling its placeholders from `vars`. */
38
17
  format: (key: string, vars?: FormatVars) => string;
18
+ /**
19
+ * Re-renders the component when the locale changes or its table loads. Returns the active locale code,
20
+ * a dependency for `useMemo` and `useCallback` over strings.
21
+ */
22
+ useMessages: () => string;
23
+ /** The en-US messages inlined in the bundle. */
24
+ source: Readonly<LocaleStrings>;
25
+ /** Calls the listener when the locale changes or its table loads; returns the remover. */
26
+ subscribe: (listener: () => void) => () => void;
27
+ /** The locales held in memory: en-US, and the active one once it loaded. */
28
+ loadedLocales: () => string[];
29
+ /** Stops following locale changes and drops the loaded table. */
30
+ dispose: () => void;
39
31
  };
40
- export type StringStore = Record<string, LocaleStrings>;
41
-
42
- export { _default as default };
32
+ /** The values `format` puts into a message's ICU `MessageFormat` placeholders, by placeholder name. */
33
+ export type FormatVars = Record<string, string | number | boolean | Date>;
34
+ /** Where an addon's translations live: the codes its manifest lists, and how to read one. */
35
+ export type LocaleSource = {
36
+ /** The addon's id, named in errors. */
37
+ owner: string;
38
+ /** Every locale the addon ships beside its bundle, en-US aside. */
39
+ codes: readonly string[];
40
+ /** Reads one locale's JSON, such as from `<addon folder>/i18n/<code>.json`. */
41
+ read: (code: string) => Promise<string>;
42
+ };
43
+ /** One locale's messages, keyed by message key. */
44
+ export type LocaleStrings = Record<string, string>;
43
45
 
44
46
  export {};
@@ -0,0 +1,43 @@
1
+ // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
+
3
+ import type { AddonHandle, PushedManifest } from './_internal';
4
+ /** Disables an icon pack and restores the default icons. */
5
+ export declare const disable: (id: string) => void;
6
+ /** Enables an icon pack and applies it. */
7
+ export declare const enable: (id: string) => void | Promise<void>;
8
+ /** Reads one installed icon pack by id. */
9
+ export declare const get: (id: string) => AddonHandle | undefined;
10
+ /** Lists every installed icon pack. */
11
+ export declare const getAll: () => AddonHandle[];
12
+ /** Installs an icon pack from its manifest URL. */
13
+ export declare const install: (url: string, digest?: string) => Promise<AddonHandle | undefined>;
14
+ /** Reports whether an icon pack is enabled. */
15
+ export declare const isEnabled: (id: string) => boolean;
16
+ /** Swaps an icon pack's files in place, keeping its enabled state. */
17
+ export declare const reload: (
18
+ id: string,
19
+ bundle: string,
20
+ manifest: PushedManifest,
21
+ bytecode?: string,
22
+ ) => Promise<ReloadResult>;
23
+ /** Enables a disabled icon pack, or disables an enabled one. */
24
+ export declare const toggle: (id: string) => void;
25
+ /** Removes an installed icon pack. */
26
+ export declare const uninstall: (id: string) => Promise<void>;
27
+ /**
28
+ * @description Checks for updates, then applies this icon pack's pending update.
29
+ * @param id The icon pack's id.
30
+ * @returns Whether the icon pack now runs a newer version.
31
+ */
32
+ export declare function update(id: string): Promise<boolean>;
33
+ /** The outcome of an addon reload: success, or failure carrying the recorded error. */
34
+ export type ReloadResult =
35
+ | {
36
+ ok: true;
37
+ }
38
+ | {
39
+ ok: false;
40
+ error: Error;
41
+ };
42
+
43
+ export {};
package/src/index.d.ts CHANGED
@@ -1,13 +1,27 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ /// <reference path="../ambient/image-modules.d.ts" />
4
+
3
5
  export * as assets from './assets';
6
+ export * as builtins from './builtins';
4
7
  export * as commands from './commands';
5
8
  export * as dialogs from './dialogs';
9
+ export * as flux from './flux';
10
+ export * as fonts from './fonts';
6
11
  export * as fs from './fs';
7
12
  export * as i18n from './i18n';
13
+ export * as iconPacks from './iconPacks';
14
+ export * as marketplace from './marketplace';
8
15
  export * as metro from './metro/index';
9
16
  export * as native from './native';
10
17
  export * as patcher from './patcher';
18
+ export * as plugins from './plugins';
11
19
  export * as settings from './settings';
20
+ export * as shims from './shims';
12
21
  export * as storage from './storage';
22
+ export * as sync from './sync';
23
+ export * as themes from './themes';
13
24
  export * as toasts from './toasts';
25
+ export * as ui from './ui';
26
+ export * as updates from './updates';
27
+ export * as utils from './utils/index';
@@ -0,0 +1,50 @@
1
+ // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
+
3
+ import type { AddonAuthor, AddonKind } from './_internal';
4
+ /**
5
+ * @description Installs the latest version of a marketplace addon, with the plugins it depends on once the user agrees.
6
+ * @param id The addon's id in the catalog.
7
+ * @returns Whether the addon now runs that version.
8
+ */
9
+ export declare function install(id: string): Promise<boolean>;
10
+ /**
11
+ * @description Fetches the marketplace catalog if it changed. Concurrent calls share one request.
12
+ * @returns Whether the server could be reached.
13
+ */
14
+ export declare function refresh(): Promise<boolean>;
15
+ /**
16
+ * @description Lists the catalog's addons of one type that match a query.
17
+ * @param query The addon type, an optional search text and the sort order.
18
+ * @returns The matching addons, or none while the catalog has not loaded.
19
+ */
20
+ export declare function search(query: CatalogQuery): MarketplaceListing[];
21
+ /** What `marketplace.search` filters the catalog by. */
22
+ export type CatalogQuery = {
23
+ /** Only addons of this kind are returned. */
24
+ type: AddonKind;
25
+ /** Matches the name, description, authors or id, case-insensitively. */
26
+ search?: string;
27
+ /** The result order; `name` when omitted. */
28
+ sort?: CatalogSort;
29
+ };
30
+ /** `name` sorts alphabetically, `updated` puts the most recently published versions first. */
31
+ export type CatalogSort = 'name' | 'updated';
32
+ /** One addon the marketplace lists, at its newest version. */
33
+ export type MarketplaceListing = {
34
+ /** The addon's id from its manifest, which installs and updates key on. */
35
+ id: string;
36
+ /** Whether the addon is a plugin, theme, icon pack or font. */
37
+ type: AddonKind;
38
+ /** The catalog's display name, or the newest version's manifest name when the catalog has none. */
39
+ name: string;
40
+ /** The catalog's description, or the newest version's manifest description when the catalog has none. */
41
+ description: string;
42
+ /** The authors listed in the newest version's manifest. */
43
+ authors: AddonAuthor[];
44
+ /** The newest published version. */
45
+ version: string;
46
+ /** When the newest version was published, as an ISO 8601 date-time. */
47
+ publishedAt: string;
48
+ };
49
+
50
+ export {};
@@ -1,12 +1,20 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ /** Discord's action sheet module, with `openLazy` and `hideActionSheet`; found on first access. */
3
4
  export declare const ActionSheets: any;
5
+ /** Discord's module with `fetchProfile`, which loads a user's profile from the API; found on first access. */
4
6
  export declare const AsyncUsers: any;
7
+ /** Discord's invite actions module, with `acceptInviteAndTransitionToInviteChannel`; found on first access. */
5
8
  export declare const Invites: any;
9
+ /** Discord's link opener module, with `openURL` and `openSettings`; found on first access. */
6
10
  export declare const Linking: any;
11
+ /** Discord's message actions module, with `sendMessage` and `receiveMessage`; found on first access. */
7
12
  export declare const Messages: any;
13
+ /** Discord's module with `openOAuth2Modal`, which opens the app authorize screen; found on first access. */
8
14
  export declare const OAuth2: any;
15
+ /** Discord's module with `showUserProfile`, which opens a user's profile; found on first access. */
9
16
  export declare const Profiles: any;
17
+ /** Discord's user profile action sheet helpers, such as `getUserProfileActionSheetKey`; found on first access. */
10
18
  export declare const UserProfiles: any;
11
19
 
12
20
  export {};