Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release release-2024-12-10 #2883

Merged
merged 492 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
492 commits
Select commit Hold shift + click to select a range
6bdd3e5
feat: Sparkline uses resolveColor
zachstence Nov 15, 2024
a2f38c4
feat: Value uses resolveColor
zachstence Nov 15, 2024
4f01d28
chore: comment
zachstence Nov 15, 2024
c19e0a7
fix: colorPalette default should be 'default'
zachstence Nov 15, 2024
201dc26
feat: FunnelChart uses resolveColor and resolveColorPalette
zachstence Nov 15, 2024
87feb12
fix: ThemeStores resolveColorPalette/Scale allow array of strings
zachstence Nov 15, 2024
d06b38d
feat: CalendarHeatmap uses resolveColorPalette
zachstence Nov 15, 2024
479ef03
feat: Heatmap uses resolveColorPalette
zachstence Nov 15, 2024
c04b6ad
feat: Hist and Histogram use resolveColor and resolveColorPalette
zachstence Nov 15, 2024
a384453
feat: Line and LineChart use resolveColor and resolveColorPalette
zachstence Nov 15, 2024
30c34ef
feat: Areas uses resolveColor and resolveColorPalette
zachstence Nov 15, 2024
b99e805
feat: Bubbles and BubbleMap use resolveColorPalette
zachstence Nov 15, 2024
173a578
feat: Points and PointMap use resolveColor and resolveColorPalette
zachstence Nov 15, 2024
4c046d2
feat: USMap uses resolveColorPalette and resolveColorScale
zachstence Nov 15, 2024
4fd5f2a
feat: SankeyDiagram uses resolveColor and resolveColorPalette
zachstence Nov 15, 2024
7d94653
chore: remove debug logs
zachstence Nov 15, 2024
ae23f42
fix: Scatter reactivity
zachstence Nov 15, 2024
88636d9
feat: Scatter and ScatterPlot use resolveColor and resolveColorPalette
zachstence Nov 15, 2024
f10ab04
feat: DataTable row color props use resolveColor
zachstence Nov 15, 2024
7aeef6b
feat: deprecate/remove usage of color system CSS vars
zachstence Nov 15, 2024
f4b7b0e
feat: move reference color constants to theme, use resolveColor
zachstence Nov 15, 2024
4449095
feat: Column uses resolveColor
zachstence Nov 15, 2024
cc915fa
chore: format
zachstence Nov 15, 2024
b1e9640
feat: resolveColor supports objects and arrays, seriesColors uses res…
zachstence Nov 18, 2024
8bc71ec
chore: remove debug log
zachstence Nov 18, 2024
70a7896
feat: BoxPlot uses resolveColor when color is column name
zachstence Nov 18, 2024
0c94912
Merge branch 'next' into feat/2499-theming
zachstence Nov 18, 2024
51da54b
Merge branch 'feat/2499-theming' into feat/2499-theming_color-names-i…
zachstence Nov 18, 2024
4ebcd7a
test: genericize variable names
zachstence Nov 18, 2024
0dc5329
refactor: split resolveColorsObject from resolveColor
zachstence Nov 18, 2024
740673b
feat: resolveColor and resolveColorsObject whitespace trimming
zachstence Nov 18, 2024
4922d49
chore: reorganize tests
zachstence Nov 18, 2024
a9517b3
feat: resolveColor handles string tuple
zachstence Nov 18, 2024
cb4eeaa
feat: resolveColorPalette and resolveColorScale handle color tuples
zachstence Nov 18, 2024
0c640cd
chore: clean up @evidence-dev/tailwind types
zachstence Nov 18, 2024
33ad525
test: Tabs color tuple story
zachstence Nov 18, 2024
82274fd
fix: resolveColorsObject undefined handling
zachstence Nov 18, 2024
7331a0e
test: LineChart colorPalette color tuple story
zachstence Nov 18, 2024
67f9ab6
chore: pnpm i
zachstence Nov 18, 2024
49a6946
fix: activeMode -> activeAppearance
zachstence Nov 18, 2024
285f5c9
Merge branch 'feat/2499-theming_color-names-in-props' into feat/2499-…
zachstence Nov 18, 2024
73480da
chore: remove usage of undefined function
zachstence Nov 18, 2024
c2264c3
feat: DocTab uses theme
zachstence Nov 18, 2024
3729f2e
Merge branch 'next' into feat/2499-theming
zachstence Nov 18, 2024
ef51c44
Merge branch 'feat/2499-theming' into feat/2499-theming_color-names-i…
zachstence Nov 18, 2024
4e5c677
Merge branch 'feat/2499-theming_color-names-in-props' into feat/2499-…
zachstence Nov 18, 2024
81a1643
Merge branch 'feat/2499-theming' into feat/2499-theming_doc-tabs
zachstence Nov 18, 2024
5a0f825
chore: pnpm i
zachstence Nov 18, 2024
d27d87b
test: get first home link
zachstence Nov 18, 2024
adec3e3
test: enable appearanceSwitcher for e2e/themes
zachstence Nov 18, 2024
f982fa3
chore: remove debug log
zachstence Nov 18, 2024
9b16a4a
chore: format
zachstence Nov 18, 2024
57ae322
Merge branch 'feat/2499-theming' into feat/2499-theming_color-names-i…
zachstence Nov 19, 2024
1457c18
chore: pnpm i
zachstence Nov 19, 2024
540bc0b
Merge pull request #2813 from evidence-dev/feat/2499-theming_doc-tabs
zachstence Nov 19, 2024
9390d4a
feat: Chart xAxisTitle uses theme instead of uiColours
zachstence Nov 19, 2024
fa54851
chore: remove invisible axis in Sparkline
zachstence Nov 19, 2024
7f9a343
feat: Sparkline uses theme instead of uiColours
zachstence Nov 19, 2024
3c4a76c
feat: CalendarHeatmap uses theme instead of uiColours
zachstence Nov 19, 2024
aaeff0e
feat: Heatmap uses theme instead of uiColours
zachstence Nov 19, 2024
d47c900
feat: Areas and Points use theme instead of uiColours
zachstence Nov 19, 2024
b5b8626
chore: remove unused uiColours
zachstence Nov 19, 2024
0d2d8d0
Merge pull request #2776 from evidence-dev/feat/2499-theming_color-na…
zachstence Nov 19, 2024
a70fd0c
Merge pull request #2812 from evidence-dev/feat/2499-theming_color-tu…
zachstence Nov 19, 2024
9a45c14
Merge pull request #2814 from evidence-dev/feat/2499-theming_remove-u…
zachstence Nov 19, 2024
c291557
refactor: move themes.js -> themes/themes.js
zachstence Nov 19, 2024
ca954b2
feat: convertLightToDark
zachstence Nov 19, 2024
e8ce2d2
feat: ThemeStores.resolveColor converts light to dark
zachstence Nov 19, 2024
f09883c
fix: non builtin colors may have undefined value
zachstence Nov 19, 2024
33d9581
refactor: move color resolution logic to static method
zachstence Nov 19, 2024
302a017
feat: ThemeStores.resolveColorsObject converts light to dark
zachstence Nov 19, 2024
51adfd0
feat: ThemeStores.resolveColorPalette and resolveColorScale converts …
zachstence Nov 19, 2024
a607cf4
Merge pull request #2817 from evidence-dev/feat/2499-theming_convert-…
zachstence Nov 19, 2024
d062cc5
Merge branch 'next' into feat/2499-theming
zachstence Nov 19, 2024
7a159de
chore: remove duplicate classes
zachstence Nov 19, 2024
78f4516
fix: use pretty-scrollbar for CategoricalLegend
zachstence Nov 19, 2024
9d2bdc5
feat: map legends use theme
zachstence Nov 19, 2024
2fb3deb
Merge pull request #2818 from evidence-dev/feat/2499-theming_map-legend
zachstence Nov 19, 2024
40e8b3c
feat: Alert uses base instead of neutral for default styling
zachstence Nov 19, 2024
af60fee
feat: default Badge uses primary instead of neutral
zachstence Nov 19, 2024
3e3d02c
feat: secondary Badge uses secondary instead of base
zachstence Nov 19, 2024
2a3833c
feat: Toast uses info instead of neutral for info status
zachstence Nov 19, 2024
14f08e8
test: fix storybook WithEvidence styles
zachstence Nov 19, 2024
011f108
feat: Delta uses base instead of neutral
zachstence Nov 19, 2024
93ac5dd
feat: Value uses base-content-muted instead of neutral
zachstence Nov 19, 2024
bb6f599
feat: CustomFormatsSection disabled submit button uses reduced opacit…
zachstence Nov 19, 2024
515c281
feat: query debugger DataPreview uses primary instead of neutral
zachstence Nov 19, 2024
04430e5
feat: USMap uses base instead of neutral
zachstence Nov 19, 2024
6d2cbb9
chore: remove neutral and neutral-content colors
zachstence Nov 19, 2024
48fc5d5
feat: support primary, secondary, accent in button
zachstence Nov 19, 2024
0678f01
Merge branch 'next' into feat/2499-theming
zachstence Nov 20, 2024
f1d509c
fix: USMap legend text color
zachstence Nov 20, 2024
ca5c619
feat: move heatmap scale to theme
zachstence Nov 20, 2024
53aaef9
fix: Heatmap legend text color
zachstence Nov 20, 2024
4fbe91b
fix: adjust convertLightToDark
zachstence Nov 20, 2024
c18180b
fix: USMap scales
zachstence Nov 20, 2024
f256dd5
fix: Callout theming
zachstence Nov 20, 2024
d71a3c7
feat: darken ReferenceArea area color, dont darken areaColor
zachstence Nov 20, 2024
d6b24d9
chore: clean up types
zachstence Nov 20, 2024
80f7ac8
feat: BoxPlot uses theme
zachstence Nov 20, 2024
d4b6a67
feat: improve theme colors
zachstence Nov 20, 2024
c1fcfd2
fix: dont fetch geojson on server
zachstence Nov 20, 2024
3a2b939
fix: map background color
zachstence Nov 20, 2024
2b1311b
chore: remove debug log
zachstence Nov 20, 2024
bd2cc0d
feat: adjust default color palette
zachstence Nov 20, 2024
08e33ab
feat: default color palette is the same in light and dark mode
zachstence Nov 20, 2024
3ec7598
feat: remove inner shadow on DocTab
zachstence Nov 20, 2024
25a0f3f
feat: EditInGithub uses theme
zachstence Nov 20, 2024
4e6549f
fix: default Badge uses base, multiselect dropdown uses default Badge
zachstence Nov 20, 2024
3772795
fix: remove DateRange border
zachstence Nov 20, 2024
c3dc743
fix: project splash starts hidden
zachstence Nov 20, 2024
b2cf90f
chore: pnpm i
zachstence Nov 20, 2024
07072ff
test: mock convertLightToDark in ThemeStores tests
zachstence Nov 20, 2024
6ebeb05
chore: format
zachstence Nov 20, 2024
43a7722
Merge branch 'next' into feat/2499-theming
zachstence Nov 21, 2024
b10585d
chore: pnpm i
zachstence Nov 21, 2024
aa84bd4
Merge branch 'next' into feat/2499-theming
zachstence Nov 22, 2024
6ea4615
feat: deprecate hardcoded colors from Reference* and Column
zachstence Nov 22, 2024
ff7592f
feat: resolveColorScale blends single color with base-100
zachstence Nov 22, 2024
26783af
feat: ReferenceArea uses 15% opacity in dark mode
zachstence Nov 22, 2024
9439d37
fix: make typescript happy
zachstence Nov 22, 2024
7339220
feat: compute content and base shades if not specified
zachstence Nov 22, 2024
16035ef
feat: kill secondary and secondary-content colors
zachstence Nov 22, 2024
be64d40
feat: deprecate non-semantic Alert statuses
zachstence Nov 22, 2024
987319c
feat: deprecate non-semantic Button variants
zachstence Nov 22, 2024
38e276d
feat: deprecate non-semantic Toast statuses
zachstence Nov 22, 2024
62a6bc9
feat: kill heat colorScale, change custom palette to heat in docs
zachstence Nov 22, 2024
fcd4d5e
feat: DateRange month dropdown uses pretty-scrollbar
zachstence Nov 22, 2024
6da1d1d
fix: PropListing HoverCard theming
zachstence Nov 22, 2024
5c1f805
feat: default border color is base-300
zachstence Nov 22, 2024
b1becca
Merge branch 'feat/2499-theming' into feat/2499-theming_compute-shades
zachstence Nov 22, 2024
a73344d
refactor: rename schemas.spec.js -> config.spec.js
zachstence Nov 22, 2024
fbf5688
feat: base is an alias for base-100 in themes config
zachstence Nov 22, 2024
2695ccf
feat: add base-heading color to theme
zachstence Nov 22, 2024
3eb97a0
feat: use base-heading for chart titles, markdown headings, and sideb…
zachstence Nov 22, 2024
ca4cf4b
chore: remove .only
zachstence Nov 22, 2024
0b2e48a
chore: format
zachstence Nov 22, 2024
2e42f71
Merge branch 'feat/2499-theming_compute-shades' into feat/2499-themin…
zachstence Nov 22, 2024
2a43da3
chore: remove .only
zachstence Nov 22, 2024
db917a9
feat: checkbox uses primary color
zachstence Nov 22, 2024
ecea17c
fix: QueryViewer scrollbar color
zachstence Nov 22, 2024
b066b6a
feat: Ctrl/Cmd+Shift+L cycles appearance
zachstence Nov 22, 2024
453c1c1
Merge pull request #2843 from evidence-dev/feat/2499-theming_add-base…
ItsMeBrianD Nov 25, 2024
b26208c
Merge pull request #2840 from evidence-dev/feat/2499-theming_compute-…
zachstence Nov 25, 2024
71d2a59
chore: pnpm i
zachstence Nov 26, 2024
71f77cc
test: update tests
zachstence Nov 26, 2024
2c9cbc0
Merge branch 'next' into feat/2499-theming
zachstence Nov 26, 2024
0aed81a
Merge branch 'next' into feat/2499-theming
zachstence Nov 27, 2024
3fef9e5
chore: pnpm i
zachstence Nov 27, 2024
49e0823
fix: broaden type
zachstence Nov 27, 2024
c79ef82
refactor: tweak shade computation to match our default theme, remove …
zachstence Nov 27, 2024
1d9b005
add post-build script that hashes files on successful builds
csjh Nov 27, 2024
d88e861
changeset
csjh Nov 27, 2024
ce8bd38
feat: adjust DimensionGrid bar opacity
zachstence Nov 27, 2024
80f4f61
feat: tweak light mode yellow
zachstence Nov 27, 2024
fe8c3be
feat: increase tabs background opacity
zachstence Nov 27, 2024
05d1a64
feat: heatmaps use custom palette with light and dark identical
zachstence Nov 27, 2024
1012809
fix: adjust CalendarHeatmap splitLine color
zachstence Nov 27, 2024
14ed15d
chore: remove debug logs
zachstence Nov 27, 2024
92e3747
fix: applyThemeDefaults preserves custom colors
zachstence Nov 27, 2024
abc0dbb
test: update tests for computeShades changes
zachstence Nov 27, 2024
195c8ce
chore: remove debug log
zachstence Dec 2, 2024
5f55592
feat: force use defaultAppearance when appearanceSwitcher is false
zachstence Dec 2, 2024
99497d5
feat: AreaMap custom color palette example specifies light and dark c…
zachstence Dec 2, 2024
7361615
chore: pnpm i
zachstence Dec 2, 2024
25adc02
chore: pnpm i
zachstence Dec 2, 2024
dc38296
chore: pnpm i
zachstence Dec 2, 2024
ada1bdf
chore: pnpm i
zachstence Dec 2, 2024
ff7eb09
Merge branch 'next' into feat/2499-theming
zachstence Dec 2, 2024
c76002d
fix: Bubble tooltip
zachstence Dec 2, 2024
35f2064
fix: Scatter tooltip
zachstence Dec 2, 2024
af504ea
chore: pnpm i
zachstence Dec 2, 2024
8a944e6
remove dependence on url prefix
csjh Dec 2, 2024
3f14da0
change naming a bit
csjh Dec 2, 2024
9320460
format
csjh Dec 2, 2024
c91fb51
docs: reorganize and deduplicate custom layout docs
zachstence Dec 2, 2024
a39fa86
chore: fix merge conflict
zachstence Dec 2, 2024
1a646ae
Merge branch 'fix/example-project-config-virtual' into feat/2499-theming
zachstence Dec 2, 2024
4e6874e
feat: darken header bottom border
zachstence Dec 3, 2024
5fba3c4
feat: lighten base-content
zachstence Dec 3, 2024
1050674
refactor: rename config themes: -> theme:
zachstence Dec 3, 2024
fad1333
feat: dont allow unknown keys under theme config
zachstence Dec 3, 2024
2ddbe30
fix: echarts canvas download uses correct theme and background color
zachstence Dec 3, 2024
916bff5
fix: set chart background color to base-100
zachstence Dec 3, 2024
b397590
test: fix mistaken refactor
zachstence Dec 3, 2024
6f53c2c
feat: lighten base-content-muted
zachstence Dec 3, 2024
4ed72f7
fix: dont resolve colorPalette or colorScale twice
zachstence Dec 3, 2024
d4a695e
test: update tests for computeShades changes
zachstence Dec 3, 2024
dca4912
refactor: use hex codes for defaultThemesConfigFile
zachstence Dec 3, 2024
66dc562
feat: light mode primary is blue-600
zachstence Dec 3, 2024
ea1f16e
feat: color, colorPalette, and colorScale accept a single config for …
zachstence Dec 3, 2024
6a606dc
Merge branch 'next' into feat/2499-theming
zachstence Dec 3, 2024
35e4c5b
Merge branch 'feat/2499-theming' into feat/2499-theming_docs
zachstence Dec 3, 2024
02820f7
refactor: use hex codes instead of hsla/rgb
zachstence Dec 3, 2024
a881f3c
fix: prevent double resolution of all colors, color arrays, color obj…
zachstence Dec 3, 2024
539547d
refactor: replace setResolved mess by passing color stores via props …
zachstence Dec 4, 2024
83b528d
chore: pnpm i
zachstence Dec 4, 2024
13dab4f
feat: move defaultAppearance and appearanceSwitcher to appearance.def…
zachstence Dec 4, 2024
a13766a
first pass
archiewood Dec 4, 2024
c6d81c0
Merge branch 'feat/2499-theming' into feat/2499-theming_docs
archiewood Dec 4, 2024
23e2d81
chore: pnpm i
zachstence Dec 4, 2024
6b3650f
feat: add defaultTab to DocTab
zachstence Dec 4, 2024
d45c62b
feat: highlight yaml with prism
zachstence Dec 4, 2024
2a7b136
docs: themes docs
zachstence Dec 4, 2024
33f5cad
uncomment HF spaces
archiewood Dec 6, 2024
7de1030
Merge branch 'next' into feat/2499-theming
zachstence Dec 9, 2024
6be29be
Merge branch 'feat/2499-theming' into feat/2499-theming_docs
zachstence Dec 9, 2024
227ce30
chore: pnpm i
zachstence Dec 9, 2024
81e70ac
fix: ScatterPlot colorPalette default is 'default'
zachstence Dec 9, 2024
cd63252
Merge branch 'feat/2499-theming' into feat/2499-theming_docs
zachstence Dec 9, 2024
40d328d
feat: add sidebar_badge to Themes page
zachstence Dec 9, 2024
8d42810
Merge pull request #2860 from evidence-dev/fix/hash-built-parquet-files
ItsMeBrianD Dec 9, 2024
50a7162
docs: document colorPalette, colorScale, and color props inputs
zachstence Dec 9, 2024
67f059e
chore: comment out nonexistent links
zachstence Dec 9, 2024
d2f6582
docs: fix links
zachstence Dec 9, 2024
d8d25df
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
7a10942
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
3cbcb7e
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
3f28761
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
d44e01b
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
ee77e3b
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
187a478
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
578d63a
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
475e3a7
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
03c4635
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
3c9478a
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
15a0f6e
docs: reorder theme props lists
zachstence Dec 9, 2024
8be4658
docs: fix closing tags
zachstence Dec 9, 2024
994fd23
docs: bold key info
zachstence Dec 9, 2024
7591c5c
docs: tweaks
zachstence Dec 9, 2024
86d04bc
chore: comment out nonexistent links
zachstence Dec 9, 2024
6c2e3a6
Update sites/docs/pages/reference/themes/index.md
zachstence Dec 9, 2024
c59c9a8
docs: Appearance -> Appearance Modes
zachstence Dec 9, 2024
daacf62
docs: our -> the
zachstence Dec 9, 2024
2f5acab
docs: remove alert around default themes config
zachstence Dec 9, 2024
eaae3d3
docs: move themes from /reference to /core-concepts
zachstence Dec 9, 2024
ad0d8df
docs: default configuration -> default theme configuration
zachstence Dec 9, 2024
1af6c1b
docs: adjust default appearance behavior language
zachstence Dec 9, 2024
ccb33cb
docs: adjust default appearance behavior language
zachstence Dec 9, 2024
4baa9f4
Update sites/docs/pages/core-concepts/themes/index.md
zachstence Dec 9, 2024
e1ebf45
Update sites/docs/pages/core-concepts/themes/index.md
zachstence Dec 9, 2024
5817bd1
Update sites/docs/pages/core-concepts/themes/index.md
zachstence Dec 9, 2024
d7797b1
Update sites/docs/pages/core-concepts/themes/index.md
zachstence Dec 9, 2024
dec1a02
Merge pull request #2871 from evidence-dev/feat/2499-theming_docs
zachstence Dec 9, 2024
0ad2134
docs: heatmaps use colorScale
zachstence Dec 9, 2024
dfc1f4c
Merge pull request #2879 from evidence-dev/docs-hf
archiewood Dec 10, 2024
4b241d9
Merge branch 'next' into feat/2499-theming
zachstence Dec 10, 2024
e2c95d1
chore: consolidate changesets
zachstence Dec 10, 2024
56dc36c
Merge pull request #2628 from evidence-dev/feat/2499-theming
ItsMeBrianD Dec 10, 2024
4ffddad
Merge branch 'main' into release-2024-12-10
zachstence Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .changeset/clever-hounds-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@evidence-dev/evidence': major
'@evidence-dev/component-utilities': major
'@evidence-dev/preprocess': major
'@evidence-dev/sdk': major
'@evidence-dev/core-components': major
'@evidence-dev/tailwind': major
---

