and even mooooore tweaks

This commit is contained in:
Chris Kruining 2024-10-17 09:19:54 +02:00
parent fb4d28b265
commit 1c0810290b
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
7 changed files with 40 additions and 22 deletions

View file

@ -1,9 +1,11 @@
@import url("https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght,GRAD@8..144,400,45;8..144,400,50;8..144,1000,0&family=Roboto+Serif:opsz,GRAD@8..144,71&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght,GRAD@8..144,400,45;8..144,400,50;8..144,1000,0&family=Roboto+Serif:opsz,GRAD@8..144,71&display=swap");
:root { :root {
--surface-1: #eee; --surface-1: #ddd;
--surface-2: #f8f8f8; --surface-2: #e8e8e8;
--surface-3: #fff; --surface-3: #eee;
--surface-4: #f8f8f8;
--surface-5: #fff;
--text-1: #222; --text-1: #222;
--text-2: #282828; --text-2: #282828;
--primary: #41c6b3; --primary: #41c6b3;
@ -33,9 +35,11 @@
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--surface-1: #333; --surface-1: #222;
--surface-2: #383838; --surface-2: #282828;
--surface-3: #444; --surface-3: #333;
--surface-4: #383838;
--surface-5: #444;
--text-1: #eee; --text-1: #eee;
--text-2: #d8d8d8; --text-2: #d8d8d8;
@ -71,6 +75,10 @@ body {
* { * {
box-sizing: border-box; box-sizing: border-box;
&:focus-visible {
outline: 1px solid var(--info);
}
} }
& .menu-root { & .menu-root {
@ -84,7 +92,7 @@ body {
padding-inline-start: 1em; padding-inline-start: 1em;
block-size: 2em; block-size: 2em;
background-color: var(--surface-2); background-color: var(--surface-3);
color: var(--text-1); color: var(--text-1);
& > .logo { & > .logo {

View file

@ -1,6 +1,6 @@
.menu { .menu {
position: fixed; position: fixed;
display: grid; display: none;
grid-template-columns: auto auto; grid-template-columns: auto auto;
place-content: start; place-content: start;
@ -28,4 +28,8 @@
text-align: end; text-align: end;
} }
} }
&:popover-open {
display: grid;
}
} }

View file

@ -32,7 +32,16 @@ export const createCommand = (label: string, command: () => any, shortcut?: Comm
}); });
}; };
export const noop = createCommand('noop', () => { }); export const noop = Object.defineProperties(createCommand('noop', () => { }), {
withLabel: {
value(label: string) {
return createCommand(label, () => { });
},
configurable: false,
writable: false,
},
}) as CommandType & { withLabel(label: string): CommandType };
export const Command: Component<{ command: CommandType }> = (props) => { export const Command: Component<{ command: CommandType }> = (props) => {
return <> return <>

View file

@ -55,6 +55,7 @@
position: sticky; position: sticky;
inset-block-start: 0; inset-block-start: 0;
background-color: var(--surface-1); background-color: var(--surface-1);
border-block-end: 1px solid var(--surface-5);
} }
& .row { & .row {

View file

@ -69,8 +69,6 @@ const GridProvider: ParentComponent<{ rows: Map<string, { [lang: string]: { valu
}, },
}; };
const mutated = createMemo(() => Object.values(state.rows).filter(entry => Object.values(entry).some(lang => lang.original !== lang.value)));
return <GridContext.Provider value={ctx}> return <GridContext.Provider value={ctx}>
<SelectionProvider selection={setSelection} multiSelect> <SelectionProvider selection={setSelection} multiSelect>
{props.children} {props.children}
@ -204,7 +202,7 @@ const TextArea: Component<{ key: string, value: string, lang: string, oninput?:
const resize = () => { const resize = () => {
element.style.height = `1px`; element.style.height = `1px`;
element.style.height = `${11 + element.scrollHeight}px`; element.style.height = `${2 + element.scrollHeight}px`;
}; };
const mutate = debounce(() => { const mutate = debounce(() => {

View file

@ -9,7 +9,7 @@
text-align: start; text-align: start;
&:hover { &:hover {
background-color: var(--surface-2); background-color: var(--surface-4);
} }
} }
@ -25,8 +25,8 @@
padding: var(--padding-m) 0; padding: var(--padding-m) 0;
inline-size: max-content; inline-size: max-content;
background-color: var(--surface-2); background-color: var(--surface-4);
border: 1px solid var(--surface-3); border: 1px solid var(--surface-5);
border-block-start-width: 0; border-block-start-width: 0;
margin: unset; margin: unset;
@ -40,10 +40,10 @@
grid-template-columns: subgrid; grid-template-columns: subgrid;
align-items: center; align-items: center;
background-color: var(--surface-2); background-color: var(--surface-4);
&:hover { &:hover {
background-color: var(--surface-3); background-color: var(--surface-5);
} }
& > sub { & > sub {
@ -54,5 +54,5 @@
} }
:popover-open + .item { :popover-open + .item {
background-color: var(--surface-2); background-color: var(--surface-4);
} }

View file

@ -112,8 +112,6 @@ export default function Edit(props: ParentProps) {
}); });
}, { key: 's', modifier: Modifier.Control | Modifier.Shift }), }, { key: 's', modifier: Modifier.Control | Modifier.Shift }),
edit: createCommand('edit', () => {
}),
selectAll: createCommand('select all', () => { selectAll: createCommand('select all', () => {
api()?.selectAll(); api()?.selectAll();
}, { key: 'a', modifier: Modifier.Control }), }, { key: 'a', modifier: Modifier.Control }),
@ -143,7 +141,7 @@ export default function Edit(props: ParentProps) {
<Menu.Item command={commands.save} /> <Menu.Item command={commands.save} />
</Menu.Item> </Menu.Item>
<Menu.Item command={commands.edit} /> <Menu.Item command={noop.withLabel('edit')} />
<Menu.Item label="selection"> <Menu.Item label="selection">
<Menu.Item command={commands.selectAll} /> <Menu.Item command={commands.selectAll} />
@ -151,7 +149,7 @@ export default function Edit(props: ParentProps) {
<Menu.Item command={commands.clearSelection} /> <Menu.Item command={commands.clearSelection} />
</Menu.Item> </Menu.Item>
<Menu.Item label="view" command={noop} /> <Menu.Item command={noop.withLabel('view')} />
</Menu.Root> </Menu.Root>
<Sidebar as="aside" class={css.sidebar}> <Sidebar as="aside" class={css.sidebar}>