@christianriedl/utils 1.0.92 → 1.0.93

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,23 +2,28 @@
2
2
  import { ref, watch } from 'vue'
3
3
  import { useSpeechRecognition } from '@christianriedl/utils';
4
4
 
5
- const props = defineProps<{ lang?: string, maxAlternatives?: number, size?: string, cls?: string, variant?: string }>();
5
+ const props = defineProps<{ lang?: string, maxAlternatives?: number, size?: string, cls?: string, variant?: "elevated" | "outlined" | "flat" | "text" | "tonal" | "plain" | undefined }>();
6
6
  const emits = defineEmits<{
7
7
  (e: 'result', result: string): void,
8
8
  (e: 'listening', isListening: boolean): void,
9
- (e: 'final', visFinal: boolean): void
9
+ (e: 'final', isFinal: boolean): void
10
10
  }>();
11
11
 
12
12
  const sz = props.size ? props.size : "large";
13
- const cls = props.cls ? props.cls : "bg-office";
13
+ const cls = props.cls ? [ props.cls] : ["bg-office"];
14
+ ; /*
15
+ let cls = {};
16
+ if (props.cls)
17
+ cls[props.cls] = true;
18
+ else
19
+ cls["bg-office"] = true;
20
+ */
14
21
  const vari = props.variant ? props.variant : "tonal";
15
22
  const lang = ref('de-AT');
16
- const maxAlternatives = ref(1);
23
+ const maxAlternatives = props.maxAlternatives ? props.maxAlternatives : 1;
17
24
 
18
25
  if (props.lang)
19
26
  lang.value = props.lang;
20
- if (props.maxAlternatives)
21
- maxAlternatives.value = props.maxAlternatives;
22
27
 
23
28
  const speech = useSpeechRecognition({
24
29
  lang,
@@ -33,13 +38,15 @@
33
38
  speech.start()
34
39
  }
35
40
 
36
- const { isListening, isFinal, stop, result } = speech
37
- watch(isListening, isListening => emits("listening", isListening.value));
38
- watch(isFinal, isFinal => emits("final", isFinal.value));
39
- watch(result, result => emits("result", result.value));
41
+ const { isListening, isFinal, stop, result } = speech;
42
+ watch(isListening, isListening => emits("listening", isListening));
43
+ watch(isFinal, isFinal => emits("final", isFinal));
44
+ watch(result, result => emits("result", result));
40
45
  </script>
41
46
 
42
47
  <template>
43
- <v-btn :size="sz" :class="cls" :variant="vari" icon="$microphone" :color="isListening ? 'red' : 'white'", @click="onStart"></v-btn>
48
+ <v-btn :variant="vari" :class="cls" @click="onStart">
49
+ <v-icon :size="sz" icon="$microphone" :color="isListening ? 'error' : 'primary'"></v-icon>
50
+ </v-btn>
44
51
  </template>
45
52