Skip to main content

The Nextcloud variable inventory

thematiq keeps a list of every CSS custom property Nextcloud and @conduction/nextcloud-vue declare or read. The list says what "every variable" means for one Nextcloud release. A test then checks that thematiq's stylesheets match what the list claims.

The three files​

FileWhat it holdsWho writes it
scripts/mapping/nextcloud-variables.jsonEvery variable, its class, its owning family, where it is declared, and Nextcloud's own value per themeThe extractor. Never edit it by hand.
scripts/mapping/variable-status.jsonPer variable: mapped, settable or excluded, with a reason for every exclusionYou. These are decisions.
scripts/mapping/variable-baseline.jsonThe exact count per class and statusYou, in the same commit as the status change.

The mappings page is generated from the first two.

Classes​

ClassMeaning
themeDeclared by Nextcloud's theming app: the vocabulary a theme is meant to set.
componentDeclared and read inside one Nextcloud component.
slotRead by a component with its own fallback, declared nowhere.
conductionA --cn-* variable of the shared Conduction library.
iconAn image URL. Never a token.
runtimeWritten by Nextcloud's JavaScript at render time. A stylesheet value would be overwritten.
unreadDeclared, read by nothing Nextcloud ships.

After a Nextcloud release​

Run these on a machine with the dev stack up:

npm run inventory:fetch # copies Nextcloud's css/js and the four theming stylesheets
npm run inventory:extract # rewrites nextcloud-variables.json
npm run test:inventory # fails on every new or vanished variable

For every failure, add or remove the entry in variable-status.json. Then update the counts in variable-baseline.json and run npm run generate:mappings.

npm run inventory:check compares the committed inventory with a fresh extraction without writing anything. It needs the sources from inventory:fetch, so CI does not run it. CI does run test:inventory as part of the unit suite.

What the test refuses​

  • A variable with no status, or a status for a variable Nextcloud does not have.
  • An exclusion without a reason.
  • A mapped claim the stylesheets do not make. Comments and --x: var(--x) do not count.
  • A theme variable the stylesheets set but the status file does not record.
  • A Nextcloud-style name, such as --color-..., that Nextcloud does not have. The four that summer-breeze sets today are listed under deadAssignments, and the list can only shrink.
  • Any change in the counts that the baseline does not repeat, upwards or downwards.