7.2 KiB
Locations refinements: picker, taxonomy and shared Attributes
This refines the existing workspace, without changing its cards, ribbon, containment commands, merge reconciliation, protected Undo or live-update contracts. See the shared Attributes component standard.
Hierarchical selection
location-picker.js exposes PlotDirectorLocationPicker.mount(host, options) and enhance(select).
It sorts roots and siblings alphabetically (independent of the workspace sort), renders containment
branches and canonical icons, highlights selection and shows its full path. Name, alias and full-path
search reveals matching ancestors. Temporary search expansion is separate from ordinary expansion;
clearing search restores the ordinary state. Duplicate names display paths. Arrow keys, Home/End,
Enter and Space navigate/select; Enter in search focuses a result and never submits a mutation.
Options: locations, types, selected, allowRoot, rootLabel, excludeIds, excludeBranches,
label, searchLabel, onChange. IDs may be numeric or stable keys. excludeBranches prevents
selecting the source and its descendants while leaving their context visible. Expansion remains
available on unselectable headings. The return object exposes value, path(id) and focus().
No picker selection itself writes to the database. The operation owns confirmation and saving.
Workspace Change Parent, branch filter and reviewed merge use the inline picker in their existing
modal. Traditional Create/Edit parent, Details relationship target and traditional Merge opt in using
select[data-location-picker], project ID and operation exclusions. Without JavaScript, the native
form controls remain. The modal uses shared theme variables and up to 900px width; paths wrap.
LocationWorkspace/Picker checks project access and uses Location_PickerRead, loading only names,
parent/type IDs and aliases, plus the canonical taxonomy. No manuscript prose is loaded.
Map and floor-plan selection interfaces are unchanged.
Server project ownership, cycle/descendant guards, merge version checks, confirmation and original relationship validation remain authoritative. Client exclusions are conveniences, not security controls. The picker is also composed for type selection with grouping headings made unassignable.
Canonical taxonomy
Forward-only migration 338_LocationTypeTaxonomy.sql adds LocationTypeTaxonomy and two read
procedures. The catalogue contains 105 entries: 97 canonical assignable type IDs, the assignable NULL
Unclassified choice, and seven grouping headings. It adds 81 LocationTypes rows, leaving the existing
16 rows, IDs, names, order and active state unchanged. No Locations row is rewritten or specialised.
City already existed (ID 16); it is now discoverable under Settlements. Existing Building, Town,
Room and NULL Unclassified remain exactly those stored values.
TypeKey is the stable taxonomy identity. LocationTypeID maps assignable entries to the existing
foreign key. Metadata supplies ParentKey, DisplayName, SortOrder, IconKey, SemanticTone
and IsAssignable. Group headings never become rows in LocationTypes. Assignable categories such
as Residential, Commercial, Public and institutional, Historic and defensive, Building and Room
remain valid selections. NULL Unclassified has a stable metadata key and no invented canonical ID.
Office in premises and Office in a room have distinct canonical IDs/names, with the same friendly
label distinguished by its taxonomy path. Active legacy/custom types absent from metadata are read
under Other with their existing IDs and names.
Extend via a reviewed forward-only migration: insert an assignable LocationTypes row only when needed, insert metadata with a unique stable key and existing parent key, choose an existing shared icon key (or add SVG geometry to ApplicationRibbon), and specify order/tone/assignability. Never renumber canonical IDs, change existing records or infer specialisations from manuscript text. The reader and UI consume metadata; no feature-specific taxonomy switch/list is required.
LocationWorkspace preserves types as the older flat canonical-ID/name list (non-null IDs only)
and adds taxonomy for all nodes, including NULL Unclassified. The enhanced workspace derives its
choices from taxonomy metadata; older open clients keep their original response contract. The presentation
adapter resolves metadata icon keys through ApplicationRibbon. Details, type context menus and
traditional forms consume the same taxonomy. Parent-type filtering/counts include the category's
own value and all descendants using sets of assigned IDs; each location counts once. Grouping
headings filter but cannot be assigned or used as record drop targets. The server accepts only active
LocationTypes IDs (or NULL), rejecting heading keys independently of the client.
Classification taxonomy is not physical containment. A Flat may be under Residential in this catalogue and under any valid recorded parent in the author's world. No type-based containment restriction or temporary/temporal tracking is introduced. Real/Fictional provenance remains separate.
Consumer compatibility audit
LocationLookup_All,Location_Get,Location_ListByProject,Location_WorkspaceRead,Location_WorkspaceAssignand the existing model keep their assignable ID/name contracts.- Import lookup procedures and
ImportServicesstill resolve canonical IDs/names. Existing StoryIntelligenceLocationImportService generic matching is not changed or re-run; old sort priority is retained and new types follow it. This task adds no AI request or geocoding work. - Project backup/export/restore and story-bible location summaries still use LocationTypeID and canonical TypeName. Global taxonomy metadata is deployment configuration, not duplicated project data.
- Geography chain/hierarchy reads join the same IDs/names; explicit geography review remains intact.
- Maps, Floor Plans, Context and Word Companion keep their location identities, references, existing detection/Quick Add flags and provider contracts. Their interfaces and focus/Hold/Follow are unchanged.
Verification, screenshots, delivery identifiers and remaining environment limits are recorded below once the final release has completed validation.
Reproduce the focused rendered checks
Start the existing executable harness with --toolbar-browser-host. On a qualified disposable
Locations clone, export the current catalogue (metadata/icons only):
dotnet run --project PlotLine.Tests -- --location-taxonomy-fixture /private/clone.json /tmp/pd-refinements-taxonomy.json
node PlotLine.Tests/Browser/workspace-refinements.cjs
xvfb-run -a node PlotLine.Tests/Browser/workspace-refinements.cjs --installed
node PlotLine.Tests/Browser/shared-attributes-comparison.cjs
xvfb-run -a node PlotLine.Tests/Browser/shared-attributes-comparison.cjs --installed
PD_TAXONOMY_FIXTURE can override the snapshot path. No second production taxonomy definition is
maintained in JavaScript. The browser tests use actual compiled Razor/shared assets with synthetic
HTTP mutations. PlotLine.Tests/Sql/LocationTaxonomy.sql is guarded to disposable clones and rolls
its fixtures back. Existing Characters and Locations browser regressions remain separate checks.