The two filter rows (📄 file/ext + 📁 folder) didn't really earn their header real estate. Browse is for navigating directory structure; ad-hoc filters across a tree of mixed file types and depths weren't the right affordance, and the visual weight competed with the column headers and the breadcrumb. Removed entirely: - template.html: dropped both <tr class="filter-row"> rows in <thead>, the related "Filter rows" help section, and the empty-state copy that mentioned the 📄/📁 rows. - init.js: dropped state.filters (file/folder/ext slots). - events.js: dropped the .column-filter[data-filter] input wiring. - tree.js: dropped recomputeVisibility() and the n.visible plumbing in visibleIds() and updateCount(). Render is now a straight depth- first walk over expanded subtrees; the count is just total rows. setFilter is removed from the public API. - css/tree.css: dropped .filter-row*, .filter-row__icon, and the browse-local .column-filter rules (.column-filter is also defined in shared/base.css for tools that still use it; that stays). No test changes — tests/browse.spec.js never exercised filters. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
// Bootstrap window.app for the browse tool. Mirrors the convention
|
|
// used by every other ZDDC tool — ./build's CSS/JS concat order means
|
|
// this file runs FIRST inside the IIFE-of-IIFEs.
|
|
(function () {
|
|
'use strict';
|
|
|
|
if (!window.app) {
|
|
window.app = { modules: {}, state: {} };
|
|
}
|
|
|
|
window.app.state = {
|
|
// Source: 'server' | 'fs' | null. Determines how the loader
|
|
// resolves entries.
|
|
source: null,
|
|
|
|
// For server-source: the URL path of the directory currently
|
|
// being viewed. Always starts with '/' and ends with '/'.
|
|
// For fs-source: the displayed path string (no semantic
|
|
// meaning — just for the toolbar).
|
|
currentPath: '/',
|
|
|
|
// FileSystemAccessAPI root handle (null in server mode).
|
|
rootHandle: null,
|
|
|
|
// Sort state. key: 'name' | 'size' | 'ext' | 'date'. dir: 1 or -1.
|
|
sort: { key: 'name', dir: 1 },
|
|
|
|
// The tree's in-memory representation. Each node:
|
|
// { id, name, isDir, size, modTime, ext, url, depth,
|
|
// parentId, expanded, loaded, childIds, isZip, zipFile,
|
|
// zipPath }
|
|
// - isZip: set when the node IS a .zip file we know how to
|
|
// expand inline (server file or FS handle).
|
|
// - zipFile: cached JSZip instance for this archive (set
|
|
// after first expand).
|
|
// - zipPath: relative path WITHIN a zip (set on virtual
|
|
// children of an expanded zip; null otherwise).
|
|
// Stored flat in a Map keyed by id; render order derived
|
|
// from a depth-first walk.
|
|
nodes: new Map(),
|
|
rootIds: [],
|
|
nextId: 1,
|
|
|
|
// Single shared popup window for file preview (across
|
|
// multiple file clicks). Same pattern as archive's preview.
|
|
previewWindow: null
|
|
};
|
|
})();
|