@webx-ui/module-auth 0.12.0 → 0.14.0

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.d.ts CHANGED
@@ -13,8 +13,8 @@ export interface AdminsOptions {
13
13
  /** Turns an avatar key into an address. Omitted, rows and forms show initials. */
14
14
  resolveAvatar?: (key: string) => Promise<string | null>;
15
15
  }
16
- /** Which of the four views of the administrators section a route opens. */
17
- export type AdminsView = 'admins' | 'calls' | 'connections' | 'keys';
16
+ /** Which of the five views of the administrators section a route opens. */
17
+ export type AdminsView = 'admins' | 'roles' | 'calls' | 'connections' | 'keys';
18
18
  /**
19
19
  * The administrators, as a section of the panel.
20
20
  *
package/dist/session.d.ts CHANGED
@@ -40,6 +40,17 @@ export interface AuthSession {
40
40
  * a password to rotate.
41
41
  */
42
42
  updateProfile(profile: ProfileInput): Promise<AdminUser>;
43
+ /**
44
+ * Ask for a new sign-in address. Changes nothing: a letter goes to the new address, and the
45
+ * link in it makes the move. Throws `HttpError` with a 422 under `email` where the site sends
46
+ * no mail, the address is taken, or the password is wrong (under `current_password`).
47
+ */
48
+ requestEmailChange(email: string, currentPassword: string): Promise<EmailChangeSent>;
49
+ }
50
+ /** Where the letter went, and how long its link works. */
51
+ export interface EmailChangeSent {
52
+ email: string;
53
+ minutes: number;
43
54
  }
44
55
  /** What somebody may send about themselves. A blank password is "leave it alone". */
