@christianriedl/utils 1.0.97 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iOpenAI.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { InjectionKey } from 'vue';
2
2
  import { ISpeechService } from './iAudio';
3
- export declare const getOpenAISymbol: InjectionKey<IOpenAIService>;
3
+ export declare const getOpenAISymbol: InjectionKey<() => IOpenAIService>;
4
4
  export interface ICompleteData {
5
5
  choices: string[];
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"iOpenAI.js","sourceRoot":"","sources":["../src/iOpenAI.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAiC,MAAM,CAAC,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"iOpenAI.js","sourceRoot":"","sources":["../src/iOpenAI.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAuC,MAAM,CAAC,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.97",
3
+ "version": "1.0.99",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ref, watch, inject, toRef, onMounted } from 'vue'
3
- import { Audio, SpeechInterfaceParams, appConfigSymbol, IPause } from '@christianriedl/utils';
2
+ import { ref, watch, inject, toRef, onMounted, reactive } from 'vue'
3
+ import { Audio, SpeechSynthesisParams, appConfigSymbol, IPause } from '@christianriedl/utils';
4
4
 
5
5
  const props = defineProps<{ text: string, language?: string, autostart?: boolean }>();
6
6
 
@@ -12,7 +12,7 @@
12
12
  const paused = ref(false);
13
13
  const ended = ref(true);
14
14
  let pause: IPause;
15
- const params: SpeechInterfaceParams = {
15
+ const params = reactive<SpeechSynthesisParams>({
16
16
  voiceName: appConfig.localStorage.getItemString("ttsVoice", ""),
17
17
  pitch: appConfig.localStorage.getItemNumber("ttsPitch", 10) / 10,
18
18
  rate: appConfig.localStorage.getItemNumber("ttsRate", 10) / 10,
@@ -23,7 +23,7 @@
23
23
  paused.value = pause.paused;
24
24
  ended.value = !pause.running;
25
25
  }
26
- }
26
+ });
27
27
 
28
28
  async function onPlay() {
29
29
  if (pause && pause.paused) {
@@ -46,14 +46,14 @@
46
46
  pause.stop();
47
47
  }
48
48
  function onVoiceChange() {
49
- appConfig.localStorage.setItem("ttsVoice", voiceName.value);
50
- voice.value = voices.value.find((v) => v.name == voiceName.value)!;
49
+ appConfig.localStorage.setItem("ttsVoice", params.voiceName!);
50
+ voice.value = voices.value.find((v) => v.name == params.voiceName)!;
51
51
  }
52
52
  function onPitchChange() {
53
- appConfig.localStorage.setItem("ttsPitch", Math.floor (pitch.value * 10));
53
+ appConfig.localStorage.setItem("ttsPitch", Math.floor (params.pitch! * 10));
54
54
  }
55
55
  function onRateChange() {
56
- appConfig.localStorage.setItem("ttsRate", Math.floor(rate.value * 10));
56
+ appConfig.localStorage.setItem("ttsRate", Math.floor(params.rate! * 10));
57
57
  }
58
58
  async function onSettings() {
59
59
  configure.value = !configure.value;
@@ -85,7 +85,7 @@
85
85
  </v-row>
86
86
  <v-row v-if="configure" dense>
87
87
  <v-col cols="12">
88
- <v-select density="compact" v-model="voiceName"
88
+ <v-select density="compact" v-model="params.voiceName"
89
89
  item-title="name"
90
90
  :items="voices"
91
91
  persistent-hint
@@ -96,11 +96,11 @@
96
96
  </v-row>
97
97
  <v-row v-if="configure" dense>
98
98
  <v-col cols="6">
99
- <v-slider v-model="pitch" label="Pitch" density="compact" min="0.5" max="2" step="0.1"
99
+ <v-slider v-model="params.pitch" label="Pitch" density="compact" min="0.5" max="2" step="0.1"
100
100
  @update:modelValue="onPitchChange"></v-slider>
101
101
  </v-col>
102
102
  <v-col cols="6">
103
- <v-slider v-model="rate" label="Rate" density="compact" min="0.5" max="2" step="0.1"
103
+ <v-slider v-model="params.rate" label="Rate" density="compact" min="0.5" max="2" step="0.1"
104
104
  @update:modelValue="onRateChange"></v-slider>
105
105
  </v-col>
106
106
  </v-row>