@serene-pub/core-catalog 0.6.0-pr-7 → 0.6.0-pr-9

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 (276) hide show
  1. package/README.md +1 -1
  2. package/components/genres/story/authors-note/AuthorsNote.svelte +2 -1
  3. package/components/genres/story/authors-note/AuthorsNoteWidget.svelte +177 -58
  4. package/components/shared/WidgetBoundary.svelte +37 -0
  5. package/components/shared/actions/Actions.svelte +2 -1
  6. package/components/shared/actions/ActionsWidget.svelte +31 -38
  7. package/components/shared/album/Album.svelte +2 -1
  8. package/components/shared/album/AlbumWidget.svelte +1 -7
  9. package/components/shared/annex/Annex.svelte +2 -1
  10. package/components/shared/annex/AnnexWidget.svelte +1 -1
  11. package/components/shared/attendance/Attendance.svelte +2 -1
  12. package/components/shared/attendance/AttendanceWidget.svelte +5 -8
  13. package/components/shared/backdrop/Backdrop.svelte +2 -1
  14. package/components/shared/backdrop/BackdropWidget.svelte +28 -22
  15. package/components/shared/chronicle/Chronicle.svelte +2 -1
  16. package/components/shared/chronicle/ChronicleWidget.svelte +211 -99
  17. package/components/shared/composer/Composer.svelte +25 -0
  18. package/components/shared/composer/ComposerWidget.svelte +146 -0
  19. package/components/shared/composer/composer.ts +10 -0
  20. package/components/shared/composer/settings.ts +59 -0
  21. package/components/shared/composer/target.ts +79 -0
  22. package/components/shared/dialogue-box/DialogueBoxMount.svelte +25 -0
  23. package/components/shared/dialogue-box/DialogueBoxWidget.svelte +207 -0
  24. package/components/shared/dialogue-box/dialogue-box.ts +10 -0
  25. package/components/shared/dialogue-box/settings.ts +25 -0
  26. package/components/shared/lore-entries/LoreEntries.svelte +2 -1
  27. package/components/shared/lore-entries/LoreEntriesWidget.svelte +44 -41
  28. package/components/shared/messages/MessageBlocksView.svelte +1 -1
  29. package/components/shared/messages/MessageControls.svelte +23 -5
  30. package/components/shared/messages/Messages.svelte +2 -1
  31. package/components/shared/messages/MessagesWidget.svelte +82 -191
  32. package/components/shared/messages/NextCharacterBlock.svelte +35 -20
  33. package/components/shared/messages/SceneDivider.svelte +40 -14
  34. package/components/shared/messages/SessionComposer.svelte +178 -123
  35. package/components/shared/messages/SessionContainer.svelte +89 -38
  36. package/components/shared/messages/SessionMessage.svelte +157 -54
  37. package/components/shared/messages/SpokenLine.svelte +57 -16
  38. package/components/shared/messages/StateProposalList.svelte +30 -20
  39. package/components/shared/messages/TurnLine.svelte +258 -66
  40. package/components/shared/messages/conversation.svelte.ts +83 -5
  41. package/components/shared/messages/readingPace.ts +101 -0
  42. package/components/shared/messages/rowFacts.ts +44 -0
  43. package/components/shared/messages/sceneMarks.ts +54 -0
  44. package/components/shared/messages/spokenLine.ts +63 -14
  45. package/components/shared/places/Places.svelte +2 -1
  46. package/components/shared/places/PlacesWidget.svelte +42 -33
  47. package/components/shared/routine-log/RoutineLog.svelte +2 -1
  48. package/components/shared/routine-log/RoutineLogWidget.svelte +0 -4
  49. package/components/shared/routine-log/routineLog.ts +5 -21
  50. package/components/shared/scene-portraits/ScenePortraits.svelte +2 -1
  51. package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +54 -32
  52. package/components/shared/session-runs/SessionRuns.svelte +26 -0
  53. package/components/shared/session-runs/SessionRunsWidget.svelte +270 -0
  54. package/components/shared/session-runs/session-runs.ts +11 -0
  55. package/components/shared/state/PieceCard.svelte +36 -25
  56. package/components/shared/state/SlotControl.svelte +18 -5
  57. package/components/shared/stats/Stats.svelte +2 -1
  58. package/components/shared/stats/StatsWidget.svelte +104 -72
  59. package/components/shared/turn-line/TurnLineMount.svelte +25 -0
  60. package/components/shared/turn-line/TurnLineWidget.svelte +25 -0
  61. package/components/shared/turn-line/settings.ts +31 -0
  62. package/components/shared/turn-line/turn-line.ts +10 -0
  63. package/components/shared/turn-order/TurnOrder.svelte +2 -1
  64. package/components/shared/turn-order/TurnOrderWidget.svelte +1 -6
  65. package/dist/components/actions.js +71 -88
  66. package/dist/components/actions.source.json +1 -1
  67. package/dist/components/album.js +39 -44
  68. package/dist/components/album.source.json +1 -1
  69. package/dist/components/annex.js +17 -8
  70. package/dist/components/annex.source.json +1 -1
  71. package/dist/components/attendance.js +39 -48
  72. package/dist/components/attendance.source.json +1 -1
  73. package/dist/components/authors-note.js +329 -162
  74. package/dist/components/authors-note.source.json +1 -1
  75. package/dist/components/backdrop.js +52 -55
  76. package/dist/components/backdrop.source.json +1 -1
  77. package/dist/components/chronicle.js +798 -559
  78. package/dist/components/chronicle.source.json +1 -1
  79. package/dist/components/composer.js +1639 -0
  80. package/dist/components/composer.source.json +1 -0
  81. package/dist/components/core-ui.json +1 -1
  82. package/dist/components/dialogue-box.js +373 -0
  83. package/dist/components/dialogue-box.source.json +1 -0
  84. package/dist/components/lore-entries.js +134 -122
  85. package/dist/components/lore-entries.source.json +1 -1
  86. package/dist/components/messages.js +1517 -8930
  87. package/dist/components/messages.source.json +1 -1
  88. package/dist/components/places.js +267 -244
  89. package/dist/components/places.source.json +1 -1
  90. package/dist/components/routine-log.js +35 -51
  91. package/dist/components/routine-log.source.json +1 -1
  92. package/dist/components/scene-portraits.js +118 -59
  93. package/dist/components/scene-portraits.source.json +1 -1
  94. package/dist/components/session-runs.js +488 -0
  95. package/dist/components/session-runs.source.json +1 -0
  96. package/dist/components/{shared-7VDIXYAL.js → shared-47J4TNSF.js} +1 -1
  97. package/dist/components/{shared-W3XS5FEL.js → shared-5E4RQYRX.js} +3 -2
  98. package/dist/components/{shared-YDS7HYL6.js → shared-EFMMT76D.js} +57 -4
  99. package/dist/components/{shared-BIWKZFUU.js → shared-FOVKPMSK.js} +3 -3
  100. package/dist/components/{shared-JPG5DQO7.js → shared-HEAKNNZB.js} +92 -17
  101. package/dist/components/shared-JXP6SHKF.js +159 -0
  102. package/dist/components/{shared-XBDUENRA.js → shared-JXYPKSTQ.js} +1 -1
  103. package/dist/components/shared-KJIOSSE3.js +257 -0
  104. package/dist/components/{shared-WV3QTKZT.js → shared-KLURQFWI.js} +13 -9
  105. package/dist/components/shared-MHCNUDUT.js +1680 -0
  106. package/dist/components/{shared-QXF5CJVN.js → shared-NICRJ4Z2.js} +1 -1
  107. package/dist/components/{shared-BBF64YGL.js → shared-W2BBJCNE.js} +22 -16
  108. package/dist/components/shared-YYYXFDZU.js +4354 -0
  109. package/dist/components/stats.js +828 -678
  110. package/dist/components/stats.source.json +1 -1
  111. package/dist/components/turn-line.js +856 -0
  112. package/dist/components/turn-line.source.json +1 -0
  113. package/dist/components/turn-order.js +62 -67
  114. package/dist/components/turn-order.source.json +1 -1
  115. package/dist/factories/answerForm.d.ts +6 -0
  116. package/dist/factories/answerForm.js +104 -96
  117. package/dist/factories/turnOrder.d.ts +98 -105
  118. package/dist/factories/turnOrder.js +120 -136
  119. package/dist/functions/pieces.js +1 -0
  120. package/dist/functions/time.js +2 -0
  121. package/dist/genres/chat/create.js +2 -0
  122. package/dist/genres/chat/memory.js +64 -43
  123. package/dist/genres/chat/respond.d.ts +7 -6
  124. package/dist/genres/chat/respond.js +13 -4
  125. package/dist/genres/chat/turnOrder.d.ts +2 -2
  126. package/dist/genres/chat/turnOrder.js +28 -12
  127. package/dist/genres/defaults.d.ts +28 -6
  128. package/dist/genres/defaults.js +84 -26
  129. package/dist/genres/dungeon-crawler/calls.d.ts +3 -1
  130. package/dist/genres/dungeon-crawler/calls.js +5 -0
  131. package/dist/genres/dungeon-crawler/create.d.ts +9 -6
  132. package/dist/genres/dungeon-crawler/create.js +18 -8
  133. package/dist/genres/dungeon-crawler/death.d.ts +13 -6
  134. package/dist/genres/dungeon-crawler/death.js +26 -12
  135. package/dist/genres/dungeon-crawler/index.d.ts +1 -0
  136. package/dist/genres/dungeon-crawler/index.js +1 -0
  137. package/dist/genres/dungeon-crawler/journal.d.ts +1 -1
  138. package/dist/genres/dungeon-crawler/journal.js +1 -1
  139. package/dist/genres/dungeon-crawler/lore.d.ts +13 -12
  140. package/dist/genres/dungeon-crawler/lore.js +16 -25
  141. package/dist/genres/dungeon-crawler/names.d.ts +10 -3
  142. package/dist/genres/dungeon-crawler/names.js +10 -3
  143. package/dist/genres/dungeon-crawler/preamble.d.ts +5 -4
  144. package/dist/genres/dungeon-crawler/preamble.js +75 -33
  145. package/dist/genres/dungeon-crawler/respond.js +4 -2
  146. package/dist/genres/dungeon-crawler/rest.d.ts +8 -7
  147. package/dist/genres/dungeon-crawler/rest.js +39 -15
  148. package/dist/genres/dungeon-crawler/reveal.js +2 -2
  149. package/dist/genres/dungeon-crawler/roundScript.d.ts +2 -1
  150. package/dist/genres/dungeon-crawler/roundScript.js +23 -5
  151. package/dist/genres/dungeon-crawler/scripts.js +4 -5
  152. package/dist/genres/dungeon-crawler/shape.d.ts +16 -0
  153. package/dist/genres/dungeon-crawler/shape.js +5 -1
  154. package/dist/genres/dungeon-crawler/sheet.d.ts +20 -20
  155. package/dist/genres/dungeon-crawler/story.d.ts +27 -16
  156. package/dist/genres/dungeon-crawler/story.js +175 -46
  157. package/dist/genres/dungeon-crawler/storyScripts.d.ts +2 -2
  158. package/dist/genres/dungeon-crawler/storyScripts.js +109 -14
  159. package/dist/genres/dungeon-crawler/summarizeScene.d.ts +13 -0
  160. package/dist/genres/dungeon-crawler/summarizeScene.js +21 -0
  161. package/dist/genres/dungeon-crawler/turnOrder.d.ts +8 -9
  162. package/dist/genres/dungeon-crawler/turnOrder.js +33 -23
  163. package/dist/genres/guide/create.js +2 -0
  164. package/dist/genres/guide/turnOrder.d.ts +3 -3
  165. package/dist/genres/guide/turnOrder.js +29 -13
  166. package/dist/genres/lair/answerForm.js +4 -1
  167. package/dist/genres/lair/buildRoom.js +4 -3
  168. package/dist/genres/lair/castellanAction.js +160 -154
  169. package/dist/genres/lair/create.js +2 -0
  170. package/dist/genres/lair/fileCurrentRoom.js +13 -10
  171. package/dist/genres/lair/fileRoom.js +4 -3
  172. package/dist/genres/lair/keeper.js +6 -2
  173. package/dist/genres/lair/names.d.ts +2 -0
  174. package/dist/genres/lair/names.js +2 -0
  175. package/dist/genres/lair/reply.js +16 -6
  176. package/dist/genres/lair/roomAnswer.js +4 -3
  177. package/dist/genres/lair/scratchpad.js +9 -7
  178. package/dist/genres/lair/scripts.js +8 -6
  179. package/dist/genres/lair/turnOrder.d.ts +3 -2
  180. package/dist/genres/lair/turnOrder.js +45 -16
  181. package/dist/genres/story/ask.d.ts +4 -0
  182. package/dist/genres/story/ask.js +4 -0
  183. package/dist/genres/story/create.js +15 -0
  184. package/dist/genres/story/index.d.ts +1 -1
  185. package/dist/genres/story/index.js +1 -1
  186. package/dist/genres/story/narrate.js +8 -0
  187. package/dist/genres/story/narrateCharacter.js +8 -0
  188. package/dist/genres/story/reckon.d.ts +5 -19
  189. package/dist/genres/story/reckon.js +53 -40
  190. package/dist/genres/story/reckoning.js +3 -0
  191. package/dist/genres/story/respond.js +17 -28
  192. package/dist/genres/story/sweep.d.ts +1 -1
  193. package/dist/genres/story/sweep.js +1 -1
  194. package/dist/genres/story/turnOrder.d.ts +21 -3
  195. package/dist/genres/story/turnOrder.js +87 -21
  196. package/dist/index.d.ts +3 -0
  197. package/dist/index.js +23 -9
  198. package/dist/loadouts.d.ts +1 -0
  199. package/dist/loadouts.js +17 -1
  200. package/dist/primers/ninth-mile.d.ts +3 -4
  201. package/dist/registry/entries.d.ts +2 -0
  202. package/dist/registry/entries.js +18 -5
  203. package/dist/registry/genres.d.ts +146 -40
  204. package/dist/registry/genres.js +373 -101
  205. package/dist/registry/hostState.d.ts +1 -2
  206. package/dist/registry/hostState.js +2 -4
  207. package/dist/registry/layouts.d.ts +141 -111
  208. package/dist/registry/layouts.js +302 -141
  209. package/dist/registry/slots.d.ts +4 -3
  210. package/dist/registry/slots.js +4 -3
  211. package/dist/registry/widgets.d.ts +12 -2
  212. package/dist/registry/widgets.js +259 -106
  213. package/dist/rulesets/vis-itineris/ruleset.js +8 -5
  214. package/dist/rulesets/wherewithal/ruleset.js +2 -1
  215. package/dist/seed/presets.js +15 -9
  216. package/dist/seed/prompts.js +24 -5
  217. package/dist/seed/scripts.js +3 -0
  218. package/dist/shared/annexField.js +23 -3
  219. package/dist/shared/illustrateScene.d.ts +1 -0
  220. package/dist/shared/illustrateScene.js +29 -1
  221. package/dist/shared/lore.d.ts +13 -0
  222. package/dist/shared/lore.js +37 -1
  223. package/dist/shared/portrait.js +13 -4
  224. package/dist/shared/reckoning.d.ts +8 -2
  225. package/dist/shared/reckoning.js +47 -30
  226. package/dist/shared/roundTick.d.ts +20 -0
  227. package/dist/shared/roundTick.js +76 -0
  228. package/dist/shared/sceneBoundaries.d.ts +7 -0
  229. package/dist/shared/sceneBoundaries.js +62 -0
  230. package/dist/shared/sceneSummaries.d.ts +7 -0
  231. package/dist/shared/sceneSummaries.js +49 -0
  232. package/dist/shared/speakMessage.d.ts +9 -2
  233. package/dist/shared/speakMessage.js +32 -9
  234. package/dist/shared/speechFields.js +4 -0
  235. package/dist/shared/summarize/character.d.ts +1 -1
  236. package/dist/shared/summarize/history.d.ts +1 -1
  237. package/dist/shared/summarize/scene.d.ts +1 -1
  238. package/dist/shared/summarize/summarizeScene.js +1 -0
  239. package/dist/shared/summarize/summarizeSpec.d.ts +1 -1
  240. package/dist/shared/summarize/world.d.ts +1 -1
  241. package/dist/shared/ui/attendance/index.d.ts +3 -2
  242. package/dist/shared/ui/attendance/index.js +3 -7
  243. package/dist/shared/ui/chronicle/index.d.ts +24 -2
  244. package/dist/shared/ui/chronicle/index.js +58 -29
  245. package/dist/shared/ui/conversation/formAnswer.d.ts +16 -2
  246. package/dist/shared/ui/conversation/formAnswer.js +23 -9
  247. package/dist/shared/ui/conversation/index.d.ts +2 -0
  248. package/dist/shared/ui/conversation/index.js +4 -0
  249. package/dist/shared/ui/conversation/itemValues.d.ts +16 -3
  250. package/dist/shared/ui/conversation/itemValues.js +15 -5
  251. package/dist/shared/ui/conversation/messageVerbState.d.ts +17 -2
  252. package/dist/shared/ui/conversation/messageVerbState.js +5 -4
  253. package/dist/shared/ui/conversation/readingPlace.d.ts +40 -0
  254. package/dist/shared/ui/conversation/readingPlace.js +119 -0
  255. package/dist/shared/ui/conversation/rewindStrip.d.ts +13 -4
  256. package/dist/shared/ui/conversation/rewindStrip.js +29 -7
  257. package/dist/shared/ui/conversation/runsInProgress.d.ts +30 -0
  258. package/dist/shared/ui/conversation/runsInProgress.js +47 -0
  259. package/dist/shared/ui/conversation/storyDays.d.ts +7 -1
  260. package/dist/shared/ui/conversation/storyDays.js +8 -0
  261. package/dist/shared/ui/conversation/tableChannel.d.ts +8 -11
  262. package/dist/shared/ui/conversation/tableChannel.js +8 -9
  263. package/dist/shared/ui/places/index.d.ts +3 -2
  264. package/dist/shared/ui/places/index.js +4 -5
  265. package/dist/shared/ui/routine-log/index.d.ts +3 -0
  266. package/dist/shared/ui/routine-log/index.js +22 -0
  267. package/dist/shared/ui/scene-portraits/portraits.d.ts +50 -16
  268. package/dist/shared/ui/scene-portraits/portraits.js +84 -21
  269. package/dist/shared/ui/session-runs/index.d.ts +90 -0
  270. package/dist/shared/ui/session-runs/index.js +143 -0
  271. package/dist/shared/ui/session-state/stateView.d.ts +18 -5
  272. package/dist/shared/ui/session-state/stateView.js +29 -8
  273. package/dist/shared/ui/turn-order/index.d.ts +0 -9
  274. package/dist/shared/ui/turn-order/index.js +1 -2
  275. package/package.json +12 -8
  276. /package/dist/components/{shared-4ME6NFDK.js → shared-LUIF6DW7.js} +0 -0
