@fy-/fws-vue 0.0.908 → 0.0.910

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.
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { ref } from "vue";
2
+ import { ref, watchEffect } from "vue";
3
3
  import { useRoute } from "vue-router";
4
4
  import type { Component } from "vue";
5
- import { useRest } from "../../rest";
6
- import { LazyHead, useSeo } from "../../seo";
5
+ import { useRest } from "../../composables/rest";
6
+ import { LazyHead, useSeo } from "../../composables/seo";
7
7
  import type { BreadcrumbLink } from "../../types";
8
8
  import DefaultBreadcrumb from "../ui/DefaultBreadcrumb.vue";
9
9
 
@@ -15,11 +15,15 @@ const props = withDefaults(
15
15
  baseBreadcrumb?: BreadcrumbLink[];
16
16
  showImage?: boolean;
17
17
  showPreview?: boolean;
18
+ showTitle?: boolean;
19
+ postValue?: any;
18
20
  }>(),
19
21
  {
20
22
  baseBreadcrumb: () => [],
21
23
  showImage: true,
22
24
  showPreview: true,
25
+ showTitle: true,
26
+ postValue: () => undefined,
23
27
  },
24
28
  );
25
29
 
@@ -29,10 +33,12 @@ const route = useRoute();
29
33
  const seo = ref<LazyHead>({});
30
34
  const is404 = ref(false);
