Merge branch 'fix-breezy' into 'develop'

Fix breezy

See merge request pleroma/pleroma-fe!2108
This commit is contained in:
HJ 2025-03-26 15:58:34 +00:00
commit 6fdf192816
4 changed files with 34 additions and 31 deletions

View file

@ -25,7 +25,7 @@
accent: #1CA4F3; accent: #1CA4F3;
cBlue: #1CA4F3; cBlue: #1CA4F3;
cRed: #f41a51; cRed: #f41a51;
cGreen: #1af46e; cGreen: #0b6a30;
cOrange: #f4af1a; cOrange: #f4af1a;
border: #d8e6f9; border: #d8e6f9;
link: #1CA4F3; link: #1CA4F3;
@ -39,7 +39,7 @@
accent: #1CA4F3; accent: #1CA4F3;
cRed: #f41a51; cRed: #f41a51;
cBlue: #1CA4F3; cBlue: #1CA4F3;
cGreen: #1af46e; cGreen: #0b6a30;
cOrange: #f4af1a; cOrange: #f4af1a;
} }
@ -47,45 +47,46 @@ Root {
--badgeNotification: color | --cRed; --badgeNotification: color | --cRed;
--buttonDefaultHoverGlow: shadow | inset 0 0 0 1 --accent / 1; --buttonDefaultHoverGlow: shadow | inset 0 0 0 1 --accent / 1;
--buttonDefaultFocusGlow: shadow | inset 0 0 0 1 --accent / 1; --buttonDefaultFocusGlow: shadow | inset 0 0 0 1 --accent / 1;
--buttonDefaultShadow: shadow | inset 0 0 0 1 --parent--text / 0.35, 0 5 5 -5 #000000 / 0.35; --buttonDefaultShadow: shadow | inset 0 0 0 1 --text / 0.35, 0 5 5 -5 #000000 / 0.35;
--buttonDefaultBevel: shadow | inset 0 14 14 -14 #FFFFFF / 0.1; --buttonDefaultBevel: shadow | inset 0 14 14 -14 #FFFFFF / 0.1;
--buttonPressedBevel: shadow | inset 0 -20 20 -20 #000000 / 0.05; --buttonPressedBevel: shadow | inset 0 -20 20 -20 #000000 / 0.05;
--defaultInputBevel: shadow | inset 0 0 0 1 --parent--text / 0.35; --defaultInputBevel: shadow | inset 0 0 0 1 --text / 0.35;
--defaultInputHoverGlow: shadow | 0 0 0 1 --accent / 1; --defaultInputHoverGlow: shadow | 0 0 0 1 --accent / 1;
--defaultInputFocusGlow: shadow | 0 0 0 1 --link / 1; --defaultInputFocusGlow: shadow | 0 0 0 1 --link / 1;
} }
Button {
background: --parent;
}
Button:disabled { Button:disabled {
shadow: --buttonDefaultBevel, --buttonDefaultShadow shadow: --buttonDefaultBevel, --buttonDefaultShadow
} }
Button:hover { Button:hover {
background: --inheritedBackground;
shadow: --buttonDefaultHoverGlow, --buttonDefaultBevel, --buttonDefaultShadow shadow: --buttonDefaultHoverGlow, --buttonDefaultBevel, --buttonDefaultShadow
} }
Button:toggled { Button:toggled {
background: $blend(--bg 0.3 --accent) background: $blend(--inheritedBackground 0.3 --accent)
} }
Button:pressed { Button:pressed {
background: $blend(--bg 0.8 --accent) background: $blend(--inheritedBackground 0.8 --accent)
} }
Button:pressed:toggled { Button:pressed:toggled {
background: $blend(--bg 0.2 --accent) background: $blend(--inheritedBackground 0.2 --accent)
} }
Button:toggled:hover { Button:toggled:hover {
background: $blend(--bg 0.3 --accent) background: $blend(--inheritedBackground 0.3 --accent)
}
Button {
background: --parent;
} }
Input { Input {
shadow: --defaultInputBevel; shadow: --defaultInputBevel;
background: --parent; background: $mod(--bg -10);
} }
PanelHeader { PanelHeader {
@ -97,5 +98,5 @@ Tab:hover {
} }
Tab { Tab {
background: --parent; background: --bg;
} }

View file

@ -388,6 +388,10 @@ nav {
&:disabled { &:disabled {
cursor: not-allowed; cursor: not-allowed;
} }
&:active {
transform: translate(1px, 1px);
}
} }
.menu-item { .menu-item {

View file

@ -112,10 +112,7 @@ export const colorFunctions = {
const color = convert(findColor(colorArg, { dynamicVars, staticVars })).rgb const color = convert(findColor(colorArg, { dynamicVars, staticVars })).rgb
const amount = Number(amountArg) const amount = Number(amountArg)
const effectiveBackground = dynamicVars.lowerLevelBackground ?? const effectiveBackground = dynamicVars.lowerLevelBackground ?? color
dynamicVars.background ??
dynamicVars.inheritedBackground ??
staticVars[colorArg]
const isLightOnDark = relativeLuminance(convert(effectiveBackground).rgb) < 0.5 const isLightOnDark = relativeLuminance(convert(effectiveBackground).rgb) < 0.5
const mod = isLightOnDark ? 1 : -1 const mod = isLightOnDark ? 1 : -1
return brightness(amount * mod, color).rgb return brightness(amount * mod, color).rgb

View file

@ -78,23 +78,24 @@ export const findColor = (color, { dynamicVars, staticVars }) => {
targetColor = { r, g, b } targetColor = { r, g, b }
} else if (variableSlot.startsWith('parent')) { } else if (variableSlot.startsWith('parent')) {
if (variableSlot === 'parent') { if (variableSlot === 'parent') {
const { r, g, b } = dynamicVars.lowerLevelBackground const { r, g, b } = dynamicVars.lowerLevelBackground ?? {}
targetColor = { r, g, b } targetColor = { r, g, b }
} else { } else {
const virtualSlot = variableSlot.replace(/^parent/, '') const virtualSlot = variableSlot.replace(/^parent/, '')
targetColor = convert(dynamicVars.lowerLevelVirtualDirectivesRaw[virtualSlot]).rgb targetColor = convert(dynamicVars.lowerLevelVirtualDirectivesRaw[virtualSlot]).rgb
} }
} else { } else {
switch (variableSlot) { const staticVar = staticVars[variableSlot]
case 'inheritedBackground': const dynamicVar = dynamicVars[variableSlot]
targetColor = convert(dynamicVars.inheritedBackground).rgb if (!staticVar && !dynamicVar) {
break console.warn(dynamicVars, variableSlot, dynamicVars[variableSlot])
case 'background': console.warn(`Couldn't find variable "${variableSlot}", falling back to magenta. Variables are:
targetColor = convert(dynamicVars.background).rgb Static:
break ${JSON.stringify(staticVars, null, 2)}
default: Dynamic:
targetColor = convert(staticVars[variableSlot]).rgb ${JSON.stringify(dynamicVars, null, 2)}`)
} }
targetColor = convert(staticVar ?? dynamicVar ?? '#FF00FF').rgb
} }
if (modifier) { if (modifier) {
@ -109,7 +110,7 @@ export const findColor = (color, { dynamicVars, staticVars }) => {
try { try {
targetColor = process(color, colorFunctions, { findColor }, { dynamicVars, staticVars }) targetColor = process(color, colorFunctions, { findColor }, { dynamicVars, staticVars })
} catch (e) { } catch (e) {
console.error('Failure executing color function', e) console.error('Failure executing color function', e ,'\n Function: ' + color)
targetColor = '#FF00FF' targetColor = '#FF00FF'
} }
} }
@ -120,7 +121,7 @@ export const findColor = (color, { dynamicVars, staticVars }) => {
Static: Static:
${JSON.stringify(staticVars, null, 2)} ${JSON.stringify(staticVars, null, 2)}
Dynamic: Dynamic:
${JSON.stringify(dynamicVars, null, 2)}`, e) ${JSON.stringify(dynamicVars, null, 2)}\nError: ${e}`)
} }
} }
@ -516,7 +517,7 @@ export const init = ({
.filter(c => virtualComponents.has(c) && !nonEditableComponents.has(c)) .filter(c => virtualComponents.has(c) && !nonEditableComponents.has(c))
} else if (liteMode) { } else if (liteMode) {
validInnerComponents = (component.validInnerComponentsLite || component.validInnerComponents || []) validInnerComponents = (component.validInnerComponentsLite || component.validInnerComponents || [])
} else if (component.name === 'Root' || component.states != null) { } else if (component.name === 'Root' || component.states != null || component.background?.includes('--parent')) {
validInnerComponents = component.validInnerComponents || [] validInnerComponents = component.validInnerComponents || []
} else { } else {
validInnerComponents = component validInnerComponents = component