Context
A leaf of #20667 (the engine hosts packages that live outside its repository), on the "themes" half of its predicate. Found while a package added a grid selection model with a look of its own: the model's SCSS compiles into the theme map, and nothing ever loads it.
The Problem
A selection model marks nodes of a view it does not own. It adds its cls to the view's wrapper and classes to the selected nodes, and the rules for those classes need a home.
The engine's own models have one, because their rules sit inside the view's stylesheet: resources/scss/src/grid/Body.scss:90-155 holds the blocks for selection.CellModel, selection.RowModel and the combined models.
A model that lives in an app or a package has no such home. Its SCSS file lands in the theme map under its class name, but theme files load only when someone calls Neo.worker.App#insertThemeFiles for a class, and nobody calls it for a selection model. Today its author either puts the model's rules into the stylesheet of some component that happens to be on the page, or subclasses the view only to carry a stylesheet.
The Architectural Reality
Neo.worker.App#insertThemeFiles(windowId, proto) walks a prototype chain and loads each class's theme files once per window (src/worker/App.mjs:442-495).
- Its callers are components (
src/component/Abstract.mjs:307-315) and four kinds of non-component: plugins (src/plugin/Base.mjs:70-72), layouts (src/layout/Base.mjs:70-72), drag zones (src/draggable/DragZone.mjs:299-301) and grid columns (src/grid/column/Base.mjs:234-256, whose JSDoc names the pattern "Non-Component Theme Injection"). Each has a reactive windowId config and inserts in afterSetWindowId.
Neo.selection.Model has no windowId (src/selection/Model.mjs:20-60). register(component) adds cls to the view's wrapperCls, sets view and adds the DOM listeners (:269); unregister() undoes that (:450).
- A view can move to another window. A component re-inserts its theme files there through its own
afterSetWindowId; a helper has to hear about the move. core.Base#observeConfig(publisher, configName, fn) is the engine's way to follow another instance's config (src/core/Base.mjs:792-820).
- Design authority: n/a — a missing seam; no existing behavior is called wrong.
The Fix
In src/selection/Model.mjs, the shape plugins and grid columns already have:
- A reactive
windowId_ config, null by default.
afterSetWindowId(value) calls Neo.currentWorker.insertThemeFiles(value, this.__proto__) for a truthy value.
register(component) takes the view's windowId and follows it with observeConfig; unregister() stops following and resets windowId to null.
- JSDoc on the hook states the scoping rule: a model's stylesheet is global once loaded, so every rule sits under the model's
cls, which register() puts on the view's wrapper.
The engine's own models ship no theme files, so nothing changes for them.
Contract Ledger
| Target surface |
Source of authority |
Proposed behavior |
Fallback / edge |
Docs |
Evidence |
Neo.selection.Model#windowId (new reactive config) |
Neo.plugin.Base#windowId, Neo.grid.column.Base#windowId |
the window of the registered view; register() sets it and follows the view, unregister() resets it |
no view, or a view without a window: null, nothing is inserted |
JSDoc |
unit arms |
| Theme files of a selection model class |
Neo.worker.App#insertThemeFiles |
inserted for the view's window when the model registers, and for the new window when the view moves |
a class without theme files: the call finds nothing and loads nothing |
JSDoc on afterSetWindowId, with the scoping rule |
unit arms that record the insertThemeFiles calls |
Acceptance Criteria
Out of Scope
- Moving the engine's own selection rules out of the view stylesheets.
- A
windowId for other helpers that lack one.
- The models that read
view.windowId (GalleryModel, HelixModel, AccordionModel, TreeAccordionModel): they keep reading the view.
Avoided Traps
- Forwarding from the owner.
component.Abstract#afterSetWindowId forwards to controller and stateProvider because every component has those configs. selectionModel is a config of nine view classes (lists, the grid view, the table body, galleries and others), so forwarding would be one edit per class and would miss the next one.
additionalThemeFiles on the view. The worker reads it from the class prototype (#8117), so a model chosen per instance cannot add to it.
- Inserting once in
register() without following. The stylesheet would be missing in the window a view is moved to.
Related
#20667 (parent) · #20698 (the per-cell selection seam of the same epic) · #20260 (a package's SCSS compiles into the theme map) · #8117 (additionalThemeFiles).
Ownership: self-assigned. Built in the session that filed it, so it is not offered as a good first issue.
Decision Record impact: none.
Live latest-open + closed sweep: checked the latest 20 open issues and two closed searches ("selection model theme files stylesheet", "insertThemeFiles"; #8117, #20260, #19899 and #20493 read, none covers a selection model) at 2026-11-10T13:19Z; no equivalent or prior exclusion found. Backlog: 27 open (orange band), so this is filed as a leaf of its owning epic #20667. A2A claim sweep (30 messages, all read-states), Memory Core sweep ("selection model own stylesheet theme files": it surfaced the session of 2026-02-24 that documented the pattern on grid columns) and own-assignment sweep (only #20667 is open and mine): no overlap.
Origin Session ID: b392078f-f3b7-419d-b868-f0567359ef2f
Retrieval Hint: "selection model theme files insertThemeFiles windowId non-component theme injection"
Context
A leaf of #20667 (the engine hosts packages that live outside its repository), on the "themes" half of its predicate. Found while a package added a grid selection model with a look of its own: the model's SCSS compiles into the theme map, and nothing ever loads it.
The Problem
A selection model marks nodes of a view it does not own. It adds its
clsto the view's wrapper and classes to the selected nodes, and the rules for those classes need a home.The engine's own models have one, because their rules sit inside the view's stylesheet:
resources/scss/src/grid/Body.scss:90-155holds the blocks forselection.CellModel,selection.RowModeland the combined models.A model that lives in an app or a package has no such home. Its SCSS file lands in the theme map under its class name, but theme files load only when someone calls
Neo.worker.App#insertThemeFilesfor a class, and nobody calls it for a selection model. Today its author either puts the model's rules into the stylesheet of some component that happens to be on the page, or subclasses the view only to carry a stylesheet.The Architectural Reality
Neo.worker.App#insertThemeFiles(windowId, proto)walks a prototype chain and loads each class's theme files once per window (src/worker/App.mjs:442-495).src/component/Abstract.mjs:307-315) and four kinds of non-component: plugins (src/plugin/Base.mjs:70-72), layouts (src/layout/Base.mjs:70-72), drag zones (src/draggable/DragZone.mjs:299-301) and grid columns (src/grid/column/Base.mjs:234-256, whose JSDoc names the pattern "Non-Component Theme Injection"). Each has a reactivewindowIdconfig and inserts inafterSetWindowId.Neo.selection.Modelhas nowindowId(src/selection/Model.mjs:20-60).register(component)addsclsto the view'swrapperCls, setsviewand adds the DOM listeners (:269);unregister()undoes that (:450).afterSetWindowId; a helper has to hear about the move.core.Base#observeConfig(publisher, configName, fn)is the engine's way to follow another instance's config (src/core/Base.mjs:792-820).The Fix
In
src/selection/Model.mjs, the shape plugins and grid columns already have:windowId_config,nullby default.afterSetWindowId(value)callsNeo.currentWorker.insertThemeFiles(value, this.__proto__)for a truthy value.register(component)takes the view'swindowIdand follows it withobserveConfig;unregister()stops following and resetswindowIdtonull.cls, whichregister()puts on the view's wrapper.The engine's own models ship no theme files, so nothing changes for them.
Contract Ledger
Neo.selection.Model#windowId(new reactive config)Neo.plugin.Base#windowId,Neo.grid.column.Base#windowIdregister()sets it and follows the view,unregister()resets itnull, nothing is insertedNeo.worker.App#insertThemeFilesafterSetWindowId, with the scoping ruleinsertThemeFilescallsAcceptance Criteria
insertThemeFiles(windowId, proto)is called with the model's prototype.windowIdchanges, the model asks again for the new window.unregister(), a later window change of that view asks for nothing, and the model'swindowIdisnull.npm run test-unitpasses, and no existing selection spec changes.Out of Scope
windowIdfor other helpers that lack one.view.windowId(GalleryModel,HelixModel,AccordionModel,TreeAccordionModel): they keep reading the view.Avoided Traps
component.Abstract#afterSetWindowIdforwards tocontrollerandstateProviderbecause every component has those configs.selectionModelis a config of nine view classes (lists, the grid view, the table body, galleries and others), so forwarding would be one edit per class and would miss the next one.additionalThemeFileson the view. The worker reads it from the class prototype (#8117), so a model chosen per instance cannot add to it.register()without following. The stylesheet would be missing in the window a view is moved to.Related
#20667 (parent) · #20698 (the per-cell selection seam of the same epic) · #20260 (a package's SCSS compiles into the theme map) · #8117 (
additionalThemeFiles).Ownership: self-assigned. Built in the session that filed it, so it is not offered as a good first issue.
Decision Record impact: none.
Live latest-open + closed sweep: checked the latest 20 open issues and two closed searches ("selection model theme files stylesheet", "insertThemeFiles"; #8117, #20260, #19899 and #20493 read, none covers a selection model) at 2026-11-10T13:19Z; no equivalent or prior exclusion found. Backlog: 27 open (orange band), so this is filed as a leaf of its owning epic #20667. A2A claim sweep (30 messages, all read-states), Memory Core sweep ("selection model own stylesheet theme files": it surfaced the session of 2026-02-24 that documented the pattern on grid columns) and own-assignment sweep (only #20667 is open and mine): no overlap.
Origin Session ID: b392078f-f3b7-419d-b868-f0567359ef2f
Retrieval Hint: "selection model theme files insertThemeFiles windowId non-component theme injection"