first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

2
node_modules/expo-font/.eslintrc.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
// @generated by expo-module-scripts
module.exports = require('expo-module-scripts/eslintrc.base.js');

487
node_modules/expo-font/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,487 @@
# Changelog
## Unpublished
### 🛠 Breaking changes
### 🎉 New features
### 🐛 Bug fixes
### 💡 Others
## 55.0.4 — 2026-02-16
_This version does not introduce any user-facing changes._
## 55.0.3 — 2026-01-27
_This version does not introduce any user-facing changes._
## 55.0.2 — 2026-01-26
_This version does not introduce any user-facing changes._
## 55.0.1 — 2026-01-22
_This version does not introduce any user-facing changes._
## 55.0.0 — 2026-01-21
### 🎉 New features
- Add support for setting custom testStrings for FontObserver on the web. ([#42442](https://github.com/expo/expo/pull/42442) by [@aleqsio](https://github.com/aleqsio))
- add support for line-height ([#41094](https://github.com/expo/expo/pull/41094) by [@Ubax](https://github.com/Ubax))
### 🐛 Bug fixes
- [ios] Defer native font querying to prevent startup hang on iOS. ([#42033](https://github.com/expo/expo/pull/42033) by [@mozzius](https://github.com/mozzius))
- unify `useFonts` return value in RSC ([#40481](https://github.com/expo/expo/pull/40481) by [@vonovak](https://github.com/vonovak))
### 💡 Others
- update ExpoFontUtils mock, to align with new API ([#40964](https://github.com/expo/expo/pull/40964) by [@Ubax](https://github.com/Ubax))
## 14.0.10 - 2025-12-05
_This version does not introduce any user-facing changes._
## 14.0.9 - 2025-10-09
### 🐛 Bug fixes
- fix android image scaling in `renderToImageAsync` ([#40113](https://github.com/expo/expo/pull/40113) by [@vonovak](https://github.com/vonovak))
## 14.0.8 — 2025-09-11
_This version does not introduce any user-facing changes._
## 14.0.7 — 2025-09-02
_This version does not introduce any user-facing changes._
## 14.0.6 — 2025-08-31
_This version does not introduce any user-facing changes._
## 14.0.5 — 2025-08-27
### 🛠 Breaking changes
- [android] improve bitmap rendering for `renderToImageAsync` ([#39118](https://github.com/expo/expo/pull/39118) by [@vonovak](https://github.com/vonovak))
## 14.0.4 — 2025-08-26
### 💡 Others
- Fix types and adjust platform checks. ([#37302](https://github.com/expo/expo/pull/37302) by [@EvanBacon](https://github.com/EvanBacon))
## 14.0.3 — 2025-08-25
_This version does not introduce any user-facing changes._
## 14.0.2 — 2025-08-16
_This version does not introduce any user-facing changes._
## 14.0.1 — 2025-08-15
_This version does not introduce any user-facing changes._
## 14.0.0 — 2025-08-13
### 🎉 New features
- expose `ExpoFontLoader` on web ([#37991](https://github.com/expo/expo/pull/37991) by [@vonovak](https://github.com/vonovak))
- Add local package mocks. ([#37736](https://github.com/expo/expo/pull/37736) by [@aleqsio](https://github.com/aleqsio))
### 💡 Others
- [web] remove deprecated style 'type' attribute ([#38114](https://github.com/expo/expo/pull/38114) by [@vonovak](https://github.com/vonovak))
- Add missing `react-native` peer dependency ([#38540](https://github.com/expo/expo/pull/38540) by [@kitten](https://github.com/kitten))
- Update remaining `@expo/config-plugins` in config plugin to `expo/config-plugins` ([#38580](https://github.com/expo/expo/pull/38580) by [@kitten](https://github.com/kitten))
## 13.3.2 - 2025-07-01
_This version does not introduce any user-facing changes._
## 13.3.1 — 2025-05-02
### 🐛 Bug fixes
- Bail out early when `getLoadedFonts` returns an empty array. ([#36586](https://github.com/expo/expo/pull/36586) by [@brentvatne](https://github.com/brentvatne))
## 13.3.0 — 2025-04-30
### 🎉 New features
- [Android] Added support for font weight styles (through XML font definitions) to config plugin. ([#26082](https://github.com/expo/expo/pull/26082) by [@jongbelegen](https://github.com/jongbelegen))
## 13.2.2 — 2025-04-25
_This version does not introduce any user-facing changes._
## 13.2.1 — 2025-04-21
_This version does not introduce any user-facing changes._
## 13.2.0 — 2025-04-21
### 🎉 New features
- Render to image ([#36185](https://github.com/expo/expo/pull/36185) by [@jakex7](https://github.com/jakex7))
## 13.1.2 — 2025-04-14
_This version does not introduce any user-facing changes._
## 13.1.1 — 2025-04-09
_This version does not introduce any user-facing changes._
## 13.1.0 — 2025-04-04
### 🛠 Breaking changes
- Bump minimum macOS version to 11.0. ([#34980](https://github.com/expo/expo/pull/34980) by [@gabrieldonadel](https://github.com/gabrieldonadel))
### 🎉 New features
- Support loading expo-font in a `react-server` environment. ([#34736](https://github.com/expo/expo/pull/34736) by [@EvanBacon](https://github.com/EvanBacon))
### 🐛 Bug fixes
- Add missing export specifier. ([#34839](https://github.com/expo/expo/pull/34839) by [@EvanBacon](https://github.com/EvanBacon))
### 💡 Others
- [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
## 13.0.4 - 2025-02-19
_This version does not introduce any user-facing changes._
## 13.0.3 - 2025-01-10
### 🐛 Bug fixes
- [ios] Fix crash when writing to fontFamilyAliases ([#34044](https://github.com/expo/expo/pull/34044) by [@techied](https://github.com/techied))
## 13.0.2 - 2024-12-19
### 🐛 Bug fixes
- [iOS] Fix crash when accessing resource from multiple threads ([#33574](https://github.com/expo/expo/pull/33574) by [@chrfalch](https://github.com/chrfalch))
## 13.0.1 — 2024-11-05
### 💡 Others
- Remove deprecated Font.processFontFamily() ([#32631](https://github.com/expo/expo/pull/32631) by [@brentvatne](https://github.com/brentvatne))
## 13.0.0 — 2024-10-22
### 🛠 Breaking changes
- Bumped iOS and tvOS deployment target to 15.1. ([#30840](https://github.com/expo/expo/pull/30840) by [@tsapeta](https://github.com/tsapeta))
### 🎉 New features
- More detailed error messages for `FontLoader` native module rejections ([#31104](https://github.com/expo/expo/pull/31104) by [@vonovak](https://github.com/vonovak))
- Add `getLoadedFonts()` function ([#30431](https://github.com/expo/expo/pull/30431) by [@vonovak](https://github.com/vonovak))
### 🐛 Bug fixes
- `useFonts` could previously attempt to set state on an unmounted component ([#31143](https://github.com/expo/expo/pull/31143) by [@vonovak](https://github.com/vonovak))
- On iOS `loadAsync()` will reject if font loading fails. ([#31053](https://github.com/expo/expo/pull/31053) by [@vonovak](https://github.com/vonovak))
- Add missing `react` peer dependencies for isolated modules. ([#30467](https://github.com/expo/expo/pull/30467) by [@byCedric](https://github.com/byCedric))
- Only import from `expo/config` to follow proper dependency chains. ([#30501](https://github.com/expo/expo/pull/30501) by [@byCedric](https://github.com/byCedric))
### 💡 Others
- Stopped scoping font family names in Expo Go on Android. ([#28797](https://github.com/expo/expo/pull/28797) by [@lukmccall](https://github.com/lukmccall))
- Replaced `@testing-library/react-hooks` with `@testing-library/react-native`. ([#30742](https://github.com/expo/expo/pull/30742) by [@byCedric](https://github.com/byCedric))
- Removed all `NativeModulesProxy` occurrences. ([#31496](https://github.com/expo/expo/pull/31496) by [@reichhartd](https://github.com/reichhartd))
## 12.0.10 - 2024-09-03
### 🐛 Bug fixes
- Fix support for macOS. ([#31307](https://github.com/expo/expo/pull/31307) by [@gabrieldonadel](https://github.com/gabrieldonadel))
## 12.0.9 - 2024-07-16
### 🐛 Bug fixes
- On `iOS`, fix issues where fonts were removed when the app is backgrounded. ([#30400](https://github.com/expo/expo/pull/30400) by [@alanjhughes](https://github.com/alanjhughes))
## 12.0.8 - 2024-07-11
### 🎉 New features
- Allow `woff` and `woff2` format on iOS with the config plugin. ([#30220](https://github.com/expo/expo/pull/30220) by [@titozzz](https://github/Titozzz))
## 12.0.7 - 2024-06-06
### 🐛 Bug fixes
- On `iOS`, store the font `postscriptName` instead of `fullName` which is what `iOS` will use to register the font. ([#29502](https://github.com/expo/expo/pull/29502) by [@alanjhughes](https://github.com/alanjhughes))
## 12.0.6 - 2024-05-29
### 🐛 Bug fixes
- [iOS] Fix font registration failing when font was in use. ([#28989](https://github.com/expo/expo/pull/28989) by [@aleqsio](https://github.com/aleqsio))
## 12.0.5 — 2024-05-10
### 🐛 Bug fixes
- Fixed some vector icons not rendering correctly. ([#28747](https://github.com/expo/expo/pull/28747) by [@tsapeta](https://github.com/tsapeta))
## 12.0.4 — 2024-04-24
_This version does not introduce any user-facing changes._
## 12.0.3 — 2024-04-24
- Fix font name lookup when name is not the same as family. ([#28407](https://github.com/expo/expo/pull/28407) by [@brentvatne](https://github.com/brentvatne))
## 12.0.2 — 2024-04-23
_This version does not introduce any user-facing changes._
## 12.0.1 — 2024-04-22
### 💡 Others
- Stopped scoping font family names in Expo Go on iOS. ([#28344](https://github.com/expo/expo/pull/28344) by [@tsapeta](https://github.com/tsapeta))
## 12.0.0 — 2024-04-18
### 🎉 New features
- [iOS] The native module has been simplified and rewritten to Swift. ([#26380](https://github.com/expo/expo/pull/26380) by [@tsapeta](https://github.com/tsapeta))
### 💡 Others
- drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
- Remove most of Constants.appOwnership. ([#26313](https://github.com/expo/expo/pull/26313) by [@wschurman](https://github.com/wschurman))
- Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
## 11.10.3 - 2024-02-16
### 🐛 Bug fixes
- Only include supported font files when using the plugin. ([#27002](https://github.com/expo/expo/pull/27002) by [@alanjhughes](https://github.com/alanjhughes))
## 11.10.2 - 2024-01-18
_This version does not introduce any user-facing changes._
## 11.10.1 - 2024-01-10
### 🎉 New features
- Added support for macOS platform. ([#26242](https://github.com/expo/expo/pull/26242) by [@tsapeta](https://github.com/tsapeta))
## 11.10.0 — 2023-12-12
### 🎉 New features
- Added custom native fonts support to `Font.isLoaded()`. ([#25770](https://github.com/expo/expo/pull/25770) by [@kudo](https://github.com/kudo))
## 11.9.0 — 2023-11-14
### 🛠 Breaking changes
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
### 🐛 Bug fixes
- Handle the case where no argument is passed to the plugin. ([#25138](https://github.com/expo/expo/pull/25138) by [@alanjhughes](https://github.com/alanjhughes))
## 11.8.0 — 2023-10-17
### 🛠 Breaking changes
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
### 🎉 New features
- Added config plugin to allow fonts to be linked at build time. ([#24772](https://github.com/expo/expo/pull/24772) by [@alanjhughes](https://github.com/alanjhughes))
- Remove `unimodule.json` in favour of `expo-module.config.json`. ([#25099](https://github.com/expo/expo/pull/25099) by [@reichhartd](https://github.com/reichhartd))
## 11.7.0 — 2023-09-15
### 🎉 New features
- Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
### 💡 Others
- Updated types for server functions. ([#23911](https://github.com/expo/expo/pull/23911) by [@EvanBacon](https://github.com/EvanBacon))
## 11.6.0 — 2023-09-04
### 🎉 New features
- Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
- Add static font extraction support with `expo-router`. ([#24027](https://github.com/expo/expo/pull/24027) by [@EvanBacon](https://github.com/EvanBacon))
### 💡 Others
- Migrated `FontLoaderModule` to use Expo Modules API. ([#24015](https://github.com/expo/expo/pull/24015) by [@lukmccall](https://github.com/lukmccall))
## 11.5.1 — 2023-08-02
### 💡 Others
- Change unloaded font error to a warning. ([#23788](https://github.com/expo/expo/pull/23788) by [@EvanBacon](https://github.com/EvanBacon))
## 11.5.0 — 2023-07-28
### 🐛 Bug fixes
- Gracefully catch exceptions during font loading on web with `fontfaceobserver`. ([#22954](https://github.com/expo/expo/pull/22954) by [@bradjones1](https://github.com/bradjones1))
## 11.4.0 — 2023-06-21
_This version does not introduce any user-facing changes._
## 11.3.0 — 2023-06-13
### 🐛 Bug fixes
- Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
## 11.2.0 — 2023-05-08
### 🐛 Bug fixes
- Fix require cycle on web. ([#21593](https://github.com/expo/expo/pull/21593) by [@EvanBacon](https://github.com/EvanBacon))
## 11.1.1 — 2023-02-09
_This version does not introduce any user-facing changes._
## 11.1.0 — 2023-02-03
### 💡 Others
- On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
## 11.0.1 — 2022-10-28
_This version does not introduce any user-facing changes._
## 11.0.0 — 2022-10-06
### 🛠 Breaking changes
- Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
### 🎉 New features
- Added support for Metro web. ([#19234](https://github.com/expo/expo/pull/19234) by [@EvanBacon](https://github.com/EvanBacon))
## 10.2.0 — 2022-07-07
_This version does not introduce any user-facing changes._
## 10.1.0 — 2022-04-18
### ⚠️ Notices
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
## 10.0.5 - 2022-02-01
### 🐛 Bug fixes
- Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
## 10.0.4 — 2021-11-17
_This version does not introduce any user-facing changes._
## 10.0.1 — 2021-10-01
_This version does not introduce any user-facing changes._
## 10.0.0 — 2021-09-28
### 🛠 Breaking changes
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
### 🐛 Bug fixes
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
## 9.3.0 — 2021-09-08
### 💡 Others
- Rewrite android code to Kotlin ([#13956](https://github.com/expo/expo/pull/13956) by [@kkafar](https://github.com/kkafar))
## 9.2.0 — 2021-06-16
### 🐛 Bug fixes
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
### 💡 Others
- Migrated `unimodules-font-interface` and `unimodules-constants-interface` to `expo-modules-core`. ([#12949](https://github.com/expo/expo/pull/12949), [#12876](https://github.com/expo/expo/pull/12876) by [@tsapeta](https://github.com/tsapeta))
- Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
## 9.1.0 — 2021-03-10
### 🎉 New features
- Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
### 🐛 Bug fixes
- Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
## 9.0.0 — 2021-01-15
### 🛠 Breaking changes
- Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
### 🐛 Bug fixes
- Remove Expo.AppLoading reference in error. ([#11204](https://github.com/expo/expo/pull/11204) by [@brentvatne](https://github.com/brentvatne))
- Removed `fbjs` dependency ([#11396](https://github.com/expo/expo/pull/11396) by [@cruzach](https://github.com/cruzach))
## 8.4.0 — 2020-11-17
_This version does not introduce any user-facing changes._
## 8.3.0 — 2020-08-18
_This version does not introduce any user-facing changes._
## 8.2.2 — 2020-07-27
### 🐛 Bug fixes
- Fixed fonts not being loaded in Internet Explorer. ([#8652](https://github.com/expo/expo/pull/8652) by [@d4rky-pl](https://github.com/d4rky-pl))
## 8.2.1 — 2020-05-29
_This version does not introduce any user-facing changes._
## 8.2.0 — 2020-05-27
_This version does not introduce any user-facing changes._
## 8.1.1 - 4/07/2020
### 🐛 Bug fixes
- Fixed timeout on Firefox [#7420](https://github.com/expo/expo/pull/7420)

41
node_modules/expo-font/README.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
<p>
<a href="https://docs.expo.dev/versions/latest/sdk/font/">
<img
src="../../.github/resources/expo-font.svg"
alt="expo-font"
height="64" />
</a>
</p>
Load fonts at runtime and use them in React Native components.
# API documentation
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/font/)
- [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/font/)
# Installation in managed Expo projects
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/font/).
# Installation in bare React Native projects
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
### Add the package to your npm dependencies
```
npx expo install expo-font
```
### Configure for Android
No additional set up necessary.
### Configure for iOS
Run `npx pod-install` after installing the npm package.
# Contributing
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).

19
node_modules/expo-font/android/build.gradle generated vendored Normal file
View File

@@ -0,0 +1,19 @@
plugins {
id 'com.android.library'
id 'expo-module-gradle-plugin'
}
group = 'host.exp.exponent'
version = '55.0.4'
android {
namespace "expo.modules.font"
defaultConfig {
versionCode 29
versionName "55.0.4"
}
}
dependencies {
implementation 'com.facebook.react:react-android'
}

View File

@@ -0,0 +1,3 @@
<manifest>
</manifest>

View File

@@ -0,0 +1,77 @@
// Copyright 2015-present 650 Industries. All rights reserved.
package expo.modules.font
import android.content.Context
import android.graphics.Typeface
import android.net.Uri
import com.facebook.react.common.assets.ReactFontManager
import expo.modules.kotlin.exception.CodedException
import expo.modules.kotlin.exception.Exceptions
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import java.io.File
private const val ASSET_SCHEME = "asset://"
private class FileNotFoundException(uri: String) :
CodedException("File '$uri' doesn't exist")
open class FontLoaderModule : Module() {
private val context: Context
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
override fun definition() = ModuleDefinition {
// could be a Set, but to be able to pass to JS we keep it as an array
var loadedFonts: List<String> = queryCustomNativeFonts()
Name("ExpoFontLoader")
Function("getLoadedFonts") {
return@Function loadedFonts
}
AsyncFunction("loadAsync") { fontFamilyName: String, localUri: String ->
val context = appContext.reactContext ?: throw Exceptions.ReactContextLost()
// TODO(nikki): make sure path is in experience's scope
val typeface: Typeface = if (localUri.startsWith(ASSET_SCHEME)) {
Typeface.createFromAsset(
context.assets, // Also remove the leading slash.
localUri.substring(ASSET_SCHEME.length + 1)
)
} else {
val file = Uri.parse(localUri).path?.let { File(it) }
?: throw FileNotFoundException(localUri)
if (file.length() == 0L) {
throw CodedException(
"Font file for $fontFamilyName is empty. Make sure the local file path is correctly populated."
)
}
Typeface.createFromFile(file)
}
ReactFontManager.getInstance().setTypeface(fontFamilyName, Typeface.NORMAL, typeface)
loadedFonts = loadedFonts.toMutableSet().apply { add(fontFamilyName) }.toList()
}
}
/**
* Queries custom native font names from the assets.
* Alignment with React Native's implementation at:
* https://github.com/facebook/react-native/blob/363ee484b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/assets/ReactFontManager.java#L146-L161
*/
private fun queryCustomNativeFonts(): List<String> {
val assetManager = context.assets
val fontFileRegex = Regex("^(.+?)(_bold|_italic|_bold_italic)?\\.(ttf|otf)$")
return assetManager.list("fonts/")
?.mapNotNull { fileName ->
fontFileRegex.find(fileName)?.groupValues?.get(1)
}
?.filter { it.isNotBlank() }
.orEmpty()
}
}

View File

@@ -0,0 +1,86 @@
// Copyright 2015-present 650 Industries. All rights reserved.
package expo.modules.font
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Typeface
import androidx.core.net.toUri
import com.facebook.react.common.assets.ReactFontManager
import expo.modules.kotlin.Promise
import expo.modules.kotlin.exception.CodedException
import expo.modules.kotlin.exception.Exceptions
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.util.UUID
import kotlin.math.ceil
private class SaveImageException(uri: String, cause: Throwable? = null) :
CodedException("Could not save image to '$uri'", cause)
open class FontUtilsModule : Module() {
private val context: Context
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
override fun definition() = ModuleDefinition {
Name("ExpoFontUtils")
AsyncFunction("renderToImageAsync") { glyphs: String, options: RenderToImageOptions, promise: Promise ->
val typeface = ReactFontManager.getInstance().getTypeface(options.fontFamily, Typeface.NORMAL, context.assets)
val scalingFactor = context.resources.displayMetrics.density
val scaledSize = options.size * scalingFactor
val lineHeight = options.lineHeight?.let { it * scalingFactor }
val paint = Paint().apply {
this.typeface = typeface
color = options.color
textSize = scaledSize
isAntiAlias = true
}
val fontMetrics = paint.fontMetrics
val width = ceil(paint.measureText(glyphs)).toInt()
// Calculate height based on font metrics to ensure enough space
// This gives the maximum height the font might occupy. Could be more than strictly needed but aligns with iOS.
val height = lineHeight?.toInt() ?: ceil(fontMetrics.descent - fontMetrics.ascent).toInt()
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
val yBaseline = lineHeight?.let {
// When lineHeight is specified, center the text vertically within that height
(it - (fontMetrics.descent - fontMetrics.ascent)) / 2f - fontMetrics.ascent
// The `drawText` method's y-parameter is the baseline of the text.
// To draw the text starting from the very top of the bitmap,
// the baseline should be at -fontMetrics.ascent.
// For most characters, text may appear vertically centered, but try with characters like Å or Ç
} ?: -fontMetrics.ascent
canvas.drawText(glyphs, 0f, yBaseline, paint)
val output = File(context.cacheDir, "${UUID.randomUUID()}.png")
try {
FileOutputStream(output).use { out ->
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out)
}
promise.resolve(
mapOf(
"uri" to output.toUri().toString(),
"width" to bitmap.width / scalingFactor,
"height" to bitmap.height / scalingFactor,
"scale" to scalingFactor
)
)
} catch (e: IOException) {
promise.reject(SaveImageException(output.absolutePath, e))
}
}
}
}

View File

@@ -0,0 +1,19 @@
package expo.modules.font
import android.graphics.Color
import expo.modules.kotlin.records.Field
import expo.modules.kotlin.records.Record
data class RenderToImageOptions(
@Field
val fontFamily: String = "",
@Field
val size: Float = 24f,
@Field
val lineHeight: Float? = null,
@Field
val color: Int = Color.BLACK
) : Record

1
node_modules/expo-font/app.plugin.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./plugin/build/withFonts');

13
node_modules/expo-font/build/ExpoFontLoader.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { UnloadFontOptions } from './Font.types';
export type ExpoFontLoaderModule = {
getLoadedFonts: () => string[];
loadAsync: (fontFamilyName: string, localUriOrWebAsset: any) => Promise<void>;
unloadAllAsync?: () => Promise<void>;
unloadAsync?: (fontFamilyName: string, options?: UnloadFontOptions) => Promise<void>;
isLoaded?: (fontFamilyName: string, options?: UnloadFontOptions) => boolean;
getServerResources?: () => string[];
resetServerContext?: () => void;
};
declare const m: ExpoFontLoaderModule;
export default m;
//# sourceMappingURL=ExpoFontLoader.d.ts.map

1
node_modules/expo-font/build/ExpoFontLoader.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontLoader.d.ts","sourceRoot":"","sources":["../src/ExpoFontLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9E,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC5E,kBAAkB,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC;AAEF,QAAA,MAAM,CAAC,EAAE,oBAWkC,CAAC;AAC5C,eAAe,CAAC,CAAC"}

14
node_modules/expo-font/build/ExpoFontLoader.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { requireNativeModule } from 'expo-modules-core';
const m = typeof window === 'undefined'
? // React server mock
{
getLoadedFonts() {
return [];
},
loadAsync() {
return Promise.resolve();
},
}
: requireNativeModule('ExpoFontLoader');
export default m;
//# sourceMappingURL=ExpoFontLoader.js.map

1
node_modules/expo-font/build/ExpoFontLoader.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontLoader.js","sourceRoot":"","sources":["../src/ExpoFontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAexD,MAAM,CAAC,GACL,OAAO,MAAM,KAAK,WAAW;IAC3B,CAAC,CAAC,oBAAoB;QACpB;YACE,cAAc;gBACZ,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,SAAS;gBACP,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;SACF;IACH,CAAC,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC5C,eAAe,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nimport { UnloadFontOptions } from './Font.types';\n\nexport type ExpoFontLoaderModule = {\n getLoadedFonts: () => string[];\n loadAsync: (fontFamilyName: string, localUriOrWebAsset: any) => Promise<void>;\n // the following methods are only available on web\n unloadAllAsync?: () => Promise<void>;\n unloadAsync?: (fontFamilyName: string, options?: UnloadFontOptions) => Promise<void>;\n isLoaded?: (fontFamilyName: string, options?: UnloadFontOptions) => boolean;\n getServerResources?: () => string[];\n resetServerContext?: () => void;\n};\n\nconst m: ExpoFontLoaderModule =\n typeof window === 'undefined'\n ? // React server mock\n {\n getLoadedFonts() {\n return [];\n },\n loadAsync() {\n return Promise.resolve();\n },\n }\n : requireNativeModule('ExpoFontLoader');\nexport default m;\n"]}

7
node_modules/expo-font/build/ExpoFontLoader.web.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { ExpoFontLoaderModule } from './ExpoFontLoader';
import { FontResource } from './Font.types';
declare const ExpoFontLoader: Required<ExpoFontLoaderModule>;
declare const _default: typeof ExpoFontLoader;
export default _default;
export declare function _createWebFontTemplate(fontFamily: string, resource: FontResource): string;
//# sourceMappingURL=ExpoFontLoader.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontLoader.web.d.ts","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AAgFzD,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,oBAAoB,CAsGlD,CAAC;wBAcyB,OAAO,cAAc;AAAhD,wBAAiD;AAejD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAIzF"}

197
node_modules/expo-font/build/ExpoFontLoader.web.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
import { CodedError, registerWebModule } from 'expo-modules-core';
import FontObserver from 'fontfaceobserver';
import { FontDisplay } from './Font.types';
function getFontFaceStyleSheet() {
if (typeof window === 'undefined') {
return null;
}
const styleSheet = getStyleElement();
return styleSheet.sheet ? styleSheet.sheet : null;
}
function getFontFaceRules() {
const sheet = getFontFaceStyleSheet();
if (sheet) {
// @ts-ignore: rule iterator
const rules = [...sheet.cssRules];
const items = [];
for (let i = 0; i < rules.length; i++) {
const rule = rules[i];
if (rule instanceof CSSFontFaceRule) {
items.push({ rule, index: i });
}
}
return items;
}
return [];
}
function getFontFaceRulesMatchingResource(fontFamilyName, options) {
const rules = getFontFaceRules();
return rules.filter(({ rule }) => {
return (rule.style.fontFamily === fontFamilyName &&
(options && options.display ? options.display === rule.style.fontDisplay : true));
});
}
const serverContext = new Set();
function getHeadElements() {
const entries = [...serverContext.entries()];
if (!entries.length) {
return [];
}
const css = entries.map(([{ css }]) => css).join('\n');
const links = entries.map(([{ resourceId }]) => resourceId);
// TODO: Maybe return nothing if no fonts were loaded.
return [
{
$$type: 'style',
children: css,
id: ID,
type: 'text/css',
},
...links.map((resourceId) => ({
$$type: 'link',
rel: 'preload',
href: resourceId,
as: 'font',
crossorigin: '',
})),
];
}
const ExpoFontLoader = {
async unloadAllAsync() {
if (typeof window === 'undefined')
return;
const element = document.getElementById(ID);
if (element && element instanceof HTMLStyleElement) {
document.removeChild(element);
}
},
async unloadAsync(fontFamilyName, options) {
const sheet = getFontFaceStyleSheet();
if (!sheet)
return;
const items = getFontFaceRulesMatchingResource(fontFamilyName, options);
for (const item of items) {
sheet.deleteRule(item.index);
}
},
getServerResources() {
const elements = getHeadElements();
return elements
.map((element) => {
switch (element.$$type) {
case 'style':
return `<style id="${element.id}">${element.children}</style>`;
case 'link':
return `<link rel="${element.rel}" href="${element.href}" as="${element.as}" crossorigin="${element.crossorigin}" />`;
default:
return '';
}
})
.filter(Boolean);
},
resetServerContext() {
serverContext.clear();
},
getLoadedFonts() {
if (typeof window === 'undefined') {
return [...serverContext.values()].map(({ name }) => name);
}
const rules = getFontFaceRules();
return rules.map(({ rule }) => rule.style.fontFamily);
},
isLoaded(fontFamilyName, resource = {}) {
if (typeof window === 'undefined') {
return !![...serverContext.values()].find((asset) => {
return asset.name === fontFamilyName;
});
}
return getFontFaceRulesMatchingResource(fontFamilyName, resource)?.length > 0;
},
// NOTE(vonovak): This is used in RN vector-icons to load fonts dynamically on web. Changing the signature is breaking.
// NOTE(EvanBacon): No async keyword! This cannot return a promise in Node environments.
loadAsync(fontFamilyName, resource) {
if (__DEV__ && typeof resource !== 'object') {
// to help devving on web, where loadAsync interface is different from native
throw new CodedError('ERR_FONT_SOURCE', `Expected font resource of type \`object\` instead got: ${typeof resource}`);
}
if (typeof window === 'undefined') {
serverContext.add({
name: fontFamilyName,
css: _createWebFontTemplate(fontFamilyName, resource),
// @ts-expect-error: typeof string
resourceId: resource.uri,
});
return Promise.resolve();
}
const canInjectStyle = document.head && typeof document.head.appendChild === 'function';
if (!canInjectStyle) {
throw new CodedError('ERR_WEB_ENVIRONMENT', `The browser's \`document.head\` element doesn't support injecting fonts.`);
}
const style = getStyleElement();
document.head.appendChild(style);
const res = getFontFaceRulesMatchingResource(fontFamilyName, resource);
if (!res.length) {
_createWebStyle(fontFamilyName, resource);
}
if (!isFontLoadingListenerSupported()) {
return Promise.resolve();
}
return new FontObserver(fontFamilyName, {
// @ts-expect-error: TODO(@kitten): Typings indicate that the polyfill may not support this?
display: resource.display,
}).load(resource.testString ?? null, 12000);
},
};
const isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';
function createExpoFontLoader() {
return ExpoFontLoader;
}
const toExport = isServer
? ExpoFontLoader
: // @ts-expect-error: registerWebModule calls `new` on the module implementation.
// Normally that'd be a class but that doesn't work on server, so we use a function instead.
// TS doesn't like that but we don't need it to be a class.
registerWebModule(createExpoFontLoader, 'ExpoFontLoader');
export default toExport;
const ID = 'expo-generated-fonts';
function getStyleElement() {
const element = document.getElementById(ID);
if (element && element instanceof HTMLStyleElement) {
return element;
}
const styleElement = document.createElement('style');
styleElement.id = ID;
return styleElement;
}
export function _createWebFontTemplate(fontFamily, resource) {
return `@font-face{font-family:"${fontFamily}";src:url("${resource.uri}");font-display:${resource.display || FontDisplay.AUTO}}`;
}
function _createWebStyle(fontFamily, resource) {
const fontStyle = _createWebFontTemplate(fontFamily, resource);
const styleElement = getStyleElement();
// @ts-ignore: TypeScript does not define HTMLStyleElement::styleSheet. This is just for IE and
// possibly can be removed if it's unnecessary on IE 11.
if (styleElement.styleSheet) {
const styleElementIE = styleElement;
styleElementIE.styleSheet.cssText = styleElementIE.styleSheet.cssText
? styleElementIE.styleSheet.cssText + fontStyle
: fontStyle;
}
else {
const textNode = document.createTextNode(fontStyle);
styleElement.appendChild(textNode);
}
return styleElement;
}
function isFontLoadingListenerSupported() {
const { userAgent } = window.navigator;
// WebKit is broken https://github.com/bramstein/fontfaceobserver/issues/95
const isIOS = !!userAgent.match(/iPad|iPhone/i);
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
// Edge is broken https://github.com/bramstein/fontfaceobserver/issues/109#issuecomment-333356795
const isEdge = userAgent.includes('Edge');
// Internet Explorer
const isIE = userAgent.includes('Trident');
return !isSafari && !isIOS && !isEdge && !isIE;
}
//# sourceMappingURL=ExpoFontLoader.web.js.map

File diff suppressed because one or more lines are too long

3
node_modules/expo-font/build/ExpoFontUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const _default: any;
export default _default;
//# sourceMappingURL=ExpoFontUtils.d.ts.map

1
node_modules/expo-font/build/ExpoFontUtils.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontUtils.d.ts","sourceRoot":"","sources":["../src/ExpoFontUtils.ts"],"names":[],"mappings":";AAEA,wBAA4D"}

3
node_modules/expo-font/build/ExpoFontUtils.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { requireOptionalNativeModule } from 'expo-modules-core';
export default requireOptionalNativeModule('ExpoFontUtils');
//# sourceMappingURL=ExpoFontUtils.js.map

1
node_modules/expo-font/build/ExpoFontUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontUtils.js","sourceRoot":"","sources":["../src/ExpoFontUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEhE,eAAe,2BAA2B,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { requireOptionalNativeModule } from 'expo-modules-core';\n\nexport default requireOptionalNativeModule('ExpoFontUtils');\n"]}

8
node_modules/expo-font/build/ExpoFontUtils.web.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { NativeModule } from 'expo-modules-core';
import { RenderToImageOptions } from './FontUtils.types';
declare class ExpoFontUtils extends NativeModule {
renderToImageAsync(glyphs: string, options?: RenderToImageOptions): Promise<string>;
}
declare const _default: typeof ExpoFontUtils;
export default _default;
//# sourceMappingURL=ExpoFontUtils.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontUtils.web.d.ts","sourceRoot":"","sources":["../src/ExpoFontUtils.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0C,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,cAAM,aAAc,SAAQ,YAAY;IAChC,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1F;;AAED,wBAAiE"}

8
node_modules/expo-font/build/ExpoFontUtils.web.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { NativeModule, registerWebModule, UnavailabilityError } from 'expo-modules-core';
class ExpoFontUtils extends NativeModule {
async renderToImageAsync(glyphs, options) {
throw new UnavailabilityError('expo-font', 'renderToImageAsync');
}
}
export default registerWebModule(ExpoFontUtils, 'ExpoFontUtils');
//# sourceMappingURL=ExpoFontUtils.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoFontUtils.web.js","sourceRoot":"","sources":["../src/ExpoFontUtils.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIzF,MAAM,aAAc,SAAQ,YAAY;IACtC,KAAK,CAAC,kBAAkB,CAAC,MAAc,EAAE,OAA8B;QACrE,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACnE,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule, UnavailabilityError } from 'expo-modules-core';\n\nimport { RenderToImageOptions } from './FontUtils.types';\n\nclass ExpoFontUtils extends NativeModule {\n async renderToImageAsync(glyphs: string, options?: RenderToImageOptions): Promise<string> {\n throw new UnavailabilityError('expo-font', 'renderToImageAsync');\n }\n}\n\nexport default registerWebModule(ExpoFontUtils, 'ExpoFontUtils');\n"]}

54
node_modules/expo-font/build/Font.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { FontDisplay, FontSource, FontResource, UnloadFontOptions } from './Font.types';
/**
* Synchronously detect if the font for `fontFamily` has finished loading.
*
* @param fontFamily The name used to load the `FontResource`.
* @return Returns `true` if the font has fully loaded.
*/
export declare function isLoaded(fontFamily: string): boolean;
/**
* Synchronously get all the fonts that have been loaded.
* This includes fonts that were bundled at build time using the config plugin, as well as those loaded at runtime using `loadAsync`.
*
* @returns Returns array of strings which you can use as `fontFamily` [style prop](https://reactnative.dev/docs/text#style).
*/
export declare function getLoadedFonts(): string[];
/**
* Synchronously detect if the font for `fontFamily` is still being loaded.
*
* @param fontFamily The name used to load the `FontResource`.
* @returns Returns `true` if the font is still loading.
*/
export declare function isLoading(fontFamily: string): boolean;
/**
* An efficient method for loading fonts from static or remote resources which can then be used
* with the platform's native text elements. In the browser, this generates a `@font-face` block in
* a shared style sheet for fonts. No CSS is needed to use this method.
*
* > **Note**: We recommend using the [config plugin](#configuration-in-app-config) instead whenever possible.
*
* @param fontFamilyOrFontMap String or map of values that can be used as the `fontFamily` [style prop](https://reactnative.dev/docs/text#style)
* with React Native `Text` elements.
* @param source The font asset that should be loaded into the `fontFamily` namespace.
*
* @return Returns a promise that fulfils when the font has loaded. Often you may want to wrap the
* method in a `try/catch/finally` to ensure the app continues if the font fails to load.
*/
export declare function loadAsync(fontFamilyOrFontMap: string | Record<string, FontSource>, source?: FontSource): Promise<void>;
/**
* Unloads all the custom fonts. This is used for testing.
* @hidden
*/
export declare function unloadAllAsync(): Promise<void>;
/**
* Unload custom fonts matching the `fontFamily`s and display values provided.
* This is used for testing.
*
* @param fontFamilyOrFontMap The name or names of the custom fonts that will be unloaded.
* @param options When `fontFamilyOrFontMap` is a string, this should be the font source used to load
* the custom font originally.
* @hidden
*/
export declare function unloadAsync(fontFamilyOrFontMap: string | Record<string, UnloadFontOptions>, options?: UnloadFontOptions): Promise<void>;
export { FontDisplay, FontSource, FontResource, UnloadFontOptions };
//# sourceMappingURL=Font.d.ts.map

1
node_modules/expo-font/build/Font.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Font.d.ts","sourceRoot":"","sources":["../src/Font.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAaxF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAUpD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAGD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAErD;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CACvB,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACxD,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CAkCf;AA0CD;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAapD;AAGD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC/D,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAkBf;AA0BD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC"}

168
node_modules/expo-font/build/Font.js generated vendored Normal file
View File

@@ -0,0 +1,168 @@
import { CodedError, Platform, UnavailabilityError } from 'expo-modules-core';
import ExpoFontLoader from './ExpoFontLoader';
import { FontDisplay } from './Font.types';
import { getAssetForSource, loadSingleFontAsync } from './FontLoader';
import { isLoadedInCache, isLoadedNative, loadPromises, markLoaded, purgeCache, purgeFontFamilyFromCache, } from './memory';
import { registerStaticFont } from './server';
// @needsAudit
/**
* Synchronously detect if the font for `fontFamily` has finished loading.
*
* @param fontFamily The name used to load the `FontResource`.
* @return Returns `true` if the font has fully loaded.
*/
export function isLoaded(fontFamily) {
if (Platform.OS === 'web') {
if (typeof ExpoFontLoader.isLoaded !== 'function') {
throw new Error(`expected ExpoFontLoader.isLoaded to be a function, was ${typeof ExpoFontLoader.isLoaded}`);
}
return isLoadedInCache(fontFamily) || ExpoFontLoader.isLoaded(fontFamily);
}
return isLoadedNative(fontFamily);
}
/**
* Synchronously get all the fonts that have been loaded.
* This includes fonts that were bundled at build time using the config plugin, as well as those loaded at runtime using `loadAsync`.
*
* @returns Returns array of strings which you can use as `fontFamily` [style prop](https://reactnative.dev/docs/text#style).
*/
export function getLoadedFonts() {
return ExpoFontLoader.getLoadedFonts();
}
// @needsAudit
/**
* Synchronously detect if the font for `fontFamily` is still being loaded.
*
* @param fontFamily The name used to load the `FontResource`.
* @returns Returns `true` if the font is still loading.
*/
export function isLoading(fontFamily) {
return fontFamily in loadPromises;
}
// @needsAudit
/**
* An efficient method for loading fonts from static or remote resources which can then be used
* with the platform's native text elements. In the browser, this generates a `@font-face` block in
* a shared style sheet for fonts. No CSS is needed to use this method.
*
* > **Note**: We recommend using the [config plugin](#configuration-in-app-config) instead whenever possible.
*
* @param fontFamilyOrFontMap String or map of values that can be used as the `fontFamily` [style prop](https://reactnative.dev/docs/text#style)
* with React Native `Text` elements.
* @param source The font asset that should be loaded into the `fontFamily` namespace.
*
* @return Returns a promise that fulfils when the font has loaded. Often you may want to wrap the
* method in a `try/catch/finally` to ensure the app continues if the font fails to load.
*/
export function loadAsync(fontFamilyOrFontMap, source) {
// NOTE(EvanBacon): Static render pass on web must be synchronous to collect all fonts.
// Because of this, `loadAsync` doesn't use the `async` keyword and deviates from the
// standard Expo SDK style guide.
const isServer = Platform.OS === 'web' && typeof window === 'undefined';
if (typeof fontFamilyOrFontMap === 'object') {
if (source) {
return Promise.reject(new CodedError(`ERR_FONT_API`, `No fontFamily can be used for the provided source: ${source}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));
}
const fontMap = fontFamilyOrFontMap;
const names = Object.keys(fontMap);
if (isServer) {
names.map((name) => registerStaticFont(name, fontMap[name]));
return Promise.resolve();
}
return Promise.all(names.map((name) => loadFontInNamespaceAsync(name, fontMap[name]))).then(() => { });
}
if (isServer) {
registerStaticFont(fontFamilyOrFontMap, source);
return Promise.resolve();
}
return loadFontInNamespaceAsync(fontFamilyOrFontMap, source);
}
async function loadFontInNamespaceAsync(fontFamily, source) {
if (!source) {
throw new CodedError(`ERR_FONT_SOURCE`, `Cannot load null or undefined font source: { "${fontFamily}": ${source} }. Expected asset of type \`FontSource\` for fontFamily of name: "${fontFamily}"`);
}
// we consult the native module to see if the font is already loaded
// this is slower than checking the cache but can help avoid loading the same font n times
if (isLoaded(fontFamily)) {
return;
}
if (loadPromises.hasOwnProperty(fontFamily)) {
return loadPromises[fontFamily];
}
// Important: we want all callers that concurrently try to load the same font to await the same
// promise. If we're here, we haven't created the promise yet. To ensure we create only one
// promise in the program, we need to create the promise synchronously without yielding the event
// loop from this point.
const asset = getAssetForSource(source);
loadPromises[fontFamily] = (async () => {
try {
await loadSingleFontAsync(fontFamily, asset);
markLoaded(fontFamily);
}
finally {
delete loadPromises[fontFamily];
}
})();
await loadPromises[fontFamily];
}
// @needsAudit
/**
* Unloads all the custom fonts. This is used for testing.
* @hidden
*/
export async function unloadAllAsync() {
if (!ExpoFontLoader.unloadAllAsync) {
throw new UnavailabilityError('expo-font', 'unloadAllAsync');
}
if (Object.keys(loadPromises).length) {
throw new CodedError(`ERR_UNLOAD`, `Cannot unload fonts while they're still loading: ${Object.keys(loadPromises).join(', ')}`);
}
purgeCache();
await ExpoFontLoader.unloadAllAsync();
}
// @needsAudit
/**
* Unload custom fonts matching the `fontFamily`s and display values provided.
* This is used for testing.
*
* @param fontFamilyOrFontMap The name or names of the custom fonts that will be unloaded.
* @param options When `fontFamilyOrFontMap` is a string, this should be the font source used to load
* the custom font originally.
* @hidden
*/
export async function unloadAsync(fontFamilyOrFontMap, options) {
if (!ExpoFontLoader.unloadAsync) {
throw new UnavailabilityError('expo-font', 'unloadAsync');
}
if (typeof fontFamilyOrFontMap === 'object') {
if (options) {
throw new CodedError(`ERR_FONT_API`, `No fontFamily can be used for the provided options: ${options}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);
}
const fontMap = fontFamilyOrFontMap;
const names = Object.keys(fontMap);
await Promise.all(names.map((name) => unloadFontInNamespaceAsync(name, fontMap[name])));
return;
}
return await unloadFontInNamespaceAsync(fontFamilyOrFontMap, options);
}
async function unloadFontInNamespaceAsync(fontFamily, options) {
if (!isLoaded(fontFamily)) {
return;
}
else {
purgeFontFamilyFromCache(fontFamily);
}
// Important: we want all callers that concurrently try to load the same font to await the same
// promise. If we're here, we haven't created the promise yet. To ensure we create only one
// promise in the program, we need to create the promise synchronously without yielding the event
// loop from this point.
if (!fontFamily) {
throw new CodedError(`ERR_FONT_FAMILY`, `Cannot unload an empty name`);
}
if (!ExpoFontLoader.unloadAsync) {
throw new UnavailabilityError('expo-font', 'unloadAsync');
}
await ExpoFontLoader.unloadAsync(fontFamily, options);
}
export { FontDisplay };
//# sourceMappingURL=Font.js.map

1
node_modules/expo-font/build/Font.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

72
node_modules/expo-font/build/Font.types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
import { Asset } from 'expo-asset';
/**
* The different types of assets you can provide to the [`loadAsync()`](#loadasyncfontfamilyorfontmap-source) function.
* A font source can be a URI, a module ID, or an Expo Asset.
*/
export type FontSource = string | number | Asset | FontResource;
/**
* An object used to dictate the resource that is loaded into the provided font namespace when used
* with [`loadAsync`](#loadasyncfontfamilyorfontmap-source).
*/
export type FontResource = {
uri?: string | number;
/**
* Sets the [`font-display`](#fontdisplay) property for a given typeface in the browser.
* @platform web
*/
display?: FontDisplay;
default?: string;
/**
* Sets a custom test string passed to the [FontFace Observer](https://www.npmjs.com/package/fontfaceobserver).
* @platform web
*/
testString?: string;
};
/**
* Sets the [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display)
* for a given typeface. The default font value on web is `FontDisplay.AUTO`.
* Even though setting the `fontDisplay` does nothing on native platforms, the default behavior
* emulates `FontDisplay.SWAP` on flagship devices like iOS, Samsung, Pixel, etc. Default
* functionality varies on One Plus devices. In the browser this value is set in the generated
* `@font-face` CSS block and not as a style property meaning you cannot dynamically change this
* value based on the element it's used in.
* @platform web
*/
export declare enum FontDisplay {
/**
* __(Default)__ The font display strategy is defined by the user agent or platform.
* This generally defaults to the text being invisible until the font is loaded.
* Good for buttons or banners that require a specific treatment.
*/
AUTO = "auto",
/**
* Fallback text is rendered immediately with a default font while the desired font is loaded.
* This is good for making the content appear to load instantly and is usually preferred.
*/
SWAP = "swap",
/**
* The text will be invisible until the font has loaded. If the font fails to load then nothing
* will appear - it's best to turn this off when debugging missing text.
*/
BLOCK = "block",
/**
* Splits the behavior between `SWAP` and `BLOCK`.
* There will be a [100ms timeout](https://developers.google.com/web/updates/2016/02/font-display?hl=en)
* where the text with a custom font is invisible, after that the text will either swap to the
* styled text or it'll show the unstyled text and continue to load the custom font. This is good
* for buttons that need a custom font but should also be quickly available to screen-readers.
*/
FALLBACK = "fallback",
/**
* This works almost identically to `FALLBACK`, the only difference is that the browser will
* decide to load the font based on slow connection speed or critical resource demand.
*/
OPTIONAL = "optional"
}
/**
* Object used to query fonts for unloading.
* @hidden
*/
export type UnloadFontOptions = Pick<FontResource, 'display'>;
export type UseFontHook = (map: string | Record<string, FontSource>) => [boolean, Error | null];
//# sourceMappingURL=Font.types.d.ts.map

1
node_modules/expo-font/build/Font.types.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Font.types.d.ts","sourceRoot":"","sources":["../src/Font.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,YAAY,CAAC;AAGhE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAGF;;;;;;;;;GASG;AACH,oBAAY,WAAW;IACrB;;;;OAIG;IACH,IAAI,SAAS;IACb;;;OAGG;IACH,IAAI,SAAS;IACb;;;OAGG;IACH,KAAK,UAAU;IACf;;;;;;OAMG;IACH,QAAQ,aAAa;IACrB;;;OAGG;IACH,QAAQ,aAAa;CACtB;AAGD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC"}

44
node_modules/expo-font/build/Font.types.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
// @needsAudit
/**
* Sets the [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display)
* for a given typeface. The default font value on web is `FontDisplay.AUTO`.
* Even though setting the `fontDisplay` does nothing on native platforms, the default behavior
* emulates `FontDisplay.SWAP` on flagship devices like iOS, Samsung, Pixel, etc. Default
* functionality varies on One Plus devices. In the browser this value is set in the generated
* `@font-face` CSS block and not as a style property meaning you cannot dynamically change this
* value based on the element it's used in.
* @platform web
*/
export var FontDisplay;
(function (FontDisplay) {
/**
* __(Default)__ The font display strategy is defined by the user agent or platform.
* This generally defaults to the text being invisible until the font is loaded.
* Good for buttons or banners that require a specific treatment.
*/
FontDisplay["AUTO"] = "auto";
/**
* Fallback text is rendered immediately with a default font while the desired font is loaded.
* This is good for making the content appear to load instantly and is usually preferred.
*/
FontDisplay["SWAP"] = "swap";
/**
* The text will be invisible until the font has loaded. If the font fails to load then nothing
* will appear - it's best to turn this off when debugging missing text.
*/
FontDisplay["BLOCK"] = "block";
/**
* Splits the behavior between `SWAP` and `BLOCK`.
* There will be a [100ms timeout](https://developers.google.com/web/updates/2016/02/font-display?hl=en)
* where the text with a custom font is invisible, after that the text will either swap to the
* styled text or it'll show the unstyled text and continue to load the custom font. This is good
* for buttons that need a custom font but should also be quickly available to screen-readers.
*/
FontDisplay["FALLBACK"] = "fallback";
/**
* This works almost identically to `FALLBACK`, the only difference is that the browser will
* decide to load the font based on slow connection speed or critical resource demand.
*/
FontDisplay["OPTIONAL"] = "optional";
})(FontDisplay || (FontDisplay = {}));
//# sourceMappingURL=Font.types.js.map

1
node_modules/expo-font/build/Font.types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Font.types.js","sourceRoot":"","sources":["../src/Font.types.ts"],"names":[],"mappings":"AA6BA,cAAc;AACd;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,WA8BX;AA9BD,WAAY,WAAW;IACrB;;;;OAIG;IACH,4BAAa,CAAA;IACb;;;OAGG;IACH,4BAAa,CAAA;IACb;;;OAGG;IACH,8BAAe,CAAA;IACf;;;;;;OAMG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,oCAAqB,CAAA;AACvB,CAAC,EA9BW,WAAW,KAAX,WAAW,QA8BtB","sourcesContent":["import { Asset } from 'expo-asset';\n\n// @needsAudit\n/**\n * The different types of assets you can provide to the [`loadAsync()`](#loadasyncfontfamilyorfontmap-source) function.\n * A font source can be a URI, a module ID, or an Expo Asset.\n */\nexport type FontSource = string | number | Asset | FontResource;\n\n// @needsAudit\n/**\n * An object used to dictate the resource that is loaded into the provided font namespace when used\n * with [`loadAsync`](#loadasyncfontfamilyorfontmap-source).\n */\nexport type FontResource = {\n uri?: string | number;\n /**\n * Sets the [`font-display`](#fontdisplay) property for a given typeface in the browser.\n * @platform web\n */\n display?: FontDisplay;\n default?: string;\n /**\n * Sets a custom test string passed to the [FontFace Observer](https://www.npmjs.com/package/fontfaceobserver).\n * @platform web\n */\n testString?: string;\n};\n\n// @needsAudit\n/**\n * Sets the [font-display](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display)\n * for a given typeface. The default font value on web is `FontDisplay.AUTO`.\n * Even though setting the `fontDisplay` does nothing on native platforms, the default behavior\n * emulates `FontDisplay.SWAP` on flagship devices like iOS, Samsung, Pixel, etc. Default\n * functionality varies on One Plus devices. In the browser this value is set in the generated\n * `@font-face` CSS block and not as a style property meaning you cannot dynamically change this\n * value based on the element it's used in.\n * @platform web\n */\nexport enum FontDisplay {\n /**\n * __(Default)__ The font display strategy is defined by the user agent or platform.\n * This generally defaults to the text being invisible until the font is loaded.\n * Good for buttons or banners that require a specific treatment.\n */\n AUTO = 'auto',\n /**\n * Fallback text is rendered immediately with a default font while the desired font is loaded.\n * This is good for making the content appear to load instantly and is usually preferred.\n */\n SWAP = 'swap',\n /**\n * The text will be invisible until the font has loaded. If the font fails to load then nothing\n * will appear - it's best to turn this off when debugging missing text.\n */\n BLOCK = 'block',\n /**\n * Splits the behavior between `SWAP` and `BLOCK`.\n * There will be a [100ms timeout](https://developers.google.com/web/updates/2016/02/font-display?hl=en)\n * where the text with a custom font is invisible, after that the text will either swap to the\n * styled text or it'll show the unstyled text and continue to load the custom font. This is good\n * for buttons that need a custom font but should also be quickly available to screen-readers.\n */\n FALLBACK = 'fallback',\n /**\n * This works almost identically to `FALLBACK`, the only difference is that the browser will\n * decide to load the font based on slow connection speed or critical resource demand.\n */\n OPTIONAL = 'optional',\n}\n\n// @needsAudit\n/**\n * Object used to query fonts for unloading.\n * @hidden\n */\nexport type UnloadFontOptions = Pick<FontResource, 'display'>;\n\nexport type UseFontHook = (map: string | Record<string, FontSource>) => [boolean, Error | null];\n"]}

24
node_modules/expo-font/build/FontHooks.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { UseFontHook } from './Font.types';
/**
* Load a map of fonts at runtime with [`loadAsync`](#loadasyncfontfamilyorfontmap-source). This returns `true` if the fonts are
* loaded and ready to use. It also returns an error if something went wrong, to use in development.
*
* > Note, the fonts are not "reloaded" when you dynamically change the font map.
*
* @param map A map of `fontFamily`s to [`FontSource`](#fontsource)s. After loading the font you can
* use the key in the `fontFamily` style prop of a `Text` element.
*
* @return
* - __loaded__ (`boolean`) - A boolean to detect if the font for `fontFamily` has finished
* loading.
* - __error__ (`Error | null`) - An error encountered when loading the fonts.
*
* @example
* ```tsx
* const [loaded, error] = useFonts({
* 'Inter-Black': require('./assets/fonts/Inter-Black.otf'),
* });
* ```
*/
export declare const useFonts: UseFontHook;
//# sourceMappingURL=FontHooks.d.ts.map

1
node_modules/expo-font/build/FontHooks.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontHooks.d.ts","sourceRoot":"","sources":["../src/FontHooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,WAAW,EAAE,MAAM,cAAc,CAAC;AA+CvD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,EAAE,WAC2C,CAAC"}

63
node_modules/expo-font/build/FontHooks.js generated vendored Normal file
View File

@@ -0,0 +1,63 @@
import { useEffect, useState } from 'react';
import { loadAsync, isLoaded } from './Font';
function isMapLoaded(map) {
if (typeof map === 'string') {
return isLoaded(map);
}
else {
return Object.keys(map).every((fontFamily) => isLoaded(fontFamily));
}
}
function useRuntimeFonts(map) {
const [loaded, setLoaded] = useState(
// For web rehydration, we need to check if the fonts are already loaded during the static render.
// Native will also benefit from this optimization.
isMapLoaded(map));
const [error, setError] = useState(null);
useEffect(() => {
let isMounted = true;
loadAsync(map)
.then(() => {
if (isMounted) {
setLoaded(true);
}
})
.catch((error) => {
if (isMounted) {
setError(error);
}
});
return () => {
isMounted = false;
};
}, []);
return [loaded, error];
}
function useStaticFonts(map) {
loadAsync(map);
return [true, null];
}
// @needsAudit
/**
* Load a map of fonts at runtime with [`loadAsync`](#loadasyncfontfamilyorfontmap-source). This returns `true` if the fonts are
* loaded and ready to use. It also returns an error if something went wrong, to use in development.
*
* > Note, the fonts are not "reloaded" when you dynamically change the font map.
*
* @param map A map of `fontFamily`s to [`FontSource`](#fontsource)s. After loading the font you can
* use the key in the `fontFamily` style prop of a `Text` element.
*
* @return
* - __loaded__ (`boolean`) - A boolean to detect if the font for `fontFamily` has finished
* loading.
* - __error__ (`Error | null`) - An error encountered when loading the fonts.
*
* @example
* ```tsx
* const [loaded, error] = useFonts({
* 'Inter-Black': require('./assets/fonts/Inter-Black.otf'),
* });
* ```
*/
export const useFonts = typeof window === 'undefined' ? useStaticFonts : useRuntimeFonts;
//# sourceMappingURL=FontHooks.js.map

1
node_modules/expo-font/build/FontHooks.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontHooks.js","sourceRoot":"","sources":["../src/FontHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAG7C,SAAS,WAAW,CAAC,GAAwC;IAC3D,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,GAAwC;IAC/D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ;IAClC,kGAAkG;IAClG,mDAAmD;IACnD,WAAW,CAAC,GAAG,CAAC,CACjB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,SAAS,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,SAAS,EAAE,CAAC;gBACd,SAAS,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,IAAI,SAAS,EAAE,CAAC;gBACd,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,cAAc,CAAC,GAAwC;IAC9D,SAAS,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { loadAsync, isLoaded } from './Font';\nimport { FontSource, UseFontHook } from './Font.types';\n\nfunction isMapLoaded(map: string | Record<string, FontSource>) {\n if (typeof map === 'string') {\n return isLoaded(map);\n } else {\n return Object.keys(map).every((fontFamily) => isLoaded(fontFamily));\n }\n}\n\nfunction useRuntimeFonts(map: string | Record<string, FontSource>): [boolean, Error | null] {\n const [loaded, setLoaded] = useState(\n // For web rehydration, we need to check if the fonts are already loaded during the static render.\n // Native will also benefit from this optimization.\n isMapLoaded(map)\n );\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let isMounted = true;\n\n loadAsync(map)\n .then(() => {\n if (isMounted) {\n setLoaded(true);\n }\n })\n .catch((error) => {\n if (isMounted) {\n setError(error);\n }\n });\n\n return () => {\n isMounted = false;\n };\n }, []);\n\n return [loaded, error];\n}\n\nfunction useStaticFonts(map: string | Record<string, FontSource>): [boolean, Error | null] {\n loadAsync(map);\n return [true, null];\n}\n\n// @needsAudit\n/**\n * Load a map of fonts at runtime with [`loadAsync`](#loadasyncfontfamilyorfontmap-source). This returns `true` if the fonts are\n * loaded and ready to use. It also returns an error if something went wrong, to use in development.\n *\n * > Note, the fonts are not \"reloaded\" when you dynamically change the font map.\n *\n * @param map A map of `fontFamily`s to [`FontSource`](#fontsource)s. After loading the font you can\n * use the key in the `fontFamily` style prop of a `Text` element.\n *\n * @return\n * - __loaded__ (`boolean`) - A boolean to detect if the font for `fontFamily` has finished\n * loading.\n * - __error__ (`Error | null`) - An error encountered when loading the fonts.\n *\n * @example\n * ```tsx\n * const [loaded, error] = useFonts({\n * 'Inter-Black': require('./assets/fonts/Inter-Black.otf'),\n * });\n * ```\n */\nexport const useFonts: UseFontHook =\n typeof window === 'undefined' ? useStaticFonts : useRuntimeFonts;\n"]}

5
node_modules/expo-font/build/FontLoader.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Asset } from 'expo-asset';
import { FontResource, FontSource } from './Font.types';
export declare function getAssetForSource(source: FontSource): Asset | FontResource;
export declare function loadSingleFontAsync(name: string, input: Asset | FontResource): Promise<void>;
//# sourceMappingURL=FontLoader.d.ts.map

1
node_modules/expo-font/build/FontLoader.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../src/FontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,GAAG,YAAY,CAc1E;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GAAG,YAAY,GAC1B,OAAO,CAAC,IAAI,CAAC,CAcf"}

30
node_modules/expo-font/build/FontLoader.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import { Asset } from 'expo-asset';
import { CodedError } from 'expo-modules-core';
import ExpoFontLoader from './ExpoFontLoader';
export function getAssetForSource(source) {
if (source instanceof Asset) {
return source;
}
if (typeof source === 'string') {
return Asset.fromURI(source);
}
else if (typeof source === 'number') {
return Asset.fromModule(source);
}
else if (typeof source === 'object' && typeof source.uri !== 'undefined') {
return getAssetForSource(source.uri);
}
return source;
}
export async function loadSingleFontAsync(name, input) {
const asset = input;
if (!asset.downloadAsync) {
throw new CodedError(`ERR_FONT_SOURCE`, '`loadSingleFontAsync` expected resource of type `Asset` from expo-asset on native');
}
await asset.downloadAsync();
if (!asset.downloaded) {
throw new CodedError(`ERR_DOWNLOAD`, `Failed to download asset for font "${name}"`);
}
await ExpoFontLoader.loadAsync(name, asset.localUri);
}
//# sourceMappingURL=FontLoader.js.map

1
node_modules/expo-font/build/FontLoader.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontLoader.js","sourceRoot":"","sources":["../src/FontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C,MAAM,UAAU,iBAAiB,CAAC,MAAkB;IAClD,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;QAC3E,OAAO,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,KAA2B;IAE3B,MAAM,KAAK,GAAG,KAAc,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,mFAAmF,CACpF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,sCAAsC,IAAI,GAAG,CAAC,CAAC;IACtF,CAAC;IACD,MAAM,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { Asset } from 'expo-asset';\nimport { CodedError } from 'expo-modules-core';\n\nimport ExpoFontLoader from './ExpoFontLoader';\nimport { FontResource, FontSource } from './Font.types';\n\nexport function getAssetForSource(source: FontSource): Asset | FontResource {\n if (source instanceof Asset) {\n return source;\n }\n\n if (typeof source === 'string') {\n return Asset.fromURI(source);\n } else if (typeof source === 'number') {\n return Asset.fromModule(source);\n } else if (typeof source === 'object' && typeof source.uri !== 'undefined') {\n return getAssetForSource(source.uri);\n }\n\n return source;\n}\n\nexport async function loadSingleFontAsync(\n name: string,\n input: Asset | FontResource\n): Promise<void> {\n const asset = input as Asset;\n if (!asset.downloadAsync) {\n throw new CodedError(\n `ERR_FONT_SOURCE`,\n '`loadSingleFontAsync` expected resource of type `Asset` from expo-asset on native'\n );\n }\n\n await asset.downloadAsync();\n if (!asset.downloaded) {\n throw new CodedError(`ERR_DOWNLOAD`, `Failed to download asset for font \"${name}\"`);\n }\n await ExpoFontLoader.loadAsync(name, asset.localUri);\n}\n"]}

5
node_modules/expo-font/build/FontLoader.web.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Asset } from 'expo-asset';
import { FontResource, FontSource } from './Font.types';
export declare function getAssetForSource(source: FontSource): Asset | FontResource;
export declare function loadSingleFontAsync(name: string, input: Asset | FontResource): Promise<void>;
//# sourceMappingURL=FontLoader.web.d.ts.map

1
node_modules/expo-font/build/FontLoader.web.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontLoader.web.d.ts","sourceRoot":"","sources":["../src/FontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;AAgCrE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,GAAG,YAAY,CAa1E;AAYD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5F"}

64
node_modules/expo-font/build/FontLoader.web.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
import { Asset } from 'expo-asset';
import { CodedError } from 'expo-modules-core';
import ExpoFontLoader from './ExpoFontLoader';
import { FontDisplay } from './Font.types';
function uriFromFontSource(asset) {
if (typeof asset === 'string') {
return asset || null;
}
else if (typeof asset === 'number') {
return uriFromFontSource(Asset.fromModule(asset));
}
else if (typeof asset === 'object' && typeof asset.uri === 'number') {
return uriFromFontSource(asset.uri);
}
else if (typeof asset === 'object') {
return asset.uri || asset.localUri || asset.default || null;
}
return null;
}
function displayFromFontSource(asset) {
if (typeof asset === 'object' && 'display' in asset) {
return asset.display || FontDisplay.AUTO;
}
return FontDisplay.AUTO;
}
function testStringFromFontSource(asset) {
if (typeof asset === 'object' && 'testString' in asset) {
return asset.testString ?? undefined;
}
return undefined;
}
export function getAssetForSource(source) {
const uri = uriFromFontSource(source);
const display = displayFromFontSource(source);
const testString = testStringFromFontSource(source);
if (!uri || typeof uri !== 'string') {
throwInvalidSourceError(uri);
}
return {
uri,
display,
testString,
};
}
function throwInvalidSourceError(source) {
let type = typeof source;
if (type === 'object')
type = JSON.stringify(source, null, 2);
throw new CodedError(`ERR_FONT_SOURCE`, `Expected font asset of type \`string | FontResource | Asset\` instead got: ${type}`);
}
// NOTE(EvanBacon): No async keyword!
export function loadSingleFontAsync(name, input) {
if (typeof input !== 'object' || typeof input.uri !== 'string' || input.downloadAsync) {
throwInvalidSourceError(input);
}
try {
return ExpoFontLoader.loadAsync(name, input);
}
catch {
// No-op.
}
return Promise.resolve();
}
//# sourceMappingURL=FontLoader.web.js.map

1
node_modules/expo-font/build/FontLoader.web.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontLoader.web.js","sourceRoot":"","sources":["../src/FontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAA4B,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,SAAS,iBAAiB,CAAC,KAAiB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,IAAI,IAAI,CAAC;IACvB,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACtE,OAAO,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,GAAG,IAAK,KAAe,CAAC,QAAQ,IAAK,KAAsB,CAAC,OAAO,IAAI,IAAI,CAAC;IAC3F,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAiB;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC;IAC3C,CAAC;IAED,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAiB;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,IAAI,KAAK,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC,UAAU,IAAI,SAAS,CAAC;IACvC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAkB;IAClD,MAAM,GAAG,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,GAAG;QACH,OAAO;QACP,UAAU;KACX,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAW;IAC1C,IAAI,IAAI,GAAW,OAAO,MAAM,CAAC;IACjC,IAAI,IAAI,KAAK,QAAQ;QAAE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9D,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,8EAA8E,IAAI,EAAE,CACrF,CAAC;AACJ,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAA2B;IAC3E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAK,KAAa,CAAC,aAAa,EAAE,CAAC;QAC/F,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["import { Asset } from 'expo-asset';\nimport { CodedError } from 'expo-modules-core';\n\nimport ExpoFontLoader from './ExpoFontLoader';\nimport { FontResource, FontSource, FontDisplay } from './Font.types';\n\nfunction uriFromFontSource(asset: FontSource): string | number | null {\n if (typeof asset === 'string') {\n return asset || null;\n } else if (typeof asset === 'number') {\n return uriFromFontSource(Asset.fromModule(asset));\n } else if (typeof asset === 'object' && typeof asset.uri === 'number') {\n return uriFromFontSource(asset.uri);\n } else if (typeof asset === 'object') {\n return asset.uri || (asset as Asset).localUri || (asset as FontResource).default || null;\n }\n\n return null;\n}\n\nfunction displayFromFontSource(asset: FontSource): FontDisplay {\n if (typeof asset === 'object' && 'display' in asset) {\n return asset.display || FontDisplay.AUTO;\n }\n\n return FontDisplay.AUTO;\n}\n\nfunction testStringFromFontSource(asset: FontSource): string | undefined {\n if (typeof asset === 'object' && 'testString' in asset) {\n return asset.testString ?? undefined;\n }\n\n return undefined;\n}\n\nexport function getAssetForSource(source: FontSource): Asset | FontResource {\n const uri = uriFromFontSource(source);\n const display = displayFromFontSource(source);\n const testString = testStringFromFontSource(source);\n if (!uri || typeof uri !== 'string') {\n throwInvalidSourceError(uri);\n }\n\n return {\n uri,\n display,\n testString,\n };\n}\n\nfunction throwInvalidSourceError(source: any): never {\n let type: string = typeof source;\n if (type === 'object') type = JSON.stringify(source, null, 2);\n throw new CodedError(\n `ERR_FONT_SOURCE`,\n `Expected font asset of type \\`string | FontResource | Asset\\` instead got: ${type}`\n );\n}\n\n// NOTE(EvanBacon): No async keyword!\nexport function loadSingleFontAsync(name: string, input: Asset | FontResource): Promise<void> {\n if (typeof input !== 'object' || typeof input.uri !== 'string' || (input as any).downloadAsync) {\n throwInvalidSourceError(input);\n }\n\n try {\n return ExpoFontLoader.loadAsync(name, input);\n } catch {\n // No-op.\n }\n\n return Promise.resolve();\n}\n"]}

12
node_modules/expo-font/build/FontUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import type { RenderToImageOptions, RenderToImageResult } from './FontUtils.types';
export type { RenderToImageOptions, RenderToImageResult };
/**
* Creates an image with provided text.
* @param glyphs Text to be exported.
* @param options RenderToImageOptions.
* @return Promise which fulfils with image metadata.
* @platform android
* @platform ios
*/
export declare function renderToImageAsync(glyphs: string, options?: RenderToImageOptions): Promise<RenderToImageResult>;
//# sourceMappingURL=FontUtils.d.ts.map

1
node_modules/expo-font/build/FontUtils.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontUtils.d.ts","sourceRoot":"","sources":["../src/FontUtils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAS9B"}

21
node_modules/expo-font/build/FontUtils.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { UnavailabilityError } from 'expo-modules-core';
import { processColor } from 'react-native';
import ExpoFontUtils from './ExpoFontUtils';
/**
* Creates an image with provided text.
* @param glyphs Text to be exported.
* @param options RenderToImageOptions.
* @return Promise which fulfils with image metadata.
* @platform android
* @platform ios
*/
export async function renderToImageAsync(glyphs, options) {
if (!ExpoFontUtils) {
throw new UnavailabilityError('expo-font', 'ExpoFontUtils.renderToImageAsync');
}
return await ExpoFontUtils.renderToImageAsync(glyphs, {
...options,
color: options?.color ? processColor(options.color) : undefined,
});
}
//# sourceMappingURL=FontUtils.js.map

1
node_modules/expo-font/build/FontUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontUtils.js","sourceRoot":"","sources":["../src/FontUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAK5C;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,OAA8B;IAE9B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,kCAAkC,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,MAAM,aAAa,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACpD,GAAG,OAAO;QACV,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;KAChE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\nimport { processColor } from 'react-native';\n\nimport ExpoFontUtils from './ExpoFontUtils';\nimport type { RenderToImageOptions, RenderToImageResult } from './FontUtils.types';\n\nexport type { RenderToImageOptions, RenderToImageResult };\n\n/**\n * Creates an image with provided text.\n * @param glyphs Text to be exported.\n * @param options RenderToImageOptions.\n * @return Promise which fulfils with image metadata.\n * @platform android\n * @platform ios\n */\nexport async function renderToImageAsync(\n glyphs: string,\n options?: RenderToImageOptions\n): Promise<RenderToImageResult> {\n if (!ExpoFontUtils) {\n throw new UnavailabilityError('expo-font', 'ExpoFontUtils.renderToImageAsync');\n }\n\n return await ExpoFontUtils.renderToImageAsync(glyphs, {\n ...options,\n color: options?.color ? processColor(options.color) : undefined,\n });\n}\n"]}

40
node_modules/expo-font/build/FontUtils.types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
export interface RenderToImageOptions {
/**
* Font family name.
* @default system default
*/
fontFamily?: string;
/**
* Size of the font.
* @default 24
*/
size?: number;
/**
* Font color
* @default 'black'
*/
color?: string;
/**
* Line height of the text. Accepts number in dp units.
*/
lineHeight?: number;
}
export interface RenderToImageResult {
/**
* The file uri to the image.
*/
uri: string;
/**
* Image width in dp.
*/
width: number;
/**
* Image height in dp.
*/
height: number;
/**
* Scale factor of the image. Multiply the dp dimensions by this value to get the dimensions in pixels.
* */
scale: number;
}
//# sourceMappingURL=FontUtils.types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"FontUtils.types.d.ts","sourceRoot":"","sources":["../src/FontUtils.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;SAEK;IACL,KAAK,EAAE,MAAM,CAAC;CACf"}

2
node_modules/expo-font/build/FontUtils.types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=FontUtils.types.js.map

1
node_modules/expo-font/build/FontUtils.types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"FontUtils.types.js","sourceRoot":"","sources":["../src/FontUtils.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface RenderToImageOptions {\n /**\n * Font family name.\n * @default system default\n */\n fontFamily?: string;\n /**\n * Size of the font.\n * @default 24\n */\n size?: number;\n /**\n * Font color\n * @default 'black'\n */\n color?: string;\n /**\n * Line height of the text. Accepts number in dp units.\n */\n lineHeight?: number;\n}\n\n// RenderToImageResult needs to be usable as the `source` prop for image,\n// so it must stay compatible with ImageURISource type\nexport interface RenderToImageResult {\n /**\n * The file uri to the image.\n */\n uri: string;\n /**\n * Image width in dp.\n */\n width: number;\n /**\n * Image height in dp.\n */\n height: number;\n\n /**\n * Scale factor of the image. Multiply the dp dimensions by this value to get the dimensions in pixels.\n * */\n scale: number;\n}\n"]}

4
node_modules/expo-font/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './Font';
export * from './FontUtils';
export { useFonts } from './FontHooks';
//# sourceMappingURL=index.d.ts.map

1
node_modules/expo-font/build/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}

4
node_modules/expo-font/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './Font';
export * from './FontUtils';
export { useFonts } from './FontHooks';
//# sourceMappingURL=index.js.map

1
node_modules/expo-font/build/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export * from './Font';\nexport * from './FontUtils';\nexport { useFonts } from './FontHooks';\n"]}

4
node_modules/expo-font/build/index.server.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { UseFontHook } from './Font.types';
export * from './Font';
export declare const useFonts: UseFontHook;
//# sourceMappingURL=index.server.d.ts.map

1
node_modules/expo-font/build/index.server.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,cAAc,QAAQ,CAAC;AAEvB,eAAO,MAAM,QAAQ,EAAE,WAEtB,CAAC"}

5
node_modules/expo-font/build/index.server.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export * from './Font';
export const useFonts = () => {
return [false, null];
};
//# sourceMappingURL=index.server.js.map

1
node_modules/expo-font/build/index.server.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAEA,cAAc,QAAQ,CAAC;AAEvB,MAAM,CAAC,MAAM,QAAQ,GAAgB,GAAG,EAAE;IACxC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACvB,CAAC,CAAC","sourcesContent":["import { UseFontHook } from './Font.types';\n\nexport * from './Font';\n\nexport const useFonts: UseFontHook = () => {\n return [false, null];\n};\n"]}

9
node_modules/expo-font/build/memory.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export declare const loadPromises: {
[name: string]: Promise<void>;
};
export declare function markLoaded(fontFamily: string): void;
export declare function isLoadedInCache(fontFamily: string): boolean;
export declare function isLoadedNative(fontFamily: string): boolean;
export declare function purgeFontFamilyFromCache(fontFamily: string): void;
export declare function purgeCache(): void;
//# sourceMappingURL=memory.d.ts.map

1
node_modules/expo-font/build/memory.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAO,CAAC;AAKlE,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,QAE5C;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAkB1D;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}

35
node_modules/expo-font/build/memory.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import ExpoFontLoader from './ExpoFontLoader';
export const loadPromises = {};
// cache the value on the js side for fast access to the fonts that are loaded
let cache = {};
export function markLoaded(fontFamily) {
cache[fontFamily] = true;
}
export function isLoadedInCache(fontFamily) {
return fontFamily in cache;
}
export function isLoadedNative(fontFamily) {
if (isLoadedInCache(fontFamily)) {
return true;
}
else {
const loadedNativeFonts = ExpoFontLoader.getLoadedFonts();
// NOTE(brentvatne): Bail out here if there are no loaded fonts. This
// is functionally equivalent to the behavior below if the returned array
// is empty, but this handles improper mocking of `getLoadedFonts`.
if (!loadedNativeFonts?.length) {
return false;
}
loadedNativeFonts.forEach((font) => {
cache[font] = true;
});
return fontFamily in cache;
}
}
export function purgeFontFamilyFromCache(fontFamily) {
delete cache[fontFamily];
}
export function purgeCache() {
cache = {};
}
//# sourceMappingURL=memory.js.map

1
node_modules/expo-font/build/memory.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAsC,EAAE,CAAC;AAElE,8EAA8E;AAC9E,IAAI,KAAK,GAAgC,EAAE,CAAC;AAE5C,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO,UAAU,IAAI,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,MAAM,iBAAiB,GAAa,cAAc,CAAC,cAAc,EAAE,CAAC;QAEpE,qEAAqE;QACrE,yEAAyE;QACzE,mEAAmE;QACnE,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACjC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,IAAI,KAAK,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,KAAK,GAAG,EAAE,CAAC;AACb,CAAC","sourcesContent":["import ExpoFontLoader from './ExpoFontLoader';\n\nexport const loadPromises: { [name: string]: Promise<void> } = {};\n\n// cache the value on the js side for fast access to the fonts that are loaded\nlet cache: { [name: string]: boolean } = {};\n\nexport function markLoaded(fontFamily: string) {\n cache[fontFamily] = true;\n}\n\nexport function isLoadedInCache(fontFamily: string): boolean {\n return fontFamily in cache;\n}\n\nexport function isLoadedNative(fontFamily: string): boolean {\n if (isLoadedInCache(fontFamily)) {\n return true;\n } else {\n const loadedNativeFonts: string[] = ExpoFontLoader.getLoadedFonts();\n\n // NOTE(brentvatne): Bail out here if there are no loaded fonts. This\n // is functionally equivalent to the behavior below if the returned array\n // is empty, but this handles improper mocking of `getLoadedFonts`.\n if (!loadedNativeFonts?.length) {\n return false;\n }\n\n loadedNativeFonts.forEach((font) => {\n cache[font] = true;\n });\n return fontFamily in cache;\n }\n}\n\nexport function purgeFontFamilyFromCache(fontFamily: string): void {\n delete cache[fontFamily];\n}\n\nexport function purgeCache(): void {\n cache = {};\n}\n"]}

13
node_modules/expo-font/build/server.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { FontSource } from './Font.types';
/**
* @returns the server resources that should be statically extracted.
* @private
*/
export declare function getServerResources(): string[];
/**
* @returns clear the server resources from the global scope.
* @private
*/
export declare function resetServerContext(): void;
export declare function registerStaticFont(fontFamily: string, source?: FontSource | null): void;
//# sourceMappingURL=server.d.ts.map

1
node_modules/expo-font/build/server.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAK7C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,SAKjC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,QAWhF"}

32
node_modules/expo-font/build/server.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { CodedError, UnavailabilityError } from 'expo-modules-core';
import ExpoFontLoader from './ExpoFontLoader';
import { getAssetForSource, loadSingleFontAsync } from './FontLoader';
/**
* @returns the server resources that should be statically extracted.
* @private
*/
export function getServerResources() {
if (!ExpoFontLoader.getServerResources) {
throw new UnavailabilityError('expo-font', 'getServerResources');
}
return ExpoFontLoader.getServerResources();
}
/**
* @returns clear the server resources from the global scope.
* @private
*/
export function resetServerContext() {
if (!ExpoFontLoader.resetServerContext) {
throw new UnavailabilityError('expo-font', 'resetServerContext');
}
return ExpoFontLoader.resetServerContext();
}
export function registerStaticFont(fontFamily, source) {
// MUST BE A SYNC FUNCTION!
if (!source) {
throw new CodedError(`ERR_FONT_SOURCE`, `Cannot load null or undefined font source: { "${fontFamily}": ${source} }. Expected asset of type \`FontSource\` for fontFamily of name: "${fontFamily}"`);
}
const asset = getAssetForSource(source);
loadSingleFontAsync(fontFamily, asset);
}
//# sourceMappingURL=server.js.map

1
node_modules/expo-font/build/server.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEtE;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACvC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACvC,MAAM,IAAI,mBAAmB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,MAA0B;IAC/E,2BAA2B;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,iDAAiD,UAAU,MAAM,MAAM,sEAAsE,UAAU,GAAG,CAC3J,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAExC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { CodedError, UnavailabilityError } from 'expo-modules-core';\n\nimport ExpoFontLoader from './ExpoFontLoader';\nimport { FontSource } from './Font.types';\nimport { getAssetForSource, loadSingleFontAsync } from './FontLoader';\n\n/**\n * @returns the server resources that should be statically extracted.\n * @private\n */\nexport function getServerResources(): string[] {\n if (!ExpoFontLoader.getServerResources) {\n throw new UnavailabilityError('expo-font', 'getServerResources');\n }\n return ExpoFontLoader.getServerResources();\n}\n\n/**\n * @returns clear the server resources from the global scope.\n * @private\n */\nexport function resetServerContext() {\n if (!ExpoFontLoader.resetServerContext) {\n throw new UnavailabilityError('expo-font', 'resetServerContext');\n }\n return ExpoFontLoader.resetServerContext();\n}\n\nexport function registerStaticFont(fontFamily: string, source?: FontSource | null) {\n // MUST BE A SYNC FUNCTION!\n if (!source) {\n throw new CodedError(\n `ERR_FONT_SOURCE`,\n `Cannot load null or undefined font source: { \"${fontFamily}\": ${source} }. Expected asset of type \\`FontSource\\` for fontFamily of name: \"${fontFamily}\"`\n );\n }\n const asset = getAssetForSource(source);\n\n loadSingleFontAsync(fontFamily, asset);\n}\n"]}

15
node_modules/expo-font/expo-module.config.json generated vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"platforms": ["apple", "android", "web"],
"apple": {
"modules": ["FontLoaderModule", "FontUtilsModule"]
},
"android": {
"modules": ["expo.modules.font.FontLoaderModule", "expo.modules.font.FontUtilsModule"],
"publication": {
"groupId": "host.exp.exponent",
"artifactId": "expo.modules.font",
"version": "55.0.4",
"repository": "local-maven-repo"
}
}
}

30
node_modules/expo-font/ios/ExpoFont.podspec generated vendored Normal file
View File

@@ -0,0 +1,30 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'ExpoFont'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platforms = {
:ios => '15.1',
:osx => '11.0',
:tvos => '15.1'
}
s.swift_version = '5.9'
s.source = { git: 'https://github.com/expo/expo.git' }
s.static_framework = true
s.dependency 'ExpoModulesCore'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES'
}
s.source_files = "**/*.{h,m,swift}"
end

50
node_modules/expo-font/ios/FontExceptions.swift generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import ExpoModulesCore
internal final class FontFileNotFoundException: GenericException<String> {
override var reason: String {
"Font file '\(param)' doesn't exist"
}
}
internal final class FontCreationFailedException: GenericException<String> {
override var reason: String {
"Could not create font from loaded data for '\(param)'"
}
}
internal final class FontNoPostScriptException: GenericException<String> {
override var reason: String {
"Could not create font '\(param)' from loaded data because it is missing the PostScript name"
}
}
internal struct FontRegistrationErrorInfo {
let fontFamilyAlias: String
let cfError: CFError
let ctFontManagerError: CTFontManagerError?
}
internal final class FontRegistrationFailedException: GenericException<FontRegistrationErrorInfo> {
override var reason: String {
let ctErrorDescription = "CTFontManagerError code: " + (param.ctFontManagerError.map { String($0.rawValue) } ?? "N/A")
return "Registering '\(param.fontFamilyAlias)' font failed with message: '\(param.cfError.localizedDescription)'. \(ctErrorDescription)"
}
}
internal final class UnregisteringFontFailedException: GenericException<CFError> {
override var reason: String {
"Unregistering font failed with message: '\(param.localizedDescription)'"
}
}
internal final class CreateImageException: Exception {
override var reason: String {
"Could not create image"
}
}
internal final class SaveImageException: GenericException<String> {
override var reason: String {
"Could not save image to '\(param)'"
}
}

View File

@@ -0,0 +1,72 @@
import ExpoModulesCore
/**
A registry of font family aliases mapped to their real font family names.
*/
private var fontFamilyAliases = [String: String]()
/**
A flag that is set to `true` when the ``UIFont.fontNames(forFamilyName:)`` is already swizzled.
*/
private var hasSwizzled = false
/**
Queue to protect shared resources
*/
private let queue = DispatchQueue(label: "expo.fontfamilyaliasmanager", attributes: .concurrent)
/**
Manages the font family aliases and swizzles the `UIFont` class.
*/
internal struct FontFamilyAliasManager {
/**
Whether the given alias has already been set.
*/
internal static func hasAlias(_ familyNameAlias: String) -> Bool {
return queue.sync {
fontFamilyAliases[familyNameAlias] != nil
}
}
/**
Sets the alias for the given family name.
If the alias has already been set, its family name will be overriden.
*/
internal static func setAlias(_ familyNameAlias: String, forFont font: String) {
maybeSwizzleUIFont()
queue.sync(flags: .barrier) {
fontFamilyAliases[familyNameAlias] = font
}
}
/**
Returns the family name for the given alias or `nil` when it's not set yet.
*/
internal static func familyName(forAlias familyNameAlias: String) -> String? {
return queue.sync {
fontFamilyAliases[familyNameAlias]
}
}
}
/**
Swizzles ``UIFont.fontNames(forFamilyName:)`` to support font family aliases.
This is necessary because the user provides a custom family name that is then used in stylesheets,
however the font usually has a different name encoded in the binary, thus the system may use a different name.
*/
private func maybeSwizzleUIFont() {
if hasSwizzled {
return
}
#if !os(macOS)
let originalFontNamesMethod = class_getClassMethod(UIFont.self, #selector(UIFont.fontNames(forFamilyName:)))
let newFontNamesMethod = class_getClassMethod(UIFont.self, #selector(UIFont._expo_fontNames(forFamilyName:)))
if let originalFontNamesMethod, let newFontNamesMethod {
method_exchangeImplementations(originalFontNamesMethod, newFontNamesMethod)
} else {
log.error("expo-font is unable to swizzle `UIFont.fontNames(forFamilyName:)`")
}
#endif
hasSwizzled = true
}

48
node_modules/expo-font/ios/FontLoaderModule.swift generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import ExpoModulesCore
public final class FontLoaderModule: Module {
// could be a Set, but to be able to pass to JS we keep it as an array
private lazy var registeredFonts: [String] = queryCustomNativeFonts()
public required init(appContext: AppContext) {
super.init(appContext: appContext)
}
public func definition() -> ModuleDefinition {
Name("ExpoFontLoader")
// NOTE: this is exposed in JS as globalThis.expo.modules.ExpoFontLoader.loadedFonts
// and potentially consumed outside of Expo (e.g. RN vector icons)
// do NOT change the property as it'll break consumers!
Function("getLoadedFonts") {
return registeredFonts
}
// NOTE: this is exposed in JS as globalThis.expo.modules.ExpoFontLoader.loadAsync
// and potentially consumed outside of Expo (e.g. RN vector icons)
// do NOT change the function signature as it'll break consumers!
AsyncFunction("loadAsync") { (fontFamilyAlias: String, localUri: URL) in
let fontUrl = localUri as CFURL
// If the font was already registered, unregister it first. Otherwise CTFontManagerRegisterFontsForURL
// would fail because of a duplicated font name when the app reloads or someone wants to override a font.
if FontFamilyAliasManager.familyName(forAlias: fontFamilyAlias) != nil {
guard try unregisterFont(url: fontUrl) else {
return
}
}
// Register the font
try registerFont(fontUrl: fontUrl, fontFamilyAlias: fontFamilyAlias)
// Create a font object from the given URL
let font = try loadFont(fromUrl: fontUrl, alias: fontFamilyAlias)
if let postScriptName = font.postScriptName as? String {
FontFamilyAliasManager.setAlias(fontFamilyAlias, forFont: postScriptName)
registeredFonts = Array(Set(registeredFonts).union([postScriptName, fontFamilyAlias]))
} else {
throw FontNoPostScriptException(fontFamilyAlias)
}
}
}
}

90
node_modules/expo-font/ios/FontUtils.swift generated vendored Normal file
View File

@@ -0,0 +1,90 @@
import CoreGraphics
/**
* Queries custom native font names from the Info.plist `UIAppFonts`.
*/
internal func queryCustomNativeFonts() -> [String] {
// [0] Read from main bundle's Info.plist
guard let fontFilePaths = Bundle.main.object(forInfoDictionaryKey: "UIAppFonts") as? [String] else {
return []
}
// [1] Get font family names for each font file
let fontFamilies: [[String]] = fontFilePaths.compactMap { fontFilePath in
guard let fontUrl = Bundle.main.url(forResource: fontFilePath, withExtension: nil) else {
return []
}
guard let fontDescriptors = CTFontManagerCreateFontDescriptorsFromURL(fontUrl as CFURL) as? [CTFontDescriptor] else {
return []
}
return fontDescriptors.compactMap { descriptor in
return CTFontDescriptorCopyAttribute(descriptor, kCTFontFamilyNameAttribute) as? String
}
}
// [2] Retrieve font names by family names
return fontFamilies.flatMap { fontFamilyNames in
return fontFamilyNames.flatMap { fontFamilyName in
#if os(iOS) || os(tvOS)
return UIFont.fontNames(forFamilyName: fontFamilyName)
#elseif os(macOS)
return NSFontManager.shared.availableMembers(ofFontFamily: fontFamilyName)?.compactMap { $0[0] as? String } ?? []
#endif
}
}
}
/**
Loads the font from the given url and returns it as ``CGFont``.
*/
internal func loadFont(fromUrl url: CFURL, alias: String) throws -> CGFont {
guard let provider = CGDataProvider(url: url),
let cgFont = CGFont(provider) else {
throw FontCreationFailedException(alias)
}
return cgFont
}
/**
Registers the given font to make it discoverable through font descriptor matching.
*/
internal func registerFont(fontUrl: CFURL, fontFamilyAlias: String) throws {
var error: Unmanaged<CFError>?
if !CTFontManagerRegisterFontsForURL(fontUrl, .process, &error), let error = error?.takeRetainedValue() {
let fontError = CTFontManagerError(rawValue: CFErrorGetCode(error))
switch fontError {
case .alreadyRegistered, .duplicatedName:
// Ignore the error if:
// - this exact font instance was already registered or
// - another instance already registered with the same name (assuming it's most likely the same font anyway)
return
default:
throw FontRegistrationFailedException(FontRegistrationErrorInfo(fontFamilyAlias: fontFamilyAlias, cfError: error, ctFontManagerError: fontError))
}
}
}
/**
Unregisters the given font, so the app will no longer be able to render it.
Returns a boolean indicating if the font is successfully unregistered after this function completes.
*/
internal func unregisterFont(url: CFURL) throws -> Bool {
var error: Unmanaged<CFError>?
if !CTFontManagerUnregisterFontsForURL(url, .process, &error), let error = error?.takeRetainedValue() {
if let ctFontManagerError = CTFontManagerError(rawValue: CFErrorGetCode(error as CFError)) {
switch ctFontManagerError {
case .systemRequired, .inUse:
return false
case .notRegistered:
return true
default:
throw UnregisteringFontFailedException(error)
}
}
}
return true
}

63
node_modules/expo-font/ios/FontUtilsModule.swift generated vendored Normal file
View File

@@ -0,0 +1,63 @@
// Copyright 2025-present 650 Industries. All rights reserved.
import ExpoModulesCore
public final class FontUtilsModule: Module {
public func definition() -> ModuleDefinition {
Name("ExpoFontUtils")
#if !os(macOS)
AsyncFunction("renderToImageAsync") { (glyphs: String, options: RenderToImageOptions, promise: Promise) throws in
let font = if let fontName = UIFont.fontNames(forFamilyName: options.fontFamily).first,
let uiFont = UIFont(name: fontName, size: options.size) {
uiFont
} else {
UIFont.systemFont(ofSize: options.size)
}
var attributes: [NSAttributedString.Key: Any] = [
.font: font,
.foregroundColor: UIColor(options.color)
]
if let lineHeight = options.lineHeight {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = lineHeight
paragraphStyle.maximumLineHeight = lineHeight
attributes[.paragraphStyle] = paragraphStyle
// Adding baseline offset to vertically center the text within the specified line height
attributes[.baselineOffset] = (lineHeight - font.lineHeight) / 2
}
let attributedString = NSAttributedString(
string: glyphs,
attributes: attributes
)
let renderer = UIGraphicsImageRenderer(size: attributedString.size())
let image = renderer.image { _ in
attributedString.draw(at: .zero)
}
guard let data = image.pngData() else {
promise.reject(CreateImageException())
return
}
let outputURL = URL(fileURLWithPath: "\(NSTemporaryDirectory())\(UUID().uuidString).png")
do {
try data.write(to: outputURL, options: .atomic)
promise.resolve([
"uri": outputURL.absoluteString,
"width": image.size.width,
"height": image.size.height,
"scale": UIScreen.main.scale
])
} catch {
promise.reject(SaveImageException(outputURL.absoluteString))
}
}
#endif
}
}

11
node_modules/expo-font/ios/FontUtilsRecords.swift generated vendored Normal file
View File

@@ -0,0 +1,11 @@
// Copyright 2025-present 650 Industries. All rights reserved.
import SwiftUI
import ExpoModulesCore
struct RenderToImageOptions: Record {
@Field var fontFamily: String = ""
@Field var lineHeight: CGFloat? = nil
@Field var size: CGFloat = 24
@Field var color: Color = .black
}

View File

@@ -0,0 +1,29 @@
#if !os(macOS)
/**
An extension to ``UIFont`` that adds a custom implementation of `fontNames(forFamilyName:)` that supports aliasing font families.
*/
public extension UIFont {
/**
Returns an array of font names for the specified family name or its alias.
*/
@objc
static dynamic func _expo_fontNames(forFamilyName familyName: String) -> [String] {
// Get font names from the original function.
let fontNames = UIFont._expo_fontNames(forFamilyName: familyName)
// If no font names were found, let's try with the alias.
if fontNames.isEmpty, let postScriptName = FontFamilyAliasManager.familyName(forAlias: familyName) {
let fontNames = UIFont._expo_fontNames(forFamilyName: postScriptName)
// If we still don't find any font names, we can assume it was not a family name but a font name.
// In that case we can safely return the original font name.
if fontNames.isEmpty {
return [postScriptName]
}
return fontNames
}
return fontNames
}
}
#endif

1
node_modules/expo-font/jest-rsc.config.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('jest-expo/rsc/jest-preset');

View File

@@ -0,0 +1 @@
3b8bd0fcb09b3557657d4827f8487e18

View File

@@ -0,0 +1 @@
06dd47add69225217039077506f35ba01c15f742

View File

@@ -0,0 +1 @@
57449a0d9ed2d42c7bbf535efb97dcab0e1a0108bc0a9f948d7724562c22e6ac

View File

@@ -0,0 +1 @@
6166146d780248c7b12e8332a8eb53d885bbd63e276ec842ec4103ba94aed4ba91bc84020addcd7ccf69371059750452800464274c5c96c5af5527a9bf3fad49

View File

@@ -0,0 +1 @@
34d57d26a286b3628c8c703d4777f2cd

View File

@@ -0,0 +1 @@
46d6d823da29741cdf5e772d85165adc4659da42

View File

@@ -0,0 +1 @@
1815b5d9441cf3f37567ed690cde6dd7f5e25e2b3196399d732b888038a5daf5

View File

@@ -0,0 +1 @@
ae29b090cd7ba6a1ddfac75b02f05204dec117f882406fd591cc52852b206058c9ab119e0b0d806bf6b9e1ccc553eaad74e6dc3bb7c106d55af56b01938a08cb

View File

@@ -0,0 +1,91 @@
{
"formatVersion": "1.1",
"component": {
"group": "host.exp.exponent",
"module": "expo.modules.font",
"version": "55.0.4",
"attributes": {
"org.gradle.status": "release"
}
},
"createdBy": {
"gradle": {
"version": "9.0.0"
}
},
"variants": [
{
"name": "releaseVariantReleaseApiPublication",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-api"
},
"files": [
{
"name": "expo.modules.font-55.0.4.aar",
"url": "expo.modules.font-55.0.4.aar",
"size": 24757,
"sha512": "ae29b090cd7ba6a1ddfac75b02f05204dec117f882406fd591cc52852b206058c9ab119e0b0d806bf6b9e1ccc553eaad74e6dc3bb7c106d55af56b01938a08cb",
"sha256": "1815b5d9441cf3f37567ed690cde6dd7f5e25e2b3196399d732b888038a5daf5",
"sha1": "46d6d823da29741cdf5e772d85165adc4659da42",
"md5": "34d57d26a286b3628c8c703d4777f2cd"
}
]
},
{
"name": "releaseVariantReleaseRuntimePublication",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-runtime"
},
"dependencies": [
{
"group": "org.jetbrains.kotlin",
"module": "kotlin-stdlib-jdk7",
"version": {
"requires": "2.1.20"
}
},
{
"group": "com.facebook.react",
"module": "react-android"
}
],
"files": [
{
"name": "expo.modules.font-55.0.4.aar",
"url": "expo.modules.font-55.0.4.aar",
"size": 24757,
"sha512": "ae29b090cd7ba6a1ddfac75b02f05204dec117f882406fd591cc52852b206058c9ab119e0b0d806bf6b9e1ccc553eaad74e6dc3bb7c106d55af56b01938a08cb",
"sha256": "1815b5d9441cf3f37567ed690cde6dd7f5e25e2b3196399d732b888038a5daf5",
"sha1": "46d6d823da29741cdf5e772d85165adc4659da42",
"md5": "34d57d26a286b3628c8c703d4777f2cd"
}
]
},
{
"name": "releaseVariantReleaseSourcePublication",
"attributes": {
"org.gradle.category": "documentation",
"org.gradle.dependency.bundling": "external",
"org.gradle.docstype": "sources",
"org.gradle.usage": "java-runtime"
},
"files": [
{
"name": "expo.modules.font-55.0.4-sources.jar",
"url": "expo.modules.font-55.0.4-sources.jar",
"size": 4110,
"sha512": "6166146d780248c7b12e8332a8eb53d885bbd63e276ec842ec4103ba94aed4ba91bc84020addcd7ccf69371059750452800464274c5c96c5af5527a9bf3fad49",
"sha256": "57449a0d9ed2d42c7bbf535efb97dcab0e1a0108bc0a9f948d7724562c22e6ac",
"sha1": "06dd47add69225217039077506f35ba01c15f742",
"md5": "3b8bd0fcb09b3557657d4827f8487e18"
}
]
}
]
}

View File

@@ -0,0 +1 @@
b243eac5c48afac01ad109b873fcddbe

View File

@@ -0,0 +1 @@
3bc6aa086a6b4ddbe1ad1da35893cb37b7e5a53c

View File

@@ -0,0 +1 @@
2ebdfc95382c09eba50ebbd1ad754dc098b0e40be7fa2afc4ee03621f593156c

View File

@@ -0,0 +1 @@
2235cba75c6648e719164c2f3f1b9d309a6123ec6e2f3b9802cf19742a0e1ef769117bb5787e62774d547cf9d3ef79c75901e036f56e86240ced7b572c30c147

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- This module was also published with a richer model, Gradle metadata, -->
<!-- which should be used instead. Do not delete the following line which -->
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
<!-- that they should prefer consuming it instead. -->
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>
<groupId>host.exp.exponent</groupId>
<artifactId>expo.modules.font</artifactId>
<version>55.0.4</version>
<packaging>aar</packaging>
<name>expo.modules.font</name>
<url>https://github.com/expo/expo</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/expo/expo/blob/main/LICENSE</url>
</license>
</licenses>
<scm>
<connection>https://github.com/expo/expo.git</connection>
<developerConnection>https://github.com/expo/expo.git</developerConnection>
<url>https://github.com/expo/expo</url>
</scm>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>2.1.20</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.facebook.react</groupId>
<artifactId>react-android</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1 @@
38b4861202512885959a485ed7133ded

View File

@@ -0,0 +1 @@
c90c2b98e6260c82d1889e2675841a9aafa520c1

View File

@@ -0,0 +1 @@
0130fb7b54b2962747f338df66ec26411cf727d2cabe871d32003265d35156e3

View File

@@ -0,0 +1 @@
6fa67f6cc41920faaf08de43dcce10f510148c07e76ac97fe75ec4eff40670258dea7a584ad8464349a8a629c75e8ac52efb26a39793b26abc4e50894728c8cf

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>host.exp.exponent</groupId>
<artifactId>expo.modules.font</artifactId>
<versioning>
<latest>55.0.4</latest>
<release>55.0.4</release>
<versions>
<version>55.0.4</version>
</versions>
<lastUpdated>20260216170142</lastUpdated>
</versioning>
</metadata>

Some files were not shown because too many files have changed in this diff Show More