expo-font 14.0.3 → 14.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/android/build.gradle +2 -2
  3. package/build/ExpoFontLoader.web.d.ts +4 -6
  4. package/build/ExpoFontLoader.web.d.ts.map +1 -1
  5. package/build/ExpoFontLoader.web.js +4 -4
  6. package/build/ExpoFontLoader.web.js.map +1 -1
  7. package/expo-module.config.json +1 -1
  8. package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.module → 14.0.4/expo.modules.font-14.0.4.module} +7 -7
  9. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.module.md5 +1 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.module.sha1 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.module.sha256 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.module.sha512 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.pom → 14.0.4/expo.modules.font-14.0.4.pom} +1 -1
  14. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.pom.md5 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.pom.sha1 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.pom.sha256 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.4/expo.modules.font-14.0.4.pom.sha512 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml +4 -4
  19. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.md5 +1 -1
  20. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha1 +1 -1
  21. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha256 +1 -1
  22. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha512 +1 -1
  23. package/package.json +3 -3
  24. package/src/ExpoFontLoader.web.ts +6 -6
  25. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.module.md5 +0 -1
  26. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.module.sha1 +0 -1
  27. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.module.sha256 +0 -1
  28. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.module.sha512 +0 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.pom.md5 +0 -1
  30. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.pom.sha1 +0 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.pom.sha256 +0 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.font/14.0.3/expo.modules.font-14.0.3.pom.sha512 +0 -1
  33. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3-sources.jar → 14.0.4/expo.modules.font-14.0.4-sources.jar} +0 -0
  34. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3-sources.jar.md5 → 14.0.4/expo.modules.font-14.0.4-sources.jar.md5} +0 -0
  35. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3-sources.jar.sha1 → 14.0.4/expo.modules.font-14.0.4-sources.jar.sha1} +0 -0
  36. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3-sources.jar.sha256 → 14.0.4/expo.modules.font-14.0.4-sources.jar.sha256} +0 -0
  37. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3-sources.jar.sha512 → 14.0.4/expo.modules.font-14.0.4-sources.jar.sha512} +0 -0
  38. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.aar → 14.0.4/expo.modules.font-14.0.4.aar} +0 -0
  39. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.aar.md5 → 14.0.4/expo.modules.font-14.0.4.aar.md5} +0 -0
  40. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.aar.sha1 → 14.0.4/expo.modules.font-14.0.4.aar.sha1} +0 -0
  41. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.aar.sha256 → 14.0.4/expo.modules.font-14.0.4.aar.sha256} +0 -0
  42. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{14.0.3/expo.modules.font-14.0.3.aar.sha512 → 14.0.4/expo.modules.font-14.0.4.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 14.0.4 — 2025-08-26
14
+
15
+ ### 💡 Others
16
+
17
+ - Fix types and adjust platform checks. ([#37302](https://github.com/expo/expo/pull/37302) by [@EvanBacon](https://github.com/EvanBacon))
18
+
13
19
  ## 14.0.3 — 2025-08-25
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '14.0.3'
7
+ version = '14.0.4'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.font"
11
11
  defaultConfig {
12
12
  versionCode 29
13
- versionName "14.0.3"
13
+ versionName "14.0.4"
14
14
  }
15
15
  }
16
16
 
@@ -1,9 +1,7 @@
1
- import { ExpoFontLoaderModule } from './ExpoFontLoader';
1
+ import type { ExpoFontLoaderModule } from './ExpoFontLoader';
2
2
  import { FontResource } from './Font.types';
3
- declare const toExport: Required<ExpoFontLoaderModule> | {
4
- new (): import("expo-modules-core/build/ts-declarations/NativeModule").NativeModule<Record<never, never>>;
5
- new (object: import("expo-modules-core/build/ts-declarations/EventEmitter").EventEmitter): import("expo-modules-core/build/ts-declarations/NativeModule").NativeModule<Record<never, never>>;
6
- };
7
- export default toExport;
3
+ declare const ExpoFontLoader: Required<ExpoFontLoaderModule>;
4
+ declare const _default: typeof ExpoFontLoader;
5
+ export default _default;
8
6
  export declare function _createWebFontTemplate(fontFamily: string, resource: FontResource): string;
9
7
  //# sourceMappingURL=ExpoFontLoader.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFontLoader.web.d.ts","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AA6LzD,QAAA,MAAM,QAAQ;;;CAK+C,CAAC;AAE9D,eAAe,QAAQ,CAAC;AAexB,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAIzF"}
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"}
@@ -1,8 +1,8 @@
1
- import { CodedError, Platform, registerWebModule } from 'expo-modules-core';
1
+ import { CodedError, registerWebModule } from 'expo-modules-core';
2
2
  import FontObserver from 'fontfaceobserver';
3
3
  import { FontDisplay } from './Font.types';
4
4
  function getFontFaceStyleSheet() {
5
- if (!Platform.isDOMAvailable) {
5
+ if (typeof window === 'undefined') {
6
6
  return null;
7
7
  }
8
8
  const styleSheet = getStyleElement();
@@ -58,7 +58,7 @@ function getHeadElements() {
58
58
  }
59
59
  const ExpoFontLoader = {
60
60
  async unloadAllAsync() {
61
- if (!Platform.isDOMAvailable)
61
+ if (typeof window === 'undefined')
62
62
  return;
63
63
  const element = document.getElementById(ID);
64
64
  if (element && element instanceof HTMLStyleElement) {
@@ -142,7 +142,7 @@ const ExpoFontLoader = {
142
142
  }).load(null, 6000);
143
143
  },
144
144
  };
145
- const isServer = Platform.OS === 'web' && typeof window === 'undefined';
145
+ const isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';
146
146
  function createExpoFontLoader() {
147
147
  return ExpoFontLoader;
148
148
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFontLoader.web.js","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAgB,MAAM,cAAc,CAAC;AAEzD,SAAS,qBAAqB;IAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC7B,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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A+F;IAC/F,wDAAwD;IACxD,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,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,UAAU;IACV,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC;AAC/D,CAAC","sourcesContent":["import { CodedError, Platform, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport { UnloadFontOptions } from './Font';\nimport { FontDisplay, FontResource } from './Font.types';\n\nfunction getFontFaceStyleSheet(): CSSStyleSheet | null {\n if (!Platform.isDOMAvailable) {\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 getHeadElements(): {\n $$type: string;\n rel?: string;\n href?: string;\n as?: string;\n crossorigin?: string;\n children?: string;\n id?: string;\n type?: string;\n}[] {\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 $$type: 'style',\n children: css,\n id: ID,\n type: 'text/css',\n },\n ...links.map((resourceId) => ({\n $$type: 'link',\n rel: 'preload',\n href: resourceId,\n as: 'font',\n crossorigin: '',\n })),\n ];\n}\n\nconst ExpoFontLoader: Required<ExpoFontLoaderModule> = {\n async unloadAllAsync(): Promise<void> {\n if (!Platform.isDOMAvailable) 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 = getHeadElements();\n\n return elements\n .map((element) => {\n switch (element.$$type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.children}</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 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(null, 6000);\n },\n};\n\nconst isServer = Platform.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;\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 // Firefox\n const isFirefox = userAgent.includes('Firefox');\n return !isSafari && !isIOS && !isEdge && !isIE && !isFirefox;\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,EAAgB,MAAM,cAAc,CAAC;AAEzD,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,CA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C;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,UAAU;IACV,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC;AAC/D,CAAC","sourcesContent":["import { CodedError, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport type { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport { UnloadFontOptions } from './Font';\nimport { FontDisplay, FontResource } 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 getHeadElements(): {\n $$type: string;\n rel?: string;\n href?: string;\n as?: string;\n crossorigin?: string;\n children?: string;\n id?: string;\n type?: string;\n}[] {\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 $$type: 'style',\n children: css,\n id: ID,\n type: 'text/css',\n },\n ...links.map((resourceId) => ({\n $$type: 'link',\n rel: 'preload',\n href: resourceId,\n as: 'font',\n crossorigin: '',\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 = getHeadElements();\n\n return elements\n .map((element) => {\n switch (element.$$type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.children}</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 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(null, 6000);\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 // Firefox\n const isFirefox = userAgent.includes('Firefox');\n return !isSafari && !isIOS && !isEdge && !isIE && !isFirefox;\n}\n"]}
@@ -8,7 +8,7 @@
8
8
  "publication": {
9
9
  "groupId": "host.exp.exponent",
10
10
  "artifactId": "expo.modules.font",
11
- "version": "14.0.3",
11
+ "version": "14.0.4",
12
12
  "repository": "local-maven-repo"
13
13
  }
14
14
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.font",
6
- "version": "14.0.3",
6
+ "version": "14.0.4",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.font-14.0.3.aar",
28
- "url": "expo.modules.font-14.0.3.aar",
27
+ "name": "expo.modules.font-14.0.4.aar",
28
+ "url": "expo.modules.font-14.0.4.aar",
29
29
  "size": 23898,
30
30
  "sha512": "6d7719c52520db8192d98350f1a5accab0ed6d30b5232c127e8cf64f1f42cafc54aba97531423f172a39c3beda38e643d1bb4b11d12ae974ba3e050a257a7bec",
31
31
  "sha256": "4ffb592fd95cbae524f5982a303b8bfe2d7ddb353b063e7c7ae4bc39e9f1dda6",
@@ -57,8 +57,8 @@
57
57
  ],
58
58
  "files": [
59
59
  {
60
- "name": "expo.modules.font-14.0.3.aar",
61
- "url": "expo.modules.font-14.0.3.aar",
60
+ "name": "expo.modules.font-14.0.4.aar",
61
+ "url": "expo.modules.font-14.0.4.aar",
62
62
  "size": 23898,
63
63
  "sha512": "6d7719c52520db8192d98350f1a5accab0ed6d30b5232c127e8cf64f1f42cafc54aba97531423f172a39c3beda38e643d1bb4b11d12ae974ba3e050a257a7bec",
64
64
  "sha256": "4ffb592fd95cbae524f5982a303b8bfe2d7ddb353b063e7c7ae4bc39e9f1dda6",
@@ -77,8 +77,8 @@
77
77
  },
78
78
  "files": [
79
79
  {
80
- "name": "expo.modules.font-14.0.3-sources.jar",
81
- "url": "expo.modules.font-14.0.3-sources.jar",
80
+ "name": "expo.modules.font-14.0.4-sources.jar",
81
+ "url": "expo.modules.font-14.0.4-sources.jar",
82
82
  "size": 3716,
83
83
  "sha512": "2c8069f25ea086e76885e4a9ba803bb5e62c8f82140d35dd34be3774aa083db6239e024b2cc4f7b1b7d0587c7bf9d022dcd6cbd5e4bfa403df27ee452ece90f9",
84
84
  "sha256": "3082716e01b1aa6412301809f3a30add410f19cbc7ce8a4a3535bf7f575712a4",
@@ -0,0 +1 @@
1
+ 97b3a42028ac6847b59a253ab1ac9ec0007aeb02adaf60c32ceb953d9e4c0a77
@@ -0,0 +1 @@
1
+ 80ed069a40b330357c705da18a7360d2b935a387077e473626cee2361c91ec719db5b74827427ce7d451dacf8baf545994982ba28470ab4b245f4dc6237bfcd6
@@ -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>14.0.3</version>
12
+ <version>14.0.4</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.font</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 0637c8eb0ff3091aad52e6c114c2439bfd841f22
@@ -0,0 +1 @@
1
+ 749b97d819fb1e2b8edb8a47c91124a0f70d3476703a430a8a807992243f9760
@@ -0,0 +1 @@
1
+ 95aebba94d2b5791dbc387c450213a2c8601488757e676cdf781cc7ff794be6434e5c4cc07fcdff06ef69f55592c59b585b49eada13b89e7f7c61aa902ec214d
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.font</artifactId>
5
5
  <versioning>
6
- <latest>14.0.3</latest>
7
- <release>14.0.3</release>
6
+ <latest>14.0.4</latest>
7
+ <release>14.0.4</release>
8
8
  <versions>
9
- <version>14.0.3</version>
9
+ <version>14.0.4</version>
10
10
  </versions>
11
- <lastUpdated>20250825161903</lastUpdated>
11
+ <lastUpdated>20250826172803</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 8678dd76a88e7de793e7d61f7b575589
1
+ e53e7515032ec3459b21b17ac3b6caab
@@ -1 +1 @@
1
- daf0ca09c9324ed403ee06fdda84443528d9a4d8
1
+ c53270d1aaed0334cf887d6ac78d98dd2ebddb32
@@ -1 +1 @@
1
- 2d0dafbf92ab8bb8b2e53ca3e231cdde6e4bc6903b0b4e97180f1df607ca7d57
1
+ 998e2d970ef7f8ad0b5b443385f0f1f63de16e2369a70d4c73bd6c7900466396
@@ -1 +1 @@
1
- b542e1610fad6204249ba6007ee0b3ac12c20637bc2a130c6bc3b9a20008adf4800746f7e9d1a1d70577d55c044d7bab5d74177d216a7bc3fc810a1723b38fd5
1
+ cb4a220567f912aed8b5caf20f4681d422bc3f7f6429c6753d85abcc8f72b8be0027e2e15d272e3c15237c4e73851142be876e13df98fcea92245b2061207504
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-font",
3
- "version": "14.0.3",
3
+ "version": "14.0.4",
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",
@@ -52,12 +52,12 @@
52
52
  "devDependencies": {
53
53
  "@testing-library/react-native": "^13.2.0",
54
54
  "@types/fontfaceobserver": "^2.1.3",
55
- "expo-module-scripts": "^5.0.3"
55
+ "expo-module-scripts": "^5.0.4"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "expo": "*",
59
59
  "react": "*",
60
60
  "react-native": "*"
61
61
  },
62
- "gitHead": "ef0b9ecf9645d3e93587d5ee5030dbfcbf735bbd"
62
+ "gitHead": "d44e41c9c0714a838b1652556d27bcb506fabbdf"
63
63
  }
@@ -1,12 +1,12 @@
1
- import { CodedError, Platform, registerWebModule } from 'expo-modules-core';
1
+ import { CodedError, registerWebModule } from 'expo-modules-core';
2
2
  import FontObserver from 'fontfaceobserver';
3
3
 
4
- import { ExpoFontLoaderModule } from './ExpoFontLoader';
4
+ import type { ExpoFontLoaderModule } from './ExpoFontLoader';
5
5
  import { UnloadFontOptions } from './Font';
6
6
  import { FontDisplay, FontResource } from './Font.types';
7
7
 
8
8
  function getFontFaceStyleSheet(): CSSStyleSheet | null {
9
- if (!Platform.isDOMAvailable) {
9
+ if (typeof window === 'undefined') {
10
10
  return null;
11
11
  }
12
12
  const styleSheet = getStyleElement();
@@ -85,7 +85,7 @@ function getHeadElements(): {
85
85
 
86
86
  const ExpoFontLoader: Required<ExpoFontLoaderModule> = {
87
87
  async unloadAllAsync(): Promise<void> {
88
- if (!Platform.isDOMAvailable) return;
88
+ if (typeof window === 'undefined') return;
89
89
 
90
90
  const element = document.getElementById(ID);
91
91
  if (element && element instanceof HTMLStyleElement) {
@@ -187,7 +187,7 @@ const ExpoFontLoader: Required<ExpoFontLoaderModule> = {
187
187
  },
188
188
  };
189
189
 
190
- const isServer = Platform.OS === 'web' && typeof window === 'undefined';
190
+ const isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';
191
191
 
192
192
  function createExpoFontLoader() {
193
193
  return ExpoFontLoader;
@@ -199,7 +199,7 @@ const toExport = isServer
199
199
  // TS doesn't like that but we don't need it to be a class.
200
200
  registerWebModule(createExpoFontLoader, 'ExpoFontLoader');
201
201
 
202
- export default toExport;
202
+ export default toExport as typeof ExpoFontLoader;
203
203
 
204
204
  const ID = 'expo-generated-fonts';
205
205
 
@@ -1 +0,0 @@
1
- 7d5858040f0279acb8acc6e48db4be07b5447129
@@ -1 +0,0 @@
1
- 40f1b1a3d09cba8308fa7383ea400bd515ae05dcc0e7d7810e45c7b725c267e5
@@ -1 +0,0 @@
1
- 9ad63b6e9e66e8aac62a760f2591c36b216f9e9035fb240c03428ce8e7af2d58d07935d7cab327f1982a59a4ac25ed3fd63989d1967d43ebe0b9199292e94434
@@ -1 +0,0 @@
1
- a20b822a4579e7b0f0aa1f7e7086ce7db28320e9
@@ -1 +0,0 @@
1
- 2cc6723e1153cb483a7523a0249c1e7113245434cf8416744382af61b6559ca7
@@ -1 +0,0 @@
1
- b54d4f2544d0cd7f52df712f2a2117eb5b36452a5c43945a02b1a7e78e9b8449df9fb74204d452194f0c21c14adb3d3134a3d3cdaadb8d44ec2a52b07c5f85e0