expo-font 56.0.3 → 56.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/font/FontLoaderModule.kt +11 -6
- package/build/ExpoFontLoader.web.d.ts.map +1 -1
- package/build/ExpoFontLoader.web.js +5 -1
- package/build/ExpoFontLoader.web.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.3/expo.modules.font-56.0.3-sources.jar → 56.0.5/expo.modules.font-56.0.5-sources.jar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.3/expo.modules.font-56.0.3.module → 56.0.5/expo.modules.font-56.0.5.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.3/expo.modules.font-56.0.3.pom → 56.0.5/expo.modules.font-56.0.5.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha512 +1 -1
- package/package.json +4 -4
- package/plugin/build/withFontsAndroid.js +1 -1
- package/plugin/src/withFontsAndroid.ts +1 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/prebuilds/output/debug/xcframeworks/ExpoFont.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoFont.tar.gz +0 -0
- package/src/ExpoFontLoader.web.ts +9 -3
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.5 — 2026-05-19
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Sanitize values in web font loader and Android config plugin ([#45887](https://github.com/expo/expo/pull/45887) by [@kitten](https://github.com/kitten))
|
|
18
|
+
|
|
19
|
+
## 56.0.4 — 2026-05-15
|
|
20
|
+
|
|
21
|
+
### 🐛 Bug fixes
|
|
22
|
+
|
|
23
|
+
- [android] include xml-fonts in the `getLoadedFonts()` list ([#43860](https://github.com/expo/expo/pull/43860) by [@vonovak](https://github.com/vonovak))
|
|
24
|
+
|
|
13
25
|
## 56.0.3 — 2026-05-06
|
|
14
26
|
|
|
15
27
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -22,13 +22,16 @@ open class FontLoaderModule : Module() {
|
|
|
22
22
|
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
|
|
23
23
|
|
|
24
24
|
override fun definition() = ModuleDefinition {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var loadedFonts: List<String>? = null
|
|
26
|
+
|
|
27
|
+
fun getLoadedFonts(): List<String> {
|
|
28
|
+
return loadedFonts ?: queryCustomNativeFonts().also { loadedFonts = it }
|
|
29
|
+
}
|
|
27
30
|
|
|
28
31
|
Name("ExpoFontLoader")
|
|
29
32
|
|
|
30
33
|
Function("getLoadedFonts") {
|
|
31
|
-
return@Function
|
|
34
|
+
return@Function getLoadedFonts()
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
AsyncFunction("loadAsync") { fontFamilyName: String, localUri: String ->
|
|
@@ -54,7 +57,7 @@ open class FontLoaderModule : Module() {
|
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
ReactFontManager.getInstance().setTypeface(fontFamilyName, Typeface.NORMAL, typeface)
|
|
57
|
-
loadedFonts =
|
|
60
|
+
loadedFonts = getLoadedFonts().toMutableSet().apply { add(fontFamilyName) }.toList()
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -66,12 +69,14 @@ open class FontLoaderModule : Module() {
|
|
|
66
69
|
private fun queryCustomNativeFonts(): List<String> {
|
|
67
70
|
val assetManager = context.assets
|
|
68
71
|
val fontFileRegex = Regex("^(.+?)(_bold|_italic|_bold_italic)?\\.(ttf|otf)$")
|
|
72
|
+
val customFontFamilies = ReactFontManager.getInstance().customFontFamilies
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
val assetFonts = assetManager.list("fonts/")
|
|
71
75
|
?.mapNotNull { fileName ->
|
|
72
76
|
fontFileRegex.find(fileName)?.groupValues?.get(1)
|
|
73
77
|
}
|
|
74
|
-
?.filter { it.isNotBlank() }
|
|
75
78
|
.orEmpty()
|
|
79
|
+
|
|
80
|
+
return customFontFamilies.union(assetFonts).filter { it.isNotBlank() }
|
|
76
81
|
}
|
|
77
82
|
}
|
|
@@ -1 +1 @@
|
|
|
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,KAAK,YAAY,EAAqC,MAAM,cAAc,CAAC;AAsEjG,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,oBAAoB,CA0GlD,CAAC;wBAcyB,OAAO,cAAc;AAAhD,wBAAiD;
|
|
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,KAAK,YAAY,EAAqC,MAAM,cAAc,CAAC;AAsEjG,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,oBAAoB,CA0GlD,CAAC;wBAcyB,OAAO,cAAc;AAAhD,wBAAiD;AAiBjD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAQzF"}
|
|
@@ -165,8 +165,12 @@ function getStyleElement() {
|
|
|
165
165
|
styleElement.id = ID;
|
|
166
166
|
return styleElement;
|
|
167
167
|
}
|
|
168
|
+
const CSS_IDENT_RE = /^[a-zA-Z_-][\w-]*$/;
|
|
168
169
|
export function _createWebFontTemplate(fontFamily, resource) {
|
|
169
|
-
|
|
170
|
+
const display = typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)
|
|
171
|
+
? resource.display
|
|
172
|
+
: FontDisplay.AUTO;
|
|
173
|
+
return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(resource.uri)});font-display:${display}}`;
|
|
170
174
|
}
|
|
171
175
|
function _createWebStyle(fontFamily, resource) {
|
|
172
176
|
const fontStyle = _createWebFontTemplate(fontFamily, resource);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoFontLoader.web.js","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAwD,MAAM,cAAc,CAAC;AAEjG,SAAS,qBAAqB;IAC5B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;IACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,UAAU,CAAC,KAAuB,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAID,SAAS,gBAAgB;IACvB,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;IACtC,IAAI,KAAK,EAAE,CAAC;QACV,4BAA4B;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,Q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cAAc,GAAG,YAAmB,CAAC;QAC3C,cAAc,CAAC,UAAU,CAAC,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO;YACnE,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,GAAG,SAAS;YAC/C,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpD,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,8BAA8B;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IACvC,2EAA2E;IAC3E,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5E,iGAAiG;IACjG,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,oBAAoB;IACpB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["import { CodedError, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport type { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport type { UnloadFontOptions } from './Font';\nimport { FontDisplay, type FontResource, type ServerFontResourceDescriptor } from './Font.types';\n\nfunction getFontFaceStyleSheet(): CSSStyleSheet | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const styleSheet = getStyleElement();\n return styleSheet.sheet ? (styleSheet.sheet as CSSStyleSheet) : null;\n}\n\ntype RuleItem = { rule: CSSFontFaceRule; index: number };\n\nfunction getFontFaceRules(): RuleItem[] {\n const sheet = getFontFaceStyleSheet();\n if (sheet) {\n // @ts-ignore: rule iterator\n const rules = [...sheet.cssRules];\n\n const items: RuleItem[] = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule instanceof CSSFontFaceRule) {\n items.push({ rule, index: i });\n }\n }\n return items;\n }\n return [];\n}\n\nfunction getFontFaceRulesMatchingResource(\n fontFamilyName: string,\n options?: UnloadFontOptions\n): RuleItem[] {\n const rules = getFontFaceRules();\n return rules.filter(({ rule }) => {\n return (\n rule.style.fontFamily === fontFamilyName &&\n (options && options.display ? options.display === (rule.style as any).fontDisplay : true)\n );\n });\n}\n\nconst serverContext: Set<{ name: string; css: string; resourceId: string }> = new Set();\n\nfunction getServerResourceDescriptors(): ServerFontResourceDescriptor[] {\n const entries = [...serverContext.entries()];\n if (!entries.length) {\n return [];\n }\n const css = entries.map(([{ css }]) => css).join('\\n');\n const links = entries.map(([{ resourceId }]) => resourceId);\n // TODO: Maybe return nothing if no fonts were loaded.\n return [\n {\n css,\n id: ID,\n type: 'style' as const,\n },\n ...links.map((resourceId) => ({\n as: 'font' as const,\n crossOrigin: '' as const,\n href: resourceId,\n rel: 'preload' as const,\n type: 'link' as const,\n })),\n ];\n}\n\nconst ExpoFontLoader: Required<ExpoFontLoaderModule> = {\n async unloadAllAsync(): Promise<void> {\n if (typeof window === 'undefined') return;\n\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n document.removeChild(element);\n }\n },\n\n async unloadAsync(fontFamilyName: string, options?: UnloadFontOptions): Promise<void> {\n const sheet = getFontFaceStyleSheet();\n if (!sheet) return;\n const items = getFontFaceRulesMatchingResource(fontFamilyName, options);\n for (const item of items) {\n sheet.deleteRule(item.index);\n }\n },\n\n getServerResources(): string[] {\n const elements = getServerResourceDescriptors();\n\n return elements\n .map((element) => {\n switch (element.type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.css}</style>`;\n case 'link':\n return `<link rel=\"${element.rel}\" href=\"${element.href}\" as=\"${element.as}\" crossorigin=\"${element.crossOrigin}\" />`;\n default:\n return '';\n }\n })\n .filter(Boolean);\n },\n\n getServerResourceDescriptors() {\n return getServerResourceDescriptors();\n },\n\n resetServerContext() {\n serverContext.clear();\n },\n\n getLoadedFonts(): string[] {\n if (typeof window === 'undefined') {\n return [...serverContext.values()].map(({ name }) => name);\n }\n const rules = getFontFaceRules();\n return rules.map(({ rule }) => rule.style.fontFamily);\n },\n\n isLoaded(fontFamilyName: string, resource: UnloadFontOptions = {}): boolean {\n if (typeof window === 'undefined') {\n return !![...serverContext.values()].find((asset) => {\n return asset.name === fontFamilyName;\n });\n }\n return getFontFaceRulesMatchingResource(fontFamilyName, resource)?.length > 0;\n },\n\n // NOTE(vonovak): This is used in RN vector-icons to load fonts dynamically on web. Changing the signature is breaking.\n // NOTE(EvanBacon): No async keyword! This cannot return a promise in Node environments.\n loadAsync(fontFamilyName: string, resource: FontResource): Promise<void> {\n if (__DEV__ && typeof resource !== 'object') {\n // to help devving on web, where loadAsync interface is different from native\n throw new CodedError(\n 'ERR_FONT_SOURCE',\n `Expected font resource of type \\`object\\` instead got: ${typeof resource}`\n );\n }\n if (typeof window === 'undefined') {\n serverContext.add({\n name: fontFamilyName,\n css: _createWebFontTemplate(fontFamilyName, resource),\n // @ts-expect-error: typeof string\n resourceId: resource.uri!,\n });\n return Promise.resolve();\n }\n\n const canInjectStyle = document.head && typeof document.head.appendChild === 'function';\n if (!canInjectStyle) {\n throw new CodedError(\n 'ERR_WEB_ENVIRONMENT',\n `The browser's \\`document.head\\` element doesn't support injecting fonts.`\n );\n }\n\n const style = getStyleElement();\n document.head!.appendChild(style);\n\n const res = getFontFaceRulesMatchingResource(fontFamilyName, resource);\n if (!res.length) {\n _createWebStyle(fontFamilyName, resource);\n }\n\n if (!isFontLoadingListenerSupported()) {\n return Promise.resolve();\n }\n\n return new FontObserver(fontFamilyName, {\n // @ts-expect-error: TODO(@kitten): Typings indicate that the polyfill may not support this?\n display: resource.display,\n }).load(resource.testString ?? null, 12000);\n },\n};\n\nconst isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';\n\nfunction createExpoFontLoader() {\n return ExpoFontLoader;\n}\nconst toExport = isServer\n ? ExpoFontLoader\n : // @ts-expect-error: registerWebModule calls `new` on the module implementation.\n // Normally that'd be a class but that doesn't work on server, so we use a function instead.\n // TS doesn't like that but we don't need it to be a class.\n registerWebModule(createExpoFontLoader, 'ExpoFontLoader');\n\nexport default toExport as typeof ExpoFontLoader;\n\nconst ID = 'expo-generated-fonts';\n\nfunction getStyleElement(): HTMLStyleElement {\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n return element;\n }\n const styleElement = document.createElement('style');\n styleElement.id = ID;\n\n return styleElement;\n}\n\nexport function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {\n return `@font-face{font-family:\"${fontFamily}\";src:url(\"${resource.uri}\");font-display:${\n resource.display || FontDisplay.AUTO\n }}`;\n}\n\nfunction _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {\n const fontStyle = _createWebFontTemplate(fontFamily, resource);\n\n const styleElement = getStyleElement();\n // @ts-ignore: TypeScript does not define HTMLStyleElement::styleSheet. This is just for IE and\n // possibly can be removed if it's unnecessary on IE 11.\n if (styleElement.styleSheet) {\n const styleElementIE = styleElement as any;\n styleElementIE.styleSheet.cssText = styleElementIE.styleSheet.cssText\n ? styleElementIE.styleSheet.cssText + fontStyle\n : fontStyle;\n } else {\n const textNode = document.createTextNode(fontStyle);\n styleElement.appendChild(textNode);\n }\n return styleElement;\n}\n\nfunction isFontLoadingListenerSupported(): boolean {\n const { userAgent } = window.navigator;\n // WebKit is broken https://github.com/bramstein/fontfaceobserver/issues/95\n const isIOS = !!userAgent.match(/iPad|iPhone/i);\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n // Edge is broken https://github.com/bramstein/fontfaceobserver/issues/109#issuecomment-333356795\n const isEdge = userAgent.includes('Edge');\n // Internet Explorer\n const isIE = userAgent.includes('Trident');\n return !isSafari && !isIOS && !isEdge && !isIE;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoFontLoader.web.js","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAwD,MAAM,cAAc,CAAC;AAEjG,SAAS,qBAAqB;IAC5B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;IACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,UAAU,CAAC,KAAuB,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAID,SAAS,gBAAgB;IACvB,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;IACtC,IAAI,KAAK,EAAE,CAAC;QACV,4BAA4B;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAElC,MAAM,KAAK,GAAe,EAAE,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;gBACpC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,gCAAgC,CACvC,cAAs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;SAAM,CAAC;QACN,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpD,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,8BAA8B;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IACvC,2EAA2E;IAC3E,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5E,iGAAiG;IACjG,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,oBAAoB;IACpB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["import { CodedError, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport type { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport type { UnloadFontOptions } from './Font';\nimport { FontDisplay, type FontResource, type ServerFontResourceDescriptor } from './Font.types';\n\nfunction getFontFaceStyleSheet(): CSSStyleSheet | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const styleSheet = getStyleElement();\n return styleSheet.sheet ? (styleSheet.sheet as CSSStyleSheet) : null;\n}\n\ntype RuleItem = { rule: CSSFontFaceRule; index: number };\n\nfunction getFontFaceRules(): RuleItem[] {\n const sheet = getFontFaceStyleSheet();\n if (sheet) {\n // @ts-ignore: rule iterator\n const rules = [...sheet.cssRules];\n\n const items: RuleItem[] = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule instanceof CSSFontFaceRule) {\n items.push({ rule, index: i });\n }\n }\n return items;\n }\n return [];\n}\n\nfunction getFontFaceRulesMatchingResource(\n fontFamilyName: string,\n options?: UnloadFontOptions\n): RuleItem[] {\n const rules = getFontFaceRules();\n return rules.filter(({ rule }) => {\n return (\n rule.style.fontFamily === fontFamilyName &&\n (options && options.display ? options.display === (rule.style as any).fontDisplay : true)\n );\n });\n}\n\nconst serverContext: Set<{ name: string; css: string; resourceId: string }> = new Set();\n\nfunction getServerResourceDescriptors(): ServerFontResourceDescriptor[] {\n const entries = [...serverContext.entries()];\n if (!entries.length) {\n return [];\n }\n const css = entries.map(([{ css }]) => css).join('\\n');\n const links = entries.map(([{ resourceId }]) => resourceId);\n // TODO: Maybe return nothing if no fonts were loaded.\n return [\n {\n css,\n id: ID,\n type: 'style' as const,\n },\n ...links.map((resourceId) => ({\n as: 'font' as const,\n crossOrigin: '' as const,\n href: resourceId,\n rel: 'preload' as const,\n type: 'link' as const,\n })),\n ];\n}\n\nconst ExpoFontLoader: Required<ExpoFontLoaderModule> = {\n async unloadAllAsync(): Promise<void> {\n if (typeof window === 'undefined') return;\n\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n document.removeChild(element);\n }\n },\n\n async unloadAsync(fontFamilyName: string, options?: UnloadFontOptions): Promise<void> {\n const sheet = getFontFaceStyleSheet();\n if (!sheet) return;\n const items = getFontFaceRulesMatchingResource(fontFamilyName, options);\n for (const item of items) {\n sheet.deleteRule(item.index);\n }\n },\n\n getServerResources(): string[] {\n const elements = getServerResourceDescriptors();\n\n return elements\n .map((element) => {\n switch (element.type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.css}</style>`;\n case 'link':\n return `<link rel=\"${element.rel}\" href=\"${element.href}\" as=\"${element.as}\" crossorigin=\"${element.crossOrigin}\" />`;\n default:\n return '';\n }\n })\n .filter(Boolean);\n },\n\n getServerResourceDescriptors() {\n return getServerResourceDescriptors();\n },\n\n resetServerContext() {\n serverContext.clear();\n },\n\n getLoadedFonts(): string[] {\n if (typeof window === 'undefined') {\n return [...serverContext.values()].map(({ name }) => name);\n }\n const rules = getFontFaceRules();\n return rules.map(({ rule }) => rule.style.fontFamily);\n },\n\n isLoaded(fontFamilyName: string, resource: UnloadFontOptions = {}): boolean {\n if (typeof window === 'undefined') {\n return !![...serverContext.values()].find((asset) => {\n return asset.name === fontFamilyName;\n });\n }\n return getFontFaceRulesMatchingResource(fontFamilyName, resource)?.length > 0;\n },\n\n // NOTE(vonovak): This is used in RN vector-icons to load fonts dynamically on web. Changing the signature is breaking.\n // NOTE(EvanBacon): No async keyword! This cannot return a promise in Node environments.\n loadAsync(fontFamilyName: string, resource: FontResource): Promise<void> {\n if (__DEV__ && typeof resource !== 'object') {\n // to help devving on web, where loadAsync interface is different from native\n throw new CodedError(\n 'ERR_FONT_SOURCE',\n `Expected font resource of type \\`object\\` instead got: ${typeof resource}`\n );\n }\n if (typeof window === 'undefined') {\n serverContext.add({\n name: fontFamilyName,\n css: _createWebFontTemplate(fontFamilyName, resource),\n // @ts-expect-error: typeof string\n resourceId: resource.uri!,\n });\n return Promise.resolve();\n }\n\n const canInjectStyle = document.head && typeof document.head.appendChild === 'function';\n if (!canInjectStyle) {\n throw new CodedError(\n 'ERR_WEB_ENVIRONMENT',\n `The browser's \\`document.head\\` element doesn't support injecting fonts.`\n );\n }\n\n const style = getStyleElement();\n document.head!.appendChild(style);\n\n const res = getFontFaceRulesMatchingResource(fontFamilyName, resource);\n if (!res.length) {\n _createWebStyle(fontFamilyName, resource);\n }\n\n if (!isFontLoadingListenerSupported()) {\n return Promise.resolve();\n }\n\n return new FontObserver(fontFamilyName, {\n // @ts-expect-error: TODO(@kitten): Typings indicate that the polyfill may not support this?\n display: resource.display,\n }).load(resource.testString ?? null, 12000);\n },\n};\n\nconst isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';\n\nfunction createExpoFontLoader() {\n return ExpoFontLoader;\n}\nconst toExport = isServer\n ? ExpoFontLoader\n : // @ts-expect-error: registerWebModule calls `new` on the module implementation.\n // Normally that'd be a class but that doesn't work on server, so we use a function instead.\n // TS doesn't like that but we don't need it to be a class.\n registerWebModule(createExpoFontLoader, 'ExpoFontLoader');\n\nexport default toExport as typeof ExpoFontLoader;\n\nconst ID = 'expo-generated-fonts';\n\nfunction getStyleElement(): HTMLStyleElement {\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n return element;\n }\n const styleElement = document.createElement('style');\n styleElement.id = ID;\n\n return styleElement;\n}\n\nconst CSS_IDENT_RE = /^[a-zA-Z_-][\\w-]*$/;\n\nexport function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {\n const display =\n typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)\n ? resource.display\n : FontDisplay.AUTO;\n return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(\n resource.uri\n )});font-display:${display}}`;\n}\n\nfunction _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {\n const fontStyle = _createWebFontTemplate(fontFamily, resource);\n\n const styleElement = getStyleElement();\n // @ts-ignore: TypeScript does not define HTMLStyleElement::styleSheet. This is just for IE and\n // possibly can be removed if it's unnecessary on IE 11.\n if (styleElement.styleSheet) {\n const styleElementIE = styleElement as any;\n styleElementIE.styleSheet.cssText = styleElementIE.styleSheet.cssText\n ? styleElementIE.styleSheet.cssText + fontStyle\n : fontStyle;\n } else {\n const textNode = document.createTextNode(fontStyle);\n styleElement.appendChild(textNode);\n }\n return styleElement;\n}\n\nfunction isFontLoadingListenerSupported(): boolean {\n const { userAgent } = window.navigator;\n // WebKit is broken https://github.com/bramstein/fontfaceobserver/issues/95\n const isIOS = !!userAgent.match(/iPad|iPhone/i);\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n // Edge is broken https://github.com/bramstein/fontfaceobserver/issues/109#issuecomment-333356795\n const isEdge = userAgent.includes('Edge');\n // Internet Explorer\n const isIE = userAgent.includes('Trident');\n return !isSafari && !isIOS && !isEdge && !isIE;\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
63ef1824563284a8ea1d55302b68a3a5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2d3a69f03341b6061aaf25ae2eb2e5e44e2fdacc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
87a25fe7ac775341198279e739706b7594f5a863da55f215422209e737e5562f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
99aeb8a7c324e889d4140890af18771545c97a69e128bf6a3fb2e70f3ddde11ec292c4d8e3b6470f0c7d0db50db21b782e1382767807899c9b1faf4552f0d41d
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar
ADDED
|
Binary file
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
da93e2606379f644a84bc11ff6d556aa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fdbabf0bc0ff373a82455dd35dac3f173ddf7bc5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d7ea73905f045bfec5b9c40172b9b29f327d7a80a0bf05389d12966d157a1430
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
27cd5270fb4a9e9c93cecfde8eb7521dea8ba1d6ff2523d2512ecdafa7a58b68c5c1e07c331f3c6bc16af18f8289d55bd01ace60feca7af8aaa2f6e9f3b487e1
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.font",
|
|
6
|
-
"version": "56.0.
|
|
6
|
+
"version": "56.0.5",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.font-56.0.
|
|
28
|
-
"url": "expo.modules.font-56.0.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.font-56.0.5.aar",
|
|
28
|
+
"url": "expo.modules.font-56.0.5.aar",
|
|
29
|
+
"size": 29409,
|
|
30
|
+
"sha512": "27cd5270fb4a9e9c93cecfde8eb7521dea8ba1d6ff2523d2512ecdafa7a58b68c5c1e07c331f3c6bc16af18f8289d55bd01ace60feca7af8aaa2f6e9f3b487e1",
|
|
31
|
+
"sha256": "d7ea73905f045bfec5b9c40172b9b29f327d7a80a0bf05389d12966d157a1430",
|
|
32
|
+
"sha1": "fdbabf0bc0ff373a82455dd35dac3f173ddf7bc5",
|
|
33
|
+
"md5": "da93e2606379f644a84bc11ff6d556aa"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
],
|
|
72
72
|
"files": [
|
|
73
73
|
{
|
|
74
|
-
"name": "expo.modules.font-56.0.
|
|
75
|
-
"url": "expo.modules.font-56.0.
|
|
76
|
-
"size":
|
|
77
|
-
"sha512": "
|
|
78
|
-
"sha256": "
|
|
79
|
-
"sha1": "
|
|
80
|
-
"md5": "
|
|
74
|
+
"name": "expo.modules.font-56.0.5.aar",
|
|
75
|
+
"url": "expo.modules.font-56.0.5.aar",
|
|
76
|
+
"size": 29409,
|
|
77
|
+
"sha512": "27cd5270fb4a9e9c93cecfde8eb7521dea8ba1d6ff2523d2512ecdafa7a58b68c5c1e07c331f3c6bc16af18f8289d55bd01ace60feca7af8aaa2f6e9f3b487e1",
|
|
78
|
+
"sha256": "d7ea73905f045bfec5b9c40172b9b29f327d7a80a0bf05389d12966d157a1430",
|
|
79
|
+
"sha1": "fdbabf0bc0ff373a82455dd35dac3f173ddf7bc5",
|
|
80
|
+
"md5": "da93e2606379f644a84bc11ff6d556aa"
|
|
81
81
|
}
|
|
82
82
|
]
|
|
83
83
|
},
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
},
|
|
92
92
|
"files": [
|
|
93
93
|
{
|
|
94
|
-
"name": "expo.modules.font-56.0.
|
|
95
|
-
"url": "expo.modules.font-56.0.
|
|
96
|
-
"size":
|
|
97
|
-
"sha512": "
|
|
98
|
-
"sha256": "
|
|
99
|
-
"sha1": "
|
|
100
|
-
"md5": "
|
|
94
|
+
"name": "expo.modules.font-56.0.5-sources.jar",
|
|
95
|
+
"url": "expo.modules.font-56.0.5-sources.jar",
|
|
96
|
+
"size": 4135,
|
|
97
|
+
"sha512": "99aeb8a7c324e889d4140890af18771545c97a69e128bf6a3fb2e70f3ddde11ec292c4d8e3b6470f0c7d0db50db21b782e1382767807899c9b1faf4552f0d41d",
|
|
98
|
+
"sha256": "87a25fe7ac775341198279e739706b7594f5a863da55f215422209e737e5562f",
|
|
99
|
+
"sha1": "2d3a69f03341b6061aaf25ae2eb2e5e44e2fdacc",
|
|
100
|
+
"md5": "63ef1824563284a8ea1d55302b68a3a5"
|
|
101
101
|
}
|
|
102
102
|
]
|
|
103
103
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0b47355fd3f734630f45aa75ceec22a6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e77c2f9647ea10a977dc6cbdc5bcb2f75e7ba9ca
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
852aee4a5076e83ca2a9fd6ef8f7e77f1fa0da727ba6d4e52de1445f7e87acc4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
134928d04fbb971bfe94310d7efffea17de3df27aa3305f9f421823874b2b44b83e9af869fff002c57ff0a1b5f4e5c9c27f97c4934bc06cdde3e7d80ab1f8dfd
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.font</artifactId>
|
|
12
|
-
<version>56.0.
|
|
12
|
+
<version>56.0.5</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.font</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
83c26737720e75ac9e099cb14e248e12
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1b51c324da92ee60f1827239c1061b896d09d44f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
be4a9b40b90c536f9f695e06164c2f1280f8bd2973c8027a815e3ae6ae5f6da3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
920cc244cf00cc45711304ca1ab4000478937362e30189e72fe965f70bb3560ee50d12aa3b590f842d12adea4c407c5947612c489cd50d8f30849b2ec30e3c7a
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.font</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>56.0.
|
|
7
|
-
<release>56.0.
|
|
6
|
+
<latest>56.0.5</latest>
|
|
7
|
+
<release>56.0.5</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>56.0.
|
|
9
|
+
<version>56.0.5</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260519105305</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
331c1994f4958bd2a937a5d3c1572b55
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3ae7b1be88a8ef248b9ce306c251c934d35368df
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5c7661b6631139856c42e6b5da33b5e94be99f4069700b276f955b7756f7f18f
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
946a300aa3126f3bbd7d058dc298a93b9a1fddba29f3ad75d34067aac62cd819a0db902e64d9b8aecc9e1b162ee171698d5a3ed00cbc97b66eeef8f0cb80dede
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-font",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.5",
|
|
4
4
|
"description": "Load fonts at runtime and use them in React Native components.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@types/fontfaceobserver": "^2.1.3",
|
|
44
44
|
"@types/node": "^22.14.0",
|
|
45
45
|
"@types/react": "~19.2.0",
|
|
46
|
-
"expo": "56.0.0-preview.
|
|
47
|
-
"expo-module-scripts": "56.0.
|
|
46
|
+
"expo": "56.0.0-preview.13",
|
|
47
|
+
"expo-module-scripts": "56.0.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"expo": "*",
|
|
51
51
|
"react": "*",
|
|
52
52
|
"react-native": "*"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "290368bc41026449a05a4ebf991b85c3a2fb0e3a",
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "expo-module build",
|
|
57
57
|
"clean": "expo-module clean",
|
|
@@ -106,7 +106,7 @@ function addFontXmlToMainApplication(config, xmlFontObjects) {
|
|
|
106
106
|
function generateFontManagerCalls(xmlFontObjects, language) {
|
|
107
107
|
const lineEnding = language === 'java' ? ';' : '';
|
|
108
108
|
const indent = ' ';
|
|
109
|
-
return Object.keys(xmlFontObjects).map((family) => `${indent}ReactFontManager.getInstance().addCustomFont(this,
|
|
109
|
+
return Object.keys(xmlFontObjects).map((family) => `${indent}ReactFontManager.getInstance().addCustomFont(this, ${JSON.stringify(family)}, R.font.${resourceNameConflictAvoidancePrefix + (0, utils_1.toValidAndroidResourceName)(family)})${lineEnding}`);
|
|
110
110
|
}
|
|
111
111
|
function copyFontsToDir(config, paths, inAppDestination, filenameProcessor = (filenameWithExt) => filenameWithExt) {
|
|
112
112
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
@@ -145,7 +145,7 @@ export function generateFontManagerCalls(
|
|
|
145
145
|
|
|
146
146
|
return Object.keys(xmlFontObjects).map(
|
|
147
147
|
(family) =>
|
|
148
|
-
`${indent}ReactFontManager.getInstance().addCustomFont(this,
|
|
148
|
+
`${indent}ReactFontManager.getInstance().addCustomFont(this, ${JSON.stringify(family)}, R.font.${resourceNameConflictAvoidancePrefix + toValidAndroidResourceName(family)})${lineEnding}`
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/utils.ts","./src/withfonts.ts","./src/withfontsandroid.ts","./src/withfontsios.ts"],"version":"5.9.
|
|
1
|
+
{"root":["./src/index.ts","./src/utils.ts","./src/withfonts.ts","./src/withfontsandroid.ts","./src/withfontsios.ts"],"version":"5.9.3"}
|
|
Binary file
|
|
Binary file
|
|
@@ -208,10 +208,16 @@ function getStyleElement(): HTMLStyleElement {
|
|
|
208
208
|
return styleElement;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
const CSS_IDENT_RE = /^[a-zA-Z_-][\w-]*$/;
|
|
212
|
+
|
|
211
213
|
export function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {
|
|
212
|
-
|
|
213
|
-
resource.display
|
|
214
|
-
|
|
214
|
+
const display =
|
|
215
|
+
typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)
|
|
216
|
+
? resource.display
|
|
217
|
+
: FontDisplay.AUTO;
|
|
218
|
+
return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(
|
|
219
|
+
resource.uri
|
|
220
|
+
)});font-display:${display}}`;
|
|
215
221
|
}
|
|
216
222
|
|
|
217
223
|
function _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
110f7f08e8e619c6d506b12b3101c923
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
5302c1179c61b0f47fe832fdd662d2ca7309be1a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ca2d9e7d4d4f3439057b0e150d58e34195b03fe01fd6561e1cec0d4e27785178
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dda4bfe6c7768cfaeb84191e5b5d4b54182d30cb07d138c7902d1d2594d3f85156c54865a9f505f3176aa4d69586dac7183dba113a9611c40d83c7f9850e2517
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar
DELETED
|
Binary file
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
457117881e6d7e345ae7f8f8ba4f06e7
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1aee8837d06817119914045d67f0ded6c6ef87d4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
025ffed46db52f034adfc39583afc2544e2d160782731816157b221016c62753
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f21118ad99fae544dacf105a2ee02ef2d8367a677ae244f2f40154f67c458ea3b210f4611cd99b6235d026e08190cddfad0b8e52ed91aeb94db52969e6c01044
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
43f69324c38b0c391a53d732ab762c18
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
177e9e0a2f100e639f25f1a5c2bc784da2a6f8e5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
91b88ff78afbee9b7ec38948228d8556876fc5cd60a1705eb1c18bc262d93ca4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
45a979ad52e89862b653547f1f7ed8fb34e453a852f11b540cb16c8fb43ea3717c71deb49560a1ad157c7fb87efe33779bd04c03ed06ccc8d284e29d34a23529
|
package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.3/expo.modules.font-56.0.3.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
aab8d9cdbf17700cc28e3d64708c9dba
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
69b039026a9572b81da9a9d9233893618f7ac221
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3561e755c5ff5a6b3a9d13defe0d5e1eb5cd56c79351c2da56ef7d5e2046f859
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
633c33eeb95153b7327aff3eb2a94abeeae25cb89f3d6cb9cce752f2f8340ff75d050c927df386ca5b266005ddbc75438d7cb32f12a73e550c064af21b81026f
|