@unbound-app/api 2.0.0 → 2.2.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/package.json +1 -1
- package/src/_internal.d.ts +24 -4
- package/src/global.d.ts +1 -0
- package/src/ui.d.ts +15 -40
- package/testing/fake-components.ts +0 -1
- package/testing/fake-settings-panel.ts +0 -4
- package/testing/fake-settings.ts +1 -1
package/package.json
CHANGED
package/src/_internal.d.ts
CHANGED
|
@@ -4980,6 +4980,8 @@ export type NewerDesignComponents = {
|
|
|
4980
4980
|
SearchBar: DesignBarrelComponents['TextField'];
|
|
4981
4981
|
/** Discord's status label, such as New or Beta, or custom text. */
|
|
4982
4982
|
Badge: React$1.ComponentType<BadgeProps>;
|
|
4983
|
+
/** Discord 354's settings slider row: its label and live value over a `Slider`. */
|
|
4984
|
+
TableSliderRow: React$1.ComponentType<TableSliderRowProps>;
|
|
4983
4985
|
};
|
|
4984
4986
|
export type NitroGem12LottieComponent = React$1.ComponentType<
|
|
4985
4987
|
NitroGem12LottieProps & Record<string, unknown>
|
|
@@ -5822,10 +5824,6 @@ export type StringSettingSchema = {
|
|
|
5822
5824
|
placeholder?: string;
|
|
5823
5825
|
/** `color`: also takes an alpha channel, `#RRGGBBAA`. */
|
|
5824
5826
|
alpha?: boolean;
|
|
5825
|
-
/** `color`: colors offered first. */
|
|
5826
|
-
presets?: string[];
|
|
5827
|
-
/** `color`: draws `presets` inline instead of a swatch row. */
|
|
5828
|
-
palette?: boolean;
|
|
5829
5827
|
/** `image`: the largest file accepted, in bytes. */
|
|
5830
5828
|
maxSize?: number;
|
|
5831
5829
|
};
|
|
@@ -6073,6 +6071,28 @@ export type TableRowTrailingTextComponent = React$1.ComponentType<TableRowTraili
|
|
|
6073
6071
|
export type TableRowTrailingTextProps = {
|
|
6074
6072
|
text?: DesignTextProps['children'];
|
|
6075
6073
|
};
|
|
6074
|
+
/**
|
|
6075
|
+
* The props of Discord's `TableSliderRow`, read from Discord 354's `design/components/TableRow/native/TableSliderRow.native.tsx`.
|
|
6076
|
+
* Any other prop, such as `maxValue` or `step`, goes to its `Slider`.
|
|
6077
|
+
*/
|
|
6078
|
+
export type TableSliderRowProps = {
|
|
6079
|
+
/** The title, drawn left of the formatted value. */
|
|
6080
|
+
label: string;
|
|
6081
|
+
/** The value the slider starts at and follows. */
|
|
6082
|
+
value: number;
|
|
6083
|
+
/** The value the slider marks on its track. */
|
|
6084
|
+
defaultValue?: number;
|
|
6085
|
+
/** The lowest value; `0` when omitted. */
|
|
6086
|
+
minValue?: number;
|
|
6087
|
+
/** Formats the value shown right of the label; no value is shown when omitted. */
|
|
6088
|
+
formatValue?: (value: number) => string;
|
|
6089
|
+
/** Called with each value while dragging. */
|
|
6090
|
+
onChange?: (value: number) => void;
|
|
6091
|
+
/** Whether the row starts its group's card, when it is not in a `TableRowGroup`. */
|
|
6092
|
+
start?: boolean;
|
|
6093
|
+
/** Whether the row ends its group's card, when it is not in a `TableRowGroup`. */
|
|
6094
|
+
end?: boolean;
|
|
6095
|
+
};
|
|
6076
6096
|
export type TableSwitchRowComponent = React$1.ComponentType<
|
|
6077
6097
|
TableSwitchRowProps & Record<string, unknown>
|
|
6078
6098
|
>;
|
package/src/global.d.ts
CHANGED
package/src/ui.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ import { ComponentProps, ComponentType, FunctionComponent, ReactElement, ReactNo
|
|
|
14
14
|
import * as RN from 'react-native';
|
|
15
15
|
import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
16
16
|
/**
|
|
17
|
-
* @description
|
|
18
|
-
* `danger`
|
|
17
|
+
* @description A pressable `TableRow` in its settings group, as Discord draws actions such as Log Out; it asks first when
|
|
18
|
+
* `confirmation` is set. `danger` draws the label red behind a red trash icon.
|
|
19
19
|
* @param props The row's label, variant, confirmation and press handler.
|
|
20
20
|
* @returns The row.
|
|
21
21
|
*/
|
|
@@ -54,7 +54,7 @@ export declare function ChecklistRow({
|
|
|
54
54
|
onChange,
|
|
55
55
|
}: ChecklistRowProps): React$1.ReactElement;
|
|
56
56
|
/**
|
|
57
|
-
* @description A settings row that shows a color swatch, opens Discord's color picker when pressed
|
|
57
|
+
* @description A settings row that shows a color swatch, opens Discord's color picker when pressed and offers a reset back to the default. Discord's picker reports its current color when dismissed, so a pick matching the shown color is ignored.
|
|
58
58
|
* @param props The row's label, chosen color, the default it falls back to and the change handler.
|
|
59
59
|
* @returns The row.
|
|
60
60
|
*/
|
|
@@ -94,7 +94,7 @@ export declare function EntityRow({
|
|
|
94
94
|
}: EntityRowProps): React$1.ReactElement;
|
|
95
95
|
/**
|
|
96
96
|
* @description A settings row, Discord's way: the label, and the saved text trailing (masked when secret). Pressing
|
|
97
|
-
* it opens Discord's
|
|
97
|
+
* it opens Discord's dialog with the focused input, its description and error, which saves only on Save.
|
|
98
98
|
* @param props The row's label, saved text, variant, validation and change handler.
|
|
99
99
|
* @returns The row.
|
|
100
100
|
*/
|
|
@@ -111,7 +111,9 @@ export declare function InputRow({
|
|
|
111
111
|
onChange,
|
|
112
112
|
}: InputRowProps): React$1.ReactElement;
|
|
113
113
|
/**
|
|
114
|
-
* @description A titled, editable list of strings: each row moves up or down or is
|
|
114
|
+
* @description A titled, editable list of strings: each row moves up or down, or is deleted after a confirmation; the
|
|
115
|
+
* delete button stands apart from the arrows so it is hard to hit by mistake. An Add row opens
|
|
116
|
+
* Discord's input dialog for a new one.
|
|
115
117
|
* @param props The group's title, saved strings, limit, validation and change handler.
|
|
116
118
|
* @returns The group.
|
|
117
119
|
*/
|
|
@@ -149,19 +151,6 @@ export declare function NumberRow({
|
|
|
149
151
|
* it as the root of every settings page.
|
|
150
152
|
*/
|
|
151
153
|
export declare function Page({ children }: PageProps): React$1.ReactElement;
|
|
152
|
-
/**
|
|
153
|
-
* @description A settings row with a grid of color swatches, the picked one ringed, for a fixed set of colors.
|
|
154
|
-
* @param props The row's label, picked color, colors and change handler.
|
|
155
|
-
* @returns The row.
|
|
156
|
-
*/
|
|
157
|
-
export declare function PaletteRow({
|
|
158
|
-
label,
|
|
159
|
-
subLabel,
|
|
160
|
-
value,
|
|
161
|
-
presets,
|
|
162
|
-
disabled,
|
|
163
|
-
onChange,
|
|
164
|
-
}: PaletteRowProps): React$1.ReactElement;
|
|
165
154
|
/**
|
|
166
155
|
* @description A row showing the picked option that opens Discord's action sheet listing every option, for choices too many for a radio group.
|
|
167
156
|
* @param props The row's label, picked value, options and change handler.
|
|
@@ -194,8 +183,9 @@ export declare function RadioRow({
|
|
|
194
183
|
*/
|
|
195
184
|
export declare function ResetRow({ label, onReset }: ResetRowProps): React$1.ReactElement;
|
|
196
185
|
/**
|
|
197
|
-
* @description
|
|
198
|
-
*
|
|
186
|
+
* @description Discord's `InlineNotice` saying a change applies after Discord restarts, with a button that restarts
|
|
187
|
+
* it now; on builds without one, a card holding the same text and button.
|
|
188
|
+
* @returns The notice.
|
|
199
189
|
*/
|
|
200
190
|
export declare function RestartRow(): React$1.ReactElement;
|
|
201
191
|
/**
|
|
@@ -245,9 +235,9 @@ export declare function SegmentedRow({
|
|
|
245
235
|
onChange,
|
|
246
236
|
}: SegmentedRowProps): React$1.ReactElement;
|
|
247
237
|
/**
|
|
248
|
-
* @description
|
|
249
|
-
* with its
|
|
250
|
-
* slider and iOS's take differently named props, so it passes both.
|
|
238
|
+
* @description Discord's `TableSliderRow`, as its own settings draw one: the label and live value over the slider
|
|
239
|
+
* with its default mark. A sub-label, which that row cannot show, moves it to a `TableRow` holding the same slider.
|
|
240
|
+
* The value is saved when the drag ends; Android's slider and iOS's take differently named props, so it passes both.
|
|
251
241
|
* @param props The row's label, value, default, range and change handler.
|
|
252
242
|
* @returns The row, or `null` when Discord's slider is unavailable.
|
|
253
243
|
*/
|
|
@@ -350,11 +340,11 @@ export type ColorRowProps = {
|
|
|
350
340
|
label: string;
|
|
351
341
|
/** The chosen color as a `#RRGGBB` hex code, or `undefined` when the default applies. */
|
|
352
342
|
color: string | undefined;
|
|
353
|
-
/** The default color, swatched while `color` is unset
|
|
343
|
+
/** The default color, swatched and opened in the picker while `color` is unset. */
|
|
354
344
|
fallbackColor: string;
|
|
355
345
|
/** The text shown under the label while `color` is unset, in place of the hex code. */
|
|
356
346
|
fallbackLabel: string;
|
|
357
|
-
/** Called with the new `#RRGGBB` hex code, or `undefined` when the user resets
|
|
347
|
+
/** Called with the new `#RRGGBB` hex code, or `undefined` when the user resets it. */
|
|
358
348
|
onChange: (color: string | undefined) => void;
|
|
359
349
|
};
|
|
360
350
|
/** What `storage.define` returns: a schema's settings, bound to one Bucket. */
|
|
@@ -485,21 +475,6 @@ export type PageProps = {
|
|
|
485
475
|
/** The page's form groups, laid out top to bottom with a 24px gap. */
|
|
486
476
|
children: React$1.ReactNode;
|
|
487
477
|
};
|
|
488
|
-
/** Props for `PaletteRow`. */
|
|
489
|
-
export type PaletteRowProps = {
|
|
490
|
-
/** The row's label. */
|
|
491
|
-
label: string;
|
|
492
|
-
/** Text shown under the label; none when omitted. */
|
|
493
|
-
subLabel?: string;
|
|
494
|
-
/** The picked color, `#RRGGBB`. */
|
|
495
|
-
value: string;
|
|
496
|
-
/** The colors offered, `#RRGGBB`. */
|
|
497
|
-
presets: string[];
|
|
498
|
-
/** Dims the row and ignores input. Defaults to false. */
|
|
499
|
-
disabled?: boolean;
|
|
500
|
-
/** Called with the color the user presses. */
|
|
501
|
-
onChange: (color: string) => void;
|
|
502
|
-
};
|
|
503
478
|
/** Props for `PickerRow`. */
|
|
504
479
|
export type PickerRowProps = {
|
|
505
480
|
/** The row's label. */
|
|
@@ -48,10 +48,6 @@ function rowName(node: SchemaNode): string {
|
|
|
48
48
|
const display = String(node.displayAs);
|
|
49
49
|
const entity = ['user', 'channel', 'guild', 'role'].includes(display);
|
|
50
50
|
|
|
51
|
-
if (display === 'color' && node.palette === true) {
|
|
52
|
-
return 'PaletteRow';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
51
|
return (
|
|
56
52
|
ROWS[kind] ??
|
|
57
53
|
ROWS[`${kind}:${display}`] ??
|
package/testing/fake-settings.ts
CHANGED
|
@@ -65,7 +65,7 @@ type Options = FakeModule;
|
|
|
65
65
|
|
|
66
66
|
const COMMON = ['title', 'subtitle', 'hidden', 'requiresRestart'];
|
|
67
67
|
const CONDITIONS = ['visibleWhen', 'disabledWhen'];
|
|
68
|
-
const STRING = ['minLength', 'maxLength', 'placeholder', 'alpha', '
|
|
68
|
+
const STRING = ['minLength', 'maxLength', 'placeholder', 'alpha', 'maxSize'];
|
|
69
69
|
|
|
70
70
|
// Mirrors the build's builders: the JSON keeps these options, and a predicate becomes `{ predicate: true }`.
|
|
71
71
|
function meta(kind: string, displayAs: string, options: Options, keys: string[] = []): SchemaNode {
|