@lt-three/love3 0.1.0 → 0.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.
- package/README.md +40 -40
- package/dist/native/analytics/animation.d.ts +1 -1
- package/dist/native/analytics/animation.js +1 -1
- package/dist/native/analytics/chart.types.d.ts +3 -3
- package/dist/native/analytics/metric-card.d.ts +3 -3
- package/dist/native/analytics/metric-card.js +3 -3
- package/dist/native/analytics/multi-line-chart.d.ts +9 -8
- package/dist/native/analytics/multi-line-chart.js +14 -13
- package/dist/native/analytics/pie-chart.d.ts +7 -7
- package/dist/native/analytics/pie-chart.js +8 -8
- package/dist/native/analytics/single-number.d.ts +4 -4
- package/dist/native/analytics/single-number.js +2 -2
- package/dist/native/atom/avatar.d.ts +6 -6
- package/dist/native/atom/avatar.js +2 -2
- package/dist/native/atom/badge.d.ts +5 -5
- package/dist/native/atom/button.d.ts +12 -12
- package/dist/native/atom/button.js +8 -8
- package/dist/native/atom/checkbox.d.ts +4 -4
- package/dist/native/atom/checkbox.js +2 -2
- package/dist/native/atom/colored-value.d.ts +4 -4
- package/dist/native/atom/colored-value.js +4 -4
- package/dist/native/atom/image.d.ts +7 -7
- package/dist/native/atom/image.js +2 -2
- package/dist/native/atom/label.d.ts +5 -5
- package/dist/native/atom/label.js +2 -2
- package/dist/native/atom/link.d.ts +5 -5
- package/dist/native/atom/link.js +5 -5
- package/dist/native/atom/readout.d.ts +7 -7
- package/dist/native/atom/readout.js +3 -3
- package/dist/native/atom/search-input.d.ts +2 -2
- package/dist/native/atom/search-input.js +2 -2
- package/dist/native/atom/select.d.ts +14 -14
- package/dist/native/atom/select.js +8 -8
- package/dist/native/atom/separator.d.ts +2 -3
- package/dist/native/atom/separator.js +2 -3
- package/dist/native/atom/skeleton.d.ts +3 -3
- package/dist/native/atom/skeleton.js +3 -3
- package/dist/native/atom/slider.d.ts +6 -6
- package/dist/native/atom/slider.js +3 -3
- package/dist/native/atom/spinner.d.ts +4 -4
- package/dist/native/atom/spinner.js +2 -2
- package/dist/native/atom/switch.d.ts +4 -4
- package/dist/native/atom/switch.js +3 -3
- package/dist/native/atom/symbol.d.ts +7 -7
- package/dist/native/atom/symbol.js +7 -7
- package/dist/native/atom/symbol.types.d.ts +8 -8
- package/dist/native/atom/symbol.types.js +7 -7
- package/dist/native/atom/text-field.d.ts +15 -15
- package/dist/native/atom/text-field.js +5 -5
- package/dist/native/atom/theme-toggle.d.ts +7 -7
- package/dist/native/atom/theme-toggle.js +4 -4
- package/dist/native/atom/timezone-select.d.ts +5 -5
- package/dist/native/atom/timezone-select.js +4 -4
- package/dist/native/atom/typography.d.ts +2 -2
- package/dist/native/atom/typography.js +2 -2
- package/dist/native/base/button.d.ts +13 -13
- package/dist/native/base/button.js +4 -4
- package/dist/native/base/form.d.ts +15 -15
- package/dist/native/base/form.js +11 -11
- package/dist/native/base/glass-card.d.ts +3 -3
- package/dist/native/base/glass-card.js +3 -3
- package/dist/native/base/input.d.ts +8 -8
- package/dist/native/base/input.js +7 -7
- package/dist/native/base/sheet.d.ts +27 -27
- package/dist/native/base/sheet.js +15 -15
- package/dist/native/form/checkbox.d.ts +3 -3
- package/dist/native/form/checkbox.js +2 -2
- package/dist/native/form/date-picker.d.ts +9 -9
- package/dist/native/form/date-picker.js +9 -9
- package/dist/native/form/form.d.ts +5 -6
- package/dist/native/form/form.js +4 -5
- package/dist/native/form/radio-group.d.ts +5 -5
- package/dist/native/form/radio-group.js +4 -4
- package/dist/native/form/select.d.ts +2 -2
- package/dist/native/form/select.js +2 -2
- package/dist/native/form/slider.d.ts +2 -2
- package/dist/native/form/slider.js +2 -2
- package/dist/native/form/switch.d.ts +2 -2
- package/dist/native/form/switch.js +2 -2
- package/dist/native/form/text-area.d.ts +2 -2
- package/dist/native/form/text-area.js +1 -1
- package/dist/native/form/text-input.d.ts +5 -5
- package/dist/native/form/text-input.js +8 -8
- package/dist/native/layout/accordion.d.ts +5 -5
- package/dist/native/layout/accordion.js +2 -2
- package/dist/native/layout/card.d.ts +8 -8
- package/dist/native/layout/card.js +3 -3
- package/dist/native/layout/description.d.ts +2 -2
- package/dist/native/layout/description.js +2 -2
- package/dist/native/layout/error.d.ts +5 -5
- package/dist/native/layout/error.js +2 -2
- package/dist/native/layout/information.d.ts +4 -4
- package/dist/native/layout/information.js +3 -3
- package/dist/native/layout/locked.d.ts +15 -15
- package/dist/native/layout/locked.js +7 -7
- package/dist/native/layout/modal.d.ts +8 -8
- package/dist/native/layout/modal.js +5 -5
- package/dist/native/layout/not-found.d.ts +4 -4
- package/dist/native/layout/not-found.js +3 -3
- package/dist/native/layout/page-frame.d.ts +8 -8
- package/dist/native/layout/page-frame.js +3 -3
- package/dist/native/layout/panel.d.ts +5 -5
- package/dist/native/layout/panel.js +5 -5
- package/dist/native/layout/reorderable-list.d.ts +14 -14
- package/dist/native/layout/reorderable-list.js +10 -10
- package/dist/native/layout/sheet.d.ts +10 -10
- package/dist/native/layout/sheet.js +4 -4
- package/dist/native/layout/simple-dialog.d.ts +3 -3
- package/dist/native/layout/simple-dialog.js +2 -2
- package/dist/native/layout/simple-table.d.ts +18 -18
- package/dist/native/layout/simple-table.js +1 -1
- package/dist/native/layout/tab-bar.d.ts +10 -10
- package/dist/native/layout/tab-bar.js +4 -4
- package/dist/native/layout/tabs.d.ts +6 -6
- package/dist/native/layout/tabs.js +4 -4
- package/dist/native/layout/tuning-panel.d.ts +10 -10
- package/dist/native/layout/tuning-panel.js +15 -15
- package/dist/native/lib/autocomplete.d.ts +1 -1
- package/dist/native/lib/autocomplete.js +1 -1
- package/dist/native/lib/breakpoints.d.ts +3 -3
- package/dist/native/lib/breakpoints.js +3 -3
- package/dist/native/lib/chart-palette.d.ts +2 -2
- package/dist/native/lib/chart-palette.js +2 -2
- package/dist/native/lib/confirm.d.ts +15 -16
- package/dist/native/lib/confirm.js +9 -10
- package/dist/native/lib/control.d.ts +9 -9
- package/dist/native/lib/external-store.d.ts +4 -5
- package/dist/native/lib/keyboard.d.ts +7 -7
- package/dist/native/lib/keyboard.js +7 -7
- package/dist/native/lib/labels.d.ts +6 -6
- package/dist/native/lib/labels.js +6 -6
- package/dist/native/lib/loading.d.ts +3 -3
- package/dist/native/lib/loading.js +3 -3
- package/dist/native/lib/network.d.ts +5 -6
- package/dist/native/lib/network.js +5 -6
- package/dist/native/lib/scheme.d.ts +7 -7
- package/dist/native/lib/scheme.js +3 -3
- package/dist/native/lib/snackbar.d.ts +12 -13
- package/dist/native/lib/snackbar.js +7 -8
- package/dist/native/lib/theme.d.ts +15 -15
- package/dist/native/lib/theme.js +15 -15
- package/dist/native/lib/timezone.d.ts +13 -13
- package/dist/native/lib/timezone.js +13 -13
- package/dist/native/lib/token-color.d.ts +1 -1
- package/dist/native/lib/token-color.js +1 -1
- package/dist/native/lib/tuning-context.d.ts +2 -2
- package/dist/native/lib/tuning.d.ts +10 -10
- package/dist/native/lib/tuning.js +8 -8
- package/dist/native/lib/typography.d.ts +3 -3
- package/dist/native/lib/typography.js +3 -3
- package/dist/native/lib/utils.d.ts +3 -3
- package/dist/native/lib/utils.js +3 -3
- package/dist/native/once/confirm.d.ts +2 -2
- package/dist/native/once/confirm.js +2 -2
- package/dist/native/once/error-boundary.d.ts +3 -3
- package/dist/native/once/error-boundary.js +2 -2
- package/dist/native/once/loading-lock.d.ts +3 -3
- package/dist/native/once/loading-lock.js +3 -3
- package/dist/native/once/offline-banner.d.ts +6 -6
- package/dist/native/once/offline-banner.js +5 -5
- package/dist/native/once/snackbar.d.ts +7 -7
- package/dist/native/once/snackbar.js +5 -5
- package/dist/native/styles.css +21 -21
- package/dist/shared/analytics.d.ts +23 -23
- package/dist/shared/button.d.ts +1 -1
- package/dist/shared/form.d.ts +7 -7
- package/dist/shared/form.js +2 -2
- package/dist/tokens/contrast-pairs.d.ts +9 -9
- package/dist/tokens/contrast-pairs.js +10 -10
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/styles.gen.css +87 -87
- package/dist/tokens/tokens.gen.d.ts +2 -2
- package/dist/tokens/tokens.gen.js +2 -2
- package/dist/tuning/catalog.d.ts +8 -8
- package/dist/tuning/catalog.js +9 -9
- package/dist/tuning/color.d.ts +4 -4
- package/dist/tuning/color.js +5 -5
- package/dist/tuning/css.d.ts +13 -13
- package/dist/tuning/css.js +17 -17
- package/dist/tuning/model.d.ts +11 -11
- package/dist/tuning/model.js +11 -11
- package/dist/tuning/native.d.ts +18 -18
- package/dist/tuning/native.js +18 -18
- package/dist/tuning/schema.d.ts +15 -15
- package/dist/tuning/schema.js +22 -22
- package/dist/tuning/types.d.ts +25 -25
- package/dist/tuning/types.js +6 -6
- package/dist/web/analytics/line-chart.d.ts +6 -6
- package/dist/web/analytics/line-chart.js +3 -3
- package/dist/web/analytics/metric-card.d.ts +6 -6
- package/dist/web/analytics/metric-card.js +5 -5
- package/dist/web/analytics/multi-line-chart.d.ts +23 -23
- package/dist/web/analytics/multi-line-chart.js +33 -33
- package/dist/web/atom/avatar.d.ts +1 -1
- package/dist/web/atom/checkbox.d.ts +6 -6
- package/dist/web/atom/checkbox.js +2 -2
- package/dist/web/atom/colored-value.d.ts +4 -4
- package/dist/web/atom/colored-value.js +4 -4
- package/dist/web/atom/help.d.ts +1 -1
- package/dist/web/atom/segmented-control.d.ts +13 -14
- package/dist/web/atom/segmented-control.js +6 -7
- package/dist/web/atom/select.d.ts +7 -7
- package/dist/web/atom/select.js +5 -5
- package/dist/web/atom/slider.d.ts +3 -3
- package/dist/web/atom/slider.js +2 -2
- package/dist/web/atom/switch.d.ts +3 -3
- package/dist/web/atom/text-area.d.ts +9 -8
- package/dist/web/atom/text-area.js +9 -8
- package/dist/web/atom/text-field.d.ts +5 -4
- package/dist/web/atom/text-field.js +5 -4
- package/dist/web/atom/toggle-chip.d.ts +6 -6
- package/dist/web/atom/toggle-chip.js +4 -4
- package/dist/web/atom/tooltip.d.ts +6 -6
- package/dist/web/atom/tooltip.js +2 -2
- package/dist/web/base/accordion.js +1 -1
- package/dist/web/base/breadcrumb.d.ts +1 -1
- package/dist/web/base/breadcrumb.js +1 -1
- package/dist/web/base/card.d.ts +3 -3
- package/dist/web/base/card.js +2 -2
- package/dist/web/base/dialog.d.ts +1 -1
- package/dist/web/base/dialog.js +1 -1
- package/dist/web/base/form.d.ts +7 -7
- package/dist/web/base/form.js +5 -5
- package/dist/web/base/pagination.d.ts +5 -5
- package/dist/web/base/pagination.js +1 -1
- package/dist/web/base/sheet.d.ts +1 -1
- package/dist/web/base/sheet.js +1 -1
- package/dist/web/base/slider.d.ts +1 -1
- package/dist/web/base/sonner.d.ts +2 -2
- package/dist/web/base/sonner.js +2 -2
- package/dist/web/base/spinner.js +1 -1
- package/dist/web/form/checkbox.d.ts +8 -8
- package/dist/web/form/checkbox.js +3 -3
- package/dist/web/form/radio-group.js +3 -3
- package/dist/web/form/select.js +1 -1
- package/dist/web/form/slider.d.ts +3 -3
- package/dist/web/form/slider.js +3 -3
- package/dist/web/form/switch.d.ts +3 -3
- package/dist/web/form/switch.js +4 -4
- package/dist/web/form/text-area.js +1 -1
- package/dist/web/form/text-input.d.ts +1 -1
- package/dist/web/form/text-input.js +1 -1
- package/dist/web/layout/accordion.d.ts +5 -5
- package/dist/web/layout/accordion.js +2 -2
- package/dist/web/layout/alert-modal.d.ts +11 -11
- package/dist/web/layout/alert-modal.js +7 -7
- package/dist/web/layout/card.d.ts +1 -1
- package/dist/web/layout/information.d.ts +9 -9
- package/dist/web/layout/information.js +7 -7
- package/dist/web/layout/modal.d.ts +1 -1
- package/dist/web/layout/page-frame.d.ts +14 -14
- package/dist/web/layout/page-frame.js +7 -7
- package/dist/web/layout/scroll-area.d.ts +1 -1
- package/dist/web/layout/sheet.d.ts +4 -4
- package/dist/web/layout/simple-table.d.ts +18 -18
- package/dist/web/layout/simple-table.js +2 -2
- package/dist/web/layout/tabs.d.ts +4 -4
- package/dist/web/layout/titled-modal.d.ts +10 -11
- package/dist/web/layout/titled-modal.js +7 -8
- package/dist/web/lib/css-vars.d.ts +6 -6
- package/dist/web/lib/css-vars.js +5 -5
- package/dist/web/lib/dialog.d.ts +4 -4
- package/dist/web/lib/labels.d.ts +8 -8
- package/dist/web/lib/labels.js +8 -8
- package/dist/web/lib/modal-open-focus.d.ts +7 -7
- package/dist/web/lib/modal-open-focus.js +9 -9
- package/dist/web/lib/restore-focus.d.ts +4 -4
- package/dist/web/lib/restore-focus.js +4 -4
- package/dist/web/styles.css +33 -33
- package/package.json +2 -2
|
@@ -10,19 +10,19 @@ export type TabType = {
|
|
|
10
10
|
export type TabsProps = {
|
|
11
11
|
tabs: TabType;
|
|
12
12
|
defaultValue?: string;
|
|
13
|
-
/**
|
|
13
|
+
/** Controlled mode: specify it to manage the selected value from outside. */
|
|
14
14
|
value?: string;
|
|
15
15
|
onValueChange?: (value: string) => void;
|
|
16
|
-
/**
|
|
16
|
+
/** Slot placed at the right end of the same row as the tab strip (used like a toolbar). */
|
|
17
17
|
trailing?: ReactNode;
|
|
18
18
|
className?: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Tabs with the same record-driven API as the web `layout/tabs`.
|
|
22
|
+
* Visually they are flush-left underlined tabs matching the web base/tabs:
|
|
23
|
+
* a 2px indigo underline for the active tab sits on a shared faint rule.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* They scroll horizontally so they never wrap as the tab count grows (instead of web's `flex-wrap`).
|
|
26
26
|
*/
|
|
27
27
|
export declare function Tabs({ tabs, defaultValue, value, onValueChange, trailing, className }: TabsProps): import("react").JSX.Element;
|
|
28
28
|
//#endregion
|
|
@@ -6,11 +6,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
|
|
7
7
|
//#region src/native/layout/tabs.tsx
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Tabs with the same record-driven API as the web `layout/tabs`.
|
|
10
|
+
* Visually they are flush-left underlined tabs matching the web base/tabs:
|
|
11
|
+
* a 2px indigo underline for the active tab sits on a shared faint rule.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* They scroll horizontally so they never wrap as the tab count grows (instead of web's `flex-wrap`).
|
|
14
14
|
*/
|
|
15
15
|
function Tabs({ tabs, defaultValue, value, onValueChange, trailing, className }) {
|
|
16
16
|
const keys = Object.keys(tabs);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { Tuning, TuningCatalog } from "../../tuning/types.js";
|
|
2
2
|
//#region src/native/layout/tuning-panel.d.ts
|
|
3
3
|
export type TuningPanelProps = {
|
|
4
|
-
/**
|
|
4
|
+
/** The tuning content (the difference from the defaults). Where it is stored is up to the app. */
|
|
5
5
|
tuning: Tuning;
|
|
6
6
|
onChange: (next: Tuning) => void;
|
|
7
|
-
/**
|
|
7
|
+
/** What is tuned. Defaults to love3's generated output. */
|
|
8
8
|
catalog?: TuningCatalog;
|
|
9
|
-
/**
|
|
9
|
+
/** Called on export (copying, sharing, etc. is up to the app). Receives the JSON string. */
|
|
10
10
|
onExport?: (json: string) => void;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* native
|
|
13
|
+
* The native tuning screen (minimal). Moves tokens and exports/imports them as `love3-tuning` JSON, the same format as web's `/tuning`.
|
|
14
14
|
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* - JSON:
|
|
18
|
-
*
|
|
19
|
-
* -
|
|
15
|
+
* - Colors: edits the current theme's (light or dark) values in hex. An unreadable value keeps a red border and is not applied
|
|
16
|
+
* - Radius: px per role (fixed at build time on real devices, so it has no effect there; it remains in the JSON)
|
|
17
|
+
* - JSON: "書き出す" (Export) puts the current tuning in the field (and also passes it to `onExport`); "読み込む" (Import) validates the JSON in the field and applies it.
|
|
18
|
+
* If even one entry is invalid, the whole input is rejected and the reasons are shown (no partial application)
|
|
19
|
+
* - For items that have no effect on real devices, the `nativeLimits` explanation is shown
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* It is not polished (a verification screen built only from love3's native components).
|
|
22
22
|
*/
|
|
23
23
|
export declare function TuningPanel({ tuning, onChange, catalog, onExport }: TuningPanelProps): import("react").JSX.Element;
|
|
24
24
|
//#endregion
|
|
@@ -15,7 +15,7 @@ import { View } from "react-native";
|
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/native/layout/tuning-panel.tsx
|
|
18
|
-
/**
|
|
18
|
+
/** Token groups shown in the color editor (ramp, primary action, state, chart; brand colors are shared, so they are separate). */
|
|
19
19
|
const EDITABLE_GROUPS = /* @__PURE__ */ new Set([
|
|
20
20
|
"ramp",
|
|
21
21
|
"action",
|
|
@@ -23,15 +23,15 @@ const EDITABLE_GROUPS = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"chart"
|
|
24
24
|
]);
|
|
25
25
|
/**
|
|
26
|
-
* native
|
|
26
|
+
* The native tuning screen (minimal). Moves tokens and exports/imports them as `love3-tuning` JSON, the same format as web's `/tuning`.
|
|
27
27
|
*
|
|
28
|
-
* -
|
|
29
|
-
* -
|
|
30
|
-
* - JSON:
|
|
31
|
-
*
|
|
32
|
-
* -
|
|
28
|
+
* - Colors: edits the current theme's (light or dark) values in hex. An unreadable value keeps a red border and is not applied
|
|
29
|
+
* - Radius: px per role (fixed at build time on real devices, so it has no effect there; it remains in the JSON)
|
|
30
|
+
* - JSON: "書き出す" (Export) puts the current tuning in the field (and also passes it to `onExport`); "読み込む" (Import) validates the JSON in the field and applies it.
|
|
31
|
+
* If even one entry is invalid, the whole input is rejected and the reasons are shown (no partial application)
|
|
32
|
+
* - For items that have no effect on real devices, the `nativeLimits` explanation is shown
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* It is not polished (a verification screen built only from love3's native components).
|
|
35
35
|
*/
|
|
36
36
|
function TuningPanel({ tuning, onChange, catalog: catalog$1 = catalog, onExport }) {
|
|
37
37
|
const scheme = useActiveScheme();
|
|
@@ -152,7 +152,7 @@ function TuningPanel({ tuning, onChange, catalog: catalog$1 = catalog, onExport
|
|
|
152
152
|
]
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
/**
|
|
155
|
+
/** The reason shown when the input is unreadable. Rendered under the row with `role="alert"` and linked from the input via `aria-describedby`. */
|
|
156
156
|
function Reason({ id, text }) {
|
|
157
157
|
return /* @__PURE__ */ jsx(Text$1, {
|
|
158
158
|
id,
|
|
@@ -162,10 +162,10 @@ function Reason({ id, text }) {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
166
|
-
* 6
|
|
167
|
-
*
|
|
168
|
-
*
|
|
165
|
+
* One color. **Keeps its own in-progress text (draft) and keeps showing it in the field until focus leaves** (`#abc` is a valid 3-digit form
|
|
166
|
+
* but may also be partway through a 6-digit one; replacing the field with the applied value would make it impossible to finish typing 6 digits). Once the value is readable, it is applied on every keystroke
|
|
167
|
+
* (the applied value takes the canonical form `#aabbcc`, but the field keeps the text as typed). On blur, the applied value (canonical form) is shown in the field.
|
|
168
|
+
* An unreadable value shows a reason and is not applied.
|
|
169
169
|
*/
|
|
170
170
|
function ColorRow({ name, value, alpha, onCommit }) {
|
|
171
171
|
const reasonId = useId();
|
|
@@ -202,13 +202,13 @@ function ColorRow({ name, value, alpha, onCommit }) {
|
|
|
202
202
|
})]
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
/**
|
|
205
|
+
/** The problem with a radius input (undefined if it is readable and within range). */
|
|
206
206
|
function radiusProblem(text) {
|
|
207
207
|
const number = Number(text);
|
|
208
208
|
if (text.trim() === "" || !Number.isFinite(number)) return `角丸は数で入力してください(0〜${64})`;
|
|
209
209
|
if (number < 0 || number > 64) return `角丸は 0〜${64} の数で入力してください(実際: ${text})`;
|
|
210
210
|
}
|
|
211
|
-
/**
|
|
211
|
+
/** One radius. As with colors, in-progress text (such as `6.`) keeps showing in the field until focus leaves. */
|
|
212
212
|
function RadiusRow({ role, value, onCommit }) {
|
|
213
213
|
const reasonId = useId();
|
|
214
214
|
const [draft, setDraft] = useState(null);
|
|
@@ -2,6 +2,6 @@ import { TextInputProps } from "react-native";
|
|
|
2
2
|
//#region src/native/lib/autocomplete.d.ts
|
|
3
3
|
export type AutoComplete = NonNullable<TextInputProps["autoComplete"]>;
|
|
4
4
|
export type TextContentType = NonNullable<TextInputProps["textContentType"]>;
|
|
5
|
-
/** iOS
|
|
5
|
+
/** iOS `textContentType`. `undefined` if there is no corresponding word (leave it to the iOS default). */
|
|
6
6
|
export declare function textContentTypeOf(autoComplete: AutoComplete | undefined): TextContentType | undefined;
|
|
7
7
|
//#endregion
|
|
@@ -25,7 +25,7 @@ const CONTENT_TYPE = {
|
|
|
25
25
|
"cc-number": "creditCardNumber",
|
|
26
26
|
off: "none"
|
|
27
27
|
};
|
|
28
|
-
/** iOS
|
|
28
|
+
/** iOS `textContentType`. `undefined` if there is no corresponding word (leave it to the iOS default). */
|
|
29
29
|
function textContentTypeOf(autoComplete) {
|
|
30
30
|
return autoComplete === void 0 ? void 0 : CONTENT_TYPE[autoComplete];
|
|
31
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/native/lib/breakpoints.d.ts
|
|
2
|
-
/** web
|
|
2
|
+
/** Same breakpoints (px) as web (Tailwind). */
|
|
3
3
|
export declare const BREAKPOINT: {
|
|
4
4
|
readonly sm: 640;
|
|
5
5
|
readonly md: 768;
|
|
@@ -7,8 +7,8 @@ export declare const BREAKPOINT: {
|
|
|
7
7
|
};
|
|
8
8
|
export type Breakpoint = keyof typeof BREAKPOINT;
|
|
9
9
|
/**
|
|
10
|
-
* `hideBelow`
|
|
11
|
-
*
|
|
10
|
+
* Whether to show a `hideBelow` column at this screen width. A width exactly at the breakpoint **shows** it (Tailwind's `sm:` is 640px and up).
|
|
11
|
+
* If unspecified, always shown.
|
|
12
12
|
*/
|
|
13
13
|
export declare function isShownAtWidth(hideBelow: Breakpoint | undefined, width: number): boolean;
|
|
14
14
|
//#endregion
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/native/lib/breakpoints.ts
|
|
2
|
-
/** web
|
|
2
|
+
/** Same breakpoints (px) as web (Tailwind). */
|
|
3
3
|
const BREAKPOINT = {
|
|
4
4
|
sm: 640,
|
|
5
5
|
md: 768,
|
|
6
6
|
lg: 1024
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* `hideBelow`
|
|
10
|
-
*
|
|
9
|
+
* Whether to show a `hideBelow` column at this screen width. A width exactly at the breakpoint **shows** it (Tailwind's `sm:` is 640px and up).
|
|
10
|
+
* If unspecified, always shown.
|
|
11
11
|
*/
|
|
12
12
|
function isShownAtWidth(hideBelow, width) {
|
|
13
13
|
return hideBelow === void 0 || width >= BREAKPOINT[hideBelow];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//#region src/native/lib/chart-palette.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Default chart colors, returned in the same order as the web `--chart-1` to `--chart-5` (five colors that separate series by hue; each has a distinct value that stays readable in dark mode).
|
|
4
4
|
*
|
|
5
|
-
* `--chart-*`
|
|
5
|
+
* `--chart-*` are raw color tokens with separate light and dark values, so the actual values can be looked up directly. They also follow `.dark`.
|
|
6
6
|
*/
|
|
7
7
|
export declare function useChartPalette(): string[];
|
|
8
8
|
//#endregion
|
|
@@ -2,9 +2,9 @@ import { useTokenColor } from "./token-color.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/native/lib/chart-palette.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Default chart colors, returned in the same order as the web `--chart-1` to `--chart-5` (five colors that separate series by hue; each has a distinct value that stays readable in dark mode).
|
|
6
6
|
*
|
|
7
|
-
* `--chart-*`
|
|
7
|
+
* `--chart-*` are raw color tokens with separate light and dark values, so the actual values can be looked up directly. They also follow `.dark`.
|
|
8
8
|
*/
|
|
9
9
|
function useChartPalette() {
|
|
10
10
|
return [
|
|
@@ -11,39 +11,38 @@ export type ConfirmDialogValue = {
|
|
|
11
11
|
title?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
buttons?: ConfirmDialogButton[];
|
|
14
|
-
/**
|
|
14
|
+
/** When the outside is pressed. If unspecified, it does not close. Calling `close` closes it. */
|
|
15
15
|
onOutsideClick?: (close: () => void) => void;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* `confirm()`
|
|
17
|
+
* Called by the renderer when it is dismissed without a button press (Escape, the Android back action, etc.).
|
|
18
|
+
* `confirm()` resolves false with it so that the waiting caller does not hang.
|
|
19
19
|
*/
|
|
20
20
|
onDismiss?: () => void;
|
|
21
21
|
};
|
|
22
|
-
/** `ConfirmDialog
|
|
22
|
+
/** State read by `ConfirmDialog`. The imperative API (`confirm()`) writes here. */
|
|
23
23
|
export declare const confirmDialogStore: ExternalStore<ConfirmDialogValue>;
|
|
24
|
-
/**
|
|
24
|
+
/** Closes the open confirm dialog (keeps its content, so the text does not vanish during the closing animation). */
|
|
25
25
|
export declare function closeConfirmDialog(): void;
|
|
26
26
|
/**
|
|
27
|
-
* `ConfirmDialog`
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Call only while a `ConfirmDialog` is mounted (`once/confirm` calls it in an effect). Returns an unsubscribe function.
|
|
28
|
+
* **When the last one detaches, a confirm left open is resolved with false and closed** (if it unmounted while open, the waiting caller would
|
|
29
|
+
* hang, and an old confirm would appear the next time one mounts).
|
|
30
30
|
*/
|
|
31
31
|
export declare function registerConfirmDialog(): () => void;
|
|
32
32
|
export type ConfirmOptions = {
|
|
33
33
|
description?: string;
|
|
34
|
-
/**
|
|
34
|
+
/** Label of the "yes" button (default "はい"). */
|
|
35
35
|
yes?: string;
|
|
36
|
-
/**
|
|
36
|
+
/** Label of the "no" button (default "いいえ"). */
|
|
37
37
|
no?: string;
|
|
38
|
-
/**
|
|
38
|
+
/** Pass `destructive` for confirming irreversible actions, so it also looks dangerous. */
|
|
39
39
|
yesVariant?: ButtonProps["variant"];
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* (love3 は i18n に依存しない。文言は `yes` / `no` で渡し、既定は日本語)。
|
|
42
|
+
* Opens a confirm dialog and resolves with the pressed button (yes = true; no, outside press, back action = false).
|
|
43
|
+
* Place one `ConfirmDialog` from `once/confirm` at the app root (**without it, it neither opens nor resolves**; a warning is logged in development.
|
|
44
|
+
* If placed later, it opens at that point).
|
|
45
|
+
* Takes no i18n argument: love3 does not depend on i18n, text is passed as `yes` / `no`, and the defaults are Japanese.
|
|
47
46
|
*/
|
|
48
47
|
export declare function confirm(message: string, options?: ConfirmOptions): Promise<boolean>;
|
|
49
48
|
//#endregion
|
|
@@ -2,9 +2,9 @@ import { NO_LABEL, YES_LABEL } from "./labels.js";
|
|
|
2
2
|
import { createExternalStore } from "./external-store.js";
|
|
3
3
|
|
|
4
4
|
//#region src/native/lib/confirm.ts
|
|
5
|
-
/** `ConfirmDialog
|
|
5
|
+
/** State read by `ConfirmDialog`. The imperative API (`confirm()`) writes here. */
|
|
6
6
|
const confirmDialogStore = createExternalStore({ isOpen: false });
|
|
7
|
-
/**
|
|
7
|
+
/** Closes the open confirm dialog (keeps its content, so the text does not vanish during the closing animation). */
|
|
8
8
|
function closeConfirmDialog() {
|
|
9
9
|
confirmDialogStore.update((prev) => ({
|
|
10
10
|
...prev,
|
|
@@ -13,9 +13,9 @@ function closeConfirmDialog() {
|
|
|
13
13
|
}
|
|
14
14
|
let mountedDialogs = 0;
|
|
15
15
|
/**
|
|
16
|
-
* `ConfirmDialog`
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Call only while a `ConfirmDialog` is mounted (`once/confirm` calls it in an effect). Returns an unsubscribe function.
|
|
17
|
+
* **When the last one detaches, a confirm left open is resolved with false and closed** (if it unmounted while open, the waiting caller would
|
|
18
|
+
* hang, and an old confirm would appear the next time one mounts).
|
|
19
19
|
*/
|
|
20
20
|
function registerConfirmDialog() {
|
|
21
21
|
mountedDialogs += 1;
|
|
@@ -28,11 +28,10 @@ function registerConfirmDialog() {
|
|
|
28
28
|
}
|
|
29
29
|
let pendingResolve = null;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* (love3 は i18n に依存しない。文言は `yes` / `no` で渡し、既定は日本語)。
|
|
31
|
+
* Opens a confirm dialog and resolves with the pressed button (yes = true; no, outside press, back action = false).
|
|
32
|
+
* Place one `ConfirmDialog` from `once/confirm` at the app root (**without it, it neither opens nor resolves**; a warning is logged in development.
|
|
33
|
+
* If placed later, it opens at that point).
|
|
34
|
+
* Takes no i18n argument: love3 does not depend on i18n, text is passed as `yes` / `no`, and the defaults are Japanese.
|
|
36
35
|
*/
|
|
37
36
|
function confirm(message, options) {
|
|
38
37
|
const { description, yes, no, yesVariant } = options ?? {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//#region src/native/lib/control.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The accessibility props that input components (`atom/text-field`, `checkbox`, `switch`, `slider`) receive from the form wrapper (`FormControl` in `base/form`).
|
|
4
|
+
* Corresponds to the web `FormControl` (Radix's Slot passes `id` / `aria-*` to the direct child input).
|
|
5
5
|
*
|
|
6
|
-
* - `id` / `aria-labelledby` / `aria-describedby` / `aria-invalid`: react-native-web
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `accessibilityHint`:
|
|
6
|
+
* - `id` / `aria-labelledby` / `aria-describedby` / `aria-invalid`: react-native-web emits them to the DOM (association with the label and description works).
|
|
7
|
+
* Real-device React Native honors `aria-labelledby` on Android only and does not read `aria-describedby`,
|
|
8
|
+
* so for real-device screen readers, pass `accessibilityLabel` and `accessibilityHint` (passed when the form's parts are strings)
|
|
9
|
+
* - `accessibilityHint`: supplementary text (`description`). Real-device VoiceOver / TalkBack reads it after the name
|
|
10
10
|
*/
|
|
11
11
|
export type ControlA11yProps = {
|
|
12
12
|
id?: string;
|
|
@@ -16,9 +16,9 @@ export type ControlA11yProps = {
|
|
|
16
16
|
accessibilityHint?: string;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* `aria-labelledby`
|
|
21
|
-
*
|
|
19
|
+
* Props received by inputs that carry their own name (`atom/checkbox` = the label on the right, `atom/slider` = its own `label`).
|
|
20
|
+
* `aria-labelledby` is **not included in the type** (no silently dropping what has nowhere to go). Only inputs that want the form wrapper's label as their name
|
|
21
|
+
* (`text-field`, `switch`) accept all of `ControlA11yProps`.
|
|
22
22
|
*/
|
|
23
23
|
export type NamedControlA11yProps = Omit<ControlA11yProps, "aria-labelledby">;
|
|
24
24
|
//#endregion
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
//#region src/native/lib/external-store.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* ので、React の `useSyncExternalStore` で読む。値は不変で扱う(`set` は新しい値を渡す)。
|
|
3
|
+
* A small external store that bridges the imperative APIs (`confirm()`, `globalLoading()`) and the components placed at the root (`ConfirmDialog`, `LoadingLock`).
|
|
4
|
+
* love3 does not depend on jotai, so it is read with React's `useSyncExternalStore`. Treat values as immutable (`set` takes a new value).
|
|
6
5
|
*/
|
|
7
6
|
export type ExternalStore<T> = {
|
|
8
7
|
get: () => T;
|
|
9
8
|
set: (next: T) => void;
|
|
10
|
-
/**
|
|
9
|
+
/** Builds the next value from the previous one. */
|
|
11
10
|
update: (updater: (prev: T) => T) => void;
|
|
12
11
|
subscribe: (listener: () => void) => () => void;
|
|
13
|
-
/**
|
|
12
|
+
/** Read from components. Re-renders when the value changes. */
|
|
14
13
|
use: () => T;
|
|
15
14
|
};
|
|
16
15
|
export declare function createExternalStore<T>(initial: T): ExternalStore<T>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { KeyDownEvent } from "react-native";
|
|
2
2
|
//#region src/native/lib/keyboard.d.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* An `onKeyDown` that calls `activate` on Space (pass it to `Pressable`).
|
|
5
5
|
*
|
|
6
|
-
* react-native-web
|
|
7
|
-
*
|
|
8
|
-
* WAI-ARIA
|
|
9
|
-
* **Enter
|
|
6
|
+
* react-native-web's `Pressable` treats Enter as a press, but treats Space as a press **only for `<button>` or `role="button"`**
|
|
7
|
+
* (`isValidKeyPress` in `PressResponder`). `role="radio"` / `"checkbox"` / `"switch"` do not respond to Space.
|
|
8
|
+
* The WAI-ARIA APG decides these three with Space (without it, people using only a keyboard cannot select them; WCAG 2.1.1).
|
|
9
|
+
* **Enter is already handled as a press by react-native-web**, so only Space is handled here (handling Enter too would call it twice).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Real-device React Native only delivers keys listed in `keyDownEvents` to `onKeyDown`, so with this usage, which passes none, it is
|
|
12
|
+
* never called (behavior on device does not change). Presses with modifier keys (Ctrl, Alt, Meta, Shift) and held-key repeats are ignored.
|
|
13
13
|
*/
|
|
14
14
|
export declare function activateOnSpace(activate: () => void, disabled?: boolean | null): (event: KeyDownEvent) => void;
|
|
15
15
|
//#endregion
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
//#region src/native/lib/keyboard.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* An `onKeyDown` that calls `activate` on Space (pass it to `Pressable`).
|
|
4
4
|
*
|
|
5
|
-
* react-native-web
|
|
6
|
-
*
|
|
7
|
-
* WAI-ARIA
|
|
8
|
-
* **Enter
|
|
5
|
+
* react-native-web's `Pressable` treats Enter as a press, but treats Space as a press **only for `<button>` or `role="button"`**
|
|
6
|
+
* (`isValidKeyPress` in `PressResponder`). `role="radio"` / `"checkbox"` / `"switch"` do not respond to Space.
|
|
7
|
+
* The WAI-ARIA APG decides these three with Space (without it, people using only a keyboard cannot select them; WCAG 2.1.1).
|
|
8
|
+
* **Enter is already handled as a press by react-native-web**, so only Space is handled here (handling Enter too would call it twice).
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Real-device React Native only delivers keys listed in `keyDownEvents` to `onKeyDown`, so with this usage, which passes none, it is
|
|
11
|
+
* never called (behavior on device does not change). Presses with modifier keys (Ctrl, Alt, Meta, Shift) and held-key repeats are ignored.
|
|
12
12
|
*/
|
|
13
13
|
function activateOnSpace(activate, disabled) {
|
|
14
14
|
return (event) => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//#region src/native/lib/labels.d.ts
|
|
2
|
-
/**
|
|
2
|
+
/** Loading indicator (Spinner) */
|
|
3
3
|
export declare const LOADING_LABEL = "読み込み中";
|
|
4
|
-
/**
|
|
4
|
+
/** Default buttons of the confirm dialog (`confirm()`). Callers override them with `yes` / `no` */
|
|
5
5
|
export declare const YES_LABEL = "はい";
|
|
6
6
|
export declare const NO_LABEL = "いいえ";
|
|
7
|
-
/**
|
|
7
|
+
/** When the input of a number field (`type="number"` of `form/text-input`) cannot be read as a number */
|
|
8
8
|
export declare const NUMBER_INVALID_LABEL = "数値で入力してください";
|
|
9
|
-
/**
|
|
9
|
+
/** Close button (Sheet, Modal, Snackbar). Callers override it with `closeLabel` */
|
|
10
10
|
export declare const CLOSE_LABEL = "閉じる";
|
|
11
|
-
/** `atom/select`
|
|
11
|
+
/** Last resort for when no heading or name was passed for the options of `atom/select` (so it never becomes an unnamed dialog) */
|
|
12
12
|
export declare const SELECT_LABEL = "選択肢";
|
|
13
|
-
/** `form/select`
|
|
13
|
+
/** Default placeholder of `form/select` (same wording as the web `form/select`) */
|
|
14
14
|
export declare const SELECT_PLACEHOLDER_LABEL = "選択してください";
|
|
15
15
|
//#endregion
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
//#region src/native/lib/labels.ts
|
|
2
|
-
/**
|
|
2
|
+
/** Loading indicator (Spinner) */
|
|
3
3
|
const LOADING_LABEL = "読み込み中";
|
|
4
|
-
/**
|
|
4
|
+
/** Default buttons of the confirm dialog (`confirm()`). Callers override them with `yes` / `no` */
|
|
5
5
|
const YES_LABEL = "はい";
|
|
6
6
|
const NO_LABEL = "いいえ";
|
|
7
|
-
/**
|
|
7
|
+
/** When the input of a number field (`type="number"` of `form/text-input`) cannot be read as a number */
|
|
8
8
|
const NUMBER_INVALID_LABEL = "数値で入力してください";
|
|
9
|
-
/**
|
|
9
|
+
/** Close button (Sheet, Modal, Snackbar). Callers override it with `closeLabel` */
|
|
10
10
|
const CLOSE_LABEL = "閉じる";
|
|
11
|
-
/** `atom/select`
|
|
11
|
+
/** Last resort for when no heading or name was passed for the options of `atom/select` (so it never becomes an unnamed dialog) */
|
|
12
12
|
const SELECT_LABEL = "選択肢";
|
|
13
|
-
/** `form/select`
|
|
13
|
+
/** Default placeholder of `form/select` (same wording as the web `form/select`) */
|
|
14
14
|
const SELECT_PLACEHOLDER_LABEL = "選択してください";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExternalStore } from "./external-store.js";
|
|
2
2
|
//#region src/native/lib/loading.d.ts
|
|
3
|
-
/** `LoadingLock
|
|
3
|
+
/** State read by `LoadingLock`. The imperative API (`globalLoading()`) writes here. */
|
|
4
4
|
export declare const loadingStore: ExternalStore<boolean>;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Shows or hides a loading overlay that blocks interaction across the whole app. Place one `LoadingLock` from `once/loading-lock` at the app root.
|
|
7
|
+
* Holds a single boolean (repeated calls are not counted; the overlay goes away as soon as `false` is passed).
|
|
8
8
|
*/
|
|
9
9
|
export declare function globalLoading(loading: boolean): void;
|
|
10
10
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createExternalStore } from "./external-store.js";
|
|
2
2
|
|
|
3
3
|
//#region src/native/lib/loading.ts
|
|
4
|
-
/** `LoadingLock
|
|
4
|
+
/** State read by `LoadingLock`. The imperative API (`globalLoading()`) writes here. */
|
|
5
5
|
const loadingStore = createExternalStore(false);
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Shows or hides a loading overlay that blocks interaction across the whole app. Place one `LoadingLock` from `once/loading-lock` at the app root.
|
|
8
|
+
* Holds a single boolean (repeated calls are not counted; the overlay goes away as soon as `false` is passed).
|
|
9
9
|
*/
|
|
10
10
|
function globalLoading(loading) {
|
|
11
11
|
loadingStore.set(loading);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/native/lib/network.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 自分で `onlineManager.setEventListener` を NetInfo に繋ぐ)。
|
|
3
|
+
* Subscribes to whether the device is currently online. Used to control the display of `once/offline-banner`.
|
|
4
|
+
* It watches NetInfo only and does not depend on TanStack Query (an app that wants to tie fetch pausing and refetch on reconnect to NetInfo
|
|
5
|
+
* wires `onlineManager.setEventListener` to NetInfo itself).
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* web
|
|
7
|
+
* On device it uses NetInfo's `isConnected` (a `null` while determining is treated as online to avoid false positives).
|
|
8
|
+
* On web (react-native-web) NetInfo also works, watching `navigator.onLine` and the `online` / `offline` events.
|
|
10
9
|
*/
|
|
11
10
|
export declare function useIsOnline(): boolean;
|
|
12
11
|
//#endregion
|
|
@@ -3,13 +3,12 @@ import { addEventListener } from "@react-native-community/netinfo";
|
|
|
3
3
|
|
|
4
4
|
//#region src/native/lib/network.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* 自分で `onlineManager.setEventListener` を NetInfo に繋ぐ)。
|
|
6
|
+
* Subscribes to whether the device is currently online. Used to control the display of `once/offline-banner`.
|
|
7
|
+
* It watches NetInfo only and does not depend on TanStack Query (an app that wants to tie fetch pausing and refetch on reconnect to NetInfo
|
|
8
|
+
* wires `onlineManager.setEventListener` to NetInfo itself).
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* web
|
|
10
|
+
* On device it uses NetInfo's `isConnected` (a `null` while determining is treated as online to avoid false positives).
|
|
11
|
+
* On web (react-native-web) NetInfo also works, watching `navigator.onLine` and the `online` / `offline` events.
|
|
13
12
|
*/
|
|
14
13
|
function useIsOnline() {
|
|
15
14
|
const [online, setOnline] = useState(true);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { TokenName } from "../../tokens/tokens.gen.js";
|
|
2
2
|
//#region src/native/lib/scheme.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** Theme selection. `system` follows the device setting. Where it is stored (AsyncStorage, a settings screen) is the app's responsibility and is not handled here. */
|
|
4
4
|
export type ThemePreference = "system" | "light" | "dark";
|
|
5
|
-
/**
|
|
5
|
+
/** The theme actually used for rendering. */
|
|
6
6
|
export type ActiveScheme = "light" | "dark";
|
|
7
|
-
/**
|
|
7
|
+
/** Decides the theme to actually use from the selection and the device color scheme. */
|
|
8
8
|
export declare function resolveScheme(preference: ThemePreference, system: "light" | "dark" | "unspecified" | null | undefined): ActiveScheme;
|
|
9
|
-
/**
|
|
9
|
+
/** Names of color tokens (excluding the `font-*` typefaces and `radius`). These are the only ones `useTokenColor` accepts. */
|
|
10
10
|
export type ColorTokenName = Exclude<TokenName, `font-${string}` | "radius">;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* The actual value of a color token. The DS owns the values (`@lt-three/love3/tokens`), and components look them up through here.
|
|
13
|
+
* The name may be in CSS variable form (`--ink-500`) or token name form (`ink-500`). Non-color tokens (typefaces, radius) are not accepted.
|
|
14
14
|
*/
|
|
15
15
|
export declare function tokenColor(scheme: ActiveScheme, name: `--${ColorTokenName}` | ColorTokenName,
|
|
16
|
-
/**
|
|
16
|
+
/** Effective values distributed by tuning (`TuningRoot`). If present, they take priority (following runtime overrides). */
|
|
17
17
|
overlay?: Readonly<Record<ActiveScheme, Readonly<Record<string, string>>>> | null): string;
|
|
18
18
|
//#endregion
|