diff --git a/src/main.css b/src/main.css
index e0826c7a..805ab1d0 100644
--- a/src/main.css
+++ b/src/main.css
@@ -56,150 +56,14 @@
margin: 0 6px;
}
-/** Tapered Rule */
-.obsidian-statblock-plugin .tapered-rule {
- width: auto;
- margin: 0.5em 0;
- height: 5px;
- background: -webkit-linear-gradient(
- 0deg,
- var(--statblock-rule-color) 0%,
- var(--statblock-rule-color) 50%,
- var(--statblock-background-color) 95%,
- var(--statblock-background-color) 100%
- );
- clip-path: polygon(0 0, 0 100%, 95% 50%);
- -webkit-clip-path: polygon(0 0, 0 100%, 95% 50%);
-}
-
-/** Top and Bottom Bars */
-.obsidian-statblock-plugin > .bar {
- height: 5px;
- background: var(--statblock-bar-color);
- border: 1px solid #000;
- /* position: absolute; */
- z-index: 1;
- width: auto;
-}
-.obsidian-statblock-plugin > .bar.top {
- top: 0;
-}
-.obsidian-statblock-plugin > .bar.bottom {
- bottom: 0;
-}
-.obsidian-statblock-plugin {
- margin: 0 auto;
- position: relative;
-}
-/** Wrapper Element */
-.obsidian-statblock-plugin > .content-wrap {
- font-family: "Noto Sans", "Myriad Pro", Calibri, Helvetica, Arial,
- sans-serif;
- font-size: 14px;
- color: var(--statblock-primary-color);
- background-color: var(--statblock-background-color);
- padding: 0.5em;
- border: 1px #ddd solid;
- box-shadow: 0 0 1.5em #ddd;
- margin-left: 2px;
- margin-right: 2px;
-
- column-width: 400px;
- column-gap: 1em;
- column-fill: auto;
-}
-
-.obsidian-statblock-plugin > .content-wrap > * {
- max-width: 400px;
-}
-
-/** Creature Name and Type */
-.obsidian-statblock-plugin .creature-heading > .name {
- font-family: "Libre Baskerville", "Lora", "Calisto MT", "Bookman Old Style",
- Bookman, "Goudy Old Style", Garamond, "Hoefler Text",
- "Bitstream Charter", Georgia, serif;
- color: var(--statblock-primary-color);
- font-weight: 700;
- margin: 0px;
- font-size: 23px;
- letter-spacing: 1px;
- font-variant: small-caps;
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-.obsidian-statblock-plugin .creature-heading .statblock-icons {
- display: flex;
- justify-content: flex-end;
- align-items: center;
-}
-
-.obsidian-statblock-plugin .creature-heading > .subheading {
- font-weight: normal;
- font-style: italic;
- font-size: 12px;
- margin: 0;
-}
-
-.obsidian-statblock-plugin .property-line {
- line-height: 1.4;
- display: block;
- color: var(--statblock-primary-color);
-}
-.obsidian-statblock-plugin .property-line > .property-name {
- margin: 0;
- margin-right: 0.25em;
- display: inline;
- font-weight: bold;
-}
-.obsidian-statblock-plugin .property-line > .property-text {
- display: inline;
- margin: 0;
-}
-
-/** Ability Scores */
-.obsidian-statblock-plugin .abilities {
- display: grid;
- grid-template-columns: repeat(6, 1fr);
-
- color: var(--statblock-primary-color);
-}
-.obsidian-statblock-plugin .abilities.fage {
- grid-template-columns: 1fr;
- gap: 0.5rem;
-}
-.obsidian-statblock-plugin .abilities.fage .top {
- display: grid;
- grid-template-columns: repeat(5, 1fr);
- gap: 0.5rem;
-}
-.obsidian-statblock-plugin .abilities.fage .bottom {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
-}
-
-.obsidian-statblock-plugin .abilities .ability-score {
- display: flex;
- flex-flow: column nowrap;
- align-items: center;
- justify-content: center;
-}
-
-.obsidian-statblock-plugin .section-header {
- border-bottom: 1px solid var(--statblock-primary-color);
- color: var(--statblock-primary-color);
- font-size: 21px;
- font-variant: small-caps;
- font-weight: normal;
- letter-spacing: 1px;
- margin: 0;
- margin-bottom: 0.3em;
- break-inside: avoid-column;
- break-after: avoid-column;
+.statblock-settings .coffee {
+ width: 60%;
+ color: var(--text-faint);
+ margin: 1rem auto;
+ text-align: center;
}
-
-.obsidian-statblock-plugin .property:not(:last-child) {
- margin-bottom: 0.25em;
+.statblock-settings .coffee img {
+ height: 30px;
}
.obsidian-statblock-plugin .property > .property-name {
@@ -218,13 +82,3 @@
.obsidian-statblock-plugin .spell-line .spells {
font-style: italic;
}
-
-.statblock-settings .coffee {
- width: 60%;
- color: var(--text-faint);
- margin: 1rem auto;
- text-align: center;
-}
-.statblock-settings .coffee img {
- height: 30px;
-}
\ No newline at end of file
diff --git a/src/main.ts b/src/main.ts
index 3cfe6e11..625a92f1 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -9,7 +9,7 @@ import domtoimage from "dom-to-image";
import type DiceRollerPlugin from "../../obsidian-dice-roller/src/main";
-import { BESTIARY_BY_NAME } from "./data/srd-bestiary";
+import { BESTIARY, BESTIARY_BY_NAME } from "./data/srd-bestiary";
import StatBlockRenderer from "./view/statblock";
import { getColumns, getParamsFromSource, renderError } from "./util/util";
import {
diff --git a/src/settings/ui/StatblockCreator.svelte b/src/settings/ui/StatblockCreator.svelte
new file mode 100644
index 00000000..aa932f6d
--- /dev/null
+++ b/src/settings/ui/StatblockCreator.svelte
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/src/svelte/EditMonster.svelte b/src/svelte/EditMonster.svelte
index 7780e912..7241b95e 100644
--- a/src/svelte/EditMonster.svelte
+++ b/src/svelte/EditMonster.svelte
@@ -173,17 +173,17 @@
height: 500px;
max-height: 50vh;
}
- .json {
+ /* .json {
margin-bottom: 1rem;
display: flex;
justify-content: flex-start;
align-items: center;
- }
+ } */
- .attributes {
+ /* .attributes {
display: grid;
grid-template-columns: repeat(6, 1fr);
- }
+ } */
.buttons {
margin-top: 1rem;
diff --git a/src/util/suggester.ts b/src/util/suggester.ts
index 9bdd8bdb..e4f753b2 100644
--- a/src/util/suggester.ts
+++ b/src/util/suggester.ts
@@ -9,7 +9,7 @@ import {
SuggestModal,
TextComponent
} from "obsidian";
-import StatBlockRenderer from "src/renderer/statblock";
+import StatBlockRenderer from "src/view/statblock";
import EditMonsterApp from "../svelte/EditMonster.svelte";
diff --git a/src/view/Statblock.svelte b/src/view/Statblock.svelte
new file mode 100644
index 00000000..385c4a6f
--- /dev/null
+++ b/src/view/Statblock.svelte
@@ -0,0 +1,29 @@
+
+
+
+ {#if monster}
+
+
+
+ {:else}
+ Invalid monster.
+ {/if}
+
+
+
diff --git a/src/renderer/statblock.ts b/src/view/statblock.ts
similarity index 97%
rename from src/renderer/statblock.ts
rename to src/view/statblock.ts
index 7f9d22a3..40f1baca 100644
--- a/src/renderer/statblock.ts
+++ b/src/view/statblock.ts
@@ -7,24 +7,36 @@ import {
SAVE_SYMBOL
} from "../data/constants";
import { catchError, catchErrorAsync, getMod, toTitleCase } from "../util/util";
-import type { Spell, Monster, StatblockMonsterPlugin } from "@types";
+import type { Spell, Monster } from "@types";
+
+import Statblock from "./Statblock.svelte";
+import type StatBlockPlugin from "src/main";
export default class StatBlockRenderer extends MarkdownRenderChild {
topBar: HTMLDivElement;
bottomBar: HTMLDivElement;
- monster: Monster;
loaded: boolean = false;
statblockEl: HTMLDivElement;
contentEl: HTMLDivElement;
constructor(
container: HTMLElement,
- monster: Monster,
- private plugin: StatblockMonsterPlugin,
+ public monster: Monster,
+ private plugin: StatBlockPlugin,
private canSave: boolean,
private canExport: boolean = true
) {
super(container);
- this.monster = monster;
+
+ new Statblock({
+ target: this.containerEl,
+ props: {
+ monster: this.monster,
+ plugin: this.plugin
+ }
+ });
+ }
+
+ old() {
this.statblockEl = this.containerEl.createDiv({
cls: "obsidian-statblock-plugin",
attr: { style: "visibility: hidden;" }
diff --git a/src/view/ui/Bar.svelte b/src/view/ui/Bar.svelte
new file mode 100644
index 00000000..ecfcb9e6
--- /dev/null
+++ b/src/view/ui/Bar.svelte
@@ -0,0 +1,11 @@
+
+
+
diff --git a/src/view/ui/BottomStats.svelte b/src/view/ui/BottomStats.svelte
new file mode 100644
index 00000000..1a80969c
--- /dev/null
+++ b/src/view/ui/BottomStats.svelte
@@ -0,0 +1,69 @@
+
+
+
+ {#if saves && saves.length}
+
+ {/if}
+ {#if skillsaves && skillsaves.length}
+
+ {/if}
+ {#if monster.damage_immunities && monster.damage_immunities.length}
+
+ {/if}
+ {#if monster.condition_immunities && monster.condition_immunities.length}
+
+ {/if}
+ {#if monster.damage_resistances && monster.damage_resistances.length}
+
+ {/if}
+ {#if monster.damage_vulnerabilities && monster.damage_vulnerabilities.length}
+
+ {/if}
+ {#if monster.senses && monster.senses.length}
+
+ {/if}
+
+
diff --git a/src/view/ui/Content.svelte b/src/view/ui/Content.svelte
new file mode 100644
index 00000000..ed515678
--- /dev/null
+++ b/src/view/ui/Content.svelte
@@ -0,0 +1,73 @@
+
+
+
+ {#if inMonster("name", "type", "alignment")}
+
+
+ {/if}
+ {#if inMonster("ac", "hp", "speed")}
+
+
+ {/if}
+ {#if inMonster("fage_stats", "stats")}
+
+
+ {/if}
+ {#if inMonster("saves", "skillsaves", "damage_immunities", "condition_immunities", "damage_vulnerabilities", "senses", "languages", "cr")}
+
+
+ {/if}
+ {#if inMonster("spells", "traits")}
+
+ {/if}
+ {#if inMonster("actions")}
+
+ {/if}
+ {#if inMonster("legendary_actions")}
+
+ {/if}
+ {#if inMonster("reactions")}
+
+ {/if}
+
+
+
diff --git a/src/view/ui/DiceRoll.svelte b/src/view/ui/DiceRoll.svelte
new file mode 100644
index 00000000..8e272884
--- /dev/null
+++ b/src/view/ui/DiceRoll.svelte
@@ -0,0 +1,35 @@
+
+
+
+({text})
+
+
diff --git a/src/view/ui/PropertyLine.svelte b/src/view/ui/PropertyLine.svelte
new file mode 100644
index 00000000..b3992189
--- /dev/null
+++ b/src/view/ui/PropertyLine.svelte
@@ -0,0 +1,31 @@
+
+
+
+ {property}
+
+
+ {text}
+
+
+
+
+
diff --git a/src/view/ui/Rule.svelte b/src/view/ui/Rule.svelte
new file mode 100644
index 00000000..ab15bb39
--- /dev/null
+++ b/src/view/ui/Rule.svelte
@@ -0,0 +1,18 @@
+
+
+
diff --git a/src/view/ui/Section.svelte b/src/view/ui/Section.svelte
new file mode 100644
index 00000000..4bd3d3b0
--- /dev/null
+++ b/src/view/ui/Section.svelte
@@ -0,0 +1,53 @@
+
+
+
+ {#if header}
+
+ {/if}
+ {#each blocks as block}
+
+ {/each}
+
+
+
diff --git a/src/view/ui/Stats.svelte b/src/view/ui/Stats.svelte
new file mode 100644
index 00000000..576280fb
--- /dev/null
+++ b/src/view/ui/Stats.svelte
@@ -0,0 +1,64 @@
+
+
+
+ {#if "fage_stats" in monster}
+
+ {#each ["Accuracy", "Communication", "Constitution", "Dexterity", "Fighting"] as stat, index}
+
+ {stat}
+ {monster.fage_stats[index]}
+
+ {/each}
+
+
+ {#each ["Intelligence", "Perception", "Strength", "Willpower"] as stat, index}
+
+ {stat}
+ {monster.fage_stats[index]}
+
+ {/each}
+
+ {:else}
+ {#each ["STR", "DEX", "CON", "INT", "WIS", "CHA"] as stat, index}
+
+ {stat}
+
+ {monster.stats[index]} ({getMod(monster.stats[index])})
+
+
+ {/each}
+ {/if}
+
+
+
diff --git a/src/view/ui/TopHeading.svelte b/src/view/ui/TopHeading.svelte
new file mode 100644
index 00000000..eda5a268
--- /dev/null
+++ b/src/view/ui/TopHeading.svelte
@@ -0,0 +1,91 @@
+
+
+
+ {#if monster.name}
+
+ {/if}
+ {#if subheading.length}
+
+ {subheading.join(" ")}
+
+ {/if}
+
+
+
diff --git a/src/view/ui/TopStats.svelte b/src/view/ui/TopStats.svelte
new file mode 100644
index 00000000..b18fe972
--- /dev/null
+++ b/src/view/ui/TopStats.svelte
@@ -0,0 +1,26 @@
+
+
+
+ {#if monster.ac}
+
+ {/if}
+ {#if monster.hp}
+
+ {#if monster.hit_dice}
+
+ {/if}
+
+ {/if}
+ {#if monster.speed}
+
+ {/if}
+
+
+
diff --git a/src/view/ui/Traits.svelte b/src/view/ui/Traits.svelte
new file mode 100644
index 00000000..82a1a487
--- /dev/null
+++ b/src/view/ui/Traits.svelte
@@ -0,0 +1,5 @@
+