@jskit-ai/auth-web 0.2.22 → 0.2.24

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - The sign-in screen's action rows wrap: on a phone, "Confirm your email"'s three actions (go to the main screen, resend the confirmation email, back to sign in) reflow onto a second line inside the card, as Material 3 reflows actions that do not fit, where the row clipped its last button at 390px. The reset and one-time-code rows and the forgot-password links wrap the same way, keeping their 12px gap.
6
+ - The sign-in, registration and reset-password fields have no margin under them, since each keeps its supporting-text line (`@jskit-ai/material-web` no longer sets `hideDetails: "auto"`): an email or password error shown on blur appears in place instead of pushing the form down.
5
7
  - `loginRequestAsExistingUser(request, options)` (new, `@jskit-ai/auth-web/test/playwright`) signs a Playwright APIRequestContext in, as `loginAsExistingUser()` signs a page's context in: a browser test `signIn` module uses it to sign each worker in once.
6
8
  - `loginAsExistingUser(page, { email | userId, secret })` from `@jskit-ai/auth-web/test/playwright` signs in on the test's own server: with no `baseURL`, its requests go to the page context's `baseURL`, so each Playwright worker signs in on its own server (`browserTestConfig()`), instead of `PLAYWRIGHT_BASE_URL` or `127.0.0.1:${PLAYWRIGHT_PORT || 4173}`, which sent every worker's sign-in to the first worker's server. The dev-auth secret still goes only to a local server: the one a given `baseURL` names, or the one that answered the session request; a managed `PLAYWRIGHT_BASE_URL` is still refused before any request.
7
9
  - The `auth/auth-surface` pattern shows the app's identity on its sign-in, reset and sign-out screens: its pages render the app's view wrappers (`src/views/auth/LoginView.vue`, `ResetPasswordView.vue`, `SignOutView.vue`) instead of the default views, and each wrapper fills the `brand` slot with the new `src/components/AppBrand.vue`, the app's name as `index.html`'s `<title>` spells it (a `text-title-large` wordmark in the wide pane, a `text-title-medium` row on phones, no heading). The foundations' rename step renames it with the `<title>`. Upgrading: an app whose `src/pages/auth/*.vue` render the default views directly makes them render its wrappers, and gives the wrappers its brand.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/auth-web",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -25,10 +25,10 @@
25
25
  "./locales/en.json": "./locales/en.json"
26
26
  },
27
27
  "peerDependencies": {
28
- "@jskit-ai/auth-core": "0.2.16",
29
- "@jskit-ai/http-runtime": "0.2.16",
30
- "@jskit-ai/kernel": "0.2.16",
31
- "@jskit-ai/shell-web": "0.2.20",
28
+ "@jskit-ai/auth-core": "0.2.18",
29
+ "@jskit-ai/http-runtime": "0.2.18",
30
+ "@jskit-ai/kernel": "0.2.18",
31
+ "@jskit-ai/shell-web": "0.2.22",
32
32
  "@tanstack/vue-query": "^5.90.5",
33
33
  "pinia": "^4.0.3",
34
34
  "vue": "^3.5.44",
@@ -305,6 +305,6 @@
305
305
  }
306
306
  },
307
307
  "devDependencies": {
308
- "@jskit-ai/material-web": "0.1.4"
308
+ "@jskit-ai/material-web": "0.1.5"
309
309
  }
310
310
  }
@@ -137,7 +137,7 @@
137
137
  </v-btn>
138
138
  </div>
139
139
 
140
- <div class="switch-row d-flex align-center justify-space-between ga-3">
140
+ <div class="switch-row d-flex flex-wrap align-center justify-space-between ga-3">
141
141
  <v-btn class="text-none" variant="tonal" color="primary" @click="goToMainScreen">
142
142
  {{ t("jskit.auth.login.confirmEmail.goToMainScreen") }}
143
143
  </v-btn>
@@ -200,7 +200,6 @@
200
200
  autocomplete="email"
201
201
  :error-messages="emailErrorMessages"
202
202
  @blur="emailTouched = true"
203
- class="mb-3"
204
203
  />
205
204
 
206
205
  <v-text-field
@@ -215,7 +214,6 @@
215
214
  :append-inner-icon="showPassword ? '$visibilityOff' : '$visibility'"
