@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.
- package/README.md +21 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNote.svelte +1 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNoteWidget.svelte +1 -1
- package/components/{sessions/world-state/WorldState.svelte → shared/actions/Actions.svelte} +5 -5
- package/components/shared/actions/ActionsWidget.svelte +118 -0
- package/components/shared/actions/actions.ts +11 -0
- package/components/shared/album/Album.svelte +24 -0
- package/components/shared/album/AlbumWidget.svelte +163 -0
- package/components/shared/album/album.ts +10 -0
- package/components/shared/annex/Annex.svelte +24 -0
- package/components/shared/annex/AnnexWidget.svelte +151 -0
- package/components/shared/annex/annex.ts +10 -0
- package/components/shared/attendance/Attendance.svelte +24 -0
- package/components/shared/attendance/AttendanceWidget.svelte +136 -0
- package/components/shared/attendance/attendance.ts +12 -0
- package/components/shared/backdrop/Backdrop.svelte +24 -0
- package/components/shared/backdrop/BackdropWidget.svelte +345 -0
- package/components/shared/backdrop/backdrop.ts +10 -0
- package/components/shared/chronicle/Chronicle.svelte +36 -0
- package/components/shared/chronicle/ChronicleWidget.svelte +569 -0
- package/components/shared/chronicle/chronicle.ts +11 -0
- package/components/{sessions → shared}/lore-entries/LoreEntries.svelte +1 -1
- package/components/{sessions → shared}/lore-entries/LoreEntriesWidget.svelte +3 -3
- package/components/shared/map-canvas/MapCanvas.svelte +171 -0
- package/components/shared/map-canvas/index.ts +390 -0
- package/components/{sessions → shared}/messages/MessageComposer.svelte +1 -1
- package/components/{sessions → shared}/messages/MessageControls.svelte +42 -0
- package/components/{sessions → shared}/messages/MessageStateLedger.svelte +19 -8
- package/components/{sessions → shared}/messages/Messages.svelte +1 -1
- package/components/{sessions → shared}/messages/MessagesWidget.svelte +126 -40
- package/components/{sessions → shared}/messages/NextCharacterBlock.svelte +17 -14
- package/components/shared/messages/SceneCueChip.svelte +82 -0
- package/components/shared/messages/SceneDivider.svelte +399 -0
- package/components/{sessions → shared}/messages/SessionComposer.svelte +33 -9
- package/components/shared/messages/SessionContainer.svelte +651 -0
- package/components/{sessions → shared}/messages/SessionMessage.svelte +52 -7
- package/components/shared/messages/TurnLine.svelte +254 -0
- package/components/{sessions → shared}/messages/conversation.svelte.ts +191 -2
- package/components/shared/messages/sceneMarks.ts +397 -0
- package/components/shared/places/Places.svelte +24 -0
- package/components/shared/places/PlacesWidget.svelte +290 -0
- package/components/shared/places/places.ts +11 -0
- package/components/{sessions → shared}/scene-portraits/ScenePortraits.svelte +1 -1
- package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +404 -0
- package/components/{sessions → shared}/state/SlotControl.svelte +9 -1
- package/components/{sessions → shared}/stats/Stats.svelte +1 -1
- package/components/shared/stats/StatsWidget.svelte +350 -0
- package/components/{sessions → shared}/stats/stats.ts +3 -2
- package/components/shared/turn-order/TurnOrder.svelte +24 -0
- package/components/shared/turn-order/TurnOrderWidget.svelte +167 -0
- package/components/shared/turn-order/turn-order.ts +11 -0
- package/components/{sessions/shared → shared}/widgetRef.svelte.ts +9 -2
- package/components/shared/world-state/WorldState.svelte +33 -0
- package/components/shared/world-state/world-state.ts +10 -0
- package/components/tsconfig.json +2 -2
- package/dist/components/actions.js +294 -0
- package/dist/components/actions.source.json +1 -0
- package/dist/components/album.js +386 -0
- package/dist/components/album.source.json +1 -0
- package/dist/components/annex.js +457 -0
- package/dist/components/annex.source.json +1 -0
- package/dist/components/attendance.js +353 -0
- package/dist/components/attendance.source.json +1 -0
- package/dist/components/authors-note.js +5 -5
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +561 -0
- package/dist/components/backdrop.source.json +1 -0
- package/dist/components/chronicle.js +1141 -0
- package/dist/components/chronicle.source.json +1 -0
- package/dist/components/core-ui.json +1 -1
- package/dist/components/lore-entries.js +5 -5
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +3014 -2489
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +1133 -0
- package/dist/components/places.source.json +1 -0
- package/dist/components/scene-portraits.js +514 -345
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/shared-3K7SOGH7.js +16 -0
- package/dist/components/shared-452PIS46.js +156 -0
- package/dist/components/shared-GEDAMORM.js +45 -0
- package/dist/components/{shared-TCQZXBE3.js → shared-GXTL5G2H.js} +4 -3
- package/dist/components/shared-ITSLBJB5.js +478 -0
- package/dist/components/shared-NK7QSVMU.js +400 -0
- package/dist/components/shared-TDWKI2QV.js +58 -0
- package/dist/components/{shared-UAQVMZZK.js → shared-XBPH6USH.js} +586 -18
- package/dist/components/{shared-AINANAIA.js → shared-XISPHAKY.js} +502 -98
- package/dist/components/stats.js +8 -208
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-order.js +461 -0
- package/dist/components/turn-order.source.json +1 -0
- package/dist/components/world-state.js +14 -202
- package/dist/components/world-state.source.json +1 -1
- package/dist/{answerForm.d.ts → factories/answerForm.d.ts} +4 -30
- package/dist/{answerForm.js → factories/answerForm.js} +10 -39
- package/dist/factories/once.d.ts +7 -0
- package/dist/factories/once.js +9 -0
- package/dist/{turnOrder.d.ts → factories/turnOrder.d.ts} +0 -22
- package/dist/{turnOrder.js → factories/turnOrder.js} +4 -104
- package/dist/genres/adventure/advanceTime.d.ts +18 -0
- package/dist/genres/adventure/advanceTime.js +24 -0
- package/dist/genres/adventure/answer.d.ts +23 -0
- package/dist/genres/adventure/answer.js +59 -0
- package/dist/genres/adventure/answerForm.d.ts +9 -0
- package/dist/genres/adventure/answerForm.js +11 -0
- package/dist/genres/adventure/ask.d.ts +73 -0
- package/dist/genres/adventure/ask.js +157 -0
- package/dist/genres/adventure/create.d.ts +36 -0
- package/dist/genres/adventure/create.js +62 -0
- package/dist/genres/adventure/illustrateScene.d.ts +7 -0
- package/dist/genres/adventure/illustrateScene.js +19 -0
- package/dist/genres/adventure/index.d.ts +45 -0
- package/dist/genres/adventure/index.js +45 -0
- package/dist/genres/adventure/keeperAction.d.ts +43 -0
- package/dist/genres/adventure/keeperAction.js +217 -0
- package/dist/genres/adventure/look.d.ts +45 -0
- package/dist/genres/adventure/look.js +209 -0
- package/dist/{adventure.d.ts → genres/adventure/respond.d.ts} +74 -65
- package/dist/{adventure.js → genres/adventure/respond.js} +125 -65
- package/dist/genres/adventure/rest.d.ts +10 -0
- package/dist/genres/adventure/rest.js +16 -0
- package/dist/genres/adventure/summarizeScene.d.ts +7 -0
- package/dist/genres/adventure/summarizeScene.js +14 -0
- package/dist/genres/adventure/turnOrder.d.ts +10 -0
- package/dist/genres/adventure/turnOrder.js +27 -0
- package/dist/genres/chat/advanceTime.d.ts +7 -0
- package/dist/genres/chat/advanceTime.js +17 -0
- package/dist/genres/chat/answerForm.d.ts +9 -0
- package/dist/genres/chat/answerForm.js +11 -0
- package/dist/genres/chat/create.d.ts +7 -0
- package/dist/{createChat.js → genres/chat/create.js} +6 -6
- package/dist/genres/chat/generateImage.d.ts +7 -0
- package/dist/{generateImage.js → genres/chat/generateImage.js} +26 -22
- package/dist/genres/chat/illustrateScene.d.ts +8 -0
- package/dist/genres/chat/illustrateScene.js +19 -0
- package/dist/genres/chat/index.d.ts +18 -0
- package/dist/genres/chat/index.js +19 -0
- package/dist/{narrate.d.ts → genres/chat/narrate.d.ts} +3 -3
- package/dist/{narrate.js → genres/chat/narrate.js} +37 -12
- package/dist/{narrateCharacter.d.ts → genres/chat/narrateCharacter.d.ts} +2 -2
- package/dist/{narrateCharacter.js → genres/chat/narrateCharacter.js} +39 -17
- package/dist/genres/chat/respond.d.ts +25 -0
- package/dist/{respond.js → genres/chat/respond.js} +91 -23
- package/dist/genres/chat/summarizeScene.d.ts +7 -0
- package/dist/genres/chat/summarizeScene.js +14 -0
- package/dist/genres/chat/turnOrder.d.ts +9 -0
- package/dist/genres/chat/turnOrder.js +28 -0
- package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.d.ts +1 -1
- package/dist/genres/guide/answerForm.d.ts +9 -0
- package/dist/genres/guide/answerForm.js +11 -0
- package/dist/genres/guide/create.d.ts +24 -0
- package/dist/genres/guide/create.js +58 -0
- package/dist/genres/guide/index.d.ts +10 -0
- package/dist/genres/guide/index.js +10 -0
- package/dist/{guide.d.ts → genres/guide/respond.d.ts} +1 -20
- package/dist/{guide.js → genres/guide/respond.js} +32 -61
- package/dist/genres/guide/summarizeScene.d.ts +7 -0
- package/dist/genres/guide/summarizeScene.js +14 -0
- package/dist/genres/guide/turnOrder.d.ts +10 -0
- package/dist/genres/guide/turnOrder.js +27 -0
- package/dist/genres/index.d.ts +14 -0
- package/dist/genres/index.js +41 -0
- package/dist/genres/lair/advanceTime.d.ts +7 -0
- package/dist/genres/lair/advanceTime.js +17 -0
- package/dist/genres/lair/answerForm.d.ts +17 -0
- package/dist/genres/lair/answerForm.js +19 -0
- package/dist/genres/lair/buildRoom.d.ts +64 -0
- package/dist/genres/lair/buildRoom.js +244 -0
- package/dist/genres/lair/castellanAction.d.ts +27 -0
- package/dist/genres/lair/castellanAction.js +177 -0
- package/dist/genres/lair/create.d.ts +28 -0
- package/dist/genres/lair/create.js +69 -0
- package/dist/genres/lair/fileRoom.d.ts +53 -0
- package/dist/genres/lair/fileRoom.js +288 -0
- package/dist/genres/lair/index.d.ts +62 -0
- package/dist/genres/lair/index.js +63 -0
- package/dist/genres/lair/nudge.d.ts +25 -0
- package/dist/genres/lair/nudge.js +78 -0
- package/dist/{lair.d.ts → genres/lair/respond.d.ts} +46 -59
- package/dist/{lair.js → genres/lair/respond.js} +55 -76
- package/dist/genres/lair/reveal.d.ts +10 -0
- package/dist/genres/lair/reveal.js +18 -0
- package/dist/genres/lair/roomAnswer.d.ts +86 -0
- package/dist/genres/lair/roomAnswer.js +378 -0
- package/dist/genres/lair/summarizeScene.d.ts +39 -0
- package/dist/genres/lair/summarizeScene.js +51 -0
- package/dist/genres/lair/trap.d.ts +11 -0
- package/dist/genres/lair/trap.js +24 -0
- package/dist/genres/lair/turnOrder.d.ts +9 -0
- package/dist/genres/lair/turnOrder.js +36 -0
- package/dist/genres/lair/whisper.d.ts +35 -0
- package/dist/genres/lair/whisper.js +90 -0
- package/dist/index.d.ts +52 -29
- package/dist/index.js +192 -86
- package/dist/loadouts.d.ts +37 -0
- package/dist/loadouts.js +105 -0
- package/dist/{entries.d.ts → registry/entries.d.ts} +1 -1
- package/dist/{genres.js → registry/genres.js} +40 -6
- package/dist/{ui/sessions → registry}/layouts.d.ts +41 -27
- package/dist/{ui/sessions → registry}/layouts.js +90 -49
- package/dist/{ui/sessions → registry}/widgets.d.ts +22 -0
- package/dist/registry/widgets.js +1294 -0
- package/dist/{presets.js → seed/presets.js} +28 -13
- package/dist/{prompts.d.ts → seed/prompts.d.ts} +10 -5
- package/dist/{prompts.js → seed/prompts.js} +225 -176
- package/dist/{annexField.d.ts → shared/annexField.d.ts} +12 -8
- package/dist/{annexField.js → shared/annexField.js} +16 -15
- package/dist/shared/builtins/branch.d.ts +8 -0
- package/dist/shared/builtins/branch.js +13 -0
- package/dist/{builtins.d.ts → shared/builtins/builtIn.d.ts} +16 -21
- package/dist/{builtins.js → shared/builtins/builtIn.js} +3 -37
- package/dist/shared/builtins/delete.d.ts +8 -0
- package/dist/shared/builtins/delete.js +13 -0
- package/dist/shared/builtins/edit.d.ts +8 -0
- package/dist/shared/builtins/edit.js +13 -0
- package/dist/shared/builtins/hide.d.ts +8 -0
- package/dist/shared/builtins/hide.js +13 -0
- package/dist/shared/builtins/index.d.ts +11 -0
- package/dist/shared/builtins/index.js +11 -0
- package/dist/shared/builtins/swipe.d.ts +8 -0
- package/dist/shared/builtins/swipe.js +17 -0
- package/dist/shared/describeLikeness.d.ts +14 -0
- package/dist/shared/describeLikeness.js +65 -0
- package/dist/shared/illustrateScene.d.ts +28 -0
- package/dist/shared/illustrateScene.js +181 -0
- package/dist/shared/portrait.d.ts +21 -0
- package/dist/shared/portrait.js +101 -0
- package/dist/shared/spriteFill.d.ts +14 -0
- package/dist/shared/spriteFill.js +107 -0
- package/dist/shared/sprites.d.ts +34 -0
- package/dist/shared/sprites.js +98 -0
- package/dist/shared/summarize/character.d.ts +9 -0
- package/dist/shared/summarize/character.js +10 -0
- package/dist/shared/summarize/history.d.ts +9 -0
- package/dist/shared/summarize/history.js +10 -0
- package/dist/shared/summarize/index.d.ts +12 -0
- package/dist/shared/summarize/index.js +12 -0
- package/dist/shared/summarize/scene.d.ts +38 -0
- package/dist/shared/summarize/scene.js +42 -0
- package/dist/shared/summarize/sceneIds.d.ts +17 -0
- package/dist/shared/summarize/sceneIds.js +17 -0
- package/dist/shared/summarize/summarizeScene.d.ts +113 -0
- package/dist/shared/summarize/summarizeScene.js +234 -0
- package/dist/shared/summarize/summarizeSpec.d.ts +54 -0
- package/dist/{summarize.js → shared/summarize/summarizeSpec.js} +23 -53
- package/dist/shared/summarize/world.d.ts +8 -0
- package/dist/shared/summarize/world.js +9 -0
- package/dist/shared/timePasses.d.ts +56 -0
- package/dist/shared/timePasses.js +86 -0
- package/dist/{toolLoop.d.ts → shared/toolLoop.d.ts} +25 -3
- package/dist/{toolLoop.js → shared/toolLoop.js} +70 -14
- package/dist/shared/ui/actions/index.d.ts +117 -0
- package/dist/shared/ui/actions/index.js +154 -0
- package/dist/shared/ui/album/index.d.ts +115 -0
- package/dist/shared/ui/album/index.js +178 -0
- package/dist/shared/ui/annex/index.d.ts +163 -0
- package/dist/shared/ui/annex/index.js +273 -0
- package/dist/shared/ui/attendance/index.d.ts +97 -0
- package/dist/shared/ui/attendance/index.js +89 -0
- package/dist/shared/ui/backdrop/index.d.ts +78 -0
- package/dist/shared/ui/backdrop/index.js +98 -0
- package/dist/shared/ui/chronicle/index.d.ts +230 -0
- package/dist/shared/ui/chronicle/index.js +249 -0
- package/dist/shared/ui/conversation/dossier.d.ts +33 -0
- package/dist/shared/ui/conversation/dossier.js +31 -0
- package/dist/{ui/sessions → shared/ui}/conversation/index.d.ts +2 -1
- package/dist/{ui/sessions → shared/ui}/conversation/index.js +3 -1
- package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.d.ts +1 -1
- package/dist/shared/ui/conversation/storyDays.d.ts +21 -0
- package/dist/shared/ui/conversation/storyDays.js +23 -0
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.js +1 -1
- package/dist/{ui/sessions → shared/ui}/lore-entries/index.d.ts +2 -2
- package/dist/shared/ui/places/index.d.ts +148 -0
- package/dist/shared/ui/places/index.js +249 -0
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.js +1 -1
- package/dist/shared/ui/scene-portraits/portraits.d.ts +191 -0
- package/dist/shared/ui/scene-portraits/portraits.js +223 -0
- package/dist/shared/ui/session-state/index.d.ts +16 -0
- package/dist/shared/ui/session-state/index.js +16 -0
- package/dist/{ui/sessions → shared/ui}/session-state/shapes.d.ts +2 -2
- package/dist/shared/ui/session-state/stateView.d.ts +249 -0
- package/dist/shared/ui/session-state/stateView.js +247 -0
- package/dist/shared/ui/turn-order/index.d.ts +146 -0
- package/dist/shared/ui/turn-order/index.js +257 -0
- package/dist/{ui/sessions → shared/ui}/widgetContext.d.ts +19 -10
- package/package.json +69 -30
- package/components/sessions/messages/SessionContainer.svelte +0 -459
- package/components/sessions/scene-portraits/ScenePortraitsWidget.svelte +0 -249
- package/components/sessions/stats/StatsWidget.svelte +0 -112
- package/components/sessions/world-state/WorldStateWidget.svelte +0 -112
- package/components/sessions/world-state/world-state.ts +0 -10
- package/dist/adventureActions.d.ts +0 -169
- package/dist/adventureActions.js +0 -599
- package/dist/createChat.d.ts +0 -7
- package/dist/generateImage.d.ts +0 -7
- package/dist/lairActions.d.ts +0 -296
- package/dist/lairActions.js +0 -1287
- package/dist/respond.d.ts +0 -24
- package/dist/sprites.d.ts +0 -24
- package/dist/sprites.js +0 -102
- package/dist/summarize.d.ts +0 -76
- package/dist/ui/sessions/conversation/dossier.d.ts +0 -328
- package/dist/ui/sessions/conversation/dossier.js +0 -31
- package/dist/ui/sessions/scene-portraits/portraits.d.ts +0 -95
- package/dist/ui/sessions/scene-portraits/portraits.js +0 -115
- package/dist/ui/sessions/session-state/index.d.ts +0 -15
- package/dist/ui/sessions/session-state/index.js +0 -15
- package/dist/ui/sessions/session-state/stateView.d.ts +0 -155
- package/dist/ui/sessions/session-state/stateView.js +0 -141
- package/dist/ui/sessions/widgets.js +0 -567
- package/components/{sessions → genres/chat}/authors-note/authors-note.ts +0 -0
- package/components/{sessions/shared → shared}/context.ts +0 -0
- package/components/{sessions → shared}/lore-entries/lore-entries.ts +0 -0
- package/components/{sessions → shared}/messages/MessageBlocksView.svelte +0 -0
- package/components/{sessions → shared}/messages/MessageMediaStrip.svelte +0 -0
- package/components/{sessions → shared}/messages/MessagePartsView.svelte +0 -0
- package/components/{sessions → shared}/messages/StateProposalList.svelte +0 -0
- package/components/{sessions → shared}/messages/mediaStrip.ts +0 -0
- package/components/{sessions → shared}/messages/messages.ts +0 -0
- package/components/{sessions → shared}/scene-portraits/StatBars.svelte +0 -0
- package/components/{sessions → shared}/scene-portraits/scene-portraits.ts +0 -0
- package/components/{sessions → shared}/state/entryFinder.ts +0 -0
- package/components/{sessions → shared}/state/slotWriter.svelte.ts +0 -0
- package/dist/components/{shared-RJDGOAVC.js → shared-FTRGUE7G.js} +78 -78
- /package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.js +0 -0
- /package/dist/{entries.js → registry/entries.js} +0 -0
- /package/dist/{genres.d.ts → registry/genres.d.ts} +0 -0
- /package/dist/{slots.d.ts → registry/slots.d.ts} +0 -0
- /package/dist/{slots.js → registry/slots.js} +0 -0
- /package/dist/{statShapes.d.ts → registry/statShapes.d.ts} +0 -0
- /package/dist/{statShapes.js → registry/statShapes.js} +0 -0
- /package/dist/{guideMascotImage.d.ts → seed/guideMascotImage.d.ts} +0 -0
- /package/dist/{guideMascotImage.js → seed/guideMascotImage.js} +0 -0
- /package/dist/{presets.d.ts → seed/presets.d.ts} +0 -0
- /package/dist/{graphBuild.d.ts → shared/graphBuild.d.ts} +0 -0
- /package/dist/{graphBuild.js → shared/graphBuild.js} +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/lore-entries/index.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/shapes.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/widgetContext.js +0 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Chronicle (PLAN-core-widgets W3): when are we in the story, and what
|
|
4
|
+
* has the lorebook recorded of this session. Top to bottom: the story
|
|
5
|
+
* clock, **Now** (the history entry the session reads), that entry's
|
|
6
|
+
* scenes from this session, and **Earlier**, folded.
|
|
7
|
+
*
|
|
8
|
+
* It reads its settings, the viewer and the session; everything else is
|
|
9
|
+
* asked of the page. One `history-entries` reads it all (the declared
|
|
10
|
+
* `lore` scope is the grant for it), and it asks again whenever the page
|
|
11
|
+
* says `story:moved` — a clock moved by a pipeline or the settings, an
|
|
12
|
+
* entry added in the lorebook, a scene captured — and after each of its
|
|
13
|
+
* own presses. The view is the plain half's (`chronicleView`); this only
|
|
14
|
+
* draws it and presses.
|
|
15
|
+
*
|
|
16
|
+
* Writes are the session owner's: the clock's step, *Move the clock…*
|
|
17
|
+
* and *Follow the line's present* (`set-story-clock`), *Start new history
|
|
18
|
+
* entry* (`start-history-entry`, then the new entry opens in the
|
|
19
|
+
* lorebook), *Summarize scene* (`summarize` with no lines: the
|
|
20
|
+
* conversation's selection starts) and *Extend graph* (`extend-graph`).
|
|
21
|
+
* A guest reads the clock alone. What the page declines is said here
|
|
22
|
+
* (R77), never a toast.
|
|
23
|
+
*
|
|
24
|
+
* 🚧 Live scenes (§7, lane D): under the clock, the **Open scene** card —
|
|
25
|
+
* its name, since when, its lines, its proposed cast with each one's
|
|
26
|
+
* evidence, *Close scene* (`scene-close`) and *Close and summarize* (the
|
|
27
|
+
* close, then `summarize-scenes` naming it). Each scene row carries its
|
|
28
|
+
* summary dot (none · running · review · done · failed) and *Summarize*
|
|
29
|
+
* (`summarize-scenes` naming it) — 🚧 or, while its finished run waits
|
|
30
|
+
* in `review` (§15 G8), *Ready to review* (`summarize` naming the scene:
|
|
31
|
+
* the host opens that run's review); *Summarize all (N)* asks for every
|
|
32
|
+
* scene with no summary yet. While a scene is open it asks again when a
|
|
33
|
+
* line arrives, so its line count keeps up.
|
|
34
|
+
*
|
|
35
|
+
* The markup carries no look (STYLE-GUIDE §6.16): its elements carry
|
|
36
|
+
* `chronicle.*` widget parts; a scene's colour rides on its swatch's
|
|
37
|
+
* `data-swatch`, an entry that says nothing yet on `data-blank`. Earlier
|
|
38
|
+
* folds in the host's accordion (`sp-accordion`), as the author's
|
|
39
|
+
* note's Advanced does.
|
|
40
|
+
*/
|
|
41
|
+
import { untrack } from "svelte"
|
|
42
|
+
import type { HistoryEntriesV1, WidgetRequests } from "@serene-pub/sdk/component"
|
|
43
|
+
import {
|
|
44
|
+
chronicleClockDraft,
|
|
45
|
+
chronicleClockFromDraft,
|
|
46
|
+
chronicleView,
|
|
47
|
+
readChronicleSettings,
|
|
48
|
+
type ChronicleClockDraft
|
|
49
|
+
} from "@serene-pub/core-catalog/chronicle"
|
|
50
|
+
import { useWidgetContext } from "../context"
|
|
51
|
+
|
|
52
|
+
/** Whether to ask the page yet: false until the host has posted this instance's settings. */
|
|
53
|
+
let { ready = true }: { ready?: boolean } = $props()
|
|
54
|
+
|
|
55
|
+
const widget = useWidgetContext()
|
|
56
|
+
const t = (source: string): string => widget?.current?.t(source) ?? source
|
|
57
|
+
const uid = $props.id()
|
|
58
|
+
|
|
59
|
+
const settings = $derived(
|
|
60
|
+
readChronicleSettings(widget?.current?.settings?.v1)
|
|
61
|
+
)
|
|
62
|
+
// Primitives, so a push that changes neither asks nothing again.
|
|
63
|
+
const earlierCount = $derived(settings.earlierCount)
|
|
64
|
+
const sessionId = $derived(widget?.current?.session?.v1?.id ?? null)
|
|
65
|
+
|
|
66
|
+
let answer = $state<HistoryEntriesV1 | null>(null)
|
|
67
|
+
/** Why the page could not be read, or declined a press — this widget's own. */
|
|
68
|
+
let alert = $state<string | null>(null)
|
|
69
|
+
/** A press in flight: its controls wait. */
|
|
70
|
+
let busy = $state<string | null>(null)
|
|
71
|
+
|
|
72
|
+
const view = $derived(chronicleView(answer, settings, widget?.current?.viewer?.v1, t))
|
|
73
|
+
|
|
74
|
+
const reason = (e: unknown) => (e instanceof Error ? e.message : String(e))
|
|
75
|
+
|
|
76
|
+
// Which answer to show is this widget's: the latest ask's.
|
|
77
|
+
let asked = 0
|
|
78
|
+
function ask() {
|
|
79
|
+
const ctx = untrack(() => widget?.current)
|
|
80
|
+
if (!ctx) return
|
|
81
|
+
const ticket = ++asked
|
|
82
|
+
const params: WidgetRequests["history-entries"]["params"] = {
|
|
83
|
+
earlierLimit: untrack(() => earlierCount)
|
|
84
|
+
}
|
|
85
|
+
ctx.request("history-entries", params).then(
|
|
86
|
+
(res) => {
|
|
87
|
+
if (ticket !== asked) return
|
|
88
|
+
answer = res
|
|
89
|
+
},
|
|
90
|
+
(e) => {
|
|
91
|
+
if (ticket !== asked) return
|
|
92
|
+
alert = t("Not read: {reason}").replace("{reason}", reason(e))
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// The session, or how many earlier entries to show, moved: ask again.
|
|
98
|
+
$effect(() => {
|
|
99
|
+
if (!ready) return
|
|
100
|
+
void sessionId
|
|
101
|
+
void earlierCount
|
|
102
|
+
untrack(() => {
|
|
103
|
+
alert = null
|
|
104
|
+
ask()
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// The story moved somewhere else (R81's shape): ask again, once per burst.
|
|
109
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
110
|
+
$effect(() =>
|
|
111
|
+
untrack(() => {
|
|
112
|
+
const off = widget?.current?.on("story:moved", () => {
|
|
113
|
+
clearTimeout(timer)
|
|
114
|
+
timer = setTimeout(() => ready && ask(), 150)
|
|
115
|
+
})
|
|
116
|
+
return () => {
|
|
117
|
+
clearTimeout(timer)
|
|
118
|
+
off?.()
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
/** Press `kind` with `params`; the page's refusal is this widget's line. */
|
|
124
|
+
async function press<K extends keyof WidgetRequests>(
|
|
125
|
+
name: string,
|
|
126
|
+
kind: K,
|
|
127
|
+
params: WidgetRequests[K]["params"]
|
|
128
|
+
): Promise<WidgetRequests[K]["result"] | undefined> {
|
|
129
|
+
const ctx = untrack(() => widget?.current)
|
|
130
|
+
if (!ctx || busy) return undefined
|
|
131
|
+
busy = name
|
|
132
|
+
alert = null
|
|
133
|
+
try {
|
|
134
|
+
return await ctx.request(kind, params)
|
|
135
|
+
} catch (e) {
|
|
136
|
+
alert = t("Not done: {reason}").replace("{reason}", reason(e))
|
|
137
|
+
return undefined
|
|
138
|
+
} finally {
|
|
139
|
+
busy = null
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// A line arrived while a scene is open: its count moved. Asked again
|
|
144
|
+
// once per burst, and only while the card is showing.
|
|
145
|
+
let lineTimer: ReturnType<typeof setTimeout> | undefined
|
|
146
|
+
$effect(() =>
|
|
147
|
+
untrack(() => {
|
|
148
|
+
const off = widget?.current?.on("message:created", () => {
|
|
149
|
+
if (!answer?.openScene) return
|
|
150
|
+
clearTimeout(lineTimer)
|
|
151
|
+
lineTimer = setTimeout(() => ready && ask(), 800)
|
|
152
|
+
})
|
|
153
|
+
return () => {
|
|
154
|
+
clearTimeout(lineTimer)
|
|
155
|
+
off?.()
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
// ── the open scene and the summaries (live scenes §7) ──────────────────
|
|
161
|
+
/** Close the open scene; with `summarize`, then summarize it in the background. */
|
|
162
|
+
async function closeOpenScene(sceneId: number, summarize: boolean) {
|
|
163
|
+
const closed = await press(summarize ? "close-summarize" : "close", "scene-close", { sceneId })
|
|
164
|
+
if (!closed) return
|
|
165
|
+
if (summarize) await press("summarize", "summarize-scenes", { sceneIds: [sceneId] })
|
|
166
|
+
ask()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Summarize `sceneIds` in the background — or, with none, every scene with no summary yet. */
|
|
170
|
+
async function summarizeScenes(sceneIds?: number[]) {
|
|
171
|
+
const done = await press("summarize", "summarize-scenes", sceneIds ? { sceneIds } : {})
|
|
172
|
+
if (done) ask()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// ── the clock ────────────────────────────────────────────────────────────
|
|
176
|
+
let moving = $state(false)
|
|
177
|
+
let draft = $state<ChronicleClockDraft>(chronicleClockDraft(null))
|
|
178
|
+
let formProblem = $state<string | null>(null)
|
|
179
|
+
|
|
180
|
+
function openMove() {
|
|
181
|
+
draft = chronicleClockDraft(answer?.clock.present)
|
|
182
|
+
formProblem = null
|
|
183
|
+
moving = !moving
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function moveClock(params: WidgetRequests["set-story-clock"]["params"], name: string) {
|
|
187
|
+
const clock = await press(name, "set-story-clock", params)
|
|
188
|
+
if (!clock) return false
|
|
189
|
+
if (answer) answer = { ...answer, clock }
|
|
190
|
+
ask()
|
|
191
|
+
return true
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Set the clock to the form's date (Set the clock, or Enter in a field). */
|
|
195
|
+
async function submitMove() {
|
|
196
|
+
const read = chronicleClockFromDraft(draft)
|
|
197
|
+
if (read.problem !== undefined) {
|
|
198
|
+
formProblem = t(read.problem)
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
formProblem = null
|
|
202
|
+
if (await moveClock({ to: read.to }, "move")) moving = false
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const FIELDS: { key: keyof ChronicleClockDraft; label: string }[] = [
|
|
206
|
+
{ key: "year", label: "Year" },
|
|
207
|
+
{ key: "month", label: "Month" },
|
|
208
|
+
{ key: "day", label: "Day" },
|
|
209
|
+
{ key: "hour", label: "Hour" },
|
|
210
|
+
{ key: "minute", label: "Minute" }
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
// ── the entries and scenes ───────────────────────────────────────────────
|
|
214
|
+
function openEntry(entryId?: number) {
|
|
215
|
+
const lorebookId = answer?.lorebookId ?? undefined
|
|
216
|
+
void press("open", "open-lore", {
|
|
217
|
+
...(lorebookId != null ? { lorebookId } : {}),
|
|
218
|
+
scope: "history",
|
|
219
|
+
...(entryId != null ? { entryId } : {})
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function openScene(sceneId: number) {
|
|
224
|
+
const lorebookId = answer?.lorebookId ?? undefined
|
|
225
|
+
void press("open", "open-lore", {
|
|
226
|
+
...(lorebookId != null ? { lorebookId } : {}),
|
|
227
|
+
scope: "scenes",
|
|
228
|
+
sceneId
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async function startEntry() {
|
|
233
|
+
const made = await press("start", "start-history-entry", {})
|
|
234
|
+
if (!made) return
|
|
235
|
+
ask()
|
|
236
|
+
// The new entry opens in the lorebook, ready to write — the pane's
|
|
237
|
+
// old behaviour, and only for the press made here.
|
|
238
|
+
openEntry(made.entryId)
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<div data-widget-part="chronicle.root" data-widget="chronicle" data-state={view.state}>
|
|
243
|
+
{#if view.state === "no-book"}
|
|
244
|
+
<p data-widget-part="chronicle.empty empty">{view.empty}</p>
|
|
245
|
+
{:else}
|
|
246
|
+
{#if alert}
|
|
247
|
+
<p data-widget-part="chronicle.alert" role="alert">{alert}</p>
|
|
248
|
+
{/if}
|
|
249
|
+
|
|
250
|
+
{#if view.clock}
|
|
251
|
+
<section data-widget-part="chronicle.clock" aria-label={t("Story clock")}>
|
|
252
|
+
<div data-widget-part="chronicle.clock-head">
|
|
253
|
+
<span data-widget-part="chronicle.clock-date">{view.clock.date}</span>
|
|
254
|
+
{#if view.clock.behind}
|
|
255
|
+
<span data-widget-part="chronicle.behind chip" title={view.clock.behindTitle}>
|
|
256
|
+
{view.clock.behind}
|
|
257
|
+
</span>
|
|
258
|
+
{/if}
|
|
259
|
+
</div>
|
|
260
|
+
<p data-widget-part="chronicle.clock-note">{view.clock.note}</p>
|
|
261
|
+
{#if view.clock.canMove}
|
|
262
|
+
<div data-widget-part="chronicle.clock-controls toolbar">
|
|
263
|
+
{#if view.clock.step}
|
|
264
|
+
{@const step = view.clock.step}
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
data-widget-part="chronicle.step"
|
|
268
|
+
disabled={!!busy}
|
|
269
|
+
onclick={() => moveClock({ by: step.by, unit: step.unit }, "step")}
|
|
270
|
+
>
|
|
271
|
+
<sp-icon name="chevron-right" size="14"></sp-icon>
|
|
272
|
+
{step.label}
|
|
273
|
+
</button>
|
|
274
|
+
{/if}
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
data-widget-part="chronicle.move"
|
|
278
|
+
aria-expanded={moving}
|
|
279
|
+
disabled={!!busy}
|
|
280
|
+
onclick={openMove}
|
|
281
|
+
>
|
|
282
|
+
<sp-icon name="calendar-clock" size="14"></sp-icon>
|
|
283
|
+
{t("Move the clock…")}
|
|
284
|
+
</button>
|
|
285
|
+
{#if view.clock.canFollow}
|
|
286
|
+
<button
|
|
287
|
+
type="button"
|
|
288
|
+
data-widget-part="chronicle.follow"
|
|
289
|
+
disabled={!!busy}
|
|
290
|
+
onclick={() => moveClock({ follow: true }, "follow")}
|
|
291
|
+
>
|
|
292
|
+
{t("Follow the line's present")}
|
|
293
|
+
</button>
|
|
294
|
+
{/if}
|
|
295
|
+
</div>
|
|
296
|
+
{#if moving}
|
|
297
|
+
<div
|
|
298
|
+
id="{uid}-move"
|
|
299
|
+
role="group"
|
|
300
|
+
aria-label={t("Move the clock")}
|
|
301
|
+
data-widget-part="chronicle.move-form"
|
|
302
|
+
>
|
|
303
|
+
<div data-widget-part="chronicle.fields">
|
|
304
|
+
{#each FIELDS as f (f.key)}
|
|
305
|
+
<label data-widget-part="chronicle.field">
|
|
306
|
+
<span data-widget-part="chronicle.field-label label">{t(f.label)}</span>
|
|
307
|
+
<input
|
|
308
|
+
type="text"
|
|
309
|
+
data-widget-part="chronicle.field-input"
|
|
310
|
+
name={f.key}
|
|
311
|
+
value={draft[f.key]}
|
|
312
|
+
oninput={(e) => (draft = { ...draft, [f.key]: e.currentTarget.value })}
|
|
313
|
+
onkeydown={(e) => {
|
|
314
|
+
if (e.key === "Enter") {
|
|
315
|
+
e.preventDefault()
|
|
316
|
+
void submitMove()
|
|
317
|
+
}
|
|
318
|
+
}}
|
|
319
|
+
/>
|
|
320
|
+
</label>
|
|
321
|
+
{/each}
|
|
322
|
+
</div>
|
|
323
|
+
{#if formProblem}
|
|
324
|
+
<p data-widget-part="chronicle.alert" role="alert">{formProblem}</p>
|
|
325
|
+
{/if}
|
|
326
|
+
<div data-widget-part="chronicle.form-actions toolbar">
|
|
327
|
+
<button type="button" data-widget-part="chronicle.cancel" onclick={() => (moving = false)}>
|
|
328
|
+
{t("Cancel")}
|
|
329
|
+
</button>
|
|
330
|
+
<button
|
|
331
|
+
type="button"
|
|
332
|
+
data-widget-part="chronicle.save"
|
|
333
|
+
disabled={!!busy}
|
|
334
|
+
onclick={submitMove}
|
|
335
|
+
>
|
|
336
|
+
{t("Set the clock")}
|
|
337
|
+
</button>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
{/if}
|
|
341
|
+
{/if}
|
|
342
|
+
</section>
|
|
343
|
+
{/if}
|
|
344
|
+
|
|
345
|
+
{#if view.ownerOnly}
|
|
346
|
+
<p data-widget-part="chronicle.note">{view.ownerOnly}</p>
|
|
347
|
+
{:else if view.state === "ready"}
|
|
348
|
+
{#if view.openScene}
|
|
349
|
+
{@const open = view.openScene}
|
|
350
|
+
<section
|
|
351
|
+
data-widget-part="chronicle.open-scene card"
|
|
352
|
+
data-scene-id={open.id}
|
|
353
|
+
aria-labelledby="{uid}-open-scene"
|
|
354
|
+
>
|
|
355
|
+
<h3 id="{uid}-open-scene" data-widget-part="chronicle.heading label">{t("Open scene")}</h3>
|
|
356
|
+
<div data-widget-part="chronicle.open-scene-head">
|
|
357
|
+
<span data-widget-part="chronicle.scene-swatch" data-swatch={open.swatch}></span>
|
|
358
|
+
<span data-widget-part="chronicle.open-scene-name">{open.name}</span>
|
|
359
|
+
</div>
|
|
360
|
+
<p data-widget-part="chronicle.open-scene-meta">
|
|
361
|
+
{#if open.since}<span data-widget-part="chronicle.open-scene-since">{open.since}</span>{/if}
|
|
362
|
+
<span data-widget-part="chronicle.scene-span">{open.span}</span>
|
|
363
|
+
</p>
|
|
364
|
+
{#if open.cast.length}
|
|
365
|
+
<ul data-widget-part="chronicle.cast list" aria-label={t("Proposed cast")}>
|
|
366
|
+
{#each open.cast as member, i (i)}
|
|
367
|
+
<li data-widget-part="chronicle.cast-member chip" title={member.evidence}>
|
|
368
|
+
{member.name}
|
|
369
|
+
<span data-widget-part="chronicle.cast-evidence">{member.evidence}</span>
|
|
370
|
+
</li>
|
|
371
|
+
{/each}
|
|
372
|
+
</ul>
|
|
373
|
+
{/if}
|
|
374
|
+
{#if open.canClose}
|
|
375
|
+
<div data-widget-part="chronicle.open-scene-actions toolbar">
|
|
376
|
+
<button
|
|
377
|
+
type="button"
|
|
378
|
+
data-widget-part="chronicle.close"
|
|
379
|
+
disabled={!!busy}
|
|
380
|
+
onclick={() => closeOpenScene(open.id, false)}
|
|
381
|
+
>
|
|
382
|
+
<sp-icon name="flag-off" size="14"></sp-icon>
|
|
383
|
+
{t("Close scene")}
|
|
384
|
+
</button>
|
|
385
|
+
{#if open.canCloseAndSummarize}
|
|
386
|
+
<button
|
|
387
|
+
type="button"
|
|
388
|
+
data-widget-part="chronicle.close-summarize"
|
|
389
|
+
disabled={!!busy}
|
|
390
|
+
onclick={() => closeOpenScene(open.id, true)}
|
|
391
|
+
>
|
|
392
|
+
<sp-icon name="film" size="14"></sp-icon>
|
|
393
|
+
{t("Close and summarize")}
|
|
394
|
+
</button>
|
|
395
|
+
{/if}
|
|
396
|
+
</div>
|
|
397
|
+
{/if}
|
|
398
|
+
{#if open.note}
|
|
399
|
+
<p data-widget-part="chronicle.open-scene-note">{open.note}</p>
|
|
400
|
+
{/if}
|
|
401
|
+
</section>
|
|
402
|
+
{/if}
|
|
403
|
+
|
|
404
|
+
<section data-widget-part="chronicle.now" aria-labelledby="{uid}-now">
|
|
405
|
+
<h3 id="{uid}-now" data-widget-part="chronicle.heading label">{t("Now")}</h3>
|
|
406
|
+
{#if view.now}
|
|
407
|
+
<div data-widget-part="chronicle.entry card" data-entry-id={view.now.id}>
|
|
408
|
+
<span data-widget-part="chronicle.entry-date">{view.now.date}</span>
|
|
409
|
+
<span data-widget-part="chronicle.entry-line" data-blank={view.now.blank ? "" : undefined}>
|
|
410
|
+
{view.now.firstLine}
|
|
411
|
+
</span>
|
|
412
|
+
<span data-widget-part="chronicle.entry-scenes">{view.now.scenes}</span>
|
|
413
|
+
</div>
|
|
414
|
+
{:else}
|
|
415
|
+
<p data-widget-part="chronicle.empty empty">{view.nowEmpty}</p>
|
|
416
|
+
{/if}
|
|
417
|
+
<div data-widget-part="chronicle.toolbar toolbar">
|
|
418
|
+
<button
|
|
419
|
+
type="button"
|
|
420
|
+
data-widget-part="chronicle.open"
|
|
421
|
+
onclick={() => openEntry(view.now?.id)}
|
|
422
|
+
>
|
|
423
|
+
<sp-icon name="external-link" size="14"></sp-icon>
|
|
424
|
+
{t("Open in lorebook")}
|
|
425
|
+
</button>
|
|
426
|
+
{#if view.canWrite && view.now}
|
|
427
|
+
<button
|
|
428
|
+
type="button"
|
|
429
|
+
data-widget-part="chronicle.start"
|
|
430
|
+
disabled={!!busy}
|
|
431
|
+
onclick={startEntry}
|
|
432
|
+
>
|
|
433
|
+
<sp-icon name="plus" size="14"></sp-icon>
|
|
434
|
+
{t("Start new history entry")}
|
|
435
|
+
</button>
|
|
436
|
+
{/if}
|
|
437
|
+
</div>
|
|
438
|
+
</section>
|
|
439
|
+
|
|
440
|
+
{#if view.now}
|
|
441
|
+
<section data-widget-part="chronicle.scenes" aria-labelledby="{uid}-scenes">
|
|
442
|
+
<h3 id="{uid}-scenes" data-widget-part="chronicle.heading label">{t("Scenes")}</h3>
|
|
443
|
+
{#if view.scenes.length}
|
|
444
|
+
<ul data-widget-part="chronicle.scene-list list">
|
|
445
|
+
{#each view.scenes as s (s.id)}
|
|
446
|
+
<li
|
|
447
|
+
data-widget-part="chronicle.scene row"
|
|
448
|
+
data-scene-id={s.id}
|
|
449
|
+
data-open={s.open ? "" : undefined}
|
|
450
|
+
>
|
|
451
|
+
<button
|
|
452
|
+
type="button"
|
|
453
|
+
data-widget-part="chronicle.scene-open"
|
|
454
|
+
title={t("Open in lorebook")}
|
|
455
|
+
onclick={() => openScene(s.id)}
|
|
456
|
+
>
|
|
457
|
+
<span data-widget-part="chronicle.scene-swatch" data-swatch={s.swatch}></span>
|
|
458
|
+
<span data-widget-part="chronicle.scene-name">{s.name}</span>
|
|
459
|
+
<span data-widget-part="chronicle.scene-span">{s.span}</span>
|
|
460
|
+
<span
|
|
461
|
+
data-widget-part="chronicle.scene-status"
|
|
462
|
+
data-status={s.status}
|
|
463
|
+
role="img"
|
|
464
|
+
aria-label={s.statusLabel}
|
|
465
|
+
title={s.statusLabel}
|
|
466
|
+
></span>
|
|
467
|
+
</button>
|
|
468
|
+
{#if s.canSummarize}
|
|
469
|
+
<button
|
|
470
|
+
type="button"
|
|
471
|
+
data-widget-part="chronicle.scene-summarize"
|
|
472
|
+
title={t("Summarize this scene in the background")}
|
|
473
|
+
disabled={!!busy}
|
|
474
|
+
onclick={() => summarizeScenes([s.id])}
|
|
475
|
+
>
|
|
476
|
+
{t("Summarize")}
|
|
477
|
+
</button>
|
|
478
|
+
{:else if s.canReview}
|
|
479
|
+
<!-- 🚧 §15 G8: the run finished; its review opens in the host. -->
|
|
480
|
+
<button
|
|
481
|
+
type="button"
|
|
482
|
+
data-widget-part="chronicle.scene-summarize chronicle.scene-review"
|
|
483
|
+
title={t("Its summary is ready: open the review to apply or discard it")}
|
|
484
|
+
disabled={!!busy}
|
|
485
|
+
onclick={() => press("review", "summarize", { kind: "scene", sceneId: s.id })}
|
|
486
|
+
>
|
|
487
|
+
{t("Ready to review")}
|
|
488
|
+
</button>
|
|
489
|
+
{/if}
|
|
490
|
+
</li>
|
|
491
|
+
{/each}
|
|
492
|
+
</ul>
|
|
493
|
+
{:else}
|
|
494
|
+
<p data-widget-part="chronicle.empty empty">{view.scenesEmpty}</p>
|
|
495
|
+
{/if}
|
|
496
|
+
{#if view.canSummarize || view.extend || view.summarizeAll}
|
|
497
|
+
<div data-widget-part="chronicle.scene-actions toolbar">
|
|
498
|
+
{#if view.canSummarize}
|
|
499
|
+
<button
|
|
500
|
+
type="button"
|
|
501
|
+
data-widget-part="chronicle.summarize"
|
|
502
|
+
disabled={!!busy}
|
|
503
|
+
onclick={() => press("summarize", "summarize", { kind: "scene" })}
|
|
504
|
+
>
|
|
505
|
+
<sp-icon name="film" size="14"></sp-icon>
|
|
506
|
+
{t("Summarize scene")}
|
|
507
|
+
</button>
|
|
508
|
+
{/if}
|
|
509
|
+
{#if view.summarizeAll}
|
|
510
|
+
{@const all = view.summarizeAll}
|
|
511
|
+
<button
|
|
512
|
+
type="button"
|
|
513
|
+
data-widget-part="chronicle.summarize-all"
|
|
514
|
+
title={all.title}
|
|
515
|
+
disabled={!!busy}
|
|
516
|
+
onclick={() => summarizeScenes()}
|
|
517
|
+
>
|
|
518
|
+
<sp-icon name="film" size="14"></sp-icon>
|
|
519
|
+
{all.label}
|
|
520
|
+
</button>
|
|
521
|
+
{/if}
|
|
522
|
+
{#if view.extend}
|
|
523
|
+
<button
|
|
524
|
+
type="button"
|
|
525
|
+
data-widget-part="chronicle.extend"
|
|
526
|
+
title={view.extend.title}
|
|
527
|
+
disabled={!!busy}
|
|
528
|
+
onclick={() => press("extend", "extend-graph", {})}
|
|
529
|
+
>
|
|
530
|
+
<sp-icon name="network" size="14"></sp-icon>
|
|
531
|
+
{view.extend.label}
|
|
532
|
+
</button>
|
|
533
|
+
{/if}
|
|
534
|
+
</div>
|
|
535
|
+
{/if}
|
|
536
|
+
</section>
|
|
537
|
+
{/if}
|
|
538
|
+
|
|
539
|
+
{#if view.earlierHead}
|
|
540
|
+
<!-- Folded: the host's accordion, its trigger the head (*Earlier (N)*). -->
|
|
541
|
+
<sp-accordion data-widget-part="chronicle.earlier" value="">
|
|
542
|
+
<sp-accordion-item value="earlier" heading={view.earlierHead} level="3">
|
|
543
|
+
<ul data-widget-part="chronicle.earlier-list list">
|
|
544
|
+
{#each view.earlier as e (e.id)}
|
|
545
|
+
<li data-widget-part="chronicle.earlier-row row" data-entry-id={e.id}>
|
|
546
|
+
<button
|
|
547
|
+
type="button"
|
|
548
|
+
data-widget-part="chronicle.earlier-entry"
|
|
549
|
+
title={t("Open in lorebook")}
|
|
550
|
+
onclick={() => openEntry(e.id)}
|
|
551
|
+
>
|
|
552
|
+
<span data-widget-part="chronicle.entry-date">{e.date}</span>
|
|
553
|
+
<span data-widget-part="chronicle.entry-line" data-blank={e.blank ? "" : undefined}>
|
|
554
|
+
{e.firstLine}
|
|
555
|
+
</span>
|
|
556
|
+
<span data-widget-part="chronicle.entry-scenes">{e.scenes}</span>
|
|
557
|
+
</button>
|
|
558
|
+
</li>
|
|
559
|
+
{/each}
|
|
560
|
+
</ul>
|
|
561
|
+
{#if view.earlierMore}
|
|
562
|
+
<p data-widget-part="chronicle.earlier-more">{view.earlierMore}</p>
|
|
563
|
+
{/if}
|
|
564
|
+
</sp-accordion-item>
|
|
565
|
+
</sp-accordion>
|
|
566
|
+
{/if}
|
|
567
|
+
{/if}
|
|
568
|
+
{/if}
|
|
569
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `chronicle` component (PLAN-core-widgets W3): the session's story
|
|
3
|
+
* clock, the history entry it reads now with this session's scenes under
|
|
4
|
+
* it, and the entries before. `npm run build` compiles it with the CLI's
|
|
5
|
+
* component bundler to `dist/components/chronicle.js`, the module the app
|
|
6
|
+
* serves at `/core-ui/chronicle`.
|
|
7
|
+
*/
|
|
8
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
9
|
+
import Chronicle from './Chronicle.svelte'
|
|
10
|
+
|
|
11
|
+
export default svelteComponent(Chronicle)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { ComponentContext } from "@serene-pub/sdk/component"
|
|
13
13
|
import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
|
|
14
14
|
import LoreEntriesWidget from "./LoreEntriesWidget.svelte"
|
|
15
|
-
import { widgetRefFromComponent } from "../
|
|
15
|
+
import { widgetRefFromComponent } from "../widgetRef.svelte"
|
|
16
16
|
|
|
17
17
|
let { ctx }: { ctx: ComponentContext } = $props()
|
|
18
18
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
type LoreEntriesFilter,
|
|
42
42
|
type LoreEntriesSort
|
|
43
43
|
} from "@serene-pub/core-catalog/lore-entries"
|
|
44
|
-
import { useWidgetContext } from "../
|
|
44
|
+
import { useWidgetContext } from "../context"
|
|
45
45
|
|
|
46
46
|
type Answer = WidgetRequests["session-entries"]["result"]
|
|
47
47
|
type Ask = WidgetRequests["session-entries"]["params"]
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
|
|
55
55
|
// Primitives, so a push that changes neither asks nothing again.
|
|
56
56
|
const pageSize = $derived(
|
|
57
|
-
readLoreEntriesSettings(widget?.current?.settings?.v1
|
|
57
|
+
readLoreEntriesSettings(widget?.current?.settings?.v1).pageSize
|
|
58
58
|
)
|
|
59
59
|
const settledSort = $derived(
|
|
60
|
-
readLoreEntriesSettings(widget?.current?.settings?.v1
|
|
60
|
+
readLoreEntriesSettings(widget?.current?.settings?.v1).sort
|
|
61
61
|
)
|
|
62
62
|
|
|
63
63
|
let query = $state("")
|