Skip to content

[#130] Implement compendium browser#1929

Draft
krbz999 wants to merge 2 commits into
1.1.xfrom
130-compendium-browser
Draft

[#130] Implement compendium browser#1929
krbz999 wants to merge 2 commits into
1.1.xfrom
130-compendium-browser

Conversation

@krbz999

@krbz999 krbz999 commented May 29, 2026

Copy link
Copy Markdown
Member

Blocked by a few required features and TODOs:

@krbz999 krbz999 added this to the v1.1.0 milestone May 29, 2026
@krbz999 krbz999 self-assigned this May 29, 2026
@krbz999 krbz999 added the blocked Issues that cannot be worked on until some other barrier has been resolved label May 29, 2026
@krbz999 krbz999 force-pushed the 130-compendium-browser branch 3 times, most recently from 94caf1d to 7fa4f9b Compare June 1, 2026 12:06
@krbz999 krbz999 force-pushed the 130-compendium-browser branch from 7fa4f9b to dd4e07b Compare June 2, 2026 20:18
Comment on lines +10 to +45
/**
* @typedef {Record<string, -1|0|1>} BrowserCheckboxFilter
*
* @typedef {{ min: number, max: number }} BrowserRangeFilter
*
* @typedef {Record<string, BrowserCheckboxFilter|BrowserRangeFilter>} BrowserFilterConfiguration
*
* @typedef {Record<string, boolean|Record<string, boolean>>|boolean} BrowserLockedConfiguration
*
* @typedef {"Actor"|"Item"} FilterDocumentName
*
* @typedef {DrawSteelActor|DrawSteelItem} BrowserDocument
*
* @typedef {(entry: object, filters: BrowserFilterConfiguration) => boolean} CompendiumFilterCallback
*
* @typedef {(filters: BrowserFilterConfiguration) => boolean} CompendiumFilterVisibility
*
* @typedef {Set<BrowserDocument|object>} BrowserFetchResults
*
* @typedef CompendiumFilter
* @property {string} [label] Human-readable label.
* @property {"checkboxes"|"range"} type The display type of the filter.
* @property {CompendiumFilterCallback} callback A callback invoked when filtering an entry.
* @property {CompendiumFilterVisibility} [visible] A callback invoked to determine visibility.
* @property {FilterDocumentName[]} modes Which modes have this filter available.
* @property {{ value: string, label: string }[]} [options] The array of options to display in a checkbox-like fashion.
* @property {number[]} [range] An 2-length array which determines the min/max of a 'range'.
*
* @typedef _CompendiumBrowserOptions
* @property {FilterDocumentName} [documentName="Item"] Initial document type to browse.
* @property {BrowserFilterConfiguration} [filters] Initial filters.
* @property {BrowserLockedConfiguration} [locked] Locked filters.
* @property {number} [selection] Number of documents to select.
*
* @typedef {_CompendiumBrowserOptions & ApplicationConfiguration} CompendiumBrowserOptions
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this get moved to an adjoining _types.d.ts file and imported?

Comment on lines +520 to +521
min: foundry.utils.getProperty(this.#filter, `${name}.min`) ?? null,
max: foundry.utils.getProperty(this.#filter, `${name}.max`) ?? null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better stylistically than chaining optional operators?

result.dataset.uuid = uuid;
result.dataset.dragstart = "";
result.dataset.name = name;
if (displayTooltip) result.dataset.tooltipHtml = CONFIG.ux.TooltipManager.constructHTML({ uuid });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate that this is more efficacious than the implementation reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Issues that cannot be worked on until some other barrier has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants