@oxyhq/bloom 0.5.0 → 0.5.1
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/FontLoader.js +6 -5
- package/lib/commonjs/fonts/FontLoader.js.map +1 -1
- package/lib/commonjs/fonts/apply-font-faces.js +4 -4
- package/lib/commonjs/fonts/apply-font-faces.web.js +13 -12
- package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/commonjs/fonts/font-assets.js +2 -2
- package/lib/commonjs/fonts/font-data.web.js +22 -0
- package/lib/commonjs/fonts/font-data.web.js.map +1 -0
- package/lib/module/fonts/FontLoader.js +6 -5
- package/lib/module/fonts/FontLoader.js.map +1 -1
- package/lib/module/fonts/apply-font-faces.js +4 -4
- package/lib/module/fonts/apply-font-faces.web.js +13 -10
- package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/module/fonts/font-assets.js +2 -2
- package/lib/module/fonts/font-data.web.js +18 -0
- package/lib/module/fonts/font-data.web.js.map +1 -0
- package/lib/module/fonts/index.web.js +4 -4
- package/lib/typescript/commonjs/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts.map +1 -0
- package/lib/typescript/module/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/module/fonts/font-data.web.d.ts.map +1 -0
- package/package.json +36 -5
- package/src/avatar/Avatar.stories.tsx +69 -0
- package/src/bottom-sheet/BottomSheet.stories.tsx +92 -0
- package/src/button/Button.stories.tsx +94 -0
- package/src/context-menu/ContextMenu.stories.tsx +71 -0
- package/src/dialog/Dialog.stories.tsx +112 -0
- package/src/fonts/FontLoader.tsx +6 -5
- package/src/fonts/apply-font-faces.ts +4 -4
- package/src/fonts/apply-font-faces.web.ts +18 -10
- package/src/fonts/font-assets.ts +2 -2
- package/src/fonts/font-data.web.ts +15 -0
- package/src/fonts/index.web.ts +4 -4
- package/src/loading/Loading.stories.tsx +60 -0
- package/src/menu/Menu.stories.tsx +79 -0
- package/src/prompt-input/PromptInput.stories.tsx +82 -0
- package/src/select/Select.stories.tsx +84 -0
- package/src/settings-list/SettingsList.stories.tsx +106 -0
- package/src/text-field/TextField.stories.tsx +90 -0
- package/src/toast/Toast.stories.tsx +109 -0
- 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/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/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Dialog.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Dialog.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/theme.test.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["blomusModernusRegular","exports","blomusModernusBold","interVariable","geistMonoVariable"],"sourceRoot":"../../../src","sources":["fonts/font-data.web.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,qBAA6B,GAAAC,OAAA,CAAAD,qBAAA,GAAG,ioqGAAioqG;AACvqqG,MAAME,kBAA0B,GAAAD,OAAA,CAAAC,kBAAA,GAAG,qlqGAAqlqG;AACxnqG,MAAMC,aAAqB,GAAAF,OAAA,CAAAE,aAAA,GAAG,i39DAAi39D;AAC/49D,MAAMC,iBAAyB,GAAAH,OAAA,CAAAG,iBAAA,GAAG,i9tCAAi9tC","ignoreList":[]}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
4
|
// Reach for the web variant explicitly. The default `./apply-font-faces`
|
|
5
|
-
// is a no-op stub
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// bundlers — Metro selects `FontLoader.native.tsx` on iOS/Android
|
|
9
|
-
// is safe to take a direct dependency on the web implementation
|
|
5
|
+
// is a no-op stub on native — native loads its fonts via
|
|
6
|
+
// `useFonts(FONT_ASSETS)` in `FontLoader.native.tsx` and has no use for
|
|
7
|
+
// CSS `@font-face` injection. This file (`FontLoader.tsx`) is only picked
|
|
8
|
+
// up by web bundlers — Metro selects `FontLoader.native.tsx` on iOS/Android
|
|
9
|
+
// — so it is safe to take a direct dependency on the web implementation
|
|
10
|
+
// here.
|
|
10
11
|
import { applyFontFaces } from "./apply-font-faces.web.js";
|
|
11
12
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","applyFontFaces","Fragment","_Fragment","jsx","_jsx","FontLoader","enabled","children","applied","current"],"sourceRoot":"../../../src","sources":["fonts/FontLoader.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAc,QAAQ,2BAAwB;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAiBxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,OAAO;EAAEC;AAA0B,CAAC,EAAE;EACjE,MAAMC,OAAO,GAAGT,MAAM,CAAC,KAAK,CAAC;EAC7B,IAAIO,OAAO,IAAI,CAACE,OAAO,CAACC,OAAO,EAAE;IAC/BD,OAAO,CAACC,OAAO,GAAG,IAAI;IACtBT,cAAc,CAAC,CAAC;EAClB;EACA,oBAAOI,IAAA,CAAAF,SAAA;IAAAK,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useRef","applyFontFaces","Fragment","_Fragment","jsx","_jsx","FontLoader","enabled","children","applied","current"],"sourceRoot":"../../../src","sources":["fonts/FontLoader.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAc,QAAQ,2BAAwB;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAiBxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,OAAO;EAAEC;AAA0B,CAAC,EAAE;EACjE,MAAMC,OAAO,GAAGT,MAAM,CAAC,KAAK,CAAC;EAC7B,IAAIO,OAAO,IAAI,CAACE,OAAO,CAACC,OAAO,EAAE;IAC/BD,OAAO,CAACC,OAAO,GAAG,IAAI;IACtBT,cAAc,CAAC,CAAC;EAClB;EACA,oBAAOI,IAAA,CAAAF,SAAA;IAAAK,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@
|
|
|
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
|
-
//
|
|
8
|
-
// imports
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// The web variant does NOT pull in any `.woff2` files via asset imports —
|
|
8
|
+
// it imports base64 data URLs from `font-data.web.ts`. This stub stays
|
|
9
|
+
// here so the file split (`*.ts` vs `*.web.ts`) makes the platform
|
|
10
|
+
// intent explicit and so the runtime API surface matches across platforms.
|
|
11
11
|
export function applyFontFaces() {
|
|
12
12
|
// intentionally empty
|
|
13
13
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import blomusReg from './assets/BlomusModernus-Regular.woff2';
|
|
5
|
-
import blomusBold from './assets/BlomusModernus-Bold.woff2';
|
|
6
|
-
import interVar from './assets/InterVariable.woff2';
|
|
7
|
-
import geistMono from './assets/GeistMono-Variable.woff2';
|
|
3
|
+
import { blomusModernusRegular, blomusModernusBold, interVariable, geistMonoVariable } from "./font-data.web.js";
|
|
8
4
|
import { fontFamilies } from "./tokens.js";
|
|
9
5
|
const STYLE_ID = 'bloom-fonts';
|
|
10
6
|
|
|
@@ -13,10 +9,17 @@ const STYLE_ID = 'bloom-fonts';
|
|
|
13
9
|
*
|
|
14
10
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
15
11
|
* stub — Metro cannot parse `.woff2` imports, so the file split keeps
|
|
16
|
-
*
|
|
12
|
+
* the font payload out of the native bundle entirely. Idempotent: safe to
|
|
17
13
|
* call multiple times; subsequent calls early-return after the
|
|
18
14
|
* `<style id="bloom-fonts">` tag has been mounted. SSR-safe via the
|
|
19
15
|
* `typeof document === 'undefined'` guard.
|
|
16
|
+
*
|
|
17
|
+
* The font URLs come from `./font-data.web`, a generated module that
|
|
18
|
+
* embeds the woff2 bytes as base64 data URLs. Inlining (rather than
|
|
19
|
+
* relying on bundler asset loaders for `.woff2`) means consumers do not
|
|
20
|
+
* have to extend Metro's `assetExts` or add a webpack/Vite asset rule —
|
|
21
|
+
* the published JS is self-contained. See `scripts/generate-font-data.mjs`
|
|
22
|
+
* for the rationale and trade-offs.
|
|
20
23
|
*/
|
|
21
24
|
export function applyFontFaces() {
|
|
22
25
|
if (typeof document === 'undefined') return;
|
|
@@ -24,10 +27,10 @@ export function applyFontFaces() {
|
|
|
24
27
|
const style = document.createElement('style');
|
|
25
28
|
style.id = STYLE_ID;
|
|
26
29
|
style.textContent = `
|
|
27
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${
|
|
28
|
-
@font-face { font-family: 'BlomusModernus'; src: url(${
|
|
29
|
-
@font-face { font-family: 'Inter'; src: url(${
|
|
30
|
-
@font-face { font-family: 'Geist Mono'; src: url(${
|
|
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; }
|
|
31
34
|
:root {
|
|
32
35
|
--bloom-font-display: ${fontFamilies.display};
|
|
33
36
|
--bloom-font-sans: ${fontFamilies.sans};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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;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,2DAA2DZ,qBAAqB;AAChF,2DAA2DC,kBAAkB;AAC7E,kDAAkDC,aAAa;AAC/D,uDAAuDC,iBAAiB;AACxE;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":[]}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
// covers all weights at runtime. `@fontsource(-variable)?/*` packages only
|
|
8
8
|
// publish .woff2 for their variable axes — modern react-native font loading
|
|
9
9
|
// requires .ttf, so we use the upstream variable TTFs instead. On web,
|
|
10
|
-
// `apply-font-faces.web.ts`
|
|
11
|
-
// file is never imported.
|
|
10
|
+
// `apply-font-faces.web.ts` inlines the .woff2 variants as base64 data URLs
|
|
11
|
+
// (see `font-data.web.ts`) and this file is never imported.
|
|
12
12
|
|
|
13
13
|
export const FONT_ASSETS = {
|
|
14
14
|
BlomusModernus: require('./assets/BlomusModernus-Regular.ttf'),
|