package/README.md CHANGED
@@ -33,7 +33,7 @@ Importing the package registers its declarations, so it lists those modules in
33
33
  | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
34
  | `src/genres/<genre>/` | one genre's pipelines, one spec per file (create, reply, actions, answer form, turn order), and its own widgets (`genres/chat/ui/authors-note/`) |
35
35
  | `src/shared/` | what more than one genre uses: the built-in message verbs, summarize, the annex field, sprites, the story graph build, the tool-loop example, and the shared widgets (`shared/ui/`) |
36
- | `src/factories/` | `answerFormSpec()` and `turnOrderSpec()`, which a plugin genre calls too |
36
+ | `src/factories/` | `answerFormSpec()`, `turnOrderSpec()` and its five builders (`roundRobinTurnOrder` …), which a plugin genre calls too |
37
37
  | `src/registry/` | genres, slots, stat shapes, entry types, widget declarations and layouts |
38
38
  | `src/seed/` | the shipped prompts, presets and the guide mascot |
39
39
  | `components/` | the Svelte sources, mirrored the same way (`components/shared/*`, `components/genres/chat/authors-note`) |
@@ -9,6 +9,7 @@
9
9
  import type { ComponentContext } from "@serene-pub/sdk/component"
10
10
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
11
11
  import AuthorsNoteWidget from "./AuthorsNoteWidget.svelte"
