@tastic/hud 0.26.0 → 0.27.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 +9 -0
- package/dist/chrome/index.mjs +9 -9
- package/dist/{chunk-UO2V5C2U.mjs → chunk-B2DSHZJT.mjs} +8 -6
- package/dist/{index-DW0PsGCE.d.ts → index-1fnoSjO0.d.ts} +6 -2
- package/dist/{index-Bz4j509X.d.mts → index-Bhu3I6FN.d.mts} +6 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -6
- package/dist/index.mjs +15 -15
- package/dist/lobby/index.d.mts +2 -2
- package/dist/lobby/index.d.ts +2 -2
- package/dist/lobby/index.js +8 -6
- package/dist/lobby/index.mjs +1 -1
- package/package.json +1 -1
- package/src/PlayerSetupPanel.tsx +34 -12
- package/dist/{chunk-33MWHPPH.mjs → chunk-JBE7IQC5.mjs} +3 -3
package/README.md
CHANGED
|
@@ -51,6 +51,15 @@ corner of the screen.
|
|
|
51
51
|
Ported from five apps' own near-identical `PlayerSetupPanel.tsx`/`LobbyPlayerPanel.tsx`
|
|
52
52
|
(AirHockey, BoxHockey, Pong, LightCycles, Snake), which had all independently converged on this
|
|
53
53
|
exact skeleton. See "The secondPicker slot" below before wiring up that one prop.
|
|
54
|
+
Four optional props fit it to a host that draws on a backdrop (a felt) with muted profile colors,
|
|
55
|
+
each changing nothing when left unset: `nullLabel` (the no-profile row's label in the seat button's
|
|
56
|
+
dropdown, e.g. `'Guest'` beside a `'GUEST'` `guestLabel`), `previewValue` (how the seat's color is
|
|
57
|
+
drawn: the button's chip, its Color row and swatches, the fallback swatch, the plain label and the
|
|
58
|
+
Ready button, while `color` and what `onColorChange` receives stay the saved values), `triggerStyle`
|
|
59
|
+
(the seat button's trigger, e.g. a surface behind its pill) and `useSeatPickerAlign` (a placement
|
|
60
|
+
hook of the host's own for the seat button's dropdown, in place of `useZoneClampedAlign`, for a
|
|
61
|
+
screen turned by a fake landscape; leave it unset inside a split-screen zone, and keep the same hook
|
|
62
|
+
for the panel's life).
|
|
54
63
|
- **`CornerActionButtons`**: Back (top-left) + Settings (top-right) icon buttons fixed at a
|
|
55
64
|
screen's rotated corners. This isn't just a loadout/lobby-screen convention - it's the right
|
|
56
65
|
default for *any* screen with top-corner icon buttons, home screens included: every app in the
|
package/dist/chrome/index.mjs
CHANGED
|
@@ -18,7 +18,15 @@ import {
|
|
|
18
18
|
getStaggeredWordDuration,
|
|
19
19
|
useCompactDialog,
|
|
20
20
|
useWellColors
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-JBE7IQC5.mjs";
|
|
22
|
+
import {
|
|
23
|
+
InlineColorPicker,
|
|
24
|
+
MONO_FONT,
|
|
25
|
+
PopoverBody,
|
|
26
|
+
getInlineColorPickerContentSize,
|
|
27
|
+
useAutoAlign,
|
|
28
|
+
usePopoverHost
|
|
29
|
+
} from "../chunk-FOJLQMKA.mjs";
|
|
22
30
|
import {
|
|
23
31
|
COMPACT_DIALOG_HEIGHT,
|
|
24
32
|
DialogHeader,
|
|
@@ -30,14 +38,6 @@ import {
|
|
|
30
38
|
overlayStyles,
|
|
31
39
|
useOverlayCardColors
|
|
32
40
|
} from "../chunk-CBH7GQKI.mjs";
|
|
33
|
-
import {
|
|
34
|
-
InlineColorPicker,
|
|
35
|
-
MONO_FONT,
|
|
36
|
-
PopoverBody,
|
|
37
|
-
getInlineColorPickerContentSize,
|
|
38
|
-
useAutoAlign,
|
|
39
|
-
usePopoverHost
|
|
40
|
-
} from "../chunk-FOJLQMKA.mjs";
|
|
41
41
|
export {
|
|
42
42
|
AchievementCatalogSection,
|
|
43
43
|
AchievementRow,
|
|
@@ -81,7 +81,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
81
81
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
82
82
|
return `${idPrefix}-difficulty`;
|
|
83
83
|
}
|
|
84
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot" }) {
|
|
84
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
85
85
|
const ownHost = usePopoverHost();
|
|
86
86
|
const popover = host ?? ownHost;
|
|
87
87
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -90,17 +90,19 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
90
90
|
const showCpuDifficulty = !isHuman && cpuDifficulty !== void 0 && cpuDifficultyOptions !== void 0 && !!onCpuDifficultyChange;
|
|
91
91
|
const seatButton = showProfilePicker || showCpuDifficulty;
|
|
92
92
|
const selectedProfile = profiles?.find((p) => p.id === selectedProfileId) ?? null;
|
|
93
|
-
const
|
|
93
|
+
const drawn = previewValue ? previewValue(color) : color;
|
|
94
|
+
const colorSection = showColor ? { value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, caption: showProfilePicker && selectedProfile ? colorCaption : void 0, previewValue } : void 0;
|
|
94
95
|
const seatPickerId = showProfilePicker ? getProfilePopoverId(idPrefix) : getCpuDifficultyPopoverId(idPrefix);
|
|
95
96
|
const seatPickerSize = showProfilePicker ? getProfilePickerContentSize(profiles.length, !!onManageProfiles, colorSection) : getOptionPickerContentSize(cpuDifficultyOptions?.length ?? 0, colorSection);
|
|
96
|
-
const
|
|
97
|
+
const useSeatAlign = useSeatPickerAlign ?? useZoneClampedAlign;
|
|
98
|
+
const seatPickerAlign = useSeatAlign(seatButton && popover.openId === seatPickerId, seatPickerSize.width, seatPickerSize.height);
|
|
97
99
|
return /* @__PURE__ */ jsxs(View, { style: [styles2.panel, ownPopoverOpen && styles2.panelOpen], children: [
|
|
98
|
-
showProfilePicker ? /* @__PURE__ */ jsx2(ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color, dark, guestLabel: guestLabel ?? "GUEST", onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign }) : showCpuDifficulty ? /* @__PURE__ */ jsx2(OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign }) : label && /* @__PURE__ */ jsx2(Text2, { variant: "labelSmall", style: { color, fontFamily: labelFontFamily }, children: label }),
|
|
100
|
+
showProfilePicker ? /* @__PURE__ */ jsx2(ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color: drawn, dark, guestLabel: guestLabel ?? "GUEST", nullLabel, onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : showCpuDifficulty ? /* @__PURE__ */ jsx2(OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color: drawn, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : label && /* @__PURE__ */ jsx2(Text2, { variant: "labelSmall", style: { color: drawn, fontFamily: labelFontFamily }, children: label }),
|
|
99
101
|
(!seatButton || secondPicker) && /* @__PURE__ */ jsxs(View, { style: [styles2.pickerRow, pickerRowPopoverOpen && styles2.pickerRowOpen], children: [
|
|
100
|
-
!seatButton && /* @__PURE__ */ jsx2(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
102
|
+
!seatButton && /* @__PURE__ */ jsx2(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
101
103
|
secondPicker
|
|
102
104
|
] }),
|
|
103
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ jsx2(ReadyButton, { color, ready: ready ?? false, onToggleReady })
|
|
105
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ jsx2(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
104
106
|
] });
|
|
105
107
|
}
|
|
106
108
|
var styles2 = StyleSheet2.create({
|
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { SeedColor } from '@rific/auto-paper';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
|
-
import { P as PopoverHost, A as AlignResult, a as PopoverRotation, u as useAutoAlign } from './usePopoverHost-T8QWb2_A.js';
|
|
6
5
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
6
|
+
import { P as PopoverHost, A as AlignResult, a as PopoverRotation, u as useAutoAlign } from './usePopoverHost-T8QWb2_A.js';
|
|
7
7
|
|
|
8
8
|
interface MenuOption<T extends string | number> {
|
|
9
9
|
value: T;
|
|
@@ -61,6 +61,7 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
61
61
|
selectedProfileId?: string | null;
|
|
62
62
|
takenProfileId?: string | null;
|
|
63
63
|
guestLabel?: string;
|
|
64
|
+
nullLabel?: string;
|
|
64
65
|
onProfileSelect?: (profile: Profile | null) => void;
|
|
65
66
|
onManageProfiles?: () => void;
|
|
66
67
|
cpuDifficulty?: C;
|
|
@@ -68,8 +69,11 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
68
69
|
onCpuDifficultyChange?: (value: C) => void;
|
|
69
70
|
humanIcon?: string;
|
|
70
71
|
cpuIcon?: string;
|
|
72
|
+
previewValue?: (hex: string) => string;
|
|
73
|
+
triggerStyle?: StyleProp<ViewStyle>;
|
|
74
|
+
useSeatPickerAlign?: (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
71
75
|
}
|
|
72
|
-
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
76
|
+
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
73
77
|
|
|
74
78
|
interface Props$1 {
|
|
75
79
|
color: string;
|
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { SeedColor } from '@rific/auto-paper';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
|
-
import { P as PopoverHost, A as AlignResult, a as PopoverRotation, u as useAutoAlign } from './usePopoverHost-T8QWb2_A.mjs';
|
|
6
5
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
6
|
+
import { P as PopoverHost, A as AlignResult, a as PopoverRotation, u as useAutoAlign } from './usePopoverHost-T8QWb2_A.mjs';
|
|
7
7
|
|
|
8
8
|
interface MenuOption<T extends string | number> {
|
|
9
9
|
value: T;
|
|
@@ -61,6 +61,7 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
61
61
|
selectedProfileId?: string | null;
|
|
62
62
|
takenProfileId?: string | null;
|
|
63
63
|
guestLabel?: string;
|
|
64
|
+
nullLabel?: string;
|
|
64
65
|
onProfileSelect?: (profile: Profile | null) => void;
|
|
65
66
|
onManageProfiles?: () => void;
|
|
66
67
|
cpuDifficulty?: C;
|
|
@@ -68,8 +69,11 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
68
69
|
onCpuDifficultyChange?: (value: C) => void;
|
|
69
70
|
humanIcon?: string;
|
|
70
71
|
cpuIcon?: string;
|
|
72
|
+
previewValue?: (hex: string) => string;
|
|
73
|
+
triggerStyle?: StyleProp<ViewStyle>;
|
|
74
|
+
useSeatPickerAlign?: (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
71
75
|
}
|
|
72
|
-
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
76
|
+
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
73
77
|
|
|
74
78
|
interface Props$1 {
|
|
75
79
|
color: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { AchievementTier } from '@tastic/achievements';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
-
import { M as MenuOption } from './index-
|
|
7
|
-
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-
|
|
6
|
+
import { M as MenuOption } from './index-Bhu3I6FN.mjs';
|
|
7
|
+
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-Bhu3I6FN.mjs';
|
|
8
8
|
import { P as PopoverHost, A as AlignResult, a as PopoverRotation } from './usePopoverHost-T8QWb2_A.mjs';
|
|
9
9
|
export { b as PopoverAlign, c as PopoverVerticalAlign, V as ViewInstance, u as useAutoAlign, d as usePopoverHost } from './usePopoverHost-T8QWb2_A.mjs';
|
|
10
10
|
export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { AchievementTier } from '@tastic/achievements';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
-
import { M as MenuOption } from './index-
|
|
7
|
-
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-
|
|
6
|
+
import { M as MenuOption } from './index-1fnoSjO0.js';
|
|
7
|
+
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-1fnoSjO0.js';
|
|
8
8
|
import { P as PopoverHost, A as AlignResult, a as PopoverRotation } from './usePopoverHost-T8QWb2_A.js';
|
|
9
9
|
export { b as PopoverAlign, c as PopoverVerticalAlign, V as ViewInstance, u as useAutoAlign, d as usePopoverHost } from './usePopoverHost-T8QWb2_A.js';
|
|
10
10
|
export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1810,7 +1810,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
1810
1810
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
1811
1811
|
return `${idPrefix}-difficulty`;
|
|
1812
1812
|
}
|
|
1813
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot" }) {
|
|
1813
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
1814
1814
|
const ownHost = usePopoverHost();
|
|
1815
1815
|
const popover = host ?? ownHost;
|
|
1816
1816
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -1819,17 +1819,19 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
1819
1819
|
const showCpuDifficulty = !isHuman && cpuDifficulty !== void 0 && cpuDifficultyOptions !== void 0 && !!onCpuDifficultyChange;
|
|
1820
1820
|
const seatButton = showProfilePicker || showCpuDifficulty;
|
|
1821
1821
|
const selectedProfile = profiles?.find((p) => p.id === selectedProfileId) ?? null;
|
|
1822
|
-
const
|
|
1822
|
+
const drawn = previewValue ? previewValue(color) : color;
|
|
1823
|
+
const colorSection = showColor ? { value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, caption: showProfilePicker && selectedProfile ? colorCaption : void 0, previewValue } : void 0;
|
|
1823
1824
|
const seatPickerId = showProfilePicker ? getProfilePopoverId(idPrefix) : getCpuDifficultyPopoverId(idPrefix);
|
|
1824
1825
|
const seatPickerSize = showProfilePicker ? (0, import_profile2.getProfilePickerContentSize)(profiles.length, !!onManageProfiles, colorSection) : (0, import_profile2.getOptionPickerContentSize)(cpuDifficultyOptions?.length ?? 0, colorSection);
|
|
1825
|
-
const
|
|
1826
|
+
const useSeatAlign = useSeatPickerAlign ?? useZoneClampedAlign;
|
|
1827
|
+
const seatPickerAlign = useSeatAlign(seatButton && popover.openId === seatPickerId, seatPickerSize.width, seatPickerSize.height);
|
|
1826
1828
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native27.View, { style: [styles21.panel, ownPopoverOpen && styles21.panelOpen], children: [
|
|
1827
|
-
showProfilePicker ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_profile2.ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color, dark, guestLabel: guestLabel ?? "GUEST", onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign }) : showCpuDifficulty ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_profile2.OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign }) : label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native_paper16.Text, { variant: "labelSmall", style: { color, fontFamily: labelFontFamily }, children: label }),
|
|
1829
|
+
showProfilePicker ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_profile2.ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color: drawn, dark, guestLabel: guestLabel ?? "GUEST", nullLabel, onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : showCpuDifficulty ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_profile2.OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color: drawn, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native_paper16.Text, { variant: "labelSmall", style: { color: drawn, fontFamily: labelFontFamily }, children: label }),
|
|
1828
1830
|
(!seatButton || secondPicker) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native27.View, { style: [styles21.pickerRow, pickerRowPopoverOpen && styles21.pickerRowOpen], children: [
|
|
1829
|
-
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
1831
|
+
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
1830
1832
|
secondPicker
|
|
1831
1833
|
] }),
|
|
1832
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color, ready: ready ?? false, onToggleReady })
|
|
1834
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
1833
1835
|
] });
|
|
1834
1836
|
}
|
|
1835
1837
|
var styles21 = import_react_native27.StyleSheet.create({
|
package/dist/index.mjs
CHANGED
|
@@ -18,18 +18,11 @@ import {
|
|
|
18
18
|
getStaggeredWordDuration,
|
|
19
19
|
useCompactDialog,
|
|
20
20
|
useWellColors
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JBE7IQC5.mjs";
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
OverlayCard,
|
|
27
|
-
SecondaryButton,
|
|
28
|
-
isCompactDialogHeight,
|
|
29
|
-
overlayActionStyles,
|
|
30
|
-
overlayStyles,
|
|
31
|
-
useOverlayCardColors
|
|
32
|
-
} from "./chunk-CBH7GQKI.mjs";
|
|
23
|
+
loadSkiaWeb,
|
|
24
|
+
locateSkiaWebFile
|
|
25
|
+
} from "./chunk-3TCJHMJP.mjs";
|
|
33
26
|
import {
|
|
34
27
|
PlayerSetupPanel,
|
|
35
28
|
ReadyButton,
|
|
@@ -38,7 +31,7 @@ import {
|
|
|
38
31
|
getCpuDifficultyPopoverId,
|
|
39
32
|
getProfilePopoverId,
|
|
40
33
|
useZoneClampedAlign
|
|
41
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-B2DSHZJT.mjs";
|
|
42
35
|
import {
|
|
43
36
|
InlineColorPicker,
|
|
44
37
|
MONO_FONT,
|
|
@@ -48,9 +41,16 @@ import {
|
|
|
48
41
|
usePopoverHost
|
|
49
42
|
} from "./chunk-FOJLQMKA.mjs";
|
|
50
43
|
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
COMPACT_DIALOG_HEIGHT,
|
|
45
|
+
DialogHeader,
|
|
46
|
+
OverlayBackdrop,
|
|
47
|
+
OverlayCard,
|
|
48
|
+
SecondaryButton,
|
|
49
|
+
isCompactDialogHeight,
|
|
50
|
+
overlayActionStyles,
|
|
51
|
+
overlayStyles,
|
|
52
|
+
useOverlayCardColors
|
|
53
|
+
} from "./chunk-CBH7GQKI.mjs";
|
|
54
54
|
|
|
55
55
|
// src/AchievementUnlockList.tsx
|
|
56
56
|
import { getContrastColor, useAutoPaperTheme } from "@rific/auto-paper";
|
package/dist/lobby/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-
|
|
1
|
+
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-Bhu3I6FN.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@rific/auto-paper';
|
|
4
4
|
import '@tastic/profile';
|
|
5
|
+
import 'react-native';
|
|
5
6
|
import '../usePopoverHost-T8QWb2_A.mjs';
|
|
6
7
|
import '@tastic/core';
|
|
7
|
-
import 'react-native';
|
package/dist/lobby/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-
|
|
1
|
+
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-1fnoSjO0.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@rific/auto-paper';
|
|
4
4
|
import '@tastic/profile';
|
|
5
|
+
import 'react-native';
|
|
5
6
|
import '../usePopoverHost-T8QWb2_A.js';
|
|
6
7
|
import '@tastic/core';
|
|
7
|
-
import 'react-native';
|
package/dist/lobby/index.js
CHANGED
|
@@ -417,7 +417,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
417
417
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
418
418
|
return `${idPrefix}-difficulty`;
|
|
419
419
|
}
|
|
420
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot" }) {
|
|
420
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
421
421
|
const ownHost = usePopoverHost();
|
|
422
422
|
const popover = host ?? ownHost;
|
|
423
423
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -426,17 +426,19 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
426
426
|
const showCpuDifficulty = !isHuman && cpuDifficulty !== void 0 && cpuDifficultyOptions !== void 0 && !!onCpuDifficultyChange;
|
|
427
427
|
const seatButton = showProfilePicker || showCpuDifficulty;
|
|
428
428
|
const selectedProfile = profiles?.find((p) => p.id === selectedProfileId) ?? null;
|
|
429
|
-
const
|
|
429
|
+
const drawn = previewValue ? previewValue(color) : color;
|
|
430
|
+
const colorSection = showColor ? { value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, caption: showProfilePicker && selectedProfile ? colorCaption : void 0, previewValue } : void 0;
|
|
430
431
|
const seatPickerId = showProfilePicker ? getProfilePopoverId(idPrefix) : getCpuDifficultyPopoverId(idPrefix);
|
|
431
432
|
const seatPickerSize = showProfilePicker ? (0, import_profile.getProfilePickerContentSize)(profiles.length, !!onManageProfiles, colorSection) : (0, import_profile.getOptionPickerContentSize)(cpuDifficultyOptions?.length ?? 0, colorSection);
|
|
432
|
-
const
|
|
433
|
+
const useSeatAlign = useSeatPickerAlign ?? useZoneClampedAlign;
|
|
434
|
+
const seatPickerAlign = useSeatAlign(seatButton && popover.openId === seatPickerId, seatPickerSize.width, seatPickerSize.height);
|
|
433
435
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native7.View, { style: [styles4.panel, ownPopoverOpen && styles4.panelOpen], children: [
|
|
434
|
-
showProfilePicker ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_profile.ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color, dark, guestLabel: guestLabel ?? "GUEST", onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign }) : showCpuDifficulty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_profile.OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign }) : label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper3.Text, { variant: "labelSmall", style: { color, fontFamily: labelFontFamily }, children: label }),
|
|
436
|
+
showProfilePicker ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_profile.ProfilePicker, { idPrefix, host: popover, profiles, selectedId: selectedProfileId ?? null, takenId: takenProfileId, color: drawn, dark, guestLabel: guestLabel ?? "GUEST", nullLabel, onSelect: (profile) => onProfileSelect?.(profile), onManage: onManageProfiles, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : showCpuDifficulty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_profile.OptionPicker, { id: getCpuDifficultyPopoverId(idPrefix), host: popover, options: cpuDifficultyOptions, value: cpuDifficulty, onChange: onCpuDifficultyChange, color: drawn, dark, icon: cpuIcon, colorSection, alignOverride: seatPickerAlign, triggerStyle }) : label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper3.Text, { variant: "labelSmall", style: { color: drawn, fontFamily: labelFontFamily }, children: label }),
|
|
435
437
|
(!seatButton || secondPicker) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native7.View, { style: [styles4.pickerRow, pickerRowPopoverOpen && styles4.pickerRowOpen], children: [
|
|
436
|
-
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
438
|
+
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
437
439
|
secondPicker
|
|
438
440
|
] }),
|
|
439
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReadyButton, { color, ready: ready ?? false, onToggleReady })
|
|
441
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
440
442
|
] });
|
|
441
443
|
}
|
|
442
444
|
var styles4 = import_react_native7.StyleSheet.create({
|
package/dist/lobby/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/hud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"description": "Visual component kit for local-multiplayer React Native games: inline (non-modal) popovers, dropdowns, color pickers, gauges, ready buttons, and dialogs, built to stay scoped to one player's own zone on a shared screen",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
package/src/PlayerSetupPanel.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SeedColor } from '@rific/auto-paper'
|
|
2
2
|
import { getOptionPickerContentSize, getProfilePickerContentSize, OptionPicker, Profile, ProfilePicker, type ProfilePickerColorSection } from '@tastic/profile'
|
|
3
3
|
import { ReactNode } from 'react'
|
|
4
|
-
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
5
5
|
import { Text } from 'react-native-paper'
|
|
6
6
|
|
|
7
7
|
import { InlineColorPicker } from './InlineColorPicker'
|
|
@@ -93,6 +93,10 @@ export interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
93
93
|
// ProfilePicker's own doc for why it's never "Player"). Required whenever profiles is provided,
|
|
94
94
|
// since the trigger always needs some idle text.
|
|
95
95
|
guestLabel?: string
|
|
96
|
+
// The no-profile row's label in the seat button's dropdown (ProfilePicker's `nullLabel`), e.g.
|
|
97
|
+
// 'Guest' for a seat whose button reads 'GUEST' (guestLabel) until a profile is picked. Unset is
|
|
98
|
+
// ProfilePicker's own default.
|
|
99
|
+
nullLabel?: string
|
|
96
100
|
onProfileSelect?: (profile: Profile | null) => void
|
|
97
101
|
// Navigates to a profile-management screen - typically only ever wired up for one seat (a rotated
|
|
98
102
|
// second zone often can't host a working text keyboard).
|
|
@@ -109,6 +113,21 @@ export interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
109
113
|
// than this component needing any opinion on what those states are.
|
|
110
114
|
humanIcon?: string
|
|
111
115
|
cpuIcon?: string
|
|
116
|
+
// How the seat's color is drawn, for a host that draws profile colors muted (Solitaire on its felt):
|
|
117
|
+
// the seat button's chip, its Color row and swatches (the color section's `previewValue`), the
|
|
118
|
+
// fallback swatch, the plain label and the Ready button all show previewValue(color), while `color`,
|
|
119
|
+
// `takenColor` and what onColorChange receives stay the saved values. Unset draws them as given.
|
|
120
|
+
previewValue?: (hex: string) => string
|
|
121
|
+
// Extra style for the seat button's trigger, e.g. a background behind its pill so it reads on a
|
|
122
|
+
// busy backdrop (ProfilePicker's and OptionPicker's `triggerStyle`).
|
|
123
|
+
triggerStyle?: StyleProp<ViewStyle>
|
|
124
|
+
// A placement of the host's own for the seat button's dropdown, in place of useZoneClampedAlign:
|
|
125
|
+
// called as a hook with whether the dropdown is open and the size it draws, and its result handed
|
|
126
|
+
// to the picker as `alignOverride` (for a screen turned by a fake landscape, whose button
|
|
127
|
+
// useAutoAlign would measure against the upright window). It replaces the zone clamp, so leave it
|
|
128
|
+
// unset for a panel inside a @tastic/split-screen zone. A hook: keep the same one for the panel's
|
|
129
|
+
// life, and remount the panel (a key) to change it.
|
|
130
|
+
useSeatPickerAlign?: (open: boolean, contentWidth: number, contentHeight: number) => AlignResult
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
// One panel per player slot in a local-multiplayer loadout/lobby screen: one seat button, an
|
|
@@ -125,7 +144,7 @@ export interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
125
144
|
// Owns its own popover host shared by its own pickers unless a `host` is passed in to share with
|
|
126
145
|
// another panel (or a shared-controls row) instead - same convention as every popover-hosting
|
|
127
146
|
// component in this package.
|
|
128
|
-
export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = 'face-man', cpuIcon = 'robot' }: PlayerSetupPanelProps<C>) {
|
|
147
|
+
export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = 'face-man', cpuIcon = 'robot', previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>) {
|
|
129
148
|
const ownHost = usePopoverHost()
|
|
130
149
|
const popover = host ?? ownHost
|
|
131
150
|
// Checking *this panel's own* ids, not just "is anything open on the host" - when `host` is
|
|
@@ -144,26 +163,29 @@ export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, la
|
|
|
144
163
|
// Read live from the selected profile rather than snapshotted at selection time, since a caller
|
|
145
164
|
// typically has no other editing surface for it on this same screen.
|
|
146
165
|
const selectedProfile = profiles?.find((p) => p.id === selectedProfileId) ?? null
|
|
166
|
+
// The seat's color as it's drawn (see previewValue); `color` itself stays the saved one.
|
|
167
|
+
const drawn = previewValue ? previewValue(color) : color
|
|
147
168
|
|
|
148
|
-
const colorSection: ProfilePickerColorSection | undefined = showColor ? { value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, caption: showProfilePicker && selectedProfile ? colorCaption : undefined } : undefined
|
|
169
|
+
const colorSection: ProfilePickerColorSection | undefined = showColor ? { value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, caption: showProfilePicker && selectedProfile ? colorCaption : undefined, previewValue } : undefined
|
|
149
170
|
// The seat button's dropdown is placed here rather than by the caller: inside a
|
|
150
171
|
// @tastic/split-screen zone (2 Player) it has to stay in that player's half, which
|
|
151
|
-
// useZoneClampedAlign does, and outside one it's useAutoAlign's own placement
|
|
152
|
-
// section and rows the picker draws. Rotation 0, the same
|
|
153
|
-
// dropdowns this button replaced were all placed with.
|
|
172
|
+
// useZoneClampedAlign does, and outside one it's useAutoAlign's own placement (or the host's own,
|
|
173
|
+
// useSeatPickerAlign). Sized from the same section and rows the picker draws. Rotation 0, the same
|
|
174
|
+
// as the profile, color and difficulty dropdowns this button replaced were all placed with.
|
|
154
175
|
const seatPickerId = showProfilePicker ? getProfilePopoverId(idPrefix) : getCpuDifficultyPopoverId(idPrefix)
|
|
155
176
|
const seatPickerSize = showProfilePicker ? getProfilePickerContentSize(profiles!.length, !!onManageProfiles, colorSection) : getOptionPickerContentSize(cpuDifficultyOptions?.length ?? 0, colorSection)
|
|
156
|
-
const
|
|
177
|
+
const useSeatAlign = useSeatPickerAlign ?? useZoneClampedAlign
|
|
178
|
+
const seatPickerAlign = useSeatAlign(seatButton && popover.openId === seatPickerId, seatPickerSize.width, seatPickerSize.height)
|
|
157
179
|
|
|
158
180
|
return (
|
|
159
181
|
<View style={[styles.panel, ownPopoverOpen && styles.panelOpen]}>
|
|
160
182
|
{showProfilePicker ? (
|
|
161
|
-
<ProfilePicker idPrefix={idPrefix} host={popover} profiles={profiles!} selectedId={selectedProfileId ?? null} takenId={takenProfileId} color={
|
|
183
|
+
<ProfilePicker idPrefix={idPrefix} host={popover} profiles={profiles!} selectedId={selectedProfileId ?? null} takenId={takenProfileId} color={drawn} dark={dark} guestLabel={guestLabel ?? 'GUEST'} nullLabel={nullLabel} onSelect={(profile: Profile | null) => onProfileSelect?.(profile)} onManage={onManageProfiles} colorSection={colorSection} alignOverride={seatPickerAlign} triggerStyle={triggerStyle} />
|
|
162
184
|
) : showCpuDifficulty ? (
|
|
163
|
-
<OptionPicker id={getCpuDifficultyPopoverId(idPrefix)} host={popover} options={cpuDifficultyOptions!} value={cpuDifficulty!} onChange={onCpuDifficultyChange!} color={
|
|
185
|
+
<OptionPicker id={getCpuDifficultyPopoverId(idPrefix)} host={popover} options={cpuDifficultyOptions!} value={cpuDifficulty!} onChange={onCpuDifficultyChange!} color={drawn} dark={dark} icon={cpuIcon} colorSection={colorSection} alignOverride={seatPickerAlign} triggerStyle={triggerStyle} />
|
|
164
186
|
) : (
|
|
165
187
|
label && (
|
|
166
|
-
<Text variant='labelSmall' style={{ color, fontFamily: labelFontFamily }}>
|
|
188
|
+
<Text variant='labelSmall' style={{ color: drawn, fontFamily: labelFontFamily }}>
|
|
167
189
|
{label}
|
|
168
190
|
</Text>
|
|
169
191
|
)
|
|
@@ -174,13 +196,13 @@ export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, la
|
|
|
174
196
|
{/* The fallback swatch, for a seat with no button: a human slot shows the selected
|
|
175
197
|
profile's own tag when it has one, falling back to humanIcon; a non-human slot always
|
|
176
198
|
falls back to cpuIcon. */}
|
|
177
|
-
{!seatButton && <InlineColorPicker id={getColorPopoverId(idPrefix)} host={popover} value={color} onChange={onColorChange} swatches={swatches} takenValue={takenColor} allowSwapTaken={allowSwapTaken} alignOverride={colorAlignOverride} rotation={colorRotation} dark={dark} tag={isHuman ? selectedProfile?.tag : undefined} icon={isHuman ? humanIcon : cpuIcon} />}
|
|
199
|
+
{!seatButton && <InlineColorPicker id={getColorPopoverId(idPrefix)} host={popover} value={color} onChange={onColorChange} swatches={swatches} takenValue={takenColor} allowSwapTaken={allowSwapTaken} previewValue={previewValue} alignOverride={colorAlignOverride} rotation={colorRotation} dark={dark} tag={isHuman ? selectedProfile?.tag : undefined} icon={isHuman ? humanIcon : cpuIcon} />}
|
|
178
200
|
|
|
179
201
|
{secondPicker}
|
|
180
202
|
</View>
|
|
181
203
|
)}
|
|
182
204
|
|
|
183
|
-
{isHuman && showReadyButton && onToggleReady && <ReadyButton color={
|
|
205
|
+
{isHuman && showReadyButton && onToggleReady && <ReadyButton color={drawn} ready={ready ?? false} onToggleReady={onToggleReady} />}
|
|
184
206
|
</View>
|
|
185
207
|
)
|
|
186
208
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MONO_FONT
|
|
3
|
+
} from "./chunk-FOJLQMKA.mjs";
|
|
1
4
|
import {
|
|
2
5
|
DialogHeader,
|
|
3
6
|
OverlayBackdrop,
|
|
@@ -8,9 +11,6 @@ import {
|
|
|
8
11
|
overlayStyles,
|
|
9
12
|
useOverlayCardColors
|
|
10
13
|
} from "./chunk-CBH7GQKI.mjs";
|
|
11
|
-
import {
|
|
12
|
-
MONO_FONT
|
|
13
|
-
} from "./chunk-FOJLQMKA.mjs";
|
|
14
14
|
|
|
15
15
|
// src/wellSurface.ts
|
|
16
16
|
import { useAutoPaperTheme } from "@rific/auto-paper";
|