@atlasauth/vue 0.1.3 → 0.1.5

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
@@ -1,21 +1,21 @@
1
- # @atlas/vue
1
+ # @atlasauth/vue
2
2
 
3
3
  The official Atlas SDK for Vue 3 — the framework peer of
4
- [`@atlas/react`](../react). It reuses the framework-agnostic
5
- [`@atlas/js`](../js) client for every API call and the shared
6
- [`@atlas/authz`](../authz) primitive for permission checks, and mirrors the web
4
+ [`@atlasauth/react`](../react). It reuses the framework-agnostic
5
+ [`@atlasauth/js`](../js) client for every API call and the shared
6
+ [`@atlasauth/authz`](../authz) primitive for permission checks, and mirrors the web
7
7
  surface as idiomatic Vue Composition API: a plugin, `Ref`/`computed`-based
8
8
  composables, and components that render in your host DOM (no iframe, so
9
9
  Tailwind/CSS just works).
10
10
 
11
- Like `@atlas/js`'s web binding, the session lives in an **HttpOnly cookie** the
11
+ Like `@atlasauth/js`'s web binding, the session lives in an **HttpOnly cookie** the
12
12
  browser sends automatically; the short-lived JWT is held only in memory for the
13
13
  life of the tab. Nothing is written to `localStorage`.
14
14
 
15
15
  ## Install
16
16
 
17
17
  ```sh
18
- npm install @atlas/vue
18
+ npm install @atlasauth/vue
19
19
  # peer you already have in a Vue 3 app:
20
20
  # vue >= 3.3
21
21
  ```
@@ -28,14 +28,14 @@ appearance tokens onto the document root as CSS variables.
28
28
 
29
29
  ```ts
30
30
  import { createApp } from 'vue';
31
- import { createAtlas } from '@atlas/vue';
31
+ import { createAtlas } from '@atlasauth/vue';
32
32
  import App from './App.vue';
33
33
 
34
34
  createApp(App)
35
35
  .use(
36
36
  createAtlas({
37
37
  publishableKey: 'pk_live_…',
38
- // frontendApi: 'https://your-instance.fapi.atlasauth.net', // optional FAPI origin
38
+ // frontendApi: 'https://your-instance-fapi.atlasauth.net', // optional FAPI origin
39
39
  // appearance: { baseTheme: 'dark', elements: { formButtonPrimary: 'rounded-xl' } },
40
40
  // localization: myCatalog,
41
41
  }),
@@ -51,7 +51,7 @@ state is reactive (`Ref` / `computed`).
51
51
 
52
52
  ```vue
53
53
  <script setup lang="ts">
54
- import { useUser, useAuth, useSession, useOrganization } from '@atlas/vue';
54
+ import { useUser, useAuth, useSession, useOrganization } from '@atlasauth/vue';
55
55
 
56
56
  const { isLoaded, isSignedIn, user } = useUser();
57
57
  const { userId, orgRole, getToken, signOut, has } = useAuth();
@@ -98,7 +98,7 @@ import {
98
98
  Protect,
99
99
  SignIn,
100
100
  UserButton,
101
- } from '@atlas/vue';
101
+ } from '@atlasauth/vue';
102
102
  </script>
103
103
 
104
104
  <template>
@@ -138,7 +138,7 @@ request is what actually stops them acting.
138
138
 
139
139
  ## Theming
140
140
 
141
- The `appearance` option mirrors `@atlas/react`: design tokens (`variables`),
141
+ The `appearance` option mirrors `@atlasauth/react`: design tokens (`variables`),
142
142
  per-element class overrides (`elements`), and prebuilt `baseTheme`s (`default`,
143
143
  `dark`, `neobrutalist`). Overrides are **appended** to our base classes, so a
144
144
  Tailwind class you add makes a rounder button — not an unstyled one.
@@ -152,9 +152,9 @@ renders.
152
152
  ## Testing
153
153
 
