@drawbridge/components 0.0.55 → 0.0.57
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/provider-font.js +8 -3
- package/dist/provider-font.mjs +8 -3
- package/package.json +4 -3
package/dist/provider-font.js
CHANGED
|
@@ -28,6 +28,7 @@ var defaults = {
|
|
|
28
28
|
family: "Roboto Flex",
|
|
29
29
|
transform: "none"
|
|
30
30
|
};
|
|
31
|
+
var FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
|
|
31
32
|
var toWeight = (value) => {
|
|
32
33
|
var _a;
|
|
33
34
|
if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
|
|
@@ -50,11 +51,11 @@ var ProviderFont = (0, import_react.memo)(({
|
|
|
50
51
|
];
|
|
51
52
|
const fonts2 = {
|
|
52
53
|
body: {
|
|
53
|
-
fontFamily: '"' + bodyFamily + '"',
|
|
54
|
+
fontFamily: '"' + bodyFamily + '", ' + FALLBACK,
|
|
54
55
|
textTransform: (body == null ? void 0 : body.transform) || defaults.transform
|
|
55
56
|
},
|
|
56
57
|
heading: {
|
|
57
|
-
fontFamily: '"' + headingFamily + '"',
|
|
58
|
+
fontFamily: '"' + headingFamily + '", ' + FALLBACK,
|
|
58
59
|
textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
|
|
59
60
|
}
|
|
60
61
|
};
|
|
@@ -69,7 +70,7 @@ var ProviderFont = (0, import_react.memo)(({
|
|
|
69
70
|
url2.push((same ? "," : ":") + heading.weight);
|
|
70
71
|
fonts2.heading.fontWeight = toWeight(heading.weight);
|
|
71
72
|
}
|
|
72
|
-
url2.push("&display=
|
|
73
|
+
url2.push("&display=optional");
|
|
73
74
|
return { url: url2, fonts: fonts2 };
|
|
74
75
|
},
|
|
75
76
|
[body, heading]
|
|
@@ -81,6 +82,10 @@ var ProviderFont = (0, import_react.memo)(({
|
|
|
81
82
|
...{
|
|
82
83
|
href: url.join(""),
|
|
83
84
|
rel: "stylesheet",
|
|
85
|
+
// precedence makes React hoist + dedupe the stylesheet into
|
|
86
|
+
// <head> during SSR so the font CSS is discovered early
|
|
87
|
+
// instead of mid-tree (late) — pulls the font load forward.
|
|
88
|
+
precedence: "high",
|
|
84
89
|
...onError && {
|
|
85
90
|
onError
|
|
86
91
|
}
|
package/dist/provider-font.mjs
CHANGED
|
@@ -5,6 +5,7 @@ var defaults = {
|
|
|
5
5
|
family: "Roboto Flex",
|
|
6
6
|
transform: "none"
|
|
7
7
|
};
|
|
8
|
+
var FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
|
|
8
9
|
var toWeight = (value) => {
|
|
9
10
|
var _a;
|
|
10
11
|
if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
|
|
@@ -27,11 +28,11 @@ var ProviderFont = memo(({
|
|
|
27
28
|
];
|
|
28
29
|
const fonts2 = {
|
|
29
30
|
body: {
|
|
30
|
-
fontFamily: '"' + bodyFamily + '"',
|
|
31
|
+
fontFamily: '"' + bodyFamily + '", ' + FALLBACK,
|
|
31
32
|
textTransform: (body == null ? void 0 : body.transform) || defaults.transform
|
|
32
33
|
},
|
|
33
34
|
heading: {
|
|
34
|
-
fontFamily: '"' + headingFamily + '"',
|
|
35
|
+
fontFamily: '"' + headingFamily + '", ' + FALLBACK,
|
|
35
36
|
textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
|
|
36
37
|
}
|
|
37
38
|
};
|
|
@@ -46,7 +47,7 @@ var ProviderFont = memo(({
|
|
|
46
47
|
url2.push((same ? "," : ":") + heading.weight);
|
|
47
48
|
fonts2.heading.fontWeight = toWeight(heading.weight);
|
|
48
49
|
}
|
|
49
|
-
url2.push("&display=
|
|
50
|
+
url2.push("&display=optional");
|
|
50
51
|
return { url: url2, fonts: fonts2 };
|
|
51
52
|
},
|
|
52
53
|
[body, heading]
|
|
@@ -58,6 +59,10 @@ var ProviderFont = memo(({
|
|
|
58
59
|
...{
|
|
59
60
|
href: url.join(""),
|
|
60
61
|
rel: "stylesheet",
|
|
62
|
+
// precedence makes React hoist + dedupe the stylesheet into
|
|
63
|
+
// <head> during SSR so the font CSS is discovered early
|
|
64
|
+
// instead of mid-tree (late) — pulls the font load forward.
|
|
65
|
+
precedence: "high",
|
|
61
66
|
...onError && {
|
|
62
67
|
onError
|
|
63
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -343,7 +343,8 @@
|
|
|
343
343
|
},
|
|
344
344
|
"scripts": {
|
|
345
345
|
"sync": ". \"$HOME/.nvm/nvm.sh\" && nvm use && npm prune && npm install && npx drawbridge-agents-sync",
|
|
346
|
-
"
|
|
346
|
+
"test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test",
|
|
347
|
+
"build": ". \"$HOME/.nvm/nvm.sh\" && nvm use && tsup && node --test && npm publish"
|
|
347
348
|
},
|
|
348
349
|
"peerDependencies": {
|
|
349
350
|
"@drawbridge/drawbridge-utils": ">=0.0.61",
|
|
@@ -356,7 +357,7 @@
|
|
|
356
357
|
"tsup": "8.5.1"
|
|
357
358
|
},
|
|
358
359
|
"dependencies": {
|
|
359
|
-
"@drawbridge/drawbridge-agents": "0.
|
|
360
|
+
"@drawbridge/drawbridge-agents": "0.1.10",
|
|
360
361
|
"embla-carousel-fade": "8.6.0",
|
|
361
362
|
"embla-carousel-react": "8.6.0",
|
|
362
363
|
"react-player": "2.16.0",
|