Theming & Appearances
5 changes: 5 additions & 0 deletions .changeset/cuddly-geckos-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/icons': patch
---

Icons use currentColor instead of hardcoded color
5 changes: 5 additions & 0 deletions .changeset/large-tips-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/evidence': patch
---

hash parquet file paths after build
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ packages/evidence/scripts/svelte.config.js
packages/ui/icons/src

# Don't lint playwright reports
**/playwright-report*
**/playwright-report*

storybook-static
2 changes: 1 addition & 1 deletion e2e/base-path/tests/tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test.describe('Page', () => {
await expect(page.getByText('This is Page B', { exact: true })).toBeVisible();
await expect(new URL(page.url()).pathname).toBe(`${basePath}/page-b/`);

const logoLink = await page.getByAltText('Home');
const logoLink = await page.getByAltText('Home').first();
await logoLink.click();
await waitForPageToLoad(page);

Expand Down
108 changes: 108 additions & 0 deletions e2e/test-utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

/** @typedef {import('@playwright/test').Page} Page */
import { expect } from '@playwright/test';

Expand All @@ -18,3 +20,109 @@ export function waitForWasm(page) {
});
});
}

/**
* @param {import('@playwright/test').Page} page
* @returns {Promise<boolean>}
*/
export const isKebabMenuOpen = async (page) => {
try {
const menu = await page.getByRole('menu', { name: 'Menu' });
const isVisible = await menu.isVisible();
return isVisible;
} catch (e) {
console.error('isKebabMenuOpen failed', e);
throw e;
}
};