45
56
  export interface ProfileInput {
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .wx-login[data-v-3c206e31]{width:100%;max-width:26rem}.wx-login__message[data-v-3c206e31]{margin-block-end:var(--wx-space-4)}.wx-login__remember[data-v-3c206e31]{margin-block-start:calc(-1 * var(--wx-space-12))}.wx-login__reveal[data-v-3c206e31]{display:inline-flex;align-items:center;padding:0;font:inherit;color:var(--wx-text-muted);background:none;border:0;cursor:pointer}.wx-login__reveal[data-v-3c206e31]:hover,.wx-login__reveal[aria-pressed=true][data-v-3c206e31]{color:var(--wx-text-default)}.wx-admin-form{container-type:inline-size}.wx-admin-form__grid{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--wx-space-24)}.wx-admin-form__grid.has-aside{grid-template-columns:200px minmax(0,1fr)}.wx-admin-form__fields{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}@container (max-width: 520px){.wx-admin-form__grid.has-aside{grid-template-columns:minmax(0,1fr)}.wx-admin-form__aside{max-width:200px}}.wx-admin-list,.wx-call-list{min-width:0}.wx-call-list__details{display:flex;flex-direction:column;gap:var(--wx-space-8);padding:var(--wx-space-8) var(--wx-space-16)}.wx-call-list__card-details{margin-top:var(--wx-space-8)}.wx-call-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-call-list__label{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--wx-space-4) var(--wx-space-8)}.wx-call-list__arguments{margin:0;padding:var(--wx-space-8) var(--wx-space-12);max-height:320px;overflow:auto;border:1px solid var(--wx-border-muted);border-radius:var(--wx-radius-sm);background:var(--wx-bg-surface);color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);line-height:var(--wx-font-line-height-relaxed);white-space:pre-wrap;word-break:break-word}.wx-connection-list{min-width:0}.wx-connection-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-connection-list .wx-table__row.is-ended,.wx-connection-list .wx-table__card.is-ended{opacity:.6}.wx-key-dialog{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0;container-type:inline-size}.wx-key-dialog__secret{display:flex;gap:var(--wx-space-8);min-width:0}.wx-key-dialog__secret>:first-child{flex:1 1 auto;min-width:0}@container (max-width: 420px){.wx-key-dialog__secret{flex-direction:column}}.wx-key-list{min-width:0}.wx-key-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-key-list .wx-table__row.is-ended,.wx-key-list .wx-table__card.is-ended{opacity:.6}.wx-content-rules[data-v-55be157e]{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}.wx-content-rules__foot[data-v-55be157e]{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--wx-space-12)}.wx-connect[data-v-19a489e0]{display:flex;flex-direction:column;gap:var(--wx-space-24);min-width:0}.wx-connect__lead[data-v-19a489e0]{max-width:68ch}.wx-connect__row[data-v-19a489e0]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wx-space-12)}.wx-connect__url[data-v-19a489e0]{flex:1 1 260px;min-width:0;padding:var(--wx-space-10) var(--wx-space-12);border-radius:var(--wx-radius-sm);background:var(--wx-bg-subtle);color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-md);word-break:break-all}.wx-connect__section[data-v-19a489e0]{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}.wx-connect__steps[data-v-19a489e0]{display:flex;flex-direction:column;gap:var(--wx-space-8);margin:0;padding-left:var(--wx-space-24);color:var(--wx-text-default);font-size:var(--wx-font-size-sm);line-height:var(--wx-font-line-height-relaxed)}.wx-connect__snippet[data-v-19a489e0]{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--wx-space-8);padding:var(--wx-space-12);border-radius:var(--wx-radius-sm);background:var(--wx-bg-subtle)}.wx-connect__snippet pre[data-v-19a489e0]{flex:1 1 240px;margin:0;min-width:0;color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);line-height:var(--wx-font-line-height-relaxed);white-space:pre-wrap;word-break:break-all}.wx-connect__links[data-v-19a489e0]{display:flex;flex-wrap:wrap;gap:var(--wx-space-12)}.wx-profile-host[data-v-9583a67a]{container-type:inline-size}.wx-profile[data-v-9583a67a]{display:flex;gap:var(--wx-space-16)}.wx-profile__aside[data-v-9583a67a]{flex:0 0 180px}.wx-profile__fields[data-v-9583a67a]{display:flex;flex-direction:column;gap:var(--wx-space-12);flex:1 1 auto;min-width:0}@container (max-width: 480px){.wx-profile[data-v-9583a67a]{flex-direction:column}.wx-profile__aside[data-v-9583a67a]{flex:none}}.wx-user-menu__theme[data-v-31b12be6]{padding:var(--wx-space-2) var(--wx-space-8) var(--wx-space-6)}.wx-user-menu__trigger[data-v-31b12be6]{display:inline-flex;padding:0;border:none;border-radius:var(--wx-radius-full);background:transparent;cursor:pointer;transition:opacity var(--wx-duration-fast) var(--wx-easing-standard)}.wx-user-menu__trigger[data-v-31b12be6]:hover{opacity:.85}.wx-user-menu__trigger[data-v-31b12be6]:focus-visible{outline:2px solid var(--wx-border-focus);outline-offset:2px}.wx-user-menu__trigger--named[data-v-31b12be6]{align-items:center;gap:var(--wx-space-8);width:100%;min-width:0;padding:var(--wx-space-4);border-radius:var(--wx-radius-control);text-align:start}.wx-user-menu__trigger--named[data-v-31b12be6]:hover{opacity:1;background:var(--wx-bg-subtle)}.wx-user-menu__who[data-v-31b12be6]{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;font-family:var(--wx-font-family-sans);line-height:1.3}.wx-user-menu__name[data-v-31b12be6],.wx-user-menu__email[data-v-31b12be6]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wx-user-menu__name[data-v-31b12be6]{color:var(--wx-text-default);font-size:var(--wx-font-size-sm);font-weight:var(--wx-font-weight-medium)}.wx-user-menu__email[data-v-31b12be6]{color:var(--wx-text-muted);font-size:var(--wx-font-size-xs)}.wx-user-menu__chevron[data-v-31b12be6]{flex:none;color:var(--wx-text-muted)}
1
+ .wx-login[data-v-3c206e31]{width:100%;max-width:26rem}.wx-login__message[data-v-3c206e31]{margin-block-end:var(--wx-space-4)}.wx-login__remember[data-v-3c206e31]{margin-block-start:calc(-1 * var(--wx-space-12))}.wx-login__reveal[data-v-3c206e31]{display:inline-flex;align-items:center;padding:0;font:inherit;color:var(--wx-text-muted);background:none;border:0;cursor:pointer}.wx-login__reveal[data-v-3c206e31]:hover,.wx-login__reveal[aria-pressed=true][data-v-3c206e31]{color:var(--wx-text-default)}.wx-admin-form{container-type:inline-size}.wx-admin-form__grid{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--wx-space-24)}.wx-admin-form__grid.has-aside{grid-template-columns:200px minmax(0,1fr)}.wx-admin-form__fields{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}@container (max-width: 520px){.wx-admin-form__grid.has-aside{grid-template-columns:minmax(0,1fr)}.wx-admin-form__aside{max-width:200px}}.wx-admin-list,.wx-call-list{min-width:0}.wx-call-list__details{display:flex;flex-direction:column;gap:var(--wx-space-8);padding:var(--wx-space-8) var(--wx-space-16)}.wx-call-list__card-details{margin-top:var(--wx-space-8)}.wx-call-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-call-list__label{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--wx-space-4) var(--wx-space-8)}.wx-call-list__arguments{margin:0;padding:var(--wx-space-8) var(--wx-space-12);max-height:320px;overflow:auto;border:1px solid var(--wx-border-muted);border-radius:var(--wx-radius-sm);background:var(--wx-bg-surface);color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);line-height:var(--wx-font-line-height-relaxed);white-space:pre-wrap;word-break:break-word}.wx-connection-list{min-width:0}.wx-connection-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-connection-list .wx-table__row.is-ended,.wx-connection-list .wx-table__card.is-ended{opacity:.6}.wx-key-dialog{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0;container-type:inline-size}.wx-key-dialog__secret{display:flex;gap:var(--wx-space-8);min-width:0}.wx-key-dialog__secret>:first-child{flex:1 1 auto;min-width:0}@container (max-width: 420px){.wx-key-dialog__secret{flex-direction:column}}.wx-key-list{min-width:0}.wx-key-list__glyph{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--wx-text-muted);background:var(--wx-bg-subtle)}.wx-key-list .wx-table__row.is-ended,.wx-key-list .wx-table__card.is-ended{opacity:.6}.wx-role-form{container-type:inline-size;display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}.wx-role-form__names{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:var(--wx-space-12)}.wx-role-form__matrix{display:flex;flex-direction:column;border:1px solid var(--wx-border-default);border-radius:var(--wx-radius-md)}.wx-role-form__row{display:grid;grid-template-columns:minmax(0,200px) minmax(0,1fr);gap:var(--wx-space-12);padding:var(--wx-space-12) var(--wx-space-16)}.wx-role-form__row+.wx-role-form__row{border-top:1px solid var(--wx-border-muted)}.wx-role-form__cells{display:flex;flex-wrap:wrap;gap:var(--wx-space-8) var(--wx-space-24);min-width:0}.wx-role-form__label{display:inline-flex;flex-direction:column;min-width:0}.wx-role-form__code{font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);color:var(--wx-text-muted);overflow-wrap:anywhere}@container (max-width: 560px){.wx-role-form__names,.wx-role-form__row{grid-template-columns:minmax(0,1fr)}.wx-role-form__row{gap:var(--wx-space-8);padding:var(--wx-space-12)}}.wx-role-list{min-width:0}.wx-role-list__name{display:inline-flex;align-items:center;gap:var(--wx-space-8);flex-wrap:wrap}.wx-role-list__slug{font-family:var(--wx-font-family-mono)}.wx-profile-host[data-v-39b6c2a5]{container-type:inline-size}.wx-profile[data-v-39b6c2a5]{display:flex;gap:var(--wx-space-16);padding-top:var(--wx-space-16)}.wx-profile__aside[data-v-39b6c2a5]{flex:0 0 180px}.wx-profile__fields[data-v-39b6c2a5],.wx-profile__section[data-v-39b6c2a5]{display:flex;flex-direction:column;gap:var(--wx-space-12);flex:1 1 auto;min-width:0}.wx-profile__section[data-v-39b6c2a5]{padding-top:var(--wx-space-16)}.wx-profile__agents[data-v-39b6c2a5]{display:flex;align-items:center;justify-content:space-between;gap:var(--wx-space-12);padding:var(--wx-space-12);border:1px solid var(--wx-border-default);border-radius:var(--wx-radius-sm)}.wx-profile__agents-text[data-v-39b6c2a5]{display:flex;flex-direction:column;gap:var(--wx-space-2);min-width:0}@container (max-width: 480px){.wx-profile[data-v-39b6c2a5]{flex-direction:column}.wx-profile__aside[data-v-39b6c2a5]{flex:none}}.wx-user-menu__theme[data-v-31b12be6]{padding:var(--wx-space-2) var(--wx-space-8) var(--wx-space-6)}.wx-user-menu__trigger[data-v-31b12be6]{display:inline-flex;padding:0;border:none;border-radius:var(--wx-radius-full);background:transparent;cursor:pointer;transition:opacity var(--wx-duration-fast) var(--wx-easing-standard)}.wx-user-menu__trigger[data-v-31b12be6]:hover{opacity:.85}.wx-user-menu__trigger[data-v-31b12be6]:focus-visible{outline:2px solid var(--wx-border-focus);outline-offset:2px}.wx-user-menu__trigger--named[data-v-31b12be6]{align-items:center;gap:var(--wx-space-8);width:100%;min-width:0;padding:var(--wx-space-4);border-radius:var(--wx-radius-control);text-align:start}.wx-user-menu__trigger--named[data-v-31b12be6]:hover{opacity:1;background:var(--wx-bg-subtle)}.wx-user-menu__who[data-v-31b12be6]{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;font-family:var(--wx-font-family-sans);line-height:1.3}.wx-user-menu__name[data-v-31b12be6],.wx-user-menu__email[data-v-31b12be6]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wx-user-menu__name[data-v-31b12be6]{color:var(--wx-text-default);font-size:var(--wx-font-size-sm);font-weight:var(--wx-font-weight-medium)}.wx-user-menu__email[data-v-31b12be6]{color:var(--wx-text-muted);font-size:var(--wx-font-size-xs)}.wx-user-menu__chevron[data-v-31b12be6]{flex:none;color:var(--wx-text-muted)}.wx-content-rules[data-v-55be157e]{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}.wx-content-rules__foot[data-v-55be157e]{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--wx-space-12)}.wx-connect[data-v-73da42dd]{display:flex;flex-direction:column;gap:var(--wx-space-24);min-width:0}.wx-connect__lead[data-v-73da42dd]{max-width:68ch}.wx-connect__row[data-v-73da42dd]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wx-space-12)}.wx-connect__url[data-v-73da42dd]{flex:1 1 260px;min-width:0;padding:var(--wx-space-10) var(--wx-space-12);border-radius:var(--wx-radius-sm);background:var(--wx-bg-subtle);color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-md);word-break:break-all}.wx-connect__section[data-v-73da42dd]{display:flex;flex-direction:column;gap:var(--wx-space-12);min-width:0}.wx-connect__steps[data-v-73da42dd]{display:flex;flex-direction:column;gap:var(--wx-space-8);margin:0;padding-left:var(--wx-space-24);color:var(--wx-text-default);font-size:var(--wx-font-size-sm);line-height:var(--wx-font-line-height-relaxed)}.wx-connect__snippet[data-v-73da42dd]{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--wx-space-8);padding:var(--wx-space-12);border-radius:var(--wx-radius-sm);background:var(--wx-bg-subtle)}.wx-connect__snippet pre[data-v-73da42dd]{flex:1 1 240px;margin:0;min-width:0;color:var(--wx-text-default);font-family:var(--wx-font-family-mono);font-size:var(--wx-font-size-xs);line-height:var(--wx-font-line-height-relaxed);white-space:pre-wrap;word-break:break-all}.wx-connect__head[data-v-73da42dd]{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--wx-space-8)}.wx-connect__links[data-v-73da42dd]{display:flex;flex-wrap:wrap;gap:var(--wx-space-12)}
package/dist/types.d.ts CHANGED
@@ -8,6 +8,41 @@ export interface Role extends AdminRole {
8
8
  permissions: string[];
9
9
  /** How many administrators hold it — the number that makes a role safe or risky to change. */
10
10
  users: number;
11
+ /**
12
+ * Whether the reader holds it. Such a role is somebody else's to edit (rule 5 of
13
+ * WEBX_UI_PERMISSIONS.md §6.2), so the form opens it read-only. Absent from an older server.
14
+ */
15
+ held?: boolean;
16
+ /** A table row, for `WxTable`; see `Admin`. */
17
+ [key: string]: unknown;
18
+ }
19
+ /** One role and the people it would be taken from, for the question before deleting it. */
20
+ export interface RoleDetails extends Role {
21
+ holders: {
22
+ id: number;
23
+ name: string;
24
+ email: string;
25
+ }[];
26
+ }
27
+ /** What the role form sends. A code left out is made from the name. */
28
+ export interface RoleInput {
29
+ name: string;
30
+ slug?: string | null;
31
+ permissions: string[];
32
+ }
33
+ /** A permission as the matrix of the role form shows it. */
34
+ export interface PermissionCell {
35
+ name: string;
36
+ /** In the panel's language, from the server. */
37
+ label: string;
38
+ /** Whether the reader holds it — what they do not hold, they cannot grant (rule 2). */
39
+ held: boolean;
40
+ }
41
+ /** One module's row of the matrix, in the order of the menu. */
42
+ export interface PermissionRow {
43
+ module: string;
44
+ title: string;
45
+ permissions: PermissionCell[];
11
46
  }
12
47
  export interface Admin {
13
48
  id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webx-ui/module-auth",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Signing in to a WebX UI admin panel: the screen, the session and the router guard. Pairs with webx-ui/module-auth on the server.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,8 +44,8 @@
44
44
  "vue-router": "^4.5.0"
45
45
  },
46
46
  "dependencies": {
47
- "@webx-ui/module-admin": "^0.29.0",
48
- "@webx-ui/core": "^0.42.0"
47
+ "@webx-ui/module-admin": "^0.31.0",
48
+ "@webx-ui/core": "^0.43.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^24.10.1",