Skip to content

Commit b5f96c5

Browse files
committed
fix: Fixes issue with dependency causing settings tab to not fully load
1 parent d1796d0 commit b5f96c5

4 files changed

Lines changed: 27 additions & 54 deletions

File tree

package-lock.json

Lines changed: 5 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"svelte": "^4.2.19",
5050
"svelte-dnd-action": "^0.9.50",
5151
"svelte-loader": "^3.2.3",
52-
"svelte-multiselect": "^10.3.0",
52+
"svelte-multiselect": "^10.2.0",
5353
"svelte-preprocess": "^6.0.2",
5454
"svelte-select": "^5.8.3",
5555
"title-case": "^4.3.1",

src/settings/creatures/Creatures.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
if (
4646
sources.length &&
47-
![creature.source].flat().some((s) => sources.includes(s))
47+
![creature.source].flat().some((s) => s && sources.includes(s))
4848
) {
4949
should = false;
5050
}

src/settings/settings.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import { EditMonsterModal } from "./modal";
3131
export default class StatblockSettingTab extends PluginSettingTab {
3232
importer: Importer;
3333
results: Partial<Monster>[] = [];
34-
filter: Setting;
35-
$UI: Creatures;
34+
filter!: Setting;
35+
$UI!: Creatures;
3636
constructor(app: App, private plugin: StatBlockPlugin) {
3737
super(app, plugin);
3838
this.importer = new Importer(this.plugin);
@@ -192,8 +192,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
192192
this.plugin.settings.renderDice,
193193
showFormula: false,
194194
showParens: false,
195-
expectedValue: ExpectedValue.Average,
196-
text: null
195+
expectedValue: ExpectedValue.Average
197196
}
198197
);
199198
}
@@ -378,18 +377,18 @@ export default class StatblockSettingTab extends PluginSettingTab {
378377
});
379378
inputFile.onchange = async () => {
380379
const { files } = inputFile;
381-
if (!files.length) return;
380+
if (!files?.length) return;
382381
try {
383382
const { files } = inputFile;
384-
if (!files.length) return;
383+
if (!files?.length) return;
385384
for (const file of Array.from(files)) {
386385
await new Promise<void>((resolve, reject) => {
387386
const reader = new FileReader();
388387

389388
reader.onload = async (event) => {
390389
try {
391390
const layout: Layout = JSON.parse(
392-
event.target.result as string
391+
event.target?.result as string
393392
);
394393
if (!layout) {
395394
reject(
@@ -446,7 +445,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
446445
});
447446
}
448447
await this.plugin.saveSettings();
449-
inputFile.value = null;
448+
inputFile.value = "";
450449
this.buildCustomLayouts(layoutContainer, containerEl);
451450
} catch (e) {}
452451
};
@@ -613,7 +612,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
613612
b.setIcon("undo").onClick(async () => {
614613
const defLayout = DefaultLayouts.find(
615614
({ id }) => id == layout.id
616-
);
615+
)!;
617616
delete this.plugin.settings.defaultLayouts[layout.id];
618617
await this.plugin.saveSettings();
619618
this.plugin.manager.updateDefaultLayout(
@@ -782,10 +781,10 @@ export default class StatblockSettingTab extends PluginSettingTab {
782781

783782
inputAppFile.onchange = async () => {
784783
const { files } = inputAppFile;
785-
if (!files.length) return;
784+
if (!files?.length) return;
786785
try {
787786
const { files } = inputAppFile;
788-
if (!files.length) return;
787+
if (!files?.length) return;
789788
const monsters = await this.importer.import(files, "appfile");
790789
if (monsters && monsters.length) {
791790
await this.plugin.saveMonsters(monsters);
@@ -817,10 +816,10 @@ export default class StatblockSettingTab extends PluginSettingTab {
817816

818817
inputImprovedInitiative.onchange = async () => {
819818
const { files } = inputImprovedInitiative;
820-
if (!files.length) return;
819+
if (!files?.length) return;
821820
try {
822821
const { files } = inputImprovedInitiative;
823-
if (!files.length) return;
822+
if (!files?.length) return;
824823
const monsters = await this.importer.import(files, "improved");
825824
if (monsters && monsters.length) {
826825
await this.plugin.saveMonsters(monsters);
@@ -852,10 +851,10 @@ export default class StatblockSettingTab extends PluginSettingTab {
852851

853852
inputCritterDB.onchange = async () => {
854853
const { files } = inputCritterDB;
855-
if (!files.length) return;
854+
if (!files?.length) return;
856855
try {
857856
const { files } = inputCritterDB;
858-
if (!files.length) return;
857+
if (!files?.length) return;
859858
const monsters = await this.importer.import(files, "critter");
860859
if (monsters && monsters.length) {
861860
await this.plugin.saveMonsters(monsters);
@@ -887,7 +886,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
887886

888887
input5eTools.onchange = async () => {
889888
const { files } = input5eTools;
890-
if (!files.length) return;
889+
if (!files?.length) return;
891890
const monsters = await this.importer.import(files, "5e");
892891
if (monsters && monsters.length) {
893892
await this.plugin.saveMonsters(monsters);
@@ -916,7 +915,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
916915
});
917916
inputTetra.onchange = async () => {
918917
const { files } = inputTetra;
919-
if (!files.length) return;
918+
if (!files?.length) return;
920919
const monsters = await this.importer.import(files, "tetra");
921920
if (monsters && monsters.length) {
922921
await this.plugin.saveMonsters(monsters);
@@ -944,7 +943,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
944943
});
945944
inputPF2EMonsterTools.onchange = async () => {
946945
const { files } = inputPF2EMonsterTools;
947-
if (!files.length) return;
946+
if (!files?.length) return;
948947
const monsters = await this.importer.import(files, "PF2eMonsterTool");
949948
if (monsters && monsters.length) {
950949
await this.plugin.saveMonsters(monsters);
@@ -982,7 +981,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
982981
});
983982
inputGeneric.onchange = async () => {
984983
const { files } = inputGeneric;
985-
if (!files.length) return;
984+
if (!files?.length) return;
986985
const monsters = await this.importer.import(files, "generic");
987986
if (monsters && monsters.length) {
988987
await this.plugin.saveMonsters(monsters);
@@ -1014,7 +1013,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
10141013
});
10151014
});
10161015

1017-
const ancestor = this.containerEl.closest(".statblock-settings");
1016+
const ancestor = this.containerEl.closest(".statblock-settings")!;
10181017
const { backgroundColor, paddingTop } = getComputedStyle(ancestor);
10191018

10201019
this.$UI = new Creatures({
@@ -1032,7 +1031,7 @@ export default class StatblockSettingTab extends PluginSettingTab {
10321031
}
10331032

10341033
class CreateStatblockModal extends FantasyStatblockModal {
1035-
creator: LayoutEditor;
1034+
creator!: LayoutEditor;
10361035
layout: Layout;
10371036
saved: boolean = false;
10381037
constructor(

0 commit comments

Comments
 (0)