@serene-pub/core-catalog 0.6.0-pr-2 → 0.6.0-pr-5

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 (360) hide show
  1. package/README.md +21 -1
  2. package/components/{sessions → genres/chat}/authors-note/AuthorsNote.svelte +1 -1
  3. package/components/{sessions → genres/chat}/authors-note/AuthorsNoteWidget.svelte +1 -1
  4. package/components/{sessions/world-state/WorldState.svelte → shared/actions/Actions.svelte} +5 -5
  5. package/components/shared/actions/ActionsWidget.svelte +118 -0
  6. package/components/shared/actions/actions.ts +11 -0
  7. package/components/shared/album/Album.svelte +24 -0
  8. package/components/shared/album/AlbumWidget.svelte +163 -0
  9. package/components/shared/album/album.ts +10 -0
  10. package/components/shared/annex/Annex.svelte +24 -0
  11. package/components/shared/annex/AnnexWidget.svelte +151 -0
  12. package/components/shared/annex/annex.ts +10 -0
  13. package/components/shared/attendance/Attendance.svelte +24 -0
  14. package/components/shared/attendance/AttendanceWidget.svelte +136 -0
  15. package/components/shared/attendance/attendance.ts +12 -0
  16. package/components/shared/backdrop/Backdrop.svelte +24 -0
  17. package/components/shared/backdrop/BackdropWidget.svelte +345 -0
  18. package/components/shared/backdrop/backdrop.ts +10 -0
  19. package/components/shared/chronicle/Chronicle.svelte +36 -0
  20. package/components/shared/chronicle/ChronicleWidget.svelte +569 -0
  21. package/components/shared/chronicle/chronicle.ts +11 -0
  22. package/components/{sessions → shared}/lore-entries/LoreEntries.svelte +1 -1
  23. package/components/{sessions → shared}/lore-entries/LoreEntriesWidget.svelte +3 -3
  24. package/components/shared/map-canvas/MapCanvas.svelte +171 -0
  25. package/components/shared/map-canvas/index.ts +390 -0
  26. package/components/{sessions → shared}/messages/MessageComposer.svelte +1 -1
  27. package/components/{sessions → shared}/messages/MessageControls.svelte +42 -0
  28. package/components/{sessions → shared}/messages/MessageStateLedger.svelte +19 -8
  29. package/components/{sessions → shared}/messages/Messages.svelte +1 -1
  30. package/components/{sessions → shared}/messages/MessagesWidget.svelte +126 -40
  31. package/components/{sessions → shared}/messages/NextCharacterBlock.svelte +17 -14
  32. package/components/shared/messages/SceneCueChip.svelte +82 -0
  33. package/components/shared/messages/SceneDivider.svelte +399 -0
  34. package/components/{sessions → shared}/messages/SessionComposer.svelte +33 -9
  35. package/components/shared/messages/SessionContainer.svelte +651 -0
  36. package/components/{sessions → shared}/messages/SessionMessage.svelte +52 -7
  37. package/components/shared/messages/TurnLine.svelte +254 -0
  38. package/components/{sessions → shared}/messages/conversation.svelte.ts +191 -2
  39. package/components/shared/messages/sceneMarks.ts +397 -0
  40. package/components/shared/places/Places.svelte +24 -0
  41. package/components/shared/places/PlacesWidget.svelte +290 -0
  42. package/components/shared/places/places.ts +11 -0
  43. package/components/{sessions → shared}/scene-portraits/ScenePortraits.svelte +1 -1
  44. package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +404 -0
  45. package/components/{sessions → shared}/state/SlotControl.svelte +9 -1
  46. package/components/{sessions → shared}/stats/Stats.svelte +1 -1
  47. package/components/shared/stats/StatsWidget.svelte +350 -0
  48. package/components/{sessions → shared}/stats/stats.ts +3 -2
  49. package/components/shared/turn-order/TurnOrder.svelte +24 -0
  50. package/components/shared/turn-order/TurnOrderWidget.svelte +167 -0
  51. package/components/shared/turn-order/turn-order.ts +11 -0
  52. package/components/{sessions/shared → shared}/widgetRef.svelte.ts +9 -2
  53. package/components/shared/world-state/WorldState.svelte +33 -0
  54. package/components/shared/world-state/world-state.ts +10 -0
  55. package/components/tsconfig.json +2 -2
  56. package/dist/components/actions.js +294 -0
  57. package/dist/components/actions.source.json +1 -0
  58. package/dist/components/album.js +386 -0
  59. package/dist/components/album.source.json +1 -0
  60. package/dist/components/annex.js +457 -0
  61. package/dist/components/annex.source.json +1 -0
  62. package/dist/components/attendance.js +353 -0
  63. package/dist/components/attendance.source.json +1 -0
  64. package/dist/components/authors-note.js +5 -5
  65. package/dist/components/authors-note.source.json +1 -1
  66. package/dist/components/backdrop.js +561 -0
  67. package/dist/components/backdrop.source.json +1 -0
  68. package/dist/components/chronicle.js +1141 -0
  69. package/dist/components/chronicle.source.json +1 -0
  70. package/dist/components/core-ui.json +1 -1
  71. package/dist/components/lore-entries.js +5 -5
  72. package/dist/components/lore-entries.source.json +1 -1
  73. package/dist/components/messages.js +3014 -2489
  74. package/dist/components/messages.source.json +1 -1
  75. package/dist/components/places.js +1133 -0
  76. package/dist/components/places.source.json +1 -0
  77. package/dist/components/scene-portraits.js +514 -345
  78. package/dist/components/scene-portraits.source.json +1 -1
  79. package/dist/components/shared-3K7SOGH7.js +16 -0
  80. package/dist/components/shared-452PIS46.js +156 -0
  81. package/dist/components/shared-GEDAMORM.js +45 -0
  82. package/dist/components/{shared-TCQZXBE3.js → shared-GXTL5G2H.js} +4 -3
  83. package/dist/components/shared-ITSLBJB5.js +478 -0
  84. package/dist/components/shared-NK7QSVMU.js +400 -0
  85. package/dist/components/shared-TDWKI2QV.js +58 -0
  86. package/dist/components/{shared-UAQVMZZK.js → shared-XBPH6USH.js} +586 -18
  87. package/dist/components/{shared-AINANAIA.js → shared-XISPHAKY.js} +502 -98
  88. package/dist/components/stats.js +8 -208
  89. package/dist/components/stats.source.json +1 -1
  90. package/dist/components/turn-order.js +461 -0
  91. package/dist/components/turn-order.source.json +1 -0
  92. package/dist/components/world-state.js +14 -202
  93. package/dist/components/world-state.source.json +1 -1
  94. package/dist/{answerForm.d.ts → factories/answerForm.d.ts} +4 -30
  95. package/dist/{answerForm.js → factories/answerForm.js} +10 -39
  96. package/dist/factories/once.d.ts +7 -0
  97. package/dist/factories/once.js +9 -0
  98. package/dist/{turnOrder.d.ts → factories/turnOrder.d.ts} +0 -22
  99. package/dist/{turnOrder.js → factories/turnOrder.js} +4 -104
  100. package/dist/genres/adventure/advanceTime.d.ts +18 -0
  101. package/dist/genres/adventure/advanceTime.js +24 -0
  102. package/dist/genres/adventure/answer.d.ts +23 -0
  103. package/dist/genres/adventure/answer.js +59 -0
  104. package/dist/genres/adventure/answerForm.d.ts +9 -0
  105. package/dist/genres/adventure/answerForm.js +11 -0
  106. package/dist/genres/adventure/ask.d.ts +73 -0
  107. package/dist/genres/adventure/ask.js +157 -0
  108. package/dist/genres/adventure/create.d.ts +36 -0
  109. package/dist/genres/adventure/create.js +62 -0
  110. package/dist/genres/adventure/illustrateScene.d.ts +7 -0
  111. package/dist/genres/adventure/illustrateScene.js +19 -0
  112. package/dist/genres/adventure/index.d.ts +45 -0
  113. package/dist/genres/adventure/index.js +45 -0
  114. package/dist/genres/adventure/keeperAction.d.ts +43 -0
  115. package/dist/genres/adventure/keeperAction.js +217 -0
  116. package/dist/genres/adventure/look.d.ts +45 -0
  117. package/dist/genres/adventure/look.js +209 -0
  118. package/dist/{adventure.d.ts → genres/adventure/respond.d.ts} +74 -65
  119. package/dist/{adventure.js → genres/adventure/respond.js} +125 -65
  120. package/dist/genres/adventure/rest.d.ts +10 -0
  121. package/dist/genres/adventure/rest.js +16 -0
  122. package/dist/genres/adventure/summarizeScene.d.ts +7 -0
  123. package/dist/genres/adventure/summarizeScene.js +14 -0
  124. package/dist/genres/adventure/turnOrder.d.ts +10 -0
  125. package/dist/genres/adventure/turnOrder.js +27 -0
  126. package/dist/genres/chat/advanceTime.d.ts +7 -0
  127. package/dist/genres/chat/advanceTime.js +17 -0
  128. package/dist/genres/chat/answerForm.d.ts +9 -0
  129. package/dist/genres/chat/answerForm.js +11 -0
  130. package/dist/genres/chat/create.d.ts +7 -0
  131. package/dist/{createChat.js → genres/chat/create.js} +6 -6
  132. package/dist/genres/chat/generateImage.d.ts +7 -0
  133. package/dist/{generateImage.js → genres/chat/generateImage.js} +26 -22
  134. package/dist/genres/chat/illustrateScene.d.ts +8 -0
  135. package/dist/genres/chat/illustrateScene.js +19 -0
  136. package/dist/genres/chat/index.d.ts +18 -0
  137. package/dist/genres/chat/index.js +19 -0
  138. package/dist/{narrate.d.ts → genres/chat/narrate.d.ts} +3 -3
  139. package/dist/{narrate.js → genres/chat/narrate.js} +37 -12
  140. package/dist/{narrateCharacter.d.ts → genres/chat/narrateCharacter.d.ts} +2 -2
  141. package/dist/{narrateCharacter.js → genres/chat/narrateCharacter.js} +39 -17
  142. package/dist/genres/chat/respond.d.ts +25 -0
  143. package/dist/{respond.js → genres/chat/respond.js} +91 -23
  144. package/dist/genres/chat/summarizeScene.d.ts +7 -0
  145. package/dist/genres/chat/summarizeScene.js +14 -0
  146. package/dist/genres/chat/turnOrder.d.ts +9 -0
  147. package/dist/genres/chat/turnOrder.js +28 -0
  148. package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.d.ts +1 -1
  149. package/dist/genres/guide/answerForm.d.ts +9 -0
  150. package/dist/genres/guide/answerForm.js +11 -0
  151. package/dist/genres/guide/create.d.ts +24 -0
  152. package/dist/genres/guide/create.js +58 -0
  153. package/dist/genres/guide/index.d.ts +10 -0
  154. package/dist/genres/guide/index.js +10 -0
  155. package/dist/{guide.d.ts → genres/guide/respond.d.ts} +1 -20
  156. package/dist/{guide.js → genres/guide/respond.js} +32 -61
  157. package/dist/genres/guide/summarizeScene.d.ts +7 -0
  158. package/dist/genres/guide/summarizeScene.js +14 -0
  159. package/dist/genres/guide/turnOrder.d.ts +10 -0
  160. package/dist/genres/guide/turnOrder.js +27 -0
  161. package/dist/genres/index.d.ts +14 -0
  162. package/dist/genres/index.js +41 -0
  163. package/dist/genres/lair/advanceTime.d.ts +7 -0
  164. package/dist/genres/lair/advanceTime.js +17 -0
  165. package/dist/genres/lair/answerForm.d.ts +17 -0
  166. package/dist/genres/lair/answerForm.js +19 -0
  167. package/dist/genres/lair/buildRoom.d.ts +64 -0
  168. package/dist/genres/lair/buildRoom.js +244 -0
  169. package/dist/genres/lair/castellanAction.d.ts +27 -0
  170. package/dist/genres/lair/castellanAction.js +177 -0
  171. package/dist/genres/lair/create.d.ts +28 -0
  172. package/dist/genres/lair/create.js +69 -0
  173. package/dist/genres/lair/fileRoom.d.ts +53 -0
  174. package/dist/genres/lair/fileRoom.js +288 -0
  175. package/dist/genres/lair/index.d.ts +62 -0
  176. package/dist/genres/lair/index.js +63 -0
  177. package/dist/genres/lair/nudge.d.ts +25 -0
  178. package/dist/genres/lair/nudge.js +78 -0
  179. package/dist/{lair.d.ts → genres/lair/respond.d.ts} +46 -59
  180. package/dist/{lair.js → genres/lair/respond.js} +55 -76
  181. package/dist/genres/lair/reveal.d.ts +10 -0
  182. package/dist/genres/lair/reveal.js +18 -0
  183. package/dist/genres/lair/roomAnswer.d.ts +86 -0
  184. package/dist/genres/lair/roomAnswer.js +378 -0
  185. package/dist/genres/lair/summarizeScene.d.ts +39 -0
  186. package/dist/genres/lair/summarizeScene.js +51 -0
  187. package/dist/genres/lair/trap.d.ts +11 -0
  188. package/dist/genres/lair/trap.js +24 -0
  189. package/dist/genres/lair/turnOrder.d.ts +9 -0
  190. package/dist/genres/lair/turnOrder.js +36 -0
  191. package/dist/genres/lair/whisper.d.ts +35 -0
  192. package/dist/genres/lair/whisper.js +90 -0
  193. package/dist/index.d.ts +52 -29
  194. package/dist/index.js +192 -86
  195. package/dist/loadouts.d.ts +37 -0
  196. package/dist/loadouts.js +105 -0
  197. package/dist/{entries.d.ts → registry/entries.d.ts} +1 -1
  198. package/dist/{genres.js → registry/genres.js} +40 -6
  199. package/dist/{ui/sessions → registry}/layouts.d.ts +41 -27
  200. package/dist/{ui/sessions → registry}/layouts.js +90 -49
  201. package/dist/{ui/sessions → registry}/widgets.d.ts +22 -0
  202. package/dist/registry/widgets.js +1294 -0
  203. package/dist/{presets.js → seed/presets.js} +28 -13
  204. package/dist/{prompts.d.ts → seed/prompts.d.ts} +10 -5
  205. package/dist/{prompts.js → seed/prompts.js} +225 -176
  206. package/dist/{annexField.d.ts → shared/annexField.d.ts} +12 -8
  207. package/dist/{annexField.js → shared/annexField.js} +16 -15
  208. package/dist/shared/builtins/branch.d.ts +8 -0
  209. package/dist/shared/builtins/branch.js +13 -0
  210. package/dist/{builtins.d.ts → shared/builtins/builtIn.d.ts} +16 -21
  211. package/dist/{builtins.js → shared/builtins/builtIn.js} +3 -37
  212. package/dist/shared/builtins/delete.d.ts +8 -0
  213. package/dist/shared/builtins/delete.js +13 -0
  214. package/dist/shared/builtins/edit.d.ts +8 -0
  215. package/dist/shared/builtins/edit.js +13 -0
  216. package/dist/shared/builtins/hide.d.ts +8 -0
  217. package/dist/shared/builtins/hide.js +13 -0
  218. package/dist/shared/builtins/index.d.ts +11 -0
  219. package/dist/shared/builtins/index.js +11 -0
  220. package/dist/shared/builtins/swipe.d.ts +8 -0
  221. package/dist/shared/builtins/swipe.js +17 -0
  222. package/dist/shared/describeLikeness.d.ts +14 -0
  223. package/dist/shared/describeLikeness.js +65 -0
  224. package/dist/shared/illustrateScene.d.ts +28 -0
  225. package/dist/shared/illustrateScene.js +181 -0
  226. package/dist/shared/portrait.d.ts +21 -0
  227. package/dist/shared/portrait.js +101 -0
  228. package/dist/shared/spriteFill.d.ts +14 -0
  229. package/dist/shared/spriteFill.js +107 -0
  230. package/dist/shared/sprites.d.ts +34 -0
  231. package/dist/shared/sprites.js +98 -0
  232. package/dist/shared/summarize/character.d.ts +9 -0
  233. package/dist/shared/summarize/character.js +10 -0
  234. package/dist/shared/summarize/history.d.ts +9 -0
  235. package/dist/shared/summarize/history.js +10 -0
  236. package/dist/shared/summarize/index.d.ts +12 -0
  237. package/dist/shared/summarize/index.js +12 -0
  238. package/dist/shared/summarize/scene.d.ts +38 -0
  239. package/dist/shared/summarize/scene.js +42 -0
  240. package/dist/shared/summarize/sceneIds.d.ts +17 -0
  241. package/dist/shared/summarize/sceneIds.js +17 -0
  242. package/dist/shared/summarize/summarizeScene.d.ts +113 -0
  243. package/dist/shared/summarize/summarizeScene.js +234 -0
  244. package/dist/shared/summarize/summarizeSpec.d.ts +54 -0
  245. package/dist/{summarize.js → shared/summarize/summarizeSpec.js} +23 -53
  246. package/dist/shared/summarize/world.d.ts +8 -0
  247. package/dist/shared/summarize/world.js +9 -0
  248. package/dist/shared/timePasses.d.ts +56 -0
  249. package/dist/shared/timePasses.js +86 -0
  250. package/dist/{toolLoop.d.ts → shared/toolLoop.d.ts} +25 -3
  251. package/dist/{toolLoop.js → shared/toolLoop.js} +70 -14
  252. package/dist/shared/ui/actions/index.d.ts +117 -0
  253. package/dist/shared/ui/actions/index.js +154 -0
  254. package/dist/shared/ui/album/index.d.ts +115 -0
  255. package/dist/shared/ui/album/index.js +178 -0
  256. package/dist/shared/ui/annex/index.d.ts +163 -0
  257. package/dist/shared/ui/annex/index.js +273 -0
  258. package/dist/shared/ui/attendance/index.d.ts +97 -0
  259. package/dist/shared/ui/attendance/index.js +89 -0
  260. package/dist/shared/ui/backdrop/index.d.ts +78 -0
  261. package/dist/shared/ui/backdrop/index.js +98 -0
  262. package/dist/shared/ui/chronicle/index.d.ts +230 -0
  263. package/dist/shared/ui/chronicle/index.js +249 -0
  264. package/dist/shared/ui/conversation/dossier.d.ts +33 -0
  265. package/dist/shared/ui/conversation/dossier.js +31 -0
  266. package/dist/{ui/sessions → shared/ui}/conversation/index.d.ts +2 -1
  267. package/dist/{ui/sessions → shared/ui}/conversation/index.js +3 -1
  268. package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.d.ts +1 -1
  269. package/dist/shared/ui/conversation/storyDays.d.ts +21 -0
  270. package/dist/shared/ui/conversation/storyDays.js +23 -0
  271. package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.d.ts +1 -1
  272. package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.js +1 -1
  273. package/dist/{ui/sessions → shared/ui}/lore-entries/index.d.ts +2 -2
  274. package/dist/shared/ui/places/index.d.ts +148 -0
  275. package/dist/shared/ui/places/index.js +249 -0
  276. package/dist/{ui/sessions → shared/ui}/scene-portraits/index.d.ts +1 -1
  277. package/dist/{ui/sessions → shared/ui}/scene-portraits/index.js +1 -1
  278. package/dist/shared/ui/scene-portraits/portraits.d.ts +191 -0
  279. package/dist/shared/ui/scene-portraits/portraits.js +223 -0
  280. package/dist/shared/ui/session-state/index.d.ts +16 -0
  281. package/dist/shared/ui/session-state/index.js +16 -0
  282. package/dist/{ui/sessions → shared/ui}/session-state/shapes.d.ts +2 -2
  283. package/dist/shared/ui/session-state/stateView.d.ts +249 -0
  284. package/dist/shared/ui/session-state/stateView.js +247 -0
  285. package/dist/shared/ui/turn-order/index.d.ts +146 -0
  286. package/dist/shared/ui/turn-order/index.js +257 -0
  287. package/dist/{ui/sessions → shared/ui}/widgetContext.d.ts +19 -10
  288. package/package.json +69 -30
  289. package/components/sessions/messages/SessionContainer.svelte +0 -459
  290. package/components/sessions/scene-portraits/ScenePortraitsWidget.svelte +0 -249
  291. package/components/sessions/stats/StatsWidget.svelte +0 -112
  292. package/components/sessions/world-state/WorldStateWidget.svelte +0 -112
  293. package/components/sessions/world-state/world-state.ts +0 -10
  294. package/dist/adventureActions.d.ts +0 -169
  295. package/dist/adventureActions.js +0 -599
  296. package/dist/createChat.d.ts +0 -7
  297. package/dist/generateImage.d.ts +0 -7
  298. package/dist/lairActions.d.ts +0 -296
  299. package/dist/lairActions.js +0 -1287
  300. package/dist/respond.d.ts +0 -24
  301. package/dist/sprites.d.ts +0 -24
  302. package/dist/sprites.js +0 -102
  303. package/dist/summarize.d.ts +0 -76
  304. package/dist/ui/sessions/conversation/dossier.d.ts +0 -328
  305. package/dist/ui/sessions/conversation/dossier.js +0 -31
  306. package/dist/ui/sessions/scene-portraits/portraits.d.ts +0 -95
  307. package/dist/ui/sessions/scene-portraits/portraits.js +0 -115
  308. package/dist/ui/sessions/session-state/index.d.ts +0 -15
  309. package/dist/ui/sessions/session-state/index.js +0 -15
  310. package/dist/ui/sessions/session-state/stateView.d.ts +0 -155
  311. package/dist/ui/sessions/session-state/stateView.js +0 -141
  312. package/dist/ui/sessions/widgets.js +0 -567
  313. package/components/{sessions → genres/chat}/authors-note/authors-note.ts +0 -0
  314. package/components/{sessions/shared → shared}/context.ts +0 -0
  315. package/components/{sessions → shared}/lore-entries/lore-entries.ts +0 -0
  316. package/components/{sessions → shared}/messages/MessageBlocksView.svelte +0 -0
  317. package/components/{sessions → shared}/messages/MessageMediaStrip.svelte +0 -0
  318. package/components/{sessions → shared}/messages/MessagePartsView.svelte +0 -0
  319. package/components/{sessions → shared}/messages/StateProposalList.svelte +0 -0
  320. package/components/{sessions → shared}/messages/mediaStrip.ts +0 -0
  321. package/components/{sessions → shared}/messages/messages.ts +0 -0
  322. package/components/{sessions → shared}/scene-portraits/StatBars.svelte +0 -0
  323. package/components/{sessions → shared}/scene-portraits/scene-portraits.ts +0 -0
  324. package/components/{sessions → shared}/state/entryFinder.ts +0 -0
  325. package/components/{sessions → shared}/state/slotWriter.svelte.ts +0 -0
  326. package/dist/components/{shared-RJDGOAVC.js → shared-FTRGUE7G.js} +78 -78
  327. /package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.js +0 -0
  328. /package/dist/{entries.js → registry/entries.js} +0 -0
  329. /package/dist/{genres.d.ts → registry/genres.d.ts} +0 -0
  330. /package/dist/{slots.d.ts → registry/slots.d.ts} +0 -0
  331. /package/dist/{slots.js → registry/slots.js} +0 -0
  332. /package/dist/{statShapes.d.ts → registry/statShapes.d.ts} +0 -0
  333. /package/dist/{statShapes.js → registry/statShapes.js} +0 -0
  334. /package/dist/{guideMascotImage.d.ts → seed/guideMascotImage.d.ts} +0 -0
  335. /package/dist/{guideMascotImage.js → seed/guideMascotImage.js} +0 -0
  336. /package/dist/{presets.d.ts → seed/presets.d.ts} +0 -0
  337. /package/dist/{graphBuild.d.ts → shared/graphBuild.d.ts} +0 -0
  338. /package/dist/{graphBuild.js → shared/graphBuild.js} +0 -0
  339. /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.d.ts +0 -0
  340. /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.js +0 -0
  341. /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.d.ts +0 -0
  342. /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.js +0 -0
  343. /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.d.ts +0 -0
  344. /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.js +0 -0
  345. /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.d.ts +0 -0
  346. /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.js +0 -0
  347. /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.d.ts +0 -0
  348. /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.js +0 -0
  349. /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.d.ts +0 -0
  350. /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.js +0 -0
  351. /package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.js +0 -0
  352. /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.d.ts +0 -0
  353. /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.js +0 -0
  354. /package/dist/{ui/sessions → shared/ui}/conversation/text.d.ts +0 -0
  355. /package/dist/{ui/sessions → shared/ui}/conversation/text.js +0 -0
  356. /package/dist/{ui/sessions → shared/ui}/lore-entries/index.js +0 -0
  357. /package/dist/{ui/sessions → shared/ui}/session-state/barMath.d.ts +0 -0
  358. /package/dist/{ui/sessions → shared/ui}/session-state/barMath.js +0 -0
  359. /package/dist/{ui/sessions → shared/ui}/session-state/shapes.js +0 -0
  360. /package/dist/{ui/sessions → shared/ui}/widgetContext.js +0 -0
