@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
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ components Serene Pub ships, as a package. Serene Pub seeds from it at boot,
|
|
|
6
6
|
references:
|
|
7
7
|
|
|
8
8
|
```ts
|
|
9
|
-
import {
|
|
9
|
+
import { chatGenre, chatTurnOrder } from '@serene-pub/core-catalog'
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Core is the first consumer of the announce path rather than a special case — one
|
|
@@ -24,3 +24,23 @@ stylesheet build can scan it for class names; it is not imported at runtime.
|
|
|
24
24
|
|
|
25
25
|
Importing the package registers its declarations, so it lists those modules in
|
|
26
26
|
`sideEffects` — a bundler must not drop them.
|
|
27
|
+
|
|
28
|
+
## Where things live
|
|
29
|
+
|
|
30
|
+
`src/` is laid out by genre (ruled 2026-10-05):
|
|
31
|
+
|
|
32
|
+
| folder | holds |
|
|
33
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `src/genres/<genre>/` | one genre's pipelines, one spec per file (create, reply, actions, answer form, turn order), and its own widgets (`genres/chat/ui/authors-note/`) |
|
|
35
|
+
| `src/shared/` | what more than one genre uses: the built-in message verbs, summarize, the annex field, sprites, the story graph build, the tool-loop example, and the shared widgets (`shared/ui/`) |
|
|
36
|
+
| `src/factories/` | `answerFormSpec()` and `turnOrderSpec()`, which a plugin genre calls too |
|
|
37
|
+
| `src/registry/` | genres, slots, stat shapes, entry types, widget declarations and layouts |
|
|
38
|
+
| `src/seed/` | the shipped prompts, presets and the guide mascot |
|
|
39
|
+
| `components/` | the Svelte sources, mirrored the same way (`components/shared/*`, `components/genres/chat/authors-note`) |
|
|
40
|
+
|
|
41
|
+
`CORE_SPECS` (`src/index.ts`) lists every pipeline core seeds, with its display name. A genre's
|
|
42
|
+
pipeline id is `core:spec/<genre>-<what>` (`core:spec/chat-respond`); one every genre uses is
|
|
43
|
+
`core:spec/<what>` (`core:spec/summarize-scene`). A name says what the pipeline does and never
|
|
44
|
+
which genre it serves (_Reply_, _Turn order_): wherever several genres' pipelines are listed, the
|
|
45
|
+
genre is shown beside it. `core:spec/tool-loop` is exported as an example and is not in
|
|
46
|
+
`CORE_SPECS`.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { ComponentContext } from "@serene-pub/sdk/component"
|
|
10
10
|
import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
|
|
11
11
|
import AuthorsNoteWidget from "./AuthorsNoteWidget.svelte"
|
|
12
|
-
import { widgetRefFromComponent } from "
|
|
12
|
+
import { widgetRefFromComponent } from "../../../shared/widgetRef.svelte"
|
|
13
13
|
|
|
14
14
|
let { ctx }: { ctx: ComponentContext } = $props()
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
authorsNoteLastReplyLine,
|
|
32
32
|
readAuthorsNote
|
|
33
33
|
} from "@serene-pub/core-catalog/authors-note"
|
|
34
|
-
import { useWidgetContext } from "
|
|
34
|
+
import { useWidgetContext } from "../../../shared/context"
|
|
35
35
|
|
|
36
36
|
const widget = useWidgetContext()
|
|
37
37
|
const t = (source: string): string => widget?.current?.t(source) ?? source
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/**
|
|
3
|
-
* Core's
|
|
3
|
+
* Core's Actions widget as a remote component (W8): the component
|
|
4
4
|
* context, as the widget context, around the widget.
|
|
5
5
|
*/
|
|
6
6
|
import { setContext, untrack } from "svelte"
|
|
7
7
|
import type { ComponentContext } from "@serene-pub/sdk/component"
|
|
8
8
|
import { WIDGET_CONTEXT_KEY } from "@serene-pub/core-catalog/widgets"
|
|
9
|
-
import
|
|
10
|
-
import { widgetRefFromComponent } from "../
|
|
9
|
+
import ActionsWidget from "./ActionsWidget.svelte"
|
|
10
|
+
import { widgetRefFromComponent } from "../widgetRef.svelte"
|
|
11
11
|
|
|
12
12
|
let { ctx }: { ctx: ComponentContext } = $props()
|
|
13
13
|
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
WIDGET_CONTEXT_KEY,
|
|
17
17
|
widgetRefFromComponent(
|
|
18
18
|
untrack(() => ctx),
|
|
19
|
-
{ id: "
|
|
19
|
+
{ id: "actions", instanceId: "actions", title: "Actions" }
|
|
20
20
|
)
|
|
21
21
|
)
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
|
-
<
|
|
24
|
+
<ActionsWidget />
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Actions (PLAN-core-widgets W8): what can I do right now — the session's
|
|
4
|
+
* listed actions (`actions.v1`) as real buttons, each with its icon and
|
|
5
|
+
* name, grouped from fields the listing carries: the turn controls, then
|
|
6
|
+
* the genre's own, then the ones added to it (`actionsView`, the plain
|
|
7
|
+
* half; this only draws it).
|
|
8
|
+
*
|
|
9
|
+
* A press is `invoke(identity)` — the same door the composer's chips
|
|
10
|
+
* take, so a core verb reaches the page's own handler and an action that
|
|
11
|
+
* collects text or recipients opens the page's collect modal before it
|
|
12
|
+
* fires. A greyed action is greyed, not disabled: `aria-disabled` keeps it
|
|
13
|
+
* in the tab order, its reason is its `title` and its description
|
|
14
|
+
* (`actions.reason`), and the click is guarded — as the chips do.
|
|
15
|
+
*
|
|
16
|
+
* Drawing a newcomer is meeting it: the widget shows every action at
|
|
17
|
+
* once, as opening **More** does in the composer, so the identities it
|
|
18
|
+
* draws wearing the *new* mark are told to the page (`actions-seen`),
|
|
19
|
+
* once each.
|
|
20
|
+
*
|
|
21
|
+
* ⚠ `showWaiting` (the questions waiting on the viewer) is declared and
|
|
22
|
+
* not drawn: no section this widget reads carries a session's open forms.
|
|
23
|
+
*
|
|
24
|
+
* The markup carries no look: each element names what it is in
|
|
25
|
+
* `data-widget-part`, the size rides on the root's `data-size`, a
|
|
26
|
+
* newcomer on its button's `data-new`, and the default widget stylesheet
|
|
27
|
+
* draws them (STYLE-GUIDE §6.16).
|
|
28
|
+
*/
|
|
29
|
+
import { actionsView, readActionsSettings, type ActionsButtonView } from "@serene-pub/core-catalog/actions"
|
|
30
|
+
import { useWidgetContext } from "../context"
|
|
31
|
+
|
|
32
|
+
const widget = useWidgetContext()
|
|
33
|
+
const t = (source: string): string => widget?.current.t(source) ?? source
|
|
34
|
+
const uid = $props.id()
|
|
35
|
+
|
|
36
|
+
const settings = $derived(
|
|
37
|
+
readActionsSettings(widget?.current.settings?.v1)
|
|
38
|
+
)
|
|
39
|
+
const view = $derived(
|
|
40
|
+
actionsView({
|
|
41
|
+
actions: widget?.current.actions?.v1,
|
|
42
|
+
settings,
|
|
43
|
+
locale: widget?.current.locale?.v1,
|
|
44
|
+
t
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
/** An element id from an action's identity (`core#advance` → `core-advance`). */
|
|
49
|
+
const idOf = (identity: string): string => identity.replace(/[^a-zA-Z0-9-]/g, "-")
|
|
50
|
+
|
|
51
|
+
/** The newcomers already told to the page — each once. */
|
|
52
|
+
const met = new Set<string>()
|
|
53
|
+
$effect(() => {
|
|
54
|
+
const fresh = view.fresh.filter((k) => !met.has(k))
|
|
55
|
+
if (!fresh.length) return
|
|
56
|
+
for (const k of fresh) met.add(k)
|
|
57
|
+
void widget?.current.request("actions-seen", { keys: fresh })?.catch(() => {})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
/** Why the last press did not go through, this widget's own. */
|
|
61
|
+
let refusal = $state<string | null>(null)
|
|
62
|
+
|
|
63
|
+
function press(button: ActionsButtonView): void {
|
|
64
|
+
if (button.disabled) return
|
|
65
|
+
refusal = null
|
|
66
|
+
try {
|
|
67
|
+
widget?.current.invoke(button.identity)
|
|
68
|
+
} catch (e) {
|
|
69
|
+
refusal = e instanceof Error && e.message ? e.message : t("That did not go through. Try again.")
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<div data-widget-part="actions.root" data-size={settings.size}>
|
|
75
|
+
{#if refusal}
|
|
76
|
+
<p data-widget-part="actions.alert" role="alert">{refusal}</p>
|
|
77
|
+
{/if}
|
|
78
|
+
|
|
79
|
+
{#if view.empty}
|
|
80
|
+
<div data-widget-part="actions.empty empty" role="status">
|
|
81
|
+
<sp-icon name="mouse-pointer-click" size="20"></sp-icon>
|
|
82
|
+
<span>{view.empty}</span>
|
|
83
|
+
</div>
|
|
84
|
+
{:else}
|
|
85
|
+
{#each view.groups as group (group.key)}
|
|
86
|
+
<div
|
|
87
|
+
data-widget-part="actions.group"
|
|
88
|
+
data-group={group.key}
|
|
89
|
+
role="group"
|
|
90
|
+
aria-labelledby={`actions-${uid}-${group.key}`}
|
|
91
|
+
>
|
|
92
|
+
<p data-widget-part="actions.group-head" id={`actions-${uid}-${group.key}`}>{group.title}</p>
|
|
93
|
+
{#each group.buttons as button (button.identity)}
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
data-widget-part="actions.button"
|
|
97
|
+
data-identity={button.identity}
|
|
98
|
+
data-new={button.isNew ? "" : undefined}
|
|
99
|
+
aria-disabled={button.disabled ? "true" : undefined}
|
|
100
|
+
aria-describedby={button.reason ? `actions-${uid}-reason-${idOf(button.identity)}` : undefined}
|
|
101
|
+
title={button.title}
|
|
102
|
+
onclick={() => press(button)}
|
|
103
|
+
>
|
|
104
|
+
<sp-icon name={button.icon} size="16"></sp-icon>
|
|
105
|
+
<span>{button.name}</span>
|
|
106
|
+
{#if button.reason}
|
|
107
|
+
<span
|
|
108
|
+
data-widget-part="actions.reason"
|
|
109
|
+
id={`actions-${uid}-reason-${idOf(button.identity)}`}
|
|
110
|
+
aria-hidden="true">{button.reason}</span
|
|
111
|
+
>
|
|
112
|
+
{/if}
|
|
113
|
+
</button>
|
|
114
|
+
{/each}
|
|
115
|
+
</div>
|
|
116
|
+
{/each}
|
|
117
|
+
{/if}
|
|
118
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `actions` component (PLAN-core-widgets W8): the session's actions as
|
|
3
|
+
* buttons — the turn controls, the genre's own, the added ones — as the
|
|
4
|
+
* page's UI worker runs it. `npm run build` compiles it with the CLI's
|
|
5
|
+
* component bundler to `dist/components/actions.js`, the module the app
|
|
6
|
+
* serves at `/core-ui/actions`.
|
|
7
|
+
*/
|
|
8
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
9
|
+
import Actions from './Actions.svelte'
|
|
10
|
+
|
|
11
|
+
export default svelteComponent(Actions)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Core's Album widget as a remote component (W2): 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 AlbumWidget from "./AlbumWidget.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: "album", instanceId: "album", title: "Album" }
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<AlbumWidget />
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Album (PLAN-core-widgets W2): what has this session shown me — every
|
|
4
|
+
* picture on its lines (`messages.v1` parts), newest line first, as
|
|
5
|
+
* square tiles. Each tile wears a corner glyph for where it came from —
|
|
6
|
+
* a paperclip for what a person attached, sparkles for what a run
|
|
7
|
+
* generated — and names who showed it and when on hover or focus. A
|
|
8
|
+
* press opens the page's lightbox (`view-image`) on that picture, with
|
|
9
|
+
* the whole album as its pages in the order drawn. Everything it shows is
|
|
10
|
+
* worked out in the plain half (`albumItems`); this only draws it.
|
|
11
|
+
*
|
|
12
|
+
* `arrangement: latest` draws the newest picture large (the `fitted`
|
|
13
|
+
* representation) and the rest as a thumbnail strip, so an illustrated
|
|
14
|
+
* scene can sit beside the log as it is generated.
|
|
15
|
+
*
|
|
16
|
+
* A picture whose file is gone (deleted from the Media panel) raises
|
|
17
|
+
* `error` and is drawn as *File no longer available*, never a broken
|
|
18
|
+
* image, and leaves the lightbox's pages — the media strip's rule.
|
|
19
|
+
*
|
|
20
|
+
* The markup carries no look: each element names what it is in
|
|
21
|
+
* `data-widget-part` (`album.tile`, …), the settings ride on the root's
|
|
22
|
+
* `data-tile` and `data-arrangement`, a tile's origin on `data-origin`,
|
|
23
|
+
* and the default widget stylesheet draws them (STYLE-GUIDE §6.16).
|
|
24
|
+
*/
|
|
25
|
+
import { SvelteSet } from "svelte/reactivity"
|
|
26
|
+
import {
|
|
27
|
+
ALBUM_EMPTY,
|
|
28
|
+
ALBUM_ORIGIN_NAMES,
|
|
29
|
+
albumItems,
|
|
30
|
+
albumOpenLabel,
|
|
31
|
+
albumSrc,
|
|
32
|
+
albumViewImageParams,
|
|
33
|
+
readAlbumSettings,
|
|
34
|
+
type AlbumItem
|
|
35
|
+
} from "@serene-pub/core-catalog/album"
|
|
36
|
+
import { useWidgetContext } from "../context"
|
|
37
|
+
|
|
38
|
+
const widget = useWidgetContext()
|
|
39
|
+
const t = (source: string): string => widget?.current.t(source) ?? source
|
|
40
|
+
|
|
41
|
+
const settings = $derived(
|
|
42
|
+
readAlbumSettings(widget?.current.settings?.v1)
|
|
43
|
+
)
|
|
44
|
+
const items = $derived(
|
|
45
|
+
albumItems(widget?.current.messages?.v1, settings, {
|
|
46
|
+
locale: widget?.current.locale?.v1,
|
|
47
|
+
t
|
|
48
|
+
})
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
/** Pictures whose file failed to load, by part id. */
|
|
52
|
+
const missing = new SvelteSet<number>()
|
|
53
|
+
/** What the lightbox pages through: every picture still there, in the order drawn. */
|
|
54
|
+
const openable = $derived(items.filter((i) => !missing.has(i.partId)))
|
|
55
|
+
|
|
56
|
+
const latest = $derived(settings.arrangement === "latest")
|
|
57
|
+
const lead = $derived(items[0])
|
|
58
|
+
const rest = $derived(items.slice(1))
|
|
59
|
+
|
|
60
|
+
/** Why the page declined the last press, this widget's own. */
|
|
61
|
+
let refusal = $state<string | null>(null)
|
|
62
|
+
|
|
63
|
+
async function open(item: AlbumItem): Promise<void> {
|
|
64
|
+
const index = openable.findIndex((i) => i.partId === item.partId)
|
|
65
|
+
if (index < 0) return
|
|
66
|
+
refusal = null
|
|
67
|
+
try {
|
|
68
|
+
await widget?.current.request("view-image", albumViewImageParams(openable, index))
|
|
69
|
+
} catch (e) {
|
|
70
|
+
refusal = e instanceof Error && e.message ? e.message : t("That did not go through. Try again.")
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function label(item: AlbumItem): string {
|
|
75
|
+
const at = openable.findIndex((i) => i.partId === item.partId)
|
|
76
|
+
return albumOpenLabel(item, at, openable.length, t)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const count = $derived(
|
|
80
|
+
items.length === 1 ? t("1 picture") : `${items.length} ${t("pictures")}`
|
|
81
|
+
)
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
{#snippet tile(item: AlbumItem, big: boolean)}
|
|
85
|
+
{#if missing.has(item.partId)}
|
|
86
|
+
<div
|
|
87
|
+
data-widget-part="album.tile"
|
|
88
|
+
data-origin={item.origin}
|
|
89
|
+
data-missing=""
|
|
90
|
+
role="img"
|
|
91
|
+
aria-label={`${item.label}: ${t("File no longer available")}`}
|
|
92
|
+
>
|
|
93
|
+
<sp-icon name="image-off" size="20"></sp-icon>
|
|
94
|
+
<span>{t("File no longer available")}</span>
|
|
95
|
+
</div>
|
|
96
|
+
{:else}
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
data-widget-part="album.tile"
|
|
100
|
+
data-origin={item.origin}
|
|
101
|
+
data-part-id={item.partId}
|
|
102
|
+
data-message-id={item.messageId}
|
|
103
|
+
aria-label={label(item)}
|
|
104
|
+
onclick={() => open(item)}
|
|
105
|
+
>
|
|
106
|
+
<img
|
|
107
|
+
src={albumSrc(item.assetId, big ? "fitted" : "thumb")}
|
|
108
|
+
alt=""
|
|
109
|
+
loading="lazy"
|
|
110
|
+
decoding="async"
|
|
111
|
+
onerror={() => missing.add(item.partId)}
|
|
112
|
+
/>
|
|
113
|
+
<span data-widget-part="album.origin" title={t(ALBUM_ORIGIN_NAMES[item.origin])} aria-hidden="true">
|
|
114
|
+
<sp-icon name={item.origin === "attached" ? "paperclip" : "sparkles"} size="12"></sp-icon>
|
|
115
|
+
</span>
|
|
116
|
+
{#if item.caption}
|
|
117
|
+
<span data-widget-part="album.caption" aria-hidden="true">{item.caption}</span>
|
|
118
|
+
{/if}
|
|
119
|
+
</button>
|
|
120
|
+
{/if}
|
|
121
|
+
{/snippet}
|
|
122
|
+
|
|
123
|
+
<div
|
|
124
|
+
data-widget-part="album.root"
|
|
125
|
+
data-tile={settings.tile}
|
|
126
|
+
data-arrangement={settings.arrangement}
|
|
127
|
+
data-source={settings.source}
|
|
128
|
+
role="group"
|
|
129
|
+
aria-label={t("Album")}
|
|
130
|
+
>
|
|
131
|
+
{#if refusal}
|
|
132
|
+
<p data-widget-part="album.alert" role="alert">{refusal}</p>
|
|
133
|
+
{/if}
|
|
134
|
+
|
|
135
|
+
{#if !items.length}
|
|
136
|
+
<div data-widget-part="album.empty empty" role="status">
|
|
137
|
+
<sp-icon name="book-image" size="20"></sp-icon>
|
|
138
|
+
<span>{t(ALBUM_EMPTY[settings.source])}</span>
|
|
139
|
+
</div>
|
|
140
|
+
{:else}
|
|
141
|
+
<p data-widget-part="album.toolbar toolbar">{count}</p>
|
|
142
|
+
{#if latest}
|
|
143
|
+
{#if lead}
|
|
144
|
+
<div data-widget-part="album.latest">
|
|
145
|
+
{@render tile(lead, true)}
|
|
146
|
+
</div>
|
|
147
|
+
{/if}
|
|
148
|
+
{#if rest.length}
|
|
149
|
+
<ul data-widget-part="album.strip list">
|
|
150
|
+
{#each rest as item (item.partId)}
|
|
151
|
+
<li>{@render tile(item, false)}</li>
|
|
152
|
+
{/each}
|
|
153
|
+
</ul>
|
|
154
|
+
{/if}
|
|
155
|
+
{:else}
|
|
156
|
+
<ul data-widget-part="album.grid list">
|
|
157
|
+
{#each items as item (item.partId)}
|
|
158
|
+
<li>{@render tile(item, false)}</li>
|
|
159
|
+
{/each}
|
|
160
|
+
</ul>
|
|
161
|
+
{/if}
|
|
162
|
+
{/if}
|
|
163
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `album` component (PLAN-core-widgets W2): every picture on the
|
|
3
|
+
* session's lines, newest first, as the page's UI worker runs it. `npm run
|
|
4
|
+
* build` compiles it with the CLI's component bundler to
|
|
5
|
+
* `dist/components/album.js`, the module the app serves at `/core-ui/album`.
|
|
6
|
+
*/
|
|
7
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
8
|
+
import Album from './Album.svelte'
|
|
9
|
+
|
|
10
|
+
export default svelteComponent(Album)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Core's Annex widget as a remote component (W9): 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 AnnexWidget from "./AnnexWidget.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: "annex", instanceId: "annex", title: "Annex" }
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<AnnexWidget />
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Annex (PLAN-core-widgets W9): what the pipeline knows that I may see —
|
|
4
|
+
* one declared annex key, by its label, from the viewer's own view of the
|
|
5
|
+
* annex (`annex.v1`). Text is prose, a number or a choice one row, a list
|
|
6
|
+
* chips, an object a row per member. Everything it shows is worked out in
|
|
7
|
+
* the plain half (`annexWidgetView`); this only draws it.
|
|
8
|
+
*
|
|
9
|
+
* Never silent: with no key picked, nothing written, or nothing the
|
|
10
|
+
* viewer may see, it says which, in one line.
|
|
11
|
+
*
|
|
12
|
+
* **Edit** is the Session data list's: a text field the host lists as the
|
|
13
|
+
* viewer's to set gets an Edit button, which opens the text in place;
|
|
14
|
+
* Save presses the field's ready-made action (`<owner>:annex#<key>`) with
|
|
15
|
+
* `{ value }` — the same door and the same write. The new value comes
|
|
16
|
+
* back through `annex.v1`; a refusal is the page's to say.
|
|
17
|
+
*
|
|
18
|
+
* The markup carries no look: each element names what it is in
|
|
19
|
+
* `data-widget-part` (`annex.prose`, `annex.row row`, …), the state and
|
|
20
|
+
* the drawn shape ride on the root's `data-state` and `data-shape`, and
|
|
21
|
+
* the default widget stylesheet draws them (STYLE-GUIDE §6.16).
|
|
22
|
+
*/
|
|
23
|
+
import {
|
|
24
|
+
annexWidgetFieldsFrom,
|
|
25
|
+
annexWidgetView,
|
|
26
|
+
readAnnexWidgetSettings
|
|
27
|
+
} from "@serene-pub/core-catalog/annex"
|
|
28
|
+
import { useWidgetContext } from "../context"
|
|
29
|
+
|
|
30
|
+
const widget = useWidgetContext()
|
|
31
|
+
const t = (source: string): string => widget?.current.t(source) ?? source
|
|
32
|
+
const uid = $props.id()
|
|
33
|
+
|
|
34
|
+
const settings = $derived(
|
|
35
|
+
readAnnexWidgetSettings(widget?.current.settings?.v1)
|
|
36
|
+
)
|
|
37
|
+
const view = $derived(
|
|
38
|
+
annexWidgetView({
|
|
39
|
+
annex: widget?.current.annex?.v1,
|
|
40
|
+
fields: annexWidgetFieldsFrom(widget?.current.actions?.v1),
|
|
41
|
+
key: settings.key,
|
|
42
|
+
viewer: widget?.current.viewer?.v1,
|
|
43
|
+
locale: widget?.current.locale?.v1,
|
|
44
|
+
t
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
/** The editor, open, and its text. */
|
|
49
|
+
let editing = $state(false)
|
|
50
|
+
let draft = $state("")
|
|
51
|
+
/** Why the last Save did not go through, this widget's own. */
|
|
52
|
+
let refusal = $state<string | null>(null)
|
|
53
|
+
|
|
54
|
+
// Another key picked: an open editor was for the old one. Keyed on the
|
|
55
|
+
// identity alone, so a value pushed while someone types leaves it open.
|
|
56
|
+
const identity = $derived(view.identity)
|
|
57
|
+
$effect(() => {
|
|
58
|
+
void identity
|
|
59
|
+
editing = false
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
function startEdit(): void {
|
|
63
|
+
draft = view.draft
|
|
64
|
+
refusal = null
|
|
65
|
+
editing = true
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function save(): void {
|
|
69
|
+
if (!identity) return
|
|
70
|
+
refusal = null
|
|
71
|
+
try {
|
|
72
|
+
widget?.current.invoke(identity, { payload: { value: draft } })
|
|
73
|
+
editing = false
|
|
74
|
+
} catch (e) {
|
|
75
|
+
refusal = e instanceof Error && e.message ? e.message : t("That did not go through. Try again.")
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<div
|
|
81
|
+
data-widget-part="annex.root"
|
|
82
|
+
data-state={view.state}
|
|
83
|
+
data-shape={view.state === "value" ? view.shape : undefined}
|
|
84
|
+
role="group"
|
|
85
|
+
aria-label={view.title}
|
|
86
|
+
>
|
|
87
|
+
{#if refusal}
|
|
88
|
+
<p data-widget-part="annex.alert" role="alert">{refusal}</p>
|
|
89
|
+
{/if}
|
|
90
|
+
|
|
91
|
+
{#if settings.showLabel && view.state !== "pick"}
|
|
92
|
+
<p data-widget-part="annex.label label">{view.title}</p>
|
|
93
|
+
{/if}
|
|
94
|
+
|
|
95
|
+
{#if editing && identity}
|
|
96
|
+
<div data-widget-part="annex.editor">
|
|
97
|
+
<textarea
|
|
98
|
+
id={`annex-${uid}-text`}
|
|
99
|
+
data-widget-part="annex.text"
|
|
100
|
+
aria-label={view.title}
|
|
101
|
+
bind:value={draft}
|
|
102
|
+
></textarea>
|
|
103
|
+
<div data-widget-part="annex.editor-actions toolbar">
|
|
104
|
+
<button type="button" data-widget-part="annex.cancel" onclick={() => (editing = false)}>
|
|
105
|
+
{t("Cancel")}
|
|
106
|
+
</button>
|
|
107
|
+
<button type="button" data-widget-part="annex.save" onclick={save}>
|
|
108
|
+
{t("Save")}
|
|
109
|
+
</button>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
{:else if view.state === "value"}
|
|
113
|
+
<div data-widget-part="annex.value value">
|
|
114
|
+
{#if view.drawn.as === "prose"}
|
|
115
|
+
<p data-widget-part="annex.prose">{view.drawn.text}</p>
|
|
116
|
+
{:else if view.drawn.as === "chips"}
|
|
117
|
+
<ul data-widget-part="annex.chips list" aria-label={view.title}>
|
|
118
|
+
{#each view.drawn.chips as chip, i (i)}
|
|
119
|
+
<li data-widget-part="annex.chip chip">{chip}</li>
|
|
120
|
+
{/each}
|
|
121
|
+
</ul>
|
|
122
|
+
{:else}
|
|
123
|
+
<dl data-widget-part="annex.rows list">
|
|
124
|
+
{#each view.drawn.rows as row (row.key)}
|
|
125
|
+
<div data-widget-part="annex.row row" data-key={row.key}>
|
|
126
|
+
<dt data-widget-part="annex.row-label label">{row.label}</dt>
|
|
127
|
+
<dd data-widget-part="annex.row-value value">{row.text}</dd>
|
|
128
|
+
</div>
|
|
129
|
+
{/each}
|
|
130
|
+
</dl>
|
|
131
|
+
{/if}
|
|
132
|
+
</div>
|
|
133
|
+
{:else}
|
|
134
|
+
<div data-widget-part="annex.empty empty" role="status">
|
|
135
|
+
<sp-icon name="clipboard-list" size="20"></sp-icon>
|
|
136
|
+
<span>{view.empty}</span>
|
|
137
|
+
</div>
|
|
138
|
+
{/if}
|
|
139
|
+
|
|
140
|
+
{#if view.canEdit && !editing}
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
data-widget-part="annex.edit"
|
|
144
|
+
aria-label={`${t("Edit")} ${view.title}`}
|
|
145
|
+
onclick={startEdit}
|
|
146
|
+
>
|
|
147
|
+
<sp-icon name="pencil" size="14"></sp-icon>
|
|
148
|
+
<span>{t("Edit")}</span>
|
|
149
|
+
</button>
|
|
150
|
+
{/if}
|
|
151
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's `annex` component (PLAN-core-widgets W9): one declared annex key, by
|
|
3
|
+
* its label, in the shape it was declared in, as the page's UI worker runs
|
|
4
|
+
* it. `npm run build` compiles it with the CLI's component bundler to
|
|
5
|
+
* `dist/components/annex.js`, the module the app serves at `/core-ui/annex`.
|
|
6
|
+
*/
|
|
7
|
+
import { svelteComponent } from '@serene-pub/component-client/svelte'
|
|
8
|
+
import Annex from './Annex.svelte'
|
|
9
|
+
|
|
10
|
+
export default svelteComponent(Annex)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Core's Who's here widget as a remote component (W10): the component
|
|
4
|
+
* context, 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 AttendanceWidget from "./AttendanceWidget.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: "attendance", instanceId: "attendance", title: "Who's here" }
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<AttendanceWidget />
|