@seriousgaming/sdk-tools 1.4.0 → 1.5.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.
Files changed (157) hide show
  1. package/dist/cli.js +830 -99
  2. package/dist/client.js +114 -11
  3. package/dist/dev/console/assets/{index-BvB-LFQZ.js → index-BVF8exas.js} +21 -21
  4. package/dist/dev/console/index.html +1 -1
  5. package/dist/dev/public-origins.d.ts +61 -0
  6. package/dist/dev/shell.d.ts +32 -4
  7. package/dist/docs/ai-agents.md +5 -0
  8. package/dist/docs/changelog-0.x.md +2 -2
  9. package/dist/docs/changelog.md +37 -4
  10. package/dist/docs/cli-and-dev-server.md +58 -0
  11. package/dist/docs/cli-error-codes.md +39 -36
  12. package/dist/docs/cli-reference.md +68 -21
  13. package/dist/docs/environment-variables.md +10 -5
  14. package/dist/docs/guides/ai-facilitation.md +2 -0
  15. package/dist/docs/guides/capabilities.md +2 -0
  16. package/dist/docs/guides/designing-a-game.md +2 -0
  17. package/dist/docs/guides/designing-screens.md +133 -0
  18. package/dist/docs/guides/endpoints.md +2 -0
  19. package/dist/docs/guides/engine-testing.md +5 -1
  20. package/dist/docs/guides/engine.md +2 -0
  21. package/dist/docs/guides/file-handling.md +3 -1
  22. package/dist/docs/guides/games.md +3 -1
  23. package/dist/docs/guides/global-settings.md +2 -0
  24. package/dist/docs/guides/guide.md +2 -0
  25. package/dist/docs/guides/hooks.md +2 -0
  26. package/dist/docs/guides/index.md +9 -0
  27. package/dist/docs/guides/internationalization.md +2 -0
  28. package/dist/docs/guides/llm-integration.md +4 -2
  29. package/dist/docs/guides/multi-team-games.md +3 -1
  30. package/dist/docs/guides/patterns.md +2 -0
  31. package/dist/docs/guides/presentation.md +1 -1
  32. package/dist/docs/guides/production-constraints.md +2 -0
  33. package/dist/docs/guides/scenario-editor.md +2 -0
  34. package/dist/docs/guides/scenarios.md +6 -2
  35. package/dist/docs/guides/session-game-flow.md +365 -0
  36. package/dist/docs/guides/session-hooks.md +205 -0
  37. package/dist/docs/guides/session.md +27 -565
  38. package/dist/docs/guides/settings.md +2 -0
  39. package/dist/docs/guides/setup.md +3 -1
  40. package/dist/docs/guides/speech-generation.md +2 -0
  41. package/dist/docs/guides/starter-game.md +61 -21
  42. package/dist/docs/guides/testing.md +2 -0
  43. package/dist/docs/guides/tick-controller.md +3 -1
  44. package/dist/docs/guides/type-safety.md +2 -0
  45. package/dist/docs/guides/ui-files-and-llms.md +328 -0
  46. package/dist/docs/guides/ui-participants.md +281 -0
  47. package/dist/docs/guides/ui-styling.md +263 -0
  48. package/dist/docs/guides/ui-ticks.md +247 -0
  49. package/dist/docs/guides/ui.md +11 -1092
  50. package/dist/docs/guides/upgrading.md +2 -0
  51. package/dist/docs/guides/validators.md +2 -0
  52. package/dist/docs/guides/waiting-room.md +1 -1
  53. package/dist/docs/index.md +2 -1
  54. package/dist/docs/page-index.md +145 -0
  55. package/dist/docs/recipes/adapt-a-game-for-walkthroughs.md +1 -1
  56. package/dist/docs/recipes/adapt-ui-for-observers.md +1 -1
  57. package/dist/docs/recipes/create-presentation.md +11 -0
  58. package/dist/docs/recipes/create-scenario-editor.md +1 -0
  59. package/dist/docs/recipes/create-session-ui.md +2 -1
  60. package/dist/docs/recipes/create-setup.md +1 -0
  61. package/dist/docs/recipes/create-user-interface.md +1 -0
  62. package/dist/docs/recipes/create-waiting-room-ui.md +1 -0
  63. package/dist/docs/recipes/design-state-for-concurrent-writes.md +1 -1
  64. package/dist/docs/recipes/fix-duplicate-packages.md +2 -2
  65. package/dist/docs/recipes/index.md +3 -0
  66. package/dist/docs/recipes/screenshot-a-surface.md +80 -0
  67. package/dist/docs/recipes/test-a-multi-role-game.md +1 -1
  68. package/dist/docs/recipes/use-request-tick.md +2 -2
  69. package/dist/execution/config-resolver.d.ts +4 -1
  70. package/dist/runtime/manifest-version.d.ts +1 -1
  71. package/dist/runtime.js +1 -1
  72. package/dist/templates/package/CLAUDE.md.template +14 -5
  73. package/dist/templates/package/DESIGN.md.liquid +39 -7
  74. package/dist/templates/package/README.md.liquid +1 -1
  75. package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
  76. package/dist/templates/package/pnpm-workspace.yaml.template +13 -0
  77. package/dist/templates/starter-game/capabilities/pacing/capability.sdk.json +18 -0
  78. package/dist/templates/starter-game/package.json +2 -0
  79. package/dist/templates/starter-game/presentation/defaults.ts +52 -0
  80. package/dist/templates/starter-game/presentation/index.html +20 -0
  81. package/dist/templates/starter-game/presentation/presentation.sdk.json +10 -0
  82. package/dist/templates/starter-game/presentation/src/App.tsx +55 -0
  83. package/dist/templates/starter-game/presentation/src/Band.tsx +40 -0
  84. package/dist/templates/starter-game/presentation/src/Slides.tsx +415 -0
  85. package/dist/templates/starter-game/presentation/src/WeatherIcon.tsx +21 -0
  86. package/dist/templates/starter-game/presentation/src/i18n.ts +88 -0
  87. package/dist/templates/starter-game/presentation/src/main.tsx +15 -0
  88. package/dist/templates/starter-game/presentation/src/stalls.test.ts +196 -0
  89. package/dist/templates/starter-game/presentation/src/stalls.ts +199 -0
  90. package/dist/templates/starter-game/presentation/types.ts +94 -0
  91. package/dist/templates/starter-game/seriousgaming.sdk.json +2 -1
  92. package/dist/templates/starter-game/session/defaults.ts +6 -0
  93. package/dist/templates/starter-game/session/index.html +1 -1
  94. package/dist/templates/starter-game/session/session.sdk.json +2 -2
  95. package/dist/templates/starter-game/session/src/App.test.tsx +436 -115
  96. package/dist/templates/starter-game/session/src/App.tsx +372 -222
  97. package/dist/templates/starter-game/session/src/JoinCodes.tsx +184 -0
  98. package/dist/templates/starter-game/session/src/ManagePanel.tsx +188 -0
  99. package/dist/templates/starter-game/session/src/Results.tsx +340 -0
  100. package/dist/templates/starter-game/session/src/SessionBar.tsx +179 -0
  101. package/dist/templates/starter-game/session/src/SessionPanels.tsx +105 -0
  102. package/dist/templates/starter-game/session/src/SidePanel.tsx +89 -0
  103. package/dist/templates/starter-game/session/src/StallCard.tsx +253 -0
  104. package/dist/templates/starter-game/session/src/TopBar.tsx +36 -0
  105. package/dist/templates/starter-game/session/src/i18n.ts +91 -24
  106. package/dist/templates/starter-game/session/src/status.ts +28 -0
  107. package/dist/templates/starter-game/session/types.ts +8 -2
  108. package/dist/templates/starter-game/shared/Awning.tsx +31 -0
  109. package/dist/templates/starter-game/shared/HostLogo.test.tsx +38 -0
  110. package/dist/templates/starter-game/shared/HostLogo.tsx +48 -0
  111. package/dist/templates/starter-game/shared/StallIcons.tsx +83 -0
  112. package/dist/templates/starter-game/shared/days.ts +11 -0
  113. package/dist/templates/starter-game/shared/format.test.ts +13 -0
  114. package/dist/templates/starter-game/{ui/src → shared}/format.ts +1 -1
  115. package/dist/templates/starter-game/testing/e2e/game.spec.ts +42 -8
  116. package/dist/templates/starter-game/ui/defaults.ts +3 -0
  117. package/dist/templates/starter-game/ui/src/App.test.tsx +197 -29
  118. package/dist/templates/starter-game/ui/src/App.tsx +176 -99
  119. package/dist/templates/starter-game/ui/src/DayBar.test.tsx +50 -7
  120. package/dist/templates/starter-game/ui/src/DayBar.tsx +96 -38
  121. package/dist/templates/starter-game/ui/src/DaysTable.tsx +69 -0
  122. package/dist/templates/starter-game/ui/src/FirstDay.tsx +37 -0
  123. package/dist/templates/starter-game/ui/src/Header.tsx +257 -0
  124. package/dist/templates/starter-game/ui/src/Lesson.tsx +63 -0
  125. package/dist/templates/starter-game/ui/src/MakeRow.tsx +98 -71
  126. package/dist/templates/starter-game/ui/src/Notices.tsx +59 -0
  127. package/dist/templates/starter-game/ui/src/PastDay.tsx +88 -0
  128. package/dist/templates/starter-game/ui/src/Section.tsx +26 -26
  129. package/dist/templates/starter-game/ui/src/ThemeToggle.tsx +25 -11
  130. package/dist/templates/starter-game/ui/src/TodayPanel.test.tsx +37 -33
  131. package/dist/templates/starter-game/ui/src/TodayPanel.tsx +66 -52
  132. package/dist/templates/starter-game/ui/src/WeatherCard.tsx +47 -0
  133. package/dist/templates/starter-game/ui/src/WeekOver.tsx +145 -0
  134. package/dist/templates/starter-game/ui/src/YesterdayPanel.tsx +65 -114
  135. package/dist/templates/starter-game/ui/src/days.ts +58 -0
  136. package/dist/templates/starter-game/ui/src/i18n.ts +86 -32
  137. package/dist/templates/starter-game/ui/src/test-helpers.ts +1 -0
  138. package/dist/templates/starter-game/ui/src/theme.ts +8 -8
  139. package/dist/templates/starter-game/ui/types.ts +6 -0
  140. package/dist/templates/starter-game/ui/ui.sdk.json +1 -1
  141. package/dist/templates/starter-game/validators/daylimit/defaults.ts +13 -0
  142. package/dist/templates/starter-game/validators/daylimit/logic/logic.test.ts +20 -0
  143. package/dist/templates/starter-game/validators/daylimit/logic/logic.ts +23 -0
  144. package/dist/templates/starter-game/validators/daylimit/types.ts +23 -0
  145. package/dist/templates/starter-game/validators/daylimit/validator.sdk.json +10 -0
  146. package/dist/templates/starter-game/waiting_room/src/App.test.tsx +83 -5
  147. package/dist/templates/starter-game/waiting_room/src/App.tsx +262 -119
  148. package/dist/templates/starter-game/waiting_room/src/i18n.ts +8 -4
  149. package/dist/utils/error-codes.d.ts +12 -0
  150. package/package.json +11 -4
  151. package/dist/templates/starter-game/session/src/Section.tsx +0 -37
  152. package/dist/templates/starter-game/session/src/TeamDoor.tsx +0 -96
  153. package/dist/templates/starter-game/session/src/format.ts +0 -8
  154. package/dist/templates/starter-game/ui/src/HistoryPanel.test.tsx +0 -74
  155. package/dist/templates/starter-game/ui/src/HistoryPanel.tsx +0 -120
  156. package/dist/templates/starter-game/ui/src/HostLogo.test.tsx +0 -25
  157. package/dist/templates/starter-game/ui/src/HostLogo.tsx +0 -38
