@hotosm/hanko-auth 0.4.6 → 0.4.7

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
@@ -204,21 +204,36 @@ The component uses Shadow DOM and can be customized using CSS custom properties.
204
204
 
205
205
  ### CSS Custom Properties
206
206
 
207
- | Property | Description | Default |
208
- | ----------------------------- | ---------------------------------- | ------------------------------------ |
209
- | `--login-btn-margin` | Margin around the login button | `0` |
207
+ #### Whole component
208
+
209
+ | Property | Description | Default |
210
+ | ----------------- | --------------------------------------------- | --------------------------------------- |
211
+ | `--font-family` | Font family for all text in the component | `system-ui, -apple-system, sans-serif` |
212
+ | `--font-weight` | Font weight for all text in the component | `500` |
213
+
214
+ #### Login button
215
+
216
+ | Property | Description | Default |
217
+ | ----------------------------- | ---------------------------------- | ------------------------------------------------------ |
218
+ | `--login-btn-margin` | Margin around the login button | `0` |
210
219
  | `--login-btn-padding` | Padding inside the login button | `var(--hot-spacing-x-small) var(--hot-spacing-medium)` |
211
- | `--login-btn-bg-color` | Background color of login button | `var(--hot-color-primary-1000)` |
212
- | `--login-btn-hover-bg-color` | Background color on hover | `var(--hot-color-primary-900)` |
213
- | `--login-btn-border-radius` | Border radius of login button | `var(--hot-border-radius-medium)` |
214
- | `--login-btn-text-color` | Text color of login button | `white` |
215
- | `--login-btn-text-size` | Font size of login button text | `var(--hot-font-size-medium)` |
216
- | `--login-btn-font-family` | Font family of login button | `inherit` |
220
+ | `--login-btn-bg-color` | Background color of login button | `var(--hot-color-primary-1000)` |
221
+ | `--login-btn-hover-bg-color` | Background color on hover | `var(--hot-color-primary-900)` |
222
+ | `--login-btn-border-radius` | Border radius of login button | `var(--hot-border-radius-medium)` |
223
+ | `--login-btn-text-color` | Text color of login button | `white` |
224
+ | `--login-btn-text-size` | Font size of login button text | `var(--hot-font-size-medium)` |
225
+ | `--login-btn-font-family` | Font family of login button | falls back to `--font-family` |
226
+ | `--login-btn-font-weight` | Font weight of login button | falls back to `--font-weight` |
217
227
 
218
228
  **Example:**
219
229
 
220
230
  ```css
221
231
  hotosm-auth {
232
+ /* Whole component */
233
+ --font-family: 'Inter', sans-serif;
234
+ --font-weight: 400;
235
+
236
+ /* Login button overrides */
222
237
  --login-btn-margin: 8px;
223
238
  --login-btn-padding: 12px 24px;
224
239
  --login-btn-bg-color: #d73f3f;
@@ -227,6 +242,7 @@ hotosm-auth {
227
242
  --login-btn-text-color: #ffffff;
228
243
  --login-btn-text-size: 16px;
229
244
  --login-btn-font-family: 'Arial', sans-serif;
245
+ --login-btn-font-weight: 700;
230
246
  }
231
247
  ```
232
248
 
