tweak vite config

This commit is contained in:
pa
2026-03-06 12:45:21 +09:00
parent 3f58a3c9dd
commit e997a7131f
5 changed files with 113 additions and 36 deletions

View File

@@ -1339,6 +1339,7 @@
"android_performance": "Android Performance",
"ios_performance": "iOS Performance",
"time_spent": "Time Spent",
"visibility": "Visibility",
"tags": "Tags",
"memo": "Memo",
"memo_placeholder": "Click to add a memo",

View File

@@ -27,7 +27,7 @@
<PopoverContent class="w-auto p-3" align="start">
<div class="flex flex-col gap-3">
<Field>
<FieldLabel>{{ t('dialog.avatar.tags.public') }}</FieldLabel>
<FieldLabel>{{ t('dialog.avatar.info.visibility') }}</FieldLabel>
<FieldContent>
<ToggleGroup
type="single"
@@ -283,6 +283,10 @@
return count;
});
/**
*
* @param tag
*/
function toggleTagFilter(tag) {
const next = new Set(tagFilters.value);
if (next.has(tag)) next.delete(tag);
@@ -290,6 +294,9 @@
tagFilters.value = next;
}
/**
*
*/
function clearFilters() {
releaseStatusFilter.value = 'all';
tagFilters.value = new Set();
@@ -325,10 +332,18 @@
return list;
});
/**
*
* @param avatarId
*/
function handleShowAvatarDialog(avatarId) {
showAvatarDialog(avatarId);
}
/**
*
* @param avatarId
*/
function handleWearAvatar(avatarId) {
if (currentUser.value.currentAvatar === avatarId) {
return;
@@ -336,6 +351,12 @@
selectAvatarWithoutConfirmation(avatarId);
}
/**
*
* @param command
* @param labelKey
* @param fn
*/
function confirmAndRun(command, labelKey, fn) {
modalStore
.confirm({
@@ -349,6 +370,11 @@
});
}
/**
*
* @param action
* @param avatarRef
*/
function handleContextMenuAction(action, avatarRef) {
switch (action) {
case 'details':
@@ -441,6 +467,12 @@
}
}
/**
*
* @param root0
* @param root0.avatarId
* @param root0.tags
*/
async function onSaveTags({ avatarId, tags: newEntries }) {
const avatar = avatars.value.find((a) => a.id === avatarId);
const oldEntries = avatar?.$tags || [];
@@ -469,6 +501,10 @@
avatarTagsMap.value = new Map(avatarTagsMap.value);
}
/**
*
* @param e
*/
function onFileChangeAvatarImage(e) {
const { file, clearInput } = handleImageUploadInput(e, {
inputSelector: imageUploadInput.value,
@@ -483,6 +519,10 @@
cropDialogOpen.value = true;
}
/**
*
* @param blob
*/
async function onCropConfirmAvatar(blob) {
const avatarRef = changeImageAvatarRef.value;
if (!avatarRef) return;
@@ -527,10 +567,18 @@
currentAvatarId
});
/**
*
* @param row
*/
function handleRowClick(row) {
handleWearAvatar(row.original.id);
}
/**
*
* @param row
*/
function getRowClass(row) {
if (row.original.id === currentAvatarId.value) {
return 'bg-primary/10 hover:bg-primary/15';
@@ -561,6 +609,9 @@
table.setPageSize(size);
});
/**
*
*/
async function refreshAvatars() {
if (isLoading.value) {
return;

View File

@@ -203,11 +203,11 @@ export function getColumns({
}
},
{
id: 'releaseStatus',
id: 'visibility',
accessorKey: 'releaseStatus',
header: () => t('dialog.avatar.tags.public'),
header: () => t('dialog.avatar.info.visibility'),
size: 120,
meta: { label: () => t('dialog.avatar.tags.public') },
meta: { label: () => t('dialog.avatar.info.visibility') },
cell: ({ row }) => {
const ref = row.original;
return (

View File

@@ -3,13 +3,19 @@ import { resolve } from 'node:path';
import fs from 'node:fs';
import { defineConfig, loadEnv } from 'vite';
import { browserslistToTargets } from 'lightningcss';
import browserslist from 'browserslist';
import tailwindcss from '@tailwindcss/vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import { languageCodes } from './localization/locales';
/**
*
* @param assetId
*/
function getAssetLanguage(assetId) {
if (!assetId) return null;
@@ -31,6 +37,10 @@ function getAssetLanguage(assetId) {
return language || null;
}
/**
*
* @param moduleId
*/
function getManualChunk(moduleId) {
const language = getAssetLanguage(moduleId);
if (!language) return;
@@ -40,6 +50,11 @@ function getManualChunk(moduleId) {
const defaultAssetName = '[hash][extname]';
/**
*
* @param root0
* @param root0.name
*/
function getAssetFilename({ name }) {
const language = getAssetLanguage(name);
if (!language) return `assets/${defaultAssetName}`;
@@ -94,12 +109,27 @@ export default defineConfig(({ mode }) => {
css: {
transformer: 'lightningcss',
lightningcss: {
minify: true,
targets: {
chrome: 140
}
drafts: {
nesting: true,
customMedia: true
},
errorRecovery: true,
targets: browserslistToTargets(browserslist('Chrome 144'))
}
},
optimizeDeps: {
include: [
'vue',
'vue/jsx-runtime',
'reka-ui',
'pinia',
'vue-i18n',
'lucide-vue-next',
'@vueuse/core',
'vue-sonner',
'dayjs'
]
},
define: {
LINUX: JSON.stringify(process.env.PLATFORM === 'linux'),
WINDOWS: JSON.stringify(process.env.PLATFORM === 'windows'),
@@ -111,7 +141,8 @@ export default defineConfig(({ mode }) => {
strictPort: true
},
build: {
target: 'chrome140',
target: 'chrome144',
cssTarget: 'chrome144',
outDir: '../build/html',
license: true,
emptyOutDir: true,