@yahoo/uds-mobile 2.24.0-beta.8 → 2.24.0-beta.9
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/README.md +1 -0
- package/dist/components/Avatar/useAvatarFontScale.cjs +2 -2
- package/dist/components/Avatar/useAvatarFontScale.js +3 -3
- package/dist/components/Avatar/useAvatarFontScale.js.map +1 -1
- package/dist/components/Button.cjs +4 -3
- package/dist/components/Button.js +5 -4
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +2 -2
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +1 -1
- package/dist/components/Chip/ChipBase.js +2 -2
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Icon.cjs +6 -5
- package/dist/components/Icon.d.cts +2 -0
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +2 -0
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +7 -6
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.cjs +1 -1
- package/dist/components/IconButton.js +2 -2
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/Input.cjs +3 -1
- package/dist/components/Input.js +4 -2
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +1 -0
- package/dist/components/InputHelpText.js +1 -0
- package/dist/components/InputHelpText.js.map +1 -1
- package/dist/components/Link.cjs +4 -2
- package/dist/components/Link.js +5 -3
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.cjs +1 -1
- package/dist/components/Pagination/PaginationEllipsis.js +2 -2
- package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.cjs +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.js +2 -2
- package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.js +2 -2
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Select/Select.cjs +2 -0
- package/dist/components/Select/Select.js +2 -0
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectItem.cjs +1 -4
- package/dist/components/Select/SelectItem.d.cts.map +1 -1
- package/dist/components/Select/SelectItem.d.ts.map +1 -1
- package/dist/components/Select/SelectItem.js +2 -5
- package/dist/components/Select/SelectItem.js.map +1 -1
- package/dist/components/Select/SelectTrigger.cjs +1 -4
- package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +2 -5
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Switch.cjs +2 -2
- package/dist/components/Switch.js +3 -3
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +1 -1
- package/dist/components/Tabs/Tab.js +2 -2
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Text.cjs +1 -1
- package/dist/components/Text.js +2 -2
- package/dist/components/Text.js.map +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +14 -3
- package/dist/fontScaling/FontScalingContext.d.cts +8 -2
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -1
- package/dist/fontScaling/FontScalingContext.d.ts +8 -2
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -1
- package/dist/fontScaling/FontScalingContext.js +14 -4
- package/dist/fontScaling/FontScalingContext.js.map +1 -1
- package/dist/fontScaling/androidNonlinearFontScaling.cjs +85 -9
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts +2 -2
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -1
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts +2 -2
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -1
- package/dist/fontScaling/androidNonlinearFontScaling.js +85 -9
- package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -1
- package/dist/fontScaling/useFontScale.cjs +18 -5
- package/dist/fontScaling/useFontScale.d.cts +6 -18
- package/dist/fontScaling/useFontScale.d.cts.map +1 -1
- package/dist/fontScaling/useFontScale.d.ts +6 -18
- package/dist/fontScaling/useFontScale.d.ts.map +1 -1
- package/dist/fontScaling/useFontScale.js +18 -6
- package/dist/fontScaling/useFontScale.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +530 -530
- package/dist/mobile/generated/fontMetrics.js +530 -530
- package/dist/mobile/generated/fontMetrics.js.map +1 -1
- package/fonts/index.cjs +214 -214
- package/fonts/index.mjs +214 -214
- package/generated/fontMetrics.ts +530 -530
- package/package.json +1 -1
|
@@ -26,20 +26,33 @@ function getFontScale() {
|
|
|
26
26
|
* Pass the SP size that the geometry accompanies on Android so this mirrors
|
|
27
27
|
* Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy
|
|
28
28
|
* scalar behavior for custom callers that do not know their base size.
|
|
29
|
+
* On iOS this follows the global text-size curve; accompanying text should
|
|
30
|
+
* omit `dynamicTypeRamp` so its native size uses the same multiplier.
|
|
29
31
|
*
|
|
30
32
|
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
31
33
|
* components re-render solely when the user changes the OS text size.
|
|
32
34
|
* Returns 1 when the nearest font-scaling provider has `enabled: false`.
|
|
33
35
|
*/
|
|
34
|
-
function
|
|
36
|
+
function useFontScaleValue(cap, fontSize, honorResolvedComponentOverride = false) {
|
|
35
37
|
const enabled = require_fontScaling_FontScalingContext.useFontScalingEnabled();
|
|
36
38
|
const fontScale = (0, react.useSyncExternalStore)(subscribe, getFontScale, getFontScale);
|
|
37
|
-
if (!enabled) return 1;
|
|
39
|
+
if (!enabled && !honorResolvedComponentOverride) return 1;
|
|
38
40
|
const effectiveCap = typeof cap === "number" && cap >= 1 ? cap : Number.POSITIVE_INFINITY;
|
|
39
|
-
const cappedFontScale = Math.min(fontScale, effectiveCap);
|
|
40
41
|
const platformVersion = Number(react_native.Platform.Version);
|
|
41
|
-
const nativeScale = react_native.Platform.OS === "android" && platformVersion >= 34 && typeof fontSize === "number" && fontSize > 0 ? require_fontScaling_androidNonlinearFontScaling.convertAndroidSpToDp(fontSize,
|
|
42
|
-
return Math.max(1, nativeScale);
|
|
42
|
+
const nativeScale = react_native.Platform.OS === "android" && platformVersion >= 34 && typeof fontSize === "number" && fontSize > 0 ? require_fontScaling_androidNonlinearFontScaling.convertAndroidSpToDp(fontSize, fontScale, platformVersion) / fontSize : fontScale;
|
|
43
|
+
return Math.max(1, Math.min(nativeScale, effectiveCap));
|
|
44
|
+
}
|
|
45
|
+
function useFontScale(cap, fontSize) {
|
|
46
|
+
return useFontScaleValue(cap, fontSize);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Internal component path. A resolved cap is defined under rollback mode only
|
|
50
|
+
* when it came from an explicit component prop, which the public contract says
|
|
51
|
+
* must continue to apply.
|
|
52
|
+
*/
|
|
53
|
+
function useComponentFontScale(cap, fontSize) {
|
|
54
|
+
return useFontScaleValue(cap, fontSize, cap !== void 0);
|
|
43
55
|
}
|
|
44
56
|
//#endregion
|
|
57
|
+
exports.useComponentFontScale = useComponentFontScale;
|
|
45
58
|
exports.useFontScale = useFontScale;
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/fontScaling/useFontScale.d.ts
|
|
3
|
+
declare function useFontScale(cap?: number | null, fontSize?: number): number;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
9
|
-
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
10
|
-
* is never below 1 so containers never shrink under their token metrics
|
|
11
|
-
* (font scales < 1 shrink text only, as today).
|
|
12
|
-
*
|
|
13
|
-
* Pass the SP size that the geometry accompanies on Android so this mirrors
|
|
14
|
-
* Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy
|
|
15
|
-
* scalar behavior for custom callers that do not know their base size.
|
|
16
|
-
*
|
|
17
|
-
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
18
|
-
* components re-render solely when the user changes the OS text size.
|
|
19
|
-
* Returns 1 when the nearest font-scaling provider has `enabled: false`.
|
|
5
|
+
* Internal component path. A resolved cap is defined under rollback mode only
|
|
6
|
+
* when it came from an explicit component prop, which the public contract says
|
|
7
|
+
* must continue to apply.
|
|
20
8
|
*/
|
|
21
|
-
declare function
|
|
9
|
+
declare function useComponentFontScale(cap?: number | null, fontSize?: number): number;
|
|
22
10
|
//#endregion
|
|
23
|
-
export { useFontScale };
|
|
11
|
+
export { useComponentFontScale, useFontScale };
|
|
24
12
|
//# sourceMappingURL=useFontScale.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFontScale.d.cts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFontScale.d.cts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":";;iBA+DS,YAAA,CAAa,GAAA,kBAAqB,QAAA;;;;;;iBASlC,qBAAA,CAAsB,GAAA,kBAAqB,QAAA"}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/fontScaling/useFontScale.d.ts
|
|
3
|
+
declare function useFontScale(cap?: number | null, fontSize?: number): number;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
9
|
-
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
10
|
-
* is never below 1 so containers never shrink under their token metrics
|
|
11
|
-
* (font scales < 1 shrink text only, as today).
|
|
12
|
-
*
|
|
13
|
-
* Pass the SP size that the geometry accompanies on Android so this mirrors
|
|
14
|
-
* Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy
|
|
15
|
-
* scalar behavior for custom callers that do not know their base size.
|
|
16
|
-
*
|
|
17
|
-
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
18
|
-
* components re-render solely when the user changes the OS text size.
|
|
19
|
-
* Returns 1 when the nearest font-scaling provider has `enabled: false`.
|
|
5
|
+
* Internal component path. A resolved cap is defined under rollback mode only
|
|
6
|
+
* when it came from an explicit component prop, which the public contract says
|
|
7
|
+
* must continue to apply.
|
|
20
8
|
*/
|
|
21
|
-
declare function
|
|
9
|
+
declare function useComponentFontScale(cap?: number | null, fontSize?: number): number;
|
|
22
10
|
//#endregion
|
|
23
|
-
export { useFontScale };
|
|
11
|
+
export { useComponentFontScale, useFontScale };
|
|
24
12
|
//# sourceMappingURL=useFontScale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFontScale.d.ts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFontScale.d.ts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":";;iBA+DS,YAAA,CAAa,GAAA,kBAAqB,QAAA;;;;;;iBASlC,qBAAA,CAAsB,GAAA,kBAAqB,QAAA"}
|
|
@@ -24,22 +24,34 @@ function getFontScale() {
|
|
|
24
24
|
* Pass the SP size that the geometry accompanies on Android so this mirrors
|
|
25
25
|
* Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy
|
|
26
26
|
* scalar behavior for custom callers that do not know their base size.
|
|
27
|
+
* On iOS this follows the global text-size curve; accompanying text should
|
|
28
|
+
* omit `dynamicTypeRamp` so its native size uses the same multiplier.
|
|
27
29
|
*
|
|
28
30
|
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
29
31
|
* components re-render solely when the user changes the OS text size.
|
|
30
32
|
* Returns 1 when the nearest font-scaling provider has `enabled: false`.
|
|
31
33
|
*/
|
|
32
|
-
function
|
|
34
|
+
function useFontScaleValue(cap, fontSize, honorResolvedComponentOverride = false) {
|
|
33
35
|
const enabled = useFontScalingEnabled();
|
|
34
36
|
const fontScale = useSyncExternalStore(subscribe, getFontScale, getFontScale);
|
|
35
|
-
if (!enabled) return 1;
|
|
37
|
+
if (!enabled && !honorResolvedComponentOverride) return 1;
|
|
36
38
|
const effectiveCap = typeof cap === "number" && cap >= 1 ? cap : Number.POSITIVE_INFINITY;
|
|
37
|
-
const cappedFontScale = Math.min(fontScale, effectiveCap);
|
|
38
39
|
const platformVersion = Number(Platform.Version);
|
|
39
|
-
const nativeScale = Platform.OS === "android" && platformVersion >= 34 && typeof fontSize === "number" && fontSize > 0 ? convertAndroidSpToDp(fontSize,
|
|
40
|
-
return Math.max(1, nativeScale);
|
|
40
|
+
const nativeScale = Platform.OS === "android" && platformVersion >= 34 && typeof fontSize === "number" && fontSize > 0 ? convertAndroidSpToDp(fontSize, fontScale, platformVersion) / fontSize : fontScale;
|
|
41
|
+
return Math.max(1, Math.min(nativeScale, effectiveCap));
|
|
42
|
+
}
|
|
43
|
+
function useFontScale(cap, fontSize) {
|
|
44
|
+
return useFontScaleValue(cap, fontSize);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Internal component path. A resolved cap is defined under rollback mode only
|
|
48
|
+
* when it came from an explicit component prop, which the public contract says
|
|
49
|
+
* must continue to apply.
|
|
50
|
+
*/
|
|
51
|
+
function useComponentFontScale(cap, fontSize) {
|
|
52
|
+
return useFontScaleValue(cap, fontSize, cap !== void 0);
|
|
41
53
|
}
|
|
42
54
|
//#endregion
|
|
43
|
-
export { useFontScale };
|
|
55
|
+
export { useComponentFontScale, useFontScale };
|
|
44
56
|
|
|
45
57
|
//# sourceMappingURL=useFontScale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFontScale.js","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\nimport { Dimensions, Platform } from 'react-native';\n\nimport { convertAndroidSpToDp } from './androidNonlinearFontScaling';\nimport { useFontScalingEnabled } from './FontScalingContext';\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const subscription = Dimensions.addEventListener('change', onStoreChange);\n return () => subscription.remove();\n}\n\n// Unistyles' rt.fontScale is stale when the OS text size changes while the\n// app is running; Dimensions reflects the live value on both platforms.\nfunction getFontScale(): number {\n return Dimensions.get('window').fontScale;\n}\n\n/**\n * The effective scale for `fontSize`, clamped to `[1, cap]`, for sizing\n * containers around scaled text (e.g. a checkbox box growing with its\n * checkmark).\n *\n * `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1\n * caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result\n * is never below 1 so containers never shrink under their token metrics\n * (font scales < 1 shrink text only, as today).\n *\n * Pass the SP size that the geometry accompanies on Android so this mirrors\n * Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy\n * scalar behavior for custom callers that do not know their base size.\n *\n * Subscribes to font-scale changes only — rotation does not re-render, and\n * components re-render solely when the user changes the OS text size.\n * Returns 1 when the nearest font-scaling provider has `enabled: false`.\n */\nfunction
|
|
1
|
+
{"version":3,"file":"useFontScale.js","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\nimport { Dimensions, Platform } from 'react-native';\n\nimport { convertAndroidSpToDp } from './androidNonlinearFontScaling';\nimport { useFontScalingEnabled } from './FontScalingContext';\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const subscription = Dimensions.addEventListener('change', onStoreChange);\n return () => subscription.remove();\n}\n\n// Unistyles' rt.fontScale is stale when the OS text size changes while the\n// app is running; Dimensions reflects the live value on both platforms.\nfunction getFontScale(): number {\n return Dimensions.get('window').fontScale;\n}\n\n/**\n * The effective scale for `fontSize`, clamped to `[1, cap]`, for sizing\n * containers around scaled text (e.g. a checkbox box growing with its\n * checkmark).\n *\n * `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1\n * caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result\n * is never below 1 so containers never shrink under their token metrics\n * (font scales < 1 shrink text only, as today).\n *\n * Pass the SP size that the geometry accompanies on Android so this mirrors\n * Android 14+'s nonlinear scaling. Omitting `fontSize` preserves the legacy\n * scalar behavior for custom callers that do not know their base size.\n * On iOS this follows the global text-size curve; accompanying text should\n * omit `dynamicTypeRamp` so its native size uses the same multiplier.\n *\n * Subscribes to font-scale changes only — rotation does not re-render, and\n * components re-render solely when the user changes the OS text size.\n * Returns 1 when the nearest font-scaling provider has `enabled: false`.\n */\nfunction useFontScaleValue(\n cap?: number | null,\n fontSize?: number,\n honorResolvedComponentOverride = false,\n): number {\n const enabled = useFontScalingEnabled();\n const fontScale = useSyncExternalStore(subscribe, getFontScale, getFontScale);\n if (!enabled && !honorResolvedComponentOverride) {\n return 1;\n }\n\n const effectiveCap = typeof cap === 'number' && cap >= 1 ? cap : Number.POSITIVE_INFINITY;\n const platformVersion = Number(Platform.Version);\n const nativeScale =\n Platform.OS === 'android' &&\n platformVersion >= 34 &&\n typeof fontSize === 'number' &&\n fontSize > 0\n ? convertAndroidSpToDp(fontSize, fontScale, platformVersion) / fontSize\n : fontScale;\n\n // React Native applies maxFontSizeMultiplier after the platform conversion.\n // This matters on Android 14+, where the converted size is nonlinear.\n return Math.max(1, Math.min(nativeScale, effectiveCap));\n}\n\nfunction useFontScale(cap?: number | null, fontSize?: number): number {\n return useFontScaleValue(cap, fontSize);\n}\n\n/**\n * Internal component path. A resolved cap is defined under rollback mode only\n * when it came from an explicit component prop, which the public contract says\n * must continue to apply.\n */\nfunction useComponentFontScale(cap?: number | null, fontSize?: number): number {\n return useFontScaleValue(cap, fontSize, cap !== undefined);\n}\n\nexport { useComponentFontScale, useFontScale };\n"],"mappings":";;;;;;AAMA,SAAS,UAAU,eAAuC;CACxD,MAAM,eAAe,WAAW,iBAAiB,UAAU,cAAc;CACzE,aAAa,aAAa,QAAQ;;AAKpC,SAAS,eAAuB;CAC9B,OAAO,WAAW,IAAI,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuBlC,SAAS,kBACP,KACA,UACA,iCAAiC,OACzB;CACR,MAAM,UAAU,uBAAuB;CACvC,MAAM,YAAY,qBAAqB,WAAW,cAAc,aAAa;CAC7E,IAAI,CAAC,WAAW,CAAC,gCACf,OAAO;CAGT,MAAM,eAAe,OAAO,QAAQ,YAAY,OAAO,IAAI,MAAM,OAAO;CACxE,MAAM,kBAAkB,OAAO,SAAS,QAAQ;CAChD,MAAM,cACJ,SAAS,OAAO,aAChB,mBAAmB,MACnB,OAAO,aAAa,YACpB,WAAW,IACP,qBAAqB,UAAU,WAAW,gBAAgB,GAAG,WAC7D;CAIN,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,aAAa,aAAa,CAAC;;AAGzD,SAAS,aAAa,KAAqB,UAA2B;CACpE,OAAO,kBAAkB,KAAK,SAAS;;;;;;;AAQzC,SAAS,sBAAsB,KAAqB,UAA2B;CAC7E,OAAO,kBAAkB,KAAK,UAAU,QAAQ,KAAA,EAAU"}
|