@tastic/hud 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -268,6 +268,11 @@ export function SettingsDialog({ visible, onDismiss, rotation = 0, settings, set
268
268
  }
269
269
  ```
270
270
 
271
+ A game with music passes `showMusic`, which adds a Music toggle beside Sound and Haptics. It flips
272
+ `@rific/feedback-press`'s Music setting (`useMusicSettings`, 0.14.0+), which its `useMusic` tracks
273
+ follow; it's apart from Sound, so a player can keep the effects and turn the music off. Hidden unless
274
+ asked for, since most games have no music.
275
+
271
276
  ## Overlay cards (`OverlayCard`, `OverlayBackdrop`, `useOverlayCardColors`)
272
277
 
273
278
  `ConfirmDialog` and `HowToPlayDialog` draw their card and the dim behind it with these, and a game's
@@ -742,11 +747,19 @@ export default function BoardHost(props: BoardProps) {
742
747
 
743
748
  ```tsx
744
749
  // BoardHost.web.tsx: web imports the board only once CanvasKit has loaded
745
- import { loadSkiaWeb } from '@tastic/hud/skia'
746
- import { lazy, Suspense } from 'react'
750
+ import { lazySkia } from '@tastic/hud/skia'
747
751
 
748
752
  import type { BoardProps } from './Board'
749
753
 
754
+ export default lazySkia<BoardProps>(() => import('./Board').then((m) => ({ default: m.Board })))
755
+ ```
756
+
757
+ `lazySkia<P extends object>(load: () => Promise<{ default: ComponentType<P> }>): ComponentType<P>` returns a
758
+ component that renders a `React.lazy` over `loadSkiaWeb().then(load)` inside a `Suspense` with a `null`
759
+ fallback: nothing is drawn, and the board's module isn't even imported, until CanvasKit has loaded. Its
760
+ props pass straight through to the board. Written out by hand, it is:
761
+
762
+ ```tsx
750
763
  const LazyBoard = lazy(() => loadSkiaWeb().then(() => import('./Board').then((m) => ({ default: m.Board }))))
751
764
 
752
765
  export default function BoardHost(props: BoardProps) {
@@ -759,9 +772,13 @@ export default function BoardHost(props: BoardProps) {
759
772
  ```
760
773
 
761
774
  - Import the host, never `Board` itself, everywhere else in the app.
762
- - Keep `lazy()` at module scope, as above, so the component is created once.
763
- - Import from `@tastic/hud/skia` (also exported from `@tastic/hud`). It carries none of the main entry's
764
- heavier peers, so it works in every app.
775
+ - Call `lazySkia` at module scope, as above, so the component is created once. Called during a render, it
776
+ would be a new component every time, remounting the board.
777
+ - Import from `@tastic/hud/skia`. It carries none of the main entry's heavier peers (only `react`), so it
778
+ works in every app. `loadSkiaWeb` and `locateSkiaWebFile` are also exported from `@tastic/hud`;
779
+ `lazySkia` is only on `@tastic/hud/skia`.
780
+ - PuckTastic and DuelTastic each had an identical copy of `lazySkia` (`src/shared/lazySkia.tsx`); they
781
+ switch to this one when they take the release that has it.
765
782
  - A test that imports a native host imports Skia, which throws under Jest (no native bindings). Mock the
766
783
  host, or don't import the screen that uses it.
767
784
 
@@ -57,13 +57,15 @@ interface BaseSettingsDialogProps {
57
57
  onDeferBottomEdgeGestures?: (value: boolean) => void;
58
58
  hideSound?: boolean;
59
59
  hideHaptics?: boolean;
60
+ showMusic?: boolean;
60
61
  hideAppearance?: boolean;
61
62
  hideUpdateCheck?: boolean;
62
63
  onUpdateError?: (message: string) => void;
63
64
  onShowHowToPlay?: () => void;
64
65
  children?: ReactNode;
66
+ leading?: ReactNode;
65
67
  }
66
- declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps): react.JSX.Element | null;
68
+ declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, showMusic, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps): react.JSX.Element | null;
67
69
 
68
70
  type MD3TextVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
69
71
  interface Props$7 {
@@ -57,13 +57,15 @@ interface BaseSettingsDialogProps {
57
57
  onDeferBottomEdgeGestures?: (value: boolean) => void;
58
58
  hideSound?: boolean;
59
59
  hideHaptics?: boolean;
60
+ showMusic?: boolean;
60
61
  hideAppearance?: boolean;
61
62
  hideUpdateCheck?: boolean;
62
63
  onUpdateError?: (message: string) => void;
63
64
  onShowHowToPlay?: () => void;
64
65
  children?: ReactNode;
66
+ leading?: ReactNode;
65
67
  }
66
- declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps): react.JSX.Element | null;
68
+ declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, showMusic, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps): react.JSX.Element | null;
67
69
 
68
70
  type MD3TextVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
69
71
  interface Props$7 {
@@ -515,7 +515,7 @@ var import_jsx_runtime11 = require("react/jsx-runtime");
515
515
  function SettingIcon({ source, color, containerColor }) {
516
516
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native12.View, { style: [styles9.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Icon, { source, size: 18, color }) });
517
517
  }
518
- function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
518
+ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, showMusic = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
519
519
  const { colors } = (0, import_auto_paper6.useAutoPaperTheme)();
520
520
  const ambientRotation = (0, import_core5.useRotation)();
521
521
  const rotation = rotationOverride ?? ambientRotation;
@@ -527,6 +527,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
527
527
  const isTouchPrimary = (0, import_core5.useIsTouchPrimaryDevice)();
528
528
  const { settings: hapticSettings, set: setHapticSettings } = (0, import_feedback_press3.useHapticSettings)();
529
529
  const { settings: soundSettings, set: setSoundSettings } = (0, import_feedback_press3.useSoundSettings)();
530
+ const { settings: musicSettings, set: setMusicSettings } = (0, import_feedback_press3.useMusicSettings)();
530
531
  const { settings: keepAwakeSettings, set: setKeepAwakeSettings } = (0, import_core4.useKeepAwakeSettings)();
531
532
  const expoKeepAwake = (0, import_core4.useExpoKeepAwake)();
532
533
  const sound = (0, import_react6.useContext)(import_feedback_press3.SoundContext);
@@ -553,13 +554,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
553
554
  const showAppearance = !hideAppearance;
554
555
  const showBlur = showAppearance && import_react_native12.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
555
556
  const showUpdateCheck = import_react_native12.Platform.OS !== "web" && !hideUpdateCheck;
557
+ const hasLeading = leading !== void 0 && leading !== null && leading !== false;
556
558
  if (!opened) return null;
557
559
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
558
560
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_auto_paper6.Dialog, { visible, onDismiss, style: [styles9.dialog, { width: sheetWidth }], children: [
559
561
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_auto_paper6.Dialog.ScrollArea, { style: styles9.scrollArea, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_auto_paper6.FadingScrollView, { contentContainerStyle: styles9.scrollContent, showsVerticalScrollIndicator: false, children: [
560
562
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
561
563
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.content, children: [
564
+ hasLeading && leading,
562
565
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleGroup, children: [
566
+ hasLeading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Text, { variant: "labelMedium", style: [styles9.sectionLabel, styles9.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
563
567
  showLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles9.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleContent, children: [
564
568
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
565
569
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.flexShrink, children: [
@@ -581,7 +585,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
581
585
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Text, { variant: "bodySmall", numberOfLines: 1, style: { color: colors.onSurfaceVariant }, children: "Stop auto-lock mid-match" })
582
586
  ] })
583
587
  ] }) }),
584
- (showSound || showHaptics) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleRow, children: [
588
+ (showSound || showMusic || showHaptics) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleRow, children: [
585
589
  showSound && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
586
590
  import_feedback_press3.TouchableRipple,
587
591
  {
@@ -599,6 +603,10 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
599
603
  ] })
600
604
  }
601
605
  ),
606
+ showMusic && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => setMusicSettings({ enabled: !musicSettings.enabled }), style: styles9.toggleButtonInRow, accessibilityLabel: `Music ${musicSettings.enabled ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleContent, children: [
607
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingIcon, { source: musicSettings.enabled ? "music" : "music-off", color: musicSettings.enabled ? colors.tertiary : colors.onSurfaceVariant, containerColor: musicSettings.enabled ? colors.tertiaryContainer : colors.surfaceVariant }),
608
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Text, { variant: "bodyLarge", style: { color: colors.onSurface }, children: "Music" })
609
+ ] }) }),
602
610
  showHaptics && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