@@ -0,0 +1,397 @@
1
+ /**
2
+ * 🚧 The conversation's **scene dividers** and **day marks**, as pure
3
+ * functions (PROPOSAL-live-scenes §3, §7, §14 C): what the log draws between
4
+ * its rows, and which scene boundaries a line's menu may offer.
5
+ *
6
+ * A scene is one of two kinds while live scenes land. A **live scene** opens
7
+ * at a message and is the run of its channel lane's lines from there to the
8
+ * message it closes at — open-ended while it is the **open scene**. A scene
9
+ * **captured by selection** (ticked lines, no opening) is its
10
+ * `selectedMessageIds` alone. A row sits in at most one scene: a captured
11
+ * scene's lines are taken first, then the live ranges fill the rest.
12
+ *
13
+ * A row's **story clock stamp** (`storyClock*`, the session's story now when
14
+ * it was written) gives the day marks: one before the first stamped line of
15
+ * each story day on the lane the log shows.
16
+ *
17
+ * Self-contained — no import — so a component bundles it from source and a
18
+ * test reads it as it stands.
19
+ */
20
+
21
+ /** A story time as a scene's clock and a row's stamp carry it. */
22
+ export interface StoryDayParts {
23
+ year: number
24
+ month?: number | null
25
+ day?: number | null
26
+ hour?: number | null
27
+ minute?: number | null
28
+ }
29
+
30
+ /** A scene as these functions read it (the dossier's `ConversationSceneV1`). */
31
+ export interface SceneMarkScene {
32
+ id: number
33
+ name: string | null
34
+ selectedMessageIds: number[]
35
+ historyEntryId?: number | null
36
+ historyEntry?: { year: number; month: number | null; day: number | null } | null
37
+ channel?: string
38
+ openedAtMessageId?: number | null
39
+ closedAtMessageId?: number | null
40
+ openedAt?: StoryDayParts | null
41
+ closedAt?: StoryDayParts | null
42
+ summaryStatus?: string
43
+ }
44
+
45
+ /** A row as these functions read it (a `MessageV1`). */
46
+ export interface SceneMarkRow {
47
+ id: number
48
+ channel?: unknown
49
+ isHidden?: boolean
50
+ storyClockYear?: unknown
51
+ storyClockMonth?: unknown
52
+ storyClockDay?: unknown
53
+ }
54
+
55
+ /** How many scene colours the conversation's palette has (the Chronicle's swatches). */
56
+ export const SCENE_SWATCH_COUNT = 8
57
+
58
+ /**
59
+ * A channel string as one lane, canonically: a bare slug is lane 1, so
60
+ * `main` and `main:1` are one lane; unset is `main`.
61
+ */
62
+ export function laneOf(channel: unknown): string {
63
+ const raw = typeof channel === "string" && channel.trim() ? channel.trim() : "main"
64
+ const at = raw.indexOf(":")
65
+ if (at < 0) return raw
66
+ const lane = raw.slice(at + 1)
67
+ return lane === "1" ? raw.slice(0, at) : raw
68
+ }
69
+
70
+ /** A scene opened at a message — not one captured by selection. */
71
+ export const isLiveScene = (s: SceneMarkScene): boolean =>
72
+ typeof s.openedAtMessageId === "number"
73
+
74
+ /** A live scene still open: no closing message yet. */
75
+ export const isOpenScene = (s: SceneMarkScene): boolean =>
76
+ isLiveScene(s) && s.closedAtMessageId == null
77
+
78
+ /**
79
+ * Where a scene begins in the session: its opening message, else its first
80
+ * captured line; a scene with neither sorts last. The order scenes take
81
+ * their colours in, here and in the Chronicle.
82
+ */
83
+ export function sceneStartOf(s: SceneMarkScene): number {
84
+ if (isLiveScene(s)) return s.openedAtMessageId as number
85
+ const ids = s.selectedMessageIds ?? []
86
+ return ids.length ? Math.min(...ids) : Number.POSITIVE_INFINITY
87
+ }
88
+
89
+ /** Each scene's colour (0–7): its place among the session's scenes, oldest first. */
90
+ export function sceneSwatches(scenes: readonly SceneMarkScene[]): Map<number, number> {
91
+ const out = new Map<number, number>()
92
+ ;[...scenes]
93
+ .sort((a, b) => sceneStartOf(a) - sceneStartOf(b) || a.id - b.id)
94
+ .forEach((s, i) => out.set(s.id, i % SCENE_SWATCH_COUNT))
95
+ return out
96
+ }
97
+
98
+ /** Whether a live scene's range holds a row: its lane, from its opening to its close. */
99
+ export function liveSceneHolds(s: SceneMarkScene, row: SceneMarkRow): boolean {
100
+ if (!isLiveScene(s)) return false
101
+ if (laneOf(row.channel) !== laneOf(s.channel)) return false
102
+ if (row.id < (s.openedAtMessageId as number)) return false
103
+ return s.closedAtMessageId == null || row.id <= s.closedAtMessageId
104
+ }
105
+
106
+ const whole = (v: unknown): number | null =>
107
+ typeof v === "number" && Number.isInteger(v) ? v : null
108
+
109
+ /** A row's stamped story day, or null for a row written before stamps. */
110
+ export function storyDayOfRow(row: SceneMarkRow): StoryDayParts | null {
111
+ const year = whole(row.storyClockYear)
112
+ if (year === null) return null
113
+ const month = whole(row.storyClockMonth)
114
+ return { year, month, day: month === null ? null : whole(row.storyClockDay) }
115
+ }
116
+
117
+ /** Whether two story times fall on one day (as precise as both are). */
118
+ export function sameStoryDay(a: StoryDayParts, b: StoryDayParts): boolean {
119
+ return (
120
+ a.year === b.year &&
121
+ (a.month ?? null) === (b.month ?? null) &&
122
+ (a.day ?? null) === (b.day ?? null)
123
+ )
124
+ }
125
+
126
+ /**
127
+ * A story day spelled free-form, the calendar's bottom rung
128
+ * (`formatStoryTime` with no calendar), the time of day left off: `Year
129
+ * 412, Mo. 3, Day 5`. 🚧 What `sceneMarks` spells with when it is handed no
130
+ * `dayLabel` — the conversation hands it the book's calendar's
131
+ * (`storyDayLabelIn`, §15 G9).
132
+ */
133
+ export function storyDayLabel(t: StoryDayParts): string {
134
+ let out = `Year ${Math.trunc(t.year)}`
135
+ if (t.month) out += `, Mo. ${t.month}`
136
+ if (t.month && t.day) out += `, Day ${t.day}`
137
+ return out
138
+ }
139
+
140
+ /** What a scene divider says and holds. */
141
+ export interface SceneDivider {
142
+ scene: SceneMarkScene
143
+ /** Its colour, 0–7. */
144
+ swatch: number
145
+ live: boolean
146
+ /** The lane's open scene: its divider reads *since …* and carries the open mark. */
147
+ open: boolean
148
+ /**
149
+ * The story lines it holds: a closed scene's recorded lines, else the
150
+ * shown lines of its range that are loaded (an open scene's grow).
151
+ */
152
+ lineCount: number
153
+ /** The loaded rows it holds, in conversation order — whose faces it shows. */
154
+ rowIds: number[]
155
+ /** The day a live scene opened on; null for a captured scene, or one opened with no story clock. */
156
+ dateLabel: string | null
157
+ /**
158
+ * 🚧 Where *Move start up one line* moves a live scene's opening: the
159
+ * shown line before it on its lane, when that line is loaded and in no
160
+ * other scene; else null (lane E).
161
+ */
162
+ startEarlier: number | null
163
+ /**
164
+ * 🚧 Where *Move start down one line* moves it: the scene's next shown
165
+ * line on its lane, when the scene would keep a line; else null.
166
+ */
167
+ startLater: number | null
168
+ /**
169
+ * 🚧 *Reopen scene* is offered: a closed live scene with no open scene
170
+ * and no later scene on its lane, so it may run on to the newest line.
171
+ */
172
+ reopens: boolean
173
+ }
174
+
175
+ /** What the log draws between its rows. */
176
+ export interface SceneMarks {
177
+ /** Per row id: the scene it sits in, and that scene's colour. */
178
+ sceneOf: Map<number, { sceneId: number; swatch: number; name: string }>
179
+ /** Per row id: the divider drawn at it — its scene's first loaded row. */
180
+ dividers: Map<number, SceneDivider>
181
+ /** Per row id: the day mark drawn before it. */
182
+ dayMarks: Map<number, { label: string; day: StoryDayParts }>
183
+ }
184
+
185
+ const sceneName = (s: SceneMarkScene) => (s.name?.trim() ? s.name : "Scene")
186
+
187
+ /**
188
+ * The marks over `rows` (conversation order, oldest first). `lane` is the
189
+ * lane the log shows: day marks compare only its rows, since the others are
190
+ * drawn hidden. Absent, every row counts. 🚧 `dayLabel` spells a divider's
191
+ * day and a day mark — the book's calendar's (§15 G9); absent, free-form
192
+ * (`storyDayLabel`).
193
+ */
194
+ export function sceneMarks(
195
+ rows: readonly SceneMarkRow[],
196
+ scenes: readonly SceneMarkScene[],
197
+ opts: { lane?: string; dayLabel?: (t: StoryDayParts) => string } = {}
198
+ ): SceneMarks {
199
+ const dayLabel = opts.dayLabel ?? storyDayLabel
200
+ const sceneOf: SceneMarks["sceneOf"] = new Map()
201
+ const dividers: SceneMarks["dividers"] = new Map()
202
+ const dayMarks: SceneMarks["dayMarks"] = new Map()
203
+ const swatches = sceneSwatches(scenes)
204
+
205
+ // Captured scenes take their ticked lines first…
206
+ const byId = new Map(rows.map((r) => [r.id, r]))
207
+ const holds = new Map<number, number[]>()
208
+ for (const s of scenes) {
209
+ if (isLiveScene(s)) continue
210
+ for (const id of s.selectedMessageIds ?? []) {
211
+ if (!byId.has(id) || sceneOf.has(id)) continue
212
+ sceneOf.set(id, { sceneId: s.id, swatch: swatches.get(s.id) ?? 0, name: sceneName(s) })
213
+ }
214
+ }
215
+ // …then each live range fills what is left on its lane.
216
+ const live = scenes.filter(isLiveScene)
217
+ for (const row of rows) {
218
+ if (sceneOf.has(row.id)) continue
219
+ const s = live.find((x) => liveSceneHolds(x, row))
220
+ if (s) sceneOf.set(row.id, { sceneId: s.id, swatch: swatches.get(s.id) ?? 0, name: sceneName(s) })
221
+ }
222
+ for (const row of rows) {
223
+ const at = sceneOf.get(row.id)
224
+ if (!at) continue
225
+ const list = holds.get(at.sceneId) ?? []
226
+ list.push(row.id)
227
+ holds.set(at.sceneId, list)
228
+ }
229
+
230
+ for (const s of scenes) {
231
+ const ids = holds.get(s.id)
232
+ if (!ids?.length) continue
233
+ const liveScene = isLiveScene(s)
234
+ const open = isOpenScene(s)
235
+ const shown = ids.filter((id) => !byId.get(id)?.isHidden).length
236
+ const recorded = s.selectedMessageIds?.length ?? 0
237
+ // A captured scene's date is its history entry's, which the log's
238
+ // history marker already says above the entry's first scene.
239
+ const when = liveScene ? s.openedAt : null
240
+ const nudge = liveScene ? startNudges(s, rows, sceneOf) : { startEarlier: null, startLater: null }
241
+ dividers.set(ids[0], {
242
+ scene: s,
243
+ swatch: swatches.get(s.id) ?? 0,
244
+ live: liveScene,
245
+ open,
246
+ lineCount: !open && recorded > 0 ? recorded : shown,
247
+ rowIds: ids,
248
+ dateLabel: when && typeof when.year === "number" ? dayLabel(when) : null,
249
+ ...nudge,
250
+ reopens: liveScene && !open && mayReopen(s, live)
251
+ })
252
+ }
253
+
254
+ let last: StoryDayParts | null = null
255
+ for (const row of rows) {
256
+ if (opts.lane !== undefined && (typeof row.channel === "string" && row.channel ? row.channel : "main") !== opts.lane)
257
+ continue
258
+ const day = storyDayOfRow(row)
259
+ if (!day) continue
260
+ if (!last || !sameStoryDay(last, day)) dayMarks.set(row.id, { label: dayLabel(day), day })
261
+ last = day
262
+ }
263
+ return { sceneOf, dividers, dayMarks }
264
+ }
265
+
266
+ /**
267
+ * 🚧 Where a live scene's opening may move by one line (lane E): the shown
268
+ * line before it on its lane — loaded and in no scene — and the scene's own
269
+ * next shown line, while the scene would keep at least one line.
270
+ */
271
+ function startNudges(
272
+ s: SceneMarkScene,
273
+ rows: readonly SceneMarkRow[],
274
+ sceneOf: SceneMarks["sceneOf"],
275
+ ): { startEarlier: number | null; startLater: number | null } {
276
+ const lane = laneOf(s.channel)
277
+ const onLane = rows.filter((r) => laneOf(r.channel) === lane)
278
+ const at = onLane.findIndex((r) => r.id === s.openedAtMessageId)
279
+ if (at < 0) return { startEarlier: null, startLater: null }
280
+ let earlier: SceneMarkRow | undefined
281
+ for (let i = at - 1; i >= 0; i--)
282
+ if (!onLane[i]!.isHidden) {
283
+ earlier = onLane[i]
284
+ break
285
+ }
286
+ let later: SceneMarkRow | undefined
287
+ for (let i = at + 1; i < onLane.length; i++)
288
+ if (!onLane[i]!.isHidden) {
289
+ later = onLane[i]
290
+ break
291
+ }
292
+ return {
293
+ startEarlier: earlier && !sceneOf.has(earlier.id) ? earlier.id : null,
294
+ startLater:
295
+ later &&
296
+ sceneOf.get(later.id)?.sceneId === s.id &&
297
+ (s.closedAtMessageId == null || later.id <= s.closedAtMessageId)
298
+ ? later.id
299
+ : null,
300
+ }
301
+ }
302
+
303
+ /** A closed live scene may run on again: no open scene and no later scene on its lane. */
304
+ function mayReopen(s: SceneMarkScene, live: readonly SceneMarkScene[]): boolean {
305
+ const lane = laneOf(s.channel)
306
+ return !live.some(
307
+ (x) =>
308
+ x.id !== s.id &&
309
+ laneOf(x.channel) === lane &&
310
+ (isOpenScene(x) || (x.openedAtMessageId as number) > (s.openedAtMessageId as number)),
311
+ )
312
+ }
313
+
314
+ /** Which scene boundaries a line's menu may offer. */
315
+ export interface BoundaryOffer {
316
+ /** *Start scene here*: a scene may open at this line. */
317
+ start: boolean
318
+ /** *End scene here*: the open scene this line may close, by id; null when none. */
319
+ end: number | null
320
+ }
321
+
322
+ /**
323
+ * What the host would accept at this line — mirrored so the menu hides what
324
+ * it would refuse (`scenes:open`, `scenes:close`):
325
+ *
326
+ * - **Start** where the line is in no scene captured by selection and in no
327
+ * closed scene, and the lane's open scene (if any) opened before it — the
328
+ * open one is then closed at the line before. With no open scene, every
329
+ * closed scene on the lane must end before the line (a new one runs on to
330
+ * the newest line, and may not cover another).
331
+ * - **End** where the lane's open scene opened at or before the line.
332
+ */
333
+ export function boundaryOffer(row: SceneMarkRow, scenes: readonly SceneMarkScene[]): BoundaryOffer {
334
+ const lane = laneOf(row.channel)
335
+ const onLane = scenes.filter((s) => isLiveScene(s) && laneOf(s.channel) === lane)
336
+ const open = onLane.find(isOpenScene) ?? null
337
+ const captured = scenes.some(
338
+ (s) => !isLiveScene(s) && (s.selectedMessageIds ?? []).includes(row.id)
339
+ )
340
+ const inClosed = onLane.some((s) => !isOpenScene(s) && liveSceneHolds(s, row))
341
+ const start =
342
+ !captured &&
343
+ !inClosed &&
344
+ (open
345
+ ? row.id > (open.openedAtMessageId as number)
346
+ : onLane.every((s) => s.closedAtMessageId != null && s.closedAtMessageId < row.id))
347
+ const end = open && row.id >= (open.openedAtMessageId as number) ? open.id : null
348
+ return { start, end }
349
+ }
350
+
351
+ /**
352
+ * 🚧 Whether a run may become one closed scene (*Mark as scene*, lane E) —
353
+ * what the host would take, mirrored: no line of it on its lane is in a
354
+ * scene captured by selection, and it overlaps no live scene on its lane,
355
+ * except that the lane's open scene, opened before the run, is closed at the
356
+ * line before (as *Start scene here* closes it).
357
+ */
358
+ export function runOffer(
359
+ run: { lane: string; first: number; last: number },
360
+ scenes: readonly SceneMarkScene[],
361
+ rows: readonly SceneMarkRow[],
362
+ ): boolean {
363
+ const onLane = scenes.filter((s) => isLiveScene(s) && laneOf(s.channel) === run.lane)
364
+ for (const s of onLane) {
365
+ const opened = s.openedAtMessageId as number
366
+ if (isOpenScene(s)) {
367
+ if (run.last < opened) continue
368
+ if (run.first <= opened) return false
369
+ continue
370
+ }
371
+ if (run.first <= (s.closedAtMessageId as number) && opened <= run.last) return false
372
+ }
373
+ const captured = new Set(scenes.filter((s) => !isLiveScene(s)).flatMap((s) => s.selectedMessageIds ?? []))
374
+ return !rows.some(
375
+ (r) => r.id >= run.first && r.id <= run.last && laneOf(r.channel) === run.lane && captured.has(r.id),
376
+ )
377
+ }
378
+
379
+ /**
380
+ * The run a selection marks as one scene (*Mark as scene*): from the
381
+ * earliest line picked to the latest picked on that line's lane, or null for
382
+ * an empty selection.
383
+ */
384
+ export function markedRun(
385
+ selected: Iterable<number>,
386
+ rows: readonly SceneMarkRow[]
387
+ ): { lane: string; first: number; last: number } | null {
388
+ const picked = new Set(selected)
389
+ const chosen = rows.filter((r) => picked.has(r.id))
390
+ if (!chosen.length) return null
391
+ const first = chosen.reduce((a, b) => (b.id < a.id ? b : a))
392
+ const lane = laneOf(first.channel)
393
+ const last = chosen
394
+ .filter((r) => laneOf(r.channel) === lane)
395
+ .reduce((a, b) => (b.id > a.id ? b : a))
396
+ return { lane, first: first.id, last: last.id }
397
+ }
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Core's Places widget as a remote component (W4): the component
4
+ * context, as the widget context, around `PlacesWidget`.
5
+ */
6
+ import { setContext, untrack } from "svelte"
7
+ import type { ComponentContext } from "@serene-pub/sdk/component"
8
+ import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
9
+ import PlacesWidget from "./PlacesWidget.svelte"
10
+ import { widgetRefFromComponent } from "../widgetRef.svelte"
11
+
12
+ let { ctx }: { ctx: ComponentContext } = $props()
13
+
14
+ // The context is the mount's, handed once: its sections move, it does not.
15
+ setContext(
16
+ WIDGET_CONTEXT_KEY,
17
+ widgetRefFromComponent(
18
+ untrack(() => ctx),
19
+ { id: "places", instanceId: "places", title: "Places" }
20
+ )
21
+ )
22
+ </script>
23
+
24
+ <PlacesWidget />