Skip to content

Commit 67fc39c

Browse files
committed
css migrations, vitest config updates
1 parent d7886aa commit 67fc39c

13 files changed

Lines changed: 439 additions & 115 deletions

File tree

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ nodeLinker: node-modules
1111
plugins:
1212
- checksum: 26e8fe1580b68848fd4498cd646f44a38bfee77658c4678777003ff5ff01977e4113cf01a3809aa2727a46aa5342d2afe8dbe610800da3b6850f74af7d0ab1fa
1313
path: .yarn/plugins/@yarnpkg/plugin-changelog.cjs
14-
spec: "https://raw.githubusercontent.com/furystack/furystack/refs/heads/develop/packages/yarn-plugin-changelog/bundles/%40yarnpkg/plugin-changelog.js"
14+
spec: 'https://raw.githubusercontent.com/furystack/furystack/refs/heads/develop/packages/yarn-plugin-changelog/bundles/%40yarnpkg/plugin-changelog.js'
1515

1616
yarnPath: .yarn/releases/yarn-4.12.0.cjs

frontend/src/components/header.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,22 @@ const AppBarLink = styledShade(ShadeAppBarLink, {
1212

1313
export const Header = Shade({
1414
shadowDomName: 'shade-app-header',
15+
css: {
16+
position: 'absolute',
17+
top: '-42px',
18+
transition: 'top 0.3s ease-in-out',
19+
'&:hover': { top: '0' },
20+
'&.scrolled': { top: '0' },
21+
},
1522
render: ({ useDisposable, injector, element }) => {
1623
const scrollService = injector.getInstance(ScrollService)
1724

1825
useDisposable('scrollListener', () =>
1926
scrollService.subscribe('onScroll', ({ top }) => {
20-
element.style.top = top ? '0' : '-42px'
27+
element.classList.toggle('scrolled', top)
2128
}),
2229
)
2330

24-
element.onmouseleave = () => {
25-
element.style.top = '-42px'
26-
}
27-
28-
element.onmouseenter = () => {
29-
element.style.top = '0'
30-
}
31-
32-
element.style.position = 'absolute'
33-
element.style.transition = 'top 0.3s ease-in-out'
34-
3531
return (
3632
<AppBar id="header">
3733
<AppBarLink title="JSON Tools" href="/">

frontend/src/components/json-schema-selector.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ type JsonSchemaSelectorProps = {
1010

1111
export const JsonSchemaSelector = Shade<JsonSchemaSelectorProps>({
1212
shadowDomName: 'shade-json-schema-selector',
13+
css: {
14+
'& .material-symbols-outlined': {
15+
fontSize: '1.15em',
16+
marginRight: '8px',
17+
},
18+
},
1319
render: ({ props, useDisposable }) => {
1420
const isVisible = useDisposable('isVisible', () => new ObservableValue(false))
1521
const value = useDisposable('value', () => new ObservableValue(props.schema))
@@ -23,9 +29,7 @@ export const JsonSchemaSelector = Shade<JsonSchemaSelectorProps>({
2329
isVisible.setValue(true)
2430
}}
2531
>
26-
<i className="material-symbols-outlined" style={{ fontSize: '1.15em', marginRight: '8px' }}>
27-
data_object
28-
</i>
32+
<i className="material-symbols-outlined">data_object</i>
2933
Schema
3034
</Button>
3135
<Modal

frontend/src/components/layout.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ import { Header } from './header.js'
55

66
export const Layout = Shade({
77
shadowDomName: 'shade-app-layout',
8+
css: {
9+
'& #Layout': {
10+
position: 'fixed',
11+
top: '0',
12+
left: '0',
13+
width: '100%',
14+
height: '100%',
15+
display: 'flex',
16+
flexDirection: 'column',
17+
lineHeight: '1.6',
18+
overflow: 'hidden',
19+
padding: '0',
20+
margin: '0',
21+
},
22+
},
823
render: ({ injector }) => {
924
return (
1025
<div
1126
id="Layout"
1227
style={{
13-
position: 'fixed',
14-
top: '0',
15-
left: '0',
16-
width: '100%',
17-
height: '100%',
18-
display: 'flex',
19-
flexDirection: 'column',
20-
lineHeight: '1.6',
21-
overflow: 'hidden',
22-
padding: '0',
23-
margin: '0',
2428
background: injector.getInstance(ThemeProviderService).theme.background.default,
2529
}}
2630
>

frontend/src/components/share-button.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { Button, NotyService } from '@furystack/shades-common-components'
33

44
export const ShareButton = Shade({
55
shadowDomName: 'shade-share-button',
6+
css: {
7+
'& .material-symbols-outlined': {
8+
fontSize: 'inherit',
9+
marginRight: '8px',
10+
},
11+
},
612
render: ({ injector }) => {
713
return (
814
<Button
@@ -26,15 +32,7 @@ export const ShareButton = Shade({
2632
})
2733
}}
2834
>
29-
<i
30-
style={{
31-
fontSize: 'inherit',
32-
marginRight: '8px',
33-
}}
34-
className="material-symbols-outlined"
35-
>
36-
share
37-
</i>
35+
<i className="material-symbols-outlined">share</i>
3836
Share
3937
</Button>
4038
)

frontend/src/components/theme-switch/index.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import { createComponent, Shade } from '@furystack/shades'
22
import type { ButtonProps } from '@furystack/shades-common-components'
3-
import { getCssVariable } from '@furystack/shades-common-components'
4-
import { Button, defaultDarkTheme, defaultLightTheme, ThemeProviderService } from '@furystack/shades-common-components'
3+
import {
4+
Button,
5+
defaultDarkTheme,
6+
defaultLightTheme,
7+
getCssVariable,
8+
ThemeProviderService,
9+
} from '@furystack/shades-common-components'
510

611
export const ThemeSwitch = Shade<Omit<ButtonProps, 'onclick'>>({
712
shadowDomName: 'theme-switch',
13+
css: {
14+
'& .material-symbols-outlined': {
15+
fontSize: '1.27em',
16+
},
17+
},
818
render: ({ props, injector, useStoredState }) => {
919
const themeProvider = injector.getInstance(ThemeProviderService)
1020
const [theme, setTheme] = useStoredState<'light' | 'dark'>(
@@ -21,13 +31,9 @@ export const ThemeSwitch = Shade<Omit<ButtonProps, 'onclick'>>({
2131
}}
2232
>
2333
{theme === 'dark' ? (
24-
<i style={{ fontSize: '1.27em' }} className="material-symbols-outlined">
25-
light_mode
26-
</i>
34+
<i className="material-symbols-outlined">light_mode</i>
2735
) : (
28-
<i style={{ fontSize: '1.27em' }} className="material-symbols-outlined">
29-
dark_mode
30-
</i>
36+
<i className="material-symbols-outlined">dark_mode</i>
3137
)}
3238
</Button>
3339
)

frontend/src/pages/compare.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ import { ShareButton } from '../components/share-button.js'
55

66
export const ComparePage = Shade({
77
shadowDomName: 'shade-compare-page',
8+
css: {
9+
'& .page-container': {
10+
position: 'fixed',
11+
height: '100%',
12+
width: '100%',
13+
},
14+
'& .actions': {
15+
position: 'fixed',
16+
bottom: '0',
17+
right: '0',
18+
zIndex: '100',
19+
alignItems: 'center',
20+
justifyContent: 'flex-end',
21+
},
22+
},
823
render: ({ injector, useObservable, element }) => {
924
const locationService = injector.getInstance(LocationService)
1025

@@ -42,13 +57,7 @@ export const ComparePage = Shade({
4257
)
4358

4459
return (
45-
<div
46-
style={{
47-
position: 'fixed',
48-
height: '100%',
49-
width: '100%',
50-
}}
51-
>
60+
<div className="page-container">
5261
<MonacoDiffEditor
5362
originalValue={original}
5463
modifiedValue={modified}
@@ -63,16 +72,7 @@ export const ComparePage = Shade({
6372
} as any
6473
}
6574
/>
66-
<div
67-
style={{
68-
position: 'fixed',
69-
bottom: '0',
70-
right: '0',
71-
zIndex: '100',
72-
alignItems: 'center',
73-
justifyContent: 'flex-end',
74-
}}
75-
>
75+
<div className="actions">
7676
<ShareButton />
7777
</div>
7878
</div>

frontend/src/pages/validate.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ import { MonacoModelProvider } from '../services/monaco-model-provider.js'
77

88
export const ValidatePage = Shade({
99
shadowDomName: 'shade-validate-page',
10+
css: {
11+
'& .page-container': {
12+
position: 'fixed',
13+
height: '100%',
14+
width: '100%',
15+
},
16+
'& .actions': {
17+
position: 'fixed',
18+
bottom: '0',
19+
right: '0',
20+
zIndex: '100',
21+
alignItems: 'center',
22+
justifyContent: 'flex-end',
23+
},
24+
},
1025
render: ({ injector, useObservable, element, useSearchState }) => {
1126
const locationService = injector.getInstance(LocationService)
1227
const modelProvider = injector.getInstance(MonacoModelProvider)
@@ -58,13 +73,7 @@ export const ValidatePage = Shade({
5873
: undefined
5974

6075
return (
61-
<div
62-
style={{
63-
position: 'fixed',
64-
height: '100%',
65-
width: '100%',
66-
}}
67-
>
76+
<div className="page-container">
6877
<MonacoEditor
6978
value={value}
7079
onValueChange={(newValue) => setValue(newValue)}
@@ -77,16 +86,7 @@ export const ValidatePage = Shade({
7786
}}
7887
/>
7988

80-
<div
81-
style={{
82-
position: 'fixed',
83-
bottom: '0',
84-
right: '0',
85-
zIndex: '100',
86-
alignItems: 'center',
87-
justifyContent: 'flex-end',
88-
}}
89-
>
89+
<div className="actions">
9090
<JsonSchemaSelector
9191
schema={jsonSchema}
9292
onSchemaChange={(schema) => {

frontend/src/services/monaco-model-provider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Injectable } from '@furystack/inject'
2-
import { Uri, languages } from 'monaco-editor/esm/vs/editor/editor.api.js'
2+
import { Uri } from 'monaco-editor/esm/vs/editor/editor.api.js'
3+
import { json } from 'monaco-editor/esm/vs/editor/editor.main.js'
34

45
@Injectable({ lifetime: 'singleton' })
56
export class MonacoModelProvider {
@@ -10,13 +11,13 @@ export class MonacoModelProvider {
1011
return this.nameUriCache.get(schemaName) as Uri
1112
}
1213
const modelUri = Uri.parse(`furystack://json-tools/model-schemas-${schemaName}.json`)
13-
languages.json.jsonDefaults.setDiagnosticsOptions({
14+
json.jsonDefaults.setDiagnosticsOptions({
1415
validate: true,
1516
enableSchemaRequest: true,
1617
schemaRequest: 'warning',
1718
schemaValidation: 'error',
1819
schemas: [
19-
...(languages.json.jsonDefaults.diagnosticsOptions.schemas || []),
20+
...(json.jsonDefaults.diagnosticsOptions.schemas || []),
2021
{
2122
uri: `furystack://json-tools/model-schemas-${schemaName}.json`,
2223
fileMatch: [modelUri.toString()],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@furystack/yarn-plugin-changelog": "^1.0.2",
1818
"@playwright/test": "^1.58.1",
1919
"@types/node": "^25.2.0",
20+
"@vitest/coverage-istanbul": "4.0.18",
2021
"@vitest/coverage-v8": "^4.0.18",
2122
"eslint": "^9.39.2",
2223
"eslint-config-prettier": "^10.1.8",

0 commit comments

Comments
 (0)