feat: add plain text dice roll detail
Introduces `plainDetail` to the dice engine to provide a non-HTML version of the roll results. This allows components to display the roll breakdown without needing to parse or render HTML.
This commit is contained in:
@@ -16,6 +16,7 @@ const schema = z.object({
|
||||
result: z.object({
|
||||
total: z.number(),
|
||||
detail: z.string(),
|
||||
plainDetail: z.string(),
|
||||
pools: z.array(
|
||||
z.object({
|
||||
rolls: z.array(z.number()),
|
||||
@@ -47,7 +48,7 @@ registerMessageType<RollPayload>({
|
||||
schema,
|
||||
defaultPayload: () => ({
|
||||
notation: "1d20",
|
||||
result: { total: 0, detail: "", pools: [] },
|
||||
result: { total: 0, detail: "", plainDetail: "", pools: [] },
|
||||
}),
|
||||
render: (p) => {
|
||||
const { result } = p;
|
||||
@@ -60,7 +61,9 @@ registerMessageType<RollPayload>({
|
||||
<span class="font-bold text-base">{result.total}</span>
|
||||
</span>
|
||||
</div>
|
||||
{result.detail && <p class="text-xs text-gray-400">{result.detail}</p>}
|
||||
{result.detail && (
|
||||
<p class="text-xs text-gray-400" innerHTML={result.detail} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user