12
+ import WidgetBoundary from "../../../shared/WidgetBoundary.svelte"
12
13
  import { widgetRefFromComponent } from "../../../shared/widgetRef.svelte"
13
14
 
14
15
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -23,4 +24,4 @@
23
24
  )
24
25
  </script>
25
26
 
26
- <AuthorsNoteWidget />
27
+ <WidgetBoundary {ctx}><AuthorsNoteWidget /></WidgetBoundary>
@@ -19,6 +19,20 @@
19
19
  * re-read moves the saved snapshot and keeps what is being typed.
20
20
  * What goes wrong is said here, in this widget (R77) — never a toast.
21
21
  *
22
+ * 🚧 It also holds the session's **Scenario** (lay-B D13, 2026-11-05;
23
+ * owner ruling R5: Left's second tab is "scenario / author's note
24
+ * management"), above the note and shown whether or not the note is
25
+ * offered — a kind of session with no note is then the Scenario alone.
26
+ * `session-scenario` reads it and the viewer's right to change it (the
27
+ * session's owner), `set-session-scenario` saves it whole; it has its own
28
+ * Save / Discard and its own read and save lines, saved and read apart from
29
+ * the note, as the page writes them apart. No event says a scenario changed
30
+ * elsewhere, so it is asked once, on mount, and takes the save's answer.
31
+ *
32
+ * The depth and interval numbers and *Sent as* show only with the viewer's
33
+ * advanced controls on (`viewer.v1.advancedControls`); hidden, the stored
34
+ * values are still what Save sends.
35
+ *
22
36
  * The markup carries no look: its elements carry `authors-note.*` widget
