@oxyhq/bloom 0.71.0 → 0.72.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/lib/commonjs/fonts/apply-font-faces.js +5 -4
- package/lib/commonjs/fonts/apply-font-faces.js.map +1 -1
- package/lib/commonjs/fonts/apply-font-faces.web.js +14 -16
- package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/commonjs/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/commonjs/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/commonjs/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/commonjs/fonts/assets/InterVariable.woff2 +0 -0
- package/lib/commonjs/fonts/font-assets.web.js +3 -2
- package/lib/commonjs/fonts/font-assets.web.js.map +1 -1
- package/lib/commonjs/fonts/font-urls.web.js +35 -0
- package/lib/commonjs/fonts/font-urls.web.js.map +1 -0
- package/lib/module/fonts/apply-font-faces.js +5 -4
- package/lib/module/fonts/apply-font-faces.js.map +1 -1
- package/lib/module/fonts/apply-font-faces.web.js +14 -16
- package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/module/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/module/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/module/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/module/fonts/assets/InterVariable.woff2 +0 -0
- package/lib/module/fonts/font-assets.web.js +3 -2
- package/lib/module/fonts/font-assets.web.js.map +1 -1
- package/lib/module/fonts/font-urls.web.js +32 -0
- package/lib/module/fonts/font-urls.web.js.map +1 -0
- package/lib/module/fonts/index.web.js +3 -3
- package/lib/typescript/commonjs/fonts/apply-font-faces.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +9 -11
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/font-assets.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/font-urls.web.d.ts +6 -0
- package/lib/typescript/commonjs/fonts/font-urls.web.d.ts.map +1 -0
- package/lib/typescript/module/fonts/apply-font-faces.d.ts.map +1 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +9 -11
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/font-assets.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/font-urls.web.d.ts +6 -0
- package/lib/typescript/module/fonts/font-urls.web.d.ts.map +1 -0
- package/package.json +4 -7
- package/src/__tests__/apply-font-faces.test.ts +32 -0
- package/src/fonts/apply-font-faces.ts +5 -4
- package/src/fonts/apply-font-faces.web.ts +14 -16
- package/src/fonts/font-assets.web.ts +3 -2
- package/src/fonts/font-urls.web.ts +30 -0
- package/src/fonts/index.web.ts +3 -3
- package/lib/commonjs/fonts/font-data.web.js +0 -22
- package/lib/commonjs/fonts/font-data.web.js.map +0 -1
- package/lib/module/fonts/font-data.web.js +0 -18
- package/lib/module/fonts/font-data.web.js.map +0 -1
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts +0 -5
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts.map +0 -1
- package/lib/typescript/module/fonts/font-data.web.d.ts +0 -5
- package/lib/typescript/module/fonts/font-data.web.d.ts.map +0 -1
- package/src/fonts/font-data.web.ts +0 -15
|
@@ -8,10 +8,11 @@ exports.applyFontFaces = applyFontFaces;
|
|
|
8
8
|
// is selected by bundlers via the package.json conditions. RN consumers
|
|
9
9
|
// never need font-face injection — useFonts handles loading on native.
|
|
10
10
|
//
|
|
11
|
-
// The
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
11
|
+
// The split is load-bearing, not decorative: the web variant reaches
|
|
12
|
+
// `font-urls.web.ts`, whose module-level `.woff2` imports would otherwise
|
|
13
|
+
// drag a second, unusable copy of every font into the native bundle
|
|
14
|
+
// (Metro resolves an asset import on native to a registry id, not a URL).
|
|
15
|
+
// Keeping this stub empty is what guarantees native pays nothing for them.
|
|
15
16
|
function applyFontFaces() {
|
|
16
17
|
// intentionally empty
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["applyFontFaces"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAAA,EAAS;EACrC;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["applyFontFaces"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAAA,EAAS;EACrC;AAAA","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.applyFontFaces = applyFontFaces;
|
|
7
|
-
var
|
|
7
|
+
var _fontUrlsWeb = require("./font-urls.web.js");
|
|
8
8
|
var _tokens = require("./tokens.js");
|
|
9
9
|
const STYLE_ID = 'bloom-fonts';
|
|
10
10
|
|
|
@@ -12,18 +12,16 @@ const STYLE_ID = 'bloom-fonts';
|
|
|
12
12
|
* Inject @font-face rules and font CSS variables onto :root.
|
|
13
13
|
*
|
|
14
14
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
15
|
-
* stub —
|
|
16
|
-
* the font payload out of the native bundle entirely.
|
|
17
|
-
* call multiple times; subsequent calls early-return
|
|
18
|
-
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
19
|
-
* `typeof document === 'undefined'` guard.
|
|
15
|
+
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
16
|
+
* split keeps the web font payload out of the native bundle entirely.
|
|
17
|
+
* Idempotent: safe to call multiple times; subsequent calls early-return
|
|
18
|
+
* after the `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
19
|
+
* the `typeof document === 'undefined'` guard.
|
|
20
20
|
*
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
26
|
-
* for the rationale and trade-offs.
|
|
21
|
+
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
22
|
+
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
23
|
+
* module for the per-bundler details and for the one thing a consumer has to
|
|
24
|
+
* provide (Metro needs `woff2` in `assetExts`).
|
|
27
25
|
*/
|
|
28
26
|
function applyFontFaces() {
|
|
29
27
|
if (typeof document === 'undefined') return;
|
|
@@ -31,10 +29,10 @@ function applyFontFaces() {
|
|
|
31
29
|
const style = document.createElement('style');
|
|
32
30
|
style.id = STYLE_ID;
|
|
33
31
|
style.textContent = `
|
|
34
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${
|
|
35
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${
|
|
36
|
-
@font-face { font-family: 'Inter'; src: url(${
|
|
37
|
-
@font-face { font-family: 'Geist Mono'; src: url(${
|
|
32
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${_fontUrlsWeb.blomusModernusRegular}") format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
|
|
33
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${_fontUrlsWeb.blomusModernusBold}") format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
|
|
34
|
+
@font-face { font-family: 'Inter'; src: url("${_fontUrlsWeb.interVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
35
|
+
@font-face { font-family: 'Geist Mono'; src: url("${_fontUrlsWeb.geistMonoVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
38
36
|
:root {
|
|
39
37
|
--bloom-font-display: ${_tokens.fontFamilies.display};
|
|
40
38
|
--bloom-font-sans: ${_tokens.fontFamilies.sans};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_fontUrlsWeb","require","_tokens","STYLE_ID","applyFontFaces","document","getElementById","style","createElement","id","textContent","blomusModernusRegular","blomusModernusBold","interVariable","geistMonoVariable","fontFamilies","display","sans","mono","head","appendChild"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.web.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,QAAQ,GAAG,aAAa;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAA,EAAS;EACrC,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;EACrC,IAAIA,QAAQ,CAACC,cAAc,CAACH,QAAQ,CAAC,EAAE;EAEvC,MAAMI,KAAK,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EAC7CD,KAAK,CAACE,EAAE,GAAGN,QAAQ;EACnBI,KAAK,CAACG,WAAW,GAAG;AACtB,4DAA4DC,kCAAqB;AACjF,4DAA4DC,+BAAkB;AAC9E,mDAAmDC,0BAAa;AAChE,wDAAwDC,8BAAiB;AACzE;AACA,8BAA8BC,oBAAY,CAACC,OAAO;AAClD,2BAA2BD,oBAAY,CAACE,IAAI;AAC5C,2BAA2BF,oBAAY,CAACG,IAAI;AAC5C;AACA,GAAG;EACDb,QAAQ,CAACc,IAAI,CAACC,WAAW,CAACb,KAAK,CAAC;AAClC","ignoreList":[]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -8,8 +8,9 @@ exports.FONT_ASSETS = void 0;
|
|
|
8
8
|
//
|
|
9
9
|
// `useFonts()` is native-only — the web `FontLoader` (`FontLoader.tsx`) calls
|
|
10
10
|
// `applyFontFaces()` instead, which injects the same four families as
|
|
11
|
-
// `@font-face` rules
|
|
12
|
-
// `font-
|
|
11
|
+
// `@font-face` rules pointing at bundler-emitted `.woff2` URLs
|
|
12
|
+
// (`apply-font-faces.web.ts` / `font-urls.web.ts`). So the map is empty by
|
|
13
|
+
// design, not by omission.
|
|
13
14
|
//
|
|
14
15
|
// This file exists so `index.web.ts` can name its font-asset source
|
|
15
16
|
// explicitly, exactly as it already does for `./apply-font-faces.web`. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FONT_ASSETS","exports"],"sourceRoot":"../../../src","sources":["fonts/font-assets.web.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMA,WAAyB,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["FONT_ASSETS","exports"],"sourceRoot":"../../../src","sources":["fonts/font-assets.web.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMA,WAAyB,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "blomusModernusBold", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BlomusModernusBold.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "blomusModernusRegular", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _BlomusModernusRegular.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "geistMonoVariable", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _GeistMonoVariable.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "interVariable", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _InterVariable.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _BlomusModernusBold = _interopRequireDefault(require("./assets/BlomusModernus-Bold.woff2"));
|
|
31
|
+
var _BlomusModernusRegular = _interopRequireDefault(require("./assets/BlomusModernus-Regular.woff2"));
|
|
32
|
+
var _GeistMonoVariable = _interopRequireDefault(require("./assets/GeistMono-Variable.woff2"));
|
|
33
|
+
var _InterVariable = _interopRequireDefault(require("./assets/InterVariable.woff2"));
|
|
34
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
|
+
//# sourceMappingURL=font-urls.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_BlomusModernusBold","_interopRequireDefault","require","_BlomusModernusRegular","_GeistMonoVariable","_InterVariable","e","__esModule","default"],"sourceRoot":"../../../src","sources":["fonts/font-urls.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
// is selected by bundlers via the package.json conditions. RN consumers
|
|
5
5
|
// never need font-face injection — useFonts handles loading on native.
|
|
6
6
|
//
|
|
7
|
-
// The
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// The split is load-bearing, not decorative: the web variant reaches
|
|
8
|
+
// `font-urls.web.ts`, whose module-level `.woff2` imports would otherwise
|
|
9
|
+
// drag a second, unusable copy of every font into the native bundle
|
|
10
|
+
// (Metro resolves an asset import on native to a registry id, not a URL).
|
|
11
|
+
// Keeping this stub empty is what guarantees native pays nothing for them.
|
|
11
12
|
export function applyFontFaces() {
|
|
12
13
|
// intentionally empty
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["applyFontFaces"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAAA,EAAS;EACrC;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["applyFontFaces"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAAA,EAAS;EACrC;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable } from "./font-
|
|
3
|
+
import { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable } from "./font-urls.web.js";
|
|
4
4
|
import { fontFamilies } from "./tokens.js";
|
|
5
5
|
const STYLE_ID = 'bloom-fonts';
|
|
6
6
|
|
|
@@ -8,18 +8,16 @@ const STYLE_ID = 'bloom-fonts';
|
|
|
8
8
|
* Inject @font-face rules and font CSS variables onto :root.
|
|
9
9
|
*
|
|
10
10
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
11
|
-
* stub —
|
|
12
|
-
* the font payload out of the native bundle entirely.
|
|
13
|
-
* call multiple times; subsequent calls early-return
|
|
14
|
-
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
15
|
-
* `typeof document === 'undefined'` guard.
|
|
11
|
+
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
12
|
+
* split keeps the web font payload out of the native bundle entirely.
|
|
13
|
+
* Idempotent: safe to call multiple times; subsequent calls early-return
|
|
14
|
+
* after the `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
15
|
+
* the `typeof document === 'undefined'` guard.
|
|
16
16
|
*
|
|
17
|
-
* The
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
22
|
-
* for the rationale and trade-offs.
|
|
17
|
+
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
18
|
+
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
19
|
+
* module for the per-bundler details and for the one thing a consumer has to
|
|
20
|
+
* provide (Metro needs `woff2` in `assetExts`).
|
|
23
21
|
*/
|
|
24
22
|
export function applyFontFaces() {
|
|
25
23
|
if (typeof document === 'undefined') return;
|
|
@@ -27,10 +25,10 @@ export function applyFontFaces() {
|
|
|
27
25
|
const style = document.createElement('style');
|
|
28
26
|
style.id = STYLE_ID;
|
|
29
27
|
style.textContent = `
|
|
30
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${blomusModernusRegular}) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
|
|
31
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${blomusModernusBold}) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
|
|
32
|
-
@font-face { font-family: 'Inter'; src: url(${interVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
33
|
-
@font-face { font-family: 'Geist Mono'; src: url(${geistMonoVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
28
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${blomusModernusRegular}") format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
|
|
29
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${blomusModernusBold}") format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
|
|
30
|
+
@font-face { font-family: 'Inter'; src: url("${interVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
31
|
+
@font-face { font-family: 'Geist Mono'; src: url("${geistMonoVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
34
32
|
:root {
|
|
35
33
|
--bloom-font-display: ${fontFamilies.display};
|
|
36
34
|
--bloom-font-sans: ${fontFamilies.sans};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["blomusModernusRegular","blomusModernusBold","interVariable","geistMonoVariable","fontFamilies","STYLE_ID","applyFontFaces","document","getElementById","style","createElement","id","textContent","display","sans","mono","head","appendChild"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.web.ts"],"mappings":";;AAAA,SACEA,qBAAqB,EACrBC,kBAAkB,EAClBC,aAAa,EACbC,iBAAiB,QACZ,oBAAiB;AACxB,SAASC,YAAY,QAAQ,aAAU;AAEvC,MAAMC,QAAQ,GAAG,aAAa;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["blomusModernusRegular","blomusModernusBold","interVariable","geistMonoVariable","fontFamilies","STYLE_ID","applyFontFaces","document","getElementById","style","createElement","id","textContent","display","sans","mono","head","appendChild"],"sourceRoot":"../../../src","sources":["fonts/apply-font-faces.web.ts"],"mappings":";;AAAA,SACEA,qBAAqB,EACrBC,kBAAkB,EAClBC,aAAa,EACbC,iBAAiB,QACZ,oBAAiB;AACxB,SAASC,YAAY,QAAQ,aAAU;AAEvC,MAAMC,QAAQ,GAAG,aAAa;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAS;EACrC,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;EACrC,IAAIA,QAAQ,CAACC,cAAc,CAACH,QAAQ,CAAC,EAAE;EAEvC,MAAMI,KAAK,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EAC7CD,KAAK,CAACE,EAAE,GAAGN,QAAQ;EACnBI,KAAK,CAACG,WAAW,GAAG;AACtB,4DAA4DZ,qBAAqB;AACjF,4DAA4DC,kBAAkB;AAC9E,mDAAmDC,aAAa;AAChE,wDAAwDC,iBAAiB;AACzE;AACA,8BAA8BC,YAAY,CAACS,OAAO;AAClD,2BAA2BT,YAAY,CAACU,IAAI;AAC5C,2BAA2BV,YAAY,CAACW,IAAI;AAC5C;AACA,GAAG;EACDR,QAAQ,CAACS,IAAI,CAACC,WAAW,CAACR,KAAK,CAAC;AAClC","ignoreList":[]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
//
|
|
5
5
|
// `useFonts()` is native-only — the web `FontLoader` (`FontLoader.tsx`) calls
|
|
6
6
|
// `applyFontFaces()` instead, which injects the same four families as
|
|
7
|
-
// `@font-face` rules
|
|
8
|
-
// `font-
|
|
7
|
+
// `@font-face` rules pointing at bundler-emitted `.woff2` URLs
|
|
8
|
+
// (`apply-font-faces.web.ts` / `font-urls.web.ts`). So the map is empty by
|
|
9
|
+
// design, not by omission.
|
|
9
10
|
//
|
|
10
11
|
// This file exists so `index.web.ts` can name its font-asset source
|
|
11
12
|
// explicitly, exactly as it already does for `./apply-font-faces.web`. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FONT_ASSETS"],"sourceRoot":"../../../src","sources":["fonts/font-assets.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMA,WAAyB,GAAG,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["FONT_ASSETS"],"sourceRoot":"../../../src","sources":["fonts/font-assets.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMA,WAAyB,GAAG,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Web font URLs, resolved by whatever bundler is building the consuming app.
|
|
4
|
+
//
|
|
5
|
+
// WEB-ONLY. Each import below hands the `.woff2` to the app's asset pipeline,
|
|
6
|
+
// which emits it as a standalone file and gives us back its URL:
|
|
7
|
+
//
|
|
8
|
+
// - Metro (Expo web) rewrites the import to the exported asset path — its
|
|
9
|
+
// asset transformer emits a bare string module whenever the platform is
|
|
10
|
+
// `web`, so the imported value is the URL itself, not an asset id.
|
|
11
|
+
// - Vite, Rollup and webpack 5 resolve it through their own asset handling
|
|
12
|
+
// and return a content-hashed URL.
|
|
13
|
+
//
|
|
14
|
+
// Either way the browser fetches the four families alongside the JS and caches
|
|
15
|
+
// them under their own URLs, instead of re-parsing ~310 KB of base64 out of the
|
|
16
|
+
// entry bundle on every cold load. No consumer ever writes an asset filename
|
|
17
|
+
// down, so a font swap here cannot leave a downstream app pointing at a file
|
|
18
|
+
// that no longer exists.
|
|
19
|
+
//
|
|
20
|
+
// Metro does not carry `woff2` in its default `assetExts`, so a consumer
|
|
21
|
+
// bundling for web with Metro has to register it; `@oxyhq/app-preset`'s Metro
|
|
22
|
+
// base already does that for every Oxy app.
|
|
23
|
+
//
|
|
24
|
+
// Native never reaches this module. The default `apply-font-faces.ts` is a
|
|
25
|
+
// no-op stub and `FontLoader.native.tsx` loads the `.ttf` variants through
|
|
26
|
+
// `useFonts` instead, so no web font bytes enter a native bundle.
|
|
27
|
+
import blomusModernusBold from './assets/BlomusModernus-Bold.woff2';
|
|
28
|
+
import blomusModernusRegular from './assets/BlomusModernus-Regular.woff2';
|
|
29
|
+
import geistMonoVariable from './assets/GeistMono-Variable.woff2';
|
|
30
|
+
import interVariable from './assets/InterVariable.woff2';
|
|
31
|
+
export { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable };
|
|
32
|
+
//# sourceMappingURL=font-urls.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["blomusModernusBold","blomusModernusRegular","geistMonoVariable","interVariable"],"sourceRoot":"../../../src","sources":["fonts/font-urls.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,kBAAkB,MAAM,oCAAoC;AACnE,OAAOC,qBAAqB,MAAM,uCAAuC;AACzE,OAAOC,iBAAiB,MAAM,mCAAmC;AACjE,OAAOC,aAAa,MAAM,8BAA8B;AAExD,SAASF,qBAAqB,EAAED,kBAAkB,EAAEG,aAAa,EAAED,iBAAiB","ignoreList":[]}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// of the box), so an extensionless specifier here would quietly fall through
|
|
9
9
|
// to the default file.
|
|
10
10
|
//
|
|
11
|
-
// - `./apply-font-faces.web` performs the real `@font-face` injection
|
|
12
|
-
//
|
|
13
|
-
// `./apply-font-faces` is a no-op stub for native.
|
|
11
|
+
// - `./apply-font-faces.web` performs the real `@font-face` injection against
|
|
12
|
+
// the `.woff2` URLs the consuming bundler emits (see `font-urls.web.ts`);
|
|
13
|
+
// the default `./apply-font-faces` is a no-op stub for native.
|
|
14
14
|
// - `./font-assets.web` is an empty map. The native map is built from Metro
|
|
15
15
|
// asset `require()` calls, and importing it from an ES module throws
|
|
16
16
|
// `ReferenceError: require is not defined` during module evaluation — which
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-font-faces.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.ts"],"names":[],"mappings":"AASA,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
* Inject @font-face rules and font CSS variables onto :root.
|
|
3
3
|
*
|
|
4
4
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
5
|
-
* stub —
|
|
6
|
-
* the font payload out of the native bundle entirely.
|
|
7
|
-
* call multiple times; subsequent calls early-return
|
|
8
|
-
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
9
|
-
* `typeof document === 'undefined'` guard.
|
|
5
|
+
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
6
|
+
* split keeps the web font payload out of the native bundle entirely.
|
|
7
|
+
* Idempotent: safe to call multiple times; subsequent calls early-return
|
|
8
|
+
* after the `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
9
|
+
* the `typeof document === 'undefined'` guard.
|
|
10
10
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
16
|
-
* for the rationale and trade-offs.
|
|
11
|
+
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
12
|
+
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
13
|
+
* module for the per-bundler details and for the one thing a consumer has to
|
|
14
|
+
* provide (Metro needs `woff2` in `assetExts`).
|
|
17
15
|
*/
|
|
18
16
|
export declare function applyFontFaces(): void;
|
|
19
17
|
//# sourceMappingURL=apply-font-faces.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAkBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-assets.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-assets.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-assets.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-assets.web.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,YAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import blomusModernusBold from './assets/BlomusModernus-Bold.woff2';
|
|
2
|
+
import blomusModernusRegular from './assets/BlomusModernus-Regular.woff2';
|
|
3
|
+
import geistMonoVariable from './assets/GeistMono-Variable.woff2';
|
|
4
|
+
import interVariable from './assets/InterVariable.woff2';
|
|
5
|
+
export { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable };
|
|
6
|
+
//# sourceMappingURL=font-urls.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-urls.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-urls.web.ts"],"names":[],"mappings":"AAwBA,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,qBAAqB,MAAM,uCAAuC,CAAC;AAC1E,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-font-faces.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.ts"],"names":[],"mappings":"AASA,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
* Inject @font-face rules and font CSS variables onto :root.
|
|
3
3
|
*
|
|
4
4
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
5
|
-
* stub —
|
|
6
|
-
* the font payload out of the native bundle entirely.
|
|
7
|
-
* call multiple times; subsequent calls early-return
|
|
8
|
-
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
9
|
-
* `typeof document === 'undefined'` guard.
|
|
5
|
+
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
6
|
+
* split keeps the web font payload out of the native bundle entirely.
|
|
7
|
+
* Idempotent: safe to call multiple times; subsequent calls early-return
|
|
8
|
+
* after the `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
9
|
+
* the `typeof document === 'undefined'` guard.
|
|
10
10
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
16
|
-
* for the rationale and trade-offs.
|
|
11
|
+
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
12
|
+
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
13
|
+
* module for the per-bundler details and for the one thing a consumer has to
|
|
14
|
+
* provide (Metro needs `woff2` in `assetExts`).
|
|
17
15
|
*/
|
|
18
16
|
export declare function applyFontFaces(): void;
|
|
19
17
|
//# sourceMappingURL=apply-font-faces.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAkBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-assets.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-assets.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"font-assets.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-assets.web.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,YAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import blomusModernusBold from './assets/BlomusModernus-Bold.woff2';
|
|
2
|
+
import blomusModernusRegular from './assets/BlomusModernus-Regular.woff2';
|
|
3
|
+
import geistMonoVariable from './assets/GeistMono-Variable.woff2';
|
|
4
|
+
import interVariable from './assets/InterVariable.woff2';
|
|
5
|
+
export { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable };
|
|
6
|
+
//# sourceMappingURL=font-urls.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-urls.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/font-urls.web.ts"],"names":[],"mappings":"AAwBA,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,qBAAqB,MAAM,uCAAuC,CAAC;AAC1E,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/bloom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -1419,19 +1419,16 @@
|
|
|
1419
1419
|
"license": "AGPL-3.0-only",
|
|
1420
1420
|
"scripts": {
|
|
1421
1421
|
"generate:exports": "node scripts/generate-platform-exports.mjs",
|
|
1422
|
-
"generate:font-data": "node scripts/generate-font-data.mjs",
|
|
1423
1422
|
"generate:theme-css": "bun scripts/generate-theme-css.ts",
|
|
1424
|
-
"prebuild": "node scripts/generate-platform-exports.mjs &&
|
|
1423
|
+
"prebuild": "node scripts/generate-platform-exports.mjs && bun scripts/generate-theme-css.ts",
|
|
1425
1424
|
"build": "bob build",
|
|
1426
1425
|
"postbuild": "node scripts/verify-package.mjs",
|
|
1427
1426
|
"verify:package": "node scripts/verify-package.mjs",
|
|
1428
1427
|
"test": "jest",
|
|
1429
|
-
"pretest": "node scripts/generate-font-data.mjs",
|
|
1430
1428
|
"typescript": "tsc --noEmit",
|
|
1431
|
-
"pretypescript": "node scripts/generate-font-data.mjs",
|
|
1432
1429
|
"clean": "rm -rf lib",
|
|
1433
1430
|
"prepack": "bun run clean && bun run build",
|
|
1434
|
-
"prepare": "bun run build || true",
|
|
1431
|
+
"prepare": "[ -n \"$BLOOM_VERIFY_PACKAGE_RUNNING\" ] || bun run build || true",
|
|
1435
1432
|
"release": "rm -rf lib && bun run build && release-it",
|
|
1436
1433
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
1437
1434
|
"storybook:build": "storybook build -o storybook-static"
|
|
@@ -1539,7 +1536,7 @@
|
|
|
1539
1536
|
"react-native-builder-bob": {
|
|
1540
1537
|
"source": "src",
|
|
1541
1538
|
"output": "lib",
|
|
1542
|
-
"exclude": "{**/{__tests__,__fixtures__,__mocks__}/**,**/*.stories.{ts,tsx},**/*.{test,spec}.{ts,tsx}
|
|
1539
|
+
"exclude": "{**/{__tests__,__fixtures__,__mocks__}/**,**/*.stories.{ts,tsx},**/*.{test,spec}.{ts,tsx}}",
|
|
1543
1540
|
"targets": [
|
|
1544
1541
|
[
|
|
1545
1542
|
"commonjs",
|
|
@@ -54,4 +54,36 @@ describe('applyFontFaces (web)', () => {
|
|
|
54
54
|
expect(cssText).toMatch(/font-family: 'Inter'/);
|
|
55
55
|
expect(cssText).toMatch(/font-family: 'Geist Mono'/);
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
// The whole point of `font-urls.web.ts` is that the browser fetches and
|
|
59
|
+
// caches the four families on their own. Re-inlining them as `data:` URLs
|
|
60
|
+
// would still render correctly in every test above, so this is the only
|
|
61
|
+
// assertion that would notice.
|
|
62
|
+
it('points every src at a bundler-emitted URL, never an inlined data: URL', () => {
|
|
63
|
+
applyFontFaces();
|
|
64
|
+
const cssText = document.getElementById('bloom-fonts')?.textContent ?? '';
|
|
65
|
+
const sources = [...cssText.matchAll(/src: url\("([^"]*)"\)/g)].map((m) => m[1]);
|
|
66
|
+
expect(sources).toHaveLength(4);
|
|
67
|
+
for (const source of sources) {
|
|
68
|
+
expect(source).not.toMatch(/^data:/);
|
|
69
|
+
expect(source).toBeTruthy();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('applyFontFaces (native stub)', () => {
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
document.head.innerHTML = '';
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Native loads `.ttf` through `useFonts`, so the default export must stay
|
|
80
|
+
// inert. If it ever forwarded to the web implementation, Metro would follow
|
|
81
|
+
// `font-urls.web.ts` and bundle a second, unusable copy of all four fonts
|
|
82
|
+
// into every iOS and Android build.
|
|
83
|
+
it('injects nothing', async () => {
|
|
84
|
+
const native = await import('../fonts/apply-font-faces');
|
|
85
|
+
native.applyFontFaces();
|
|
86
|
+
expect(document.getElementById('bloom-fonts')).toBeNull();
|
|
87
|
+
expect(document.head.innerHTML).toBe('');
|
|
88
|
+
});
|
|
57
89
|
});
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// is selected by bundlers via the package.json conditions. RN consumers
|
|
3
3
|
// never need font-face injection — useFonts handles loading on native.
|
|
4
4
|
//
|
|
5
|
-
// The
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// The split is load-bearing, not decorative: the web variant reaches
|
|
6
|
+
// `font-urls.web.ts`, whose module-level `.woff2` imports would otherwise
|
|
7
|
+
// drag a second, unusable copy of every font into the native bundle
|
|
8
|
+
// (Metro resolves an asset import on native to a registry id, not a URL).
|
|
9
|
+
// Keeping this stub empty is what guarantees native pays nothing for them.
|
|
9
10
|
export function applyFontFaces(): void {
|
|
10
11
|
// intentionally empty
|
|
11
12
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
blomusModernusBold,
|
|
4
4
|
interVariable,
|
|
5
5
|
geistMonoVariable,
|
|
6
|
-
} from './font-
|
|
6
|
+
} from './font-urls.web';
|
|
7
7
|
import { fontFamilies } from './tokens';
|
|
8
8
|
|
|
9
9
|
const STYLE_ID = 'bloom-fonts';
|
|
@@ -12,18 +12,16 @@ const STYLE_ID = 'bloom-fonts';
|
|
|
12
12
|
* Inject @font-face rules and font CSS variables onto :root.
|
|
13
13
|
*
|
|
14
14
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
15
|
-
* stub —
|
|
16
|
-
* the font payload out of the native bundle entirely.
|
|
17
|
-
* call multiple times; subsequent calls early-return
|
|
18
|
-
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
19
|
-
* `typeof document === 'undefined'` guard.
|
|
15
|
+
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
16
|
+
* split keeps the web font payload out of the native bundle entirely.
|
|
17
|
+
* Idempotent: safe to call multiple times; subsequent calls early-return
|
|
18
|
+
* after the `<style id="bloom-fonts">` tag has been mounted. SSR-safe via
|
|
19
|
+
* the `typeof document === 'undefined'` guard.
|
|
20
20
|
*
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
26
|
-
* for the rationale and trade-offs.
|
|
21
|
+
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
22
|
+
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
23
|
+
* module for the per-bundler details and for the one thing a consumer has to
|
|
24
|
+
* provide (Metro needs `woff2` in `assetExts`).
|
|
27
25
|
*/
|
|
28
26
|
export function applyFontFaces(): void {
|
|
29
27
|
if (typeof document === 'undefined') return;
|
|
@@ -32,10 +30,10 @@ export function applyFontFaces(): void {
|
|
|
32
30
|
const style = document.createElement('style');
|
|
33
31
|
style.id = STYLE_ID;
|
|
34
32
|
style.textContent = `
|
|
35
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${blomusModernusRegular}) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
|
|
36
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${blomusModernusBold}) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
|
|
37
|
-
@font-face { font-family: 'Inter'; src: url(${interVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
38
|
-
@font-face { font-family: 'Geist Mono'; src: url(${geistMonoVariable}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
33
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${blomusModernusRegular}") format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
|
|
34
|
+
@font-face { font-family: 'BlomusModernus'; src: url("${blomusModernusBold}") format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
|
|
35
|
+
@font-face { font-family: 'Inter'; src: url("${interVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
36
|
+
@font-face { font-family: 'Geist Mono'; src: url("${geistMonoVariable}") format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
|
|
39
37
|
:root {
|
|
40
38
|
--bloom-font-display: ${fontFamilies.display};
|
|
41
39
|
--bloom-font-sans: ${fontFamilies.sans};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
//
|
|
3
3
|
// `useFonts()` is native-only — the web `FontLoader` (`FontLoader.tsx`) calls
|
|
4
4
|
// `applyFontFaces()` instead, which injects the same four families as
|
|
5
|
-
// `@font-face` rules
|
|
6
|
-
// `font-
|
|
5
|
+
// `@font-face` rules pointing at bundler-emitted `.woff2` URLs
|
|
6
|
+
// (`apply-font-faces.web.ts` / `font-urls.web.ts`). So the map is empty by
|
|
7
|
+
// design, not by omission.
|
|
7
8
|
//
|
|
8
9
|
// This file exists so `index.web.ts` can name its font-asset source
|
|
9
10
|
// explicitly, exactly as it already does for `./apply-font-faces.web`. The
|