diff --git a/CHANGELOG.md b/CHANGELOG.md index f01821c..faa9d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. Dates are displayed in UTC. ## [Unreleased] +## [0.5.1 - 0.5.2](https://github.com/averrin/alpha-suit/compare/0.5.1...0.5.2) +Added: + * Expanding dropped folders for grid + * [Director integration] support saved effects for grid + * Support dropped compendiums for grid [Compendium Folders required] + * [Premium, Experimental] Grid tab in the sidebar + * [Premium, Experimental] Grid tab in Alpha Tree + * Folders are now grid-droppable in Alpha Tree + * [Experimental] Checkbox to search files within the current folder + +Known Issues: + * Grid can lost some data. Resizing and auto-placing can act weirdly, especially with experimental features enabled. + ## [0.5.0 - 0.5.1](https://github.com/averrin/alpha-suit/compare/0.5.0...0.5.1) Added: * Titles for grid buttons diff --git a/module.json b/module.json index bc2d264..f57423c 100644 --- a/module.json +++ b/module.json @@ -14,9 +14,9 @@ "readme": "https://github.com/averrin/alpha-suit/blob/master/README.md", "bugs": "https://github.com/averrin/alpha-suit/issues", "changelog": "https://github.com/averrin/alpha-suit/releases/latest/", - "version": "0.5.0-dev", - "minimumCoreVersion": "0.8.6", - "compatibleCoreVersion": "9", + "version": "0.6.0-dev", + "minimumCoreVersion": "9", + "compatibleCoreVersion": "10", "esmodules": [ "index.js" ], @@ -35,7 +35,7 @@ "relationships": {}, "socket": false, "manifest": "https://github.com/averrin/alpha-suit/releases/latest/download/module.json", - "download": "https://github.com/averrin/alpha-suit/releases/download/0.5.0-dev/module.zip", + "download": "https://github.com/averrin/alpha-suit/releases/download/0.6.0-dev/module.zip", "protected": false, "coreTranslation": false, "library": false, diff --git a/package-lock.json b/package-lock.json index 073158c..7c7b141 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "svelte-collapsible": "^0.2.1", "svelte-copy-to-clipboard": "^0.2.5", "svelte-french-toast": "^1.0.3", - "svelte-grid": "../svelte-grid", + "svelte-grid": "averrin/svelte-grid", "sveltejs-tippy": "^3.0.0", "tree-model": "^1.0.7", "treeverse": "^3.0.0", diff --git a/src/apps.js b/src/apps.js index 04e080d..c5fb588 100644 --- a/src/apps.js +++ b/src/apps.js @@ -27,7 +27,6 @@ export function createApps() { const app = new (CreateApplication(spec, props))(); apps[spec.app_id] = app; } - logger.info(apps) return apps; } diff --git a/src/index.js b/src/index.js index ea95f3a..8ffc9fc 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ import "iconify-icon"; import { moduleId, SETTINGS, infoColor } from "./modules/constants.js"; -import {get} from "svelte/store" +import { get } from "svelte/store" import initHelpers, { logger, moduleId as mid } from "crew-components/helpers"; import { initStores as helperStores } from "crew-components/stores"; @@ -18,9 +18,11 @@ import { initSettingsTopics } from "./modules/settings_content"; import { createApps, getApp, startGMApps, startUserApps } from "./apps"; import { getTool, initTools } from "./tools"; import "./systems.js"; -import {createAPI} from "./api.js"; +import { createAPI } from "./api.js"; +import GridUI_inline from "./view/GridUI_inline.svelte" import NotificationsApp from "./view/Notifications.js" +import CreateApplication from "crew-components/AlphaApplication"; initHelpers(moduleId, infoColor, SETTINGS); createApps(); @@ -47,11 +49,43 @@ Hooks.on('renderSceneControls', _ => { initTools(); }); +function addSidebarTab(id, appSpec) { + const tabs = document.getElementById("sidebar-tabs"); + const tab = document.createElement("a") + tab.classList.add("item") + tab.dataset.tab = id + const icon = document.createElement("i") + icon.classList.add("fas") + icon.classList.add("fa-icons") + tab.appendChild(icon) + tabs.prepend(tab) + + const sidebar = document.getElementById("sidebar"); + const section = document.createElement("section") + section.classList.add("sidebar-tab") + section.classList.add("tab") + section.id = id + section.dataset.tab = id + sidebar.appendChild(section); + + //TODO: rework resizing + document.querySelector(':root').style.setProperty("--sidebar-width", "360px"); + + const igApp = new (CreateApplication(appSpec))(); + igApp.start(); + igApp.show() +} + Hooks.once('ready', () => { helperStores() initStores(); startUserApps() + if (game.settings.get(moduleId, SETTINGS.GRID_IN_SIDEBAR)) { + const inlineGrid = { moduleId: "alpha-suit", isTemp: true, app_id: "grid", target: "#grid", title: "Alpha Grid [ALPHA]", component: GridUI_inline } + addSidebarTab("grid", inlineGrid) + } + if (game.user.isGM) { startGMApps() diff --git a/src/modules/constants.js b/src/modules/constants.js index 45e3c7b..ed7f56f 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -5,6 +5,8 @@ export const FLAGS = { } export const SETTINGS = { + GRID_IN_SIDEBAR: "grid-in-sidebar", + GRID_IN_TREE: "grid-in-tree", GRID_FOR_PLAYERS: "grid-for-players", DEBUG: "debug", FILES_WHITE_LIST: "files-white-list", diff --git a/src/modules/settings.js b/src/modules/settings.js index f186e16..3f29228 100644 --- a/src/modules/settings.js +++ b/src/modules/settings.js @@ -396,4 +396,22 @@ export function initSettings() { type: Boolean, default: true, }); + + game.settings.register(moduleId, SETTINGS.GRID_IN_SIDEBAR, { + name: "Show grid tab in sidebar", + hint: "[EXPERIMENTAL] Add grid tab to the sidebar", + scope: "client", + config: false, + type: Boolean, + default: false, + }); + + game.settings.register(moduleId, SETTINGS.GRID_IN_TREE, { + name: "Show grid tab in Alpha Tree", + hint: "[EXPERIMENTAL] Add grid tab in Alpha Tree", + scope: "client", + config: false, + type: Boolean, + default: false, + }); } diff --git a/src/modules/stores.js b/src/modules/stores.js index e448908..f98087b 100644 --- a/src/modules/stores.js +++ b/src/modules/stores.js @@ -30,6 +30,8 @@ export const helpTopic = writable(null); export const helpTree = writable({}); export const settingsTopic = writable(null); export const settingsTree = writable({}); +export const gridSizes = writable({}); +export const lastEditGrid = writable(null); export const tagsStore = writable([]); export const systems = writable({}); @@ -39,6 +41,8 @@ export const directorActionsStore = writable([]); export const charactersStore = writable([]); export const targetsStore = writable([]); +export const editingWidget = writable(null) + function getTree() { let collection = get(currentCollection); return collection.directory.tree; diff --git a/src/view/EditWidgetDialog.svelte b/src/view/EditWidgetDialog.svelte index f964939..510b152 100644 --- a/src/view/EditWidgetDialog.svelte +++ b/src/view/EditWidgetDialog.svelte @@ -3,7 +3,7 @@ - +
-
- - -
+
+ + +
+

