Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ui): make appearance editor more cohesive (#2897)

Fake-User822efef8199c
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index 3e91b806ad..c4f05db37c 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -1,17 +1,32 @@
-import { ThemeEditorAdvanced } from '../../../theme/components/ThemeEditorAdvanced';
-import { ThemeEditorBasic } from '../../../theme/components/ThemeEditorBasic';
-import ThemeTools from '../../../theme/components/ThemeTools';
-import ThemeList from '../../../theme/components/ThemeList';
+import { ThemeEditorAdvanced } from '@theme/components/ThemeEditorAdvanced';
+import { ThemeEditorBasic } from '@theme/components/ThemeEditorBasic';
+import ThemeTools from '@theme/components/ThemeTools';
+import ThemeList from '@theme/components/ThemeList';
+
+import { Panel } from '@ui';
export function Appearance() {
return (
- <div
- class="absolute inset-0 overflow-hidden bg-edge-muted @container gap-px grid grid-cols-1 grid-rows-[min-content_min-content_1fr_1fr] @[650px]:grid-cols-2 @[650px]:grid-rows-[min-content_min-content_1fr]"
- >
- <div class="@[650px]:col-span-2"><ThemeTools /></div>
- <div class="@[650px]:col-span-2"><ThemeEditorBasic /></div>
- <div class="overflow-hidden"><ThemeList/></div>
- <div class="overflow-hidden"><ThemeEditorAdvanced /></div>
+ <div
+ style={{
+ 'grid-template-rows': 'min-content 1fr',
+ 'grid-template-columns': '1fr',
+ 'overflow': 'hidden',
+ 'display': 'grid',
+ 'padding': '20px',
+ 'height': '100%',
+ 'gap': '20px',
+ }}
+ >
+ <Panel>
+ <ThemeTools />
+ <ThemeEditorBasic />
+ </Panel>
+
+ <div class="@container grid grid-cols-1 @[700px]:grid-cols-2 gap-5 overflow-hidden min-h-0">
+ <Panel><ThemeList /></Panel>
+ <Panel><ThemeEditorAdvanced /></Panel>
</div>
+ </div>
);
}
diff --git a/js/app/packages/theme/components/ThemeEditorAdvanced.tsx b/js/app/packages/theme/components/ThemeEditorAdvanced.tsx
index 1108b296c8..9acc257027 100644
--- a/js/app/packages/theme/components/ThemeEditorAdvanced.tsx
+++ b/js/app/packages/theme/components/ThemeEditorAdvanced.tsx
@@ -42,15 +42,15 @@ export function ThemeEditorAdvanced(){
<div
style="
- background-color: var(--b1);
- font-family: var(--font-sans);
- scrollbar-width: none;
- position: relative;
- overflow: hidden;
- font-size: 14px;
- display: block;
- height: 100%;
- "
+ background-color: var(--b1);
+ font-size: var(--text-xs);
+ scrollbar-width: none;
+ position: relative;
+ overflow: hidden;
+ font-weight: 300;
+ display: block;
+ height: 100%;
+ "
>
<div
style="
@@ -64,27 +64,34 @@ export function ThemeEditorAdvanced(){
>
<div
style="
- background-color: var(--color-edge-muted);
- box-sizing: border-box;
- overflow-x: hidden;
- display: grid;
- gap: 1px;
- "
+ background-color: var(--color-edge-muted);
+ box-sizing: border-box;
+ overflow-x: hidden;
+ display: grid;
+ gap: 1px;
+ "
>
<div
style="
- border-bottom: 1px solid var(--color-edge-muted);
- background-color: var(--b1);
- align-items: center;
- position: absolute;
- padding: 0 20px;
- display: grid;
- height: 42px;
- width: 100%;
- z-index: 1;
+ border-bottom: 1px solid var(--color-edge-muted);
+ background-color: var(--b1);
+ align-items: center;
+ position: absolute;
+ padding: 0 20px;
+ display: grid;
+ height: 42px;
+ width: 100%;
+ z-index: 1;
"
>
- <div style="font-size: var(--text-xs);">Theme Tokens</div>
+ <div
+ style={{
+ 'font-size': '0.875rem',
+ 'font-weight': '600'
+ }}
+ >
+ Theme Tokens
+ </div>
</div>
<div style="height: 41px;" />
@@ -111,7 +118,12 @@ export function ThemeEditorAdvanced(){
});
return (
- <div style="background-color: var(--b1);">
+ <div
+ style="
+ font-family: var(--font-mono);
+ background-color: var(--b1);
+ "
+ >
<div
style="
background-color: var(--color-edge-muted);
@@ -167,6 +179,11 @@ export function ThemeEditorAdvanced(){
outline: none;
border: none;
width: 100%;
+ font-family: var(--font-mono);
+ font-size: var(--text-xs);
+ font-weight: 300;
+ color: var(--color-ink-extra-muted);
+ background: transparent;
"
/>
</div>
diff --git a/js/app/packages/theme/components/ThemeEditorBasic.tsx b/js/app/packages/theme/components/ThemeEditorBasic.tsx
index 64b8f39ba6..f21f982605 100644
--- a/js/app/packages/theme/components/ThemeEditorBasic.tsx
+++ b/js/app/packages/theme/components/ThemeEditorBasic.tsx
@@ -119,6 +119,9 @@ export function ThemeEditorBasic(){
let canvasRef!: HTMLCanvasElement;
let gl: WebGL2RenderingContext;
let program: WebGLProgram;
+ let gridXLocation: WebGLUniformLocation;
+ let gridYLocation: WebGLUniformLocation;
+ let resizeObserver: ResizeObserver;
function setupWebGL(){
const context = canvasRef.getContext('webgl2', {colorSpace: 'display-p3'});
@@ -153,7 +156,10 @@ export function ThemeEditorBasic(){
in vec2 vUV;
out vec4 fragColor;
uniform float chroma;
+ uniform float gridX;
+ uniform float gridY;
const float PI = 3.14159265359;
+ const float radius = 0.135;
vec3 OKLCH_to_OKLab(float L, float C, float h){
return vec3(
@@ -185,7 +191,19 @@ export function ThemeEditorBasic(){
vec3 lab = OKLCH_to_OKLab(L, C, h);
vec3 rgb_linear = OKLab_to_linear_sRGB(lab);
vec3 rgb = linear_to_sRGB(rgb_linear);
- fragColor = vec4(rgb, 1.0);
+
+ /* DOT GRID */
+ float smoothing = gridY * 0.0013;
+ float offsetX = fract(gridX) * 0.5 / gridX;
+ float offsetY = fract(gridY) * 0.5 / gridY;
+ vec2 centeredUV = vUV - vec2(offsetX, offsetY);
+ float dist = 1.0 - smoothstep(
+ radius - smoothing,
+ radius + smoothing,
+ distance(vec2(mod(centeredUV.x * gridX, 1.0), mod(centeredUV.y * gridY, 1.0)), vec2(0.5))
+ );
+
+ fragColor = vec4(rgb * dist, dist);
}
`;
@@ -197,6 +215,8 @@ export function ThemeEditorBasic(){
gl.useProgram(program);
chromaLocation = gl.getUniformLocation(program, 'chroma')!;
+ gridXLocation = gl.getUniformLocation(program, 'gridX')!;
+ gridYLocation = gl.getUniformLocation(program, 'gridY')!;
}
function setCanvasColor(e: PointerEvent){
@@ -244,6 +264,21 @@ export function ThemeEditorBasic(){
onMount(() => {
setupWebGL();
+ function updateCanvasSize(){
+ const rect = canvasContainerRef.getBoundingClientRect();
+ canvasRef.width = rect.width * devicePixelRatio;
+ canvasRef.height = rect.height * devicePixelRatio;
+ gl.viewport(0, 0, canvasRef.width, canvasRef.height);
+ gl.uniform1f(gridXLocation, rect.width / 8.3);
+ gl.uniform1f(gridYLocation, rect.height / 8.3);
+ gl.uniform1f(chromaLocation, themeReactive.a0.c[0]());
+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
+ }
+
+ resizeObserver = new ResizeObserver(updateCanvasSize);
+ resizeObserver.observe(canvasContainerRef);
+ updateCanvasSize();
+
createEffect(() => {
gl.uniform1f(chromaLocation, themeReactive.a0.c[0]());
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
@@ -259,6 +294,7 @@ export function ThemeEditorBasic(){
});
onCleanup(() => {
+ resizeObserver.disconnect();
document.removeEventListener('pointermove', handlePointerMove);
document.removeEventListener('pointerup', handlePointerUp);
});
@@ -276,15 +312,15 @@ export function ThemeEditorBasic(){
<div
style="
- font-family: var(--font-sans);
- background-color: var(--b1);
- box-sizing: border-box;
- height: min-content;
- font-weight: 500;
- font-size: 12px;
- display: grid;
- padding: 20px;
- gap: 20px;
+ font-family: var(--font-sans);
+ background-color: var(--b1);
+ box-sizing: border-box;
+ height: min-content;
+ font-weight: 500;
+ font-size: 12px;
+ display: grid;
+ padding: 20px;
+ gap: 20px;
"
>
<div
@@ -292,32 +328,36 @@ export function ThemeEditorBasic(){
ref={canvasContainerRef}
style="
border: 1px solid var(--color-edge-muted);
+ border-radius: 6px;
position: relative;
height: 250px;
width: 100%;
"
>
<canvas
- ref={canvasRef}
style="
+ background-color: #000c; /* scuffed */
+ border-radius: 5px;
touch-action: none;
user-select: none;
display: block;
height: 100%;
width: 100%;
"
+ ref={canvasRef}
/>
<div
- ref={canvasThumbRef}
style="
border: 1px solid var(--color-edge-muted);
transform: translate(-50%, -50%);
background-color: var(--a0);
box-sizing: border-box;
+ border-radius: 2px;
position: absolute;
height: 18px;
width: 18px;
"
+ ref={canvasThumbRef}
/>
</div>
@@ -325,9 +365,9 @@ export function ThemeEditorBasic(){
style="
grid-template-columns: 11ch 1fr;
height: min-content;
+ gap: 20px 10px;
display: grid;
width: 100%;
- gap: 20px 10px;
"
>
<div style="position: relative;">
@@ -381,10 +421,8 @@ export function ThemeEditorBasic(){
/>
<input
+ onInput={(e) => { handleChromaChange(e);}}
value={themeReactive.a0.c[0]().toString()}
- onInput={(e) => {
- handleChromaChange(e);
- }}
class="theme-editor-basic-slider"
style="
appearance: none;
@@ -474,9 +512,7 @@ export function ThemeEditorBasic(){
/>
<input
- onInput={(e) => {
- handleSaturationChange(e);
- }}
+ onInput={(e) => {handleSaturationChange(e);}}
class="theme-editor-basic-slider"
style="
appearance: none;
diff --git a/js/app/packages/theme/components/ThemeList.tsx b/js/app/packages/theme/components/ThemeList.tsx
index 014eb59325..ff7792ffcb 100644
--- a/js/app/packages/theme/components/ThemeList.tsx
+++ b/js/app/packages/theme/components/ThemeList.tsx
@@ -24,11 +24,6 @@ export function ThemeList() {
border-color: var(--a0) !important;
transition: none !important;
}
-
- hr{
- border-color: var(--a0) !important;
- transition: none !important;
- }
}
@media(hover){
@@ -45,11 +40,6 @@ export function ThemeList() {
border-color: var(--a0) !important;
transition: none !important;
}
-
- hr{
- border-color: var(--a0) !important;
- transition: none !important;
- }
}
}
`}</style>
@@ -78,6 +68,8 @@ export function ThemeList() {
>
<div
style="
+ border-bottom: 1px solid var(--color-edge-muted); /* temp remove when long */
+ margin-bottom: -1px; /* temp remove when long */
background-color: var(--color-edge-muted);
box-sizing: border-box;
overflow-x: hidden;
@@ -98,7 +90,14 @@ export function ThemeList() {
z-index: 1;
"
>
- <div style="font-size: var(--text-xs);">Theme List</div>
+ <div
+ style={{
+ 'font-size': '0.875rem',
+ 'font-weight': '600'
+ }}
+ >
+ Theme List
+ </div>
</div>
<div style="height: 41px;" />
<For each={themes()}>
@@ -110,54 +109,69 @@ export function ThemeList() {
applyTheme(theme.id)
}}
style="
- grid-template-columns: min-content 1fr min-content;
cursor: var(--cursor-pointer);
background-color: var(--b1);
- align-items: center;
- padding: 10px 20px;
- display: grid;
- gap: 20px;
"
>
<div
style="
- grid-template-columns: repeat(3, min-content);
- display: grid;
- gap: 5px;
- "
- >
- <ColorSwatch
- color={`oklch(${theme.tokens.a0.l} ${theme.tokens.a0.c} ${theme.tokens.a0.h}deg)`}
- width={'10px'}
- />
- <ColorSwatch
- color={`oklch(${theme.tokens.b0.l} ${theme.tokens.b0.c} ${theme.tokens.b0.h}deg)`}
- width={'10px'}
- />
- <ColorSwatch
- color={`oklch(${theme.tokens.c0.l} ${theme.tokens.c0.c} ${theme.tokens.c0.h}deg)`}
- width={'10px'}
- />
- </div>
-
- <hr
- style="
- border: none;
- border-top: 1px dashed var(--color-edge-muted);
- transition: border-color var(--transition);
- box-sizing: border-box;
- width: 100%;
- "
- />
-
- <div
- class="theme-list-item-name"
- style="
- transition: color var(--transition);
- white-space: nowrap;
+ background-color: var(--color-edge-muted);
+ grid-template-columns: min-content 1fr;
+ align-items: center;
+ display: grid;
+ height: 41px;
+ gap: 1px;
"
>
- {theme.name}
+ <div
+ style="
+ background-color: var(--b1);
+ box-sizing: border-box;
+ align-items: center;
+ padding: 0 20px;
+ display: grid;
+ height: 100%;
+ width: 100%;
+ "
+ >
+ <div
+ style="
+ grid-template-columns: repeat(3, min-content);
+ display: grid;
+ gap: 5px;
+ "
+ >
+ <ColorSwatch
+ color={`oklch(${theme.tokens.a0.l} ${theme.tokens.a0.c} ${theme.tokens.a0.h}deg)`}
+ width={'10px'}
+ />
+ <ColorSwatch
+ color={`oklch(${theme.tokens.b0.l} ${theme.tokens.b0.c} ${theme.tokens.b0.h}deg)`}
+ width={'10px'}
+ />
+ <ColorSwatch
+ color={`oklch(${theme.tokens.c0.l} ${theme.tokens.c0.c} ${theme.tokens.c0.h}deg)`}
+ width={'10px'}
+ />
+ </div>
+ </div>
+
+ <div
+ class="theme-list-item-name"
+ style="
+ background-color: var(--b1);
+ box-sizing: border-box;
+ transition: color var(--transition);
+ white-space: nowrap;
+ align-items: center;
+ padding: 0 20px;
+ display: grid;
+ height: 100%;
+ width: 100%;
+ "
+ >
+ {theme.name}
+ </div>
</div>
</div>
)}
diff --git a/js/app/packages/theme/components/ThemeTools.tsx b/js/app/packages/theme/components/ThemeTools.tsx
index cb877003d0..256e061d9d 100644
--- a/js/app/packages/theme/components/ThemeTools.tsx
+++ b/js/app/packages/theme/components/ThemeTools.tsx
@@ -2,7 +2,6 @@ import { deleteTheme, exportTheme, importTheme, invertTheme, saveTheme } from '.
import { currentThemeId, isThemeSaved, themes, userThemes } from '../signals/themeSignals';
import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { createEffect, createMemo, createSignal, Show } from 'solid-js';
-import IconPaintbrush from '@macro-icons/wide/paintbrush.svg';
import IconLightDark from '@macro-icons/macro-light-dark.svg';
import IconClipboard from '@macro-icons/macro-clipboard.svg';
import IconImport from '@macro-icons/macro-import.svg';
@@ -11,7 +10,6 @@ import { randomizeTheme } from './ThemeEditorBasic';
import IconDice from '@macro-icons/macro-dice.svg';
import IconSave from '@macro-icons/macro-save.svg';
-
export function ThemeTools() {
let themeName!: HTMLDivElement;
@@ -39,7 +37,8 @@ export function ThemeTools() {
return (
<div
style={{
- 'grid-template-columns': `min-content min-content 1fr repeat(${columnCount()}, min-content)`,
+ 'grid-template-columns': ` min-content 1fr repeat(${columnCount()}, min-content)`,
+ 'border-bottom': '1px solid var(--color-edge-muted)',
'padding': '0 12px 0 20px' /* (41 - 32) / 2 */,
'gap': '4.5px' /* (41 - 32) / 2 */,
'font-family': 'var(--font-sans)',
@@ -53,19 +52,7 @@ export function ThemeTools() {
'width': '100%',
}}
>
- <div style="width: 18px; height: 18px; shrink: 0; color: var(--color-text-muted)">
- <IconPaintbrush />
- </div>
-
<div
- ref={themeName}
- contentEditable
- style="white-space: nowrap;"
- onBlur={() => {
- if(!themeName.innerText.trim()){
- themeName.innerText = defaultThemeName;
- }
- }}
onKeyDown={(e) => {
if(e.key === 'Enter'){
e.preventDefault();
@@ -74,23 +61,27 @@ export function ThemeTools() {
saveTheme(name);
themeName.blur();
}
- else {
- themeName.innerText = defaultThemeName;
- }
+ else { themeName.innerText = defaultThemeName; }
}
}}
+ onBlur={() => {
+ if(!themeName.innerText.trim()){
+ themeName.innerText = defaultThemeName;
+ }
+ }}
+ style={{
+ 'white-space': 'nowrap',
+ 'font-size': '0.875rem',
+ 'font-weight': '600',
+ 'outline': 'none',
+ }}
+ contentEditable={true}
+ ref={themeName}
>
{currentThemeName()}
</div>
- <hr
- style="
- border: none;
- border-top: 1px dashed var(--color-edge-muted);
- box-sizing: border-box;
- width: 100%;
- "
- />
+ <div/>
<Show when={showTrash()}>
<DeprecatedIconButton
diff --git a/js/app/packages/ui/components/Panel.tsx b/js/app/packages/ui/components/Panel.tsx
index 70269ec53c..9d0835ed48 100644
--- a/js/app/packages/ui/components/Panel.tsx
+++ b/js/app/packages/ui/components/Panel.tsx
@@ -14,7 +14,7 @@ export function Panel(props: PanelProps) {
style={{
'background-image': `linear-gradient(${props.active ? `${props.highlightColor || 'var(--color-accent)'}, var(--color-edge-muted) 80%` : 'var(--color-edge-muted)'})`,
}}
- class="p-px h-full w-full box-border rounded-md overflow-clip"
+ class="p-px h-full w-full box-border rounded-md overflow-clip min-h-0"
>
<div
class={cn(