31
35
  const getBlogPost = async () => {
32
- const data = await rest(
33
- `Cms/${props.cmsAlias}/Post/${route.params.slug}`,
34
- "GET",
35
- );
36
+ let data: any = undefined;
37
+ if (!props.postValue) {
38
+ data = await rest(`Cms/${props.cmsAlias}/Post/${route.params.slug}`, "GET");
39
+ } else {
40
+ data = props.postValue;
41
+ }
36
42
  if (data && data.result == "success") {
37
43
  post.value = data.data;
38
44
  seo.value.title = post.value.Title;
@@ -59,6 +65,9 @@ const getBlogPost = async () => {
59
65
  }
60
66
  };
61
67
  await getBlogPost();
68
+ watchEffect(() => {
69
+ getBlogPost();
70
+ });
62
71
  useSeo(seo);
63
72
  </script>
64
73
  <template>
@@ -83,7 +92,7 @@ useSeo(seo);
83
92
  v-if="post.CoverUUID"
84
93
  :content="`https://s.nocachenocry.com/${post.CoverUUID}?vars=format=webp:resize=512x512`"
85
94
  />
86
- <div class="py-4 px-4 max-w-6xl mx-auto">
95
+ <div class="py-4 px-4 max-w-6xl mx-auto" v-if="showTitle">
87
96
  <h1
88
97
  class="mb-4 text-4xl tracking-tight font-extrabold text-center text-fv-neutral-900 dark:text-white"
89
98
  >
@@ -7,8 +7,8 @@ import {
7
7
  } from "@heroicons/vue/24/solid";
8
8
  import DefaultPaging from "../ui/DefaultPaging.vue";
9
9
  import DefaultInput from "../ui/DefaultInput.vue";
10
- import { useEventBus } from "../../event-bus";
11
- import { useRest } from "../../rest";
10
+ import { useEventBus } from "../../composables/event-bus";
11
+ import { useRest } from "../../composables/rest";
12
12
  import { useRoute } from "vue-router";
13
13
  import { useStorage } from "@vueuse/core";
14
14
  interface DefaultStringObject {
@@ -3,8 +3,8 @@ import useVuelidate from "@vuelidate/core";
3
3
  import { reactive } from "vue";
4
4
  import { onMounted } from "vue";
5
5
  import { onUnmounted } from "vue";
6
- import { useTranslation } from "../../translations";
7
- import { useEventBus } from "../../event-bus";
6
+ import { useTranslation } from "../../composables/translations";
7
+ import { useEventBus } from "../../composables/event-bus";
8
8
  import DefaultDateSelection from "../ui/DefaultDateSelection.vue";
9
9
  import DefaultInput from "../ui/DefaultInput.vue";
10
10
 
@@ -2,10 +2,10 @@
2
2
  import { ref, onMounted } from "vue";
3
3
  import type { KlbFlowData, KlbUserFlowField } from "@fy-/fws-types";
4
4
  import { useRoute, useRouter } from "vue-router";
5
- import { useTranslation } from "../../translations";
6
- import { useEventBus } from "../../event-bus";
5
+ import { useTranslation } from "../../composables/translations";
6
+ import { useEventBus } from "../../composables/event-bus";
7
7
  import { useUserStore } from "../../stores/user";
8
- import { useRest, APIResult } from "../../rest";
8
+ import { useRest, APIResult } from "../../composables/rest";
9
9
  import DefaultInput from "../ui/DefaultInput.vue";
10
10
  import { ClientOnly } from "../ssr/ClientOnly";
11
11
  const rest = useRest();
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, onMounted, onUnmounted } from "vue";
3
3
  import { ExclamationCircleIcon } from "@heroicons/vue/24/solid";
4
- import { useEventBus } from "../../event-bus";
4
+ import { useEventBus } from "../../composables/event-bus";
5
5
  import DefaultModal from "./DefaultModal.vue";
6
6
 
7
7
  const eventBus = useEventBus();
@@ -2,7 +2,7 @@
2
2
  import { LinkIcon } from "@heroicons/vue/24/solid";
3
3
  import { computed, ref, toRef } from "vue";
4
4
  import type { ErrorObject } from "@vuelidate/core";
5
- import { useTranslation } from "../../translations";
5
+ import { useTranslation } from "../../composables/translations";
6
6
  type modelValueType = string | number | string[] | undefined;
7
7
  type checkboxValueType = any[] | Set<any> | undefined | boolean;
8
8
  const props = withDefaults(
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted, onUnmounted, ref } from "vue";
3
- import type { Component } from "vue";
4
- import { useEventBus } from "../../event-bus";
3
+ import { useEventBus } from "../../composables/event-bus";
5
4
 
6
5
  const props = withDefaults(
7
6
  defineProps<{
@@ -32,18 +31,16 @@ onUnmounted(() => {
32
31
  <template>
33
32
  <div
34
33
  v-if="loading || force"
35
- class="flex-grow flex flex-col bg-fv-neutral-800/[.8] items-center justify-center absolute inset-0 z-50"
34
+ class="flex-grow flex flex-col bg-fv-neutral-200/[.8] dark:bg-fv-neutral-800/[.8] items-center justify-center absolute inset-0 z-50"
36
35
  >
37
- <div class="text-center animate-pulse w-40 h-40 p-4 rounded-full shadow">
38
- <div class="relative flex flex-col items-center">
39
- <div class="flex items-center justify-center flex-col">
40
- <img
41
- :src="image"
42
- :alt="$t('global_loading')"
43
- class="w-full h-full relative"
44
- />
45
- </div>
46
- </div>
36
+ <div
37
+ class="text-center animate-pulse w-40 h-40 p-6 rounded-full shadow bg-fv-neutral-50 dark:bg-fv-neutral-900 flex items-center justify-center"
38
+ >
39
+ <img
40
+ :src="image"
41
+ :alt="$t('global_loading')"
42
+ class="w-full h-full relative"
43
+ />
47
44
  </div>
48
45
  </div>
49
46
  </template>
@@ -7,7 +7,7 @@ import {
7
7
  } from "@headlessui/vue";
8
8
  import { ref, onMounted, onUnmounted, h } from "vue";
9
9
  import { XCircleIcon } from "@heroicons/vue/24/solid";
10
- import { useEventBus } from "../../event-bus";
10
+ import { useEventBus } from "../../composables/event-bus";
11
11
  const props = withDefaults(
12
12
  defineProps<{
13
13
  id: string;
@@ -8,8 +8,8 @@ import {
8
8
  onMounted,
9
9
  computed,
10
10
  } from "vue";
11
- import type { APIPaging } from "../../rest";
12
- import { useEventBus } from "../../event-bus";
11
+ import type { APIPaging } from "../../composables/rest";
12
+ import { useEventBus } from "../../composables/event-bus";
13
13
  import { useServerRouter } from "../../stores/serverRouter";
14
14
  import { useRoute } from "vue-router";
15
15
  import { useFyHead } from "@fy-/head";
@@ -1,5 +1,5 @@
1
1
  import { RestMethod, RestParams, getMode, rest, stringHash } from "@fy-/fws-js";
2
- import { useRestStore } from "./stores/rest";
2
+ import { useRestStore } from "../stores/rest";
3
3
  import { isServerRendered } from "./ssr";
4
4
  import { useEventBus } from "./event-bus";
5
5
 
@@ -2,7 +2,7 @@ import { Router } from "vue-router";
2
2
  import { Pinia } from "pinia";
3
3
  import { renderToString } from "@vue/server-renderer";
4
4
  import { getInitialState, getPath, getURL, getUUID } from "@fy-/fws-js";
5
- import { useServerRouter } from "./stores/serverRouter";
5
+ import { useServerRouter } from "../stores/serverRouter";
6
6
 
7
7
  export interface SSRResult {
8
8
  initial: {
package/index.ts CHANGED
@@ -3,10 +3,14 @@ import i18next from "i18next";
3
3
  import mitt from "mitt";
4
4
  import { Emitter } from "mitt";
5
5
  import { useServerRouter } from "./stores/serverRouter";
6
- import { useEventBus, Events } from "./event-bus";
7
- import { i18nextPromise, useTranslation } from "./translations";
8
- import { initVueClient, initVueServer, isServerRendered } from "./ssr";
9
- import { useSeo } from "./seo";
6
+ import { useEventBus, Events } from "./composables/event-bus";
7
+ import { i18nextPromise, useTranslation } from "./composables/translations";
8
+ import {
9
+ initVueClient,
10
+ initVueServer,
11
+ isServerRendered,
12
+ } from "./composables/ssr";
13
+ import { useSeo } from "./composables/seo";
10
14
  import { useUserStore, useUserCheck } from "./stores/user";
11
15
  import { ClientOnly } from "./components/ssr/ClientOnly";
12
16
  import {
@@ -15,8 +19,8 @@ import {
15
19
  formatDate,
16
20
  formatDatetime,
17
21
  formatTimeago,
18
- } from "./templating";
19
- import { useRest } from "./rest";
22
+ } from "./composables/templating";
23
+ import { useRest } from "./composables/rest";
20
24
  export * from "./stores/serverRouter";
21
25
 
22
26
  // Components/UI/Transitions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "0.0.908",
3
+ "version": "0.0.910",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {
package/stores/rest.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineStore } from "pinia";
2
- import { APIResult } from "../rest";
2
+ import { APIResult } from "../composables/rest";
3
3
 
4
4
  type SharedState = {
5
5
  results: Record<number, APIResult | undefined>;
package/stores/user.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineStore } from "pinia";
2
2
  import type { User } from "@fy-/fws-types";
3
- import { APIResult } from "../rest";
3
+ import { APIResult } from "../composables/rest";
4
4
  import { rest } from "@fy-/fws-js";
5
5
  import { computed } from "vue";
6
6
  import { RouteLocation, useRouter } from "vue-router";
File without changes
File without changes
File without changes