@serene-pub/core-catalog 0.6.0-pr-8 → 0.6.0-pr-9
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 +1 -1
- package/components/shared/chronicle/ChronicleWidget.svelte +127 -57
- package/components/shared/composer/ComposerWidget.svelte +17 -5
- package/components/shared/composer/settings.ts +6 -2
- package/components/shared/composer/target.ts +19 -0
- package/components/shared/dialogue-box/DialogueBoxWidget.svelte +2 -2
- package/components/shared/lore-entries/LoreEntriesWidget.svelte +39 -35
- package/components/shared/messages/MessageBlocksView.svelte +1 -1
- package/components/shared/messages/MessageControls.svelte +21 -4
- package/components/shared/messages/MessagesWidget.svelte +24 -8
- package/components/shared/messages/NextCharacterBlock.svelte +18 -3
- package/components/shared/messages/SceneDivider.svelte +22 -12
- package/components/shared/messages/SessionComposer.svelte +67 -22
- package/components/shared/messages/SessionContainer.svelte +87 -32
- package/components/shared/messages/SessionMessage.svelte +68 -29
- package/components/shared/messages/SpokenLine.svelte +45 -13
- package/components/shared/messages/TurnLine.svelte +233 -45
- package/components/shared/messages/conversation.svelte.ts +30 -2
- package/components/shared/messages/rowFacts.ts +44 -0
- package/components/shared/messages/spokenLine.ts +63 -14
- package/components/shared/places/PlacesWidget.svelte +32 -20
- package/components/shared/routine-log/routineLog.ts +5 -21
- package/components/shared/session-runs/SessionRunsWidget.svelte +16 -12
- package/dist/components/actions.js +5 -5
- package/dist/components/actions.source.json +1 -1
- package/dist/components/album.js +1 -1
- package/dist/components/album.source.json +1 -1
- package/dist/components/annex.js +1 -1
- package/dist/components/annex.source.json +1 -1
- package/dist/components/attendance.js +1 -1
- package/dist/components/attendance.source.json +1 -1
- package/dist/components/authors-note.js +1 -1
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +3 -3
- package/dist/components/backdrop.source.json +1 -1
- package/dist/components/chronicle.js +641 -484
- package/dist/components/chronicle.source.json +1 -1
- package/dist/components/composer.js +188 -153
- package/dist/components/composer.source.json +1 -1
- package/dist/components/core-ui.json +1 -1
- package/dist/components/dialogue-box.js +11 -11
- package/dist/components/dialogue-box.source.json +1 -1
- package/dist/components/lore-entries.js +101 -92
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +351 -275
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +237 -202
- package/dist/components/places.source.json +1 -1
- package/dist/components/routine-log.js +6 -17
- package/dist/components/routine-log.source.json +1 -1
- package/dist/components/scene-portraits.js +4 -4
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/session-runs.js +118 -211
- package/dist/components/session-runs.source.json +1 -1
- package/dist/components/{shared-OVDOAXYZ.js → shared-47J4TNSF.js} +1 -1
- package/dist/components/{shared-ASZVJYPD.js → shared-EFMMT76D.js} +56 -3
- package/dist/components/{shared-N7FFW5TX.js → shared-FOVKPMSK.js} +3 -3
- package/dist/components/{shared-7SWDK5MC.js → shared-HEAKNNZB.js} +4 -0
- package/dist/components/shared-JXP6SHKF.js +159 -0
- package/dist/components/{shared-TNJZHTMT.js → shared-JXYPKSTQ.js} +1 -1
- package/dist/components/{shared-2FMI3LEE.js → shared-KJIOSSE3.js} +2 -2
- package/dist/components/{shared-RQYMTMHF.js → shared-KLURQFWI.js} +2 -2
- package/dist/components/{shared-BR2KXM25.js → shared-MHCNUDUT.js} +96 -12
- package/dist/components/{shared-6S23SGJB.js → shared-NICRJ4Z2.js} +1 -1
- package/dist/components/{shared-M7AYID43.js → shared-W2BBJCNE.js} +7 -7
- package/dist/components/{shared-XJD6Y2OU.js → shared-YYYXFDZU.js} +387 -248
- package/dist/components/stats.js +5 -5
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-line.js +384 -112
- package/dist/components/turn-line.source.json +1 -1
- package/dist/components/turn-order.js +4 -4
- package/dist/components/turn-order.source.json +1 -1
- package/dist/factories/answerForm.d.ts +6 -0
- package/dist/factories/answerForm.js +104 -96
- package/dist/factories/turnOrder.d.ts +84 -107
- package/dist/factories/turnOrder.js +89 -131
- package/dist/genres/chat/create.js +2 -0
- package/dist/genres/chat/memory.js +64 -43
- package/dist/genres/chat/respond.d.ts +7 -6
- package/dist/genres/chat/respond.js +13 -4
- package/dist/genres/chat/turnOrder.d.ts +2 -2
- package/dist/genres/chat/turnOrder.js +28 -12
- package/dist/genres/defaults.d.ts +8 -2
- package/dist/genres/defaults.js +51 -27
- package/dist/genres/dungeon-crawler/journal.d.ts +1 -1
- package/dist/genres/dungeon-crawler/journal.js +1 -1
- package/dist/genres/dungeon-crawler/rest.js +5 -3
- package/dist/genres/dungeon-crawler/story.d.ts +2 -1
- package/dist/genres/dungeon-crawler/story.js +7 -4
- package/dist/genres/dungeon-crawler/storyScripts.js +85 -9
- package/dist/genres/dungeon-crawler/turnOrder.d.ts +8 -9
- package/dist/genres/dungeon-crawler/turnOrder.js +33 -23
- package/dist/genres/guide/create.js +2 -0
- package/dist/genres/guide/turnOrder.d.ts +3 -3
- package/dist/genres/guide/turnOrder.js +29 -13
- package/dist/genres/lair/answerForm.js +4 -1
- package/dist/genres/lair/buildRoom.js +4 -3
- package/dist/genres/lair/castellanAction.js +160 -154
- package/dist/genres/lair/fileCurrentRoom.js +13 -10
- package/dist/genres/lair/fileRoom.js +4 -3
- package/dist/genres/lair/keeper.js +2 -0
- package/dist/genres/lair/names.d.ts +2 -0
- package/dist/genres/lair/names.js +2 -0
- package/dist/genres/lair/reply.js +16 -6
- package/dist/genres/lair/roomAnswer.js +4 -3
- package/dist/genres/lair/scratchpad.js +9 -7
- package/dist/genres/lair/turnOrder.d.ts +3 -2
- package/dist/genres/lair/turnOrder.js +45 -16
- package/dist/genres/story/create.d.ts +1 -0
- package/dist/genres/story/create.js +1 -0
- package/dist/genres/story/reckon.js +43 -10
- package/dist/genres/story/turnOrder.d.ts +13 -3
- package/dist/genres/story/turnOrder.js +79 -22
- package/dist/index.js +8 -8
- package/dist/primers/ninth-mile.d.ts +3 -4
- package/dist/registry/entries.js +16 -5
- package/dist/registry/genres.d.ts +61 -54
- package/dist/registry/genres.js +123 -106
- package/dist/registry/widgets.js +12 -1
- package/dist/seed/presets.js +11 -7
- package/dist/seed/scripts.js +3 -0
- package/dist/shared/lore.d.ts +13 -0
- package/dist/shared/lore.js +37 -1
- package/dist/shared/reckoning.d.ts +7 -1
- package/dist/shared/reckoning.js +24 -17
- package/dist/shared/sceneBoundaries.js +7 -6
- package/dist/shared/speakMessage.d.ts +9 -2
- package/dist/shared/speakMessage.js +32 -9
- package/dist/shared/ui/chronicle/index.d.ts +7 -2
- package/dist/shared/ui/chronicle/index.js +21 -12
- package/dist/shared/ui/conversation/index.d.ts +1 -0
- package/dist/shared/ui/conversation/index.js +2 -0
- package/dist/shared/ui/conversation/messageVerbState.d.ts +5 -0
- package/dist/shared/ui/conversation/messageVerbState.js +3 -3
- package/dist/shared/ui/conversation/rewindStrip.d.ts +11 -4
- package/dist/shared/ui/conversation/rewindStrip.js +9 -7
- package/dist/shared/ui/conversation/runsInProgress.d.ts +30 -0
- package/dist/shared/ui/conversation/runsInProgress.js +47 -0
- package/dist/shared/ui/conversation/tableChannel.d.ts +8 -11
- package/dist/shared/ui/conversation/tableChannel.js +8 -9
- package/dist/shared/ui/routine-log/index.d.ts +3 -0
- package/dist/shared/ui/routine-log/index.js +22 -0
- package/dist/shared/ui/session-runs/index.d.ts +9 -1
- package/dist/shared/ui/session-runs/index.js +20 -14
- package/dist/shared/ui/turn-order/index.d.ts +0 -9
- package/dist/shared/ui/turn-order/index.js +1 -2
- package/package.json +8 -8
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* An empty order with people to choose from — a round that is over, or
|
|
18
18
|
* a manual strategy waiting to be told — waits on a message and offers
|
|
19
|
-
* the pick
|
|
19
|
+
* the pick (at the compact width, the shorter "Your move, or pick who
|
|
20
|
+
* speaks", so the line fits a phone). 🚧 A round that waits on others once the viewer has had their
|
|
20
21
|
* say (`waitingFor`, the page's reading) says so: "Waiting for Maren Holt". An order whose entries are all on other channels shows
|
|
21
22
|
* nothing here.
|
|
22
23
|
*
|
|
@@ -68,6 +69,8 @@
|
|
|
68
69
|
waitingFor?: readonly string[]
|
|
69
70
|
/** 🚧 The viewer owns the session: their Continue moves past a waiting player (D5). */
|
|
70
71
|
viewerIsOwner?: boolean
|
|
72
|
+
/** Why nothing starts by itself, as the server sent it (to the owner only): said under the line, or in place of the waiting sentence. */
|
|
73
|
+
standstill?: "no-turn-order" | "no-auto-advance" | "no-extent"
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
let {
|
|
@@ -81,8 +84,15 @@
|
|
|
81
84
|
canChooseSomeoneElse = true,
|
|
82
85
|
viewerUserId = null,
|
|
83
86
|
waitingFor = [],
|
|
84
|
-
viewerIsOwner = false
|
|
87
|
+
viewerIsOwner = false,
|
|
88
|
+
standstill
|
|
85
89
|
}: Props = $props()
|
|
90
|
+
const STANDSTILL_WORDS = {
|
|
91
|
+
"no-turn-order": "This genre sets no turn order. Pick who speaks, or press Continue.",
|
|
92
|
+
"no-auto-advance": "This genre sets no Auto-advance, so nothing starts by itself. Press Continue.",
|
|
93
|
+
"no-extent":
|
|
94
|
+
"Auto-advance is on, but this genre does not say how far it runs, so nothing starts by itself. Press Continue."
|
|
95
|
+
} as const
|
|
86
96
|
const waitingWords = $derived(
|
|
87
97
|
waitingFor.length ? `Waiting for ${new Intl.ListFormat("en", { style: "long", type: "conjunction" }).format([...waitingFor])}` : ""
|
|
88
98
|
)
|
|
@@ -140,7 +150,9 @@
|
|
|
140
150
|
{:else if shouldShow && !order.length && candidates.length}
|
|
141
151
|
<div data-widget-part="messages.turn-line-waiting turn-line.waiting messages.next-up-waiting turn-line.next-up-waiting">
|
|
142
152
|
<span data-widget-part="messages.turn-line-text turn-line.text messages.next-up-text turn-line.next-up-text">
|
|
143
|
-
|
|
153
|
+
{standstill === "no-turn-order" ? STANDSTILL_WORDS["no-turn-order"] : conversation.ctx.layout?.v1?.tier === "compact"
|
|
154
|
+
? "Your move, or pick who speaks"
|
|
155
|
+
: "Waiting for a message — or pick who speaks next"}
|
|
144
156
|
</span>
|
|
145
157
|
<button type="button" data-widget-part="messages.turn-line-pick turn-line.pick messages.next-up-pick turn-line.next-up-pick" onclick={onSomeoneElse}>
|
|
146
158
|
<sp-icon name="users" size="14"></sp-icon>
|
|
@@ -204,6 +216,9 @@
|
|
|
204
216
|
Continue moves past {headName}: their turn is skipped this round.
|
|
205
217
|
</p>
|
|
206
218
|
{/if}
|
|
219
|
+
{#if standstill === "no-auto-advance" || standstill === "no-extent"}
|
|
220
|
+
<p data-widget-part="messages.turn-line-standstill turn-line.standstill">{STANDSTILL_WORDS[standstill]}</p>
|
|
221
|
+
{/if}
|
|
207
222
|
{#if after.length}
|
|
208
223
|
<p data-widget-part="messages.turn-line-after turn-line.after messages.next-up-after turn-line.next-up-after">
|
|
209
224
|
Then {after.map((e) => nameOf(e.ref)).join(", ")}
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
const scene = $derived(divider.scene)
|
|
47
47
|
const name = $derived(scene.name?.trim() ? scene.name : "Scene")
|
|
48
48
|
const canEdit = $derived(conv.scenes.boundaries)
|
|
49
|
+
/** The session's notes are the owner's: a guest's divider names the scene and opens nothing. */
|
|
50
|
+
const isOwner = $derived(!!conv.dossier?.isOwner)
|
|
51
|
+
const startsHere = $derived(startsEntry && isOwner)
|
|
49
52
|
const refusal = $derived(
|
|
50
53
|
conv.scenes.refusal?.at === "scene" && conv.scenes.refusal.id === scene.id
|
|
51
54
|
? conv.scenes.refusal.text
|
|
@@ -225,7 +228,7 @@
|
|
|
225
228
|
<sp-icon name="film" size="14"></sp-icon>
|
|
226
229
|
{name}
|
|
227
230
|
</button>
|
|
228
|
-
{:else}
|
|
231
|
+
{:else if isOwner}
|
|
229
232
|
<button
|
|
230
233
|
type="button"
|
|
231
234
|
data-widget-part="messages.scene-title"
|
|
@@ -235,6 +238,11 @@
|
|
|
235
238
|
<sp-icon name="film" size="14"></sp-icon>
|
|
236
239
|
{name}
|
|
237
240
|
</button>
|
|
241
|
+
{:else}
|
|
242
|
+
<span data-widget-part="messages.scene-title">
|
|
243
|
+
<sp-icon name="film" size="14"></sp-icon>
|
|
244
|
+
{name}
|
|
245
|
+
</span>
|
|
238
246
|
{/if}
|
|
239
247
|
{#if divider.open}
|
|
240
248
|
<span data-widget-part="messages.scene-title-state">open</span>
|
|
@@ -294,7 +302,7 @@
|
|
|
294
302
|
{/if}
|
|
295
303
|
</span>
|
|
296
304
|
{/if}
|
|
297
|
-
{#if canEdit ||
|
|
305
|
+
{#if canEdit || startsHere}
|
|
298
306
|
<!-- `sp-popover` (§3.5): the host's positioned panel; the rows wear
|
|
299
307
|
the message menu's parts beside their own, so they read as one
|
|
300
308
|
family of menus. -->
|
|
@@ -315,7 +323,7 @@
|
|
|
315
323
|
</button>
|
|
316
324
|
<div data-widget-part="messages.scene-menu-panel messages.message-options-panel">
|
|
317
325
|
<article data-widget-part="messages.scene-menu-list messages.message-options-list">
|
|
318
|
-
{#if
|
|
326
|
+
{#if startsHere}
|
|
319
327
|
<button
|
|
320
328
|
type="button"
|
|
321
329
|
data-widget-part="messages.scene-option messages.message-option"
|
|
@@ -358,15 +366,17 @@
|
|
|
358
366
|
<span>{reviewing ? "Review summary" : "Summarize"}</span>
|
|
359
367
|
</button>
|
|
360
368
|
{/if}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
369
|
+
{#if isOwner}
|
|
370
|
+
<button
|
|
371
|
+
type="button"
|
|
372
|
+
data-widget-part="messages.scene-option messages.message-option"
|
|
373
|
+
title="Open this scene in the lorebook"
|
|
374
|
+
onclick={press(openInLore)}
|
|
375
|
+
>
|
|
376
|
+
<sp-icon name="external-link" size="16"></sp-icon>
|
|
377
|
+
<span>Open in lorebook</span>
|
|
378
|
+
</button>
|
|
379
|
+
{/if}
|
|
370
380
|
{#if divider.live}
|
|
371
381
|
{#if divider.startEarlier !== null || divider.startLater !== null || divider.reopens}
|
|
372
382
|
<hr data-widget-part="messages.scene-menu-divider messages.message-options-divider" />
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
import { i18nText } from "@serene-pub/sdk/component"
|
|
40
40
|
import { untrack } from "svelte"
|
|
41
41
|
import { useConversation } from "./conversation.svelte"
|
|
42
|
+
import { composerSendShown } from "../composer/target"
|
|
42
43
|
import type { WidgetAction } from "@serene-pub/sdk/component"
|
|
43
44
|
|
|
44
45
|
/** The More panel's tab that is not a pane: the turn controls, in the actions row. */
|
|
@@ -49,9 +50,14 @@
|
|
|
49
50
|
composerSkin?: "classic" | "minimal" | "writer" | "quill"
|
|
50
51
|
/** Hides the Actions label and its row outright. */
|
|
51
52
|
showActions?: boolean
|
|
53
|
+
/**
|
|
54
|
+
* 🚧 Draws Send and Stop (the `showSend` setting). Off hides them where Enter sends;
|
|
55
|
+
* at the compact width they always show.
|
|
56
|
+
*/
|
|
57
|
+
showSend?: boolean
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
let { composerSkin = "classic", showActions = true }: Props = $props()
|
|
60
|
+
let { composerSkin = "classic", showActions = true, showSend = true }: Props = $props()
|
|
55
61
|
|
|
56
62
|
const conv = useConversation()
|
|
57
63
|
const c = $derived(conv.dossier?.composer)
|
|
@@ -292,10 +298,37 @@
|
|
|
292
298
|
})
|
|
293
299
|
let hintVisible = $state(false)
|
|
294
300
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
/**
|
|
302
|
+
* Who the viewer may write as, from whichever source the host fills: the
|
|
303
|
+
* seats (`c.seats`, by participant reference), else the personas.
|
|
304
|
+
*/
|
|
305
|
+
type WriteAsEntry = {
|
|
306
|
+
key: string | number
|
|
307
|
+
name: string
|
|
308
|
+
avatarRef: string
|
|
309
|
+
active: boolean
|
|
310
|
+
choose: () => void
|
|
311
|
+
}
|
|
312
|
+
const entries = $derived.by((): WriteAsEntry[] => {
|
|
313
|
+
if (c?.seats) {
|
|
314
|
+
return c.seats.map((s) => ({
|
|
315
|
+
key: s.seatRef,
|
|
316
|
+
name: s.name,
|
|
317
|
+
avatarRef: s.seatRef,
|
|
318
|
+
active: s.seatRef === c?.seatRef,
|
|
319
|
+
choose: () => void conv.request("write-as", { seatRef: s.seatRef })
|
|
320
|
+
}))
|
|
321
|
+
}
|
|
322
|
+
return (c?.personas ?? []).map((p) => ({
|
|
323
|
+
key: p.personaId,
|
|
324
|
+
name: p.name,
|
|
325
|
+
avatarRef: personaRefOf(p.personaId),
|
|
326
|
+
active: p.personaId === c?.personaId,
|
|
327
|
+
choose: () => void conv.request("switch-persona", { personaId: p.personaId })
|
|
328
|
+
}))
|
|
329
|
+
})
|
|
330
|
+
const activeEntry = $derived(entries.find((e) => e.active) ?? null)
|
|
331
|
+
const entryCount = $derived(entries.length)
|
|
299
332
|
/**
|
|
300
333
|
* A persona's avatar reference: the `ref` its conversation cast row carries
|
|
301
334
|
* (🚧 the seat's); ⏳ `character:<personaId>` for a host that fills none.
|
|
@@ -530,8 +563,8 @@
|
|
|
530
563
|
let placeholder = $derived(
|
|
531
564
|
closed
|
|
532
565
|
? composerClosedPlaceholder(closed)
|
|
533
|
-
:
|
|
534
|
-
? `Write as ${
|
|
566
|
+
: activeEntry
|
|
567
|
+
? `Write as ${activeEntry.name}…`
|
|
535
568
|
: c?.playerLabel
|
|
536
569
|
? `Write as ${c.playerLabel}…`
|
|
537
570
|
: "Write a message…"
|
|
@@ -1013,8 +1046,8 @@
|
|
|
1013
1046
|
<!-- 🚧 Which channel this line lands on is the widget's channel tabs
|
|
1014
1047
|
now (lair fix 2, `messages.channel-tabs` above the log): the
|
|
1015
1048
|
composer writes on the tab shown. -->
|
|
1016
|
-
{#if
|
|
1017
|
-
{#if
|
|
1049
|
+
{#if activeEntry}
|
|
1050
|
+
{#if entryCount > 1}
|
|
1018
1051
|
<!-- `sp-popover` (§3.5): our button is the trigger, the card the panel. -->
|
|
1019
1052
|
<sp-popover
|
|
1020
1053
|
placement="top-start"
|
|
@@ -1023,10 +1056,10 @@
|
|
|
1023
1056
|
>
|
|
1024
1057
|
<button slot="trigger" type="button" data-widget-part="messages.composer-persona composer.persona"
|
|
1025
1058
|
title="Switch persona"
|
|
1026
|
-
aria-label="Switch persona (currently {
|
|
1027
|
-
<sp-avatar ref={
|
|
1059
|
+
aria-label="Switch persona (currently {activeEntry.name})">
|
|
1060
|
+
<sp-avatar ref={activeEntry.avatarRef} size="sm"></sp-avatar>
|
|
1028
1061
|
<span data-widget-part="messages.composer-persona-name composer.persona-name">
|
|
1029
|
-
{
|
|
1062
|
+
{activeEntry.name}
|
|
1030
1063
|
</span>
|
|
1031
1064
|
<sp-icon name="chevron-down" size="14"></sp-icon>
|
|
1032
1065
|
</button>
|
|
@@ -1034,27 +1067,27 @@
|
|
|
1034
1067
|
<p data-widget-part="messages.composer-persona-menu-title composer.persona-menu-title">
|
|
1035
1068
|
Write as
|
|
1036
1069
|
</p>
|
|
1037
|
-
{#each
|
|
1070
|
+
{#each entries as e (e.key)}
|
|
1038
1071
|
<button
|
|
1039
1072
|
type="button"
|
|
1040
1073
|
data-widget-part="messages.composer-persona-option composer.persona-option"
|
|
1041
|
-
aria-current={
|
|
1074
|
+
aria-current={e.active ? "true" : undefined}
|
|
1042
1075
|
onclick={() => {
|
|
1043
|
-
|
|
1076
|
+
e.choose()
|
|
1044
1077
|
personaSwitcherOpen = false
|
|
1045
1078
|
}}
|
|
1046
1079
|
>
|
|
1047
|
-
<sp-avatar ref={
|
|
1048
|
-
<span data-widget-part="messages.composer-persona-option-name composer.persona-option-name">{
|
|
1080
|
+
<sp-avatar ref={e.avatarRef} size="sm"></sp-avatar>
|
|
1081
|
+
<span data-widget-part="messages.composer-persona-option-name composer.persona-option-name">{e.name}</span>
|
|
1049
1082
|
</button>
|
|
1050
1083
|
{/each}
|
|
1051
1084
|
</div>
|
|
1052
1085
|
</sp-popover>
|
|
1053
1086
|
{:else}
|
|
1054
1087
|
<span data-widget-part="messages.composer-persona composer.persona">
|
|
1055
|
-
<sp-avatar ref={
|
|
1088
|
+
<sp-avatar ref={activeEntry.avatarRef} size="sm"></sp-avatar>
|
|
1056
1089
|
<span data-widget-part="messages.composer-persona-name composer.persona-name">
|
|
1057
|
-
{
|
|
1090
|
+
{activeEntry.name}
|
|
1058
1091
|
</span>
|
|
1059
1092
|
</span>
|
|
1060
1093
|
{/if}
|
|
@@ -1117,11 +1150,23 @@
|
|
|
1117
1150
|
</button>
|
|
1118
1151
|
{/if}
|
|
1119
1152
|
|
|
1120
|
-
{#if morePanes.length
|
|
1153
|
+
{#if morePanes.length === 0 && readersOffered}
|
|
1154
|
+
<!-- A menu of one item is the item: What can be attached opens
|
|
1155
|
+
the readers dialog (note 41) from its own button. -->
|
|
1156
|
+
<button
|
|
1157
|
+
type="button"
|
|
1158
|
+
data-widget-part="messages.composer-icon-button composer.icon-button messages.composer-readers-button composer.readers-button"
|
|
1159
|
+
title="What can be attached"
|
|
1160
|
+
aria-label="What can be attached"
|
|
1161
|
+
onclick={openReaders}
|
|
1162
|
+
>
|
|
1163
|
+
<sp-icon name="circle-help" size="16"></sp-icon>
|
|
1164
|
+
</button>
|
|
1165
|
+
{:else if morePanes.length > 0}
|
|
1121
1166
|
<!-- `sp-popover` (§3.5): our button is the trigger, the card the panel.
|
|
1122
1167
|
A panel filling the field area marks it `data-active`. Under
|
|
1123
1168
|
the panes, **What can be attached** opens the readers dialog
|
|
1124
|
-
(note 41)
|
|
1169
|
+
(note 41); with no panes it is its own button (above). -->
|
|
1125
1170
|
<sp-popover
|
|
1126
1171
|
placement="top-end"
|
|
1127
1172
|
open={moreMenuOpen}
|
|
@@ -1166,7 +1211,7 @@
|
|
|
1166
1211
|
</sp-popover>
|
|
1167
1212
|
{/if}
|
|
1168
1213
|
|
|
1169
|
-
{#if !hideCompose}
|
|
1214
|
+
{#if !hideCompose && composerSendShown(showSend, conv.ctx.layout?.v1?.tier)}
|
|
1170
1215
|
{#if isGenerating}
|
|
1171
1216
|
<button
|
|
1172
1217
|
type="button"
|
|
@@ -102,6 +102,8 @@
|
|
|
102
102
|
// is never drawn here, not even hidden.
|
|
103
103
|
const messages = $derived(conv.rows)
|
|
104
104
|
const sceneList = $derived(conv.dossier?.scenes ?? [])
|
|
105
|
+
/** The session's notes are the owner's: a guest's dates and scene names are text, not links into them. */
|
|
106
|
+
const isOwner = $derived(!!conv.dossier?.isOwner)
|
|
105
107
|
const loadingOlderMessages = $derived(!!conv.dossier?.loadingOlder)
|
|
106
108
|
const loaded = $derived(!!conv.dossier)
|
|
107
109
|
/**
|
|
@@ -165,6 +167,21 @@
|
|
|
165
167
|
messages.map((m) => (m.isHidden ? `${m.id}h` : m.id)).join(",")
|
|
166
168
|
)
|
|
167
169
|
|
|
170
|
+
/**
|
|
171
|
+
* What the lane-and-order deriveds below read off a row — its id (order),
|
|
172
|
+
* its channel (`cueAt`, `lanePlaces`, `laneById`, `shownOnLane`), whether
|
|
173
|
+
* the copy draws it inline (`conv.isInterleaved`) and the line it is
|
|
174
|
+
* anchored to (`anchorOf`) — and nothing else, so a streamed token that
|
|
175
|
+
* changes none of them reruns none of those deriveds. Each reads the key,
|
|
176
|
+
* then does its work under `untrack`. `drawnMessages` and the like hand
|
|
177
|
+
* rows to the template, so they are never keyed this way.
|
|
178
|
+
*/
|
|
179
|
+
let laneKey = $derived(
|
|
180
|
+
messages
|
|
181
|
+
.map((m) => `${m.id}|${m.channel ?? ""}|${conv.isInterleaved(m) ? 1 : 0}|${anchorOf(m) ?? ""}`)
|
|
182
|
+
.join(",")
|
|
183
|
+
)
|
|
184
|
+
|
|
168
185
|
const NO_MARKS: SceneMarks = {
|
|
169
186
|
sceneOf: new Map(),
|
|
170
187
|
dividers: new Map(),
|
|
@@ -195,11 +212,15 @@
|
|
|
195
212
|
let cueAt = $derived.by(() => {
|
|
196
213
|
const out = new Map<number, { id: number; reason: string }>()
|
|
197
214
|
if (!showSceneMarkers) return out
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
215
|
+
void laneKey
|
|
216
|
+
const cues = conv.scenes.cues
|
|
217
|
+
return untrack(() => {
|
|
218
|
+
const lanes = new Map(messages.map((m) => [m.id, laneOf(m.channel)]))
|
|
219
|
+
for (const c of cues)
|
|
220
|
+
if (lanes.get(c.messageId) === laneOf(c.channel) && !out.has(c.messageId))
|
|
221
|
+
out.set(c.messageId, { id: c.id, reason: c.reason })
|
|
222
|
+
return out
|
|
223
|
+
})
|
|
203
224
|
})
|
|
204
225
|
|
|
205
226
|
let entryMarks = $derived.by((): Map<number, EntryMarks> => {
|
|
@@ -228,15 +249,32 @@
|
|
|
228
249
|
orderedMessages(messages, order)
|
|
229
250
|
)
|
|
230
251
|
|
|
252
|
+
/** 🚧 ★ The settle line a channel reads (CP10): its own, when the dossier carries one for
|
|
253
|
+
* its lane; otherwise `main`'s (a line on no story channel rides `main`). */
|
|
254
|
+
function settledLineOn(channel: unknown): number | null {
|
|
255
|
+
const lane = laneOf(channel)
|
|
256
|
+
const by = conv.dossier?.settledThroughBy
|
|
257
|
+
if (by && typeof by === "object" && Object.prototype.hasOwnProperty.call(by, lane)) {
|
|
258
|
+
const own = by[lane]
|
|
259
|
+
return typeof own === "number" ? own : null
|
|
260
|
+
}
|
|
261
|
+
return conv.settledThrough ?? null
|
|
262
|
+
}
|
|
263
|
+
|
|
231
264
|
/** 🚧 The settle line's one mark (pr-6 R-a/R-b, sprint 2): after the newest settled
|
|
232
265
|
* line this copy shows, on its lane. */
|
|
233
266
|
let settledMarkAfter = $derived.by((): number | null => {
|
|
234
|
-
|
|
267
|
+
void conv.dossier?.settledThroughBy
|
|
268
|
+
void conv.settledThrough
|
|
269
|
+
const line = settledLineOn(conv.lane.current)
|
|
235
270
|
if (line === null) return null
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
271
|
+
void laneKey
|
|
272
|
+
return untrack(() => {
|
|
273
|
+
let best: number | null = null
|
|
274
|
+
for (const m of messages.filter((m) => shownOnLane(m)))
|
|
275
|
+
if (m.id <= line && (best === null || m.id > best)) best = m.id
|
|
276
|
+
return best
|
|
277
|
+
})
|
|
240
278
|
})
|
|
241
279
|
|
|
242
280
|
/**
|
|
@@ -245,8 +283,12 @@
|
|
|
245
283
|
* what the reader can reach here, never every channel's rows.
|
|
246
284
|
*/
|
|
247
285
|
let lanePlaces = $derived.by(() => {
|
|
248
|
-
|
|
249
|
-
|
|
286
|
+
void laneKey
|
|
287
|
+
void conv.lane.current
|
|
288
|
+
return untrack(() => {
|
|
289
|
+
const shown = messages.filter((m) => shownOnLane(m))
|
|
290
|
+
return new Map(shown.map((m, i) => [m.id, { n: i + 1, of: shown.length }]))
|
|
291
|
+
})
|
|
250
292
|
})
|
|
251
293
|
|
|
252
294
|
/**
|
|
@@ -254,7 +296,10 @@
|
|
|
254
296
|
* where its anchor is — on the anchor's lane — and none is ever the
|
|
255
297
|
* log's last line, so the anchor keeps the newest line's controls.
|
|
256
298
|
*/
|
|
257
|
-
const laneById = $derived
|
|
299
|
+
const laneById = $derived.by(() => {
|
|
300
|
+
void laneKey
|
|
301
|
+
return untrack(() => new Map(messages.map((m) => [m.id, m.channel || "main"])))
|
|
302
|
+
})
|
|
258
303
|
/**
|
|
259
304
|
* 🚧 The **dice fold** (PLAN-sheet-widget §16, `interleaveAs: fold`): an
|
|
260
305
|
* interleaved row is one head line — the host's summary, else its first
|
|
@@ -266,9 +311,12 @@
|
|
|
266
311
|
const openFolds = new SvelteSet<number>()
|
|
267
312
|
const folded = (msg: MessageV1) => conv.interleaveAs === "fold" && conv.isInterleaved(msg)
|
|
268
313
|
const lastOwnId = $derived.by((): number | null => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
314
|
+
void laneKey
|
|
315
|
+
return untrack(() => {
|
|
316
|
+
for (let i = messages.length - 1; i >= 0; i--)
|
|
317
|
+
if (!conv.isInterleaved(messages[i]!)) return messages[i]!.id
|
|
318
|
+
return null
|
|
319
|
+
})
|
|
272
320
|
})
|
|
273
321
|
function shownOnLane(msg: MessageV1): boolean {
|
|
274
322
|
const lane = conv.lane.current
|
|
@@ -491,7 +539,7 @@
|
|
|
491
539
|
<!-- History-entry marker: the date this stretch of the story is set
|
|
492
540
|
on, once before the entry's first scene message. -->
|
|
493
541
|
<li data-widget-part="messages.log-item" role="presentation" hidden={!onThisChannel}>
|
|
494
|
-
{#if entry.scene.historyEntryId}
|
|
542
|
+
{#if entry.scene.historyEntryId && isOwner}
|
|
495
543
|
<button
|
|
496
544
|
data-widget-part="messages.history-marker"
|
|
497
545
|
onclick={() =>
|
|
@@ -549,7 +597,7 @@
|
|
|
549
597
|
{#snippet dayMarkItem(msg: MessageV1, label: string)}
|
|
550
598
|
{@const filed = dayMarkEntry(msg.id)}
|
|
551
599
|
<li data-widget-part="messages.log-item" role="presentation">
|
|
552
|
-
{#if filed}
|
|
600
|
+
{#if filed && isOwner}
|
|
553
601
|
<button
|
|
554
602
|
data-widget-part="messages.history-marker messages.day-mark"
|
|
555
603
|
onclick={() =>
|
|
@@ -697,7 +745,7 @@
|
|
|
697
745
|
? undefined
|
|
698
746
|
: "")}
|
|
699
747
|
data-row-kind={conv.rowKind(msg) ?? undefined}
|
|
700
|
-
data-history-settled={
|
|
748
|
+
data-history-settled={(settledLineOn(msg.channel) ?? -1) >= msg.id ? "" : undefined}
|
|
701
749
|
>
|
|
702
750
|
{#if folded(msg)}
|
|
703
751
|
{@const isOpen = openFolds.has(msg.id)}
|
|
@@ -773,19 +821,26 @@
|
|
|
773
821
|
{#if entry?.isLastOfEntry && entry.historyEntry?.isCompleted && entry.historyEntry.nextEntry}
|
|
774
822
|
{@const next = entry.historyEntry.nextEntry}
|
|
775
823
|
<li data-widget-part="messages.log-item" role="presentation" hidden={!onThisChannel}>
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
824
|
+
{#if isOwner}
|
|
825
|
+
<button
|
|
826
|
+
data-widget-part="messages.history-marker"
|
|
827
|
+
onclick={() =>
|
|
828
|
+
openLore({
|
|
829
|
+
scope: "history",
|
|
830
|
+
entryId: next.id,
|
|
831
|
+
lorebookId: entry.scene.lorebookId
|
|
832
|
+
})}
|
|
833
|
+
title="Open next history entry in lorebook"
|
|
834
|
+
>
|
|
835
|
+
<sp-icon name="calendar" size="12"></sp-icon>
|
|
836
|
+
Next: {formatEntryDate(next)}
|
|
837
|
+
</button>
|
|
838
|
+
{:else}
|
|
839
|
+
<span data-widget-part="messages.history-marker">
|
|
840
|
+
<sp-icon name="calendar" size="12"></sp-icon>
|
|
841
|
+
Next: {formatEntryDate(next)}
|
|
842
|
+
</span>
|
|
843
|
+
{/if}
|
|
789
844
|
</li>
|
|
790
845
|
{/if}
|
|
791
846
|
{/each}
|