Major upgrade to the browse tool's UX, plus a few shared modules other tools can adopt. User-facing: - Right-click context menu on tree rows AND empty pane space. Traditional file-manager grouping (Open / Download / New / Rename-Delete / Copy / Tree ops / View). Items stay visible but disabled when not applicable so muscle memory carries. Generic shared/context-menu.js framework supports normal items, toggles, submenus, separators, danger styling. - YAML editor for .yaml / .yml / .zddc files (CodeMirror 5 vendored at shared/vendor/codemirror-yaml.min.*). js-yaml lint on every change for parse errors. For .zddc cascade files, an additional schema-aware lint pass flags unknown keys, bad enum values, and wrong types. - Per-row drag-drop upload using webkitGetAsEntry (folder uploads work recursively). Per-row drop indicator; doc-level overlay still fires for blank-space drops at drop_target scopes. - New folder / New markdown file context-menu items (server mode). Rename + Delete with native confirm() dialog. File-API helpers removeNode / renameNode use the existing PUT/POST/DELETE endpoints. - Hover info card with the row's full metadata (ZDDC fields + filesystem info + path/URL). Interactive — mouse into it, drag-select text, Ctrl/Cmd-C or right-click → Copy. 200ms grace before dismiss. - Autofilter input at the top of the tree pane. Same grammar as archive's column filters (zddc.filter.parse / matches). Filters files; folders without matches collapse out. Non-matching folders force-open visually when descendants match, without mutating the user's actual expand state. - Two-line ZDDC label: title-first, tracking/rev/status as monospace meta below. Icon column anchors to the title line. Chevron is a Lucide outline `chevron-right` SVG, rotated 90° on `.expanded`. - File-type Lucide icon sprite (shared/icons.js — 16 outline glyphs, ~5 KB). PDF / Word / Spreadsheet / Slides / Image / Video / Audio / CAD / Web / Config / Code / Archive get distinct icons; folders tinted with --primary. - Header wraps gracefully at narrow viewports (shared/base.css flex-wrap + title min-width:0 ellipsis). Body becomes flex column in browse so a wrapping header doesn't break #appMain height. - Markdown editor opens in WYSIWYG mode by default. YAML front-matter + TOC sidebar reworked: flexbox layout (single visible resizer between FM and TOC), both bodies overflow:auto for X+Y scrollbars. - `?file=<path>` deep links open browse pre-positioned at a specific file. Multi-segment paths walk into subdirectories on the way. Auto-flips Show hidden when a segment is dot/underscore-prefixed. - Refresh + show-hidden toggle preserve expansion / selection / preview pinning. Path-keyed snapshot survives a re-fetched listing. - "Add Local Directory" → "Use Local Directory" across the four tools that have it (browse, archive, classifier, +transmittal comment). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
117 lines
3.6 KiB
Bash
Executable file
117 lines
3.6 KiB
Bash
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
root_dir=$(cd "$(dirname "$0")" && pwd)
|
|
. "$root_dir/../shared/build-lib.sh"
|
|
|
|
src_html="$root_dir/template.html"
|
|
output_dir="$root_dir/dist"
|
|
output_html="$output_dir/browse.html"
|
|
|
|
mkdir -p "$output_dir"
|
|
ensure_exists "$src_html"
|
|
|
|
css_temp=$(mktemp)
|
|
js_raw=$(mktemp)
|
|
js_temp=$(mktemp)
|
|
cleanup() { rm -f "$css_temp" "$js_raw" "$js_temp"; }
|
|
trap cleanup EXIT
|
|
|
|
# CSS files: shared base first, then browse-specific. Toast UI's CSS
|
|
# is bundled because the markdown plugin uses Toast UI inside the
|
|
# preview pane (.md files render as a full editor).
|
|
concat_files \
|
|
"../shared/fonts.css" \
|
|
"../shared/base.css" \
|
|
"../shared/toast.css" \
|
|
"../shared/nav.css" \
|
|
"../shared/logo.css" \
|
|
"../shared/vendor/toastui-editor.min.css" \
|
|
"../shared/vendor/codemirror-yaml.min.css" \
|
|
"../shared/context-menu.css" \
|
|
"../shared/elevation.css" \
|
|
"css/base.css" \
|
|
"css/tree.css" \
|
|
"css/preview-yaml.css" \
|
|
> "$css_temp"
|
|
|
|
# JS files: shared canonical helpers, then browse modules.
|
|
# init.js must come first so window.app exists when later modules
|
|
# attach to it. JSZip is vendored (rather than CDN-loaded) so ZIP
|
|
# expansion in the tree works under restrictive networks / CSPs and
|
|
# without an external HTTP dependency.
|
|
concat_files \
|
|
"../shared/vendor/jszip.min.js" \
|
|
"../shared/vendor/utif.min.js" \
|
|
"../shared/vendor/js-yaml.min.js" \
|
|
"../shared/vendor/codemirror-yaml.min.js" \
|
|
"../shared/vendor/toastui-editor-all.min.js" \
|
|
"../shared/zddc.js" \
|
|
"../shared/zddc-filter.js" \
|
|
"../shared/zip-source.js" \
|
|
"../shared/theme.js" \
|
|
"../shared/toast.js" \
|
|
"../shared/nav.js" \
|
|
"../shared/logo.js" \
|
|
"../shared/help.js" \
|
|
"../shared/preview-lib.js" \
|
|
"../shared/context-menu.js" \
|
|
"../shared/elevation.js" \
|
|
"../shared/icons.js" \
|
|
"../shared/zddc-source.js" \
|
|
"js/init.js" \
|
|
"js/loader.js" \
|
|
"js/tree.js" \
|
|
"js/preview.js" \
|
|
"js/preview-markdown.js" \
|
|
"js/preview-yaml.js" \
|
|
"js/hovercard.js" \
|
|
"js/grid.js" \
|
|
"js/upload.js" \
|
|
"js/download.js" \
|
|
"js/events.js" \
|
|
"js/app.js" \
|
|
> "$js_raw"
|
|
|
|
# Escape any literal `</` inside JS string/template literals so the
|
|
# inlined <script> block doesn't get terminated prematurely.
|
|
escape_js_close_tags "$js_raw" "$js_temp"
|
|
|
|
tool=browse
|
|
compute_build_label "$tool" "$@"
|
|
|
|
# Replace template placeholders with concatenated CSS/JS + label.
|
|
# Non-stable build labels (alpha/beta/dev-dirty) are wrapped in a red
|
|
# span — same convention as every other tool (compute_build_label
|
|
# sets $is_red=1 for non-stable cuts). Keeps the visual cue
|
|
# consistent across tool headers.
|
|
awk -v css_file="$css_temp" -v js_file="$js_temp" \
|
|
-v build_label="$build_label" -v is_red="$is_red" \
|
|
-v favicon="$favicon_data_uri" '
|
|
/\{\{CSS_PLACEHOLDER\}\}/ {
|
|
while ((getline line < css_file) > 0) print line
|
|
close(css_file); next
|
|
}
|
|
/\{\{JS_PLACEHOLDER\}\}/ {
|
|
while ((getline line < js_file) > 0) print line
|
|
close(js_file); next
|
|
}
|
|
/\{\{BUILD_LABEL\}\}/ {
|
|
if (is_red == "1") {
|
|
gsub(/\{\{BUILD_LABEL\}\}/, "<span style=\"color:red;font-weight:bold\">" build_label "</span>")
|
|
} else {
|
|
gsub(/\{\{BUILD_LABEL\}\}/, build_label)
|
|
}
|
|
print; next
|
|
}
|
|
{
|
|
gsub(/\{\{FAVICON\}\}/, favicon)
|
|
print
|
|
}
|
|
' "$src_html" > "$output_html"
|
|
|
|
echo "Wrote $output_html"
|
|
|
|
# Promote AFTER the dist file exists so promote_release can copy from
|
|
# $output_html. (The order matters — _promote_stable does cp $output_html ...)
|
|
promote_release "$tool"
|