216
215
  @click:append-inner="togglePasswordVisibility"
217
216
  @blur="passwordTouched = true"
218
- class="mb-3"
219
217
  />
220
218
 
221
219
  <v-text-field
@@ -230,7 +228,6 @@
230
228
  :append-inner-icon="showConfirmPassword ? '$visibilityOff' : '$visibility'"
231
229
  @click:append-inner="toggleConfirmPasswordVisibility"
232
230
  @blur="confirmPasswordTouched = true"
233
- class="mb-3"
234
231
  />
235
232
 
236
233
  <v-text-field
@@ -242,10 +239,9 @@
242
239
  autocomplete="one-time-code"
243
240
  :error-messages="otpCodeErrorMessages"
244
241
  @blur="otpCodeTouched = true"
245
- class="mb-3"
246
242
  />
247
243
 
248
- <div v-if="isLogin && (canRequestPasswordRecovery || canUseOtp)" class="aux-links d-flex justify-end mb-4">
244
+ <div v-if="isLogin && (canRequestPasswordRecovery || canUseOtp)" class="aux-links d-flex flex-wrap justify-end mb-4">
249
245
  <v-btn
250
246
  v-if="canRequestPasswordRecovery"
251
247
  variant="text"
@@ -308,14 +304,14 @@
308
304
  {{ submitLabel }}
309
305
  </v-btn>
310
306
 
311
- <div v-if="isForgot" class="switch-row mt-4 d-flex align-center justify-space-between ga-3">
307
+ <div v-if="isForgot" class="switch-row mt-4 d-flex flex-wrap align-center justify-space-between ga-3">
312
308
  <span class="on-surface-variant">{{ t("jskit.auth.login.rememberedPassword") }}</span>
313
309
  <v-btn variant="text" color="secondary" @click="switchMode('login')">
314
310
  {{ t("jskit.auth.login.backToSignIn") }}
315
311
  </v-btn>
316
312
  </div>
317
313
 
318
- <div v-else-if="isOtp" class="switch-row mt-4 d-flex align-center justify-space-between ga-3">
314
+ <div v-else-if="isOtp" class="switch-row mt-4 d-flex flex-wrap align-center justify-space-between ga-3">
319
315
  <span class="on-surface-variant">{{ t("jskit.auth.login.otherMethod") }}</span>
320
316
  <v-btn variant="text" color="secondary" @click="switchMode('login')">
321
317
  {{ t("jskit.auth.login.backToSignIn") }}
@@ -34,7 +34,6 @@
34
34
  autocomplete="new-password"
35
35
  :append-inner-icon="showPassword ? '$visibilityOff' : '$visibility'"
36
36
  :error-messages="passwordError"
37
- class="mb-3"
38
37
  @click:append-inner="showPassword = !showPassword"
39
38
  />
40
39
  <v-text-field
@@ -46,7 +45,6 @@
46
45
  autocomplete="new-password"
47
46
  :append-inner-icon="showConfirmPassword ? '$visibilityOff' : '$visibility'"
48
47
  :error-messages="confirmPasswordError"
49
- class="mb-4"
50
48
  @click:append-inner="showConfirmPassword = !showConfirmPassword"
51
49
  />
52
50
  <v-btn block color="primary" size="large" type="submit" :loading="loading" :disabled="!canSubmit">
@@ -125,6 +125,18 @@ test("default login view avoids decorative login chrome", () => {
125
125
  assert.doesNotMatch(constantsSource, /\[LOGIN_MODE\]:\s*"Sign in to continue\.?"/);
126
126
  });
127
127
 
