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