logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 17b25ef0e0eb261fbfd09be740a1cd8c0e3ad88b
parent 709ce1611a557fdeb3c5f34ed3ba8cd62ead89f2
Author: Henry Jameson <me@hjkos.com>
Date:   Mon, 12 Feb 2024 19:58:42 +0200

avatar shadows

Diffstat:

Asrc/components/avatar.style.js20++++++++++++++++++++
Msrc/components/notification.style.js3++-
Msrc/components/post.style.js3++-
Msrc/components/user_avatar/user_avatar.vue6+++---
Msrc/services/style_setter/style_setter.js3++-
Msrc/services/theme_data/theme_data_3.service.js19+++++--------------
6 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/src/components/avatar.style.js b/src/components/avatar.style.js @@ -0,0 +1,20 @@ +export default { + name: 'Avatar', + selector: '.Avatar', + defaultRules: [ + { + directives: { + background: '--bg', + opacity: 0, + shadow: [{ + x: 0, + y: 1, + blur: 8, + spread: 0, + color: '#000000', + alpha: 0.7 + }] + } + } + ] +} diff --git a/src/components/notification.style.js b/src/components/notification.style.js @@ -9,7 +9,8 @@ export default { 'Button', 'ButtonUnstyled', 'RichContent', - 'Input' + 'Input', + 'Avatar' ], defaultRules: [ { diff --git a/src/components/post.style.js b/src/components/post.style.js @@ -9,7 +9,8 @@ export default { 'Button', 'ButtonUnstyled', 'RichContent', - 'Input' + 'Input', + 'Avatar' ], defaultRules: [ { diff --git a/src/components/user_avatar/user_avatar.vue b/src/components/user_avatar/user_avatar.vue @@ -30,9 +30,9 @@ @import "../../variables"; .Avatar { - --_avatarShadowBox: var(--avatarStatusShadow); - --_avatarShadowFilter: var(--avatarStatusShadowFilter); - --_avatarShadowInset: var(--avatarStatusShadowInset); + --_avatarShadowBox: var(--shadow); + --_avatarShadowFilter: var(--shadowFilter); + --_avatarShadowInset: var(--shadowInset); --_still-image-label-visibility: hidden; display: inline-block; diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js @@ -11,9 +11,9 @@ export const applyTheme = (input) => { const t0 = performance.now() const { rules, t3b } = generatePreset(input) const t1 = performance.now() + console.log('Themes 2 initialization took ' + (t1 - t0) + 'ms') const themes3 = init(sampleRules, t3b) const t2 = performance.now() - console.log('Themes 2 initialization took ' + (t1 - t0) + 'ms') console.log('Themes 3 initialization took ' + (t2 - t1) + 'ms') const head = document.head const body = document.body @@ -29,6 +29,7 @@ export const applyTheme = (input) => { // styleSheet.insertRule(`:root { ${rules.shadows} }`, 'index-max') styleSheet.insertRule(`:root { ${rules.fonts} }`, 'index-max') themes3.css.forEach(rule => { + console.log(rule) styleSheet.insertRule(rule, 'index-max') }) body.classList.remove('hidden') diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js @@ -26,20 +26,10 @@ import Border from 'src/components/border.style.js' import Post from 'src/components/post.style.js' import Notification from 'src/components/notification.style.js' import RichContent from 'src/components/rich_content.style.js' +import Avatar from 'src/components/avatar.style.js' const DEBUG = false -export const DEFAULT_SHADOWS = { - avatar: [{ - x: 0, - y: 1, - blur: 8, - spread: 0, - color: '#000000', - alpha: 0.7 - }] -} - const components = { Root, Text, @@ -59,7 +49,8 @@ const components = { Input, Post, Notification, - RichContent + RichContent, + Avatar } // "Unrolls" a tree structure of item: { parent: { ...item2, parent: { ...item3, parent: {...} } }} @@ -372,7 +363,7 @@ export const init = (extraRuleset, palette) => { // Normalizing states and variants to always include "normal" const states = { normal: '', ...originalStates } const variants = { normal: '', ...originalVariants } - const innerComponents = validInnerComponents.map(name => components[name]) + const innerComponents = (validInnerComponents).map(name => components[name]) // Optimization: we only really need combinations without "normal" because all states implicitly have it const permutationStateKeys = Object.keys(states).filter(s => s !== 'normal') @@ -448,7 +439,6 @@ export const init = (extraRuleset, palette) => { dynamicVars.inheritedBackground = lowerLevelBackground - // TODO properly provide "parent" text color? const intendedTextColor = convert(findColor(inheritedTextColor, dynamicVars)).rgb const textColor = newTextRule.directives.textAuto === 'no-auto' ? intendedTextColor @@ -495,6 +485,7 @@ export const init = (extraRuleset, palette) => { } else { computed[selector] = computed[selector] || {} + // TODO make background non-mandatory if (computedDirectives.background) { let inheritRule = null const variantRules = ruleset.filter(findRules({ component: component.name, variant: combination.variant, parent }))