@gusnips/react 0.9.24 → 0.9.25
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/README.md +36 -36
- package/dist/api-client.d.ts +51 -51
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +3 -3
- package/dist/api-error.d.ts +11 -11
- package/dist/api-error.js +11 -11
- package/dist/auth-email.d.ts +40 -0
- package/dist/auth-email.d.ts.map +1 -0
- package/dist/auth-email.js +106 -0
- package/dist/auth-email.js.map +1 -0
- package/dist/auth-store.d.ts +23 -23
- package/dist/auth-store.js +13 -13
- package/dist/copy.d.ts +3 -3
- package/dist/copy.js +3 -3
- package/dist/deploy-recovery.d.ts +40 -40
- package/dist/deploy-recovery.js +40 -40
- package/dist/describe-error.d.ts +68 -68
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +5 -5
- package/dist/error-boundary.d.ts +12 -12
- package/dist/guards.d.ts +15 -15
- package/dist/guards.js +3 -3
- package/dist/hydrate.d.ts +15 -16
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +9 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/i18n.d.ts +15 -16
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +5 -6
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal-path.d.ts +8 -7
- package/dist/internal-path.d.ts.map +1 -1
- package/dist/internal-path.js +8 -7
- package/dist/internal-path.js.map +1 -1
- package/dist/prerender-contract.d.ts +7 -7
- package/dist/prerender-contract.js +7 -7
- package/dist/query.d.ts +16 -17
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/query.js.map +1 -1
- package/dist/sse.d.ts +19 -20
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +18 -19
- package/dist/sse.js.map +1 -1
- package/dist/states.d.ts +12 -12
- package/dist/states.d.ts.map +1 -1
- package/dist/supabase-session.d.ts +47 -48
- package/dist/supabase-session.d.ts.map +1 -1
- package/dist/supabase-session.js +35 -35
- package/dist/supabase-session.js.map +1 -1
- package/dist/theme.d.ts +4 -4
- package/dist/theme.js +4 -4
- package/dist/ui/class-name.d.ts +3 -4
- package/dist/ui/class-name.d.ts.map +1 -1
- package/dist/ui/class-name.js +3 -4
- package/dist/ui/class-name.js.map +1 -1
- package/dist/ui/combobox.d.ts +11 -11
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/dialog.d.ts +5 -5
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/drawer.d.ts +10 -10
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +2 -2
- package/dist/ui/input.d.ts +2 -2
- package/dist/ui/input.js +2 -2
- package/dist/ui/menu.d.ts +8 -8
- package/dist/ui/menu.d.ts.map +1 -1
- package/dist/ui/menu.js +4 -4
- package/dist/ui/menu.js.map +1 -1
- package/dist/ui/select.d.ts +12 -12
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +3 -3
- package/dist/ui/tabs.d.ts +14 -15
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +13 -14
- package/dist/ui/tabs.js.map +1 -1
- package/package.json +1 -1
- package/src/api-client.ts +51 -51
- package/src/api-error.ts +11 -11
- package/src/auth-email.test.ts +145 -0
- package/src/auth-email.ts +112 -0
- package/src/auth-store.ts +23 -23
- package/src/copy.ts +3 -3
- package/src/deploy-recovery.ts +40 -40
- package/src/describe-error.ts +68 -68
- package/src/error-boundary.tsx +12 -12
- package/src/guards.tsx +15 -15
- package/src/hydrate.ts +15 -16
- package/src/i18n.ts +15 -16
- package/src/index.ts +2 -0
- package/src/internal-path.ts +8 -7
- package/src/prerender-contract.ts +7 -7
- package/src/query.ts +16 -17
- package/src/sse.ts +19 -20
- package/src/states.ts +12 -12
- package/src/supabase-session.ts +46 -47
- package/src/theme.ts +4 -4
- package/src/ui/class-name.ts +3 -4
- package/src/ui/combobox.tsx +11 -11
- package/src/ui/dialog.tsx +5 -5
- package/src/ui/drawer.tsx +10 -10
- package/src/ui/input.tsx +2 -2
- package/src/ui/menu.tsx +8 -8
- package/src/ui/select.tsx +12 -12
- package/src/ui/tabs.tsx +14 -15
package/dist/ui/menu.d.ts
CHANGED
|
@@ -24,17 +24,17 @@ export type MenuContentProps = Primitive.Popup.Props & {
|
|
|
24
24
|
/** Where the portal mounts. Defaults to `<body>`. */
|
|
25
25
|
container?: Primitive.Portal.Props["container"];
|
|
26
26
|
/**
|
|
27
|
-
* Positioner props
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Positioner props: `side`, `align`, `sideOffset`, `collisionPadding` and the stacking order. The
|
|
28
|
+
* default `z-[60]` puts the menu above the overlay layer (z-50: dialog, drawer) so a menu opened
|
|
29
|
+
* inside a dialog is not painted behind it; raise it with `positionerProps={{ className: "z-[80]"
|
|
30
|
+
* }}` if the app stacks something higher.
|
|
31
31
|
*/
|
|
32
32
|
positionerProps?: Primitive.Positioner.Props;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* A dropdown
|
|
36
|
-
* and popup composed once, for the same reason the dialog's are: the arrangement is not
|
|
37
|
-
*
|
|
35
|
+
* A dropdown for choices, such as the account menu, a row's actions or a picker. Portal, positioner
|
|
36
|
+
* and popup composed once, for the same reason the dialog's are: the arrangement is not optional
|
|
37
|
+
* and getting it wrong throws a number.
|
|
38
38
|
*
|
|
39
39
|
* Roving focus, typeahead, escape, outside-dismiss and focus return all come from Base UI.
|
|
40
40
|
* Nothing here re-implements any of them.
|
|
@@ -55,7 +55,7 @@ type MenuGroupCaption = {
|
|
|
55
55
|
* Optional, because a group whose trigger already says what it is would only repeat itself.
|
|
56
56
|
*/
|
|
57
57
|
export declare function MenuGroup({ label, children, ...rest }: Primitive.Group.Props & MenuGroupCaption): import("react").JSX.Element;
|
|
58
|
-
/** A set of choices
|
|
58
|
+
/** A set of choices for a theme, locale or one axis of a filter. Same caption rule as `MenuGroup`. */
|
|
59
59
|
export declare function MenuRadioGroup({ label, children, ...rest }: Primitive.RadioGroup.Props & MenuGroupCaption): import("react").JSX.Element;
|
|
60
60
|
export type MenuRadioItemProps = Primitive.RadioItem.Props & {
|
|
61
61
|
/** Mark for the chosen item. */
|
package/dist/ui/menu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/ui/menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,eAAO,MAAM,IAAI,sEAAiB,CAAC;AACnC,eAAO,MAAM,WAAW,mBAAoB,CAAC;AAC7C,eAAO,MAAM,UAAU,yJAAmB,CAAC;AAC3C,eAAO,MAAM,cAAc,sJAAuB,CAAC;AACnD,eAAO,MAAM,SAAS,wJAAkB,CAAC;AACzC,eAAO,MAAM,YAAY,2JAAqB,CAAC;AAC/C,eAAO,MAAM,SAAS,wJAAkB,CAAC;AACzC,eAAO,MAAM,YAAY,oJAAqB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,4JAAyB,CAAC;AACvD,eAAO,MAAM,yBAAyB,yKAAkC,CAAC;AACzE,eAAO,MAAM,sBAAsB,sKAA+B,CAAC;AACnE,eAAO,MAAM,eAAe,8BAAwB,CAAC;AACrD,eAAO,MAAM,kBAAkB,8JAA2B,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG;IACrD;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAChD;;;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,MAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG;IAC3D,gCAAgC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,+BAY5F"}
|
package/dist/ui/menu.js
CHANGED
|
@@ -25,9 +25,9 @@ export const MenuRadioItemIndicator = Primitive.RadioItemIndicator;
|
|
|
25
25
|
export const MenuSubmenuRoot = Primitive.SubmenuRoot;
|
|
26
26
|
export const MenuSubmenuTrigger = Primitive.SubmenuTrigger;
|
|
27
27
|
/**
|
|
28
|
-
* A dropdown
|
|
29
|
-
* and popup composed once, for the same reason the dialog's are: the arrangement is not
|
|
30
|
-
*
|
|
28
|
+
* A dropdown for choices, such as the account menu, a row's actions or a picker. Portal, positioner
|
|
29
|
+
* and popup composed once, for the same reason the dialog's are: the arrangement is not optional
|
|
30
|
+
* and getting it wrong throws a number.
|
|
31
31
|
*
|
|
32
32
|
* Roving focus, typeahead, escape, outside-dismiss and focus return all come from Base UI.
|
|
33
33
|
* Nothing here re-implements any of them.
|
|
@@ -71,7 +71,7 @@ const captionClasses = "px-3 pt-2 pb-1 text-muted-foreground";
|
|
|
71
71
|
export function MenuGroup({ label, children, ...rest }) {
|
|
72
72
|
return (_jsxs(Primitive.Group, { ...rest, children: [label === undefined ? null : (_jsx(Primitive.GroupLabel, { className: captionClasses, children: label })), children] }));
|
|
73
73
|
}
|
|
74
|
-
/** A set of choices
|
|
74
|
+
/** A set of choices for a theme, locale or one axis of a filter. Same caption rule as `MenuGroup`. */
|
|
75
75
|
export function MenuRadioGroup({ label, children, ...rest }) {
|
|
76
76
|
return (_jsxs(Primitive.RadioGroup, { ...rest, children: [label === undefined ? null : (_jsx(Primitive.GroupLabel, { className: captionClasses, children: label })), children] }));
|
|
77
77
|
}
|
package/dist/ui/menu.js.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d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface SelectOption<T extends string = string> {
|
|
|
23
23
|
}
|
|
24
24
|
export type SelectProps<T extends string = string> = Omit<Primitive.Root.Props<T, false>, "children" | "items" | "defaultValue" | "multiple"> & {
|
|
25
25
|
options?: readonly SelectOption<T>[];
|
|
26
|
-
/** Shown while nothing is selected. No default
|
|
26
|
+
/** Shown while nothing is selected. No default because a default would be English. */
|
|
27
27
|
placeholder?: ReactNode;
|
|
28
28
|
/**
|
|
29
29
|
* Shown instead of the list when `options` is empty. Required, because a popup that opens
|
|
@@ -31,9 +31,9 @@ export type SelectProps<T extends string = string> = Omit<Primitive.Root.Props<T
|
|
|
31
31
|
*/
|
|
32
32
|
emptyLabel: ReactNode;
|
|
33
33
|
/**
|
|
34
|
-
* Label of an entry that puts the field back to nothing selected
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Label of an entry that puts the field back to nothing selected, for an optional question where
|
|
35
|
+
* "I'd rather not say" has to stay reachable after the first answer. Rendered only once there is
|
|
36
|
+
* a value to take back; picking it calls `onValueChange(null)`.
|
|
37
37
|
*/
|
|
38
38
|
clearLabel?: string;
|
|
39
39
|
/** Accessible name for the trigger, when no visible label points at it. */
|
|
@@ -42,15 +42,15 @@ export type SelectProps<T extends string = string> = Omit<Primitive.Root.Props<T
|
|
|
42
42
|
chevron?: ReactNode;
|
|
43
43
|
/** Mark next to the selected option. */
|
|
44
44
|
indicator?: ReactNode;
|
|
45
|
-
/** Classes for the trigger
|
|
45
|
+
/** Classes for the trigger button, which you see when the popup is closed. */
|
|
46
46
|
className?: StateClassName<Primitive.Trigger.State>;
|
|
47
47
|
popupClassName?: StateClassName<Primitive.Popup.State>;
|
|
48
48
|
triggerProps?: Primitive.Trigger.Props;
|
|
49
49
|
/**
|
|
50
|
-
* Positioner props
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* Positioner props: `align`, `side`, `sideOffset`, `collisionPadding` and the stacking order. The
|
|
51
|
+
* default `z-[60]` puts the list above the overlay layer (z-50: dialog, drawer); raise it with
|
|
52
|
+
* `positionerProps={{ className: "z-[80]" }}` if the app stacks something higher than a dialog
|
|
53
|
+
* above it.
|
|
54
54
|
*/
|
|
55
55
|
positionerProps?: Primitive.Positioner.Props;
|
|
56
56
|
};
|
|
@@ -61,9 +61,9 @@ export type SelectProps<T extends string = string> = Omit<Primitive.Root.Props<T
|
|
|
61
61
|
*
|
|
62
62
|
* Controlled only, and that is the point of `value ?? null`: React and Base UI both read
|
|
63
63
|
* `value={undefined}` as "uncontrolled", so a caller holding `T | undefined` in state would
|
|
64
|
-
* silently hand the field back to the primitive the moment the value cleared, and every
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* silently hand the field back to the primitive the moment the value cleared, and every later
|
|
65
|
+
* render would be ignored. `null` says "nothing selected" out loud. `defaultValue` is not accepted
|
|
66
|
+
* here for the same reason. Use the parts for an uncontrolled select.
|
|
67
67
|
*/
|
|
68
68
|
export declare function Select<T extends string = string>({ value, options, placeholder, emptyLabel, clearLabel, label, chevron, indicator, className, popupClassName, triggerProps, positionerProps, ...rest }: SelectProps<T>): import("react").JSX.Element;
|
|
69
69
|
//# sourceMappingURL=select.d.ts.map
|
package/dist/ui/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ui/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtE,eAAO,MAAM,UAAU,uBAAiB,CAAC;AACzC,eAAO,MAAM,aAAa,wJAAoB,CAAC;AAC/C,eAAO,MAAM,WAAW,oJAAkB,CAAC;AAC3C,eAAO,MAAM,UAAU,mJAAiB,CA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CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;IACvC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAChD,KAAK,EACL,OAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,EACd,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,WAAW,CAAC,CAAC,CAAC,+BAwGhB"}
|
package/dist/ui/select.js
CHANGED
|
@@ -25,9 +25,9 @@ export const SelectSeparator = Primitive.Separator;
|
|
|
25
25
|
*
|
|
26
26
|
* Controlled only, and that is the point of `value ?? null`: React and Base UI both read
|
|
27
27
|
* `value={undefined}` as "uncontrolled", so a caller holding `T | undefined` in state would
|
|
28
|
-
* silently hand the field back to the primitive the moment the value cleared, and every
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* silently hand the field back to the primitive the moment the value cleared, and every later
|
|
29
|
+
* render would be ignored. `null` says "nothing selected" out loud. `defaultValue` is not accepted
|
|
30
|
+
* here for the same reason. Use the parts for an uncontrolled select.
|
|
31
31
|
*/
|
|
32
32
|
export function Select({ value, options = [], placeholder, emptyLabel, clearLabel, label, chevron, indicator, className, popupClassName, triggerProps, positionerProps, ...rest }) {
|
|
33
33
|
const selected = options.find((option) => option.value === value);
|
package/dist/ui/tabs.d.ts
CHANGED
|
@@ -9,19 +9,18 @@ type TabListLabel = {
|
|
|
9
9
|
"aria-labelledby": string;
|
|
10
10
|
};
|
|
11
11
|
export type TabListProps = Omit<Primitive.List.Props, "aria-labelledby"> & TabListLabel & {
|
|
12
|
-
/** Classes for the
|
|
12
|
+
/** Classes for the wrapper that owns the sideways scroll. */
|
|
13
13
|
wrapperClassName?: string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* The rail, and the reason this file exists.
|
|
17
17
|
*
|
|
18
|
-
* It scrolls sideways rather than wrapping, because a second row of tabs pushes the panel
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* first tab and the right of the last.
|
|
18
|
+
* It scrolls sideways rather than wrapping, because a second row of tabs pushes the panel below the
|
|
19
|
+
* fold on a phone. But the scroll cannot live on the rail itself: `overflow-x: auto` makes the
|
|
20
|
+
* element a scroll container, a scroll container clips everything its children paint outside the
|
|
21
|
+
* padding box, and a computed `overflow-x` of `auto` forces `overflow-y` from `visible` to `auto`
|
|
22
|
+
* as well. A self-scrolling rail therefore crops the focus ring on all FOUR sides of whichever tab
|
|
23
|
+
* the keyboard is on: top and bottom always, the left of the first tab and the right of the last.
|
|
25
24
|
*
|
|
26
25
|
* So the scroll goes on a wrapper, and the wrapper's padding is the room the ring needs. The
|
|
27
26
|
* number is derived, not inherited: `@gusnips/tokens` draws `outline: 2px solid` at
|
|
@@ -35,17 +34,17 @@ export type TabListProps = Omit<Primitive.List.Props, "aria-labelledby"> & TabLi
|
|
|
35
34
|
export declare function TabList({ label, className, wrapperClassName, children, ...rest }: TabListProps): import("react").JSX.Element;
|
|
36
35
|
export declare function Tab({ className, ...rest }: Primitive.Tab.Props): import("react").JSX.Element;
|
|
37
36
|
/**
|
|
38
|
-
* The travelling marker under the active tab
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* The travelling marker under the active tab. A SEPARATE part, because the two donors disagreed
|
|
38
|
+
* about whether to have one at all and both were right about their own app. Render it or do not;
|
|
39
|
+
* the rail works either way.
|
|
41
40
|
*
|
|
42
41
|
* It must be a child of `TabList`: Base UI measures the active tab against the enclosing
|
|
43
42
|
* `[role="tablist"]` and writes `--active-tab-left` / `--active-tab-width` onto this element.
|
|
44
43
|
*
|
|
45
|
-
* `renderBeforeHydration` is on by default because this package's apps are prerendered
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
44
|
+
* `renderBeforeHydration` is on by default because this package's apps are prerendered. With it
|
|
45
|
+
* off, every prerendered page shows the rail with no marker until React arrives. It writes one
|
|
46
|
+
* inline script to do that; under a strict CSP without Base UI's `CspProvider` the script is
|
|
47
|
+
* blocked and the behaviour falls back to exactly what `false` would have done.
|
|
49
48
|
*/
|
|
50
49
|
export declare function TabIndicator({ className, ...rest }: Primitive.Indicator.Props): import("react").JSX.Element;
|
|
51
50
|
export {};
|
package/dist/ui/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ui/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOxD,eAAO,MAAM,IAAI,gJAAiB,CAAC;AACnC,eAAO,MAAM,QAAQ,iJAAkB,CAAC;AAExC,KAAK,YAAY,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,GACtE,YAAY,GAAG;IACb,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ui/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOxD,eAAO,MAAM,IAAI,gJAAiB,CAAC;AACnC,eAAO,MAAM,QAAQ,iJAAkB,CAAC;AAExC,KAAK,YAAY,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,GACtE,YAAY,GAAG;IACb,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEJ;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,+BAa9F;AAYD,wBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,+BAE9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,KAAK,+BAY7E"}
|
package/dist/ui/tabs.js
CHANGED
|
@@ -10,13 +10,12 @@ export const TabPanel = Primitive.Panel;
|
|
|
10
10
|
/**
|
|
11
11
|
* The rail, and the reason this file exists.
|
|
12
12
|
*
|
|
13
|
-
* It scrolls sideways rather than wrapping, because a second row of tabs pushes the panel
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* first tab and the right of the last.
|
|
13
|
+
* It scrolls sideways rather than wrapping, because a second row of tabs pushes the panel below the
|
|
14
|
+
* fold on a phone. But the scroll cannot live on the rail itself: `overflow-x: auto` makes the
|
|
15
|
+
* element a scroll container, a scroll container clips everything its children paint outside the
|
|
16
|
+
* padding box, and a computed `overflow-x` of `auto` forces `overflow-y` from `visible` to `auto`
|
|
17
|
+
* as well. A self-scrolling rail therefore crops the focus ring on all FOUR sides of whichever tab
|
|
18
|
+
* the keyboard is on: top and bottom always, the left of the first tab and the right of the last.
|
|
20
19
|
*
|
|
21
20
|
* So the scroll goes on a wrapper, and the wrapper's padding is the room the ring needs. The
|
|
22
21
|
* number is derived, not inherited: `@gusnips/tokens` draws `outline: 2px solid` at
|
|
@@ -44,17 +43,17 @@ export function Tab({ className, ...rest }) {
|
|
|
44
43
|
return _jsx(Primitive.Tab, { ...rest, className: mergeClassName(tabClasses, className) });
|
|
45
44
|
}
|
|
46
45
|
/**
|
|
47
|
-
* The travelling marker under the active tab
|
|
48
|
-
*
|
|
49
|
-
*
|
|
46
|
+
* The travelling marker under the active tab. A SEPARATE part, because the two donors disagreed
|
|
47
|
+
* about whether to have one at all and both were right about their own app. Render it or do not;
|
|
48
|
+
* the rail works either way.
|
|
50
49
|
*
|
|
51
50
|
* It must be a child of `TabList`: Base UI measures the active tab against the enclosing
|
|
52
51
|
* `[role="tablist"]` and writes `--active-tab-left` / `--active-tab-width` onto this element.
|
|
53
52
|
*
|
|
54
|
-
* `renderBeforeHydration` is on by default because this package's apps are prerendered
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
53
|
+
* `renderBeforeHydration` is on by default because this package's apps are prerendered. With it
|
|
54
|
+
* off, every prerendered page shows the rail with no marker until React arrives. It writes one
|
|
55
|
+
* inline script to do that; under a strict CSP without Base UI's `CspProvider` the script is
|
|
56
|
+
* blocked and the behaviour falls back to exactly what `false` would have done.
|
|
58
57
|
*/
|
|
59
58
|
export function TabIndicator({ className, ...rest }) {
|
|
60
59
|
return (_jsx(Primitive.Indicator, { "aria-hidden": "true", renderBeforeHydration: true, ...rest, className: mergeClassName("absolute bottom-0 left-0 h-0.5 w-[var(--active-tab-width)] translate-x-[var(--active-tab-left)] bg-foreground transition-[translate,width]", className) }));
|
package/dist/ui/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/ui/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,6FAA6F;AAC7F,uFAAuF;AACvF,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC;AAYxC
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/ui/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,6FAA6F;AAC7F,uFAAuF;AACvF,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC;AAYxC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAgB;IAC7F,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,sCAAsC,EAAE,gBAAgB,CAAC,YAC1E,KAAC,SAAS,CAAC,IAAI,kBACD,KAAK,KACb,IAAI;YACR,sEAAsE;YACtE,SAAS,EAAE,cAAc,CAAC,qBAAqB,EAAE,SAAS,CAAC,YAE1D,QAAQ,GACM,GACb,CACP,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,uFAAuF;AACvF,2DAA2D;AAC3D,EAAE;AACF,4FAA4F;AAC5F,6FAA6F;AAC7F,uBAAuB;AACvB,MAAM,UAAU,GACd,yJAAyJ,CAAC;AAE5J,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAuB;IAC7D,OAAO,KAAC,SAAS,CAAC,GAAG,OAAK,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,GAAI,CAAC;AACvF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAA6B;IAC5E,OAAO,CACL,KAAC,SAAS,CAAC,SAAS,mBACN,MAAM,EAClB,qBAAqB,WACjB,IAAI,EACR,SAAS,EAAE,cAAc,CACvB,4IAA4I,EAC5I,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gusnips/react",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"description": "The headless runtime under a Vite + React SPA: typed fetch client with single-flight refresh, auth store, query defaults, route guards, error boundary, stale-tab recovery, i18n bootstrap.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/api-client.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { ApiError } from "./api-error.ts";
|
|
|
5
5
|
/**
|
|
6
6
|
* The app's one door to the API. Nothing else should call `fetch`.
|
|
7
7
|
*
|
|
8
|
-
* Every route answers the same envelope, so unwrapping and error-shaping belong here once
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Every route answers the same envelope, so unwrapping and error-shaping belong here once rather
|
|
9
|
+
* than in every hook. Three donors built this independently and all three arrived at single-flight
|
|
10
|
+
* token refresh. See {@link SessionAdapter.refresh} for the reason, which is the sharpest thing in
|
|
11
|
+
* this file.
|
|
12
12
|
*
|
|
13
13
|
* Four things deliberately did NOT come across from the donors, because they belong to a
|
|
14
14
|
* product and not to a client:
|
|
@@ -16,7 +16,7 @@ import { ApiError } from "./api-error.ts";
|
|
|
16
16
|
* - **Toasts.** Whether a failure is spoken aloud is a design decision that differs per surface.
|
|
17
17
|
* Throw, and let the caller decide.
|
|
18
18
|
* - **In-flight GET deduplication.** react-query already dedups by key, so the client's copy is
|
|
19
|
-
* redundant
|
|
19
|
+
* redundant. One donor's version also returned a `clone()` of a body already being consumed,
|
|
20
20
|
* which is a race with no symptom until it has one.
|
|
21
21
|
* - **Service-status tracking and impersonation.** One donor's, and firmly its own.
|
|
22
22
|
* - **Analytics correlation headers.** Injected through {@link ApiClientOptions.headers}.
|
|
@@ -26,8 +26,8 @@ import { ApiError } from "./api-error.ts";
|
|
|
26
26
|
export interface RefreshResult {
|
|
27
27
|
token: string | null;
|
|
28
28
|
/**
|
|
29
|
-
* False when the refresh never got an ANSWER out of the auth server
|
|
30
|
-
* a 5xx
|
|
29
|
+
* False when the refresh never got an ANSWER out of the auth server because of a dropped
|
|
30
|
+
* connection, a 5xx or a captive portal.
|
|
31
31
|
*
|
|
32
32
|
* This flag is invariant 3, and only one of three donors had it. Losing a packet says nothing
|
|
33
33
|
* about whether a session is still good, so a client that collapses "auth said no" into
|
|
@@ -39,8 +39,8 @@ export interface RefreshResult {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* The seam onto whatever holds the session. Supabase in every donor so far, but nothing here
|
|
43
|
-
*
|
|
42
|
+
* The seam onto whatever holds the session. Supabase in every donor so far, but nothing here knows
|
|
43
|
+
* that. An adapter is four lines and keeps the auth vendor out of this package.
|
|
44
44
|
*/
|
|
45
45
|
export interface SessionAdapter {
|
|
46
46
|
getToken(): Promise<string | null>;
|
|
@@ -49,9 +49,9 @@ export interface SessionAdapter {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* How long anything here waits on a sign-out: the default for
|
|
53
|
-
*
|
|
54
|
-
* `@gusnips/react/supabase`. Shared so the two give up together
|
|
52
|
+
* How long anything here waits on a sign-out: the default for {@link
|
|
53
|
+
* ApiClientOptions.signOutTimeoutMs}, and the deadline of `signOutEvenOffline` in
|
|
54
|
+
* `@gusnips/react/supabase`. Shared so the two give up together. A redirect that gave up sooner
|
|
55
55
|
* would navigate away while the session was still in storage.
|
|
56
56
|
*/
|
|
57
57
|
export const SIGN_OUT_TIMEOUT_MS = 3_000;
|
|
@@ -70,54 +70,54 @@ export interface ApiClientOptions {
|
|
|
70
70
|
*/
|
|
71
71
|
headers?: () => Record<string, string>;
|
|
72
72
|
/**
|
|
73
|
-
* The session is gone and cannot be renewed
|
|
73
|
+
* The session is gone and cannot be renewed. Send them to sign in.
|
|
74
74
|
*
|
|
75
75
|
* The client does not know the route, and it deliberately still THROWS after calling this:
|
|
76
76
|
* `location.replace()` does not stop the current frame, so a caller's own `onError` must
|
|
77
77
|
* still run or a half-finished screen keeps rendering against data that will never arrive.
|
|
78
78
|
* The error it throws carries `expected: true`.
|
|
79
79
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* Routing to the sign-in screen without a reload is equally supported. It is the case that keeps
|
|
81
|
+
* this client alive across the next sign-in. The sign-out latch is keyed on the refused token for
|
|
82
|
+
* exactly that reason; see `refusedToken`.
|
|
83
83
|
*/
|
|
84
84
|
onSessionDead: () => void;
|
|
85
85
|
/**
|
|
86
86
|
* Every failed response, seen once, just before it is thrown.
|
|
87
87
|
*
|
|
88
|
-
* For a reaction that belongs to the whole app rather than to one call site. The donor's case
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
88
|
+
* For a reaction that belongs to the whole app rather than to one call site. The donor's case is
|
|
89
|
+
* the sharp one: a mid-session account suspension 403s every authed route except `GET /auth/me`,
|
|
90
|
+
* so the moment one arrives the app has to refresh `me` and route to the screen that explains it.
|
|
91
|
+
* Otherwise every query on the page fails at once and the shell half-renders behind an error
|
|
92
|
+
* storm until `me` goes stale on its own.
|
|
93
93
|
*
|
|
94
|
-
* It cannot live at a call site, because the point is that it fires from whichever call
|
|
95
|
-
*
|
|
96
|
-
*
|
|
94
|
+
* It cannot live at a call site, because the point is that it fires from whichever call happened
|
|
95
|
+
* to be first. It went in the donor's client directly, which made the client import its query
|
|
96
|
+
* cache and its query keys, creating a cycle that this hook removes.
|
|
97
97
|
*
|
|
98
98
|
* Observation only: the error is thrown either way, and throwing from here would replace a
|
|
99
99
|
* real API failure with whatever the listener hit.
|
|
100
100
|
*
|
|
101
101
|
* **The response comes with it, because a refusal's headers are otherwise unreachable.**
|
|
102
|
-
* `request` throws before the `Response` escapes, so an adopter whose API states something on
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
102
|
+
* `request` throws before the `Response` escapes, so an adopter whose API states something on the
|
|
103
|
+
* error path had no way to read it at all. One reports what every call cost, refusals included,
|
|
104
|
+
* which is how "a blocked page costs nothing" becomes a thing a customer can check rather than a
|
|
105
|
+
* thing we assert. That is the distinction worth keeping: field-error flattening and a per-call
|
|
106
|
+
* meter callback both stayed in their products, because a product can write those itself. This
|
|
107
|
+
* one it cannot, at any price, and a capability the kit makes unreachable is a regression the kit
|
|
108
|
+
* has to undo.
|
|
109
109
|
*
|
|
110
|
-
* The BODY has already been read by the time this runs
|
|
111
|
-
*
|
|
110
|
+
* The BODY has already been read by the time this runs to build the error from the envelope, so
|
|
111
|
+
* `response.json()` here throws. The headers are what is left, and what this is for.
|
|
112
112
|
*/
|
|
113
113
|
onError?: (error: ApiError, response: Response) => void;
|
|
114
114
|
/**
|
|
115
115
|
* Abort a request that has not answered. Default 30s.
|
|
116
116
|
*
|
|
117
|
-
* Neither donor bounded its authenticated requests
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
117
|
+
* Neither donor bounded its authenticated requests. Both bounded only their keyless clients, so a
|
|
118
|
+
* stalled connection was a spinner with no end. providerkit learned the same lesson about
|
|
119
|
+
* streams: a request with no deadline is a bug that only shows up on a bad network, which is
|
|
120
|
+
* exactly when nobody can reproduce it.
|
|
121
121
|
*/
|
|
122
122
|
timeoutMs?: number;
|
|
123
123
|
/** How many times to refresh-and-retry a 401. Default 2. */
|
|
@@ -127,9 +127,9 @@ export interface ApiClientOptions {
|
|
|
127
127
|
/**
|
|
128
128
|
* How long to wait for `signOut()` before redirecting anyway. Default 3s.
|
|
129
129
|
*
|
|
130
|
-
* A fail-safe, and one donor added it after the failure it prevents: awaiting `signOut()`
|
|
131
|
-
*
|
|
132
|
-
*
|
|
130
|
+
* A fail-safe, and one donor added it after the failure it prevents: awaiting `signOut()` covers
|
|
131
|
+
* a rejection but not a HANG, and a hang leaves the tab signed out in name only: still on the
|
|
132
|
+
* page, every request 401ing, nothing left that could redirect it.
|
|
133
133
|
*/
|
|
134
134
|
signOutTimeoutMs?: number;
|
|
135
135
|
/** Header carrying the server's request id, echoed onto {@link ApiError.requestId}. */
|
|
@@ -151,9 +151,9 @@ export interface ApiClient {
|
|
|
151
151
|
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
152
152
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
153
153
|
/**
|
|
154
|
-
* DELETE, discarding whatever comes back. Returns `void` because 204 is the usual answer and
|
|
155
|
-
*
|
|
156
|
-
*
|
|
154
|
+
* DELETE, discarding whatever comes back. Returns `void` because 204 is the usual answer and a
|
|
155
|
+
* 204 has NO BODY. `res.json()` on one throws `Unexpected end of JSON input`, which reads like a
|
|
156
|
+
* malformed response and is really just a success nobody was allowed to parse.
|
|
157
157
|
*
|
|
158
158
|
* Split from {@link ApiClient.delJson} rather than guessing per response, because the guess is
|
|
159
159
|
* the part that hides a bug: a route that was supposed to answer with data and returned
|
|
@@ -161,21 +161,21 @@ export interface ApiClient {
|
|
|
161
161
|
* layers away. The donor that hit this had written exactly these two functions.
|
|
162
162
|
*/
|
|
163
163
|
del(path: string, options?: RequestOptions): Promise<void>;
|
|
164
|
-
/** The DELETE that answers with something worth reading
|
|
164
|
+
/** The DELETE that answers with something worth reading, such as a queue entry it handed back. */
|
|
165
165
|
delJson<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
166
166
|
/**
|
|
167
|
-
* The whole envelope rather than just `data`, for a route whose `meta` is half the answer
|
|
168
|
-
* a list's `total
|
|
167
|
+
* The whole envelope rather than just `data`, for a route whose `meta` is half the answer, such
|
|
168
|
+
* as a list's `total` or a metered call's receipt.
|
|
169
169
|
*/
|
|
170
170
|
page<T, M>(path: string, options?: RequestOptions): Promise<ApiSuccess<T, M>>;
|
|
171
171
|
/**
|
|
172
172
|
* The same, off a POST.
|
|
173
173
|
*
|
|
174
|
-
* Two adopters needed this and both wrote the same workaround: `client.request(…)` followed by
|
|
175
|
-
*
|
|
176
|
-
* assertion about the success shape. One of them left the reason sitting in a comment
|
|
177
|
-
*
|
|
178
|
-
*
|
|
174
|
+
* Two adopters needed this and both wrote the same workaround: `client.request(…)` followed by a
|
|
175
|
+
* hand-rolled `res.json()`, stepping around the client's own envelope reader and its one
|
|
176
|
+
* assertion about the success shape. One of them left the reason sitting in a comment: "the whole
|
|
177
|
+
* envelope is reachable off a GET and not off a POST, so this one reads the body itself". This
|
|
178
|
+
* package's gap was described in somebody else's file.
|
|
179
179
|
*
|
|
180
180
|
* A metered route takes a body whenever its input is too long or too punctuated to be a path
|
|
181
181
|
* segment (a URL, a search query), and then the receipt has to survive the POST too. When the
|
package/src/api-error.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { ApiErrorBody } from "@gusnips/http";
|
|
|
3
3
|
/**
|
|
4
4
|
* A refusal, with the whole envelope intact.
|
|
5
5
|
*
|
|
6
|
-
* `code` is what the UI switches on, `messageKey` is what gets localized, and `details` carries
|
|
7
|
-
*
|
|
8
|
-
* Keeping all of it means a caller never has to re-parse a response body that has already been
|
|
6
|
+
* `code` is what the UI switches on, `messageKey` is what gets localized, and `details` carries the
|
|
7
|
+
* parts that make a refusal actionable, such as the `resetAt` on a 429 or the plan that lifts a
|
|
8
|
+
* 402. Keeping all of it means a caller never has to re-parse a response body that has already been
|
|
9
9
|
* read once.
|
|
10
10
|
*
|
|
11
11
|
* A real `class` and not an interface with a factory: one donor used the interface shape, which
|
|
@@ -23,17 +23,17 @@ export class ApiError extends Error {
|
|
|
23
23
|
*
|
|
24
24
|
* Read from the `Retry-After` HEADER, which is where HTTP puts it and where a rate limiter
|
|
25
25
|
* written by anyone puts it. The second migration is why this exists: that API sends
|
|
26
|
-
* `Retry-After: 60` on every 429 and nothing in its body, so the package's only reader
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* `Retry-After: 60` on every 429 and nothing in its body, so the package's only reader looked in
|
|
27
|
+
* `details.retryAfterSecs`, the first donor's convention, and found nothing, and both the copy
|
|
28
|
+
* and the retry rule were flying blind on the one refusal that states its own expiry. Two
|
|
29
|
+
* conventions, same fact; `retryAfterSecs` from `@gusnips/http/retry` reads either.
|
|
30
30
|
*/
|
|
31
31
|
readonly retryAfterSecs: number | undefined;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* The client raised this itself to stop a caller while it was already handling the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* The client raised this itself to stop a caller while it was already handling the situation.
|
|
35
|
+
* Today this is the 401 thrown after a dead session, where the person is already on their way to
|
|
36
|
+
* the sign-in page.
|
|
37
37
|
*
|
|
38
38
|
* It is control flow, not a fault. Exception reporting should skip it, and an error surface
|
|
39
39
|
* should not ask somebody to retry something that is not broken. One donor had this and it is
|
|
@@ -65,7 +65,7 @@ export class ApiError extends Error {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* A request aborted by the caller's own `AbortController` or a navigation that unmounted the
|
|
69
69
|
* component waiting on it.
|
|
70
70
|
*
|
|
71
71
|
* Worth its own predicate because it is the one failure that must NOT be reported, retried or
|