[F] Fix svelte warnings & errors

This commit is contained in:
Azalea
2026-04-21 03:49:04 -04:00
parent e711921725
commit 7865f7cfa7
14 changed files with 66 additions and 82 deletions

View File

@@ -27,7 +27,7 @@
display: flex
gap: 1rem
div
a
&.active
color: vars.$c-main
</style>

View File

@@ -9,6 +9,10 @@
let editing = false
let inputPage: number
function focus(node: HTMLInputElement) {
node.focus()
}
function updatePage(newPage: number) {
if (newPage > 0 && newPage <= totalPages) dispatch('updatePage', newPage)
}
@@ -33,7 +37,7 @@
<button on:click={() => updatePage(page - 1)} disabled={page <= 1}>Previous</button>
{#if editing}
<input bind:value={inputPage} on:blur={finishEditing} on:keydown={handleKeydown} min="1" max={totalPages} autofocus/>
<input bind:value={inputPage} on:blur={finishEditing} on:keydown={handleKeydown} min="1" max={totalPages} use:focus/>
{:else}
<span on:click={startEditing} role="button" tabindex="0" on:keydown={(e) => e.key === 'Enter' && startEditing()}>
Page {page} of {totalPages}

View File

@@ -27,15 +27,15 @@
})
})
function mouseOver(event: MouseEvent) {
function mouseOver(event: Event) {
console.log('over')
isHovered = true
updatePosition(event)
updatePosition(event as MouseEvent)
}
function mouseMove(event: MouseEvent) {
function mouseMove(event: Event) {
console.log('move')
updatePosition(event)
updatePosition(event as MouseEvent)
}
function updatePosition(event: MouseEvent) {

View File

@@ -14,7 +14,7 @@
let error = ""
setLoading(true)
GAME.userSummary(username, game).then(d => data = d).catch(e => error = e).finally(_ => setLoading(false))
GAME.userSummary(username, game).then(d => data = d).catch(e => error = e).finally(() => setLoading(false))
</script>
{#if !data}

View File

@@ -179,7 +179,7 @@
try {
data = await GAME.export('chu3')
}
catch (e) {
catch (e: any) {
error = e.message
submitting = ""
return
@@ -481,7 +481,7 @@
<span>{USERBOX_SETUP_MODE ? t('userbox.new.url_warning') : USERBOX_SETUP_TEXT}</span>
<div class="actions">
{#if USERBOX_SETUP_MODE}
<input type="text" on:keyup={e => {if (e.key == "Enter") { userboxHandleInput((e.target as HTMLInputElement).value) } else g(e.currentTarget.value)}} class="add-margin" placeholder="Base URL">
<input type="text" on:keyup={e => {if (e.key == "Enter") { userboxHandleInput((e.target as HTMLInputElement).value) }}} class="add-margin" placeholder="Base URL">
{:else}
{#if USERBOX_PROGRESS != 0}
<div class="progress">
@@ -558,36 +558,6 @@ p.notice
height: 100%
opacity: 0
.preview
margin-top: 32px
display: flex
flex-wrap: wrap
justify-content: space-between
gap: 32px
> div
position: relative
width: 100px
height: 100px
overflow: hidden
background: vars.$ov-lighter
border-radius: vars.$border-radius
span
position: absolute
bottom: 0
width: 100%
text-align: center
z-index: 10
background: rgba(0, 0, 0, 0.2)
backdrop-filter: blur(2px)
img
position: absolute
inset: 0
width: 100%
height: 100%
object-fit: contain
.fields
display: flex

View File

@@ -3,8 +3,8 @@
import { ts } from "../../libs/i18n";
import StatusOverlays from "../StatusOverlays.svelte";
let regionId = $state(0);
let submitting = ""
let error: string;
let submitting = $state("")
let error: string = $state("");
const prefectures = ["None","Aichi","Aomori","Akita","Ishikawa","Ibaraki","Iwate","Ehime","Oita","Osaka","Okayama","Okinawa","Kagawa","Kagoshima","Kanagawa","Gifu","Kyoto","Kumamoto","Gunma","Kochi","Saitama","Saga","Shiga","Shizuoka","Shimane","Chiba","Tokyo","Tokushima","Tochigi","Tottori","Toyama","Nagasaki","Nagano","Nara","Niigata","Hyogo","Hiroshima","Fukui","Fukuoka","Fukushima","Hokkaido","Mie","Miyagi","Miyazaki","Yamagata","Yamaguchi","Yamanashi","Wakayama"]
@@ -31,7 +31,7 @@
<span class="name">{ts(`settings.regionSelector.title`)}</span>
<span class="desc">{ts(`settings.regionSelector.desc`)}</span>
</label>
<select bind:value={regionId} on:change={saveNewRegion}>
<select bind:value={regionId} onchange={saveNewRegion}>
<option value={0} disabled selected>{ts("settings.regionSelector.select")}</option>
{#each prefectures.slice(1) as prefecture, index}
<option value={index}>{prefecture}</option>

View File

@@ -4,7 +4,6 @@
import { DISCORD_INVITE } from "../../libs/config";
export let error: string;
export let expected: boolean = false;
</script>
<div class="overlay" transition:fade>

View File

@@ -119,6 +119,7 @@ export const EN_REF_HOME = {
'home.linkcard.enter-info': 'Please enter either an Access Code or a Serial Number in the following boxes. Dragging and dropping aime.txt or felica.txt is also supported.',
'home.linkcard.access-code': 'If you have an Access Code, enter it below. Access Codes can be obtained from the back of your card or from the title screen of your game (press the Access Code button and card in). If you do not have an Access Code, you may generate one.',
'home.linkcard.enter-sn': 'If you have a Serial Number, enter it below. Serial Numbers can be obtained via most smartphones (NFC Tools: <a href="https://play.google.com/store/apps/details?id=com.wakdev.wdnfc">Android</a> / <a href="https://apps.apple.com/us/app/nfc-tools/id1252962749">Apple</a>) or a card reader.',
'home.linkcard.kdx-notice': 'If you are playing KanadeDX, please enter the virtual card number here (can be found in Settings > Card Number).',
'home.linkcard.link': 'Link',
'home.linkcard.data-conflict': 'Data Conflict',
'home.linkcard.name': 'Name',

View File

@@ -91,23 +91,29 @@ const zhGeneral: typeof EN_REF_GENERAL = {
'game.ongeki': "音击",
'game.wacca': "华卡",
"status.error": "发生错误",
"status.error.hint": "出了一些问题,请稍后刷新重试或者",
"status.error.hint.link": "加我们的 Discord 群问一问",
"status.error.hint": "支持 (Discord)",
"status.detail": "详细信息:${detail}",
"action.refresh": "刷新",
"action.cancel": "取消",
"action.confirm": "确认",
"action.home": "主页",
'navigation.profile': '个人资料',
'navigation.maps': '地图',
'navigation.home': '首页',
'navigation.rankings': '排行榜',
'navigation.notice': '公告'
'navigation.notice': '公告',
'loading': '正在加载...',
'404': '找不到页面 (${pathname})。如果您认为这是个错误,请通过适当的支持渠道报告。'
}
const zhHome: typeof EN_REF_HOME = {
'home.nav.portal': "主页",
'home.nav.link-card': "绑卡",
'home.nav.game-setup': "连接设置",
'home.nav.support': "支持",
'home.user-profile': "个人资料",
'home.rankings': "排行榜",
'home.settings': "设置",
'home.manage-cards': '管理游戏卡',
'home.manage-cards-description': '绑定、解绑、管理游戏数据卡',
'home.link-card': '绑定游戏卡',
@@ -125,8 +131,7 @@ const zhHome: typeof EN_REF_HOME = {
'home.linkcard.lastused': "上次使用",
'home.linkcard.enter-info': "请输入以下信息,或将 aime.txt / felica.txt 文件拖放到此区域",
'home.linkcard.access-code': "卡背面的 20 位卡号(如果提示找不到卡,请尝试使用游戏内置的显示卡号功能,输入游戏读取到的卡号)",
'home.linkcard.enter-sn1': "在您的手机",
'home.linkcard.enter-sn2': "上下载 NFC Tools 并扫描您的卡。然后输入显示的 SN 号。",
'home.linkcard.enter-sn': "在您的手机上下载 NFC Tools 并扫描您的卡。然后输入显示的 SN 号。",
'home.linkcard.kdx-notice': "如果你在玩 KanadeDX,请在这里输入虚拟卡号(可以在设置 > 卡号中找到卡号)",
'home.linkcard.link': "绑定",
'home.linkcard.data-conflict': "卡号冲突",
@@ -139,17 +144,12 @@ const zhHome: typeof EN_REF_HOME = {
'home.linkcard.unlink': "取消链接",
'home.linkcard.unlink-notice': "你确定要取消此卡的链接吗?",
'home.linkcard.felica-ac-warning': "该 Access Code 是一张 FeliCa AIC 卡。\n如果你使用实体卡而非 aime.txt 模拟)刷卡登录游戏,与官方服务器不同,你需要绑定该卡的 FeliCa SN或与之对应的,游戏界面中查看得到的 00 开头的卡号)而非此号码。\n如果你使用 aime.txt 模拟登录,请忽略本警告继续绑定。",
'home.setup.welcome': "欢迎! 如果您有街机框体或者手台,请按照以下说明设置以连接到 AquaDX。",
'home.setup.blockquote': "我们假设您已经拥有所需的文件,并且可以启动机台或手台附带的游戏(例如 ROM 和 segatools。如果没有,请联系您设备的卖家以获取所需的文件,因为出于版权原因,我们不会提供这些文件。",
'home.setup.get': "开始",
'home.setup.edit': "请打开您的 segatools.ini 文件并修改以下行",
'home.setup.test': "在您重新启动游戏后,应该能够连接到 AquaDX。可以验证测试菜单中的网络测试测试连接是否全部良好。",
'home.setup.ask': "如果您有任何问题,请加入我们的",
'home.setup.support': "以获取支持",
'home.setup.keychip-tips': "这是你的狗号,不要与任何人分享",
'home.community.discord': 'Discord',
'home.community.telegram': 'Telegram (中文)',
'home.community.qq': 'QQ (中文)',
'home.community.github': 'GitHub 仓库',
'home.linkcard.card-security-warning': "卡片信息决定了您可以访问的所有玩家数据。请不要与任何人分享您的卡号。",
'home.import.unknown-game': '未知游戏类型 (目前导入只支持舞萌和中二)',
'home.import.new-data': '要导入的数据',
'home.import.data-conflict': '继续导入将覆盖现有数据',
@@ -188,6 +188,7 @@ const zhSetup: typeof EN_REF_SETUP = {
const zhSettings: typeof EN_REF_SETTINGS = {
'settings.title': '用户设置',
'settings.page-title': '${page} 设置',
'settings.tabs.profile': '个人资料',
'settings.tabs.global': '全局',
'settings.tabs.chu3': '中二',
@@ -239,6 +240,8 @@ const zhSettings: typeof EN_REF_SETTINGS = {
'settings.fields.chusanTeamName.desc': '自定义显示在个人资料顶部的文本。',
'settings.fields.chusanInfinitePenguins.name': '我是桐谷遥',
'settings.fields.chusanInfinitePenguins.desc': '将角色界限突破的企鹅雕像数量设置为 999。',
'settings.fields.chusanLvUnlockAll.name': '解锁所有 Linked Gate',
'settings.fields.chusanLvUnlockAll.desc': '会触发一个很长的动画序列,且无法撤销',
'settings.fields.chusanMatchingReflector.name': '全国对战 Reflector',
'settings.fields.chusanMatchingReflector.desc': '全国对战服务器的 UDP 反射服务器的 URL',
'settings.fields.chusanMatchingServer.name': '全国对战服务器',
@@ -286,6 +289,7 @@ export const zhUserbox: typeof EN_REF_USERBOX = {
'userbox.header.general': '游戏设置',
'userbox.header.matching': '全国对战',
'userbox.header.matching.symbolChat': '全国对战聊天表情',
'userbox.header.linkedVerse': 'Linked Verse',
'userbox.header.userbox': 'UserBox 设置',
'userbox.header.preview': 'UserBox 预览',
'userbox.nameplateId': '名牌',
@@ -295,6 +299,7 @@ export const zhUserbox: typeof EN_REF_USERBOX = {
'userbox.trophyIdSub2': '称号3',
'userbox.mapIconId': '地图图标',
'userbox.voiceId': '系统语音',
'userbox.stageId': '舞台',
'userbox.avatarWear': '企鹅服饰',
'userbox.avatarHead': '企鹅头饰',
'userbox.avatarFace': '企鹅面部',
@@ -315,6 +320,14 @@ export const zhUserbox: typeof EN_REF_USERBOX = {
'userbox.matching.symbolChat': '表情选择',
'userbox.matching.symbolChat.default': '默认',
'userbox.lv.diffnotice': '在 Linked Verse 中,你将根据难度分别进行匹配。',
'userbox.lv.difficulty': 'Linked Verse 难度',
'userbox.lv.difficulty.1': 'LEVEL V (1000 生命, 仅限 MASTER)',
'userbox.lv.difficulty.2': 'LEVEL IV (3000 生命, 仅限 MASTER)',
'userbox.lv.difficulty.3': 'LEVEL III (5000 生命, 仅限 MASTER)',
'userbox.lv.difficulty.4': 'LEVEL II (5000 生命, 仅限 MASTER & EXPERT)',
'userbox.lv.difficulty.5': 'LEVEL I (5000 生命, 所有难度)',
'userbox.new.name': 'AquaBox',
'userbox.new.setup': '将中二Lumi 或更高版本)的游戏文件夹拖放到下方区域,以显示带有名牌和头像的 UserBox。所有文件都在浏览器中处理。',
'userbox.new.setup.notice': '选择包含游戏数据的最外层文件夹。',

View File

@@ -35,7 +35,7 @@ export function registerChart() {
)
}
const dayTemplate = (DateHelper) => {
const dayTemplate = (DateHelper: any) => {
const ROWS_COUNT = 7
const ALLOWED_DOMAIN_TYPE = ['month']
@@ -43,7 +43,7 @@ const dayTemplate = (DateHelper) => {
name: 'ghDayFix',
allowedDomainType: ALLOWED_DOMAIN_TYPE,
rowsCount: () => ROWS_COUNT,
columnsCount: (ts) => {
columnsCount: (ts: any) => {
let count = DateHelper.getWeeksCountInMonth(ts)
const endOfMonth = moment().endOf('month').toDate()
const clampEnd = DateHelper.getFirstWeekOfMonth(endOfMonth).toDate()
@@ -53,7 +53,7 @@ const dayTemplate = (DateHelper) => {
}
return count
},
mapping: (startTimestamp, endTimestamp) => {
mapping: (startTimestamp: any, endTimestamp: any) => {
const clampStart = DateHelper.getFirstWeekOfMonth(startTimestamp)
let clampEnd = DateHelper.getFirstWeekOfMonth(endTimestamp)
@@ -64,7 +64,7 @@ const dayTemplate = (DateHelper) => {
let x = -1
const pivotDay = clampStart.weekday()
return DateHelper.intervals('day', clampStart, clampEnd).map((ts) => {
return DateHelper.intervals('day', clampStart, clampEnd).map((ts: any) => {
const weekday = DateHelper.date(ts).weekday()
if (weekday === pivotDay) {
x += 1
@@ -77,7 +77,7 @@ const dayTemplate = (DateHelper) => {
}
})
},
extractUnit: (ts) => DateHelper.date(ts).startOf('day').valueOf(),
extractUnit: (ts: any) => DateHelper.date(ts).startOf('day').valueOf(),
}
}

View File

@@ -63,13 +63,6 @@
<style lang="sass">
@use "../vars"
.tabs
display: flex
gap: 1rem
div
&.active
color: vars.$c-main
h3
font-size: 1.3rem

View File

@@ -49,12 +49,12 @@
if (linkingType === 'AC') inputAC = ""
if (linkingType === 'SN') inputSN = ""
} catch (e) {
setError(e.message, linkingType)
setError((e as any).message, linkingType!)
}
state = "ready"
}
let linkingType: 'AC' | 'SN' = null
let linkingType: 'AC' | 'SN' | null = null
async function link(type: 'AC' | 'SN') {
if (state !== 'ready' || accountCardSummary === null) return
state = "linking-" + type
@@ -192,7 +192,7 @@
function inputACChange() {
// Add spaces to the input
const cursorIndex = cursorPositionToCursorIndex(inputAC, elemInputAC.selectionStart, /\d/)
const cursorIndex = cursorPositionToCursorIndex(inputAC, elemInputAC.selectionStart ?? 0, /\d/)
inputAC = inputAC.replace(/\D/g, '').replace(/(.{4})/g, '$1 ').replace(/ $/, '')
const cursorPosition = cursorIndexToCursorPosition(inputAC, cursorIndex, /\d/)
setTimeout(() => elemInputAC.selectionStart = elemInputAC.selectionEnd = cursorPosition, 0)
@@ -212,7 +212,7 @@
function inputSNChange() {
// Add colons to the input
inputSN = inputSN.toUpperCase()
const cursorIndex = cursorPositionToCursorIndex(inputSN, inputElemSN.selectionStart, /[0-9A-F]/)
const cursorIndex = cursorPositionToCursorIndex(inputSN, inputElemSN.selectionStart ?? 0, /[0-9A-F]/)
inputSN = inputSN.replace(/[^0-9A-F]/g, '').replace(/(.{2})/g, '$1:').replace(/:$/, '')
const cursorPosition = cursorIndexToCursorPosition(inputSN, cursorIndex, /[0-9A-F]/)
setTimeout(() => inputElemSN.selectionStart = inputElemSN.selectionEnd = cursorPosition, 0)

View File

@@ -95,7 +95,9 @@
bind:tested={srcTested} bind:this={srcEl} bind:exportedData={srcExportedData} />
<div class="arrow" class:disabled={!(srcTested && dstTested)}>
<img src="{DATA_HOST}/d/DownArrow.png" alt="arrow" on:click={startTransfer}>
<button class="arrow-btn" on:click={startTransfer}>
<img src="{DATA_HOST}/d/DownArrow.png" alt="arrow">
</button>
</div>
<TransferServer bind:src={dst} bind:gameInfo={gameInfo} on:change={onChange}
@@ -115,6 +117,15 @@
&.disabled
filter: grayscale(1)
.arrow-btn
background: none
border: none
padding: 0
cursor: pointer
&:disabled
cursor: not-allowed
// CSS animation to let the image opacity breathe
img
animation: breathe 1s infinite alternate

View File

@@ -29,8 +29,8 @@
registerChart()
export let username: string;
export let game: GameName;
export let username: string = "";
export let game: GameName = "" as GameName;
let calElement: HTMLElement
let error: string;
let me: AquaNetUser
@@ -593,10 +593,6 @@
overflow: hidden
flex-direction: column
.first-line
display: flex
flex-direction: row
// Limit song name to one line
.song-title
max-width: 90%
@@ -612,9 +608,6 @@
flex-direction: column
gap: 0
.rank-text
text-align: left
// Recent Scores section
.recent
.scores