/**
* @param {import('@playwright/test').Page} page
* @returns {Promise<boolean>} True if the kebab menu was opened, false if it was already open
*/
export const openKebabMenu = async (page) => {
if (await isKebabMenuOpen(page)) return false;

try {
// Click button to open menu
await page.getByRole('button', { name: 'Menu' }).click();
// Make sure menu is open
await expect(page.getByRole('menu', { name: 'Menu' })).toBeVisible();
return true;
} catch (e) {
console.error('openKebabMenu failed', e);
throw e;
}
};

/**
* @param {import('@playwright/test').Page} page
* @returns {Promise<boolean>} True if the kebab menu was closed, false if it was already closed
*/
export const closeKebabMenu = async (page) => {
if (!(await isKebabMenuOpen(page))) return false;

try {
// Click button to close menu
await page.getByRole('button', { name: 'Menu' }).click();
// Make sure menu is closed
await expect(page.getByRole('menu', { name: 'Menu' })).not.toBeVisible();
return true;
} catch (e) {
console.error('closeKebabMenu failed', e);
throw e;
}
};

/**
* @param {import('@playwright/test').Page} page
* @param {{ closeKebabMenu?: boolean }} options
* @returns {Promise<'light' | 'dark' | 'system'>}
*/
const getAppearance = async (page, options = { closeKebabMenu: true }) => {
try {
await openKebabMenu(page);

const textContent = await page.getByRole('menuitem', { name: 'Appearance' }).textContent();
const appearance = textContent?.split(/\s+/)[1].toLowerCase();
if (!appearance || !['light', 'dark', 'system'].includes(appearance)) {
throw new Error(`Invalid appearance ${appearance}`);
}
return /** @type {'light' | 'dark' | 'system'} */ (appearance);
} catch (e) {
console.error('getAppearance failed', e);
throw e;
} finally {
if (options.closeKebabMenu) {
await closeKebabMenu(page);
}
}
};