Template

{ logger.info("editor:save", e); - process() + process(); }} - bind:content + bind:content={widget.persist.template} options={{ editable: true }} />

Preview

-
+
+ + +
diff --git a/src/view/FilesUI.svelte b/src/view/FilesUI.svelte index c427587..08d7723 100644 --- a/src/view/FilesUI.svelte +++ b/src/view/FilesUI.svelte @@ -443,15 +443,25 @@ const ff = foundry.utils.debounce(filterFiles, 5); const searchLimit = setting(SETTINGS.FILES_SEARCH_LIMIT); const fuzzy = setting(SETTINGS.FILES_FUZZY) && isPremium(); + let searchInFolder = false; + let folderForSearch; function searchFile() { if (search.length >= 3) { + if (topic.id != "Search") { + folderForSearch = topic.id; + } + selectedFiles.set([]); searchStatus = "Searching..."; files = []; topic = { id: "Search", source: { files } }; filterFiles(); + let index = $fileIndex; + if (searchInFolder && folderForSearch) { + index = index.filter((p) => p.startsWith(folderForSearch)); + } if (!fuzzy) { - $fileIndex.forEach((f) => { + index.forEach((f) => { const name = f.split("/")[f.split("/").length - 1]; const store = f.split("/")[0]; f = f.replace(store + "/", ""); @@ -464,7 +474,7 @@ } else { const result = fuzzyFindInList( search, - $fileIndex.map((f) => { + index.map((f) => { const name = f.split("/")[f.split("/").length - 1]; const store = f.split("/")[0]; f = f.replace(store + "/", ""); @@ -530,6 +540,21 @@ clearable={true} > + + { + searchInFolder = e.detail; + searchFile(); + }} + /> + {#if $fileIndex.length == 0} {/if} diff --git a/src/view/GridUI.svelte b/src/view/GridUI.svelte index 17eada3..92ddadb 100644 --- a/src/view/GridUI.svelte +++ b/src/view/GridUI.svelte @@ -1,573 +1,10 @@ - -
- - {#if !locked} -
-
- { - serializeItems(); - }} - /> - - - - - - - - - - - - -
-
- - {#if isPremium()} - - {/if} -
-
- {/if} -
-
- -
mouseUp(e, dataItem)} - id={dataItem.id} - data-type={dataItem.type} - > - {#if dataItem.type == "Item"} - - {:else if dataItem.type == "ActiveEffect"} - - {:else if dataItem.type == "File"} - - {:else if dataItem.type == "Text"} -
- -
- {:else if dataItem.type == "JournalEntry"} - - {:else if dataItem.type == "Scene"} - - {:else if dataItem.type == "Actor"} - - {:else} - - {/if} - - {#if !locked} -
- removeItem(dataItem)} title="Remove item" /> -
- {/if} -
-
- - {#if items.length == 0} -
- {#if game.user.isGM} - Drop Item / Actor / File / Macros / Scene here - {:else} - Drop Item / Macros here - {/if} -
OR
- -
- {/if} -
+
- - diff --git a/src/view/GridUI_inline.svelte b/src/view/GridUI_inline.svelte new file mode 100644 index 0000000..5a0a48d --- /dev/null +++ b/src/view/GridUI_inline.svelte @@ -0,0 +1,20 @@ + + + + + diff --git a/src/view/TreeUI.svelte b/src/view/TreeUI.svelte index d3f40b9..c1fe8a6 100644 --- a/src/view/TreeUI.svelte +++ b/src/view/TreeUI.svelte @@ -65,7 +65,7 @@ class:ui-w-full={$selected.length == 0} style="height: {contentH}px;" > - + {#if $selected.length > 0}
null} on:click on:dragstart={drag} @@ -114,7 +120,9 @@ {title} on:drop={handleDrop} on:click -/> +> + +
diff --git a/src/view/components/LeftPane.svelte b/src/view/components/LeftPane.svelte index ce5a234..478015e 100644 --- a/src/view/components/LeftPane.svelte +++ b/src/view/components/LeftPane.svelte @@ -1,4 +1,5 @@