603
611
  import_feedback_press3.TouchableRipple,
604
612
  {
@@ -741,6 +749,10 @@ var styles9 = import_react_native12.StyleSheet.create({
741
749
  toggleGroup: {
742
750
  gap: 4
743
751
  },
752
+ // The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
753
+ toggleGroupLabel: {
754
+ marginBottom: 8
755
+ },
744
756
  // No horizontal margin of its own now either - see toggleButton's identical note.
745
757
  toggleRow: {
746
758
  flexDirection: "row",
@@ -18,7 +18,15 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "../chunk-75Q2VN5R.mjs";
21
+ } from "../chunk-VDPL2WUK.mjs";
22
+ import {
23
+ InlineColorPicker,
24
+ MONO_FONT,
25
+ PopoverBody,
26
+ getInlineColorPickerContentSize,
27
+ useAutoAlign,
28
+ usePopoverHost
29
+ } from "../chunk-5ECU3722.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-5ECU3722.mjs";
41
41
  export {
42
42
  AchievementCatalogSection,
43
43
  AchievementRow,
@@ -1,3 +1,6 @@
1
+ import {
2
+ MONO_FONT
3
+ } from "./chunk-5ECU3722.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-5ECU3722.mjs";
14
14
 
15
15
  // src/wellSurface.ts
16
16
  import { useAutoPaperTheme } from "@rific/auto-paper";
@@ -282,7 +282,7 @@ var styles6 = StyleSheet6.create({
282
282
  // src/BaseSettingsDialog.tsx
283
283
  import { AutoAppearancePicker, Dialog, FadingScrollView, useAutoPaperTheme as useAutoPaperTheme4, useBlurModule, useThemeSettings } from "@rific/auto-paper";
284
284
  import { useExpoKeepAwake, useKeepAwakeSettings } from "@rific/core";
285
- import { Button as Button2, SoundContext, TouchableRipple, useHapticSettings, useSoundSettings, useVibration } from "@rific/feedback-press";
285
+ import { Button as Button2, SoundContext, TouchableRipple, useHapticSettings, useMusicSettings, useSoundSettings, useVibration } from "@rific/feedback-press";
286
286
  import { useUpdater } from "@rific/updater";
287
287
  import { rotateInsets as rotateInsets2, useIsTouchPrimaryDevice, useRotation as useRotation2 } from "@tastic/core";
288
288
  import { useContext, useState as useState3 } from "react";
@@ -315,7 +315,7 @@ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
315
315
  function SettingIcon({ source, color, containerColor }) {
316
316
  return /* @__PURE__ */ jsx8(View6, { style: [styles7.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ jsx8(Icon2, { source, size: 18, color }) });
317
317
  }
318
- function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
318
+ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, showMusic = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
319
319
  const { colors } = useAutoPaperTheme4();
320
320
  const ambientRotation = useRotation2();
321
321
  const rotation = rotationOverride ?? ambientRotation;
@@ -327,6 +327,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
327
327
  const isTouchPrimary = useIsTouchPrimaryDevice();
328
328
  const { settings: hapticSettings, set: setHapticSettings } = useHapticSettings();
329
329
  const { settings: soundSettings, set: setSoundSettings } = useSoundSettings();
330
+ const { settings: musicSettings, set: setMusicSettings } = useMusicSettings();
330
331
  const { settings: keepAwakeSettings, set: setKeepAwakeSettings } = useKeepAwakeSettings();
331
332
  const expoKeepAwake = useExpoKeepAwake();
332
333
  const sound = useContext(SoundContext);
@@ -353,13 +354,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
353
354
  const showAppearance = !hideAppearance;
354
355
  const showBlur = showAppearance && Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
355
356
  const showUpdateCheck = Platform.OS !== "web" && !hideUpdateCheck;
357
+ const hasLeading = leading !== void 0 && leading !== null && leading !== false;
356
358
  if (!opened) return null;
357
359
  return /* @__PURE__ */ jsx8(Portal3, { children: /* @__PURE__ */ jsxs7(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
358
360
  /* @__PURE__ */ jsxs7(Dialog, { visible, onDismiss, style: [styles7.dialog, { width: sheetWidth }], children: [
359
361
  /* @__PURE__ */ jsx8(Dialog.ScrollArea, { style: styles7.scrollArea, children: /* @__PURE__ */ jsxs7(FadingScrollView, { contentContainerStyle: styles7.scrollContent, showsVerticalScrollIndicator: false, children: [
360
362
  /* @__PURE__ */ jsx8(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
361
363
  /* @__PURE__ */ jsxs7(View6, { style: styles7.content, children: [
364
+ hasLeading && leading,
362
365
  /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleGroup, children: [
366
+ hasLeading && /* @__PURE__ */ jsx8(Text6, { variant: "labelMedium", style: [styles7.sectionLabel, styles7.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
363
367
  showLockOrientation && /* @__PURE__ */ jsx8(TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles7.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleContent, children: [
364
368
  /* @__PURE__ */ jsx8(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
365
369
  /* @__PURE__ */ jsxs7(View6, { style: styles7.flexShrink, children: [
@@ -381,7 +385,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
381
385
  /* @__PURE__ */ jsx8(Text6, { variant: "bodySmall", numberOfLines: 1, style: { color: colors.onSurfaceVariant }, children: "Stop auto-lock mid-match" })
382
386
  ] })
383
387
  ] }) }),
384
- (showSound || showHaptics) && /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleRow, children: [
388
+ (showSound || showMusic || showHaptics) && /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleRow, children: [
385
389
  showSound && /* @__PURE__ */ jsx8(
386
390
  TouchableRipple,
387
391
  {
@@ -399,6 +403,10 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
399
403
  ] })
400
404
  }
401
405
  ),
406
+ showMusic && /* @__PURE__ */ jsx8(TouchableRipple, { onPress: () => setMusicSettings({ enabled: !musicSettings.enabled }), style: styles7.toggleButtonInRow, accessibilityLabel: `Music ${musicSettings.enabled ? "on" : "off"}`, children: /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleContent, children: [
407
+ /* @__PURE__ */ jsx8(SettingIcon, { source: musicSettings.enabled ? "music" : "music-off", color: musicSettings.enabled ? colors.tertiary : colors.onSurfaceVariant, containerColor: musicSettings.enabled ? colors.tertiaryContainer : colors.surfaceVariant }),
408
+ /* @__PURE__ */ jsx8(Text6, { variant: "bodyLarge", style: { color: colors.onSurface }, children: "Music" })
409
+ ] }) }),
402
410
  showHaptics && /* @__PURE__ */ jsx8(
403
411
  TouchableRipple,
404
412
  {
@@ -541,6 +549,10 @@ var styles7 = StyleSheet7.create({
541
549
  toggleGroup: {
542
550
  gap: 4
543
551
  },
552
+ // The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
553
+ toggleGroupLabel: {
554
+ marginBottom: 8
555
+ },
544
556
  // No horizontal margin of its own now either - see toggleButton's identical note.
545
557
  toggleRow: {
546
558
  flexDirection: "row",
package/dist/index.d.mts CHANGED
@@ -7,7 +7,7 @@ import { M as MenuOption } from './index-BOMA2rLU.mjs';
7
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-BOMA2rLU.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
- export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.mjs';
10
+ export { l as loadSkiaWeb, a as locateSkiaWebFile } from './locateSkiaWebFile-DAJ0ok2i.mjs';
11
11
  import '@tastic/core';
12
12
  import '@rific/auto-paper';
13
13
  import '@rific/feedback-press';
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { M as MenuOption } from './index-B2sz-9jr.js';
7
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-B2sz-9jr.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
- export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.js';
10
+ export { l as loadSkiaWeb, a as locateSkiaWebFile } from './locateSkiaWebFile-DAJ0ok2i.js';
11
11
  import '@tastic/core';
12
12
  import '@rific/auto-paper';
13
13
  import '@rific/feedback-press';
package/dist/index.js CHANGED
@@ -714,7 +714,7 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
714
714
  function SettingIcon({ source, color, containerColor }) {
715
715
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native13.View, { style: [styles10.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Icon, { source, size: 18, color }) });
716
716
  }
717
- function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
717
+ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, showMusic = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
718
718
  const { colors } = (0, import_auto_paper7.useAutoPaperTheme)();
719
719
  const ambientRotation = (0, import_core5.useRotation)();
720
720
  const rotation = rotationOverride ?? ambientRotation;
@@ -726,6 +726,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
726
726
  const isTouchPrimary = (0, import_core5.useIsTouchPrimaryDevice)();
727
727
  const { settings: hapticSettings, set: setHapticSettings } = (0, import_feedback_press3.useHapticSettings)();
728
728
  const { settings: soundSettings, set: setSoundSettings } = (0, import_feedback_press3.useSoundSettings)();
729
+ const { settings: musicSettings, set: setMusicSettings } = (0, import_feedback_press3.useMusicSettings)();
729
730
  const { settings: keepAwakeSettings, set: setKeepAwakeSettings } = (0, import_core4.useKeepAwakeSettings)();
730
731
  const expoKeepAwake = (0, import_core4.useExpoKeepAwake)();
731
732
  const sound = (0, import_react6.useContext)(import_feedback_press3.SoundContext);
@@ -752,13 +753,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
752
753
  const showAppearance = !hideAppearance;
753
754
  const showBlur = showAppearance && import_react_native13.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
754
755
  const showUpdateCheck = import_react_native13.Platform.OS !== "web" && !hideUpdateCheck;
756
+ const hasLeading = leading !== void 0 && leading !== null && leading !== false;
755
757
  if (!opened) return null;
756
758
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
757
759
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_auto_paper7.Dialog, { visible, onDismiss, style: [styles10.dialog, { width: sheetWidth }], children: [
758
760
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_auto_paper7.Dialog.ScrollArea, { style: styles10.scrollArea, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_auto_paper7.FadingScrollView, { contentContainerStyle: styles10.scrollContent, showsVerticalScrollIndicator: false, children: [
759
761
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
760
762
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.content, children: [
763
+ hasLeading && leading,
761
764
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleGroup, children: [
765
+ hasLeading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Text, { variant: "labelMedium", style: [styles10.sectionLabel, styles10.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
762
766
  showLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles10.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleContent, children: [
763
767
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
764
768
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.flexShrink, children: [
@@ -780,7 +784,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
780
784
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Text, { variant: "bodySmall", numberOfLines: 1, style: { color: colors.onSurfaceVariant }, children: "Stop auto-lock mid-match" })
781
785
  ] })
782
786
  ] }) }),
783
- (showSound || showHaptics) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleRow, children: [
787
+ (showSound || showMusic || showHaptics) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleRow, children: [
784
788
  showSound && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
785
789
  import_feedback_press3.TouchableRipple,
786
790
  {
@@ -798,6 +802,10 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
798
802
  ] })
799
803
  }
800
804
  ),
805
+ showMusic && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => setMusicSettings({ enabled: !musicSettings.enabled }), style: styles10.toggleButtonInRow, accessibilityLabel: `Music ${musicSettings.enabled ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleContent, children: [
806
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SettingIcon, { source: musicSettings.enabled ? "music" : "music-off", color: musicSettings.enabled ? colors.tertiary : colors.onSurfaceVariant, containerColor: musicSettings.enabled ? colors.tertiaryContainer : colors.surfaceVariant }),
807
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Text, { variant: "bodyLarge", style: { color: colors.onSurface }, children: "Music" })
808
+ ] }) }),
801
809
  showHaptics && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
802
810
  import_feedback_press3.TouchableRipple,
803
811
  {
@@ -940,6 +948,10 @@ var styles10 = import_react_native13.StyleSheet.create({
940
948
  toggleGroup: {
941
949
  gap: 4
942
950
  },
951
+ // The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
952
+ toggleGroupLabel: {
953
+ marginBottom: 8
954
+ },
943
955
  // No horizontal margin of its own now either - see toggleButton's identical note.
944
956
  toggleRow: {
945
957
  flexDirection: "row",
package/dist/index.mjs CHANGED
@@ -18,18 +18,7 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "./chunk-75Q2VN5R.mjs";
22
- import {
23
- COMPACT_DIALOG_HEIGHT,
24
- DialogHeader,
25
- OverlayBackdrop,
26
- OverlayCard,
27
- SecondaryButton,
28
- isCompactDialogHeight,
29
- overlayActionStyles,
30
- overlayStyles,
31
- useOverlayCardColors
32
- } from "./chunk-CBH7GQKI.mjs";
21
+ } from "./chunk-VDPL2WUK.mjs";
33
22
  import {
34
23
  PlayerSetupPanel,
35
24
  ReadyButton,
@@ -51,6 +40,17 @@ import {
51
40
  loadSkiaWeb,
52
41
  locateSkiaWebFile
53
42
  } from "./chunk-3TCJHMJP.mjs";
43
+ import {
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";
@@ -0,0 +1,5 @@
1
+ declare function loadSkiaWeb(): Promise<void>;
2
+
3
+ declare function locateSkiaWebFile(file: string): string;
4
+
5
+ export { locateSkiaWebFile as a, loadSkiaWeb as l };
@@ -0,0 +1,5 @@
1
+ declare function loadSkiaWeb(): Promise<void>;
2
+
3
+ declare function locateSkiaWebFile(file: string): string;
4
+
5
+ export { locateSkiaWebFile as a, loadSkiaWeb as l };
@@ -1,5 +1,8 @@
1
- declare function loadSkiaWeb(): Promise<void>;
1
+ export { l as loadSkiaWeb, a as locateSkiaWebFile } from '../locateSkiaWebFile-DAJ0ok2i.mjs';
2
+ import { ComponentType } from 'react';
2
3
 
3
- declare function locateSkiaWebFile(file: string): string;
4
+ declare function lazySkia<P extends object>(load: () => Promise<{
5
+ default: ComponentType<P>;
6
+ }>): ComponentType<P>;
4
7
 
5
- export { loadSkiaWeb, locateSkiaWebFile };
8
+ export { lazySkia };
@@ -1,5 +1,8 @@
1
- declare function loadSkiaWeb(): Promise<void>;
1
+ export { l as loadSkiaWeb, a as locateSkiaWebFile } from '../locateSkiaWebFile-DAJ0ok2i.js';
2
+ import { ComponentType } from 'react';
2
3
 
3
- declare function locateSkiaWebFile(file: string): string;
4
+ declare function lazySkia<P extends object>(load: () => Promise<{
5
+ default: ComponentType<P>;
6
+ }>): ComponentType<P>;
4
7
 
5
- export { loadSkiaWeb, locateSkiaWebFile };
8
+ export { lazySkia };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/skia/index.ts
21
21
  var skia_exports = {};
22
22
  __export(skia_exports, {
23
+ lazySkia: () => lazySkia,
23
24
  loadSkiaWeb: () => loadSkiaWeb,
24
25
  locateSkiaWebFile: () => locateSkiaWebFile
25
26
  });
@@ -34,8 +35,19 @@ function loadSkiaWeb() {
34
35
  function locateSkiaWebFile(file) {
35
36
  return `${process.env.EXPO_BASE_URL ?? ""}/${file}`;
36
37
  }
38
+
39
+ // src/skia/lazySkia.tsx
40
+ var import_react = require("react");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ function lazySkia(load) {
43
+ const LazySkiaComponent = (0, import_react.lazy)(() => loadSkiaWeb().then(load));
44
+ return function SkiaHost(props) {
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LazySkiaComponent, { ...props }) });
46
+ };
47
+ }
37
48
  // Annotate the CommonJS export names for ESM import in node:
38
49
  0 && (module.exports = {
50
+ lazySkia,
39
51
  loadSkiaWeb,
40
52
  locateSkiaWebFile
41
53
  });
@@ -2,7 +2,18 @@ import {
2
2
  loadSkiaWeb,
3
3
  locateSkiaWebFile
4
4
  } from "../chunk-3TCJHMJP.mjs";
5
+
6
+ // src/skia/lazySkia.tsx
7
+ import { lazy, Suspense } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function lazySkia(load) {
10
+ const LazySkiaComponent = lazy(() => loadSkiaWeb().then(load));
11
+ return function SkiaHost(props) {
12
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazySkiaComponent, { ...props }) });
13
+ };
14
+ }
5
15
  export {
16
+ lazySkia,
6
17
  loadSkiaWeb,
7
18
  locateSkiaWebFile
8
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/hud",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
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",
@@ -93,15 +93,15 @@
93
93
  "devDependencies": {
94
94
  "@infinitetoken/eslint-config": "^0.2.1",
95
95
  "@infinitetoken/jest-config": "^0.5.2",
96
- "@infinitetoken/tsconfig": "^0.6.0",
97
- "@rific/auto-paper": "^0.13.4",
96
+ "@infinitetoken/tsconfig": "^0.7.0",
97
+ "@rific/auto-paper": "^0.14.0",
98
98
  "@rific/core": "^0.5.0",
99
- "@rific/feedback-press": "^0.13.1",
100
- "@rific/updater": "^0.7.1",
99
+ "@rific/feedback-press": "^0.14.0",
100
+ "@rific/updater": "^0.8.0",
101
101
  "@shopify/react-native-skia": "^2.14.0",
102
102
  "@tastic/achievements": "^0.6.0",
103
- "@tastic/core": "^0.14.0",
104
- "@tastic/profile": "^0.17.0",
103
+ "@tastic/core": "^0.16.0",
104
+ "@tastic/profile": "^0.18.0",
105
105
  "@tastic/split-screen": "^0.5.5",
106
106
  "@testing-library/dom": "^10.4.1",
107
107
  "@testing-library/react": "^16.3.2",
@@ -123,9 +123,9 @@
123
123
  "typescript": "^6.0.3"
124
124
  },
125
125
  "peerDependencies": {
126
- "@rific/auto-paper": "^0.13.0",
126
+ "@rific/auto-paper": ">=0.13.0",
127
127
  "@rific/core": ">=0.4.0",
128
- "@rific/feedback-press": ">=0.10.2",
128
+ "@rific/feedback-press": ">=0.14.0",
129
129
  "@rific/updater": ">=0.4.0",
130
130
  "@shopify/react-native-skia": ">=2.6.0",
131
131
  "@tastic/achievements": ">=0.2.0",
@@ -1,6 +1,6 @@
1
1
  import { AutoAppearancePicker, Dialog, FadingScrollView, useAutoPaperTheme, useBlurModule, useThemeSettings } from '@rific/auto-paper'
2
2
  import { useExpoKeepAwake, useKeepAwakeSettings } from '@rific/core'
3
- import { Button, SoundContext, TouchableRipple, useHapticSettings, useSoundSettings, useVibration } from '@rific/feedback-press'
3
+ import { Button, SoundContext, TouchableRipple, useHapticSettings, useMusicSettings, useSoundSettings, useVibration } from '@rific/feedback-press'
4
4
  import { useUpdater } from '@rific/updater'
5
5
  import { rotateInsets, useIsTouchPrimaryDevice, useRotation, type ViewRotation } from '@tastic/core'
6
6
  import { ReactNode, useContext, useState } from 'react'
@@ -23,7 +23,7 @@ interface SettingIconProps {
23
23
  // Small colored badge per row (icon tinted on its own MD3 container color) - echoes the
24
24
  // primary/secondary/tertiary triad that's already each consuming app's own identity, so the
25
25
  // settings list picks up that same palette instead of introducing new colors of its own. Every
26
- // on/off row (Lock Orientation, Edge Guard, Sound, Haptics) is tertiary while on, and an app adding
26
+ // on/off row (Lock Orientation, Edge Guard, Sound, Music, Haptics) is tertiary while on, and an app adding
27
27
  // its own toggle rows should match; secondary is for the always-on action row (How to Play).
28
28
  function SettingIcon({ source, color, containerColor }: SettingIconProps) {
29
29
  return (
@@ -67,6 +67,10 @@ export interface BaseSettingsDialogProps {
67
67
  // Haptics is already native-only (see the row's own Platform.OS check) - this hides it even
68
68
  // there, for a game that's deliberately silent on vibration.
69
69
  hideHaptics?: boolean
70
+ // Opt in, unlike the rows above: a Music toggle beside Sound, for a game with music
71
+ // (@rific/feedback-press's useMusic, gated on its own Music setting, apart from Sound). Most
72
+ // games have none, so it's hidden unless asked for.
73
+ showMusic?: boolean
70
74
  hideAppearance?: boolean
71
75
  // Check for Updates is already native-only (a web build has no OTA update concept at all) - this
72
76
  // hides it even there, for a native app that isn't wired up for EAS/OTA updates at all.
@@ -83,6 +87,12 @@ export interface BaseSettingsDialogProps {
83
87
  // rendered between Appearance and Check for Updates - this component only owns the settings
84
88
  // every game shares, never anything about how a particular game plays.
85
89
  children?: ReactNode
90
+ // App-specific sections shown FIRST, above every shared row: a game's own rules, which someone
91
+ // opening Settings from that game is most likely there for (Solitaire, Jay 2026-11-10: rules below
92
+ // Sound, How to Play and Appearance went unfound). When given, the shared rows get a GENERAL
93
+ // label, so every gap between sections is still followed by a label. Omit it (or pass null) where
94
+ // there is nothing to put first: the sheet is then exactly as before.
95
+ leading?: ReactNode
86
96
  }
87
97
 
88
98
  // The settings shell every @tastic game shares - orientation lock, the optional edge-guard and
@@ -92,7 +102,7 @@ export interface BaseSettingsDialogProps {
92
102
  // is the seam for whatever isn't shared: a game with its own board/difficulty settings (or a stats
93
103
  // backup flow, or anything else genuinely specific to it) renders those below Appearance, not by
94
104
  // forking this component.
95
- export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps) {
105
+ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, showMusic = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps) {
96
106
  const { colors } = useAutoPaperTheme()
97
107
  const ambientRotation = useRotation()
98
108
  const rotation = rotationOverride ?? ambientRotation
@@ -116,6 +126,7 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
116
126
  const isTouchPrimary = useIsTouchPrimaryDevice()
117
127
  const { settings: hapticSettings, set: setHapticSettings } = useHapticSettings()
118
128
  const { settings: soundSettings, set: setSoundSettings } = useSoundSettings()
129
+ const { settings: musicSettings, set: setMusicSettings } = useMusicSettings()
119
130
  const { settings: keepAwakeSettings, set: setKeepAwakeSettings } = useKeepAwakeSettings()
120
131
  const expoKeepAwake = useExpoKeepAwake()
121
132
  // Sound/Haptics toggle themselves: the ripple's automatic press feedback fires on onPressIn,
@@ -169,6 +180,7 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
169
180
  // See the Blur row's own comment below for why it hides on Android and without expo-blur.
170
181
  const showBlur = showAppearance && Platform.OS !== 'android' && expoBlur !== undefined && expoBlur !== null
171
182
  const showUpdateCheck = Platform.OS !== 'web' && !hideUpdateCheck
183
+ const hasLeading = leading !== undefined && leading !== null && leading !== false
172
184
 
173
185
  // Laid out in its own turned frame rather than rotated in place. Paper's Portal mounts at the app
174
186
  // root, full screen and portrait-shaped, so a sheet that only rotated its card kept resolving its
@@ -197,11 +209,19 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
197
209
  closes it too. */}
198
210
  <DialogHeader icon='cog' title='Settings' compact={compactHeader} />
199
211
  <View style={styles.content}>
212
+ {hasLeading && leading}
200
213
  {/* Grouped tightly together (styles.toggleGroup's small internal gap, not the 24px gap
201
214
  between sections below) - same bare-row shape for all of them, no segmented control
202
215
  and no section heading (each row's own label already says what it is). Haptics only
203
216
  joins on native - there's nothing for it to control on web. */}
204
217
  <View style={styles.toggleGroup}>
218
+ {/* Unlabeled while it opens the sheet (each row's own label says what it is); labeled
219
+ once an app's leading sections sit above it, like every other section after a gap. */}
220
+ {hasLeading && (
221
+ <Text variant='labelMedium' style={[styles.sectionLabel, styles.toggleGroupLabel, { color: colors.onSurfaceVariant }]}>
222
+ GENERAL
223
+ </Text>
224
+ )}
205
225
  {/* Omitted entirely for a portrait-only game (no lockOrientation/onLockOrientationChange
206
226
  passed at all - nothing to lock), and hidden (not just disabled) on a desktop/laptop
207
227
  browser even when they are - see isTouchPrimary's own doc above. Still shown on
@@ -269,7 +289,7 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
269
289
  inside it use toggleButtonInRow (flex: 1) instead so the two don't double up on it.
270
290
  The row itself only renders when at least one of the two will - an empty flex row
271
291
  still eats its own gap/margin otherwise. */}
272
- {(showSound || showHaptics) && (
292
+ {(showSound || showMusic || showHaptics) && (
273
293
  <View style={styles.toggleRow}>
274
294
  {showSound && (
275
295
  <TouchableRipple
@@ -291,6 +311,20 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
291
311
  </TouchableRipple>
292
312
  )}
293
313
 
314
+ {/* Music has its own setting, apart from Sound (feedback-press's useMusic plays only
315
+ while it's on). No sound of its own when switched on: the music fading in is
316
+ the confirmation. */}
317
+ {showMusic && (
318
+ <TouchableRipple onPress={() => setMusicSettings({ enabled: !musicSettings.enabled })} style={styles.toggleButtonInRow} accessibilityLabel={`Music ${musicSettings.enabled ? 'on' : 'off'}`}>
319
+ <View style={styles.toggleContent}>
320
+ <SettingIcon source={musicSettings.enabled ? 'music' : 'music-off'} color={musicSettings.enabled ? colors.tertiary : colors.onSurfaceVariant} containerColor={musicSettings.enabled ? colors.tertiaryContainer : colors.surfaceVariant} />
321
+ <Text variant='bodyLarge' style={{ color: colors.onSurface }}>
322
+ Music
323
+ </Text>
324
+ </View>
325
+ </TouchableRipple>
326
+ )}
327
+
294
328
  {/* Already native-only (see showHaptics's own definition) - hideHaptics can hide
295
329
  it there too, for a game that's deliberately silent on vibration. */}
296
330
  {showHaptics && (
@@ -489,6 +523,10 @@ const styles = StyleSheet.create({
489
523
  toggleGroup: {
490
524
  gap: 4
491
525
  },
526
+ // The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
527
+ toggleGroupLabel: {
528
+ marginBottom: 8
529
+ },
492
530
  // No horizontal margin of its own now either - see toggleButton's identical note.
493
531
  toggleRow: {
494
532
  flexDirection: 'row',
package/src/skia/index.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  // The Skia entry point (`@tastic/hud/skia`): the web CanvasKit loader every app's Skia host files use,
2
- // and the wasm URL rule it applies, reachable without the main barrel. Several Skia apps lack the
2
+ // the wasm URL rule it applies, and lazySkia (a web host's lazy, Suspense-wrapped component behind that
3
+ // loader), reachable without the main barrel. Several Skia apps lack the
3
4
  // barrel's heavier peers (@tastic/profile, @tastic/split-screen), and importing `@tastic/hud` there
4
5
  // fails to bundle, so this is the one import path every app's host files share.
5
6
  //
6
7
  // package.json points both "react-native" and "browser" at this file. That is fine because it has no
7
8
  // .web twin itself: Metro doesn't platform-resolve an exports-map target, but it does resolve the
8
9
  // relative imports below, so web bundles get loadSkiaWeb.web.ts and native ones the no-op. The
9
- // boundary (only @shopify/react-native-skia's /src/web subpath, and only from the .web file) is
10
+ // boundary (react, and @shopify/react-native-skia's /src/web subpath only from the .web file) is
10
11
  // enforced by src/__tests__/skiaImports.test.ts.
11
12
  export { loadSkiaWeb } from '../loadSkiaWeb'
12
13
  export { locateSkiaWebFile } from '../locateSkiaWebFile'
14
+ export { lazySkia } from './lazySkia'
@@ -0,0 +1,27 @@
1
+ import { type ComponentType, lazy, Suspense } from 'react'
2
+
3
+ import { loadSkiaWeb } from '../loadSkiaWeb'
4
+
5
+ // A Skia component for the web (an app's BoardHost.web.tsx, the web half of the host pair: see the
6
+ // README's "Skia on web"). Skia's web target renders through CanvasKit, a WASM build of Skia, and a
7
+ // component's own `Skia` import binds to `global.CanvasKit` once, synchronously, at module-evaluation
8
+ // time (see @shopify/react-native-skia's Skia.web.ts: `export const Skia = JsiSkApi(global.CanvasKit)`)
9
+ // - not lazily, and not reactively. A plain import of the component would evaluate that binding against
10
+ // a not-yet-loaded, undefined CanvasKit before anything renders, since Metro evaluates the whole static
11
+ // import graph up front. A dynamic import is the one thing that defers module evaluation to runtime, so
12
+ // the component's module (and Skia with it) is only imported once loadSkiaWeb() has resolved and set
13
+ // global.CanvasKit for real. On native there's nothing to defer (JSI is ready before any JS runs), so an
14
+ // app's BoardHost.tsx just re-exports its component, which then draws on the first frame.
15
+ //
16
+ // Call it once, at module scope (`export default lazySkia(...)`), so the lazy component is created once:
17
+ // called during a render it would be a new component type every time, remounting the Skia component.
18
+ export function lazySkia<P extends object>(load: () => Promise<{ default: ComponentType<P> }>): ComponentType<P> {
19
+ const LazySkiaComponent = lazy(() => loadSkiaWeb().then(load))
20
+ return function SkiaHost(props: P) {
21
+ return (
22
+ <Suspense fallback={null}>
23
+ <LazySkiaComponent {...props} />
24
+ </Suspense>
25
+ )
26
+ }
27
+ }