@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,136 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Who's here (PLAN-core-widgets W10): which people have this session open
|
|
4
|
+
* now, as whom each writes, and who is typing — the session's attendance
|
|
5
|
+
* (`attendance.v1`), drawn as two groups.
|
|
6
|
+
*
|
|
7
|
+
* **Here**: a row per person with the session open — their name, *you*
|
|
8
|
+
* on the viewer's own, the persona each writes as (face and name, from
|
|
9
|
+
* the cast), a typing pulse while one of their personas is typing, and
|
|
10
|
+
* *Owner* / *Guest* as a quiet chip. Under it, *Nobody else is here.*
|
|
11
|
+
* when the viewer has the room to themselves. **Away**: the session's
|
|
12
|
+
* other people, with when they were last here (off with `showAway`). A
|
|
13
|
+
* press on a persona opens its sheet (`open-character`). Everything it
|
|
14
|
+
* shows is worked out in the plain half (`attendanceView`); this only
|
|
15
|
+
* draws it, and keeps the clock the Away times are told from.
|
|
16
|
+
*
|
|
17
|
+
* The markup carries no look: each element names what it is in
|
|
18
|
+
* `data-widget-part` (`attendance.person row`, …), the row's state rides
|
|
19
|
+
* on `data-state`, and the default widget stylesheet draws them
|
|
20
|
+
* (STYLE-GUIDE §6.16).
|
|
21
|
+
*/
|
|
22
|
+
import type { ViewerV1 } from "@serene-pub/sdk/component"
|
|
23
|
+
import { attendanceView, readAttendanceSettings } from "@serene-pub/core-catalog/attendance"
|
|
24
|
+
import { useWidgetContext } from "../context"
|
|
25
|
+
|
|
26
|
+
const NOBODY: ViewerV1 = { userId: null, isAdmin: false, isGuest: false }
|
|
27
|
+
|
|
28
|
+
const widget = useWidgetContext()
|
|
29
|
+
const t = (source: string): string => widget?.current.t(source) ?? source
|
|
30
|
+
|
|
31
|
+
/** The clock the Away rows' "Last here …" are told from, moved once a minute. */
|
|
32
|
+
let now = $state(Date.now())
|
|
33
|
+
$effect(() => {
|
|
34
|
+
const tick = setInterval(() => (now = Date.now()), 60_000)
|
|
35
|
+
return () => clearInterval(tick)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const settings = $derived(
|
|
39
|
+
readAttendanceSettings(widget?.current.settings?.v1)
|
|
40
|
+
)
|
|
41
|
+
const view = $derived(
|
|
42
|
+
attendanceView({
|
|
43
|
+
attendance: widget?.current.attendance?.v1,
|
|
44
|
+
characters: widget?.current.scope("characters"),
|
|
45
|
+
viewer: widget?.current.viewer?.v1 ?? NOBODY,
|
|
46
|
+
settings,
|
|
47
|
+
now,
|
|
48
|
+
t
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
/** Why the page declined the last press, this widget's own. */
|
|
53
|
+
let refusal = $state<string | null>(null)
|
|
54
|
+
|
|
55
|
+
async function openPersona(characterId: number): Promise<void> {
|
|
56
|
+
refusal = null
|
|
57
|
+
try {
|
|
58
|
+
await widget?.current.request("open-character", { characterId })
|
|
59
|
+
} catch (e) {
|
|
60
|
+
refusal = e instanceof Error && e.message ? e.message : t("That did not go through. Try again.")
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{#snippet personRow(person: (typeof view.here)[number], state: "here" | "away")}
|
|
66
|
+
<li
|
|
67
|
+
data-widget-part="attendance.person row"
|
|
68
|
+
data-state={state}
|
|
69
|
+
data-role={person.role}
|
|
70
|
+
data-you={person.you ? "" : undefined}
|
|
71
|
+
data-typing={person.typing ? "" : undefined}
|
|
72
|
+
>
|
|
73
|
+
<span data-widget-part="attendance.name">{person.name}</span>
|
|
74
|
+
{#if person.you}
|
|
75
|
+
<span data-widget-part="attendance.you">{t("you")}</span>
|
|
76
|
+
{/if}
|
|
77
|
+
{#each person.personas as persona (persona.ref)}
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
data-widget-part="attendance.persona"
|
|
81
|
+
data-ref={persona.ref}
|
|
82
|
+
title={t("Open {name}").replace("{name}", persona.name)}
|
|
83
|
+
onclick={() => openPersona(persona.characterId)}
|
|
84
|
+
>
|
|
85
|
+
{#if settings.faces}
|
|
86
|
+
{#if persona.face}
|
|
87
|
+
<img data-widget-part="attendance.face" src={persona.face} alt="" />
|
|
88
|
+
{:else}
|
|
89
|
+
<span data-widget-part="attendance.face" data-blank="">
|
|
90
|
+
<sp-icon name="user-round" size="12"></sp-icon>
|
|
91
|
+
</span>
|
|
92
|
+
{/if}
|
|
93
|
+
{/if}
|
|
94
|
+
<span>{persona.name}</span>
|
|
95
|
+
</button>
|
|
96
|
+
{/each}
|
|
97
|
+
{#if person.typing}
|
|
98
|
+
<span data-widget-part="attendance.typing" role="status">{t("typing…")}</span>
|
|
99
|
+
{/if}
|
|
100
|
+
{#if person.lastHere}
|
|
101
|
+
<span data-widget-part="attendance.away">{person.lastHere}</span>
|
|
102
|
+
{/if}
|
|
103
|
+
<span data-widget-part="attendance.role chip">{person.roleChip}</span>
|
|
104
|
+
</li>
|
|
105
|
+
{/snippet}
|
|
106
|
+
|
|
107
|
+
<div data-widget-part="attendance.root" data-faces={settings.faces ? "" : undefined}>
|
|
108
|
+
{#if refusal}
|
|
109
|
+
<p data-widget-part="attendance.alert" role="alert">{refusal}</p>
|
|
110
|
+
{/if}
|
|
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}
|
|
115
|
+
<ul data-widget-part="attendance.list list">
|
|
116
|
+
{#each view.here as person (person.key)}
|
|
117
|
+
{@render personRow(person, "here")}
|
|
118
|
+
{/each}
|
|
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>
|
|
125
|
+
|
|
126
|
+
{#if view.away.length}
|
|
127
|
+
<section data-widget-part="attendance.group" data-group="away" aria-label={t("Away")}>
|
|
128
|
+
<h3 data-widget-part="attendance.group-head">{t("Away")}</h3>
|
|
129
|
+
<ul data-widget-part="attendance.list list">
|
|
130
|
+
{#each view.away as person (person.key)}
|
|
131
|
+
{@render personRow(person, "away")}
|
|
132
|
+
{/each}
|
|
133
|
+
</ul>
|
|
134
|
+
</section>
|
|
135
|
+
{/if}
|
|
136
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `attendance` component (PLAN-core-widgets W10): Who's here — the
|
|
3
|
+
* session's people, who has it open now, as whom each writes and who is
|
|
4
|
+
* typing, and who is away, as the page's UI worker runs it. `npm run build`
|
|
5
|
+
* compiles it with the CLI's component bundler to
|
|
6
|
+
* `dist/components/attendance.js`, the module the app serves at
|
|
7
|
+
* `/core-ui/attendance`.
|
|
8
|
+
*/
|
|
9
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
10
|
+
import Attendance from './Attendance.svelte'
|
|
11
|
+
|
|
12
|
+
export default svelteComponent(Attendance)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Core's Backdrop widget as a remote component: the component context,
|
|
4
|
+
* as the widget context, around the widget.
|
|
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 BackdropWidget from "./BackdropWidget.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: "backdrop", instanceId: "backdrop", title: "Backdrop" }
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<BackdropWidget />
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Backdrop (DESIGN-image-generation §6.4, 2026-10-12): the session's
|
|
4
|
+
* **backdrop** — one picture, session state (`sessions.backdropMediaId`),
|
|
5
|
+
* set by a pipeline (`core:outlet/set-backdrop@1`) or by a person here.
|
|
6
|
+
* It arrives on the `session` section (`SessionV1.backdrop`, its `fitted`
|
|
7
|
+
* address resolved by the host); this widget draws it, fitted
|
|
8
|
+
* (`fit`: cover or contain) under a darkening overlay (`dim`, 0–100) so
|
|
9
|
+
* text laid over it stays legible.
|
|
10
|
+
*
|
|
11
|
+
* **Change** opens the chooser: a cast member, then their gallery —
|
|
12
|
+
* paged by the same `character-images` request Scene Portraits' chosen
|
|
13
|
+
* images use, so no second picker reaches the server. Below it, **From
|
|
14
|
+
* this session**: the pictures generated in this session, paged by
|
|
15
|
+
* `session-images` — the Album's `generated` source over the session's
|
|
16
|
+
* lines, answered by the page (§16 follow-up D3). A tile sets the
|
|
17
|
+
* backdrop (`set-backdrop`); **Clear** takes it away. Both are offered
|
|
18
|
+
* only to the session's owner or an admin — the server's own rule — and
|
|
19
|
+
* the new picture comes back on the `session` section, never the reply.
|
|
20
|
+
*
|
|
21
|
+
* A picture whose file is gone draws *File no longer available*, never a
|
|
22
|
+
* broken image, and Clear still works.
|
|
23
|
+
*
|
|
24
|
+
* **Illustrate** (I9, §6.5) fires the Scene action
|
|
25
|
+
* (`<chat|adventure>-illustrate-scene#illustrate-scene`) through `invoke`,
|
|
26
|
+
* with `{ placement: 'backdrop' }` — the picture becomes the backdrop
|
|
27
|
+
* and nothing is posted. Shown only when the session lists that action
|
|
28
|
+
* (`actions.v1`; Chat and Adventure today) and to the viewer who may change the
|
|
29
|
+
* backdrop; greyed with the listing's verdict. The new picture arrives
|
|
30
|
+
* on the `session` section like any other.
|
|
31
|
+
*
|
|
32
|
+
* The markup carries no look: each element names what it is in
|
|
33
|
+
* `data-widget-part` (`backdrop.root`, …), the settings ride on the
|
|
34
|
+
* root's `data-fit` and the `--sp-backdrop-dim` variable, and the default
|
|
35
|
+
* widget stylesheet draws them (STYLE-GUIDE §6.16).
|
|
36
|
+
*/
|
|
37
|
+
import { untrack } from "svelte"
|
|
38
|
+
import {
|
|
39
|
+
BACKDROP_EMPTY,
|
|
40
|
+
BACKDROP_ILLUSTRATE_PAYLOAD,
|
|
41
|
+
backdropOf,
|
|
42
|
+
illustrateActionOf,
|
|
43
|
+
mayChangeBackdrop,
|
|
44
|
+
readBackdropSettings
|
|
45
|
+
} from "@serene-pub/core-catalog/backdrop"
|
|
46
|
+
import { useWidgetContext } from "../context"
|
|
47
|
+
|
|
48
|
+
const w = useWidgetContext()
|
|
49
|
+
const t = (source: string) => w?.current.t?.(source) ?? source
|
|
50
|
+
|
|
51
|
+
const settings = $derived(readBackdropSettings(w?.current.settings?.v1))
|
|
52
|
+
const backdrop = $derived(backdropOf(w?.current.session?.v1))
|
|
53
|
+
const mayChange = $derived(mayChangeBackdrop(w?.current.viewer?.v1))
|
|
54
|
+
const illustrate = $derived(illustrateActionOf(w?.current.actions?.v1))
|
|
55
|
+
const characters = $derived(w?.current.scope("characters"))
|
|
56
|
+
/** Who the chooser offers: the session's people, benched ones left out. */
|
|
57
|
+
const members = $derived((characters?.members ?? []).filter((m) => !m.benched))
|
|
58
|
+
|
|
59
|
+
/** The picture failed to load: its file is gone. Reset when another is set. */
|
|
60
|
+
let missing = $state(false)
|
|
61
|
+
let lastId = $state<number | null>(null)
|
|
62
|
+
$effect(() => {
|
|
63
|
+
const id = backdrop?.mediaId ?? null
|
|
64
|
+
if (id !== untrack(() => lastId)) {
|
|
65
|
+
lastId = id
|
|
66
|
+
missing = false
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
/** This widget's own error line (R77). */
|
|
71
|
+
let error = $state<string | null>(null)
|
|
72
|
+
const messageOf = (e: unknown) =>
|
|
73
|
+
e instanceof Error && e.message ? e.message : t("That did not go through. Try again.")
|
|
74
|
+
|
|
75
|
+
/* ── the chooser: a member's gallery, by `character-images` ───────── */
|
|
76
|
+
|
|
77
|
+
interface GalleryImage {
|
|
78
|
+
ref: string
|
|
79
|
+
src: string
|
|
80
|
+
caption?: string
|
|
81
|
+
}
|
|
82
|
+
interface GalleryPages {
|
|
83
|
+
images: GalleryImage[]
|
|
84
|
+
next: string | null
|
|
85
|
+
done: boolean
|
|
86
|
+
error: string | null
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let choosing = $state(false)
|
|
90
|
+
/** Whose gallery the chooser shows, by character id. */
|
|
91
|
+
let memberId = $state<number | null>(null)
|
|
92
|
+
let galleries = $state<Record<number, GalleryPages>>({})
|
|
93
|
+
/** Members whose next page is on its way — not state: nothing draws it. */
|
|
94
|
+
const asking = new Set<number>()
|
|
95
|
+
|
|
96
|
+
const isImage = (v: unknown): v is GalleryImage =>
|
|
97
|
+
!!v &&
|
|
98
|
+
typeof v === "object" &&
|
|
99
|
+
typeof (v as GalleryImage).ref === "string" &&
|
|
100
|
+
typeof (v as GalleryImage).src === "string"
|
|
101
|
+
|
|
102
|
+
async function nextPage(characterId: number): Promise<void> {
|
|
103
|
+
const held = untrack(() => galleries[characterId])
|
|
104
|
+
if (asking.has(characterId) || held?.done) return
|
|
105
|
+
asking.add(characterId)
|
|
106
|
+
const keep = held?.images ?? []
|
|
107
|
+
let pages: GalleryPages
|
|
108
|
+
try {
|
|
109
|
+
const res = (await w?.current.request("character-images", {
|
|
110
|
+
characterId,
|
|
111
|
+
...(held?.next ? { cursor: held.next } : {})
|
|
112
|
+
})) as { images?: unknown[]; nextCursor?: string } | undefined
|
|
113
|
+
const images = (Array.isArray(res?.images) ? res.images : []).filter(isImage)
|
|
114
|
+
const next = typeof res?.nextCursor === "string" && res.nextCursor ? res.nextCursor : null
|
|
115
|
+
pages = { images: [...keep, ...images], next, done: !next, error: null }
|
|
116
|
+
} catch (e) {
|
|
117
|
+
pages = { images: keep, next: null, done: true, error: messageOf(e) }
|
|
118
|
+
} finally {
|
|
119
|
+
asking.delete(characterId)
|
|
120
|
+
}
|
|
121
|
+
galleries = { ...untrack(() => galleries), [characterId]: pages }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ── From this session: its generated pictures, by `session-images` ── */
|
|
125
|
+
|
|
126
|
+
let sessionPages = $state<GalleryPages | null>(null)
|
|
127
|
+
/** A page is on its way — not state: nothing draws it. */
|
|
128
|
+
let askingSession = false
|
|
129
|
+
|
|
130
|
+
async function nextSessionPage(): Promise<void> {
|
|
131
|
+
const held = untrack(() => sessionPages)
|
|
132
|
+
if (askingSession || held?.done) return
|
|
133
|
+
askingSession = true
|
|
134
|
+
const keep = held?.images ?? []
|
|
135
|
+
let pages: GalleryPages
|
|
136
|
+
try {
|
|
137
|
+
const res = (await w?.current.request("session-images", {
|
|
138
|
+
...(held?.next ? { cursor: held.next } : {})
|
|
139
|
+
})) as { images?: unknown[]; nextCursor?: string } | undefined
|
|
140
|
+
const images = (Array.isArray(res?.images) ? res.images : []).filter(isImage)
|
|
141
|
+
const next = typeof res?.nextCursor === "string" && res.nextCursor ? res.nextCursor : null
|
|
142
|
+
pages = { images: [...keep, ...images], next, done: !next, error: null }
|
|
143
|
+
} catch (e) {
|
|
144
|
+
pages = { images: keep, next: null, done: true, error: messageOf(e) }
|
|
145
|
+
} finally {
|
|
146
|
+
askingSession = false
|
|
147
|
+
}
|
|
148
|
+
sessionPages = pages
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function pickMember(id: number) {
|
|
152
|
+
memberId = id
|
|
153
|
+
if (!untrack(() => galleries[id])) void nextPage(id)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function openChooser() {
|
|
157
|
+
choosing = true
|
|
158
|
+
error = null
|
|
159
|
+
const first = untrack(() => memberId ?? members[0]?.characterId ?? null)
|
|
160
|
+
if (first !== null) pickMember(first)
|
|
161
|
+
// Asked afresh each time: a Scene may have drawn one since.
|
|
162
|
+
sessionPages = null
|
|
163
|
+
void nextSessionPage()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const member = $derived(members.find((m) => m.characterId === memberId) ?? null)
|
|
167
|
+
const pages = $derived(memberId !== null ? galleries[memberId] : undefined)
|
|
168
|
+
|
|
169
|
+
/** Draw the scene as the backdrop: the Scene action, placement `backdrop`. */
|
|
170
|
+
function illustrateNow() {
|
|
171
|
+
if (!illustrate || illustrate.disabled) return
|
|
172
|
+
error = null
|
|
173
|
+
try {
|
|
174
|
+
w?.current.invoke(illustrate.identity, { payload: { ...BACKDROP_ILLUSTRATE_PAYLOAD } })
|
|
175
|
+
} catch (e) {
|
|
176
|
+
error = messageOf(e)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Set the backdrop to `ref` — null clears it. The picture follows on the session section. */
|
|
181
|
+
async function setBackdrop(ref: string | null) {
|
|
182
|
+
try {
|
|
183
|
+
await w?.current.request("set-backdrop", { mediaRef: ref })
|
|
184
|
+
error = null
|
|
185
|
+
choosing = false
|
|
186
|
+
} catch (e) {
|
|
187
|
+
error = messageOf(e)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<div
|
|
193
|
+
data-widget-part="backdrop.root"
|
|
194
|
+
data-fit={settings.fit}
|
|
195
|
+
data-empty={backdrop ? undefined : ""}
|
|
196
|
+
style:--sp-backdrop-dim={settings.dim / 100}
|
|
197
|
+
role="group"
|
|
198
|
+
aria-label={t("Backdrop")}
|
|
199
|
+
>
|
|
200
|
+
{#if backdrop && !missing}
|
|
201
|
+
<img
|
|
202
|
+
data-widget-part="backdrop.image"
|
|
203
|
+
src={backdrop.src}
|
|
204
|
+
alt={t("The session's backdrop")}
|
|
205
|
+
decoding="async"
|
|
206
|
+
onerror={() => (missing = true)}
|
|
207
|
+
/>
|
|
208
|
+
<div data-widget-part="backdrop.dim" aria-hidden="true"></div>
|
|
209
|
+
{:else if backdrop}
|
|
210
|
+
<div data-widget-part="backdrop.missing" role="img" aria-label={t("File no longer available")}>
|
|
211
|
+
<sp-icon name="image-off" size="20"></sp-icon>
|
|
212
|
+
<span>{t("File no longer available")}</span>
|
|
213
|
+
</div>
|
|
214
|
+
{/if}
|
|
215
|
+
|
|
216
|
+
{#if error}
|
|
217
|
+
<p data-widget-part="backdrop.alert" role="alert">{error}</p>
|
|
218
|
+
{/if}
|
|
219
|
+
|
|
220
|
+
{#if choosing}
|
|
221
|
+
{@const images = pages?.images ?? []}
|
|
222
|
+
{@const own = sessionPages?.images ?? []}
|
|
223
|
+
<section data-widget-part="backdrop.chooser" aria-label={t("Choose a backdrop")}>
|
|
224
|
+
<header data-widget-part="backdrop.chooser-head card-head">
|
|
225
|
+
<span>{t("Choose a backdrop")}</span>
|
|
226
|
+
<button
|
|
227
|
+
type="button"
|
|
228
|
+
data-widget-part="backdrop.chooser-close"
|
|
229
|
+
aria-label={t("Close")}
|
|
230
|
+
title={t("Close")}
|
|
231
|
+
onclick={() => (choosing = false)}
|
|
232
|
+
>
|
|
233
|
+
<sp-icon name="x" size="13"></sp-icon>
|
|
234
|
+
</button>
|
|
235
|
+
</header>
|
|
236
|
+
{#if !members.length}
|
|
237
|
+
<p data-widget-part="backdrop.chooser-note">
|
|
238
|
+
{t("Nobody in this session has a gallery to pick from yet.")}
|
|
239
|
+
</p>
|
|
240
|
+
{:else}
|
|
241
|
+
<div data-widget-part="backdrop.members" role="group" aria-label={t("Whose images")}>
|
|
242
|
+
{#each members as m (m.ref)}
|
|
243
|
+
<button
|
|
244
|
+
type="button"
|
|
245
|
+
aria-pressed={m.characterId === memberId}
|
|
246
|
+
data-widget-part="backdrop.member"
|
|
247
|
+
onclick={() => pickMember(m.characterId)}
|
|
248
|
+
>
|
|
249
|
+
{m.name}
|
|
250
|
+
</button>
|
|
251
|
+
{/each}
|
|
252
|
+
</div>
|
|
253
|
+
{#if pages?.error}
|
|
254
|
+
<p data-widget-part="backdrop.chooser-note" role="alert">{pages.error}</p>
|
|
255
|
+
{:else if pages?.done && !images.length && member}
|
|
256
|
+
<p data-widget-part="backdrop.chooser-note">
|
|
257
|
+
{t("{name} has no images in their gallery.").replace("{name}", member.name)}
|
|
258
|
+
</p>
|
|
259
|
+
{/if}
|
|
260
|
+
{#if images.length}
|
|
261
|
+
<div data-widget-part="backdrop.chooser-list">
|
|
262
|
+
{#each images as image, index (image.ref)}
|
|
263
|
+
<button
|
|
264
|
+
type="button"
|
|
265
|
+
data-widget-part="backdrop.chooser-tile"
|
|
266
|
+
aria-label={t("Use image {n} as the backdrop").replace("{n}", String(index + 1))}
|
|
267
|
+
onclick={() => setBackdrop(image.ref)}
|
|
268
|
+
>
|
|
269
|
+
<img src={image.src} alt="" loading="lazy" />
|
|
270
|
+
</button>
|
|
271
|
+
{/each}
|
|
272
|
+
</div>
|
|
273
|
+
{/if}
|
|
274
|
+
{#if pages && !pages.done && memberId !== null}
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
data-widget-part="backdrop.chooser-more"
|
|
278
|
+
onclick={() => memberId !== null && nextPage(memberId)}
|
|
279
|
+
>
|
|
280
|
+
{t("Show more")}
|
|
281
|
+
</button>
|
|
282
|
+
{/if}
|
|
283
|
+
{/if}
|
|
284
|
+
<section data-widget-part="backdrop.from-session" aria-label={t("From this session")}>
|
|
285
|
+
<h3 data-widget-part="backdrop.chooser-subhead">{t("From this session")}</h3>
|
|
286
|
+
{#if sessionPages?.error}
|
|
287
|
+
<p data-widget-part="backdrop.chooser-note" role="alert">{sessionPages.error}</p>
|
|
288
|
+
{:else if sessionPages?.done && !own.length}
|
|
289
|
+
<p data-widget-part="backdrop.chooser-note">
|
|
290
|
+
{t("Nothing has been generated in this session yet.")}
|
|
291
|
+
</p>
|
|
292
|
+
{/if}
|
|
293
|
+
{#if own.length}
|
|
294
|
+
<div data-widget-part="backdrop.chooser-list">
|
|
295
|
+
{#each own as image, index (image.ref)}
|
|
296
|
+
<button
|
|
297
|
+
type="button"
|
|
298
|
+
data-widget-part="backdrop.chooser-tile"
|
|
299
|
+
aria-label={t("Use picture {n} from this session as the backdrop").replace("{n}", String(index + 1))}
|
|
300
|
+
title={image.caption}
|
|
301
|
+
onclick={() => setBackdrop(image.ref)}
|
|
302
|
+
>
|
|
303
|
+
<img src={image.src} alt="" loading="lazy" />
|
|
304
|
+
</button>
|
|
305
|
+
{/each}
|
|
306
|
+
</div>
|
|
307
|
+
{/if}
|
|
308
|
+
{#if sessionPages && !sessionPages.done}
|
|
309
|
+
<button type="button" data-widget-part="backdrop.chooser-more" onclick={() => nextSessionPage()}>
|
|
310
|
+
{t("Show more")}
|
|
311
|
+
</button>
|
|
312
|
+
{/if}
|
|
313
|
+
</section>
|
|
314
|
+
</section>
|
|
315
|
+
{:else if !backdrop}
|
|
316
|
+
<div data-widget-part="backdrop.empty empty" role="status">
|
|
317
|
+
<sp-icon name="mountain-snow" size="20"></sp-icon>
|
|
318
|
+
<span>{t(BACKDROP_EMPTY)}</span>
|
|
319
|
+
</div>
|
|
320
|
+
{/if}
|
|
321
|
+
|
|
322
|
+
{#if mayChange && !choosing}
|
|
323
|
+
<div data-widget-part="backdrop.toolbar toolbar">
|
|
324
|
+
{#if illustrate}
|
|
325
|
+
<button
|
|
326
|
+
type="button"
|
|
327
|
+
data-widget-part="backdrop.illustrate"
|
|
328
|
+
aria-disabled={illustrate.disabled ? "true" : undefined}
|
|
329
|
+
title={t("Draw the scene as it stands and set it as the backdrop")}
|
|
330
|
+
onclick={illustrateNow}
|
|
331
|
+
>
|
|
332
|
+
{t("Illustrate")}
|
|
333
|
+
</button>
|
|
334
|
+
{/if}
|
|
335
|
+
<button type="button" data-widget-part="backdrop.change" onclick={openChooser}>
|
|
336
|
+
{t("Change")}
|
|
337
|
+
</button>
|
|
338
|
+
{#if backdrop}
|
|
339
|
+
<button type="button" data-widget-part="backdrop.clear" onclick={() => setBackdrop(null)}>
|
|
340
|
+
{t("Clear")}
|
|
341
|
+
</button>
|
|
342
|
+
{/if}
|
|
343
|
+
</div>
|
|
344
|
+
{/if}
|
|
345
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `backdrop` component (DESIGN-image-generation §6.4): the session's
|
|
3
|
+
* backdrop, as the page's UI worker runs it. `npm run build` compiles it with
|
|
4
|
+
* the CLI's component bundler to `dist/components/backdrop.js`, the module
|
|
5
|
+
* the app serves at `/core-ui/backdrop`.
|
|
6
|
+
*/
|
|
7
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
8
|
+
import Backdrop from './Backdrop.svelte'
|
|
9
|
+
|
|
10
|
+
export default svelteComponent(Backdrop)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Core's Chronicle widget as a remote component (W3): the component
|
|
4
|
+
* context, as the widget context, around `ChronicleWidget`.
|
|
5
|
+
*
|
|
6
|
+
* The widget asks the page only once its settings have arrived: the page
|
|
7
|
+
* posts a widget's settings (it reads them) right after it says ready,
|
|
8
|
+
* and an ask made before would be spent on the declared Earlier count
|
|
9
|
+
* instead of this instance's.
|
|
10
|
+
*/
|
|
11
|
+
import { setContext, untrack } from "svelte"
|
|
12
|
+
import type { ComponentContext } from "@serene-pub/sdk/component"
|
|
13
|
+
import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
|
|
14
|
+
import ChronicleWidget from "./ChronicleWidget.svelte"
|
|
15
|
+
import { widgetRefFromComponent } from "../widgetRef.svelte"
|
|
16
|
+
|
|
17
|
+
let { ctx }: { ctx: ComponentContext } = $props()
|
|
18
|
+
|
|
19
|
+
let settled = $state(untrack(() => ctx.settings) !== undefined)
|
|
20
|
+
$effect(() =>
|
|
21
|
+
untrack(() => ctx).subscribe((section) => {
|
|
22
|
+
if (section === "settings") settled = true
|
|
23
|
+
})
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// The context is the mount's, handed once: its sections move, it does not.
|
|
27
|
+
setContext(
|
|
28
|
+
WIDGET_CONTEXT_KEY,
|
|
29
|
+
widgetRefFromComponent(
|
|
30
|
+
untrack(() => ctx),
|
|
31
|
+
{ id: "chronicle", instanceId: "chronicle", title: "Chronicle" }
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<ChronicleWidget ready={settled} />
|