@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.
Files changed (98) hide show
  1. package/lib/commonjs/fonts/FontLoader.js +6 -5
  2. package/lib/commonjs/fonts/FontLoader.js.map +1 -1
  3. package/lib/commonjs/fonts/apply-font-faces.js +4 -4
  4. package/lib/commonjs/fonts/apply-font-faces.web.js +13 -12
  5. package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
  6. package/lib/commonjs/fonts/font-assets.js +2 -2
  7. package/lib/commonjs/fonts/font-data.web.js +22 -0
  8. package/lib/commonjs/fonts/font-data.web.js.map +1 -0
  9. package/lib/module/fonts/FontLoader.js +6 -5
  10. package/lib/module/fonts/FontLoader.js.map +1 -1
  11. package/lib/module/fonts/apply-font-faces.js +4 -4
  12. package/lib/module/fonts/apply-font-faces.web.js +13 -10
  13. package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
  14. package/lib/module/fonts/font-assets.js +2 -2
  15. package/lib/module/fonts/font-data.web.js +18 -0
  16. package/lib/module/fonts/font-data.web.js.map +1 -0
  17. package/lib/module/fonts/index.web.js +4 -4
  18. package/lib/typescript/commonjs/fonts/FontLoader.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +8 -1
  20. package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/fonts/font-data.web.d.ts +5 -0
  22. package/lib/typescript/commonjs/fonts/font-data.web.d.ts.map +1 -0
  23. package/lib/typescript/module/fonts/FontLoader.d.ts.map +1 -1
  24. package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +8 -1
  25. package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
  26. package/lib/typescript/module/fonts/font-data.web.d.ts +5 -0
  27. package/lib/typescript/module/fonts/font-data.web.d.ts.map +1 -0
  28. package/package.json +36 -5
  29. package/src/avatar/Avatar.stories.tsx +69 -0
  30. package/src/bottom-sheet/BottomSheet.stories.tsx +92 -0
  31. package/src/button/Button.stories.tsx +94 -0
  32. package/src/context-menu/ContextMenu.stories.tsx +71 -0
  33. package/src/dialog/Dialog.stories.tsx +112 -0
  34. package/src/fonts/FontLoader.tsx +6 -5
  35. package/src/fonts/apply-font-faces.ts +4 -4
  36. package/src/fonts/apply-font-faces.web.ts +18 -10
  37. package/src/fonts/font-assets.ts +2 -2
  38. package/src/fonts/font-data.web.ts +15 -0
  39. package/src/fonts/index.web.ts +4 -4
  40. package/src/loading/Loading.stories.tsx +60 -0
  41. package/src/menu/Menu.stories.tsx +79 -0
  42. package/src/prompt-input/PromptInput.stories.tsx +82 -0
  43. package/src/select/Select.stories.tsx +84 -0
  44. package/src/settings-list/SettingsList.stories.tsx +106 -0
  45. package/src/text-field/TextField.stories.tsx +90 -0
  46. package/src/toast/Toast.stories.tsx +109 -0
  47. package/lib/commonjs/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
  48. package/lib/commonjs/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
  49. package/lib/commonjs/fonts/assets/GeistMono-Variable.woff2 +0 -0
  50. package/lib/commonjs/fonts/assets/InterVariable.woff2 +0 -0
  51. package/lib/module/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
  52. package/lib/module/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
  53. package/lib/module/fonts/assets/GeistMono-Variable.woff2 +0 -0
  54. package/lib/module/fonts/assets/InterVariable.woff2 +0 -0
  55. package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
  56. package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
  57. package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts +0 -2
  58. package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
  59. package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts +0 -2
  60. package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts.map +0 -1
  61. package/lib/typescript/commonjs/__tests__/Button.test.d.ts +0 -2
  62. package/lib/typescript/commonjs/__tests__/Button.test.d.ts.map +0 -1
  63. package/lib/typescript/commonjs/__tests__/Code.test.d.ts +0 -2
  64. package/lib/typescript/commonjs/__tests__/Code.test.d.ts.map +0 -1
  65. package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts +0 -2
  66. package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts.map +0 -1
  67. package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts +0 -2
  68. package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts.map +0 -1
  69. package/lib/typescript/commonjs/__tests__/Pre.test.d.ts +0 -2
  70. package/lib/typescript/commonjs/__tests__/Pre.test.d.ts.map +0 -1
  71. package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts +0 -2
  72. package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts.map +0 -1
  73. package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts +0 -5
  74. package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts.map +0 -1
  75. package/lib/typescript/commonjs/__tests__/theme.test.d.ts +0 -2
  76. package/lib/typescript/commonjs/__tests__/theme.test.d.ts.map +0 -1
  77. package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
  78. package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
  79. package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts +0 -2
  80. package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
  81. package/lib/typescript/module/__tests__/BottomSheet.test.d.ts +0 -2
  82. package/lib/typescript/module/__tests__/BottomSheet.test.d.ts.map +0 -1
  83. package/lib/typescript/module/__tests__/Button.test.d.ts +0 -2
  84. package/lib/typescript/module/__tests__/Button.test.d.ts.map +0 -1
  85. package/lib/typescript/module/__tests__/Code.test.d.ts +0 -2
  86. package/lib/typescript/module/__tests__/Code.test.d.ts.map +0 -1
  87. package/lib/typescript/module/__tests__/Dialog.test.d.ts +0 -2
  88. package/lib/typescript/module/__tests__/Dialog.test.d.ts.map +0 -1
  89. package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts +0 -2
  90. package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts.map +0 -1
  91. package/lib/typescript/module/__tests__/Pre.test.d.ts +0 -2
  92. package/lib/typescript/module/__tests__/Pre.test.d.ts.map +0 -1
  93. package/lib/typescript/module/__tests__/SettingsList.test.d.ts +0 -2
  94. package/lib/typescript/module/__tests__/SettingsList.test.d.ts.map +0 -1
  95. package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts +0 -5
  96. package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts.map +0 -1
  97. package/lib/typescript/module/__tests__/theme.test.d.ts +0 -2
  98. package/lib/typescript/module/__tests__/theme.test.d.ts.map +0 -1