128
+ test("default login view's action rows wrap, so a phone shows every action instead of clipping the last", () => {
129
+ const viewSource = readFileSync(fileURLToPath(new URL("../src/client/views/DefaultLoginView.vue", import.meta.url)), "utf8");
130
+ const rows = [...viewSource.matchAll(/class="((?:switch-row|aux-links)\b[^"]*)"/gu)].map(([, classes]) => classes);
131
+
132
+ assert.equal(rows.filter((classes) => classes.startsWith("switch-row")).length, 3);
133
+ for (const classes of rows.filter((entry) => entry.startsWith("switch-row"))) {
134
+ assert.match(classes, /\bflex-wrap\b/u, classes);
135
+ assert.match(classes, /\bga-3\b/u, classes);
136
+ }
137
+ assert.match(rows.find((classes) => classes.startsWith("aux-links")), /\bflex-wrap\b/u);
138
+ });
139
+
128
140
  test("default login view gates password login controls by provider capabilities", () => {
129
141
  const viewPath = fileURLToPath(new URL("../src/client/views/DefaultLoginView.vue", import.meta.url));
130
142
  const validationPath = fileURLToPath(new URL("../src/client/composables/loginView/useLoginViewValidation.js", import.meta.url));
@@ -152,6 +152,20 @@ test("password sign-in opens the requested page, remembers the account, and sign
152
152
  await finish(api);
153
153
  });
154
154
 
155
+ test("an email error shown on blur appears in the field's own line, so the fields below it stay put", options, async () => {
156
+ const api = await openApp();
157
+ const { page } = api;
158
+ await page.goto("/auth/login");
159
+ await expect(page.getByTestId("auth-mode-register")).toBeVisible();
160
+ const password = page.getByLabel("Password", { exact: true });
161
+ const before = await password.boundingBox();
162
+ await page.getByLabel("Email").fill("not-an-email");
163
+ await page.getByLabel("Email").blur();
164
+ await expect(page.locator(".v-messages__message").first()).toBeVisible();
165
+ assert.deepEqual(await password.boundingBox(), before);
166
+ await finish(api);
167
+ });
168
+
155
169
  test("a refused sign-in reports the server's error and leaves the form usable", options, async () => {
156
170
  const api = await openApp({ routes: { "POST /api/login": deny(401, "Invalid email or password.") } });
157
171
  const { page } = api;
@@ -269,6 +283,37 @@ test("register waits for email confirmation, and the other modes reach their req
269
283
  await finish(api);
270
284
  });
271
285
 
286
+ // Material 3 reflows actions that do not fit: on a phone, Confirm your email's three actions wrap inside the card.
287
+ test("on a phone, Confirm your email's three actions wrap inside the card, none clipped", options, async () => {
288
+ const api = await openApp({
289
+ viewport: { width: 390, height: 844 },
290
+ routes: { "POST /api/register": { json: { requiresEmailConfirmation: true, username: "Ada" } } }
291
+ });
292
+ const { page } = api;
293
+ await page.goto("/auth/login?returnTo=/home&mode=register");
294
+ await page.getByLabel("Email").fill("ada@example.com");
295
+ await page.getByLabel("Password", { exact: true }).fill("Correct-horse-1");
296
+ await page.getByLabel("Confirm password", { exact: true }).fill("Correct-horse-1");
297
+ await page.getByTestId("auth-submit").click();
298
+ await expect(page.getByText("Confirm your email")).toBeVisible();
299
+ const layout = await page.locator(".switch-row").evaluate((element) => ({
300
+ row: element.getBoundingClientRect().toJSON(),
301
+ overflows: element.scrollWidth > element.clientWidth,
302
+ buttons: [...element.querySelectorAll(".v-btn")].map((button) => ({
303
+ text: button.textContent.trim(),
304
+ ...button.getBoundingClientRect().toJSON()
305
+ }))
306
+ }));
307
+ assert.deepEqual(layout.buttons.map(({ text }) => text), ["Go to main screen", "Resend confirmation email", "Back to sign in"]);
308
+ assert.equal(layout.overflows, false, "the row does not overflow");
309
+ for (const button of layout.buttons) {
310
+ assert.ok(button.left >= layout.row.left - 0.5 && button.right <= layout.row.right + 0.5, `${button.text} lies inside the row`);
311
+ assert.ok(button.right <= 390, `${button.text} lies inside the screen`);
312
+ }
313
+ assert.ok(new Set(layout.buttons.map(({ top }) => Math.round(top))).size > 1, "the actions wrap onto more than one line");
314
+ await finish(api);
315
+ });
316
+
272
317
  test("email confirmation takes the registration's password: the development link, a pasted link after an unconfirmed sign-in, and the emailed link", options, async () => {
273
318
  const session = {
274
319
  ...SIGNED_OUT,