Skip to content

Commit

Permalink
chore: pnpm up
Browse files Browse the repository at this point in the history
  • Loading branch information
ForkKILLET committed Jan 1, 2024
1 parent 69e8021 commit 6d16cc7
Show file tree
Hide file tree
Showing 7 changed files with 900 additions and 397 deletions.
36 changes: 18 additions & 18 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"lint": "eslint --ext .ts,.vue ."
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/vue-fontawesome": "^3.0.3",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@typescript-eslint/parser": "^5.62.0",
"@vueuse/components": "^10.5.0",
"@vueuse/core": "^10.5.0",
"axios": "^1.5.1",
"@vueuse/components": "^10.7.1",
"@vueuse/core": "^10.7.1",
"axios": "^1.6.3",
"d3-force": "^3.0.0",
"d3-interpolate": "^3.0.1",
"dayjs": "^1.11.10",
Expand All @@ -28,22 +28,22 @@
"mitt": "^3.0.1",
"normalize.css": "^8.0.1",
"pinia": "^2.1.7",
"schemastery": "^3.13.1",
"vue": "^3.3.4",
"schemastery": "^3.14.2",
"vue": "^3.4.3",
"vue-router": "^4.2.5",
"wanakana": "^5.2.0"
"wanakana": "^5.3.1"
},
"devDependencies": {
"@types/d3-force": "^3.0.6",
"@types/d3-interpolate": "^3.0.2",
"@types/wanakana": "^4.0.4",
"@types/d3-force": "^3.0.9",
"@types/d3-interpolate": "^3.0.4",
"@types/wanakana": "^4.0.6",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@vitejs/plugin-vue": "^4.4.0",
"@vitejs/plugin-vue": "^5.0.2",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/runtime-core": "^3.3.4",
"eslint": "^8.51.0",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vue-tsc": "^1.8.19"
"@vue/runtime-core": "^3.4.3",
"eslint": "^8.56.0",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vue-tsc": "^1.8.27"
}
}
2 changes: 1 addition & 1 deletion frontend/src/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ registerShortcuts([
id: 'modal:close',
precedence: 1,
key: newKey('Escape'),
info: 'Modalを閉める', // FIXME: Japanese of 'modal window'
info: 'モーダル・ウィンドウを閉める',
isActive: () => !! modalStore.component,
action: modalStore.forceClose
}
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/WordGraphChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import { storeToRefs } from 'pinia'
import { useElementSize, useEventListener } from '@vueuse/core'
import { IDragTarget, IDragTargetInfo, ISimulationNode, IView, useWordGraph } from '@store/wordGraph'
import { useConfig } from '@store/config'
import { useConfigData, useConfigItem } from '@store/config'
import { getEventPoint } from '@util/dom'
import { depRef } from '@util/reactivity'
import { storeRef } from '@util/storage'
import { disposeShortcuts, newKey, registerShortcuts } from '@util/keyboard'
import EllipsisText from '@comp/charts/EllipsisText.vue'
Expand Down Expand Up @@ -110,7 +109,9 @@ const onDragEnd = (event: MouseEvent | TouchEvent) => {
}
}
const scale = storeRef('wordGraphScale', 1)
const config = useConfigData()
const scale = useConfigItem(config, 'wordGraphScale')
const zoom = (deltaScale: number) => {
const newScale = scale.value + deltaScale
Expand Down Expand Up @@ -153,8 +154,6 @@ useEventListener([ 'mousedown', 'touchstart' ], onDragStart)
useEventListener([ 'mousemove', 'touchmove' ], onDragMove)
useEventListener([ 'mouseup', 'touchend' ], onDragEnd)
useEventListener(root, 'wheel', onWheel)
const { config } = storeToRefs(useConfig())
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/config/ConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const value = computed({
<div v-else-if="schema.type === 'boolean'">
<NyaSwitch v-model="(value as boolean)" />
</div>
<div v-else-if="schema.type === 'number'">
<NyaConfirmInput
v-model="(value as number)"
:click-to-edit="true"
/>
</div>
</div>
</div>
</template>
Expand Down
29 changes: 28 additions & 1 deletion frontend/src/stores/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { defineStore, storeToRefs } from 'pinia'
import Schema from 'schemastery'

import { storeReactive } from '@util/storage'
import { Ref, computed } from 'vue'
import { RemoveIndex } from '@type/tool'

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down Expand Up @@ -58,11 +60,31 @@ export const Config = Schema.object({
.description('同期 API の URL'),
shortcuts: Schema
.dict(Schema.string())
.hidden(),
wordGraphScale: Schema
.number()
.extra('section', '単語リンク・グラフ')
.default(1)
.description('グラフのズーム倍率')
.hidden(),
wordGraphEdgeType: Schema
.union([
Schema.const('all'),
Schema.const('rel')
])
.extra('section', '単語リンク・グラフ')
.default('all')
.description('グラフに表現するリンクの種類')
.hidden()
})

type ConfigDataRO = RemoveIndex<ReturnType<typeof Config>>
export type ConfigData = {
-readonly [K in keyof ConfigDataRO]: ConfigDataRO[K]
}

export const useConfig = defineStore('config', () => {
const config = storeReactive<ReturnType<typeof Config>>('config', new Config(), Config)
const config = storeReactive<ConfigData>('config', new Config(), Config)

return { config }
})
Expand All @@ -71,3 +93,8 @@ export const useConfigData = () => {
const { config } = storeToRefs(useConfig())
return config
}

export const useConfigItem = <K extends keyof ConfigData>(config: Ref<ConfigData>, key: K) => computed({
get: () => config.value[key],
set: val => config.value[key] = val
})
9 changes: 9 additions & 0 deletions frontend/src/types/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@ export type AddSub10Table = {
}

export type IncSub10<T extends IntSub10> = AddSub10Table[T]

export type RemoveIndex<T> = {
[ K in keyof T as
string extends K ? never :
number extends K ? never :
symbol extends K ? never :
K
] : T[K]
}
Loading

0 comments on commit 6d16cc7

Please sign in to comment.