/**
* @param {import('@playwright/test').Page} page
* @param {'light' | 'dark' | 'system'} appearance
*/
export const switchAppearance = async (page, appearance) => {
try {
let current = await getAppearance(page);
if (current === appearance) return;

await openKebabMenu(page);
// Switch appearance a max of 2 times (since there's 3 options)
for (let i = 0; i < 2; i++) {
await page.getByRole('menuitem', { name: 'Appearance' }).click();
current = await getAppearance(page, { closeKebabMenu: false });
if (current === appearance) break;
}

if (current !== appearance) {
throw new Error(`Appearance ${current} doesnt match ${appearance} after switching`);
}
} catch (e) {
console.error('switchAppearance failed', e);
throw e;
} finally {
await closeKebabMenu(page);
}
};
20 changes: 15 additions & 5 deletions e2e/themes/evidence.config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
themes:
light:
mySemanticColor: "#ff0000"
dark:
mySemanticColor: "#00ff00"
appearance:
default: light
switcher: true

theme:
colors:
base:
light: "#fdf4ff"
dark: "#170118"
primary:
light: "#ff0000"
dark: "#00ff00"
myCustomColor:
light: "#abcdef"
dark: "#fedcba"

plugins:
components:
Expand Down
8 changes: 4 additions & 4 deletions e2e/themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "e2e-themes",
"version": "0.0.19",
"scripts": {
"build": "cross-env VITE_EVIDENCE_THEMES=true evidence build",
"build:strict": "cross-env VITE_EVIDENCE_THEMES=true evidence build:strict",
"dev": "cross-env VITE_EVIDENCE_THEMES=true evidence dev",
"build": "cross-env evidence build",
"build:strict": "cross-env evidence build:strict",
"dev": "cross-env evidence dev",
"sources": "evidence sources",
"preview": "cross-env VITE_EVIDENCE_THEMES=true evidence preview",
"preview": "cross-env evidence preview",
"test:preview": "playwright test",
"test:dev": "cross-env DEV=true playwright test"
},
Expand Down
17 changes: 16 additions & 1 deletion e2e/themes/pages/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
<div data-testid="div-with-background" class="w-20 h-20 bg-mySemanticColor">
<div data-testid="div-primary-class" class="bg-primary">
div-primary-class
</div>