23
37
  * parts and the default widget stylesheet draws them (STYLE-GUIDE §6.16).
24
38
  */
@@ -34,6 +48,8 @@
34
48
  import { useWidgetContext } from "../../../shared/context"
35
49
 
36
50
  const widget = useWidgetContext()
51
+ /** 🚧 2026-11-10: the viewer's advanced controls switch; absent means shown. */
52
+ const advanced = $derived(widget?.current?.viewer?.v1?.advancedControls !== false)
37
53
  const t = (source: string): string => widget?.current?.t(source) ?? source
38
54
 
39
55
  /** What the page last answered. */
@@ -44,9 +60,18 @@
44
60
  let saveError = $state<string | null>(null)
45
61
  let saving = $state(false)
46
62
 
63
+ /** 🚧 The scenario, the same way: what the page last answered, the form's copy, its own lines. */
64
+ let scenarioAnswer = $state<{ scenario: string; canEdit: boolean } | null>(null)
65
+ let scenarioDraft = $state("")
66
+ let scenarioReadError = $state<string | null>(null)
67
+ let scenarioSaveError = $state<string | null>(null)
68
+ let scenarioSaving = $state(false)
69
+
47
70
  const saved = $derived(answer ? readAuthorsNote(answer.note) : AUTHORS_NOTE_DEFAULTS)
