@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.
@@ -10,12 +10,12 @@ function styleToRadius(style, baseRadius) {
10
10
  if (baseRadius !== undefined)
11
11
  return `${baseRadius}px`;
12
12
  switch (style) {
13
- case 'pill':
14
- return '9999px';
15
- case 'rounded':
16
- return '8px';
17
- case 'sharp':
18
- return '0';
13
+ case "pill":
14
+ return "9999px";
15
+ case "rounded":
16
+ return "8px";
17
+ case "sharp":
18
+ return "0";
19
19
  default:
20
20
  return undefined;
21
21
  }
@@ -29,28 +29,29 @@ export function brandingToCssVars(branding) {
29
29
  const vars = {};
30
30
  // Primary color
31
31
  if (branding.colors?.primary) {
32
- vars['--ah-color-primary'] = branding.colors.primary;
32
+ vars["--ah-color-primary"] = branding.colors.primary;
33
33
  // Generate hover variant (slightly darker)
34
- vars['--ah-color-primary-hover'] = branding.colors.primary;
34
+ vars["--ah-color-primary-hover"] = branding.colors.primary;
35
35
  }
36
36
  // Page background
37
37
  if (branding.colors?.page_background) {
38
38
  const bg = branding.colors.page_background;
39
- if (bg.type === 'solid' && bg.start) {
40
- vars['--ah-page-bg'] = bg.start;
39
+ if (bg.type === "solid" && bg.start) {
40
+ vars["--ah-page-bg"] = bg.start;
41
41
  }
42
- else if (bg.type === 'gradient' && bg.start && bg.end) {
42
+ else if (bg.type === "gradient" && bg.start && bg.end) {
43
43
  const angle = bg.angle_deg ?? 180;
44
- vars['--ah-page-bg'] = `linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
44
+ vars["--ah-page-bg"] =
45
+ `linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
45
46
  }
46
47
  }
47
48
  // Logo URL (stored for reference, used via prop)
48
49
  if (branding.logo_url) {
49
- vars['--ah-logo-url'] = `url(${branding.logo_url})`;
50
+ vars["--ah-logo-url"] = `url(${branding.logo_url})`;
50
51
  }
51
52
  // Font URL
52
53
  if (branding.font?.url) {
53
- vars['--ah-font-url'] = branding.font.url;
54
+ vars["--ah-font-url"] = branding.font.url;
54
55
  }
55
56
  return vars;
56
57
  }
@@ -66,29 +67,29 @@ export function themeToCssVars(theme) {
66
67
  const b = theme.borders;
67
68
  // Widget
68
69
  if (b.widget_corner_radius !== undefined) {
69
- vars['--ah-widget-radius'] = `${b.widget_corner_radius}px`;
70
+ vars["--ah-widget-radius"] = `${b.widget_corner_radius}px`;
70
71
  }
71
72
  if (b.widget_border_weight !== undefined) {
72
- vars['--ah-widget-border-width'] = `${b.widget_border_weight}px`;
73
+ vars["--ah-widget-border-width"] = `${b.widget_border_weight}px`;
73
74
  }
74
75
  if (b.show_widget_shadow === false) {
75
- vars['--ah-widget-shadow'] = 'none';
76
+ vars["--ah-widget-shadow"] = "none";
76
77
  }
77
78
  // Buttons
78
79
  const btnRadius = styleToRadius(b.buttons_style, b.button_border_radius);
79
80
  if (btnRadius) {
80
- vars['--ah-btn-radius'] = btnRadius;
81
+ vars["--ah-btn-radius"] = btnRadius;
81
82
  }
82
83
  if (b.button_border_weight !== undefined) {
83
- vars['--ah-btn-border-width'] = `${b.button_border_weight}px`;
84
+ vars["--ah-btn-border-width"] = `${b.button_border_weight}px`;
84
85
  }
85
86
  // Inputs
86
87
  const inputRadius = styleToRadius(b.inputs_style, b.input_border_radius);
87
88
  if (inputRadius) {
88
- vars['--ah-input-radius'] = inputRadius;
89
+ vars["--ah-input-radius"] = inputRadius;
89
90
  }
90
91
  if (b.input_border_weight !== undefined) {
91
- vars['--ah-input-border-width'] = `${b.input_border_weight}px`;
92
+ vars["--ah-input-border-width"] = `${b.input_border_weight}px`;
92
93
  }
93
94
  }
94
95
  // Colors
@@ -96,68 +97,68 @@ export function themeToCssVars(theme) {
96
97
  const c = theme.colors;
97
98
  // Primary button
98
99
  if (c.primary_button) {
99
- vars['--ah-color-primary'] = c.primary_button;
100
- vars['--ah-color-primary-hover'] = c.primary_button;
100
+ vars["--ah-color-primary"] = c.primary_button;
101
+ vars["--ah-color-primary-hover"] = c.primary_button;
101
102
  }
102
103
  if (c.primary_button_label) {
103
- vars['--ah-btn-primary-text'] = c.primary_button_label;
104
+ vars["--ah-btn-primary-text"] = c.primary_button_label;
104
105
  }
105
106
  // Secondary button
106
107
  if (c.secondary_button_border) {
107
- vars['--ah-btn-secondary-border'] = c.secondary_button_border;
108
+ vars["--ah-btn-secondary-border"] = c.secondary_button_border;
108
109
  }
109
110
  if (c.secondary_button_label) {
110
- vars['--ah-btn-secondary-text'] = c.secondary_button_label;
111
+ vars["--ah-btn-secondary-text"] = c.secondary_button_label;
111
112
  }
112
113
  // Text colors
113
114
  if (c.body_text) {
114
- vars['--ah-color-text'] = c.body_text;
115
+ vars["--ah-color-text"] = c.body_text;
115
116
  }
116
117
  if (c.header) {
117
- vars['--ah-color-text-header'] = c.header;
118
+ vars["--ah-color-text-header"] = c.header;
118
119
  }
119
120
  if (c.input_labels_placeholders) {
120
- vars['--ah-color-text-label'] = c.input_labels_placeholders;
121
- vars['--ah-color-text-muted'] = c.input_labels_placeholders;
121
+ vars["--ah-color-text-label"] = c.input_labels_placeholders;
122
+ vars["--ah-color-text-muted"] = c.input_labels_placeholders;
122
123
  }
123
124
  if (c.input_filled_text) {
124
- vars['--ah-color-input-text'] = c.input_filled_text;
125
+ vars["--ah-color-input-text"] = c.input_filled_text;
125
126
  }
126
127
  // Backgrounds
127
128
  if (c.widget_background) {
128
- vars['--ah-color-bg'] = c.widget_background;
129
+ vars["--ah-color-bg"] = c.widget_background;
129
130
  }
130
131
  if (c.input_background) {
131
- vars['--ah-color-input-bg'] = c.input_background;
132
+ vars["--ah-color-input-bg"] = c.input_background;
132
133
  }
133
134
  // Borders
134
135
  if (c.widget_border) {
135
- vars['--ah-widget-border-color'] = c.widget_border;
136
+ vars["--ah-widget-border-color"] = c.widget_border;
136
137
  }
137
138
  if (c.input_border) {
138
- vars['--ah-color-border'] = c.input_border;
139
+ vars["--ah-color-border"] = c.input_border;
139
140
  }
140
141
  // Links
141
142
  if (c.links_focused_components) {
142
- vars['--ah-color-link'] = c.links_focused_components;
143
+ vars["--ah-color-link"] = c.links_focused_components;
143
144
  }
144
145
  // Focus/hover
145
146
  if (c.base_focus_color) {
146
- vars['--ah-color-focus-ring'] = c.base_focus_color;
147
+ vars["--ah-color-focus-ring"] = c.base_focus_color;
147
148
  }
148
149
  if (c.base_hover_color) {
149
- vars['--ah-color-primary-hover'] = c.base_hover_color;
150
+ vars["--ah-color-primary-hover"] = c.base_hover_color;
150
151
  }
151
152
  // Semantic colors
152
153
  if (c.error) {
153
- vars['--ah-color-error'] = c.error;
154
+ vars["--ah-color-error"] = c.error;
154
155
  }
155
156
  if (c.success) {
156
- vars['--ah-color-success'] = c.success;
157
+ vars["--ah-color-success"] = c.success;
157
158
  }
158
159
  // Icons
159
160
  if (c.icons) {
160
- vars['--ah-color-icon'] = c.icons;
161
+ vars["--ah-color-icon"] = c.icons;
161
162
  }
162
163
  }
163
164
  // Fonts
@@ -166,93 +167,93 @@ export function themeToCssVars(theme) {
166
167
  // reference_text_size is the base font size in pixels (default 16px)
167
168
  const baseSize = f.reference_text_size || 16;
168
169
  if (f.font_url) {
169
- vars['--ah-font-url'] = f.font_url;
170
+ vars["--ah-font-url"] = f.font_url;
170
171
  }
171
172
  if (f.reference_text_size) {
172
- vars['--ah-font-size-base'] = `${f.reference_text_size}px`;
173
+ vars["--ah-font-size-base"] = `${f.reference_text_size}px`;
173
174
  }
174
175
  // Title, subtitle, etc. sizes are percentages of the base size
175
176
  if (f.title?.size) {
176
177
  const titlePx = Math.round((f.title.size / 100) * baseSize);
177
- vars['--ah-font-size-title'] = `${titlePx}px`;
178
+ vars["--ah-font-size-title"] = `${titlePx}px`;
178
179
  }
179
180
  if (f.subtitle?.size) {
180
181
  const subtitlePx = Math.round((f.subtitle.size / 100) * baseSize);
181
- vars['--ah-font-size-subtitle'] = `${subtitlePx}px`;
182
+ vars["--ah-font-size-subtitle"] = `${subtitlePx}px`;
182
183
  }
183
184
  if (f.body_text?.size) {
184
185
  const bodyPx = Math.round((f.body_text.size / 100) * baseSize);
185
- vars['--ah-font-size-body'] = `${bodyPx}px`;
186
+ vars["--ah-font-size-body"] = `${bodyPx}px`;
186
187
  }
187
188
  if (f.input_labels?.size) {
188
189
  const labelPx = Math.round((f.input_labels.size / 100) * baseSize);
189
- vars['--ah-font-size-label'] = `${labelPx}px`;
190
+ vars["--ah-font-size-label"] = `${labelPx}px`;
190
191
  }
191
192
  if (f.buttons_text?.size) {
192
193
  const btnPx = Math.round((f.buttons_text.size / 100) * baseSize);
193
- vars['--ah-font-size-btn'] = `${btnPx}px`;
194
+ vars["--ah-font-size-btn"] = `${btnPx}px`;
194
195
  }
195
196
  if (f.links?.size) {
196
197
  const linkPx = Math.round((f.links.size / 100) * baseSize);
197
- vars['--ah-font-size-link'] = `${linkPx}px`;
198
+ vars["--ah-font-size-link"] = `${linkPx}px`;
198
199
  }
199
- if (f.links_style === 'underlined') {
200
- vars['--ah-link-decoration'] = 'underline';
200
+ if (f.links_style === "underlined") {
201
+ vars["--ah-link-decoration"] = "underline";
201
202
  }
202
203
  // Font weights - bold option sets font-weight to 700
203
204
  if (f.title?.bold !== undefined) {
204
- vars['--ah-font-weight-title'] = f.title.bold ? '700' : '400';
205
+ vars["--ah-font-weight-title"] = f.title.bold ? "700" : "400";
205
206
  }
206
207
  if (f.subtitle?.bold !== undefined) {
207
- vars['--ah-font-weight-subtitle'] = f.subtitle.bold ? '700' : '400';
208
+ vars["--ah-font-weight-subtitle"] = f.subtitle.bold ? "700" : "400";
208
209
  }
209
210
  if (f.body_text?.bold !== undefined) {
210
- vars['--ah-font-weight-body'] = f.body_text.bold ? '700' : '400';
211
+ vars["--ah-font-weight-body"] = f.body_text.bold ? "700" : "400";
211
212
  }
212
213
  if (f.input_labels?.bold !== undefined) {
213
- vars['--ah-font-weight-label'] = f.input_labels.bold ? '700' : '400';
214
+ vars["--ah-font-weight-label"] = f.input_labels.bold ? "700" : "400";
214
215
  }
215
216
  if (f.buttons_text?.bold !== undefined) {
216
- vars['--ah-font-weight-btn'] = f.buttons_text.bold ? '600' : '400';
217
+ vars["--ah-font-weight-btn"] = f.buttons_text.bold ? "600" : "400";
217
218
  }
218
219
  if (f.links?.bold !== undefined) {
219
- vars['--ah-font-weight-link'] = f.links.bold ? '700' : '400';
220
+ vars["--ah-font-weight-link"] = f.links.bold ? "700" : "400";
220
221
  }
221
222
  }
222
223
  // Widget settings
223
224
  if (theme.widget) {
224
225
  const w = theme.widget;
225
226
  if (w.header_text_alignment) {
226
- vars['--ah-title-align'] = w.header_text_alignment;
227
+ vars["--ah-title-align"] = w.header_text_alignment;
227
228
  }
228
229
  if (w.logo_height) {
229
- vars['--ah-logo-height'] = `${w.logo_height}px`;
230
+ vars["--ah-logo-height"] = `${w.logo_height}px`;
230
231
  }
231
232
  if (w.logo_position) {
232
233
  const positionMap = {
233
- center: 'center',
234
- left: 'flex-start',
235
- right: 'flex-end',
234
+ center: "center",
235
+ left: "flex-start",
236
+ right: "flex-end",
236
237
  };
237
- if (w.logo_position === 'none') {
238
- vars['--ah-logo-display'] = 'none';
238
+ if (w.logo_position === "none") {
239
+ vars["--ah-logo-display"] = "none";
239
240
  }
240
241
  else {
241
- vars['--ah-logo-align'] = positionMap[w.logo_position] ?? 'center';
242
+ vars["--ah-logo-align"] = positionMap[w.logo_position] ?? "center";
242
243
  }
243
244
  }
244
245
  if (w.social_buttons_layout) {
245
246
  // 'top' means social buttons above fields, 'bottom' means below
246
247
  // Divider is always order 1 (middle)
247
- if (w.social_buttons_layout === 'top') {
248
- vars['--ah-social-order'] = '0';
249
- vars['--ah-divider-order'] = '1';
250
- vars['--ah-fields-order'] = '2';
248
+ if (w.social_buttons_layout === "top") {
249
+ vars["--ah-social-order"] = "0";
250
+ vars["--ah-divider-order"] = "1";
251
+ vars["--ah-fields-order"] = "2";
251
252
  }
252
253
  else {
253
- vars['--ah-social-order'] = '2';
254
- vars['--ah-divider-order'] = '1';
255
- vars['--ah-fields-order'] = '0';
254
+ vars["--ah-social-order"] = "2";
255
+ vars["--ah-divider-order"] = "1";
256
+ vars["--ah-fields-order"] = "0";
256
257
  }
257
258
  }
258
259
  }
@@ -260,10 +261,10 @@ export function themeToCssVars(theme) {
260
261
  if (theme.page_background) {
261
262
  const pb = theme.page_background;
262
263
  if (pb.background_color) {
263
- vars['--ah-page-bg'] = pb.background_color;
264
+ vars["--ah-page-bg"] = pb.background_color;
264
265
  }
265
266
  if (pb.background_image_url) {
266
- vars['--ah-page-bg-image'] = `url(${pb.background_image_url})`;
267
+ vars["--ah-page-bg-image"] = `url(${pb.background_image_url})`;
267
268
  }
268
269
  }
269
270
  return vars;
@@ -12,12 +12,12 @@ function styleToRadius(style, baseRadius) {
12
12
  if (baseRadius !== undefined)
13
13
  return `${baseRadius}px`;
14
14
  switch (style) {
15
- case 'pill':
16
- return '9999px';
17
- case 'rounded':
18
- return '8px';
19
- case 'sharp':
20
- return '0';
15
+ case "pill":
16
+ return "9999px";
17
+ case "rounded":
18
+ return "8px";
19
+ case "sharp":
20
+ return "0";
21
21
  default:
22
22
  return undefined;
23
23
  }
@@ -31,28 +31,29 @@ function brandingToCssVars(branding) {
31
31
  const vars = {};
32
32
  // Primary color
33
33
  if (branding.colors?.primary) {
34
- vars['--ah-color-primary'] = branding.colors.primary;
34
+ vars["--ah-color-primary"] = branding.colors.primary;
35
35
  // Generate hover variant (slightly darker)
36
- vars['--ah-color-primary-hover'] = branding.colors.primary;
36
+ vars["--ah-color-primary-hover"] = branding.colors.primary;
37
37
  }
38
38
  // Page background
39
39
  if (branding.colors?.page_background) {
40
40
  const bg = branding.colors.page_background;
41
- if (bg.type === 'solid' && bg.start) {
42
- vars['--ah-page-bg'] = bg.start;
41
+ if (bg.type === "solid" && bg.start) {
42
+ vars["--ah-page-bg"] = bg.start;
43
43
  }
44
- else if (bg.type === 'gradient' && bg.start && bg.end) {
44
+ else if (bg.type === "gradient" && bg.start && bg.end) {
45
45
  const angle = bg.angle_deg ?? 180;
46
- vars['--ah-page-bg'] = `linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
46
+ vars["--ah-page-bg"] =
47
+ `linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
47
48
  }
48
49
  }
49
50
  // Logo URL (stored for reference, used via prop)
50
51
  if (branding.logo_url) {
51
- vars['--ah-logo-url'] = `url(${branding.logo_url})`;
52
+ vars["--ah-logo-url"] = `url(${branding.logo_url})`;
52
53
  }
53
54
  // Font URL
54
55
  if (branding.font?.url) {
55
- vars['--ah-font-url'] = branding.font.url;
56
+ vars["--ah-font-url"] = branding.font.url;
56
57
  }
57
58
  return vars;
58
59
  }
@@ -68,29 +69,29 @@ function themeToCssVars(theme) {
68
69
  const b = theme.borders;
69
70
  // Widget
70
71
  if (b.widget_corner_radius !== undefined) {
71
- vars['--ah-widget-radius'] = `${b.widget_corner_radius}px`;
72
+ vars["--ah-widget-radius"] = `${b.widget_corner_radius}px`;
72
73
  }
73
74
  if (b.widget_border_weight !== undefined) {
74
- vars['--ah-widget-border-width'] = `${b.widget_border_weight}px`;
75
+ vars["--ah-widget-border-width"] = `${b.widget_border_weight}px`;
75
76
  }
76
77
  if (b.show_widget_shadow === false) {
77
- vars['--ah-widget-shadow'] = 'none';
78
+ vars["--ah-widget-shadow"] = "none";
78
79
  }
79
80
  // Buttons
80
81
  const btnRadius = styleToRadius(b.buttons_style, b.button_border_radius);
81
82
  if (btnRadius) {
82
- vars['--ah-btn-radius'] = btnRadius;
83
+ vars["--ah-btn-radius"] = btnRadius;
83
84
  }
84
85
  if (b.button_border_weight !== undefined) {
85
- vars['--ah-btn-border-width'] = `${b.button_border_weight}px`;
86
+ vars["--ah-btn-border-width"] = `${b.button_border_weight}px`;
86
87
  }
87
88
  // Inputs
88
89
  const inputRadius = styleToRadius(b.inputs_style, b.input_border_radius);
89
90
  if (inputRadius) {
90
- vars['--ah-input-radius'] = inputRadius;
91
+ vars["--ah-input-radius"] = inputRadius;
91
92
  }
92
93
  if (b.input_border_weight !== undefined) {
93
- vars['--ah-input-border-width'] = `${b.input_border_weight}px`;
94
+ vars["--ah-input-border-width"] = `${b.input_border_weight}px`;
94
95
  }
95
96
  }
96
97
  // Colors
@@ -98,68 +99,68 @@ function themeToCssVars(theme) {
98
99
  const c = theme.colors;
99
100
  // Primary button
100
101
  if (c.primary_button) {
101
- vars['--ah-color-primary'] = c.primary_button;
102
- vars['--ah-color-primary-hover'] = c.primary_button;
102
+ vars["--ah-color-primary"] = c.primary_button;
103
+ vars["--ah-color-primary-hover"] = c.primary_button;
103
104
  }
104
105
  if (c.primary_button_label) {
105
- vars['--ah-btn-primary-text'] = c.primary_button_label;
106
+ vars["--ah-btn-primary-text"] = c.primary_button_label;
106
107
  }
107
108
  // Secondary button
108
109
  if (c.secondary_button_border) {
109
- vars['--ah-btn-secondary-border'] = c.secondary_button_border;
110
+ vars["--ah-btn-secondary-border"] = c.secondary_button_border;
110
111
  }
111
112
  if (c.secondary_button_label) {
112
- vars['--ah-btn-secondary-text'] = c.secondary_button_label;
113
+ vars["--ah-btn-secondary-text"] = c.secondary_button_label;
113
114
  }
114
115
  // Text colors
115
116
  if (c.body_text) {
116
- vars['--ah-color-text'] = c.body_text;
117
+ vars["--ah-color-text"] = c.body_text;
117
118
  }
118
119
  if (c.header) {
119
- vars['--ah-color-text-header'] = c.header;
120
+ vars["--ah-color-text-header"] = c.header;
120
121
  }
121
122
  if (c.input_labels_placeholders) {
122
- vars['--ah-color-text-label'] = c.input_labels_placeholders;
123
- vars['--ah-color-text-muted'] = c.input_labels_placeholders;
123
+ vars["--ah-color-text-label"] = c.input_labels_placeholders;
124
+ vars["--ah-color-text-muted"] = c.input_labels_placeholders;
124
125
  }
125
126
  if (c.input_filled_text) {
126
- vars['--ah-color-input-text'] = c.input_filled_text;
127
+ vars["--ah-color-input-text"] = c.input_filled_text;
127
128
  }
128
129
  // Backgrounds
129
130
  if (c.widget_background) {
130
- vars['--ah-color-bg'] = c.widget_background;
131
+ vars["--ah-color-bg"] = c.widget_background;
131
132
  }
132
133
  if (c.input_background) {
133
- vars['--ah-color-input-bg'] = c.input_background;
134
+ vars["--ah-color-input-bg"] = c.input_background;
134
135
  }
135
136
  // Borders
136
137
  if (c.widget_border) {
137
- vars['--ah-widget-border-color'] = c.widget_border;
138
+ vars["--ah-widget-border-color"] = c.widget_border;
138
139
  }
139
140
  if (c.input_border) {
140
- vars['--ah-color-border'] = c.input_border;
141
+ vars["--ah-color-border"] = c.input_border;
141
142
  }
142
143
  // Links
143
144
  if (c.links_focused_components) {
144
- vars['--ah-color-link'] = c.links_focused_components;
145
+ vars["--ah-color-link"] = c.links_focused_components;
145
146
  }
146
147
  // Focus/hover
147
148
  if (c.base_focus_color) {
148
- vars['--ah-color-focus-ring'] = c.base_focus_color;
149
+ vars["--ah-color-focus-ring"] = c.base_focus_color;
149
150
  }
150
151
  if (c.base_hover_color) {
151
- vars['--ah-color-primary-hover'] = c.base_hover_color;
152
+ vars["--ah-color-primary-hover"] = c.base_hover_color;
152
153
  }
153
154
  // Semantic colors
154
155
  if (c.error) {
155
- vars['--ah-color-error'] = c.error;
156
+ vars["--ah-color-error"] = c.error;
156
157
  }
157
158
  if (c.success) {
158
- vars['--ah-color-success'] = c.success;
159
+ vars["--ah-color-success"] = c.success;
159
160
  }
160
161
  // Icons
161
162
  if (c.icons) {
162
- vars['--ah-color-icon'] = c.icons;
163
+ vars["--ah-color-icon"] = c.icons;
163
164
  }
164
165
  }
165
166
  // Fonts
@@ -168,93 +169,93 @@ function themeToCssVars(theme) {
168
169
  // reference_text_size is the base font size in pixels (default 16px)
169
170
  const baseSize = f.reference_text_size || 16;
170
171
  if (f.font_url) {
171
- vars['--ah-font-url'] = f.font_url;
172
+ vars["--ah-font-url"] = f.font_url;
172
173
  }
173
174
  if (f.reference_text_size) {
174
- vars['--ah-font-size-base'] = `${f.reference_text_size}px`;
175
+ vars["--ah-font-size-base"] = `${f.reference_text_size}px`;
175
176
  }
176
177
  // Title, subtitle, etc. sizes are percentages of the base size
177
178
  if (f.title?.size) {
178
179
  const titlePx = Math.round((f.title.size / 100) * baseSize);
179
- vars['--ah-font-size-title'] = `${titlePx}px`;
180
+ vars["--ah-font-size-title"] = `${titlePx}px`;
180
181
  }
181
182
  if (f.subtitle?.size) {
182
183
  const subtitlePx = Math.round((f.subtitle.size / 100) * baseSize);
183
- vars['--ah-font-size-subtitle'] = `${subtitlePx}px`;
184
+ vars["--ah-font-size-subtitle"] = `${subtitlePx}px`;
184
185
  }
185
186
  if (f.body_text?.size) {
186
187
  const bodyPx = Math.round((f.body_text.size / 100) * baseSize);
187
- vars['--ah-font-size-body'] = `${bodyPx}px`;
188
+ vars["--ah-font-size-body"] = `${bodyPx}px`;
188
189
  }
189
190
  if (f.input_labels?.size) {
190
191
  const labelPx = Math.round((f.input_labels.size / 100) * baseSize);
191
- vars['--ah-font-size-label'] = `${labelPx}px`;
192
+ vars["--ah-font-size-label"] = `${labelPx}px`;
192
193
  }
193
194
  if (f.buttons_text?.size) {
194
195
  const btnPx = Math.round((f.buttons_text.size / 100) * baseSize);
195
- vars['--ah-font-size-btn'] = `${btnPx}px`;
196
+ vars["--ah-font-size-btn"] = `${btnPx}px`;
196
197
  }
197
198
  if (f.links?.size) {
198
199
  const linkPx = Math.round((f.links.size / 100) * baseSize);
199
- vars['--ah-font-size-link'] = `${linkPx}px`;
200
+ vars["--ah-font-size-link"] = `${linkPx}px`;
200
201
  }
201
- if (f.links_style === 'underlined') {
202
- vars['--ah-link-decoration'] = 'underline';
202
+ if (f.links_style === "underlined") {
203
+ vars["--ah-link-decoration"] = "underline";
203
204
  }
204
205
  // Font weights - bold option sets font-weight to 700
205
206
  if (f.title?.bold !== undefined) {
206
- vars['--ah-font-weight-title'] = f.title.bold ? '700' : '400';
207
+ vars["--ah-font-weight-title"] = f.title.bold ? "700" : "400";
207
208
  }
208
209
  if (f.subtitle?.bold !== undefined) {
209
- vars['--ah-font-weight-subtitle'] = f.subtitle.bold ? '700' : '400';
210
+ vars["--ah-font-weight-subtitle"] = f.subtitle.bold ? "700" : "400";
210
211
  }
211
212
  if (f.body_text?.bold !== undefined) {
212
- vars['--ah-font-weight-body'] = f.body_text.bold ? '700' : '400';
213
+ vars["--ah-font-weight-body"] = f.body_text.bold ? "700" : "400";
213
214
  }
214
215
  if (f.input_labels?.bold !== undefined) {
215
- vars['--ah-font-weight-label'] = f.input_labels.bold ? '700' : '400';
216
+ vars["--ah-font-weight-label"] = f.input_labels.bold ? "700" : "400";
216
217
  }
217
218
  if (f.buttons_text?.bold !== undefined) {
218
- vars['--ah-font-weight-btn'] = f.buttons_text.bold ? '600' : '400';
219
+ vars["--ah-font-weight-btn"] = f.buttons_text.bold ? "600" : "400";
219
220
  }
220
221
  if (f.links?.bold !== undefined) {
221
- vars['--ah-font-weight-link'] = f.links.bold ? '700' : '400';
222
+ vars["--ah-font-weight-link"] = f.links.bold ? "700" : "400";
222
223
  }
223
224
  }
224
225
  // Widget settings
225
226
  if (theme.widget) {
226
227
  const w = theme.widget;
227
228
  if (w.header_text_alignment) {
228
- vars['--ah-title-align'] = w.header_text_alignment;
229
+ vars["--ah-title-align"] = w.header_text_alignment;
229
230
  }
230
231
  if (w.logo_height) {
231
- vars['--ah-logo-height'] = `${w.logo_height}px`;
232
+ vars["--ah-logo-height"] = `${w.logo_height}px`;
232
233
  }
233
234
  if (w.logo_position) {
234
235
  const positionMap = {
235
- center: 'center',
236
- left: 'flex-start',
237
- right: 'flex-end',
236
+ center: "center",
237
+ left: "flex-start",
238
+ right: "flex-end",
238
239
  };
239
- if (w.logo_position === 'none') {
240
- vars['--ah-logo-display'] = 'none';
240
+ if (w.logo_position === "none") {
241
+ vars["--ah-logo-display"] = "none";
241
242
  }
242
243
  else {
243
- vars['--ah-logo-align'] = positionMap[w.logo_position] ?? 'center';
244
+ vars["--ah-logo-align"] = positionMap[w.logo_position] ?? "center";
244
245
  }
245
246
  }
246
247
  if (w.social_buttons_layout) {
247
248
  // 'top' means social buttons above fields, 'bottom' means below
248
249
  // Divider is always order 1 (middle)
249
- if (w.social_buttons_layout === 'top') {
250
- vars['--ah-social-order'] = '0';
251
- vars['--ah-divider-order'] = '1';
252
- vars['--ah-fields-order'] = '2';
250
+ if (w.social_buttons_layout === "top") {
251
+ vars["--ah-social-order"] = "0";
252
+ vars["--ah-divider-order"] = "1";
253
+ vars["--ah-fields-order"] = "2";
253
254
  }
254
255
  else {
255
- vars['--ah-social-order'] = '2';
256
- vars['--ah-divider-order'] = '1';
257
- vars['--ah-fields-order'] = '0';
256
+ vars["--ah-social-order"] = "2";
257
+ vars["--ah-divider-order"] = "1";
258
+ vars["--ah-fields-order"] = "0";
258
259
  }
259
260
  }
260
261
  }
@@ -262,10 +263,10 @@ function themeToCssVars(theme) {
262
263
  if (theme.page_background) {
263
264
  const pb = theme.page_background;
264
265
  if (pb.background_color) {
265
- vars['--ah-page-bg'] = pb.background_color;
266
+ vars["--ah-page-bg"] = pb.background_color;
266
267
  }
267
268
  if (pb.background_image_url) {
268
- vars['--ah-page-bg-image'] = `url(${pb.background_image_url})`;
269
+ vars["--ah-page-bg-image"] = `url(${pb.background_image_url})`;
269
270
  }
270
271
  }
271
272
  return vars;
@@ -1 +1 @@
1
- export * from './types/components';
1
+ export * from "./types/components";