@christianriedl/media 1.0.76 → 1.0.77

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/media",
3
- "version": "1.0.76",
3
+ "version": "1.0.77",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -18,8 +18,8 @@
18
18
  "author": "Christian Riedl",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@christianriedl/utils": "^1.0.83",
22
- "@christianriedl/rest": "^1.0.48",
21
+ "@christianriedl/utils": "^1.0.84",
22
+ "@christianriedl/rest": "^1.0.49",
23
23
  "@christianriedl/epg": "^1.0.27"
24
24
  },
25
25
  "devDependencies": {
@@ -6,7 +6,7 @@
6
6
  const props = defineProps<{ folder: IMediaFolder }>();
7
7
  const emits = defineEmits<{ (e: 'close'): void }>();
8
8
 
9
- const title = `Download '${props.folder.Name}' (${props.folder.Files.length} Bilder)`
9
+ const title = `Download '${props.folder.Name}' (${props.folder.ChildCount} Bilder)`
10
10
  const getMedia = inject(getMediaSymbol)!;
11
11
  const mediaService = getMedia();
12
12
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { reactive, inject, ref, computed, onMounted, onUnmounted } from 'vue';
2
+ import { reactive, inject, ref, computed, onMounted, onUnmounted, StyleValue } from 'vue';
3
3
  import { useRouter } from 'vue-router';
4
4
  import { Helper, IValueText, IAppState, appStateSymbol } from '@christianriedl/utils';
5
5
  import { IMediaInstanceService, getMediaInstanceSymbol } from '@christianriedl/media';
@@ -11,7 +11,7 @@
11
11
  const instanceService = getMediaInstanceService();
12
12
  const info = instanceService.instanceInformation;
13
13
  const stat = instanceService.scanStatistics;
14
- const heightStyle = computed(() => { return { height: appState!.bodyHeight.value + 'px' } });
14
+ const heightStyle = computed<StyleValue>(() => { return { height: appState!.bodyHeight.value + 'px' } });
15
15
 
16
16
  const listtime = computed(() => unixTimeToString(info.listModificationTime));
17
17
  const roottime = computed(() => unixTimeToString(info.rootModificationTime));
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
2
+ import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import { IAppState, Helper, EDevice, EScope, appStateSymbol } from '@christianriedl/utils';
4
4
  import { Authorize, authorizeSymbol } from '@christianriedl/rest';
5
5
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IAudioFile, MediaService, EPlayState, PlayerService, getMediaSymbol, getPlayerSymbol } from '@christianriedl/media';
@@ -11,7 +11,7 @@
11
11
  const mediaService = getMediaService();
12
12
  const getPlayerService = inject(getPlayerSymbol)!;
13
13
  const playerService = getPlayerService();
14
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
14
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
15
15
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
16
16
  const supportsLocalMedia = authorize.checkScope(EScope.Media);
17
17
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onBeforeMount, onUnmounted, nextTick, watch } from 'vue';
2
+ import { inject, ref, reactive, computed, onMounted, onBeforeMount, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
5
  import { IAppState, IAppConfig, EDevice, EDirection, Dictionary, Helper, appStateSymbol, appConfigSymbol } from '@christianriedl/utils';
@@ -12,7 +12,7 @@
12
12
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
13
13
  const getMediaService = inject(getMediaSymbol)!;
14
14
  const mediaService = getMediaService();
15
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
15
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
16
16
  const isMobile = appState.isMobile;
17
17
  const url = ref('');
18
18
  const infoDialog = ref(false);
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
2
+ import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter } from 'vue-router';
5
5
  import { IAppState, IAppConfig, EDevice, EBrowser, appStateSymbol, appConfigSymbol, Helper } from '@christianriedl/utils';
@@ -12,7 +12,7 @@
12
12
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
13
13
  const getMediaService = inject(getMediaSymbol)!;
14
14
  const mediaService = getMediaService();
15
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
15
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
16
16
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
17
17
  const router = useRouter();
18
18
  const open = ref<string[]>([]);
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
2
+ import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter } from 'vue-router';
5
5
  import { IAppState, EScope, appStateSymbol } from '@christianriedl/utils';
@@ -11,7 +11,7 @@
11
11
  const mediaService = getMediaService();
12
12
  const getDvbService = inject(getDvbServiceSymbol)!;
13
13
  const dvbService = getDvbService()!;
14
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
14
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
15
15
  const isMobile = appState.isMobile;
16
16
  const router = useRouter();
