Commit 18dadc7435
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/themerepo/ThemeFilterMenu.vue added +273
| @@ -0,0 +1,273 @@ | ||
| 1 | <script setup lang="ts"> | |
| 2 | import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui' | |
| 3 | import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue' | |
| 4 | import MenuHelp from '../settings/MenuHelp.vue' | |
| 5 | import MenuTitle from '../settings/MenuTitle.vue' | |
| 6 | ||
| 7 | const props = defineProps<{ modelValue: boolean; bigSwatches?: boolean }>() | |
| 8 | const emit = defineEmits<{ | |
| 9 | 'update:modelValue': [value: boolean] | |
| 10 | 'update:big-swatches': [value: boolean] | |
| 11 | }>() | |
| 12 | ||
| 13 | const rootRef = ref<HTMLElement>() | |
| 14 | const btnRef = ref<HTMLElement>() | |
| 15 | const menuRef = ref<HTMLElement>() | |
| 16 | const open = ref(false) | |
| 17 | const menuStyle = ref<Record<string, string>>({}) | |
| 18 | let raf = 0 | |
| 19 | ||
| 20 | function updatePosition() { | |
| 21 | if (!btnRef.value) return | |
| 22 | const viewportMargin = 12 | |
| 23 | const menuWidth = menuRef.value?.offsetWidth ?? 260 | |
| 24 | const btnRect = btnRef.value.getBoundingClientRect() | |
| 25 | const maxLeft = Math.max( | |
| 26 | viewportMargin, | |
| 27 | window.innerWidth - viewportMargin - menuWidth | |
| 28 | ) | |
| 29 | const left = Math.min( | |
| 30 | Math.max(btnRect.right - menuWidth, viewportMargin), | |
| 31 | maxLeft | |
| 32 | ) | |
| 33 | const maxTop = Math.max(viewportMargin, window.innerHeight - viewportMargin) | |
| 34 | const top = Math.min(btnRect.bottom + 6, maxTop) | |
| 35 | menuStyle.value = { top: `${top}px`, left: `${left}px` } | |
| 36 | } | |
| 37 | ||
| 38 | function toggle() { | |
| 39 | open.value = !open.value | |
| 40 | if (open.value) void nextTick(updatePosition) | |
| 41 | } | |
| 42 | ||
| 43 | function onDocClick(e: MouseEvent) { | |
| 44 | const target = e.target as Node | |
| 45 | if ( | |
| 46 | rootRef.value && !rootRef.value.contains(target) && | |
| 47 | menuRef.value && !menuRef.value.contains(target) | |
| 48 | ) { | |
| 49 | open.value = false | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | function onReposition() { | |
| 54 | if (!open.value || raf) return | |
| 55 | raf = requestAnimationFrame(() => { | |
| 56 | raf = 0 | |
| 57 | updatePosition() | |
| 58 | }) | |
| 59 | } | |
| 60 | ||
| 61 | onMounted(() => { | |
| 62 | document.addEventListener('click', onDocClick, true) | |
| 63 | window.addEventListener('resize', onReposition, { passive: true }) | |
| 64 | window.addEventListener('scroll', onReposition, { | |
| 65 | capture: true, | |
| 66 | passive: true | |
| 67 | }) | |
| 68 | }) | |
| 69 | ||
| 70 | onUnmounted(() => { | |
| 71 | document.removeEventListener('click', onDocClick, true) | |
| 72 | window.removeEventListener('resize', onReposition) | |
| 73 | window.removeEventListener('scroll', onReposition, true) | |
| 74 | if (raf) cancelAnimationFrame(raf) | |
| 75 | }) | |
| 76 | ||
| 77 | const menuTitleElementRef = ref<HTMLDivElement>() | |
| 78 | const isMenuHelpPoppedUp = ref(false) | |
| 79 | const bigMenuTitleElementRef = ref<HTMLDivElement>() | |
| 80 | const isBigMenuHelpPoppedUp = ref(false) | |
| 81 | ||
| 82 | const options = [ | |
| 83 | { | |
| 84 | value: 'main', | |
| 85 | title: 'Main', | |
| 86 | ariaLabel: 'Main colors only', | |
| 87 | text: 'MAIN', | |
| 88 | name: 'Swatches' | |
| 89 | }, | |
| 90 | { | |
| 91 | value: 'all', | |
| 92 | title: 'All', | |
| 93 | ariaLabel: 'All colors', | |
| 94 | text: 'ALL', | |
| 95 | name: 'Swatches' | |
| 96 | } | |
| 97 | ] | |
| 98 | ||
| 99 | const bigOptions = [ | |
| 100 | { | |
| 101 | value: 'on', | |
| 102 | title: 'On', | |
| 103 | ariaLabel: 'Big swatches on', | |
| 104 | text: 'ON', | |
| 105 | name: 'BigSwatches' | |
| 106 | }, | |
| 107 | { | |
| 108 | value: 'off', | |
| 109 | title: 'Off', | |
| 110 | ariaLabel: 'Big swatches off', | |
| 111 | text: 'OFF', | |
| 112 | name: 'BigSwatches' | |
| 113 | } | |
| 114 | ] | |
| 115 | ||
| 116 | const swatchMode = computed({ | |
| 117 | get: () => props.modelValue ? 'main' : 'all', | |
| 118 | set: (value: string) => emit('update:modelValue', value === 'main') | |
| 119 | }) | |
| 120 | ||
| 121 | const bigMode = computed({ | |
| 122 | get: () => props.bigSwatches ? 'on' : 'off', | |
| 123 | set: (value: string) => emit('update:big-swatches', value === 'on') | |
| 124 | }) | |
| 125 | </script> | |
| 126 | ||
| 127 | <template> | |
| 128 | <div ref="rootRef" class="theme-settings"> | |
| 129 | <button | |
| 130 | ref="btnRef" | |
| 131 | type="button" | |
| 132 | class="theme-settings-btn" | |
| 133 | aria-haspopup="true" | |
| 134 | :aria-expanded="open" | |
| 135 | aria-label="Filters" | |
| 136 | @click="toggle" | |
| 137 | > | |
| 138 | <span class="i-lucide:settings" /> | |
| 139 | </button> | |
| 140 | ||
| 141 | <Teleport to="body"> | |
| 142 | <div | |
| 143 | v-show="open" | |
| 144 | ref="menuRef" | |
| 145 | class="theme-settings-menu VPMenu" | |
| 146 | :style="menuStyle" | |
| 147 | > | |
| 148 | <div class="theme-filter" role="radiogroup"> | |
| 149 | <div ref="menuTitleElementRef" relative flex items-center mb-2> | |
| 150 | <MenuTitle | |
| 151 | title="Swatches" | |
| 152 | aria-label="Swatches" | |
| 153 | flex="1" | |
| 154 | pr-4 | |
| 155 | > | |
| 156 | <template #icon> | |
| 157 | <span i-lucide:palette mr-1 aria-hidden="true" /> | |
| 158 | </template> | |
| 159 | </MenuTitle> | |
| 160 | <MenuHelp | |
| 161 | v-model:is-popped-up="isMenuHelpPoppedUp" | |
| 162 | :menu-title-element-ref="menuTitleElementRef" | |
| 163 | > | |
| 164 | <h4 text-md mb-1 font-semibold>Swatches</h4> | |
| 165 | <p text="sm" mb-2 max-w-100> | |
| 166 | Show main colors or all the colors | |
| 167 | </p> | |
| 168 | </MenuHelp> | |
| 169 | </div> | |
| 170 | <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md"> | |
| 171 | <NuInputHorizontalRadioGroup | |
| 172 | v-model="swatchMode" | |
| 173 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" | |
| 174 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" | |
| 175 | :options="options" | |
| 176 | /> | |
| 177 | </NuInputHighlight> | |
| 178 | </div> | |
| 179 | <div class="theme-filter" role="radiogroup"> | |
| 180 | <div ref="bigMenuTitleElementRef" relative flex items-center mb-2> | |
| 181 | <MenuTitle | |
| 182 | title="Big swatches" | |
| 183 | aria-label="Big swatches" | |
| 184 | flex="1" | |
| 185 | pr-4 | |
| 186 | > | |
| 187 | <template #icon> | |
| 188 | <span i-lucide:layout-grid mr-1 aria-hidden="true" /> | |
| 189 | </template> | |
| 190 | </MenuTitle> | |
| 191 | <MenuHelp | |
| 192 | v-model:is-popped-up="isBigMenuHelpPoppedUp" | |
| 193 | :menu-title-element-ref="bigMenuTitleElementRef" | |
| 194 | > | |
| 195 | <h4 text-md mb-1 font-semibold>Big swatches</h4> | |
| 196 | <p text="sm" mb-2 max-w-100> | |
| 197 | Shows each color as a larger tile with its hex value underneath. | |
| 198 | </p> | |
| 199 | </MenuHelp> | |
| 200 | </div> | |
| 201 | <NuInputHighlight :active="isBigMenuHelpPoppedUp" class="rounded-md"> | |
| 202 | <NuInputHorizontalRadioGroup | |
| 203 | v-model="bigMode" | |
| 204 | bg="$vp-nolebase-enhanced-readabilities-menu-background-color" | |
| 205 | text="sm $vp-nolebase-enhanced-readabilities-menu-text-color" | |
| 206 | :options="bigOptions" | |
| 207 | /> | |
| 208 | </NuInputHighlight> | |
| 209 | </div> | |
| 210 | </div> | |
| 211 | </Teleport> | |
| 212 | </div> | |
| 213 | </template> | |
| 214 | ||
| 215 | <style scoped> | |
| 216 | .theme-settings { | |
| 217 | position: relative; | |
| 218 | flex-shrink: 0; | |
| 219 | } | |
| 220 | .theme-settings-btn { | |
| 221 | display: flex; | |
| 222 | align-items: center; | |
| 223 | justify-content: center; | |
| 224 | width: 30px; | |
| 225 | height: 30px; | |
| 226 | padding: 0; | |
| 227 | border: none; | |
| 228 | border-radius: 0; | |
| 229 | background: transparent; | |
| 230 | color: var(--vp-c-text-1); | |
| 231 | opacity: 0.55; | |
| 232 | cursor: pointer; | |
| 233 | transition: opacity 0.25s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); | |
| 234 | } | |
| 235 | .theme-settings-btn:hover, | |
| 236 | .theme-settings-btn[aria-expanded="true"] { | |
| 237 | color: var(--vp-c-text-1); | |
| 238 | opacity: 1; | |
| 239 | background: transparent; | |
| 240 | } | |
| 241 | .theme-settings-btn:active { | |
| 242 | transform: scale(0.94); | |
| 243 | } | |
| 244 | .theme-settings-btn span { | |
| 245 | font-size: 15px; | |
| 246 | } | |
| 247 | html.effects-disabled .theme-settings-btn { | |
| 248 | transition: none; | |
| 249 | } | |
| 250 | html.effects-disabled .theme-settings-btn:active { | |
| 251 | transform: none; | |
| 252 | } | |
| 253 | .theme-settings-menu { | |
| 254 | --vp-nolebase-enhanced-readabilities-menu-background-color: var( | |
| 255 | --wk-c-menu-bg | |
| 256 | ); | |
| 257 | --vp-nolebase-enhanced-readabilities-menu-text-color: var(--vp-c-text-1); | |
| 258 | position: fixed; | |
| 259 | z-index: 100; | |
| 260 | width: 260px; | |
| 261 | max-width: calc(100vw - 24px); | |
| 262 | max-height: calc(100vh - 24px); | |
| 263 | overflow-y: auto; | |
| 264 | padding: 12px; | |
| 265 | border-radius: 12px; | |
| 266 | border: 1px solid var(--vp-c-divider); | |
| 267 | background-color: var(--vp-c-bg-elv); | |
| 268 | box-shadow: var(--vp-shadow-3, 0 4px 16px rgba(0, 0, 0, 0.3)); | |
| 269 | } | |
| 270 | .theme-settings-menu > * + * { | |
| 271 | margin-top: 14px; | |
| 272 | } | |
| 273 | </style> | |
docs/.vitepress/theme/components/themerepo/ThemeRepos.vue +385 −36
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | import { useMediaQuery } from '@vueuse/core' | |
| 3 | import { computed, onMounted, ref } from 'vue' | |
| 2 | import { refDebounced, useMediaQuery } from '@vueuse/core' | |
| 3 | import { computed, onMounted, onUnmounted, ref } from 'vue' | |
| 4 | 4 | import { |
| 5 | 5 | DEFAULT_THEME, |
| 6 | 6 | resolveThemeColors |
| @@ -9,7 +9,9 @@ import type { | ||
| 9 | 9 | ManaTheme, |
| 10 | 10 | ThemeRepoEntry |
| 11 | 11 | } from '../../../../ext/themeRepos/types' |
| 12 | import { SEARCH_DEBOUNCE_MS, STATUS_TICK_MS } from '../extrepo/constants' | |
| 12 | 13 | import { screens } from './screens' |
| 14 | import ThemeFilterMenu from './ThemeFilterMenu.vue' | |
| 13 | 15 | import ThemePreview from './ThemePreview.vue' |
| 14 | 16 | import ThemeRow from './ThemeRow.vue' |
| 15 | 17 | |
| @@ -22,6 +24,7 @@ type ThemeFile = { | ||
| 22 | 24 | theme?: { name?: string; colors?: { values?: Record<string, string> } } |
| 23 | 25 | } |
| 24 | 26 | type LoadedTheme = ManaTheme & { raw: string } |
| 27 | type ThemeGroup = { author: string; themes: LoadedTheme[] } | |
| 25 | 28 | |
| 26 | 29 | const props = withDefaults(defineProps<{ themes?: ThemeRepoEntry[] }>(), { |
| 27 | 30 | themes: () => [] |
| @@ -40,24 +43,92 @@ const previewTheme = computed( | ||
| 40 | 43 | DEFAULT_THEME |
| 41 | 44 | ) |
| 42 | 45 | const screen = computed(() => screens[screenIndex.value] ?? screens[0]) |
| 46 | const groups = computed<ThemeGroup[]>(() => { | |
| 47 | const byAuthor = new Map<string, LoadedTheme[]>() | |
| 48 | for (const theme of themes.value) { | |
| 49 | const author = theme.author?.trim() || 'Unknown' | |
| 50 | const list = byAuthor.get(author) | |
| 51 | if (list) list.push(theme) | |
| 52 | else byAuthor.set(author, [theme]) | |
| 53 | } | |
| 54 | return [...byAuthor.entries()] | |
| 55 | .map(([author, list]) => ({ | |
| 56 | author, | |
| 57 | themes: [...list].sort((a, b) => a.name.localeCompare(b.name)) | |
| 58 | })) | |
| 59 | .sort((a, b) => a.author.localeCompare(b.author)) | |
| 60 | }) | |
| 61 | ||
| 62 | const openGroups = ref<Set<string>>(new Set()) | |
| 63 | const knownAuthors = new Set<string>() | |
| 64 | const query = ref('') | |
| 65 | const debouncedQuery = refDebounced(query, SEARCH_DEBOUNCE_MS) | |
| 66 | const mainColorsOnly = ref(true) | |
| 67 | const bigSwatches = ref(true) | |
| 68 | ||
| 69 | const isSearching = computed(() => debouncedQuery.value.trim().length > 0) | |
| 70 | const filteredGroups = computed<ThemeGroup[]>(() => { | |
| 71 | const q = debouncedQuery.value.trim().toLowerCase() | |
| 72 | if (!q) return groups.value | |
| 73 | return groups.value | |
| 74 | .map(group => ({ | |
| 75 | author: group.author, | |
| 76 | themes: group.themes.filter(theme => | |
| 77 | theme.name.toLowerCase().includes(q) || | |
| 78 | group.author.toLowerCase().includes(q) | |
| 79 | ) | |
| 80 | })) | |
| 81 | .filter(group => group.themes.length > 0) | |
| 82 | }) | |
| 83 | const searchPlaceholder = computed(() => | |
| 84 | themes.value.length | |
| 85 | ? `Search themes (${themes.value.length})…` | |
| 86 | : 'Search themes…' | |
| 87 | ) | |
| 88 | ||
| 89 | function toggleGroup(author: string): void { | |
| 90 | const next = new Set(openGroups.value) | |
| 91 | if (next.has(author)) next.delete(author) | |
| 92 | else next.add(author) | |
| 93 | openGroups.value = next | |
| 94 | } | |
| 43 | 95 | |
| 44 | async function fetchJson<T>(url: string): Promise<T> { | |
| 45 | const res = await fetch(url) | |
| 96 | function isGroupOpen(author: string): boolean { | |
| 97 | return isSearching.value || openGroups.value.has(author) | |
| 98 | } | |
| 99 | ||
| 100 | function applyThemes(list: LoadedTheme[]): void { | |
| 101 | themes.value = list | |
| 102 | const next = new Set(openGroups.value) | |
| 103 | for (const group of groups.value) { | |
| 104 | if (!knownAuthors.has(group.author)) { | |
| 105 | knownAuthors.add(group.author) | |
| 106 | next.add(group.author) | |
| 107 | } | |
| 108 | } | |
| 109 | openGroups.value = next | |
| 110 | } | |
| 111 | ||
| 112 | async function fetchJson<T>(url: string, noCache = false): Promise<T> { | |
| 113 | const res = await fetch(url, noCache ? { cache: 'no-cache' } : undefined) | |
| 46 | 114 | if (!res.ok) throw new Error(`${res.status} ${res.statusText}`) |
| 47 | 115 | return res.json() |
| 48 | 116 | } |
| 49 | 117 | |
| 50 | async function loadRepo(entry: ThemeRepoEntry): Promise<LoadedTheme[]> { | |
| 118 | async function loadRepo( | |
| 119 | entry: ThemeRepoEntry, | |
| 120 | noCache = false | |
| 121 | ): Promise<LoadedTheme[]> { | |
| 51 | 122 | if (!entry.raw) return [] |
| 52 | 123 | |
| 53 | const index = await fetchJson<{ themes?: ThemeIndexEntry[] }>(entry.raw) | |
| 54 | const loaded = await Promise.all( | |
| 124 | const index = await fetchJson<{ themes?: ThemeIndexEntry[] }>(entry.raw, true) | |
| 125 | const results = await Promise.allSettled( | |
| 55 | 126 | (index.themes ?? []) |
| 56 | 127 | .filter((item): item is ThemeIndexEntry & { url: string } => |
| 57 | 128 | Boolean(item.url) |
| 58 | 129 | ) |
| 59 | 130 | .map(async item => { |
| 60 | const file = await fetchJson<ThemeFile>(item.url) | |
| 131 | const file = await fetchJson<ThemeFile>(item.url, noCache) | |
| 61 | 132 | const values = file.theme?.colors?.values |
| 62 | 133 | const name = item.name ?? file.theme?.name |
| 63 | 134 | return values && name |
| @@ -73,27 +144,106 @@ async function loadRepo(entry: ThemeRepoEntry): Promise<LoadedTheme[]> { | ||
| 73 | 144 | }) |
| 74 | 145 | ) |
| 75 | 146 | |
| 76 | return loaded.filter((theme): theme is LoadedTheme => theme !== null) | |
| 147 | return results | |
| 148 | .map(result => result.status === 'fulfilled' ? result.value : null) | |
| 149 | .filter((theme): theme is LoadedTheme => theme !== null) | |
| 77 | 150 | } |
| 78 | 151 | |
| 79 | onMounted(async () => { | |
| 80 | if (props.themes.length === 0) return | |
| 81 | ||
| 82 | loading.value = true | |
| 83 | const results = await Promise.allSettled(props.themes.map(loadRepo)) | |
| 152 | async function fetchThemes(noCache = false): Promise<{ | |
| 153 | themes: LoadedTheme[] | |
| 154 | failed: boolean | |
| 155 | }> { | |
| 156 | const results = await Promise.allSettled( | |
| 157 | props.themes.map(entry => loadRepo(entry, noCache)) | |
| 158 | ) | |
| 84 | 159 | const unique = new Map<string, LoadedTheme>() |
| 85 | 160 | for ( |
| 86 | 161 | const theme of results.flatMap(r => r.status === 'fulfilled' ? r.value : []) |
| 87 | 162 | ) { |
| 88 | 163 | unique.set(theme.raw, theme) |
| 89 | 164 | } |
| 90 | themes.value = [...unique.values()].sort((a, b) => | |
| 91 | a.name.localeCompare(b.name) | |
| 92 | ) | |
| 93 | loadFailed.value = results.some(r => r.status === 'rejected') | |
| 94 | loading.value = false | |
| 165 | return { | |
| 166 | themes: [...unique.values()].sort((a, b) => a.name.localeCompare(b.name)), | |
| 167 | failed: results.some(r => r.status === 'rejected') | |
| 168 | } | |
| 169 | } | |
| 170 | ||
| 171 | async function load(): Promise<void> { | |
| 172 | if (props.themes.length === 0) return | |
| 173 | ||
| 174 | loadFailed.value = false | |
| 175 | try { | |
| 176 | const result = await fetchThemes() | |
| 177 | applyThemes(result.themes) | |
| 178 | loadFailed.value = result.failed | |
| 179 | } finally { | |
| 180 | loading.value = false | |
| 181 | } | |
| 182 | } | |
| 183 | ||
| 184 | const refreshing = ref(false) | |
| 185 | const refreshFailed = ref(false) | |
| 186 | const ticked = ref(false) | |
| 187 | let tickTimer: ReturnType<typeof setTimeout> | undefined | |
| 188 | ||
| 189 | onUnmounted(() => { | |
| 190 | if (tickTimer) clearTimeout(tickTimer) | |
| 191 | }) | |
| 192 | ||
| 193 | async function refresh(): Promise<void> { | |
| 194 | if (refreshing.value) return | |
| 195 | ||
| 196 | refreshing.value = true | |
| 197 | refreshFailed.value = false | |
| 198 | try { | |
| 199 | const result = await fetchThemes(true) | |
| 200 | if (result.failed || result.themes.length === 0) { | |
| 201 | refreshFailed.value = true | |
| 202 | return | |
| 203 | } | |
| 204 | applyThemes(result.themes) | |
| 205 | } finally { | |
| 206 | refreshing.value = false | |
| 207 | } | |
| 208 | } | |
| 209 | ||
| 210 | const busy = computed(() => loading.value || refreshing.value) | |
| 211 | const failed = computed(() => loadFailed.value || refreshFailed.value) | |
| 212 | const statusIcon = computed(() => { | |
| 213 | if (busy.value) return 'i-lucide:loader-circle' | |
| 214 | if (failed.value) return 'i-lucide:x' | |
| 215 | if (ticked.value) return 'i-lucide:check' | |
| 216 | return 'i-lucide:refresh-cw' | |
| 217 | }) | |
| 218 | const statusTitle = computed(() => { | |
| 219 | if (loading.value) return 'Loading themes…' | |
| 220 | if (refreshing.value) return 'Refreshing themes…' | |
| 221 | if (failed.value) return 'Loading failed — click to retry' | |
| 222 | if (ticked.value) return 'Themes refreshed' | |
| 223 | return 'Refresh themes' | |
| 95 | 224 | }) |
| 96 | 225 | |
| 226 | async function onStatusClick(): Promise<void> { | |
| 227 | if (busy.value) return | |
| 228 | if (loadFailed.value) { | |
| 229 | loading.value = true | |
| 230 | await load() | |
| 231 | return | |
| 232 | } | |
| 233 | ||
| 234 | ticked.value = false | |
| 235 | if (tickTimer) clearTimeout(tickTimer) | |
| 236 | await refresh() | |
| 237 | if (!refreshFailed.value) { | |
| 238 | ticked.value = true | |
| 239 | tickTimer = setTimeout(() => { | |
| 240 | ticked.value = false | |
| 241 | }, STATUS_TICK_MS) | |
| 242 | } | |
| 243 | } | |
| 244 | ||
| 245 | onMounted(load) | |
| 246 | ||
| 97 | 247 | function showScreen(delta: number): void { |
| 98 | 248 | screenIndex.value = (screenIndex.value + delta + screens.length) % |
| 99 | 249 | screens.length |
| @@ -106,6 +256,33 @@ function toggleTheme(theme: LoadedTheme): void { | ||
| 106 | 256 | |
| 107 | 257 | <template> |
| 108 | 258 | <div class="theme-repos"> |
| 259 | <div class="theme-toolbar"> | |
| 260 | <div class="theme-search"> | |
| 261 | <span class="i-lucide:search" /> | |
| 262 | <input v-model="query" type="text" :placeholder="searchPlaceholder" /> | |
| 263 | </div> | |
| 264 | <button | |
| 265 | type="button" | |
| 266 | class="theme-status-btn" | |
| 267 | :class="{ | |
| 268 | spinning: busy, | |
| 269 | 'is-failed': !busy && failed, | |
| 270 | 'is-ok': !busy && !failed && ticked | |
| 271 | }" | |
| 272 | :disabled="busy" | |
| 273 | :title="statusTitle" | |
| 274 | aria-label="Reload theme data" | |
| 275 | @click="onStatusClick" | |
| 276 | > | |
| 277 | <span :class="statusIcon" /> | |
| 278 | </button> | |
| 279 | <ThemeFilterMenu | |
| 280 | v-model="mainColorsOnly" | |
| 281 | :big-swatches="bigSwatches" | |
| 282 | @update:big-swatches="bigSwatches = $event" | |
| 283 | /> | |
| 284 | </div> | |
| 285 | ||
| 109 | 286 | <div v-if="themes.length" class="theme-showcase"> |
| 110 | 287 | <div class="theme-stage"> |
| 111 | 288 | <ThemePreview |
| @@ -121,24 +298,60 @@ function toggleTheme(theme: LoadedTheme): void { | ||
| 121 | 298 | class="theme-list" |
| 122 | 299 | :class="{ 'theme-list-open': isPhone && selectedKey }" |
| 123 | 300 | > |
| 124 | <template v-for="theme in themes" :key="theme.raw"> | |
| 125 | <ThemeRow | |
| 126 | :theme="theme" | |
| 127 | :selected="theme.raw === selectedKey" | |
| 128 | @select="toggleTheme(theme)" | |
| 129 | /> | |
| 130 | <div | |
| 131 | v-if="isPhone && theme.raw === selectedKey" | |
| 132 | class="theme-dropdown" | |
| 301 | <p | |
| 302 | v-if="isSearching && filteredGroups.length === 0" | |
| 303 | class="theme-repos-empty" | |
| 304 | > | |
| 305 | No themes match your search. | |
| 306 | </p> | |
| 307 | <div | |
| 308 | v-for="group in filteredGroups" | |
| 309 | :key="group.author" | |
| 310 | class="theme-group" | |
| 311 | > | |
| 312 | <button | |
| 313 | type="button" | |
| 314 | class="theme-group-row" | |
| 315 | :aria-expanded="isGroupOpen(group.author)" | |
| 316 | @click="toggleGroup(group.author)" | |
| 133 | 317 | > |
| 134 | <ThemePreview | |
| 135 | :theme="theme" | |
| 136 | :screen="screen" | |
| 137 | @prev="showScreen(-1)" | |
| 138 | @next="showScreen(1)" | |
| 318 | <span class="theme-group-title"> | |
| 319 | <span class="theme-group-name">{{ group.author }}</span> | |
| 320 | <span | |
| 321 | class="theme-group-count" | |
| 322 | :title="`${group.themes.length} theme${ | |
| 323 | group.themes.length === 1 ? '' : 's' | |
| 324 | }`" | |
| 325 | >{{ group.themes.length }}</span> | |
| 326 | </span> | |
| 327 | <span | |
| 328 | class="theme-group-toggle i-lucide:chevron-down" | |
| 329 | :class="{ open: isGroupOpen(group.author) }" | |
| 139 | 330 | /> |
| 140 | </div> | |
| 141 | </template> | |
| 331 | </button> | |
| 332 | <template v-if="isGroupOpen(group.author)"> | |
| 333 | <template v-for="theme in group.themes" :key="theme.raw"> | |
| 334 | <ThemeRow | |
| 335 | :theme="theme" | |
| 336 | :selected="theme.raw === selectedKey" | |
| 337 | :main-only="mainColorsOnly" | |
| 338 | :big-swatches="bigSwatches" | |
| 339 | @select="toggleTheme(theme)" | |
| 340 | /> | |
| 341 | <div | |
| 342 | v-if="isPhone && theme.raw === selectedKey" | |
| 343 | class="theme-dropdown" | |
| 344 | > | |
| 345 | <ThemePreview | |
| 346 | :theme="theme" | |
| 347 | :screen="screen" | |
| 348 | @prev="showScreen(-1)" | |
| 349 | @next="showScreen(1)" | |
| 350 | /> | |
| 351 | </div> | |
| 352 | </template> | |
| 353 | </template> | |
| 354 | </div> | |
| 142 | 355 | </div> |
| 143 | 356 | </div> |
| 144 | 357 | </div> |
| @@ -158,6 +371,83 @@ function toggleTheme(theme: LoadedTheme): void { | ||
| 158 | 371 | border-radius: var(--radius-xl, 12px); |
| 159 | 372 | overflow: hidden; |
| 160 | 373 | } |
| 374 | .theme-toolbar { | |
| 375 | display: flex; | |
| 376 | flex-wrap: nowrap; | |
| 377 | align-items: center; | |
| 378 | gap: 8px; | |
| 379 | padding: 10px; | |
| 380 | background-color: var(--vp-c-bg-soft); | |
| 381 | border-bottom: 1px solid var(--vp-c-divider); | |
| 382 | } | |
| 383 | .theme-search { | |
| 384 | display: flex; | |
| 385 | align-items: center; | |
| 386 | gap: 6px; | |
| 387 | flex: 1 1 auto; | |
| 388 | min-width: 0; | |
| 389 | padding: 6px 10px; | |
| 390 | border-radius: 8px; | |
| 391 | border: 1px solid var(--vp-c-divider); | |
| 392 | background-color: var(--vp-c-bg); | |
| 393 | color: var(--vp-c-text-2); | |
| 394 | } | |
| 395 | .theme-search input { | |
| 396 | flex: 1; | |
| 397 | min-width: 0; | |
| 398 | border: none; | |
| 399 | outline: none; | |
| 400 | background: transparent; | |
| 401 | color: var(--vp-c-text-1); | |
| 402 | font-size: 13px; | |
| 403 | } | |
| 404 | .theme-search > span { | |
| 405 | flex-shrink: 0; | |
| 406 | } | |
| 407 | .theme-status-btn { | |
| 408 | display: flex; | |
| 409 | align-items: center; | |
| 410 | justify-content: center; | |
| 411 | flex-shrink: 0; | |
| 412 | width: 30px; | |
| 413 | height: 30px; | |
| 414 | padding: 0; | |
| 415 | border: none; | |
| 416 | border-radius: 0; | |
| 417 | background: transparent; | |
| 418 | color: var(--vp-c-text-1); | |
| 419 | opacity: 0.55; | |
| 420 | cursor: pointer; | |
| 421 | transition: opacity 0.25s; | |
| 422 | } | |
| 423 | .theme-status-btn:hover:not(:disabled) { | |
| 424 | opacity: 1; | |
| 425 | } | |
| 426 | .theme-status-btn:disabled { | |
| 427 | cursor: default; | |
| 428 | } | |
| 429 | .theme-status-btn span { | |
| 430 | font-size: 15px; | |
| 431 | } | |
| 432 | .theme-status-btn.spinning span { | |
| 433 | animation: theme-spin 1s linear infinite; | |
| 434 | } | |
| 435 | .theme-status-btn.is-failed { | |
| 436 | color: var(--vp-c-red-2, #e5484d); | |
| 437 | opacity: 1; | |
| 438 | } | |
| 439 | .theme-status-btn.is-ok { | |
| 440 | color: var(--vp-c-green-1, #3dd68c); | |
| 441 | opacity: 1; | |
| 442 | } | |
| 443 | @keyframes theme-spin { | |
| 444 | to { | |
| 445 | transform: rotate(360deg); | |
| 446 | } | |
| 447 | } | |
| 448 | html.effects-disabled .theme-status-btn.spinning span { | |
| 449 | animation: none; | |
| 450 | } | |
| 161 | 451 | .theme-showcase { |
| 162 | 452 | display: grid; |
| 163 | 453 | grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1.18fr); |
| @@ -186,7 +476,66 @@ function toggleTheme(theme: LoadedTheme): void { | ||
| 186 | 476 | justify-content: flex-start; |
| 187 | 477 | overflow-y: auto; |
| 188 | 478 | } |
| 189 | .theme-list > .theme-row:not(:first-child) { | |
| 479 | .theme-group + .theme-group { | |
| 480 | border-top: 1px solid var(--vp-c-divider); | |
| 481 | } | |
| 482 | .theme-group-row { | |
| 483 | display: flex; | |
| 484 | align-items: center; | |
| 485 | justify-content: space-between; | |
| 486 | gap: 12px; | |
| 487 | width: 100%; | |
| 488 | padding: 10px 14px; | |
| 489 | border: none; | |
| 490 | background-color: var(--vp-c-bg-soft); | |
| 491 | color: var(--vp-c-text-1); | |
| 492 | font: inherit; | |
| 493 | text-align: left; | |
| 494 | cursor: pointer; | |
| 495 | } | |
| 496 | .theme-group-title { | |
| 497 | display: flex; | |
| 498 | align-items: center; | |
| 499 | gap: 8px; | |
| 500 | min-width: 0; | |
| 501 | } | |
| 502 | .theme-group-name { | |
| 503 | min-width: 0; | |
| 504 | font-size: 14px; | |
| 505 | font-weight: 600; | |
| 506 | color: var(--vp-c-text-1); | |
| 507 | white-space: nowrap; | |
| 508 | overflow: hidden; | |
| 509 | text-overflow: ellipsis; | |
| 510 | } | |
| 511 | .theme-group-toggle { | |
| 512 | color: var(--vp-c-text-1); | |
| 513 | font-size: 18px; | |
| 514 | transition: color 0.2s, transform 0.2s; | |
| 515 | } | |
| 516 | .theme-group-row:hover .theme-group-toggle { | |
| 517 | color: var(--vp-c-brand-1); | |
| 518 | } | |
| 519 | .theme-group-toggle.open { | |
| 520 | transform: rotate(180deg); | |
| 521 | } | |
| 522 | .theme-group-count { | |
| 523 | display: inline-flex; | |
| 524 | align-items: center; | |
| 525 | justify-content: center; | |
| 526 | min-width: 20px; | |
| 527 | padding: 1px 6px; | |
| 528 | border-radius: 6px; | |
| 529 | border: 1px solid var(--vp-c-divider); | |
| 530 | background-color: var(--vp-c-bg); | |
| 531 | color: var(--vp-c-text-2); | |
| 532 | font-size: 11px; | |
| 533 | font-weight: 600; | |
| 534 | line-height: 16px; | |
| 535 | font-variant-numeric: tabular-nums; | |
| 536 | flex-shrink: 0; | |
| 537 | } | |
| 538 | .theme-group .theme-row + .theme-row { | |
| 190 | 539 | border-top: 1px solid var(--vp-c-divider); |
| 191 | 540 | } |
| 192 | 541 | .theme-dropdown { |
docs/.vitepress/theme/components/themerepo/ThemeRow.vue +123 −117
| @@ -1,9 +1,18 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed } from 'vue' |
| 3 | import { IDENTITY_COLORS } from '../../../../ext/themeRepos/defaults' | |
| 3 | 4 | import type { ManaTheme } from '../../../../ext/themeRepos/types' |
| 4 | 5 | import { useCopy } from '../extrepo/useCopy' |
| 5 | 6 | |
| 6 | const props = defineProps<{ theme: ManaTheme; selected: boolean }>() | |
| 7 | const props = withDefaults( | |
| 8 | defineProps<{ | |
| 9 | theme: ManaTheme | |
| 10 | selected: boolean | |
| 11 | mainOnly?: boolean | |
| 12 | bigSwatches?: boolean | |
| 13 | }>(), | |
| 14 | { mainOnly: false, bigSwatches: false } | |
| 15 | ) | |
| 7 | 16 | defineEmits<{ select: [] }>() |
| 8 | 17 | |
| 9 | 18 | const { copiedKey, copy } = useCopy() |
| @@ -14,38 +23,49 @@ const addThemeLink = computed(() => | ||
| 14 | 23 | : undefined |
| 15 | 24 | ) |
| 16 | 25 | |
| 17 | const swatches = computed(() => | |
| 18 | Object.entries(props.theme.colors) | |
| 26 | function formatColor(color: string): string { | |
| 27 | return /^#[0-9a-f]{6}ff$/i.test(color) ? color.slice(0, 7) : color | |
| 28 | } | |
| 29 | ||
| 30 | const swatches = computed(() => { | |
| 31 | const colors = props.theme.colors | |
| 32 | if (props.mainOnly) { | |
| 33 | return IDENTITY_COLORS | |
| 34 | .filter(key => colors[key]) | |
| 35 | .map(key => ({ key, color: formatColor(colors[key]) })) | |
| 36 | } | |
| 37 | return Object.entries(colors) | |
| 19 | 38 | .sort(([a], [b]) => a.localeCompare(b)) |
| 20 | .map(([key, color]) => ({ key, color })) | |
| 21 | ) | |
| 39 | .map(([key, color]) => ({ key, color: formatColor(color) })) | |
| 40 | }) | |
| 22 | 41 | </script> |
| 23 | 42 | |
| 24 | 43 | <template> |
| 25 | 44 | <div |
| 26 | 45 | class="theme-row" |
| 27 | 46 | :class="{ 'theme-row-selected': selected }" |
| 47 | role="button" | |
| 48 | tabindex="0" | |
| 49 | :aria-pressed="selected" | |
| 28 | 50 | @click="$emit('select')" |
| 51 | @keydown.enter.self.prevent="$emit('select')" | |
| 52 | @keydown.space.self.prevent="$emit('select')" | |
| 29 | 53 | > |
| 30 | 54 | <div class="theme-row-body"> |
| 31 | <div class="theme-row-text"> | |
| 32 | <button | |
| 33 | type="button" | |
| 34 | class="theme-row-name" | |
| 35 | :aria-pressed="selected" | |
| 36 | :title="selected | |
| 37 | ? 'Show default preview' | |
| 38 | : `Preview ${theme.name}`" | |
| 39 | > | |
| 40 | {{ theme.name }} | |
| 41 | </button> | |
| 42 | <span v-if="theme.author" class="theme-row-author"> | |
| 43 | {{ theme.author }} | |
| 44 | </span> | |
| 45 | </div> | |
| 55 | <button | |
| 56 | type="button" | |
| 57 | class="theme-row-name" | |
| 58 | :aria-pressed="selected" | |
| 59 | :title="selected | |
| 60 | ? 'Show default preview' | |
| 61 | : `Preview ${theme.name}`" | |
| 62 | > | |
| 63 | {{ theme.name }} | |
| 64 | </button> | |
| 46 | 65 | <button |
| 47 | 66 | type="button" |
| 48 | 67 | class="theme-shades" |
| 68 | :class="{ 'theme-shades-big': bigSwatches }" | |
| 49 | 69 | :aria-pressed="selected" |
| 50 | 70 | :aria-label="`Preview ${theme.name}`" |
| 51 | 71 | > |
| @@ -53,43 +73,60 @@ const swatches = computed(() => | ||
| 53 | 73 | v-for="swatch in swatches" |
| 54 | 74 | :key="swatch.key" |
| 55 | 75 | class="theme-shade" |
| 56 | :style="{ backgroundColor: swatch.color }" | |
| 76 | :class="{ 'theme-shade-big': bigSwatches }" | |
| 77 | :style="bigSwatches | |
| 78 | ? undefined | |
| 79 | : { backgroundColor: swatch.color }" | |
| 57 | 80 | :title="`${swatch.key}: ${swatch.color}`" |
| 58 | /> | |
| 81 | > | |
| 82 | <template v-if="bigSwatches"> | |
| 83 | <span | |
| 84 | class="theme-shade-fill" | |
| 85 | :style="{ backgroundColor: swatch.color }" | |
| 86 | /> | |
| 87 | <span class="theme-shade-hex">{{ | |
| 88 | swatch.color.replace('#', '') | |
| 89 | }}</span> | |
| 90 | </template> | |
| 91 | </span> | |
| 59 | 92 | </button> |
| 60 | 93 | </div> |
| 61 | 94 | |
| 62 | <a | |
| 63 | v-if="addThemeLink" | |
| 64 | class="theme-install" | |
| 65 | :href="addThemeLink" | |
| 66 | :aria-label="`Add ${theme.name} to Mana`" | |
| 67 | :title="`Add ${theme.name} to Mana`" | |
| 68 | @click.stop | |
| 69 | > | |
| 70 | <span class="theme-install-icon i-lucide:download" /> | |
| 71 | <span class="theme-install-label">Install</span> | |
| 72 | </a> | |
| 95 | <div class="theme-row-actions"> | |
| 96 | <a | |
| 97 | v-if="addThemeLink" | |
| 98 | class="ext-btn ext-btn-install" | |
| 99 | :href="addThemeLink" | |
| 100 | :aria-label="`Add ${theme.name} to Mana`" | |
| 101 | :title="`Add ${theme.name} to Mana`" | |
| 102 | @click.stop | |
| 103 | > | |
| 104 | <span class="i-lucide:download" /> | |
| 105 | <span class="ext-btn-install-label">Install</span> | |
| 106 | </a> | |
| 73 | 107 | |
| 74 | <button | |
| 75 | v-if="theme.raw" | |
| 76 | type="button" | |
| 77 | class="theme-copy" | |
| 78 | :class="{ 'theme-copy-done': copiedKey === theme.raw }" | |
| 79 | :aria-label="copiedKey === theme.raw | |
| 80 | ? `Copied ${theme.name} URL` | |
| 81 | : `Copy ${theme.name} URL`" | |
| 82 | :title="copiedKey === theme.raw | |
| 83 | ? 'Copied!' | |
| 84 | : `Copy ${theme.name} JSON URL`" | |
| 85 | @click.stop="copy(theme.raw, theme.raw)" | |
| 86 | > | |
| 87 | <span v-if="copiedKey === theme.raw" class="i-lucide:check" /> | |
| 88 | <span v-else class="i-lucide:copy" /> | |
| 89 | </button> | |
| 108 | <button | |
| 109 | v-if="theme.raw" | |
| 110 | type="button" | |
| 111 | class="ext-btn ext-btn-copy" | |
| 112 | :class="{ 'theme-copy-done': copiedKey === theme.raw }" | |
| 113 | :aria-label="copiedKey === theme.raw | |
| 114 | ? `Copied ${theme.name} URL` | |
| 115 | : `Copy ${theme.name} URL`" | |
| 116 | :title="copiedKey === theme.raw | |
| 117 | ? 'Copied!' | |
| 118 | : `Copy ${theme.name} JSON URL`" | |
| 119 | @click.stop="copy(theme.raw, theme.raw)" | |
| 120 | > | |
| 121 | <span v-if="copiedKey === theme.raw" class="i-lucide:check" /> | |
| 122 | <span v-else class="i-lucide:copy" /> | |
| 123 | </button> | |
| 124 | </div> | |
| 90 | 125 | </div> |
| 91 | 126 | </template> |
| 92 | 127 | |
| 128 | <style scoped src="../extrepo/repoRowShared.css"></style> | |
| 129 | ||
| 93 | 130 | <style scoped> |
| 94 | 131 | .theme-row { |
| 95 | 132 | display: flex; |
| @@ -103,6 +140,10 @@ const swatches = computed(() => | ||
| 103 | 140 | .theme-row:hover { |
| 104 | 141 | background-color: var(--vp-c-bg-soft); |
| 105 | 142 | } |
| 143 | .theme-row:focus-visible { | |
| 144 | outline: 2px solid var(--vp-c-brand-1); | |
| 145 | outline-offset: -2px; | |
| 146 | } | |
| 106 | 147 | .theme-row-selected { |
| 107 | 148 | border-left-color: var(--vp-c-brand-1); |
| 108 | 149 | background-color: var(--vp-c-bg-soft); |
| @@ -114,11 +155,11 @@ const swatches = computed(() => | ||
| 114 | 155 | flex-direction: column; |
| 115 | 156 | gap: 6px; |
| 116 | 157 | } |
| 117 | .theme-row-text { | |
| 118 | min-width: 0; | |
| 158 | .theme-row-actions { | |
| 119 | 159 | display: flex; |
| 120 | flex-direction: column; | |
| 121 | gap: 1px; | |
| 160 | align-items: center; | |
| 161 | gap: 6px; | |
| 162 | flex-shrink: 0; | |
| 122 | 163 | } |
| 123 | 164 | .theme-row-name { |
| 124 | 165 | min-width: 0; |
| @@ -136,14 +177,6 @@ const swatches = computed(() => | ||
| 136 | 177 | text-overflow: ellipsis; |
| 137 | 178 | cursor: pointer; |
| 138 | 179 | } |
| 139 | .theme-row-author { | |
| 140 | font-size: 12px; | |
| 141 | line-height: 1.3; | |
| 142 | color: var(--vp-c-text-3); | |
| 143 | white-space: nowrap; | |
| 144 | overflow: hidden; | |
| 145 | text-overflow: ellipsis; | |
| 146 | } | |
| 147 | 180 | .theme-shades { |
| 148 | 181 | width: 100%; |
| 149 | 182 | display: flex; |
| @@ -159,69 +192,42 @@ const swatches = computed(() => | ||
| 159 | 192 | flex: 1; |
| 160 | 193 | height: 100%; |
| 161 | 194 | } |
| 162 | .theme-copy { | |
| 163 | flex-shrink: 0; | |
| 195 | .theme-shades-big { | |
| 196 | height: auto; | |
| 197 | gap: 6px; | |
| 198 | border-radius: 0; | |
| 199 | overflow-x: auto; | |
| 200 | overflow-y: hidden; | |
| 201 | } | |
| 202 | .theme-shade-big { | |
| 203 | flex: 1 0 48px; | |
| 204 | min-width: 48px; | |
| 205 | height: auto; | |
| 164 | 206 | display: flex; |
| 165 | align-items: center; | |
| 166 | justify-content: center; | |
| 167 | width: 32px; | |
| 168 | height: 32px; | |
| 169 | padding: 0; | |
| 170 | border-radius: 8px; | |
| 207 | flex-direction: column; | |
| 208 | border-radius: 6px; | |
| 209 | overflow: hidden; | |
| 171 | 210 | border: 1px solid var(--vp-c-divider); |
| 172 | 211 | background-color: var(--vp-c-bg); |
| 173 | color: var(--vp-c-text-1); | |
| 174 | cursor: pointer; | |
| 175 | transition: border-color 0.2s, color 0.2s; | |
| 176 | 212 | } |
| 177 | .theme-copy:hover { | |
| 178 | border-color: var(--vp-c-brand-1); | |
| 179 | color: var(--vp-c-brand-1); | |
| 213 | .theme-shade-fill { | |
| 214 | width: 100%; | |
| 215 | height: 42px; | |
| 216 | } | |
| 217 | .theme-shade-hex { | |
| 218 | display: block; | |
| 219 | padding: 4px 2px; | |
| 220 | font-size: 10px; | |
| 221 | line-height: 1.2; | |
| 222 | text-align: center; | |
| 223 | color: var(--vp-c-text-2); | |
| 224 | font-variant-numeric: tabular-nums; | |
| 225 | white-space: nowrap; | |
| 226 | overflow: hidden; | |
| 227 | text-overflow: ellipsis; | |
| 180 | 228 | } |
| 181 | 229 | .theme-copy-done { |
| 182 | 230 | border-color: var(--vp-c-brand-1); |
| 183 | 231 | color: var(--vp-c-brand-1); |
| 184 | 232 | } |
| 185 | .theme-copy span { | |
| 186 | font-size: 15px; | |
| 187 | } | |
| 188 | .theme-install { | |
| 189 | flex-shrink: 0; | |
| 190 | display: flex; | |
| 191 | align-items: center; | |
| 192 | justify-content: center; | |
| 193 | gap: 5px; | |
| 194 | height: 32px; | |
| 195 | padding: 0 10px; | |
| 196 | border-radius: 8px; | |
| 197 | border: 1px solid var(--vp-button-brand-border); | |
| 198 | background-color: var(--vp-button-brand-bg); | |
| 199 | color: var(--vp-button-brand-text) !important; | |
| 200 | font-size: 13px; | |
| 201 | font-weight: 600; | |
| 202 | line-height: 1; | |
| 203 | text-decoration: none !important; | |
| 204 | transition: filter 0.2s, border-color 0.2s; | |
| 205 | } | |
| 206 | .theme-install:hover { | |
| 207 | filter: brightness(1.08); | |
| 208 | border-color: var(--vp-button-brand-hover-border); | |
| 209 | } | |
| 210 | .theme-install-icon { | |
| 211 | font-size: 15px; | |
| 212 | } | |
| 213 | .theme-install-label { | |
| 214 | white-space: nowrap; | |
| 215 | } | |
| 216 | ||
| 217 | @media (max-width: 767px) { | |
| 218 | .theme-install { | |
| 219 | width: 32px; | |
| 220 | padding: 0; | |
| 221 | gap: 0; | |
| 222 | } | |
| 223 | .theme-install-label { | |
| 224 | display: none; | |
| 225 | } | |
| 226 | } | |
| 227 | 233 | </style> |
docs/ext/themeRepos/defaults.ts +7
| @@ -21,6 +21,13 @@ export const DEFAULT_THEME: ManaTheme = { | ||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | export const IDENTITY_COLORS = [ | |
| 25 | 'accent', | |
| 26 | 'background', | |
| 27 | 'secondaryBackground', | |
| 28 | 'tertiaryBackground' | |
| 29 | ] as const | |
| 30 | ||
| 24 | 31 | export const resolveThemeColors = ( |
| 25 | 32 | colors?: Record<string, string> |
| 26 | 33 | ): Record<string, string> => ({ ...DEFAULT_THEME.colors, ...(colors ?? {}) }) |