@@ -1,8 +1,9 @@
1
- /// <reference path="../assets.d.ts" />
2
- import blomusReg from './assets/BlomusModernus-Regular.woff2';
3
- import blomusBold from './assets/BlomusModernus-Bold.woff2';
4
- import interVar from './assets/InterVariable.woff2';
5
- import geistMono from './assets/GeistMono-Variable.woff2';
1
+ import {
2
+ blomusModernusRegular,
3
+ blomusModernusBold,
4
+ interVariable,
5
+ geistMonoVariable,
6
+ } from './font-data.web';
6
7
  import { fontFamilies } from './tokens';
7
8
 
8
9
  const STYLE_ID = 'bloom-fonts';
@@ -12,10 +13,17 @@ const STYLE_ID = 'bloom-fonts';
12
13
  *
13
14
  * Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
14
15
  * stub — Metro cannot parse `.woff2` imports, so the file split keeps
15
- * those imports out of the native bundle entirely. Idempotent: safe to
16
+ * the font payload out of the native bundle entirely. Idempotent: safe to
16
17
  * call multiple times; subsequent calls early-return after the
17
18
  * `<style id="bloom-fonts">` tag has been mounted. SSR-safe via the
18
19
  * `typeof document === 'undefined'` guard.
20
+ *
21
+ * The font URLs come from `./font-data.web`, a generated module that
22
+ * embeds the woff2 bytes as base64 data URLs. Inlining (rather than
23
+ * relying on bundler asset loaders for `.woff2`) means consumers do not
24
+ * have to extend Metro's `assetExts` or add a webpack/Vite asset rule —
25
+ * the published JS is self-contained. See `scripts/generate-font-data.mjs`
26
+ * for the rationale and trade-offs.
19
27
  */
20
28
  export function applyFontFaces(): void {
21
29
  if (typeof document === 'undefined') return;
@@ -24,10 +32,10 @@ export function applyFontFaces(): void {
24
32
  const style = document.createElement('style');
25
33
  style.id = STYLE_ID;
26
34
  style.textContent = `
27
- @font-face { font-family: 'BlomusModernus'; src: url(${blomusReg}) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
28
- @font-face { font-family: 'BlomusModernus'; src: url(${blomusBold}) format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
29
- @font-face { font-family: 'Inter'; src: url(${interVar}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
30
- @font-face { font-family: 'Geist Mono'; src: url(${geistMono}) format('woff2-variations'); font-weight: 100 900; font-style: normal; font-display: swap; }
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; }
31
39
  :root {
32
40
  --bloom-font-display: ${fontFamilies.display};
33
41
  --bloom-font-sans: ${fontFamilies.sans};
@@ -5,8 +5,8 @@
5
5
  // covers all weights at runtime. `@fontsource(-variable)?/*` packages only
6
6
  // publish .woff2 for their variable axes — modern react-native font loading
7
7
  // requires .ttf, so we use the upstream variable TTFs instead. On web,
8
- // `apply-font-faces.web.ts` references the .woff2 variants directly and this
9
- // file is never imported.
8
+ // `apply-font-faces.web.ts` inlines the .woff2 variants as base64 data URLs
9
+ // (see `font-data.web.ts`) and this file is never imported.
10
10
 
11
11
  export const FONT_ASSETS = {
12
12
  BlomusModernus: require('./assets/BlomusModernus-Regular.ttf'),