@widgetic/editor 4.1.12 → 4.1.13
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.
|
@@ -800,6 +800,12 @@
|
|
|
800
800
|
*/
|
|
801
801
|
function handleFontSelect(font: FontItem | RecentFont) {
|
|
802
802
|
if (onChange) {
|
|
803
|
+
// The family has to reach the card even when the weight catalog fails.
|
|
804
|
+
onChange({
|
|
805
|
+
family: font.family,
|
|
806
|
+
weight: 'Regular',
|
|
807
|
+
category: font.category
|
|
808
|
+
});
|
|
803
809
|
// Reset weight to Regular or first available weight
|
|
804
810
|
fetchFontWeights(font.family).then(async () => {
|
|
805
811
|
const newWeight = availableWeights.includes('Regular') ?
|
|
@@ -828,6 +834,8 @@
|
|
|
828
834
|
// console.log('✅ [FontInput] Font selected:', {
|
|
829
835
|
// font: fontValue
|
|
830
836
|
// });
|
|
837
|
+
}).catch((error) => {
|
|
838
|
+
console.error('[FontInput] Weight lookup failed after the family was applied:', error);
|
|
831
839
|
});
|
|
832
840
|
}
|
|
833
841
|
}
|
|
@@ -1414,6 +1422,15 @@
|
|
|
1414
1422
|
* Fetches and processes font weights from Google Fonts API
|
|
1415
1423
|
* or from fonts.json for custom fonts
|
|
1416
1424
|
*/
|
|
1425
|
+
function keepWeightIfListed() {
|
|
1426
|
+
const currentName = selectedWeight.startsWith(`${controllerId}-`)
|
|
1427
|
+
? selectedWeight.slice(controllerId.length + 1)
|
|
1428
|
+
: '';
|
|
1429
|
+
if (!availableWeights.includes(currentName)) {
|
|
1430
|
+
selectedWeight = `${controllerId}-${availableWeights.includes('Regular') ? 'Regular' : availableWeights[0]}`;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1417
1434
|
async function fetchFontWeights(fontFamily: string) {
|
|
1418
1435
|
try {
|
|
1419
1436
|
// Wait for FontManager init — reactive weight fetch can race ahead of onMount.
|
|
@@ -1480,12 +1497,12 @@
|
|
|
1480
1497
|
fontCatalogFallbackWarned = true;
|
|
1481
1498
|
console.warn('[FontInput] Using default weights (Google catalog not loaded). Later fonts will use the same fallback silently.');
|
|
1482
1499
|
}
|
|
1483
|
-
availableWeights = ['Regular', 'Bold'];
|
|
1484
|
-
|
|
1500
|
+
availableWeights = ['Regular', 'Italic', 'Bold', 'Bold Italic'];
|
|
1501
|
+
keepWeightIfListed();
|
|
1485
1502
|
} catch (error) {
|
|
1486
1503
|
console.error('Error fetching font weights:', error);
|
|
1487
|
-
availableWeights = ['Regular'];
|
|
1488
|
-
|
|
1504
|
+
availableWeights = ['Regular', 'Italic', 'Bold', 'Bold Italic'];
|
|
1505
|
+
keepWeightIfListed();
|
|
1489
1506
|
}
|
|
1490
1507
|
}
|
|
1491
1508
|
|
|
@@ -1814,8 +1831,10 @@
|
|
|
1814
1831
|
collisionPadding={12}
|
|
1815
1832
|
side={familyPopoverSide}
|
|
1816
1833
|
sideOffset={4}
|
|
1834
|
+
tabindex={-1}
|
|
1835
|
+
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
1817
1836
|
portalProps={{ to: fontPickerPortalHost }}
|
|
1818
|
-
class="font-input-popover !p-0 widgetic-colors widgetic-radius rounded-medium modal-shadow border border-grey2"
|
|
1837
|
+
class="font-input-popover !p-0 widgetic-colors widgetic-radius rounded-medium modal-shadow border border-grey2 outline-none"
|
|
1819
1838
|
style={familyPopoverStyle}
|
|
1820
1839
|
>
|
|
1821
1840
|
<div class="flex flex-col h-full min-h-0 font-popover-content">
|
|
@@ -2020,15 +2039,21 @@
|
|
|
2020
2039
|
</span>
|
|
2021
2040
|
<IconCaretDownFilled class="w-5 h-5 shrink-0 text-grey5 group-hover:text-grey7" />
|
|
2022
2041
|
</Popover.Trigger>
|
|
2023
|
-
<Popover.Content
|
|
2042
|
+
<Popover.Content
|
|
2043
|
+
class="font-input-popover p-0 w-[150px] outline-none"
|
|
2044
|
+
tabindex={-1}
|
|
2045
|
+
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
2046
|
+
portalProps={{ to: fontPickerPortalHost }}
|
|
2047
|
+
>
|
|
2024
2048
|
<Command.Root>
|
|
2025
2049
|
<Command.List aria-label={$t('editor.font.weightList')}>
|
|
2026
2050
|
<Command.Group>
|
|
2027
2051
|
{#each availableWeights as weight}
|
|
2028
2052
|
<Command.Item
|
|
2029
2053
|
value={weight}
|
|
2054
|
+
tabindex={-1}
|
|
2030
2055
|
onSelect={() => handleWeightSelect(weight)}
|
|
2031
|
-
class="px-2 py-2"
|
|
2056
|
+
class="px-2 py-2 outline-none"
|
|
2032
2057
|
>
|
|
2033
2058
|
<Check
|
|
2034
2059
|
class="me-1 h-4 w-4 {displayWeight === weight ? 'opacity-100' : 'opacity-0'}"
|
|
@@ -2119,14 +2144,12 @@
|
|
|
2119
2144
|
.font-family-input-ct :global(button:focus-visible),
|
|
2120
2145
|
.font-weight-input-ct :global(button:focus),
|
|
2121
2146
|
.font-weight-input-ct :global(button:focus-visible),
|
|
2122
|
-
:global(.font-input-popover
|
|
2123
|
-
:global(.font-input-popover
|
|
2124
|
-
:global(.font-
|
|
2125
|
-
:global(.font-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
outline: none;
|
|
2129
|
-
box-shadow: none;
|
|
2147
|
+
:global(.font-input-popover:focus),
|
|
2148
|
+
:global(.font-input-popover:focus-visible),
|
|
2149
|
+
:global(.font-input-popover *:focus),
|
|
2150
|
+
:global(.font-input-popover *:focus-visible) {
|
|
2151
|
+
outline: none !important;
|
|
2152
|
+
outline-offset: 0 !important;
|
|
2130
2153
|
}
|
|
2131
2154
|
|
|
2132
2155
|
/* Clamp to the viewport so the Fonts header and list stay on screen */
|