Skip to content

feat(core): support global and contextual downIsGood configuration (#3297) - #3323

Open
FrancescoCastaldi wants to merge 1 commit into
evidence-dev:nextfrom
FrancescoCastaldi:feat/global-down-is-good
Open

feat(core): support global and contextual downIsGood configuration (#3297)#3323
FrancescoCastaldi wants to merge 1 commit into
evidence-dev:nextfrom
FrancescoCastaldi:feat/global-down-is-good

Conversation

@FrancescoCastaldi

Copy link
Copy Markdown

Closes #3297

Description

This PR introduces global, page-level, and wrapper-context downIsGood (down_is_good) default configuration for <Delta>, <BigValue>, <Table>, and related comparison components.

In cost and finance dashboards, an increase is often negative (costs went up) and a decrease is positive (costs went down). Previously, authors had to add down_is_good={true} to each individual component.

Changes

  1. Svelte Context & <DeltaDefaults> tag:
    • Created DeltaDefaultsContext (delta-defaults.context.svelte.ts)
    • Added <DeltaDefaults down_is_good={true}> / <DeltaDefaults downIsGood={true}> wrapper component
  2. Page Frontmatter & Project Layout:
    • Added down_is_good and downIsGood to projectRootPageFrontmatterSchema and projectLayoutSchema
    • Updated pageSettingsSchema and CLI page settings resolution to pass layout & frontmatter defaults
  3. Theme Defaults:
    • Added defaults and delta blocks to themeConfigSchema and themeOverridesSchema
  4. Resolution Cascading in DeltaDisplay:
    • Priority hierarchy:
      1. Component prop override (comparison.down_is_good / downIsGood)
      2. Nearest <DeltaDefaults> context
      3. Page frontmatter (down_is_good / downIsGood)
      4. Project layout / theme defaults
      5. Fallback: false
  5. Tests:
    • Added unit test suite delta-defaults.test.ts for schema validation and default inheritance
    • Added test cases in files.server.test.ts

…vidence-dev#3297)

- add delta-defaults context and <DeltaDefaults> wrapper component
- support down_is_good / downIsGood in page frontmatter and project layout config
- support delta/defaults downIsGood in theme config
- update DeltaDisplay, BigValue, Delta, Table, and comparison components to resolve defaults with cascading priority
- add unit tests for delta defaults resolution and schema validation
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Evidence Team on Vercel.

A member of the Team first needs to authorize it.

@FrancescoCastaldi

Copy link
Copy Markdown
Author

Hi @archiewood @hughess! 👋 Whenever you have a moment, could you please take a look at this PR and approve the CI workflow? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant