Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions apps/stage-web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,15 @@ const cardStore = useAiriCardStore()
const analyticsStore = useSharedAnalyticsStore()
const inferencePreload = useInferencePreload()

const primaryColor = computed(() => {
return isDark.value
? `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${0})) 70%, oklch(50% 0 360))`
: `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${0})) 90%, oklch(90% 0 360))`
})

const secondaryColor = computed(() => {
return isDark.value
? `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${180})) 70%, oklch(50% 0 360))`
: `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${180})) 90%, oklch(90% 0 360))`
})

const tertiaryColor = computed(() => {
return isDark.value
? `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${60})) 70%, oklch(50% 0 360))`
: `color-mix(in srgb, oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + ${60})) 90%, oklch(90% 0 360))`
})
Comment on lines -43 to -59
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const getCSSVar = (variableName: string) => getComputedStyle(document.documentElement).getPropertyValue(variableName).trim()

const colors = computed(() => {
return [primaryColor.value, secondaryColor.value, tertiaryColor.value, isDark.value ? '#121212' : '#FFFFFF']
return [
getCSSVar('--primary-color'),
Comment thread
drHuangMHT marked this conversation as resolved.
getCSSVar('--secondary-color'),
getCSSVar('--tertiary-color'),
Comment thread
drHuangMHT marked this conversation as resolved.
Comment on lines +50 to +52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep transition colors reactive during dynamic hue animation

This computed now snapshots resolved CSS colors via getComputedStyle(...), so it only updates when tracked refs change; however dynamic hue mode animates --chromatic-hue in CSS (.dynamic-hue) without changing settings.themeColorsHue. As a result, when dynamic hue is enabled, transitions use stale sampled colors instead of tracking the live hue animation that the previous color-expression approach provided.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@drHuangMHT drHuangMHT Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who would ever want an interface with flashy RGB effects🤦 does the original code also watch this change? @codex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the css variable returns what's in colors.css as raw value that is not mixed into RGB value, which is static. this is not an issue as long as the variable is used in styles. CSS engine will handle the update automatically.

isDark.value ? '#121212' : '#FFFFFF',
]
})
Comment thread
drHuangMHT marked this conversation as resolved.

const onboardingExtraSteps = computed(() => {
Expand Down Expand Up @@ -119,9 +108,6 @@ function handleSetupSkipped() {

<template>
<StageTransitionGroup
:primary-color="primaryColor"
:secondary-color="secondaryColor"
:tertiary-color="tertiaryColor"
:colors="colors"
:z-index="100"
:disable-transitions="settings.disableTransitions.value"
Expand Down
48 changes: 48 additions & 0 deletions apps/stage-web/src/styles/colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
:root {
/* Light mode defaults */
--chromatic-hue: 0;
--chromatic-chroma-900: 0.15;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is controlled and injected by https://github.com/proj-airi/chromatic. We should not define this here.

--is-dark: 0;

--primary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 0)) 90%,
oklch(90% 0 360)
);

--secondary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 180)) 90%,
oklch(90% 0 360)
);

--tertiary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 60)) 90%,
oklch(90% 0 360)
);
}

@media (prefers-color-scheme: dark) {
:root {
Comment thread
drHuangMHT marked this conversation as resolved.
--is-dark: 1;

--primary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 0)) 70%,
oklch(50% 0 360)
);

--secondary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 180)) 70%,
oklch(50% 0 360)
);

--tertiary-color: color-mix(
in srgb,
oklch(95% var(--chromatic-chroma-900) calc(var(--chromatic-hue) + 60)) 70%,
oklch(50% 0 360)
);
}
}
2 changes: 2 additions & 0 deletions packages/ui-transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"devDependencies": {
"@unocss/reset": "^66.6.8",
"@vitejs/plugin-vue": "^6.0.6",
"@vue/test-utils": "catalog:",
"jsdom": "catalog:",
"vite": "catalog:",
"vite-plugin-vue-devtools": "^8.1.1",
"vue-router": "^5.0.4",
Expand Down
33 changes: 12 additions & 21 deletions packages/ui-transitions/src/components/ArrowTransition.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import type { StageTransitionCommonParams } from '.'

const props = withDefaults(defineProps<{
stageTransition?: {
primaryColor?: string
secondaryColor?: string
zIndex?: number
}
}>(), {
stageTransition: () => ({
primaryColor: '#666',
secondaryColor: '#ccc',
}),
})
import { useCssVariables } from './useCssVar'

const stageTransition = computed(() => props.stageTransition)
const overlayColor1 = computed(() => stageTransition.value.primaryColor || '#666')
const overlayColor2 = computed(() => stageTransition.value.secondaryColor || '#ccc')
const {
primaryColor = '#666',
secondaryColor = '#ccc',
zIndex = 100,
} = defineProps<Omit<StageTransitionCommonParams, 'name'>>()
Comment on lines +6 to +10
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using vue ^3.5.32 according to the catalog, and reactive props destructure is available. not using it?


onMounted(() => {
document.documentElement.style.setProperty('--stage-transition-3-overlay-color-1', overlayColor1.value)
document.documentElement.style.setProperty('--stage-transition-3-overlay-color-2', overlayColor2.value)
})
useCssVariables(() => ({
'overlay-color-1': primaryColor,
'overlay-color-2': secondaryColor,
}), { prefix: '--stage-transition-3-' })
Comment on lines +12 to +15
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve code readability. useCssVariables also handles reactivity when you need it(although not needed in this case).

</script>

<template>
<div class="stage-transition-3" :style="{ zIndex: stageTransition.zIndex || 100 }" />
<div class="stage-transition-3" :style="{ zIndex }" />
</template>

<style scoped>
Expand Down
42 changes: 25 additions & 17 deletions packages/ui-transitions/src/components/BubbleWaveOutTransition.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { useCssVariables } from './useCssVar'

const props = defineProps<{
stageTransition?: {
colors?: string[]
delay?: number
duration?: number
zIndex?: number
}
}>()
interface TransitionParams {
colors?: string[]
delay?: number
duration?: number
zIndex?: number
}

const colors = computed(() => props.stageTransition?.colors || ['#eee', '#ebcb8b', '#c56370', '#3f3b52'])
const {
colors = ['#eee', '#ebcb8b', '#c56370', '#3f3b52'],
delay = 0,
duration = 0.4,
zIndex = 100,
} = defineProps<TransitionParams>()
Comment on lines +11 to +16
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


onMounted(() => {
document.documentElement.style.setProperty('--circle-expansion-delay', `${props.stageTransition?.delay || 0}s`)
document.documentElement.style.setProperty('--circle-expansion-duration', `${props.stageTransition?.duration || 0.4}s`)
colors.value.forEach((color, index) => {
document.documentElement.style.setProperty(`--circle-expansion-color-${index + 1}`, color)
function getCssVar() {
const record: Record<string, string> = {
delay: `${delay}s`,
duration: `${duration}s`,
}
colors.forEach((color, index) => {
record[`color-${index + 1}`] = color
})
})
return record
}

useCssVariables(getCssVar, { prefix: '--circle-expansion-' })
</script>

<template>
<div class="circle-expansion-transition" :style="{ zIndex: stageTransition?.zIndex || 100 }">
<div class="circle-expansion-transition" :style="{ zIndex }">
<div v-for="(_, index) in colors" :key="index" />
</div>
</template>
Expand Down
81 changes: 48 additions & 33 deletions packages/ui-transitions/src/components/FantasyFallTransition.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'

const props = defineProps <{
stageTransition?: {
primaryColor?: string
duration?: number
delay?: number
direction?: 'up' | 'down' | 'left' | 'right'
borderRadius?: {
sm?: string
md?: string
lg?: string
}
zIndex?: number
}
}>()

const direction = computed(() => props.stageTransition?.direction || 'up')
const directionClass = computed(() => `fantasy-fall-${direction.value}`)

onMounted(() => {
document.documentElement.style.setProperty('--fantasy-fall-color', props.stageTransition?.primaryColor || '#eee')
document.documentElement.style.setProperty('--fantasy-fall-duration', `${props.stageTransition?.duration || 0.6}s`)
document.documentElement.style.setProperty('--fantasy-fall-delay', `${props.stageTransition?.delay || 0}s`)
document.documentElement.style.setProperty('--fantasy-fall-radius-sm', `${props.stageTransition?.borderRadius?.sm || '14rem'}`)
document.documentElement.style.setProperty('--fantasy-fall-radius-md', `${props.stageTransition?.borderRadius?.md || '14rem'}`)
document.documentElement.style.setProperty('--fantasy-fall-radius-lg', `${props.stageTransition?.borderRadius?.lg || '50%'}`)
})
import { computed } from 'vue'

import { useCssVariables } from './useCssVar'

interface TransitionParams {
primaryColor?: string
duration?: number
delay?: number
direction?: 'up' | 'down' | 'left' | 'right'
borderRadius?: {
sm?: string
md?: string
lg?: string
}
zIndex?: number
}

const {
direction = 'up',
primaryColor = '#eee',
duration = 0.6,
delay = 0,
borderRadius = { sm: '14rem', md: '14rem', lg: '50%' },
zIndex = 100,
} = defineProps<TransitionParams>()
Comment on lines +19 to +26
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const directionClass = computed(() => `fantasy-fall-${direction}`)

useCssVariables(() => ({
'color': primaryColor,
'duration': `${duration}s`,
'delay': `${delay}s`,
'radius-sm': borderRadius?.sm ?? '14rem',
'radius-md': borderRadius?.md ?? '14rem',
'radius-lg': borderRadius?.lg ?? '50%',
}), { prefix: '--fantasy-fall-' })
</script>

<template>
<div class="fantasy-fall-transition" :class="directionClass" :style="{ zIndex: stageTransition?.zIndex ?? 100 }" />
<div
class="fantasy-fall-transition"
:class="directionClass"
:style="{ zIndex }"
/>
</template>

<style scoped>
Expand All @@ -53,7 +64,8 @@ onMounted(() => {
transform: translateY(-100%);
border-bottom-left-radius: var(--fantasy-fall-radius-sm);
border-bottom-right-radius: var(--fantasy-fall-radius-sm);
animation: fantasy-fall-up var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards;
animation: fantasy-fall-up var(--fantasy-fall-duration) ease-out
var(--fantasy-fall-delay) forwards;
}

/* Bottom direction */
Expand All @@ -69,7 +81,8 @@ onMounted(() => {
transform: translateY(100%);
border-top-left-radius: var(--fantasy-fall-radius-sm);
border-top-right-radius: var(--fantasy-fall-radius-sm);
animation: fantasy-fall-down var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards;
animation: fantasy-fall-down var(--fantasy-fall-duration) ease-out
var(--fantasy-fall-delay) forwards;
}

/* Left direction */
Expand All @@ -85,7 +98,8 @@ onMounted(() => {
transform: translateX(-100%);
border-top-right-radius: var(--fantasy-fall-radius-sm);
border-bottom-right-radius: var(--fantasy-fall-radius-sm);
animation: fantasy-fall-left var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards;
animation: fantasy-fall-left var(--fantasy-fall-duration) ease-out
var(--fantasy-fall-delay) forwards;
}

/* Right direction */
Expand All @@ -101,7 +115,8 @@ onMounted(() => {
transform: translateX(100%);
border-top-left-radius: var(--fantasy-fall-radius-sm);
border-bottom-left-radius: var(--fantasy-fall-radius-sm);
animation: fantasy-fall-right var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards;
animation: fantasy-fall-right var(--fantasy-fall-duration) ease-out
var(--fantasy-fall-delay) forwards;
}

/* Responsive border radius adjustments */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import type { StageTransitionCommonParams } from '..'

const props = defineProps<{
stageTransition?: {
primaryColor?: string
secondaryColor?: string
zIndex?: number
}
}>()
import { useCssVariables } from './useCssVar'

const stageTransition = computed(() => props.stageTransition)
const overlayColor1 = computed(() => stageTransition.value?.primaryColor || '#666')
const overlayColor2 = computed(() => stageTransition.value?.secondaryColor || '#ccc')
const { primaryColor = '#666', secondaryColor = '#ccc', zIndex = 100 }
= defineProps<Omit<StageTransitionCommonParams, 'name'>>()

onMounted(() => {
document.documentElement.style.setProperty('--stage-transition-4-overlay-color-1', overlayColor1.value)
document.documentElement.style.setProperty('--stage-transition-4-overlay-color-2', overlayColor2.value)
})
useCssVariables(() => ({
'overlay-color-1': primaryColor,
'overlay-color-2': secondaryColor,
}), { prefix: '--stage-transition-4-' })
</script>

<template>
<div class="stage-transition-4" :style="{ zIndex: stageTransition?.zIndex ?? 100 }">
<div class="stage-transition-4" :style="{ zIndex }">
<div class="stage-transition-4__block" />
<div class="stage-transition-4__block" />
<div class="stage-transition-4__block" />
Expand Down
Loading