@@ -100,17 +100,49 @@ What the model simplifies, and what it deliberately leaves out.
100
100
 
101
101
  ## User interfaces
102
102
 
103
- **`ui/`**: the participant surface. A game holds one, so several views are components inside it rather than separate resources.
103
+ Write each screen's brief here before you build it, then check the built screen against it. `pnpm run --silent sdk docs view guides/designing-screens.md` explains each prompt, and what to check afterwards.
104
104
 
105
- - **Reads / writes:** the capabilities it renders and the ones players change through it
106
- - **Views:** the tabs or panels, and what each is for
107
- - **How a player submits:** what they change, and what tells them a write did not land
105
+ ### Who plays, and on what
108
106
 
109
- **`session/`**: the facilitator surface. What the facilitator watches, and what they can change mid-session.
107
+ Who uses each screen, where they are, and the device in their hand.
110
108
 
111
- **`waiting_room/`**: what players see before the session opens, if the game has one.
109
+ **Example:** 'Participants on their own phones, standing in teams of three; the facilitator on a laptop that is also on the projector.'
112
110
 
113
- **`setup/`** and **`scenario_editor/`**: the form a facilitator fills in at session creation, and the screen for authoring lasting scenarios, if the game has them, and which settings resources each `configures`.
111
+ ### Tone
112
+
113
+ How the game should feel to play.
114
+
115
+ **Example:** 'Quick and light. A market stall, not a spreadsheet.'
116
+
117
+ ### Key screens
118
+
119
+ Each screen, the one main action on it, and what the person needs to see to take it. A game holds one participant surface, so several views are components inside `ui/` rather than separate resources. For `setup/` and `scenario_editor/`, if the game has them, also name the settings resources each `configures`.
120
+
121
+ **Example:**
122
+
123
+ - **`ui/`, today:** set how many of each item to make. Needs the forecast and what is left of capacity
124
+ - **`ui/`, history:** compare past days. No action; the profit for each day comes first
125
+ - **`session/`:** spot the stall that has stopped changing its numbers, and step in
126
+ - **`waiting_room/`:** name the team while everyone arrives
127
+ - **`presentation/`:** the briefing, a slide a round, and the results for the debrief
128
+
129
+ ### Layout
130
+
131
+ The pattern each screen follows, and how it changes between a phone and a laptop.
132
+
133
+ **Example:** 'One column on a phone, with the decision first and the open button pinned to the bottom. Two columns from tablet width, with today beside yesterday.'
134
+
135
+ ### States
136
+
137
+ What each screen shows before play, mid-round, while a round is processed, after the last round, when a write is refused, and to an observer.
138
+
139
+ **Example:** 'Before the first day, the results panel says when results will appear. A refused plan shows the validator's reason under the slider that was moved.'
140
+
141
+ ### Identity
142
+
143
+ What makes this game look like itself on top of the host's theme: the accent layer, iconography and imagery from the game's world, and the words it uses for things.
144
+
145
+ **Example:** 'Rounded, card-like panels; illustrated weather icons; "stall" for team and "open up" for submit.'
114
146
 
