generated from League-of-Foundry-Developers/foundry-typescript-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Clean up the Actor crafting app salvage UI (#233)
- Loading branch information
1 parent
23fa902
commit c46fb2e
Showing
11 changed files
with
326 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: Fabricate 0.10.14 | ||
title: Fabricate 0.10.15 | ||
email: [email protected] | ||
description: >- | ||
End user documentation for the Foundry Virtual Tabletop (VTT) Module, "Fabricate". | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const key = Symbol(); | ||
|
||
export { key } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts"> | ||
/* | ||
* =========================================================================== | ||
* Imports | ||
* =========================================================================== | ||
*/ | ||
import {Avatar} from "@skeletonlabs/skeleton"; | ||
</script> | ||
|
||
<div class="card snap-start h-full bg-surface-700 flex flex-row col-span-1 row-span-1"> | ||
<Avatar alt="Loading item..." initials="?" width="w-24" rounded="rounded-r-none rounded-l-md" /> | ||
<div class="flex flex-col w-2/3 p-2"> | ||
<div class="placeholder rounded-xl w-2/3 h-4 mb-2 animate-pulse"></div> | ||
<div class="placeholder rounded-xl w-3/4 h-2 mt-2 animate-pulse"></div> | ||
<div class="placeholder rounded-xl w-4/4 h-2 mt-2 animate-pulse"></div> | ||
<div class="placeholder rounded-xl w-3/4 h-2 mt-2 animate-pulse"></div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {Readable, Subscriber, Unsubscriber, writable, Writable} from "svelte/store"; | ||
import {Component} from "../../scripts/crafting/component/Component"; | ||
import {FabricateAPI} from "../../scripts/api/FabricateAPI"; | ||
|
||
class ComponentsStore implements Readable<Map<string, Component>> { | ||
|
||
private readonly _components: Writable<Map<string, Component>>; | ||
private readonly _fabricateAPI: FabricateAPI; | ||
|
||
constructor({ | ||
fabricateAPI, | ||
components = new Map<string, Component>(), | ||
}: { | ||
fabricateAPI: FabricateAPI; | ||
components?: Map<string, Component>; | ||
}) { | ||
this._fabricateAPI = fabricateAPI; | ||
this._components = writable(components); | ||
} | ||
|
||
public async loadAll() { | ||
const allComponentsById = await this._fabricateAPI.components.getAll(); | ||
const allComponentsLoaded = await Promise.all(Array.from(allComponentsById.values()).map(component => component.load())); | ||
allComponentsLoaded.forEach((component) => { | ||
allComponentsById.set(component.id, component); | ||
}); | ||
this._components.set(allComponentsById); | ||
} | ||
|
||
public async add(component: Component) { | ||
const loadedComponent = await component.load(true); | ||
this._components.update((storedComponents) => { | ||
storedComponents.set(loadedComponent.id, loadedComponent); | ||
return storedComponents; | ||
}); | ||
} | ||
|
||
public async addAll(componentsToAdd: Component[]) { | ||
const loadedComponents = await Promise.all(componentsToAdd.map(component => component.load(true))); | ||
this._components.update((storedComponents) => { | ||
loadedComponents.forEach((component) => { | ||
storedComponents.set(component.id, component); | ||
}); | ||
return storedComponents; | ||
}); | ||
} | ||
|
||
public async remove(component: Component) { | ||
this._components.update((storedComponents) => { | ||
storedComponents.delete(component.id); | ||
return storedComponents; | ||
}); | ||
} | ||
|
||
public async removeAll(componentsToDelete: Component[]) { | ||
this._components.update((storedComponents) => { | ||
componentsToDelete.forEach((component) => { | ||
storedComponents.delete(component.id); | ||
}); | ||
return storedComponents; | ||
}); | ||
} | ||
|
||
subscribe(subscriber: Subscriber<Map<string, Component>>): Unsubscriber { | ||
return this._components.subscribe(subscriber); | ||
} | ||
|
||
} | ||
|
||
export { ComponentsStore } |
Oops, something went wrong.