@@ -3950,7 +3950,7 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3950
3950
  }, Symbol.toStringTag, { value: "Module" })), ms = Vi`
3951
3951
  :host {
3952
3952
  display: block;
3953
- font-family: var(--hot-font-sans);
3953
+ font-family: var(--font-family, var(--hot-font-sans));
3954
3954
  }
3955
3955
 
3956
3956
  .container {
@@ -3985,34 +3985,26 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3985
3985
  animation: spin 1s linear infinite;
3986
3986
  margin: 0 auto;
3987
3987
  }
3988
- /* Container that mimics the login button dimensions */
3988
+ /* Container that mimics the avatar/dropdown-trigger dimensions */
3989
3989
  .loading-placeholder {
3990
3990
  display: inline-grid;
3991
3991
  place-items: center;
3992
- /* Use same styling as login-link button */
3993
- padding: var(
3994
- --login-btn-padding,
3995
- var(--hot-spacing-x-small) var(--hot-spacing-medium)
3996
- );
3997
- margin: var(--login-btn-margin, 0);
3998
- font-size: var(--login-btn-text-size, var(--hot-font-size-medium));
3999
- font-family: var(--login-btn-font-family, inherit);
4000
- border-radius: var(
4001
- --login-btn-border-radius,
4002
- var(--hot-border-radius-medium)
4003
- );
3992
+ /* Match dropdown-trigger padding so size is stable pre/post load */
3993
+ padding: var(--hot-spacing-x-small);
3994
+ width: var(--hot-spacing-2x-large);
3995
+ height: var(--hot-spacing-2x-large);
3996
+ box-sizing: content-box;
4004
3997
  }
4005
3998
 
4006
3999
  /* Invisible text to reserve button width */
4007
4000
  .loading-placeholder-text {
4008
- visibility: hidden;
4009
- grid-area: 1 / 1;
4001
+ display: none;
4010
4002
  }
4011
4003
 
4012
4004
  .spinner-small {
4013
4005
  grid-area: 1 / 1;
4014
- width: 1em;
4015
- height: 1em;
4006
+ width: var(--hot-spacing-2x-large);
4007
+ height: var(--hot-spacing-2x-large);
4016
4008
  border: 2px solid var(--hot-color-gray-200);
4017
4009
  border-top: 2px solid var(--hot-color-gray-600);
4018
4010
  border-radius: 50%;
@@ -4040,7 +4032,8 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4040
4032
  border: none;
4041
4033
  border-radius: 6px;
4042
4034
  font-size: 14px;
4043
- font-weight: 500;
4035
+ font-family: var(--font-family, var(--hot-font-sans));
4036
+ font-weight: var(--font-weight, 500);
4044
4037
  cursor: pointer;
4045
4038
  transition: all 0.2s;
4046
4039
  }
@@ -4221,8 +4214,8 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4221
4214
  display: inline-block;
4222
4215
  cursor: pointer;
4223
4216
  transition: all 0.2s;
4224
- font-weight: var(--hot-font-weight-medium);
4225
- font-family: var(--login-btn-font-family, inherit);
4217
+ font-weight: var(--login-btn-font-weight, var(--font-weight, var(--hot-font-weight-medium)));
4218
+ font-family: var(--login-btn-font-family, var(--font-family, var(--hot-font-sans)));
4226
4219
  }
4227
4220
 
4228
4221
  /* Button variants - filled */
@@ -4344,7 +4337,7 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4344
4337
  .dropdown-content.open {
4345
4338
  opacity: 1;
4346
4339
  visibility: visible;
4347
- transform: translateY(-1);
4340
+ transform: translateY(-1px);
4348
4341
  }
4349
4342
 
4350
4343
  .dropdown-content button {
@@ -4358,6 +4351,7 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4358
4351
  text-align: left;
4359
4352
  transition: background-color 0.2s ease;
4360
4353
  gap: var(--hot-spacing-small);
4354
+ font-family: var(--font-family, var(--hot-font-sans, inherit));
4361
4355
  font-size: var(--hot-font-size-small);
4362
4356
  color: var(--hot-color-gray-900);
4363
4357
  }
@@ -4406,6 +4400,7 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4406
4400
  border: none;
4407
4401
  cursor: pointer;
4408
4402
  gap: var(--hot-spacing-small);
4403
+ font-family: var(--font-family, var(--hot-font-sans, inherit));
4409
4404
  }
4410
4405
 
4411
4406
  .bar-trigger:hover,
@@ -5279,7 +5274,7 @@ let re = class extends Mt {
5279
5274
  this.log("🕒 Hanko session expired event received"), this.handleSessionExpired();
5280
5275
  }), this._hanko.onUserLoggedOut(() => {
5281
5276
  this.log("🚪 Hanko user logged out event received"), this.handleUserLoggedOut();
5282
- }), await this.checkSession(), this.user && (this.osmRequired && await this.checkOSMConnection(), await this.fetchProfileDisplayName()), this.loading = !1, this._broadcastState(), this.setupEventListeners();
5277
+ }), await this.checkSession(), this.user && (this.osmRequired && await this.checkOSMConnection(), await this.fetchProfileDisplayName()), await new Promise((s) => setTimeout(s, 3e3)), this.loading = !1, this._broadcastState(), this.setupEventListeners();
5283
5278
  } catch (n) {
5284
5279
  this.logError("Failed to initialize hanko-auth:", n), this.error = n.message, this.loading = !1, this._broadcastState();
5285
5280
  }