Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into merge-0.22.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Dec 26, 2024
2 parents 82b09d8 + adaf573 commit 0543371
Show file tree
Hide file tree
Showing 66 changed files with 3,590 additions and 1,082 deletions.
28 changes: 26 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"glob": "11.0.0",
"hotkeys-js": "3.13.6",
"immer": "9.0.21",
"kuromoji": "github:VOICEVOX/kuromoji.js#0.0.1",
"markdown-it": "13.0.2",
"move-file": "3.0.0",
"multistream": "4.1.0",
Expand Down
6 changes: 1 addition & 5 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import {
import { getConfigManager } from "./browserConfig";
import { IpcSOData } from "@/type/ipc";
import {
defaultHotkeySettings,
defaultToolbarButtonSetting,
EngineId,
EngineSettingType,
EngineSettings,
HotkeySettingType,
Sandbox,
} from "@/type/preload";
import { AssetTextFileNames } from "@/type/staticResources";
import { HotkeySettingType } from "@/domain/hotkeyAction";

const toStaticPath = (fileName: string) =>
`${import.meta.env.BASE_URL}/${fileName}`.replaceAll(/\/\/+/g, "/");
Expand Down Expand Up @@ -247,9 +246,6 @@ export const api: Sandbox = {
changePinWindow() {
throw new Error(`Not supported on Browser version: changePinWindow`);
},
getDefaultHotkeySettings() {
return Promise.resolve(defaultHotkeySettings);
},
getDefaultToolbarSetting() {
return Promise.resolve(defaultToolbarButtonSetting);
},
Expand Down
14 changes: 11 additions & 3 deletions src/backend/common/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import {
ConfigType,
configSchema,
DefaultStyleId,
defaultHotkeySettings,
HotkeySettingType,
ExperimentalSettingType,
HotkeyCombination,
VoiceId,
PresetKey,
} from "@/type/preload";
import { ensureNotNullish } from "@/helpers/errorHelper";
import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo";
import {
HotkeyCombination,
defaultHotkeySettings,
HotkeySettingType,
} from "@/domain/hotkeyAction";

const lockKey = "save";

Expand Down Expand Up @@ -341,6 +343,12 @@ export abstract class BaseConfigManager {
this._save();
}

/** 全ての設定を取得する。テスト用。 */
public getAll(): ConfigType {
if (!this.config) throw new Error("Config is not initialized");
return this.config;
}

private _save() {
void this.lock.acquire(lockKey, async () => {
await this.save({
Expand Down
5 changes: 0 additions & 5 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { AssetTextFileNames } from "@/type/staticResources";
import {
EngineInfo,
SystemError,
defaultHotkeySettings,
defaultToolbarButtonSetting,
EngineId,
TextAsset,
Expand Down Expand Up @@ -695,10 +694,6 @@ registerIpcMainHandle<IpcMainHandle>({
}
},

GET_DEFAULT_HOTKEY_SETTINGS: () => {
return defaultHotkeySettings;
},

GET_DEFAULT_TOOLBAR_SETTING: () => {
return defaultToolbarButtonSetting;
},
Expand Down
4 changes: 0 additions & 4 deletions src/backend/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ const api: Sandbox = {
return ipcRendererInvokeProxy.HOTKEY_SETTINGS({ newData });
},

getDefaultHotkeySettings: async () => {
return await ipcRendererInvokeProxy.GET_DEFAULT_HOTKEY_SETTINGS();
},

getDefaultToolbarSetting: async () => {
return await ipcRendererInvokeProxy.GET_DEFAULT_TOOLBAR_SETTING();
},
Expand Down
33 changes: 33 additions & 0 deletions src/components/Base/BaseSlider.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import { ref } from "vue";
import BaseSlider from "./BaseSlider.vue";

const meta: Meta<typeof BaseSlider> = {
component: BaseSlider,
args: {
modelValue: 50,
min: 0,
max: 100,
step: 1,
},
render: (args) => ({
components: { BaseSlider },
setup() {
const model = ref(Number(args.modelValue));
return { args, model };
},
template: `<BaseSlider v-bind="args" v-model="model"></BaseSlider>`,
}),
};

export default meta;
type Story = StoryObj<typeof BaseSlider>;

export const Default: Story = {};

export const Disabled: Story = {
args: {
disabled: true,
},
};
102 changes: 102 additions & 0 deletions src/components/Base/BaseSlider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<template>
<SliderRoot
class="SliderRoot"
:min
:max
:step
:disabled
:modelValue="[model]"
@update:modelValue="
(value) => {
if (value == undefined) {
throw new Error('Undefined value received');
}
$emit('update:modelValue', value[0]);
}
"
>
<SliderTrack class="SliderTrack">
<SliderRange class="SliderRange" />
</SliderTrack>
<SliderThumb class="SliderThumb" />
</SliderRoot>
</template>

<script setup lang="ts">
import { SliderRange, SliderRoot, SliderThumb, SliderTrack } from "radix-vue";
defineProps<{
min?: number;
max?: number;
step?: number;
disabled?: boolean;
modelValue: number;
}>();
defineEmits<{
"update:modelValue": [value: number];
}>();
const model = defineModel<number>({ required: true });
</script>

<style lang="scss">
@use "@/styles/v2/variables" as vars;
@use "@/styles/v2/colors" as colors;
@use "@/styles/v2/mixin" as mixin;
.SliderRoot {
position: relative;
display: flex;
align-items: center;
height: vars.$size-control;
cursor: grab;
&:active {
cursor: grabbing;
}
&[data-disabled] {
opacity: 0.5;
cursor: not-allowed;
}
}
.SliderTrack {
background-color: colors.$border;
position: relative;
flex-grow: 1;
border-radius: 9999px;
height: 4px;
}
.SliderRange {
position: absolute;
background-color: colors.$primary;
border-radius: 9999px;
height: 100%;
}
.SliderThumb {
display: block;
width: 8px;
height: vars.$size-indicator;
background-color: colors.$primary;
border: 1px solid colors.$border;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
border-radius: vars.$radius-1;
:hover:not([data-disabled]) > & {
background-color: colors.$primary-hovered;
}
:active:not([data-disabled]) > & {
background-color: colors.$primary-pressed;
box-shadow: 0 0 0 transparent;
}
&:focus-visible {
@include mixin.on-focus;
}
}
</style>
1 change: 0 additions & 1 deletion src/components/Base/BaseSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const checked = defineModel<boolean>("checked", { required: true });
&:focus-visible {
@include mixin.on-focus;
outline-offset: 2px;
}
&[data-state="checked"] {
Expand Down
8 changes: 0 additions & 8 deletions src/components/Dialog/AllDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
v-model="isAcceptRetrieveTelemetryDialogOpenComputed"
/>
<AcceptTermsDialog v-model="isAcceptTermsDialogOpenComputed" />
<HelpDialog v-model="isHelpDialogOpenComputed" />
<SettingDialog v-model="isSettingDialogOpenComputed" />
<HotkeySettingDialog v-model="isHotkeySettingDialogOpenComputed" />
<ToolBarCustomDialog v-model="isToolbarSettingDialogOpenComputed" />
Expand All @@ -28,7 +27,6 @@

<script setup lang="ts">
import { computed } from "vue";
import HelpDialog from "@/components/Dialog/HelpDialog/HelpDialog.vue";
import SettingDialog from "@/components/Dialog/SettingDialog/SettingDialog.vue";
import HotkeySettingDialog from "@/components/Dialog/HotkeySettingDialog.vue";
import ToolBarCustomDialog from "@/components/Dialog/ToolBarCustomDialog.vue";
Expand All @@ -49,12 +47,6 @@ const props = defineProps<{
}>();
const store = useStore();
// ライセンス表示
const isHelpDialogOpenComputed = computed({
get: () => store.state.isHelpDialogOpen,
set: (val) => store.actions.SET_DIALOG_OPEN({ isHelpDialogOpen: val }),
});
// 設定
const isSettingDialogOpenComputed = computed({
get: () => store.state.isSettingDialogOpen,
Expand Down
Loading

0 comments on commit 0543371

Please sign in to comment.