@authhero/widget 0.17.2 → 0.18.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/authhero-widget/authhero-widget.esm.js +1 -1
- package/dist/cjs/authhero-widget.cjs.entry.js +75 -74
- package/dist/collection/index.js +1 -1
- package/dist/collection/themes/index.js +34 -30
- package/dist/collection/utils/branding.js +75 -74
- package/dist/esm/authhero-widget.entry.js +75 -74
- package/dist/types/index.d.ts +1 -1
- package/dist/types/themes/index.d.ts +2 -2
- package/dist/types/utils/branding.d.ts +8 -8
- package/hydrate/index.js +75 -74
- package/hydrate/index.mjs +75 -74
- package/package.json +2 -2
- /package/dist/authhero-widget/{p-409a28d3.entry.js → p-18d0a438.entry.js} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -5340,12 +5340,12 @@ function styleToRadius(style, baseRadius) {
|
|
|
5340
5340
|
if (baseRadius !== undefined)
|
|
5341
5341
|
return `${baseRadius}px`;
|
|
5342
5342
|
switch (style) {
|
|
5343
|
-
case
|
|
5344
|
-
return
|
|
5345
|
-
case
|
|
5346
|
-
return
|
|
5347
|
-
case
|
|
5348
|
-
return
|
|
5343
|
+
case "pill":
|
|
5344
|
+
return "9999px";
|
|
5345
|
+
case "rounded":
|
|
5346
|
+
return "8px";
|
|
5347
|
+
case "sharp":
|
|
5348
|
+
return "0";
|
|
5349
5349
|
default:
|
|
5350
5350
|
return undefined;
|
|
5351
5351
|
}
|
|
@@ -5359,28 +5359,29 @@ function brandingToCssVars(branding) {
|
|
|
5359
5359
|
const vars = {};
|
|
5360
5360
|
// Primary color
|
|
5361
5361
|
if (branding.colors?.primary) {
|
|
5362
|
-
vars[
|
|
5362
|
+
vars["--ah-color-primary"] = branding.colors.primary;
|
|
5363
5363
|
// Generate hover variant (slightly darker)
|
|
5364
|
-
vars[
|
|
5364
|
+
vars["--ah-color-primary-hover"] = branding.colors.primary;
|
|
5365
5365
|
}
|
|
5366
5366
|
// Page background
|
|
5367
5367
|
if (branding.colors?.page_background) {
|
|
5368
5368
|
const bg = branding.colors.page_background;
|
|
5369
|
-
if (bg.type ===
|
|
5370
|
-
vars[
|
|
5369
|
+
if (bg.type === "solid" && bg.start) {
|
|
5370
|
+
vars["--ah-page-bg"] = bg.start;
|
|
5371
5371
|
}
|
|
5372
|
-
else if (bg.type ===
|
|
5372
|
+
else if (bg.type === "gradient" && bg.start && bg.end) {
|
|
5373
5373
|
const angle = bg.angle_deg ?? 180;
|
|
5374
|
-
vars[
|
|
5374
|
+
vars["--ah-page-bg"] =
|
|
5375
|
+
`linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
|
|
5375
5376
|
}
|
|
5376
5377
|
}
|
|
5377
5378
|
// Logo URL (stored for reference, used via prop)
|
|
5378
5379
|
if (branding.logo_url) {
|
|
5379
|
-
vars[
|
|
5380
|
+
vars["--ah-logo-url"] = `url(${branding.logo_url})`;
|
|
5380
5381
|
}
|
|
5381
5382
|
// Font URL
|
|
5382
5383
|
if (branding.font?.url) {
|
|
5383
|
-
vars[
|
|
5384
|
+
vars["--ah-font-url"] = branding.font.url;
|
|
5384
5385
|
}
|
|
5385
5386
|
return vars;
|
|
5386
5387
|
}
|
|
@@ -5396,29 +5397,29 @@ function themeToCssVars(theme) {
|
|
|
5396
5397
|
const b = theme.borders;
|
|
5397
5398
|
// Widget
|
|
5398
5399
|
if (b.widget_corner_radius !== undefined) {
|
|
5399
|
-
vars[
|
|
5400
|
+
vars["--ah-widget-radius"] = `${b.widget_corner_radius}px`;
|
|
5400
5401
|
}
|
|
5401
5402
|
if (b.widget_border_weight !== undefined) {
|
|
5402
|
-
vars[
|
|
5403
|
+
vars["--ah-widget-border-width"] = `${b.widget_border_weight}px`;
|
|
5403
5404
|
}
|
|
5404
5405
|
if (b.show_widget_shadow === false) {
|
|
5405
|
-
vars[
|
|
5406
|
+
vars["--ah-widget-shadow"] = "none";
|
|
5406
5407
|
}
|
|
5407
5408
|
// Buttons
|
|
5408
5409
|
const btnRadius = styleToRadius(b.buttons_style, b.button_border_radius);
|
|
5409
5410
|
if (btnRadius) {
|
|
5410
|
-
vars[
|
|
5411
|
+
vars["--ah-btn-radius"] = btnRadius;
|
|
5411
5412
|
}
|
|
5412
5413
|
if (b.button_border_weight !== undefined) {
|
|
5413
|
-
vars[
|
|
5414
|
+
vars["--ah-btn-border-width"] = `${b.button_border_weight}px`;
|
|
5414
5415
|
}
|
|
5415
5416
|
// Inputs
|
|
5416
5417
|
const inputRadius = styleToRadius(b.inputs_style, b.input_border_radius);
|
|
5417
5418
|
if (inputRadius) {
|
|
5418
|
-
vars[
|
|
5419
|
+
vars["--ah-input-radius"] = inputRadius;
|
|
5419
5420
|
}
|
|
5420
5421
|
if (b.input_border_weight !== undefined) {
|
|
5421
|
-
vars[
|
|
5422
|
+
vars["--ah-input-border-width"] = `${b.input_border_weight}px`;
|
|
5422
5423
|
}
|
|
5423
5424
|
}
|
|
5424
5425
|
// Colors
|
|
@@ -5426,68 +5427,68 @@ function themeToCssVars(theme) {
|
|
|
5426
5427
|
const c = theme.colors;
|
|
5427
5428
|
// Primary button
|
|
5428
5429
|
if (c.primary_button) {
|
|
5429
|
-
vars[
|
|
5430
|
-
vars[
|
|
5430
|
+
vars["--ah-color-primary"] = c.primary_button;
|
|
5431
|
+
vars["--ah-color-primary-hover"] = c.primary_button;
|
|
5431
5432
|
}
|
|
5432
5433
|
if (c.primary_button_label) {
|
|
5433
|
-
vars[
|
|
5434
|
+
vars["--ah-btn-primary-text"] = c.primary_button_label;
|
|
5434
5435
|
}
|
|
5435
5436
|
// Secondary button
|
|
5436
5437
|
if (c.secondary_button_border) {
|
|
5437
|
-
vars[
|
|
5438
|
+
vars["--ah-btn-secondary-border"] = c.secondary_button_border;
|
|
5438
5439
|
}
|
|
5439
5440
|
if (c.secondary_button_label) {
|
|
5440
|
-
vars[
|
|
5441
|
+
vars["--ah-btn-secondary-text"] = c.secondary_button_label;
|
|
5441
5442
|
}
|
|
5442
5443
|
// Text colors
|
|
5443
5444
|
if (c.body_text) {
|
|
5444
|
-
vars[
|
|
5445
|
+
vars["--ah-color-text"] = c.body_text;
|
|
5445
5446
|
}
|
|
5446
5447
|
if (c.header) {
|
|
5447
|
-
vars[
|
|
5448
|
+
vars["--ah-color-text-header"] = c.header;
|
|
5448
5449
|
}
|
|
5449
5450
|
if (c.input_labels_placeholders) {
|
|
5450
|
-
vars[
|
|
5451
|
-
vars[
|
|
5451
|
+
vars["--ah-color-text-label"] = c.input_labels_placeholders;
|
|
5452
|
+
vars["--ah-color-text-muted"] = c.input_labels_placeholders;
|
|
5452
5453
|
}
|
|
5453
5454
|
if (c.input_filled_text) {
|
|
5454
|
-
vars[
|
|
5455
|
+
vars["--ah-color-input-text"] = c.input_filled_text;
|
|
5455
5456
|
}
|
|
5456
5457
|
// Backgrounds
|
|
5457
5458
|
if (c.widget_background) {
|
|
5458
|
-
vars[
|
|
5459
|
+
vars["--ah-color-bg"] = c.widget_background;
|
|
5459
5460
|
}
|
|
5460
5461
|
if (c.input_background) {
|
|
5461
|
-
vars[
|
|
5462
|
+
vars["--ah-color-input-bg"] = c.input_background;
|
|
5462
5463
|
}
|
|
5463
5464
|
// Borders
|
|
5464
5465
|
if (c.widget_border) {
|
|
5465
|
-
vars[
|
|
5466
|
+
vars["--ah-widget-border-color"] = c.widget_border;
|
|
5466
5467
|
}
|
|
5467
5468
|
if (c.input_border) {
|
|
5468
|
-
vars[
|
|
5469
|
+
vars["--ah-color-border"] = c.input_border;
|
|
5469
5470
|
}
|
|
5470
5471
|
// Links
|
|
5471
5472
|
if (c.links_focused_components) {
|
|
5472
|
-
vars[
|
|
5473
|
+
vars["--ah-color-link"] = c.links_focused_components;
|
|
5473
5474
|
}
|
|
5474
5475
|
// Focus/hover
|
|
5475
5476
|
if (c.base_focus_color) {
|
|
5476
|
-
vars[
|
|
5477
|
+
vars["--ah-color-focus-ring"] = c.base_focus_color;
|
|
5477
5478
|
}
|
|
5478
5479
|
if (c.base_hover_color) {
|
|
5479
|
-
vars[
|
|
5480
|
+
vars["--ah-color-primary-hover"] = c.base_hover_color;
|
|
5480
5481
|
}
|
|
5481
5482
|
// Semantic colors
|
|
5482
5483
|
if (c.error) {
|
|
5483
|
-
vars[
|
|
5484
|
+
vars["--ah-color-error"] = c.error;
|
|
5484
5485
|
}
|
|
5485
5486
|
if (c.success) {
|
|
5486
|
-
vars[
|
|
5487
|
+
vars["--ah-color-success"] = c.success;
|
|
5487
5488
|
}
|
|
5488
5489
|
// Icons
|
|
5489
5490
|
if (c.icons) {
|
|
5490
|
-
vars[
|
|
5491
|
+
vars["--ah-color-icon"] = c.icons;
|
|
5491
5492
|
}
|
|
5492
5493
|
}
|
|
5493
5494
|
// Fonts
|
|
@@ -5496,93 +5497,93 @@ function themeToCssVars(theme) {
|
|
|
5496
5497
|
// reference_text_size is the base font size in pixels (default 16px)
|
|
5497
5498
|
const baseSize = f.reference_text_size || 16;
|
|
5498
5499
|
if (f.font_url) {
|
|
5499
|
-
vars[
|
|
5500
|
+
vars["--ah-font-url"] = f.font_url;
|
|
5500
5501
|
}
|
|
5501
5502
|
if (f.reference_text_size) {
|
|
5502
|
-
vars[
|
|
5503
|
+
vars["--ah-font-size-base"] = `${f.reference_text_size}px`;
|
|
5503
5504
|
}
|
|
5504
5505
|
// Title, subtitle, etc. sizes are percentages of the base size
|
|
5505
5506
|
if (f.title?.size) {
|
|
5506
5507
|
const titlePx = Math.round((f.title.size / 100) * baseSize);
|
|
5507
|
-
vars[
|
|
5508
|
+
vars["--ah-font-size-title"] = `${titlePx}px`;
|
|
5508
5509
|
}
|
|
5509
5510
|
if (f.subtitle?.size) {
|
|
5510
5511
|
const subtitlePx = Math.round((f.subtitle.size / 100) * baseSize);
|
|
5511
|
-
vars[
|
|
5512
|
+
vars["--ah-font-size-subtitle"] = `${subtitlePx}px`;
|
|
5512
5513
|
}
|
|
5513
5514
|
if (f.body_text?.size) {
|
|
5514
5515
|
const bodyPx = Math.round((f.body_text.size / 100) * baseSize);
|
|
5515
|
-
vars[
|
|
5516
|
+
vars["--ah-font-size-body"] = `${bodyPx}px`;
|
|
5516
5517
|
}
|
|
5517
5518
|
if (f.input_labels?.size) {
|
|
5518
5519
|
const labelPx = Math.round((f.input_labels.size / 100) * baseSize);
|
|
5519
|
-
vars[
|
|
5520
|
+
vars["--ah-font-size-label"] = `${labelPx}px`;
|
|
5520
5521
|
}
|
|
5521
5522
|
if (f.buttons_text?.size) {
|
|
5522
5523
|
const btnPx = Math.round((f.buttons_text.size / 100) * baseSize);
|
|
5523
|
-
vars[
|
|
5524
|
+
vars["--ah-font-size-btn"] = `${btnPx}px`;
|
|
5524
5525
|
}
|
|
5525
5526
|
if (f.links?.size) {
|
|
5526
5527
|
const linkPx = Math.round((f.links.size / 100) * baseSize);
|
|
5527
|
-
vars[
|
|
5528
|
+
vars["--ah-font-size-link"] = `${linkPx}px`;
|
|
5528
5529
|
}
|
|
5529
|
-
if (f.links_style ===
|
|
5530
|
-
vars[
|
|
5530
|
+
if (f.links_style === "underlined") {
|
|
5531
|
+
vars["--ah-link-decoration"] = "underline";
|
|
5531
5532
|
}
|
|
5532
5533
|
// Font weights - bold option sets font-weight to 700
|
|
5533
5534
|
if (f.title?.bold !== undefined) {
|
|
5534
|
-
vars[
|
|
5535
|
+
vars["--ah-font-weight-title"] = f.title.bold ? "700" : "400";
|
|
5535
5536
|
}
|
|
5536
5537
|
if (f.subtitle?.bold !== undefined) {
|
|
5537
|
-
vars[
|
|
5538
|
+
vars["--ah-font-weight-subtitle"] = f.subtitle.bold ? "700" : "400";
|
|
5538
5539
|
}
|
|
5539
5540
|
if (f.body_text?.bold !== undefined) {
|
|
5540
|
-
vars[
|
|
5541
|
+
vars["--ah-font-weight-body"] = f.body_text.bold ? "700" : "400";
|
|
5541
5542
|
}
|
|
5542
5543
|
if (f.input_labels?.bold !== undefined) {
|
|
5543
|
-
vars[
|
|
5544
|
+
vars["--ah-font-weight-label"] = f.input_labels.bold ? "700" : "400";
|
|
5544
5545
|
}
|
|
5545
5546
|
if (f.buttons_text?.bold !== undefined) {
|
|
5546
|
-
vars[
|
|
5547
|
+
vars["--ah-font-weight-btn"] = f.buttons_text.bold ? "600" : "400";
|
|
5547
5548
|
}
|
|
5548
5549
|
if (f.links?.bold !== undefined) {
|
|
5549
|
-
vars[
|
|
5550
|
+
vars["--ah-font-weight-link"] = f.links.bold ? "700" : "400";
|
|
5550
5551
|
}
|
|
5551
5552
|
}
|
|
5552
5553
|
// Widget settings
|
|
5553
5554
|
if (theme.widget) {
|
|
5554
5555
|
const w = theme.widget;
|
|
5555
5556
|
if (w.header_text_alignment) {
|
|
5556
|
-
vars[
|
|
5557
|
+
vars["--ah-title-align"] = w.header_text_alignment;
|
|
5557
5558
|
}
|
|
5558
5559
|
if (w.logo_height) {
|
|
5559
|
-
vars[
|
|
5560
|
+
vars["--ah-logo-height"] = `${w.logo_height}px`;
|
|
5560
5561
|
}
|
|
5561
5562
|
if (w.logo_position) {
|
|
5562
5563
|
const positionMap = {
|
|
5563
|
-
center:
|
|
5564
|
-
left:
|
|
5565
|
-
right:
|
|
5564
|
+
center: "center",
|
|
5565
|
+
left: "flex-start",
|
|
5566
|
+
right: "flex-end",
|
|
5566
5567
|
};
|
|
5567
|
-
if (w.logo_position ===
|
|
5568
|
-
vars[
|
|
5568
|
+
if (w.logo_position === "none") {
|
|
5569
|
+
vars["--ah-logo-display"] = "none";
|
|
5569
5570
|
}
|
|
5570
5571
|
else {
|
|
5571
|
-
vars[
|
|
5572
|
+
vars["--ah-logo-align"] = positionMap[w.logo_position] ?? "center";
|
|
5572
5573
|
}
|
|
5573
5574
|
}
|
|
5574
5575
|
if (w.social_buttons_layout) {
|
|
5575
5576
|
// 'top' means social buttons above fields, 'bottom' means below
|
|
5576
5577
|
// Divider is always order 1 (middle)
|
|
5577
|
-
if (w.social_buttons_layout ===
|
|
5578
|
-
vars[
|
|
5579
|
-
vars[
|
|
5580
|
-
vars[
|
|
5578
|
+
if (w.social_buttons_layout === "top") {
|
|
5579
|
+
vars["--ah-social-order"] = "0";
|
|
5580
|
+
vars["--ah-divider-order"] = "1";
|
|
5581
|
+
vars["--ah-fields-order"] = "2";
|
|
5581
5582
|
}
|
|
5582
5583
|
else {
|
|
5583
|
-
vars[
|
|
5584
|
-
vars[
|
|
5585
|
-
vars[
|
|
5584
|
+
vars["--ah-social-order"] = "2";
|
|
5585
|
+
vars["--ah-divider-order"] = "1";
|
|
5586
|
+
vars["--ah-fields-order"] = "0";
|
|
5586
5587
|
}
|
|
5587
5588
|
}
|
|
5588
5589
|
}
|
|
@@ -5590,10 +5591,10 @@ function themeToCssVars(theme) {
|
|
|
5590
5591
|
if (theme.page_background) {
|
|
5591
5592
|
const pb = theme.page_background;
|
|
5592
5593
|
if (pb.background_color) {
|
|
5593
|
-
vars[
|
|
5594
|
+
vars["--ah-page-bg"] = pb.background_color;
|
|
5594
5595
|
}
|
|
5595
5596
|
if (pb.background_image_url) {
|
|
5596
|
-
vars[
|
|
5597
|
+
vars["--ah-page-bg-image"] = `url(${pb.background_image_url})`;
|
|
5597
5598
|
}
|
|
5598
5599
|
}
|
|
5599
5600
|
return vars;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authhero/widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Server-Driven UI widget for AuthHero authentication flows",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@authhero/adapter-interfaces": "0.
|
|
40
|
+
"@authhero/adapter-interfaces": "0.142.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@hono/node-server": "^1.14.1",
|
|
File without changes
|