48
71
  const dirty = $derived(answer ? authorsNoteDirty(draft, saved) : false)
49
72
  const canEdit = $derived(answer?.canEdit === true)
73
+ const scenarioDirty = $derived(scenarioAnswer ? scenarioDraft !== scenarioAnswer.scenario : false)
74
+ const scenarioCanEdit = $derived(scenarioAnswer?.canEdit === true)
50
75
  const lastLine = $derived(answer ? authorsNoteLastReplyLine(answer.lastReply, t) : null)
51
76
 
52
77
  const reason = (e: unknown) => (e instanceof Error ? e.message : String(e))
@@ -81,6 +106,29 @@
81
106
 
82
107
  $effect(() => untrack(() => ask()))
83
108
 
109
+ /** The scenario is asked once, on mount: nothing tells this widget it changed elsewhere. */
110
+ let scenarioAsked = 0
111
+ function askScenario() {
112
+ const ctx = untrack(() => widget?.current)
113
+ if (!ctx) return
114
+ const ticket = ++scenarioAsked
115
+ ctx.request("session-scenario", {}).then(
116
+ (res) => {
117
+ if (ticket !== scenarioAsked) return
118
+ scenarioReadError = null
119
+ const wasDirty = scenarioAnswer ? scenarioDraft !== scenarioAnswer.scenario : false
120
+ scenarioAnswer = res
121
+ if (!wasDirty) scenarioDraft = res.scenario
122
+ },
123
+ (e) => {
124
+ if (ticket !== scenarioAsked) return
125
+ scenarioReadError = reason(e)
126
+ }
127
+ )
128
+ }
129
+
130
+ $effect(() => untrack(() => askScenario()))
131
+
84
132
  // A reply finished: what it did with the note is on its receipt now.
