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