WORK-723
ID:WORK-723Status:ready

Behaviour scripts and components select by attribute, and a test forbids class selectors

SPEC-196 D6. @refrakt-md/behaviors has 27 sites that select by .rf- class, and the Svelte components 2 more (ThemeShell.svelte selects rf-docs-sidebar at lines 76 and 95). The prefix is configurable, so any theme with another prefix breaks them today. They move to data-name, data-rune and the other vocabulary attributes.

The D6 measurement split the sites:

Priority:highComplexity:moderateMilestone:v0.50.0Source:SPEC-196
claude/composition-usage-rune-pages-c87ar6 View source

Criteria completion

Criteria completion: 0 of 9 (0%) checked; tracking started on Nov 9, no incremental history yet0%25%50%75%100%Nov 9Nov 22

Tracking started Nov 9 — check back for trends.

Branches 2
claude/composition-usage-rune-pages-c87ar6 current ready
claude/rune-composition-layout-convention-hkqrzx donemain ready
History 1
  1. aea7072
    Created (ready)by bjornolofandersson

Acceptance Criteria

  • The code-block wrapper (packages/runes/src/nodes.ts:146) and the table wrapper (nodes.ts:426) carry a data attribute beside their hard-coded class
  • The mobile panel, the search trigger's key hint and the docs sidebar in packages/transform/src/layouts.ts carry data attributes beside their classes
  • The 14 selectors in the table select attributes, and the 3 dead selectors are removed
  • datatable.ts and compare.ts, which read the table and code-block wrappers back, select the new attributes
  • The 13 selectors of behaviour-injected classes select a data-name the behaviour now sets
  • ThemeShell.svelte selects the docs sidebar by attribute
  • A test fails on any .rf- selector in packages/behaviors/src and the Svelte components (string literals passed to querySelector, querySelectorAll, closest, matches and classList.contains)
  • A behaviour test runs each changed behaviour on output rendered with a non-rf prefix
  • Both contract copies are regenerated if the new layout attributes appear in them

Approach

  • Land BUG-048 first: nav-menubar.ts:30 is one of these selectors, and the bug should be fixed with its own test before this rewrite touches the file.
  • Follow the existing naming: a wrapper the engine did not make still gets data-name where it is a named part of a rune, and a layout chrome element gets the same kind of name the layout's other regions use. Record the names chosen in SPEC-196's "What exists".
  • mockup selects its host's parent today. closest('[data-section="media"]') says what it means and survives a wrapper being added.
  • The test reads source, as the Markdoc.parse guard does. Matching string literals is enough; dynamic class names built at runtime are the business of WORK-724.

Blocked by

  • BUG-048

References

  • SPEC-196 D6, and "What exists, measured".
  • ADR-048: implementation order, step 1.