@unbound-app/api 0.11.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 +27 -4
- package/src/_internal.d.ts +2771 -139
- 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 +101 -25
- package/src/dialogs.d.ts +90 -25
- package/src/flux.d.ts +317 -0
- package/src/fonts.d.ts +51 -0
- package/src/fs.d.ts +15 -24
- package/src/global.d.ts +173 -11
- package/src/i18n.d.ts +33 -31
- package/src/iconPacks.d.ts +43 -0
- package/src/index.d.ts +14 -0
- package/src/marketplace.d.ts +50 -0
- package/src/metro/api.d.ts +8 -0
- package/src/metro/common.d.ts +34 -5
- package/src/metro/components.d.ts +34 -25
- package/src/metro/filters.d.ts +31 -16
- package/src/metro/index.d.ts +26079 -83
- package/src/metro/stores.d.ts +5 -0
- package/src/native.d.ts +77 -5
- package/src/patcher.d.ts +214 -57
- package/src/plugins.d.ts +55 -0
- package/src/settings.d.ts +8 -16
- package/src/shims.d.ts +5 -0
- package/src/storage.d.ts +80 -224
- 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/metro/common.d.ts
CHANGED
|
@@ -1,26 +1,55 @@
|
|
|
1
1
|
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
2
|
|
|
3
|
+
export type { MarkdownParserModule, SimpleMarkdownModule } from '../_internal';
|
|
4
|
+
import type { MarkdownParserModule, SimpleMarkdownModule } from '../_internal';
|
|
5
|
+
import * as React$1 from 'react';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
import { ImageProps, ImageURISource } from 'react-native';
|
|
8
|
+
|
|
9
|
+
/** Discord's clipboard module, which reads and writes strings and images; found on first access. */
|
|
3
10
|
declare const Clipboard$1: any;
|
|
4
11
|
declare const React$1: typeof import('react');
|
|
12
|
+
/** The React Native instance Discord bundles, read from `window.ReactNative`. */
|
|
5
13
|
declare const ReactNative$1: typeof import('react-native');
|
|
14
|
+
/** React Native's asset registry, with `registerAsset`; found on first access. */
|
|
6
15
|
export declare const Assets: any;
|
|
16
|
+
/** Discord's module with `createBotMessage`, which builds a local message from Clyde; found on first access. */
|
|
7
17
|
export declare const Clyde: any;
|
|
18
|
+
/** Discord's slash command module, with `getBuiltInCommands`; found on first access. */
|
|
8
19
|
export declare const Commands: any;
|
|
20
|
+
/** Discord's constants module, with `Fonts`, `Endpoints` and more; found on first access. */
|
|
9
21
|
export declare const Constants: any;
|
|
10
|
-
|
|
11
|
-
export declare const Flux: any;
|
|
12
|
-
export declare const FluxHooks: any;
|
|
22
|
+
/** Discord's copy of `react-native-gesture-handler`; found on first access. */
|
|
13
23
|
export declare const Gestures: any;
|
|
14
|
-
|
|
24
|
+
/** React Native's image source resolver; patching it changes the source every `Image` renders. */
|
|
25
|
+
export declare const ImageSources: ImageSourcesModule;
|
|
26
|
+
/** Discord's markdown parser, which turns message text into an AST or React nodes; found on first access. */
|
|
27
|
+
export declare const MarkdownParser: MarkdownParserModule;
|
|
28
|
+
/** Discord's copy of Moment.js; found on first access. */
|
|
15
29
|
export declare const Moment: any;
|
|
30
|
+
/** Discord's HTTP client for its API, with `getAPIBaseURL`; found on first access. */
|
|
16
31
|
export declare const REST: any;
|
|
32
|
+
/** Discord's module exporting its `Radius` corner radius tokens; found on first access. */
|
|
17
33
|
export declare const Radius: any;
|
|
34
|
+
/** Discord's copy of `react-native-reanimated`; found on first access. */
|
|
18
35
|
export declare const Reanimated: any;
|
|
36
|
+
/** Discord's copy of `react-native-svg`, with `Svg` and `Path`; found on first access. */
|
|
19
37
|
export declare const SVG: any;
|
|
38
|
+
/** Discord's copy of `react-native-screens`, with `FullWindowOverlay`; found on first access. */
|
|
20
39
|
export declare const Screens: any;
|
|
40
|
+
/** Discord's copy of `simple-markdown`, whose block rules parse whole documents; found on first access. */
|
|
41
|
+
export declare const SimpleMarkdown: SimpleMarkdownModule;
|
|
42
|
+
/** Discord's design tokens, with `colors` and `internal`; found on first access. */
|
|
43
|
+
export declare const Theme: any;
|
|
44
|
+
/** Discord's `util` module, with `inspect` for printing values; found on first access. */
|
|
21
45
|
export declare const Util: any;
|
|
46
|
+
/** Discord's localisation module, with `getLanguages`, `getSystemLocale` and `intl`; found on first access. */
|
|
22
47
|
export declare const i18n: any;
|
|
23
|
-
|
|
48
|
+
/** React Native's `ImageSourceUtils`, which every `Image` render resolves its source through. */
|
|
49
|
+
export type ImageSourcesModule = {
|
|
50
|
+
/** Resolves the source or sources an `Image` with these props loads, or `null` for none. */
|
|
51
|
+
getImageSourcesFromImageProps: (props: ImageProps) => ImageURISource | ImageURISource[] | null;
|
|
52
|
+
};
|
|
24
53
|
export { Clipboard$1 as Clipboard, React$1 as React, ReactNative$1 as ReactNative };
|
|
25
54
|
|
|
26
55
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
2
|
|
|
3
|
-
export type {
|
|
4
|
-
|
|
3
|
+
export type { DesignComponentName, DesignModule } from '../_internal';
|
|
4
|
+
export { DESIGN_COMPONENTS } from '../_internal';
|
|
5
|
+
import type { DesignComponentName, DesignModule } from '../_internal';
|
|
5
6
|
import * as React$1 from 'react';
|
|
6
|
-
import { ComponentProps, ComponentType, ElementType, ReactNode } from 'react';
|
|
7
|
+
import { ComponentProps, ComponentType, ElementType, FunctionComponent, ReactNode } from 'react';
|
|
7
8
|
import * as RN from 'react-native';
|
|
8
9
|
import { ColorValue, ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
9
10
|
|
|
11
|
+
/** The `messageType` values for `HelpMessage`, from Discord or else Unbound's fallback; `{}` when neither loads. */
|
|
10
12
|
declare const HelpMessageTypes$1: any;
|
|
11
13
|
declare const HelpMessageTypes: {
|
|
12
14
|
readonly 0: 'WARNING';
|
|
@@ -18,18 +20,36 @@ declare const HelpMessageTypes: {
|
|
|
18
20
|
readonly ERROR: 2;
|
|
19
21
|
readonly SUCCESS: 3;
|
|
20
22
|
};
|
|
23
|
+
/** Discord's stacked avatar components, `AvatarPile` and `AvatarDuoPile`; found on first access. */
|
|
21
24
|
export declare const AvatarPiles: any;
|
|
25
|
+
/** Discord's avatar module, with `Avatar` and `AvatarSizes`; found on first access. */
|
|
22
26
|
export declare const Avatars: any;
|
|
27
|
+
/** Discord's blur backdrop components, with `BackgroundBlurFill`; found on first access. */
|
|
23
28
|
export declare const BackdropFilters: any;
|
|
29
|
+
/** Discord's bottom sheet components, with `ActionSheet` and `BottomSheetTitleHeader`; found on first access. */
|
|
24
30
|
export declare const BottomSheets: any;
|
|
31
|
+
/** Discord's default avatar images, `DEFAULT_AVATARS` and `DEFAULT_AVATARS_SMALL`; found on first access. */
|
|
25
32
|
export declare const DefaultAvatars: any;
|
|
26
33
|
/** Discord's design module, with Unbound's fallbacks standing in for components a build lacks. */
|
|
27
34
|
export declare const Discord: DesignModule;
|
|
35
|
+
/** Discord's copy of Shopify's `FlashList` module; found on first access. */
|
|
28
36
|
export declare const FlashList: any;
|
|
37
|
+
/** Discord's legacy form components, such as `FormRow` and `FormSection`; `{}` on builds without them. */
|
|
29
38
|
export declare const Forms: any;
|
|
39
|
+
/** The `@gorhom/bottom-sheet` Discord bundles, whose `BottomSheetScrollView` scrolls inside a `scrollable` sheet; found on first access. */
|
|
40
|
+
export declare const GorhomSheet: any;
|
|
41
|
+
/** Discord's media viewer module, with `openMediaModal`; found on first access. */
|
|
30
42
|
export declare const Media: any;
|
|
43
|
+
/** Discord's portal components, `Portal` and `PortalHost`, for rendering outside the tree; found on first access. */
|
|
31
44
|
export declare const Portal: any;
|
|
45
|
+
/** Discord's safe area components, with `SafeAreaPaddingView`; found on first access. */
|
|
32
46
|
export declare const SafeArea: any;
|
|
47
|
+
/** `react-native-safe-area-context`, with `useSafeAreaInsets`; found on first access. */
|
|
48
|
+
export declare const SafeAreaContext: any;
|
|
49
|
+
/** Discord's `TableRowDivider`, the hairline `TableRowGroup` draws between rows; found on first access. */
|
|
50
|
+
export declare const TableRowDividers: any;
|
|
51
|
+
/** Discord's video player module, with `VideoComponent` and `createVideoControls`; found on first access. */
|
|
52
|
+
export declare const Video: any;
|
|
33
53
|
/**
|
|
34
54
|
* @description Discord's help message, or Unbound's own on Discord builds that no longer ship one, picked on first render.
|
|
35
55
|
* @param props The message, its type, text styling, corner radius and an optional trailing button.
|
|
@@ -48,28 +68,14 @@ export declare function HelpMessage(
|
|
|
48
68
|
*/
|
|
49
69
|
export declare function Switch(
|
|
50
70
|
props: SwitchProps,
|
|
51
|
-
): import('react').ReactElement<
|
|
52
|
-
FormsFormSwitchProps,
|
|
53
|
-
string | import('react').JSXElementConstructor<any>
|
|
54
|
-
>;
|
|
55
|
-
/**
|
|
56
|
-
* @description Checks every design component the SDK exposes against the running Discord build.
|
|
57
|
-
* @returns The components Discord renders itself, the ones a fallback stands in for, and the ones nothing renders.
|
|
58
|
-
*/
|
|
59
|
-
export declare function auditDesignComponents(): DesignComponentAudit;
|
|
71
|
+
): import('react').ReactElement<SwitchProps, string | import('react').JSXElementConstructor<any>>;
|
|
60
72
|
/**
|
|
61
73
|
* @description Tells whether a value can be rendered as a React element type: a function or class
|
|
62
74
|
* component, or a `memo`/`forwardRef`/`lazy` object.
|
|
63
75
|
* @param value The value to check.
|
|
64
76
|
* @returns Whether React can render it.
|
|
65
77
|
*/
|
|
66
|
-
export declare function isRenderable(
|
|
67
|
-
value:
|
|
68
|
-
| DesignModule[keyof DesignModule]
|
|
69
|
-
| React$1.ElementType
|
|
70
|
-
| Record<string, React$1.ComponentType<never>>
|
|
71
|
-
| undefined,
|
|
72
|
-
): value is React$1.ElementType;
|
|
78
|
+
export declare function isRenderable(value: unknown): value is React$1.ElementType;
|
|
73
79
|
/**
|
|
74
80
|
* @description Registers the component the design module returns when a Discord build lacks the
|
|
75
81
|
* named one or ships something React can't render.
|
|
@@ -80,21 +86,24 @@ export declare function registerDesignFallback<K extends DesignComponentName>(
|
|
|
80
86
|
name: K,
|
|
81
87
|
component: DesignModule[K],
|
|
82
88
|
): void;
|
|
83
|
-
/**
|
|
84
|
-
export type DesignComponentAudit = {
|
|
85
|
-
native: DesignComponentName[];
|
|
86
|
-
fallback: DesignComponentName[];
|
|
87
|
-
missing: DesignComponentName[];
|
|
88
|
-
};
|
|
89
|
+
/** Props for `HelpMessage`; the defaults named here are those of Unbound's fallback. */
|
|
89
90
|
export type HelpMessageProps = {
|
|
91
|
+
/** The message; a string or number is rendered as text, any other node as given. */
|
|
90
92
|
children?: React$1.ReactNode;
|
|
93
|
+
/** A `HelpMessageTypes` value that picks the icon and feedback colors; `WARNING` when omitted. */
|
|
91
94
|
messageType?: HelpMessageType;
|
|
95
|
+
/** Discord's text variant for string children; `text-sm/medium` when omitted. */
|
|
92
96
|
textVariant?: string;
|
|
97
|
+
/** The color of string children; the theme's default text color when omitted. */
|
|
93
98
|
textColor?: ColorValue;
|
|
99
|
+
/** The corner radius in density-independent pixels; `8` when omitted. */
|
|
94
100
|
borderRadius?: number;
|
|
101
|
+
/** A node, usually a button, rendered after the message. */
|
|
95
102
|
button?: React$1.ReactNode;
|
|
96
103
|
};
|
|
104
|
+
/** A `HelpMessage` style: one of the `HelpMessageTypes` values. */
|
|
97
105
|
export type HelpMessageType = (typeof HelpMessageTypes)[keyof typeof HelpMessageTypes & string];
|
|
106
|
+
/** The props of Discord's `FormSwitch`, which the switch fallback accepts. */
|
|
98
107
|
export type SwitchProps = React$1.ComponentProps<DesignModule['FormSwitch']>;
|
|
99
108
|
export { HelpMessageTypes$1 as HelpMessageTypes };
|
|
100
109
|
|
package/src/metro/filters.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
|
|
2
2
|
|
|
3
|
-
import type { PredicateResult } from '../
|
|
3
|
+
import type { PredicateResult } from '../_types';
|
|
4
4
|
declare const CACHE_KEY: unique symbol;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @description Builds a filter matching a module every part matches, testing the parts in order.
|
|
7
|
+
* @param parts The filters to combine; none may be a raw filter such as `byFilePath`.
|
|
8
|
+
* @returns A {@link MetroFilter} keyed by its parts' keys in any order, or unkeyed when a part is.
|
|
9
|
+
*/
|
|
10
|
+
export declare function all(...parts: MetroFilter[]): MetroFilter;
|
|
11
|
+
/**
|
|
12
|
+
* @description Builds a filter matching a module any part matches, testing the parts in order.
|
|
13
|
+
* @param parts The filters to combine; none may be a raw filter such as `byFilePath`.
|
|
14
|
+
* @returns A {@link MetroFilter} keyed by its parts' keys in any order, or unkeyed when a part is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function any(...parts: MetroFilter[]): MetroFilter;
|
|
13
17
|
/**
|
|
14
18
|
* @description Builds a filter matching a module whose `displayName` equals the given name.
|
|
15
19
|
* @param name The `displayName` the module must have.
|
|
@@ -22,6 +26,13 @@ export declare function byDisplayName(name: string): MetroFilter;
|
|
|
22
26
|
* @returns A {@link MetroFilter} matching the module loaded from that file path.
|
|
23
27
|
*/
|
|
24
28
|
export declare function byFilePath(path: string): MetroFilter;
|
|
29
|
+
/**
|
|
30
|
+
* @description Builds a filter matching a flux store by name, appending `Store` when `short` is set.
|
|
31
|
+
* @param name The store name to match against.
|
|
32
|
+
* @param short Whether to append `Store` to `name` before matching.
|
|
33
|
+
* @returns A {@link MetroFilter} matching the flux store with that name.
|
|
34
|
+
*/
|
|
35
|
+
export declare function byFluxStore(name: string, short?: boolean): MetroFilter;
|
|
25
36
|
/**
|
|
26
37
|
* @description Builds a filter matching a module whose `name` equals the given name.
|
|
27
38
|
* @param name The `name` the module must have.
|
|
@@ -41,17 +52,21 @@ export declare function byProps(...props: string[]): MetroFilter;
|
|
|
41
52
|
*/
|
|
42
53
|
export declare function byPrototypes(...prototypes: string[]): MetroFilter;
|
|
43
54
|
/**
|
|
44
|
-
* @description Builds a filter matching a
|
|
45
|
-
* @param name The
|
|
46
|
-
* @
|
|
47
|
-
|
|
55
|
+
* @description Builds a filter matching a wrapped component, like one from `React.memo`, whose inner `type` has the given name.
|
|
56
|
+
* @param name The `name` of the wrapped component's `type`.
|
|
57
|
+
* @returns A {@link MetroFilter} matching the module whose `type` has that name.
|
|
58
|
+
*/
|
|
59
|
+
export declare function byTypeName(name: string): MetroFilter;
|
|
60
|
+
/**
|
|
61
|
+
* @description Builds a filter matching a module the given filter does not match.
|
|
62
|
+
* @param part The filter to negate; it may not be a raw filter such as `byFilePath`.
|
|
63
|
+
* @returns A {@link MetroFilter} keyed by the part's key, or unkeyed when the part is.
|
|
48
64
|
*/
|
|
49
|
-
export declare function
|
|
65
|
+
export declare function not(part: MetroFilter): MetroFilter;
|
|
50
66
|
/** A module predicate, carrying its cache key and a `raw` flag, produced by every `by*` helper. */
|
|
51
67
|
export type MetroFilter = ((mdl: any, id: number | string) => PredicateResult) & {
|
|
52
68
|
[CACHE_KEY]?: string;
|
|
53
69
|
isRaw?: boolean;
|
|
70
|
+
filePath?: string;
|
|
54
71
|
};
|
|
55
|
-
export { _default as default };
|
|
56
|
-
|
|
57
72
|
export {};
|