From a7ab1d3297cfbb632a0b6875727902b39bc24d8c Mon Sep 17 00:00:00 2001 From: "S. MohammadMahdi Zamanian" Date: Sun, 22 Sep 2024 12:46:18 +0330 Subject: [PATCH] fix(*): gecut context update --- src/main.ts | 2 +- src/signal/color.context.ts | 6 +++--- src/signal/theme.context.ts | 2 +- src/ui/components/footer.ts | 8 ++++---- src/ui/components/header.ts | 4 ++-- src/ui/router.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main.ts b/src/main.ts index fb46ea6..337ebfc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,3 @@ import 'unfonts.css'; -import './ui/app-index'; +import './ui/app-index.js'; diff --git a/src/signal/color.context.ts b/src/signal/color.context.ts index 8517099..07f87c7 100644 --- a/src/signal/color.context.ts +++ b/src/signal/color.context.ts @@ -13,16 +13,16 @@ const lightness = params.get('l'); export type HSLColor = {hue: string; saturation: string; lightness: string}; export const colorContext = new ContextSignal('color'); -colorContext.setValue({ +colorContext.value = { hue: hue ?? json.get('HTB.HUE', '0'), saturation: saturation ?? json.get('HTB.SATURATION', '0'), lightness: lightness ?? json.get('HTB.LIGHTNESS', '0'), -}); +}; colorContext.subscribe( debounce((color: HSLColor) => { const hex = chroma.hsl(Number(color.hue), Number(color.saturation) / 100, Number(color.lightness) / 100).hex('rgb'); - themeContext.setValue(hex); + themeContext.value = hex; json.set('HTB.HUE', color.hue); json.set('HTB.SATURATION', color.saturation); diff --git a/src/signal/theme.context.ts b/src/signal/theme.context.ts index b7daf53..d25aadd 100644 --- a/src/signal/theme.context.ts +++ b/src/signal/theme.context.ts @@ -12,5 +12,5 @@ themeContext.subscribe((sourceColor) => { document.documentElement.style.setProperty(key, color); } - paletteContext.setValue(themeFromSourceColor(argbFromHex(sourceColor))); + paletteContext.value = themeFromSourceColor(argbFromHex(sourceColor)); }); diff --git a/src/ui/components/footer.ts b/src/ui/components/footer.ts index 36fd72f..0f43070 100644 --- a/src/ui/components/footer.ts +++ b/src/ui/components/footer.ts @@ -10,19 +10,19 @@ import {paletteContext} from '../../signal/palette.context.js'; const colorPickerChange = debounce((event: InputEvent) => { const target = event.target as HTMLInputElement; - const color = colorContext.getValue(); + const color = colorContext.value; - colorContext.setValue({ + colorContext.value = { hue: '0', lightness: '0', saturation: '0', ...color, [target.name]: target.value.toString(), - }); + }; }, 1000 / 60); export function footer() { - const color = colorContext.getValue(); + const color = colorContext.value; return html`