85
133
  $effect(() =>
86
134
  untrack(() =>
@@ -124,27 +172,96 @@
124
172
  saveError = null
125
173
  }
126
174
 
175
+ async function saveScenario() {
176
+ const ctx = untrack(() => widget?.current)
177
+ if (!ctx || !scenarioCanEdit || !scenarioDirty || scenarioSaving) return
178
+ scenarioSaving = true
179
+ scenarioSaveError = null
180
+ try {
181
+ const now = await ctx.request("set-session-scenario", { scenario: scenarioDraft })
182
+ // The saved row is what the page answered; the form is clean against it.
183
+ scenarioAnswer = now
184
+ scenarioDraft = now.scenario
185
+ } catch (e) {
186
+ scenarioSaveError = t("Not saved: {reason}").replace("{reason}", reason(e))
187
+ } finally {
188
+ scenarioSaving = false
189
+ }
190
+ }
191
+
192
+ function discardScenario() {
193
+ scenarioDraft = scenarioAnswer?.scenario ?? ""
194
+ scenarioSaveError = null
195
+ }
196
+
127
197
  const setNumber = (key: "depth" | "interval", raw: string) => {
128
198
  const n = raw.trim() === "" ? NaN : Number(raw)
129
199
  draft = { ...draft, [key]: Number.isFinite(n) ? n : draft[key] }
130
200
  }
131
201
  </script>
132
202
 
133
- <div data-widget-part="authors-note.root" data-widget="authors-note" data-dirty={dirty ? "" : undefined}>
203
+ <div
204
+ data-widget-part="authors-note.root"
205
+ data-widget="authors-note"
206
+ data-dirty={dirty || scenarioDirty ? "" : undefined}
207
+ >
208
+ <section data-widget-part="authors-note.scenario">
209
+ {#if scenarioReadError}
210
+ <p data-widget-part="authors-note.alert" role="alert">
211
+ {t("Could not read the scenario: {reason}").replace("{reason}", scenarioReadError)}
212
+ </p>
213
+ {/if}
214
+ {#if scenarioAnswer}
215
+ {#if !scenarioCanEdit}
216
+ <p data-widget-part="authors-note.note">
217
+ {t("Only the session's owner can change the scenario.")}
218
+ </p>
219
+ {/if}
220
+ <label data-widget-part="authors-note.field">
221
+ <span data-widget-part="authors-note.label label">{t("Scenario")}</span>
222
+ <textarea
223
+ data-widget-part="authors-note.scenario-text"
224
+ rows="4"
225
+ placeholder={t("Describe the session scenario, setting, or context (optional)")}
226
+ disabled={!scenarioCanEdit}
227
+ value={scenarioDraft}
228
+ oninput={(e) => (scenarioDraft = e.currentTarget.value)}
229
+ ></textarea>
230
+ </label>
231
+ {#if scenarioSaveError}
232
+ <p data-widget-part="authors-note.alert" role="alert">{scenarioSaveError}</p>
233
+ {/if}
234
+ {#if scenarioCanEdit}
235
+ <div data-widget-part="authors-note.actions toolbar">
236
+ {#if scenarioDirty}
237
+ <span data-widget-part="authors-note.unsaved">{t("Unsaved changes")}</span>
238
+ <button
239
+ type="button"
240
+ data-widget-part="authors-note.discard"
241
+ disabled={scenarioSaving}
242
+ onclick={discardScenario}
243
+ >
244
+ {t("Discard")}
245
+ </button>
246
+ {/if}
247
+ <button
248
+ type="button"
249
+ data-widget-part="authors-note.save"
250
+ disabled={!scenarioDirty || scenarioSaving}
251
+ onclick={saveScenario}
252
+ >
253
+ {scenarioSaving ? t("Saving…") : t("Save")}
254
+ </button>
255
+ </div>
256
+ {/if}
257
+ {/if}
258
+ </section>
134
259
  {#if readError}
135
260
  <p data-widget-part="authors-note.alert" role="alert">
136
261
  {t("Could not read the author's note: {reason}").replace("{reason}", readError)}
137
262
  </p>
138
263
  {/if}
139
- {#if !answer}
140
- {#if !readError}
141
- <p data-widget-part="authors-note.note">{t("Reading the author's note…")}</p>
142
- {/if}
143
- {:else if !answer.offered}
144
- <p data-widget-part="authors-note.note">
145
- {t("This kind of session has no author's note.")}
146
- </p>
147
- {:else}
264
+ {#if answer?.offered}
148
265
  {#if !canEdit}
149
266
  <p data-widget-part="authors-note.note">
150
267
  {t("Only the session's owner can change the author's note.")}
@@ -161,55 +278,57 @@
161
278
  oninput={(e) => (draft = { ...draft, text: e.currentTarget.value })}
162
279
  ></textarea>
163
280
  </label>
164
- <div data-widget-part="authors-note.numbers">
165
- <label data-widget-part="authors-note.field">
166
- <span data-widget-part="authors-note.label label">{t("Messages from the end")}</span>
167
- <input
168
- type="number"
169
- data-widget-part="authors-note.number"
170
- min="0"
171
- step="1"
172
- disabled={!canEdit}
173
- value={String(draft.depth)}
174
- oninput={(e) => setNumber("depth", e.currentTarget.value)}
175
- />
176
- </label>
177
- <label data-widget-part="authors-note.field">
178
- <span data-widget-part="authors-note.label label">{t("Every how many replies")}</span>
179
- <input
180
- type="number"
181
- data-widget-part="authors-note.number"
182
- min="1"
183
- step="1"
184
- disabled={!canEdit}
185
- value={String(draft.interval)}
186
- oninput={(e) => setNumber("interval", e.currentTarget.value)}
187
- />
188
- </label>
189
- </div>
190
- <p data-widget-part="authors-note.help">
191
- {t("0 messages puts it right before the reply. Every 1 reply adds it each time.")}
192
- </p>
193
- <sp-accordion data-widget-part="authors-note.advanced">
194
- <sp-accordion-item value="advanced" heading={t("Advanced")} level="4">
195
- <span data-widget-part="authors-note.role">
196
- <sp-combobox
197
- data-widget-part="authors-note.role-field"
198
- label={t("Sent as")}
199
- value={draft.role}
281
+ {#if advanced}
282
+ <div data-widget-part="authors-note.numbers">
283
+ <label data-widget-part="authors-note.field">
284
+ <span data-widget-part="authors-note.label label">{t("Messages from the end")}</span>
285
+ <input
286
+ type="number"
287
+ data-widget-part="authors-note.number"
288
+ min="0"
289
+ step="1"
200
290
  disabled={!canEdit}
201
- onchange={(e: CustomEvent<{ value: string }>) => {
202
- const next = AUTHORS_NOTE_ROLES.find((r) => r.value === e.detail.value)
203
- if (next) draft = { ...draft, role: next.value }
204
- }}
205
- >
206
- {#each AUTHORS_NOTE_ROLES as r (r.value)}
207
- <sp-option value={r.value}>{t(r.label)}</sp-option>
208
- {/each}
209
- </sp-combobox>
210
- </span>
211
- </sp-accordion-item>
212
- </sp-accordion>
291
+ value={String(draft.depth)}
292
+ oninput={(e) => setNumber("depth", e.currentTarget.value)}
293
+ />
294
+ </label>
295
+ <label data-widget-part="authors-note.field">
296
+ <span data-widget-part="authors-note.label label">{t("Every how many replies")}</span>
297
+ <input
298
+ type="number"
299
+ data-widget-part="authors-note.number"
300
+ min="1"
301
+ step="1"
302
+ disabled={!canEdit}
303
+ value={String(draft.interval)}
304
+ oninput={(e) => setNumber("interval", e.currentTarget.value)}
305
+ />
306
+ </label>
307
+ </div>
308
+ <p data-widget-part="authors-note.help">
309
+ {t("0 messages puts it right before the reply. Every 1 reply adds it each time.")}
310
+ </p>
311
+ <sp-accordion data-widget-part="authors-note.advanced">
312
+ <sp-accordion-item value="advanced" heading={t("Advanced")} level="4">
313
+ <span data-widget-part="authors-note.role">
314
+ <sp-combobox
315
+ data-widget-part="authors-note.role-field"
316
+ label={t("Sent as")}
317
+ value={draft.role}
318
+ disabled={!canEdit}
319
+ onchange={(e: CustomEvent<{ value: string }>) => {
320
+ const next = AUTHORS_NOTE_ROLES.find((r) => r.value === e.detail.value)
321
+ if (next) draft = { ...draft, role: next.value }
322
+ }}
323
+ >
324
+ {#each AUTHORS_NOTE_ROLES as r (r.value)}
325
+ <sp-option value={r.value}>{t(r.label)}</sp-option>
326
+ {/each}
327
+ </sp-combobox>
328
+ </span>
329
+ </sp-accordion-item>
330
+ </sp-accordion>
331
+ {/if}
213
332
  {#if saveError}
214
333
  <p data-widget-part="authors-note.alert" role="alert">{saveError}</p>
215
334
  {/if}
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ /**
3
+ * The one boundary every core widget host draws its widget inside.
4
+ *
5
+ * Why (playtest item 15): a widget whose Svelte render threw after mount
6
+ * went blank with nothing on screen — the worker reports a throw at mount
7
+ * and in a handler, not one in a render. Here the throw is caught, said to
8
+ * the page as a fatal report over the widget port (the page answers with
9
+ * its own "This widget stopped" overlay), and one plain sentence is drawn.
10
+ *
11
+ * A handler's throw is not this boundary's: the worker reports it.
12
+ */
13
+ import type { Snippet } from "svelte"
14
+ import type { ComponentContext } from "@serene-pub/sdk/component"
15
+
16
+ let { ctx, children }: { ctx: ComponentContext; children: Snippet } = $props()
17
+
18
+ function report(error: unknown) {
19
+ const message = error instanceof Error ? error.message : String(error)
20
+ const where =
21
+ error instanceof Error && error.stack
22
+ ? "\n" + error.stack.split("\n").slice(1, 7).join("\n")
23
+ : ""
24
+ try {
25
+ ctx.error(message + where, true)
26
+ } catch {
27
+ // A closed port has nobody to tell.
28
+ }
29
+ }
30
+ </script>
31
+
32
+ <svelte:boundary onerror={report}>
33
+ {@render children()}
34
+ {#snippet failed()}
35
+ <p role="alert">This widget stopped and can't show anything.</p>
36
+ {/snippet}
37
+ </svelte:boundary>
@@ -7,6 +7,7 @@
7
7
  import type { ComponentContext } from "@serene-pub/sdk/component"
8
8
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
9
  import ActionsWidget from "./ActionsWidget.svelte"
10
+ import WidgetBoundary from "../WidgetBoundary.svelte"
10
11
  import { widgetRefFromComponent } from "../widgetRef.svelte"
11
12
 
12
13
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -21,4 +22,4 @@
21
22
  )
22
23
  </script>
23
24
 
24
- <ActionsWidget />
25
+ <WidgetBoundary {ctx}><ActionsWidget /></WidgetBoundary>
@@ -76,43 +76,36 @@
76
76
  <p data-widget-part="actions.alert" role="alert">{refusal}</p>
77
77
  {/if}
78
78
 
79
- {#if view.empty}
80
- <div data-widget-part="actions.empty empty" role="status">
81
- <sp-icon name="mouse-pointer-click" size="20"></sp-icon>
82
- <span>{view.empty}</span>
79
+ {#each view.groups as group (group.key)}
80
+ <div
81
+ data-widget-part="actions.group"
82
+ data-group={group.key}
83
+ role="group"
84
+ aria-labelledby={`actions-${uid}-${group.key}`}
85
+ >
86
+ <p data-widget-part="actions.group-head" id={`actions-${uid}-${group.key}`}>{group.title}</p>
87
+ {#each group.buttons as button (button.identity)}
88
+ <button
89
+ type="button"
90
+ data-widget-part="actions.button"
91
+ data-identity={button.identity}
92
+ data-new={button.isNew ? "" : undefined}
93
+ aria-disabled={button.disabled ? "true" : undefined}
94
+ aria-describedby={button.reason ? `actions-${uid}-reason-${idOf(button.identity)}` : undefined}
95
+ title={button.title}
96
+ onclick={() => press(button)}
97
+ >
98
+ <sp-icon name={button.icon} size="16"></sp-icon>
99
+ <span>{button.name}</span>
100
+ {#if button.reason}
101
+ <span
102
+ data-widget-part="actions.reason"
103
+ id={`actions-${uid}-reason-${idOf(button.identity)}`}
104
+ aria-hidden="true">{button.reason}</span
105
+ >
106
+ {/if}
107
+ </button>
108
+ {/each}
83
109
  </div>
84
- {:else}
85
- {#each view.groups as group (group.key)}
86
- <div
87
- data-widget-part="actions.group"
88
- data-group={group.key}
89
- role="group"
90
- aria-labelledby={`actions-${uid}-${group.key}`}
91
- >
92
- <p data-widget-part="actions.group-head" id={`actions-${uid}-${group.key}`}>{group.title}</p>
93
- {#each group.buttons as button (button.identity)}
94
- <button
95
- type="button"
96
- data-widget-part="actions.button"
97
- data-identity={button.identity}
98
- data-new={button.isNew ? "" : undefined}
99
- aria-disabled={button.disabled ? "true" : undefined}
100
- aria-describedby={button.reason ? `actions-${uid}-reason-${idOf(button.identity)}` : undefined}
101
- title={button.title}
102
- onclick={() => press(button)}
103
- >
104
- <sp-icon name={button.icon} size="16"></sp-icon>
105
- <span>{button.name}</span>
106
- {#if button.reason}
107
- <span
108
- data-widget-part="actions.reason"
109
- id={`actions-${uid}-reason-${idOf(button.identity)}`}
110
- aria-hidden="true">{button.reason}</span
111
- >
112
- {/if}
113
- </button>
114
- {/each}
115
- </div>
116
- {/each}
117
- {/if}
110
+ {/each}
118
111
  </div>
@@ -7,6 +7,7 @@
7
7
  import type { ComponentContext } from "@serene-pub/sdk/component"
8
8
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
9
  import AlbumWidget from "./AlbumWidget.svelte"
10
+ import WidgetBoundary from "../WidgetBoundary.svelte"
10
11
  import { widgetRefFromComponent } from "../widgetRef.svelte"
11
12
 
12
13
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -21,4 +22,4 @@
21
22
  )
22
23
  </script>
23
24
 
24
- <AlbumWidget />
25
+ <WidgetBoundary {ctx}><AlbumWidget /></WidgetBoundary>
@@ -24,7 +24,6 @@
24
24
  */
25
25
  import { SvelteSet } from "svelte/reactivity"
26
26
  import {
27
- ALBUM_EMPTY,
28
27
  ALBUM_ORIGIN_NAMES,
29
28
  albumItems,
30
29
  albumOpenLabel,
@@ -132,12 +131,7 @@
132
131
  <p data-widget-part="album.alert" role="alert">{refusal}</p>
133
132
  {/if}
134
133
 
135
- {#if !items.length}
136
- <div data-widget-part="album.empty empty" role="status">
137
- <sp-icon name="book-image" size="20"></sp-icon>
138
- <span>{t(ALBUM_EMPTY[settings.source])}</span>
139
- </div>
140
- {:else}
134
+ {#if items.length}
141
135
  <p data-widget-part="album.toolbar toolbar">{count}</p>
142
136
  {#if latest}
143
137
  {#if lead}
@@ -7,6 +7,7 @@
7
7
  import type { ComponentContext } from "@serene-pub/sdk/component"
8
8
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
9
  import AnnexWidget from "./AnnexWidget.svelte"
10
+ import WidgetBoundary from "../WidgetBoundary.svelte"
10
11
  import { widgetRefFromComponent } from "../widgetRef.svelte"
11
12
 
12
13
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -21,4 +22,4 @@
21
22
  )
22
23
  </script>
23
24
 
24
- <AnnexWidget />
25
+ <WidgetBoundary {ctx}><AnnexWidget /></WidgetBoundary>
@@ -144,7 +144,7 @@
144
144
  </dl>
145
145
  {/if}
146
146
  </div>
147
- {:else}
147
+ {:else if view.state === "hidden" || view.state === "pick"}
148
148
  <div data-widget-part="annex.empty empty" role="status">
149
149
  <sp-icon name="clipboard-list" size="20"></sp-icon>
150
150
  <span>{view.empty}</span>
@@ -7,6 +7,7 @@
7
7
  import type { ComponentContext } from "@serene-pub/sdk/component"
8
8
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
9
  import AttendanceWidget from "./AttendanceWidget.svelte"
10
+ import WidgetBoundary from "../WidgetBoundary.svelte"
10
11
  import { widgetRefFromComponent } from "../widgetRef.svelte"
11
12
 
12
13
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -21,4 +22,4 @@
21
22
  )
22
23
  </script>
23
24
 
24
- <AttendanceWidget />
25
+ <WidgetBoundary {ctx}><AttendanceWidget /></WidgetBoundary>
@@ -109,19 +109,16 @@
109
109
  <p data-widget-part="attendance.alert" role="alert">{refusal}</p>
110
110
  {/if}
111
111
 
112
- <section data-widget-part="attendance.group" data-group="here" aria-label={t("Here")}>
113
- <h3 data-widget-part="attendance.group-head">{t("Here")}</h3>
114
- {#if view.here.length}
112
+ {#if view.here.length}
113
+ <section data-widget-part="attendance.group" data-group="here" aria-label={t("Here")}>
114
+ <h3 data-widget-part="attendance.group-head">{t("Here")}</h3>
115
115
  <ul data-widget-part="attendance.list list">
116
116
  {#each view.here as person (person.key)}
117
117
  {@render personRow(person, "here")}
118
118
  {/each}
119
119
  </ul>
120
- {/if}
121
- {#if view.alone}
122
- <p data-widget-part="attendance.empty empty" role="status">{view.alone}</p>
123
- {/if}
124
- </section>
120
+ </section>
121
+ {/if}
125
122
 
126
123
  {#if view.away.length}
127
124
  <section data-widget-part="attendance.group" data-group="away" aria-label={t("Away")}>
@@ -7,6 +7,7 @@
7
7
  import type { ComponentContext } from "@serene-pub/sdk/component"
8
8
  import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
9
  import BackdropWidget from "./BackdropWidget.svelte"
10
+ import WidgetBoundary from "../WidgetBoundary.svelte"
10
11
  import { widgetRefFromComponent } from "../widgetRef.svelte"
11
12
 
12
13
  let { ctx }: { ctx: ComponentContext } = $props()
@@ -21,4 +22,4 @@
21
22
  )
22
23
  </script>
23
24
 
24
- <BackdropWidget />
25
+ <WidgetBoundary {ctx}><BackdropWidget /></WidgetBoundary>