115
147
  ---
116
148
 
@@ -73,7 +73,7 @@ pnpm run build
73
73
  ├── session/ # THE session interface: the facilitator's screen
74
74
  ├── waiting_room/ # THE holding screen, shown before and between
75
75
  ├── guide/ # THE facilitator guide, as markdown chapters
76
- ├── presentation/ # THE slide deck the facilitator projects (add with `new presentation`)
76
+ ├── presentation/ # THE slide deck the facilitator projects
77
77
  ├── setup/ # THE form a facilitator fills in at session creation (`new setup`)
78
78
  ├── scenario_editor/ # THE editor for authoring lasting scenarios (`new scenario_editor`)
79
79
  ├── capabilities/ # The shape of the game's state
@@ -15,7 +15,7 @@ A user interface is a React app that reads game state and (optionally) sends dec
15
15
  ```
16
16
  2. **Confirm the capabilities exist.** A UI reads (and optionally writes) capabilities by their short names. Create any that are missing first.
17
17
  3. **Change or create the bundle.** The starter game already has a `ui/`, so change it with `pnpm run sdk update ui --patch '[...]'`; `new ui` refuses while `ui/` exists. In an empty package, `pnpm run sdk new ui '{ ... }'`. Declare every capability the UI shows in `reads`, and add `writes` only for the ones it sends back via `setData`. A UI receives exactly what it declares.
18
- 4. **Implement the components** under `ui/src/` (the entry component is `App.tsx`), with `useUserInterfaceData()` for `data`, `settings`, `setData` and `completedTicks`. Default to MUI; another library must integrate with `useUserInterfaceTheme` so dark mode and colour palettes work, and text on a theme colour uses that colour's `contrastText`. Remember a viewer's own choices with `useViewerStorage`, never `localStorage`. Put every string in `src/i18n.ts`. `pnpm run --silent sdk docs view guides/ui.md` is the reference for every hook.
18
+ 4. **Implement the components** under `ui/src/` (the entry component is `App.tsx`), with `useUserInterfaceData()` for `data`, `settings`, `setData` and `completedTicks`. Default to MUI; another library must integrate with `useUserInterfaceTheme` so dark mode and colour palettes work, and text on a theme colour uses that colour's `contrastText`. Remember a viewer's own choices with `useViewerStorage`, never `localStorage`. Put every string in `src/i18n.ts`. `pnpm run --silent sdk docs view guides/ui.md` is the reference for every hook, with the topic pages it links.
19
19
  5. **Await every write.** `setData` returns a promise that rejects when the host refuses the write. Route writes through `useMutationReporter`, as the starter game's `ui/src/writes.ts` does, so the participant sees the refusal. Never retry a write automatically: on a `conflict` the host has already retried and given up, so offer `failure.retry` behind a 'Try again' button instead.
20
20
  6. **Add a test** beside the component (`App.test.tsx`), rendered with `renderUserInterface()` (or `renderSessionUserInterface<SessionData>()`, `renderSettingsEditor()`) from `@seriousgaming/sdk/ui/testing`, as the starter game's tests do. `pnpm run --silent sdk docs view guides/testing.md` has the harness.
21
21
  7. **Verify**: `pnpm run build` and `pnpm test:run`. A running dev server hot-reloads the UI. The user starts the dev server (`pnpm run sdk dev`) when they want to see it; never start it yourself.
@@ -1,3 +1,16 @@
1
+ # Refuse any version published less than seven days ago, so a compromised
2
+ # release is not pulled in before anyone has had time to catch it. pnpm's own
3
+ # default is one day. Given a range, pnpm picks the newest release in it that is
4
+ # old enough, so this steps a dependency down rather than failing your install.
5
+ #
6
+ # The SDK's own packages are exempt. You chose them by running `new package`,
7
+ # and a game scaffolded on the day of an SDK release would otherwise refuse the
8
+ # very version that scaffolded it. Everything they depend on is still held to
9
+ # the seven days.
10
+ minimumReleaseAge: 10080
11
+ minimumReleaseAgeExclude:
12
+ - '@seriousgaming/*'
13
+
1
14
  # A transitive dependency of the SDK packages whose parent pins it to a range
2
15
  # that only reaches a version with a security advisory against it. Your package
3
16
  # does not depend on it directly, and nothing you change in package.json moves
@@ -0,0 +1,18 @@
1
+ {
2
+ "definition": {
3
+ "scope": "shared",
4
+ "variablesSchema": {
5
+ "type": "object",
6
+ "properties": {
7
+ "LastOpenDay": {
8
+ "type": "integer",
9
+ "description": "The last day a stall may open. The facilitator lowers it to hold the room at a day, and raises it to let them on; the default opens all ten",
10
+ "default": 10,
11
+ "minimum": 0
12
+ }
13
+ },
14
+ "required": ["LastOpenDay"],
15
+ "additionalProperties": false
16
+ }
17
+ }
18
+ }
@@ -32,8 +32,10 @@
32
32
  "@emotion/styled": "^11.14.1",
33
33
  "@fontsource-variable/roboto-mono": "^5.3.0",
34
34
  "@fontsource-variable/work-sans": "^5.3.0",
35
+ "@mui/icons-material": "^9.4.0",
35
36
  "@mui/material": "^9.4.0",
36
37
  "@mui/stylis-plugin-rtl": "^9.4.0",
38
+ "@seriousgaming/deck": "workspace:*",
37
39
  "i18next": "^26.4.2",
38
40
  "react": "^19.3.0",
39
41
  "react-dom": "^19.3.0",
@@ -0,0 +1,52 @@
1
+ // This file is auto-generated from the schemas the resource declares: the values
2
+ // a session starts with, for use as test fixtures.
3
+ // Do not edit this file directly. It will be regenerated on build.
4
+
5
+ import type { Context, TeamContext, SharedContext, Settings } from './types';
6
+
7
+ export const defaultContext: Context = {
8
+ plan: {
9
+ Make: {},
10
+ },
11
+ weather: {
12
+ Today: 'sunny',
13
+ Expected: {},
14
+ },
15
+ results: {
16
+ Day: 0,
17
+ Weather: 'sunny',
18
+ Lines: {},
19
+ Takings: 0,
20
+ Spent: 0,
21
+ Profit: 0,
22
+ Purse: 0,
23
+ },
24
+ };
25
+
26
+ export const defaultTeamContext: TeamContext = {
27
+ plan: {
28
+ Make: {},
29
+ },
30
+ weather: {
31
+ Today: 'sunny',
32
+ Expected: {},
33
+ },
34
+ results: {
35
+ Day: 0,
36
+ Weather: 'sunny',
37
+ Lines: {},
38
+ Takings: 0,
39
+ Spent: 0,
40
+ Profit: 0,
41
+ Purse: 0,
42
+ },
43
+ };
44
+
45
+ export const defaultSharedContext: SharedContext = {};
46
+
47
+ export const defaultSettings: Settings = {
48
+ session: {
49
+ ShowJoinLinks: true,
50
+ CurrencySymbol: '£',
51
+ },
52
+ };
@@ -0,0 +1,20 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Lemonade Stand</title>
7
+ <style>
8
+ html,
9
+ body,
10
+ #root {
11
+ height: 100%;
12
+ margin: 0;
13
+ }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <div id="root"></div>
18
+ <script type="module" src="./src/main.tsx"></script>
19
+ </body>
20
+ </html>
@@ -0,0 +1,10 @@
1
+ {
2
+ "definition": {
3
+ "reads": ["plan", "weather", "results"],
4
+ "settings": ["session"]
5
+ },
6
+ "ui": {
7
+ "entrypoint": "index.html"
8
+ },
9
+ "rootDirectory": "."
10
+ }
@@ -0,0 +1,55 @@
1
+ import { brandFromTheme, Deck } from '@seriousgaming/deck';
2
+ import { usePresentation } from '@seriousgaming/sdk/ui';
3
+ import { useEffect, useMemo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import type { Settings, SharedContext, TeamContext } from '../types';
7
+ import { useSlides } from './Slides';
8
+
9
+ /*
10
+ A presentation is the facilitator's slide deck. It is read-only, and it renders
11
+ with or without a session: in a game's library, while rehearsing or to export
12
+ it beforehand, `session` is null, so every slide must make sense without
13
+ results.
14
+
15
+ The host's theme becomes the deck's brand here, so the slides pick up the same
16
+ colours as every other surface.
17
+ */
18
+
19
+ /** Where to open when nothing is remembered: wherever the room has got to. */
20
+ function startFor(rounds: number, played: number | null): string {
21
+ if (!played) return 'title';
22
+ return played >= rounds ? 'results' : `day-${played + 1}`;
23
+ }
24
+
25
+ export default function App() {
26
+ const { game, session, theme, locale } = usePresentation<
27
+ Settings,
28
+ TeamContext,
29
+ SharedContext
30
+ >();
31
+ const { i18n } = useTranslation();
32
+ const language = locale.locale;
33
+
34
+ useEffect(() => {
35
+ void i18n.changeLanguage(language);
36
+ }, [i18n, language]);
37
+
38
+ const brand = useMemo(() => brandFromTheme(theme), [theme]);
39
+ const slides = useSlides();
40
+
41
+ return (
42
+ <Deck
43
+ brand={brand}
44
+ title={game.name}
45
+ dir={i18n.dir(language)}
46
+ lang={language}
47
+ // Come back to the same slide after a reload or a break. Each session
48
+ // keeps its own place; rehearsing without one has one of its own.
49
+ rememberAs={session ? `session:${session.id}` : 'com.example.lemonade'}
50
+ startAt={startFor(game.maxTicks ?? 10, session?.completedTicks ?? null)}
51
+ >
52
+ {slides}
53
+ </Deck>
54
+ );
55
+ }
@@ -0,0 +1,40 @@
1
+ import { useId } from 'react';
2
+
3
+ const BAND = 60;
4
+ const DEPTH = 30;
5
+ const SCALLOP = 96;
6
+
7
+ /**
8
+ * The awning across the top of every slide: a band of the host's primary
9
+ * colour with the game's scalloped edge under it, the same motif as
10
+ * `shared/Awning.tsx` on the player screens.
11
+ *
12
+ * It is drawn again here rather than imported because a deck has no MUI
13
+ * theme to read the colour from: the deck's own brand reaches every slide as
14
+ * `--deck-primary`, so the shape fills with that.
15
+ */
16
+ export function Band() {
17
+ const id = useId();
18
+
19
+ return (
20
+ <div aria-hidden style={{ lineHeight: 0 }}>
21
+ <div style={{ height: BAND, background: 'var(--deck-primary)' }} />
22
+ <svg
23
+ width="100%"
24
+ height={DEPTH}
25
+ preserveAspectRatio="none"
26
+ style={{ display: 'block', marginTop: -1 }}
27
+ >
28
+ <defs>
29
+ <pattern id={id} width={SCALLOP} height={DEPTH} patternUnits="userSpaceOnUse">
30
+ <path
31
+ d={`M0 0 H${SCALLOP} V2 Q${SCALLOP / 2} ${DEPTH} 0 2 Z`}
32
+ style={{ fill: 'var(--deck-primary)' }}
33
+ />
34
+ </pattern>
35
+ </defs>
36
+ <rect width="100%" height={DEPTH} fill={`url(#${id})`} />
37
+ </svg>
38
+ </div>
39
+ );
40
+ }