<div data-testid="div-primary-var" style="background: var(--primary)">
div-primary-var
</div>

<div data-testid="div-myCustomColor-class" class="bg-myCustomColor">
div-myCustomColor-class
</div>

<div data-testid="div-myCustomColor-var" style="background: var(--myCustomColor)">
div-myCustomColor-var
</div>

This is some body text
52 changes: 40 additions & 12 deletions e2e/themes/tests/tests.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@
// @ts-check
import { test, expect } from '@playwright/test';
import { waitForPageToLoad } from '../../test-utils';
import { switchAppearance, waitForPageToLoad } from '../../test-utils';

test('should change color based on theme', async ({ page }) => {
test('should change colors based on theme', async ({ page }) => {
await page.goto('/');
await waitForPageToLoad(page);

const divWithBackground = await page.getByTestId('div-with-background');
const divPrimaryClass = await page.getByTestId('div-primary-class');
const divPrimaryVar = await page.getByTestId('div-primary-var');
const divMyCustomColorClass = await page.getByTestId('div-myCustomColor-class');
const divMyCustomColorVar = await page.getByTestId('div-myCustomColor-var');

// Starts with system theme (dark)
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await switchAppearance(page, 'system');
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(254, 220, 186)');
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(254, 220, 186)');

await page.getByLabel('Menu').click();
await switchAppearance(page, 'light');
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(255, 0, 0)');
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(255, 0, 0)');
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(171, 205, 239)');
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(171, 205, 239)');

// Light theme
await page.getByRole('menuitem', { name: 'Appearance' }).click();
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(255, 0, 0)');
await switchAppearance(page, 'dark');
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(254, 220, 186)');
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(254, 220, 186)');
});

test('body text should be computed from base', async ({ page }) => {
await page.goto('/');
await waitForPageToLoad(page);

const body = await page.locator('body');
const text = await page.getByText('This is some body text');

await switchAppearance(page, 'system');
await expect(text).toHaveCSS('color', 'rgb(205, 200, 206)');
await expect(body).toHaveCSS('background-color', 'rgb(23, 1, 24)');

await switchAppearance(page, 'light');
await expect(text).toHaveCSS('color', 'rgb(45, 42, 46)');
await expect(body).toHaveCSS('background-color', 'rgb(253, 244, 255)');

// Dark theme
await page.getByRole('menuitem', { name: 'Appearance' }).click();
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(0, 255, 0)');
await switchAppearance(page, 'dark');
await expect(text).toHaveCSS('color', 'rgb(205, 200, 206)');
await expect(body).toHaveCSS('background-color', 'rgb(23, 1, 24)');
});
44 changes: 43 additions & 1 deletion packages/evidence/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import sade from 'sade';
import { logQueryEvent } from '@evidence-dev/telemetry';
import { enableDebug } from '@evidence-dev/sdk/utils';
import { loadEnv } from 'vite';
import { createHash } from 'crypto';

const increaseNodeMemoryLimit = () => {
// Don't override the memory limit if it's already set
Expand Down Expand Up @@ -152,13 +153,20 @@ const watchPatterns = [
}
];

function removeStaticDir(dir) {
const staticlessDir = path.normalize(dir).split(path.sep).slice(1);
return path.join(...staticlessDir);
}

const strictMode = function () {
process.env['VITE_BUILD_STRICT'] = true;
};
const buildHelper = function (command, args) {
const watchers = runFileWatcher(watchPatterns);
const flatArgs = flattenArguments(args);

const dataDir = process.env.EVIDENCE_DATA_DIR ?? './static/data';

// Run svelte kit build in the hidden directory
const child = spawn(command, flatArgs, {
shell: true,
Expand All @@ -174,8 +182,42 @@ const buildHelper = function (command, args) {
});
// Copy the outputs to the root of the project upon successful exit
child.on('exit', function (code) {
const outDir = '.evidence/template/build';
if (code === 0) {
fs.copySync('./.evidence/template/build', './build');
const staticlessDataDir = removeStaticDir(dataDir);
const buildDataDir = path.join(outDir, staticlessDataDir);
const manifestFile = path.join(buildDataDir, 'manifest.json');

if (fs.existsSync(manifestFile)) {
const manifest = fs.readJsonSync(manifestFile);
for (const files of Object.values(manifest.renderedFiles)) {
for (let i = 0; i < files.length; i++) {
// <url prefix>/sqlite/transactions/transactions.parquet
// ^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
const nDiskParts = 3;

const diskParts = files[i].split('/').slice(-nDiskParts).join('/');
const filePath = path.posix.join(buildDataDir, diskParts);
if (!fs.existsSync(filePath)) continue;

const contents = fs.readFileSync(filePath);
const hash = createHash('md5').update(contents).digest('hex');

const newDiskPart = path.posix.join(
path.dirname(diskParts),
hash,
path.basename(diskParts)
);
const newFilePath = path.join(buildDataDir, newDiskPart);
fs.moveSync(filePath, newFilePath);

files[i] = files[i].replace(diskParts, newDiskPart);
}
}
fs.writeJsonSync(manifestFile, manifest);
}

fs.copySync(outDir, './build');
console.log(`Build complete --> ${process.env.EVIDENCE_BUILD_DIR ?? './build'} `);
} else {
console.error('Build failed');
Expand Down
5 changes: 3 additions & 2 deletions packages/evidence/scripts/build-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ fsExtra.outputFileSync(
import { sourceQueryHmr, configVirtual, queryDirectoryHmr } from '@evidence-dev/sdk/build/vite';
import { isDebug } from '@evidence-dev/sdk/utils';
import { log } from "@evidence-dev/sdk/logger";
import { evidenceThemes } from '@evidence-dev/tailwind/vite-plugin';

const logger = createLogger();

const strictFs = (process.env.NODE_ENV === 'development') ? false : true;
/** @type {import('vite').UserConfig} */
const config =
{
plugins: [sveltekit(), configVirtual(), queryDirectoryHmr, sourceQueryHmr()],
plugins: [sveltekit(), configVirtual(), queryDirectoryHmr, sourceQueryHmr(), evidenceThemes()],
optimizeDeps: {
include: ['echarts-stat', 'echarts', 'blueimp-md5', 'nanoid', '@uwdata/mosaic-sql',
// We need these to prevent HMR from doing a full page reload
Expand All @@ -74,7 +75,7 @@ fsExtra.outputFileSync(
])

],
exclude: ['svelte-icons', '@evidence-dev/universal-sql', '$evidence/config']
exclude: ['svelte-icons', '@evidence-dev/universal-sql', '$evidence/config', '$evidence/themes']
},
ssr: {
external: ['@evidence-dev/telemetry', 'blueimp-md5', 'nanoid', '@uwdata/mosaic-sql', '@evidence-dev/sdk/plugins']
Expand Down
5 changes: 5 additions & 0 deletions packages/lib/component-utilities/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"types": ["@evidence-dev/tailwind"]
}
}
1 change: 1 addition & 0 deletions packages/lib/component-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@evidence-dev/tailwind": "workspace:^",
"@faker-js/faker": "^8.0.2",
"vitest": "^2.0.5"
},
Expand Down
Loading
Loading