17
17
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, computed, onMounted } from 'vue';
2
+ import { inject, ref, computed, onMounted, StyleValue } from 'vue';
3
3
  import { useRouter, useRoute } from 'vue-router';
4
4
  import { IAppState, appStateSymbol, IAppConfig, appConfigSymbol, Helper } from '@christianriedl/utils';
5
5
  import { EOrientation, EMediaType, IMediaFolder, IPictureFile, MediaService, IMediaAppConfig, getMediaSymbol } from '@christianriedl/media';
@@ -9,7 +9,7 @@
9
9
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
10
10
  const getMediaService = inject(getMediaSymbol)!;
11
11
  const mediaService = getMediaService();
12
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
12
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
13
13
  const isMobile = appState.isMobile;
14
14
  const router = useRouter();
15
15
  const route = useRoute();
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
2
+ import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import { useRouter } from 'vue-router';
4
4
  import { IAppState, EDevice, EScope, appStateSymbol } from '@christianriedl/utils';
5
5
  import { Authorize, authorizeSymbol } from '@christianriedl/rest';
@@ -18,7 +18,7 @@
18
18
  const showRenderer = ref(false);
19
19
  const supportsLocalMedia = authorize.checkScope(EScope.Media);
20
20
 
21
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
21
+ const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
22
22
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
23
23
  const router = useRouter();
24
24
 
@@ -1,76 +0,0 @@
1
- <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
3
- import { useRouter } from 'vue-router';
4
- import { IAppState, EDevice, appStateSymbol } from '@christianriedl/utils';
5
- import { getMediaSymbol } from '@christianriedl/media';
6
-
7
- const appState = inject(appStateSymbol)!;
8
- const getMediaService = inject(getMediaSymbol)!;
9
- const mediaService = getMediaService();
10
- const stack = reactive<string[]>([]);
11
- const backVisible = ref(false);
12
- const directoryNames = reactive<string[]>([]);
13
- const fileNames = reactive<string[]>([]);
14
- const path = computed(() => stack.join('/'));
15
- const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
16
-
17
- window.addEventListener('popstate', onPopState);
18
-
19
- function onPopState(event: any) {
20
- if (event.state && event.state.noBackExitsApp && backVisible.value) {
21
- event.preventDefault();
22
- listBack();
23
- }
24
- }
25
- onUnmounted(() => {
26
- window.removeEventListener('popstate', onPopState);
27
- while (window.history.state && window.history.state.noBackExitsApp)
28
- window.history.back();
29
- });
30
- onMounted(async () => {
31
- mediaService.log.trace('Documents created');
32
- await getItems('');
33
- })
34
- async function getItems(name: string) : Promise<boolean> {
35
- if (name)
36
- stack.splice(stack.length, 0, name);
37
- const fullPath = stack.join('/');
38
- const directories = await mediaService.getDirectories(fullPath);
39
- directoryNames.splice(0, directoryNames.length, ...directories);
40
- const files = await mediaService.getFiles(fullPath);
41
- fileNames.splice(0, fileNames.length, ...files);
42
- mediaService.log.trace(`At ${fullPath} : ${directories.length} directories, ${files.length} files`);
43
- backVisible.value = stack.length > 0;
44
- window.history.pushState({ noBackExitsApp: true }, '')
45
- return true;
46
- }
47
- async function onSelect(name: string) {
48
- await getItems(name);
49
- }
50
- async function listBack() {
51
- if (stack.length > 0) {
52
- stack.splice(stack.length - 1, 1);
53
- await getItems('');
54
- }
55
- }
56
- function toUrl(name: string): string {
57
- return mediaService.getFileUrl(stack.join('/') + '/' + name);
58
- }
59
- </script>
60
- <template>
61
- <v-card class="bg-media">
62
- <v-card-title>{{path}}</v-card-title>
63
- <v-list class="bg-media">
64
- <v-list-item v-for="dir in directoryNames" :key="dir" :title="dir" :value="dir" density="compact" @click.stop="onSelect(dir)">
65
- </v-list-item>
66
- <v-list-item v-for="file in fileNames" :key="file" :title="file" :value="file" density="compact" :href="toUrl(file)">
67
- </v-list-item>
68
- </v-list>
69
- <v-card-actions>
70
- <v-btn v-if="backVisible" @click="listBack">
71
- <v-icon size="large" icon="$back" />
72
- </v-btn>
73
- </v-card-actions>
74
- </v-card>
75
- </template>
76
-