@providame/vue 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -10,18 +10,30 @@ npm install @providame/vue vue
10
10
 
11
11
  ## Usage
12
12
 
13
- Install the plugin once, then import the CSS for the prebuilt components:
13
+ Install the plugin once, and import the stylesheet:
14
14
 
15
15
  ```ts
16
16
  import { createApp } from 'vue'
17
17
  import { ProvidamePlugin } from '@providame/vue'
18
- import '@providame/vue/style.css'
18
+ import '@providame/vue/style.css' // required — see below
19
19
 
20
20
  createApp(App).use(ProvidamePlugin, {
21
21
  publishableKey: 'pk_test_...',
22
22
  })
23
23
  ```
24
24
 
25
+ > **The stylesheet import is required.** Without it every prebuilt component
26
+ > renders completely unstyled — there is no runtime fallback, and no error to
27
+ > tell you what's wrong.
28
+ >
29
+ > This package ships a real CSS file rather than injecting styles at runtime,
30
+ > so Nuxt and other SSR frameworks can inline it into the document head instead
31
+ > of flashing unstyled content on first paint. `@providame/react` and
32
+ > `@providame/sdk-js` inject at runtime and need no import — this package is
33
+ > the exception, deliberately.
34
+ >
35
+ > In Nuxt, add it to `nuxt.config.ts` instead: `css: ['@providame/vue/style.css']`.
36
+
25
37
  ### Prebuilt components
26
38
 
27
39
  ```vue
@@ -34,6 +46,31 @@ import { SignIn } from '@providame/vue'
34
46
  </template>
35
47
  ```
36
48
 
49
+ ### Modal vs. page usage
50
+
51
+ These components serve two contexts, and the footer link behaves differently
52
+ in each:
53
+
54
+ - **Page** — you render `<SignIn>` at your own `/sign-in` route. Pass
55
+ `sign-up-url` and the footer renders a normal link that navigates.
56
+ - **Modal** — `<SignInButton mode="modal">` handles this for you: the footer
57
+ switches to sign-up *in place*, because navigating would tear the modal down.
58
+
59
+ Rendering these inside your own modal? Attach the switch listener instead of
60
+ passing a URL, and hold the view state yourself:
61
+
62
+ ```vue
63
+ <SignIn v-if="view === 'sign-in'" @switch-to-sign-up="view = 'sign-up'" />
64
+ <SignUp v-else @switch-to-sign-in="view = 'sign-in'" />
65
+ ```
66
+
67
+ The listener takes precedence when both it and a URL are supplied.
68
+
69
+ > `SignInButton` no longer accepts `sign-up-url` (nor `SignUpButton`
70
+ > `sign-in-url`). They had no effect in `mode="redirect"` and produced a
71
+ > modal-destroying navigation in `mode="modal"`. Pass those URLs to
72
+ > `<SignIn>`/`<SignUp>` directly when rendering them as pages.
73
+
37
74
  ### Headless
38
75
 
39
76
  ```ts
@@ -13,8 +13,10 @@ type __VLS_Props = {
13
13
  };
14
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
15
  complete: (session: import("@providame/core").Session) => any;
16
+ switchToSignUp: () => any;
16
17
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
18
  onComplete?: ((session: import("@providame/core").Session) => any) | undefined;
19
+ onSwitchToSignUp?: (() => any) | undefined;
18
20
  }>, {
19
21
  title: string;
20
22
  signUpUrl: string;
@@ -1,7 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  mode?: "modal" | "redirect";
3
3
  signInUrl?: string;
4
- signUpUrl?: string;
5
4
  };
6
5
  declare var __VLS_1: {};
7
6
  type __VLS_Slots = {} & {
@@ -18,8 +18,10 @@ type __VLS_Props = {
18
18
  };
19
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
20
20
  complete: (session: import("@providame/core").Session) => any;
21
+ switchToSignIn: () => any;
21
22
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
22
23
  onComplete?: ((session: import("@providame/core").Session) => any) | undefined;
24
+ onSwitchToSignIn?: (() => any) | undefined;
23
25
  }>, {
24
26
  title: string;
25
27
  signInUrl: string;
@@ -1,7 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  mode?: "modal" | "redirect";
3
3
  signUpUrl?: string;
4
- signInUrl?: string;
5
4
  };
6
5
  declare var __VLS_1: {};
7
6
  type __VLS_Slots = {} & {