154
154
  ```sh
155
- pnpm --filter @atlas/vue test # vitest + @vue/test-utils (happy-dom)
156
- pnpm --filter @atlas/vue typecheck # tsc --noEmit
157
- pnpm --filter @atlas/vue build # tsc -> dist
155
+ pnpm --filter @atlasauth/vue test # vitest + @vue/test-utils (happy-dom)
156
+ pnpm --filter @atlasauth/vue typecheck # tsc --noEmit
157
+ pnpm --filter @atlasauth/vue build # tsc -> dist
158
158
  ```
159
159
 
160
160
  ## License
@@ -1,5 +1,6 @@
1
1
  import { type ComputedRef, type ShallowRef } from 'vue';
2
2
  import type { ProviderToken } from '@atlasauth/js';
3
+ import type { AuthStatus } from './plugin';
3
4
  import { type ProtectCondition } from './protect';
4
5
  import type { AtlasOrganizationMembership, AtlasSession, AtlasUser } from './types';
5
6
  /**
@@ -31,6 +32,10 @@ export declare function useSession(): {
31
32
  export declare function useAuth(): {
32
33
  isLoaded: ComputedRef<boolean>;
33
34
  isSignedIn: ComputedRef<boolean>;
35
+ /** Three-state auth status (`loading` | `signed_in` | `signed_out`); same source as isLoaded/isSignedIn. */
36
+ status: ShallowRef<AuthStatus>;
37
+ /** The active session, or null while loading or signed out. */
38
+ session: ShallowRef<AtlasSession | null>;
34
39
  userId: ComputedRef<string | null>;
35
40
  sessionId: ComputedRef<string | null>;
36
41
  orgId: ComputedRef<string | null>;
@@ -34,10 +34,12 @@ function useSession() {
34
34
  };
35
35
  }
36
36
  function useAuth() {
37
- const { status, claims, getToken, getProviderToken, signOut } = (0, context_1.useAtlas)();
37
+ const { status, session, claims, getToken, getProviderToken, signOut } = (0, context_1.useAtlas)();
38
38
  return {
39
39
  isLoaded: (0, vue_1.computed)(() => status.value !== 'loading'),
40
40
  isSignedIn: (0, vue_1.computed)(() => status.value === 'signed_in'),
41
+ status,
42
+ session,
41
43
  userId: (0, vue_1.computed)(() => claims.value?.sub ?? null),
42
44
  sessionId: (0, vue_1.computed)(() => claims.value?.sid ?? null),
43
45
  orgId: (0, vue_1.computed)(() => claims.value?.org_id ?? null),
@@ -1 +1 @@
1
- {"version":3,"file":"composables.js","sourceRoot":"","sources":["../src/composables.ts"],"names":[],"mappings":";;AAiBA,0BAmBC;AAED,gCASC;AAED,0BA4BC;AAED,0CAmBC;AAlGD,6BAAkE;AAElE,uCAAqC;AACrC,uCAA4D;AAG5D;;;;;;;;;GASG;AAEH,SAAgB,OAAO;IAYrB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,IAAA,kBAAQ,GAAE,CAAC;IACtD,OAAO;QACL,QAAQ,EAAE,IAAA,cAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;QACpD,UAAU,EAAE,IAAA,cAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC;QACxD,IA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,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAA,kBAAQ,GAAE,CAAC;IAC1E,MAAM,MAAM,GAAG,IAAA,cAAQ,EACrB,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,IAAI,CACxF,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,IAAA,cAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;QACpD,YAAY,EAAE,IAAA,cAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,IAAI,IAAI,CAAC;QAChE,UAAU,EAAE,MAAM;QAClB,WAAW;QACX,SAAS,EAAE,qBAAqB;KACjC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlasauth/vue",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {
7
- "@atlasauth/js": "0.1.9",
8
- "@atlasauth/authz": "0.1.1"
7
+ "@atlasauth/authz": "0.1.1",
8
+ "@atlasauth/js": "0.4.0"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "vue": ">=3.3"