@witchcraft/nuxt-auth 0.1.6 → 0.1.8

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "auth",
3
3
  "configKey": "auth",
4
- "version": "0.1.6",
4
+ "version": "0.1.8",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -6,8 +6,8 @@ type __VLS_Props = {
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
8
  declare var __VLS_19: {
9
- iconClass: string;
10
9
  class: string;
10
+ iconClass: string;
11
11
  };
12
12
  type __VLS_Slots = {} & {
13
13
  extra?: (props: typeof __VLS_19) => any;
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div
3
- class="
4
- flex-1
5
- flex
6
- flex-col
7
- items-center
8
- justify-center
9
- gap-2
10
- "
3
+ :class="twMerge(`
4
+ flex-1
5
+ flex
6
+ flex-col
7
+ items-stretch
8
+ justify-center
9
+ gap-2
10
+ `, $attrs?.class)"
11
11
  >
12
12
  <template
13
13
  v-for="provider in enabledProviders"
@@ -19,40 +19,44 @@
19
19
  v-if="provider"
20
20
  :id="'login-provider-' + provider"
21
21
  type="button"
22
- class="p-2 text-l"
22
+ class="text-l p-2 px-4 [&_label]:justify-start [&_label]:gap-4"
23
23
  :style="styles[provider]"
24
24
  :key="provider"
25
25
  @click="login(provider, loginOptions)"
26
26
  >
27
27
  <WIcon
28
28
  v-if="styles[provider]?.logo"
29
- class="px-2 text-xl"
29
+ class="text-xl"
30
30
  >
31
31
  <component
32
32
  :is="styles[provider]?.logo"
33
33
  />
34
34
  </WIcon>
35
- Sign in / Register with {{ styles[provider]?.name ?? provider }}
35
+ <div>
36
+ Sign in / Register with {{ styles[provider]?.name ?? provider }}
37
+ </div>
36
38
  </WButton>
37
39
  </template>
38
40
  <slot
39
41
  name="extra"
40
- class="p-2 text-l"
41
- icon-class="text-xl px-2"
42
+ icon-class="text-xl"
43
+ class="text-l p-2 px-4 [&_label]:justify-start [&_label]:gap-4"
42
44
  />
43
45
  </div>
44
46
  </template>
45
47
 
46
48
  <script setup>
47
49
  import { useInjectedDarkMode } from "@witchcraft/ui/composables/useInjectedDarkMode";
50
+ import { twMerge } from "@witchcraft/ui/utils/twMerge";
48
51
  import defu from "defu";
49
52
  import { useRuntimeConfig } from "#app";
50
- import { computed } from "#imports";
53
+ import { computed, useAttrs } from "#imports";
51
54
  import { useAuth } from "../composables/useAuth.js";
52
55
  import { providerStyles as baseProviderStyles } from "../core/providerStyles.js";
53
56
  const rc = useRuntimeConfig();
54
57
  const config = rc.public.auth;
55
58
  const enabledProviders = config.enabledProviders;
59
+ const $attrs = useAttrs();
56
60
  const { darkMode: isDark } = useInjectedDarkMode();
57
61
  const props = defineProps({
58
62
  providerStyles: { type: Object, required: false, default: () => ({}) },
@@ -6,8 +6,8 @@ type __VLS_Props = {
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
8
  declare var __VLS_19: {
9
- iconClass: string;
10
9
  class: string;
10
+ iconClass: string;
11
11
  };
12
12
  type __VLS_Slots = {} & {
13
13
  extra?: (props: typeof __VLS_19) => any;
@@ -36,11 +36,12 @@ export const useAuth = ({ handleActions } = {}) => {
36
36
  }
37
37
  async function logout() {
38
38
  setFetchUserOnNavigation();
39
- userData.value = null;
39
+ const wasSemiAuthed = isSemiAuthed.value;
40
40
  await Promise.allSettled(hooks.beforeLogout.map((listener) => listener()));
41
41
  const handled = handleActions?.("logout", getAuthApiRoute(useRuntimeConfig().public, "logout"));
42
+ userData.value = null;
42
43
  if (!handled) {
43
- const res = await $fetch(getAuthApiRoute(useRuntimeConfig().public, "logout"), {
44
+ const res = wasSemiAuthed ? true : await $fetch(getAuthApiRoute(useRuntimeConfig().public, "logout"), {
44
45
  cache: "no-store",
45
46
  method: "post"
46
47
  });
@@ -79,7 +79,7 @@ export default class GithubProvider implements ProviderHandler<"oauth2", "github
79
79
  }
80
80
  export declare const githubProviderStyle: {
81
81
  name: string;
82
- logo: any;
82
+ logo: import("vue").FunctionalComponent<import("vue").SVGAttributes, {}, any, {}>;
83
83
  style: {
84
84
  bg: string;
85
85
  bgDark: string;
@@ -60,7 +60,7 @@ export default class GoogleProvider implements ProviderHandler<"oauth2_pcke", "g
60
60
  }
61
61
  export declare const googleProviderStyle: {
62
62
  name: string;
63
- logo: any;
63
+ logo: import("vue").FunctionalComponent<import("vue").SVGAttributes, {}, any, {}>;
64
64
  style: {
65
65
  bg: string;
66
66
  bgDark: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/nuxt-auth",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Nuxt module for logging.",
5
5
  "repository": "witchcraftjs/nuxt-auth",
6
6
  "license": "MIT",