@yahoo/uds-mobile 2.23.2 → 2.24.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -12
- package/dist/bin/automated-config/dist/generated/generatedConfigs.mjs +92 -46
- package/dist/components/Button/buttonTheme.cjs +63 -23
- package/dist/components/Button/buttonTheme.d.cts +29 -12
- package/dist/components/Button/buttonTheme.d.cts.map +1 -1
- package/dist/components/Button/buttonTheme.d.ts +29 -12
- package/dist/components/Button/buttonTheme.d.ts.map +1 -1
- package/dist/components/Button/buttonTheme.js +62 -23
- package/dist/components/Button/buttonTheme.js.map +1 -1
- package/dist/components/Button.cjs +34 -13
- package/dist/components/Button.d.cts +7 -0
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.ts +7 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +34 -13
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +30 -7
- package/dist/components/Checkbox.d.cts +7 -0
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +30 -7
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +23 -9
- package/dist/components/Chip/ChipBase.d.cts.map +1 -1
- package/dist/components/Chip/ChipBase.d.ts.map +1 -1
- package/dist/components/Chip/ChipBase.js +23 -9
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Chip/ChipDismissible.cjs +3 -1
- package/dist/components/Chip/ChipDismissible.js +3 -1
- package/dist/components/Chip/ChipDismissible.js.map +1 -1
- package/dist/components/Chip/types.d.cts +7 -0
- package/dist/components/Chip/types.d.cts.map +1 -1
- package/dist/components/Chip/types.d.ts +7 -0
- package/dist/components/Chip/types.d.ts.map +1 -1
- package/dist/components/Icon.cjs +7 -3
- package/dist/components/Icon.d.cts +9 -1
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +9 -1
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +7 -3
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.cjs +18 -8
- package/dist/components/IconButton.js +18 -8
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +29 -11
- package/dist/components/Radio/Radio.d.cts +7 -0
- package/dist/components/Radio/Radio.d.cts.map +1 -1
- package/dist/components/Radio/Radio.d.ts +7 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +29 -11
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Switch.cjs +25 -2
- package/dist/components/Switch.d.cts +7 -0
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts +7 -0
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +25 -2
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +12 -2
- package/dist/components/Tabs/Tab.d.cts.map +1 -1
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +12 -2
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs +8 -3
- package/dist/components/Tabs/Tabs.d.cts +9 -1
- package/dist/components/Tabs/Tabs.d.cts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +9 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +8 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.cts +2 -0
- package/dist/components/Tabs/tabsContexts.d.cts.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.ts +2 -0
- package/dist/components/Tabs/tabsContexts.d.ts.map +1 -1
- package/dist/components/Tabs/tabsContexts.js.map +1 -1
- package/dist/components/Text.cjs +4 -1
- package/dist/components/Text.d.cts +10 -2
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +10 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +4 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.cjs +6 -2
- package/dist/components/UDSProvider.d.cts +8 -0
- package/dist/components/UDSProvider.d.cts.map +1 -1
- package/dist/components/UDSProvider.d.ts +8 -0
- package/dist/components/UDSProvider.d.ts.map +1 -1
- package/dist/components/UDSProvider.js +6 -2
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +35 -0
- package/dist/fontScaling/FontScalingContext.d.cts +38 -0
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -0
- package/dist/fontScaling/FontScalingContext.d.ts +38 -0
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -0
- package/dist/fontScaling/FontScalingContext.js +34 -0
- package/dist/fontScaling/FontScalingContext.js.map +1 -0
- package/dist/fontScaling/constants.cjs +72 -0
- package/dist/fontScaling/constants.d.cts +49 -0
- package/dist/fontScaling/constants.d.cts.map +1 -0
- package/dist/fontScaling/constants.d.ts +49 -0
- package/dist/fontScaling/constants.d.ts.map +1 -0
- package/dist/fontScaling/constants.js +70 -0
- package/dist/fontScaling/constants.js.map +1 -0
- package/dist/fontScaling/index.cjs +13 -0
- package/dist/fontScaling/index.d.cts +8 -0
- package/dist/fontScaling/index.d.ts +8 -0
- package/dist/fontScaling/index.js +6 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +38 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +36 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +36 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +39 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -0
- package/dist/fontScaling/types.cjs +1 -0
- package/dist/fontScaling/types.d.cts +51 -0
- package/dist/fontScaling/types.d.cts.map +1 -0
- package/dist/fontScaling/types.d.ts +51 -0
- package/dist/fontScaling/types.d.ts.map +1 -0
- package/dist/fontScaling/types.js +1 -0
- package/dist/fontScaling/useFontScale.cjs +32 -0
- package/dist/fontScaling/useFontScale.d.cts +18 -0
- package/dist/fontScaling/useFontScale.d.cts.map +1 -0
- package/dist/fontScaling/useFontScale.d.ts +18 -0
- package/dist/fontScaling/useFontScale.d.ts.map +1 -0
- package/dist/fontScaling/useFontScale.js +32 -0
- package/dist/fontScaling/useFontScale.js.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.cjs +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js.map +1 -0
- package/dist/jest/mocks/react-native.cjs +19 -4
- package/dist/jest/mocks/react-native.d.cts +8 -5
- package/dist/jest/mocks/react-native.d.cts.map +1 -1
- package/dist/jest/mocks/react-native.d.ts +8 -5
- package/dist/jest/mocks/react-native.d.ts.map +1 -1
- package/dist/jest/mocks/react-native.js +18 -5
- package/dist/jest/mocks/react-native.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +14 -0
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +14 -0
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/setup.cjs +4 -0
- package/dist/jest/setup.d.cts.map +1 -1
- package/dist/jest/setup.d.ts.map +1 -1
- package/dist/jest/setup.js +4 -0
- package/dist/jest/setup.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +1166 -0
- package/dist/mobile/generated/fontMetrics.js +1168 -0
- package/dist/mobile/generated/fontMetrics.js.map +1 -0
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/uds-icons.ttf +0 -0
- package/generated/fontMetrics.ts +1173 -0
- package/generated/styles.d.ts +5 -28
- package/generated/unistyles.d.ts +0 -27
- package/package.json +11 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
import { FontScalingConfig } from "./types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.d.ts
|
|
6
|
+
interface ResolveMaxFontSizeMultiplierOptions {
|
|
7
|
+
/** Explicit component prop. `null` = force-uncap. Wins over everything. */
|
|
8
|
+
explicit?: number | null;
|
|
9
|
+
/** Provider config, if any provider is mounted. */
|
|
10
|
+
config?: FontScalingConfig;
|
|
11
|
+
/**
|
|
12
|
+
* The text's resolved variant, `'control'` for control-internal text/icons,
|
|
13
|
+
* or `undefined` for `variant="inherit"` text (no variant opinion — nested
|
|
14
|
+
* text inherits its parent's cap natively).
|
|
15
|
+
*/
|
|
16
|
+
variant?: TextVariant | 'control';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
20
|
+
*
|
|
21
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
22
|
+
* entry, then `default`) > built-in default table.
|
|
23
|
+
*
|
|
24
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
25
|
+
* global) when nothing applies — including for built-in uncapped variants, so
|
|
26
|
+
* body text nested inside capped text still inherits the parent's cap. Only an
|
|
27
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
28
|
+
*/
|
|
29
|
+
declare function resolveMaxFontSizeMultiplier({
|
|
30
|
+
explicit,
|
|
31
|
+
config,
|
|
32
|
+
variant
|
|
33
|
+
}: ResolveMaxFontSizeMultiplierOptions): number | undefined;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type ResolveMaxFontSizeMultiplierOptions, resolveMaxFontSizeMultiplier };
|
|
36
|
+
//# sourceMappingURL=resolveMaxFontSizeMultiplier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMaxFontSizeMultiplier.d.ts","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"mappings":";;;;;UAWU,mCAAA;;EAER,QAAA;EAF2C;EAI3C,MAAA,GAAS,iBAAA;EAMY;;;;;EAArB,OAAA,GAAU,WAAA;AAAA;;AAAW;;;;;;;;;;iBAkBd,4BAAA,CAAA;EACP,QAAA;EACA,MAAA;EACA;AAAA,GACC,mCAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { DEFAULT_MAX_FONT_SIZE_MULTIPLIERS } from "./constants.js";
|
|
3
|
+
//#region src/fontScaling/resolveMaxFontSizeMultiplier.ts
|
|
4
|
+
const UNCAPPED = 0;
|
|
5
|
+
function toResolved(cap) {
|
|
6
|
+
return cap === null ? UNCAPPED : cap;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the `maxFontSizeMultiplier` to hand to React Native.
|
|
10
|
+
*
|
|
11
|
+
* Precedence: explicit prop > provider config (variant entry, then base-variant
|
|
12
|
+
* entry, then `default`) > built-in default table.
|
|
13
|
+
*
|
|
14
|
+
* Returns `undefined` (native behavior: inherit from parent text or app
|
|
15
|
+
* global) when nothing applies — including for built-in uncapped variants, so
|
|
16
|
+
* body text nested inside capped text still inherits the parent's cap. Only an
|
|
17
|
+
* explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.
|
|
18
|
+
*/
|
|
19
|
+
function resolveMaxFontSizeMultiplier({ explicit, config, variant }) {
|
|
20
|
+
if (explicit !== void 0) return toResolved(explicit);
|
|
21
|
+
if (config?.enabled === false) return;
|
|
22
|
+
if (variant === void 0) return config?.default !== void 0 ? toResolved(config.default) : void 0;
|
|
23
|
+
if (variant === "control") {
|
|
24
|
+
if (config?.control !== void 0) return toResolved(config.control);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
const baseVariant = variant.split("/")[0];
|
|
28
|
+
const variantCap = config?.variants?.[variant];
|
|
29
|
+
if (variantCap !== void 0) return toResolved(variantCap);
|
|
30
|
+
const baseVariantCap = config?.variants?.[baseVariant];
|
|
31
|
+
if (baseVariantCap !== void 0) return toResolved(baseVariantCap);
|
|
32
|
+
if (config?.default !== void 0) return toResolved(config.default);
|
|
33
|
+
const builtIn = DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];
|
|
34
|
+
return typeof builtIn === "number" ? builtIn : void 0;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { resolveMaxFontSizeMultiplier };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=resolveMaxFontSizeMultiplier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveMaxFontSizeMultiplier.js","names":[],"sources":["../../src/fontScaling/resolveMaxFontSizeMultiplier.ts"],"sourcesContent":["import type { TextVariant } from '../components/Text';\nimport {\n DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER,\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS,\n} from './constants';\nimport type { FontScalingCapValue, FontScalingConfig } from './types';\n\n// React Native: maxFontSizeMultiplier of 0 means \"no max, ignore parent/global\n// default\" — the only way to force-uncap text nested inside capped text.\nconst UNCAPPED = 0;\n\ninterface ResolveMaxFontSizeMultiplierOptions {\n /** Explicit component prop. `null` = force-uncap. Wins over everything. */\n explicit?: number | null;\n /** Provider config, if any provider is mounted. */\n config?: FontScalingConfig;\n /**\n * The text's resolved variant, `'control'` for control-internal text/icons,\n * or `undefined` for `variant=\"inherit\"` text (no variant opinion — nested\n * text inherits its parent's cap natively).\n */\n variant?: TextVariant | 'control';\n}\n\nfunction toResolved(cap: FontScalingCapValue): number {\n return cap === null ? UNCAPPED : cap;\n}\n\n/**\n * Resolves the `maxFontSizeMultiplier` to hand to React Native.\n *\n * Precedence: explicit prop > provider config (variant entry, then base-variant\n * entry, then `default`) > built-in default table.\n *\n * Returns `undefined` (native behavior: inherit from parent text or app\n * global) when nothing applies — including for built-in uncapped variants, so\n * body text nested inside capped text still inherits the parent's cap. Only an\n * explicit `null` (prop or provider) maps to `0`, RN's force-uncap value.\n */\nfunction resolveMaxFontSizeMultiplier({\n explicit,\n config,\n variant,\n}: ResolveMaxFontSizeMultiplierOptions): number | undefined {\n if (explicit !== undefined) {\n return toResolved(explicit);\n }\n\n if (config?.enabled === false) {\n return undefined;\n }\n\n if (variant === undefined) {\n return config?.default !== undefined ? toResolved(config.default) : undefined;\n }\n\n if (variant === 'control') {\n if (config?.control !== undefined) {\n return toResolved(config.control);\n }\n return DEFAULT_CONTROL_MAX_FONT_SIZE_MULTIPLIER;\n }\n\n const baseVariant = variant.split('/')[0] as TextVariant;\n\n const variantCap = config?.variants?.[variant];\n if (variantCap !== undefined) {\n return toResolved(variantCap);\n }\n const baseVariantCap = config?.variants?.[baseVariant];\n if (baseVariantCap !== undefined) {\n return toResolved(baseVariantCap);\n }\n if (config?.default !== undefined) {\n return toResolved(config.default);\n }\n\n // Future: a theme-level typography[variant].maxFontSizeMultiplier slots here.\n\n const builtIn =\n DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[variant] ?? DEFAULT_MAX_FONT_SIZE_MULTIPLIERS[baseVariant];\n return typeof builtIn === 'number' ? builtIn : undefined;\n}\n\nexport { resolveMaxFontSizeMultiplier, type ResolveMaxFontSizeMultiplierOptions };\n"],"mappings":";;;AASA,MAAM,WAAW;AAejB,SAAS,WAAW,KAAkC;CACpD,OAAO,QAAQ,OAAO,WAAW;;;;;;;;;;;;;AAcnC,SAAS,6BAA6B,EACpC,UACA,QACA,WAC0D;CAC1D,IAAI,aAAa,KAAA,GACf,OAAO,WAAW,SAAS;CAG7B,IAAI,QAAQ,YAAY,OACtB;CAGF,IAAI,YAAY,KAAA,GACd,OAAO,QAAQ,YAAY,KAAA,IAAY,WAAW,OAAO,QAAQ,GAAG,KAAA;CAGtE,IAAI,YAAY,WAAW;EACzB,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;EAEnC,OAAA;;CAGF,MAAM,cAAc,QAAQ,MAAM,IAAI,CAAC;CAEvC,MAAM,aAAa,QAAQ,WAAW;CACtC,IAAI,eAAe,KAAA,GACjB,OAAO,WAAW,WAAW;CAE/B,MAAM,iBAAiB,QAAQ,WAAW;CAC1C,IAAI,mBAAmB,KAAA,GACrB,OAAO,WAAW,eAAe;CAEnC,IAAI,QAAQ,YAAY,KAAA,GACtB,OAAO,WAAW,OAAO,QAAQ;CAKnC,MAAM,UACJ,kCAAkC,YAAY,kCAAkC;CAClF,OAAO,OAAO,YAAY,WAAW,UAAU,KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/fontScaling/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A cap on OS font scaling for a piece of text.
|
|
7
|
+
*
|
|
8
|
+
* - `number` (>= 1) — text scales with the OS setting up to this multiplier
|
|
9
|
+
* - `null` — explicitly uncapped: text follows the OS setting with no limit
|
|
10
|
+
*/
|
|
11
|
+
type FontScalingCapValue = number | null;
|
|
12
|
+
/**
|
|
13
|
+
* App-level font-scaling configuration, applied via `UDSFontScalingProvider`
|
|
14
|
+
* (or the `fontScaling` prop on `UDSGestureProvider`).
|
|
15
|
+
*
|
|
16
|
+
* Resolution order for any piece of text: explicit component prop, then this
|
|
17
|
+
* config, then the built-in defaults in `DEFAULT_MAX_FONT_SIZE_MULTIPLIERS`.
|
|
18
|
+
*
|
|
19
|
+
* The config object should be identity-stable (a module constant or memoized)
|
|
20
|
+
* — every UDS text element reads it from context.
|
|
21
|
+
*/
|
|
22
|
+
interface FontScalingConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Master switch for UDS-applied caps. When `false`, no caps are applied
|
|
25
|
+
* anywhere and text follows native OS scaling. Container-metric fixes
|
|
26
|
+
* (Button/Checkbox growing to fit scaled text) remain active.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Fallback cap for any variant not listed in `variants`. Takes precedence
|
|
32
|
+
* over the built-in default table, including its uncapped entries — setting
|
|
33
|
+
* `default: 2` caps body/label/caption text that UDS leaves uncapped by
|
|
34
|
+
* default.
|
|
35
|
+
*/
|
|
36
|
+
default?: FontScalingCapValue;
|
|
37
|
+
/**
|
|
38
|
+
* Cap for control-internal text and icons: Button labels and icons,
|
|
39
|
+
* Checkbox boxes/checkmarks/labels, and standalone `Icon` glyphs.
|
|
40
|
+
* @default 2
|
|
41
|
+
*/
|
|
42
|
+
control?: FontScalingCapValue;
|
|
43
|
+
/**
|
|
44
|
+
* Per-variant caps. A base-variant key (e.g. `display1`) also covers its
|
|
45
|
+
* `/emphasized` twin unless the emphasized key is listed explicitly.
|
|
46
|
+
*/
|
|
47
|
+
variants?: Partial<Record<TextVariant, FontScalingCapValue>>;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type FontScalingCapValue, type FontScalingConfig };
|
|
51
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAkBmB;;;;;;EAXnB,OAAA,GAAU,mBAAA;;;;;;EAMV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
|
|
4
|
+
//#region src/fontScaling/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A cap on OS font scaling for a piece of text.
|
|
7
|
+
*
|
|
8
|
+
* - `number` (>= 1) — text scales with the OS setting up to this multiplier
|
|
9
|
+
* - `null` — explicitly uncapped: text follows the OS setting with no limit
|
|
10
|
+
*/
|
|
11
|
+
type FontScalingCapValue = number | null;
|
|
12
|
+
/**
|
|
13
|
+
* App-level font-scaling configuration, applied via `UDSFontScalingProvider`
|
|
14
|
+
* (or the `fontScaling` prop on `UDSGestureProvider`).
|
|
15
|
+
*
|
|
16
|
+
* Resolution order for any piece of text: explicit component prop, then this
|
|
17
|
+
* config, then the built-in defaults in `DEFAULT_MAX_FONT_SIZE_MULTIPLIERS`.
|
|
18
|
+
*
|
|
19
|
+
* The config object should be identity-stable (a module constant or memoized)
|
|
20
|
+
* — every UDS text element reads it from context.
|
|
21
|
+
*/
|
|
22
|
+
interface FontScalingConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Master switch for UDS-applied caps. When `false`, no caps are applied
|
|
25
|
+
* anywhere and text follows native OS scaling. Container-metric fixes
|
|
26
|
+
* (Button/Checkbox growing to fit scaled text) remain active.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Fallback cap for any variant not listed in `variants`. Takes precedence
|
|
32
|
+
* over the built-in default table, including its uncapped entries — setting
|
|
33
|
+
* `default: 2` caps body/label/caption text that UDS leaves uncapped by
|
|
34
|
+
* default.
|
|
35
|
+
*/
|
|
36
|
+
default?: FontScalingCapValue;
|
|
37
|
+
/**
|
|
38
|
+
* Cap for control-internal text and icons: Button labels and icons,
|
|
39
|
+
* Checkbox boxes/checkmarks/labels, and standalone `Icon` glyphs.
|
|
40
|
+
* @default 2
|
|
41
|
+
*/
|
|
42
|
+
control?: FontScalingCapValue;
|
|
43
|
+
/**
|
|
44
|
+
* Per-variant caps. A base-variant key (e.g. `display1`) also covers its
|
|
45
|
+
* `/emphasized` twin unless the emphasized key is listed explicitly.
|
|
46
|
+
*/
|
|
47
|
+
variants?: Partial<Record<TextVariant, FontScalingCapValue>>;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type FontScalingCapValue, type FontScalingConfig };
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/fontScaling/types.ts"],"mappings":";;;;;;AAAsD;;;;KAQjD,mBAAA;AAAmB;;;;;;;;;;AAAA,UAYd,iBAAA;EAOR;;;;;;EAAA,OAAA;EAkBmB;;;;;;EAXnB,OAAA,GAAU,mBAAA;;;;;;EAMV,OAAA,GAAU,mBAAA;;;;;EAKV,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,mBAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_native = require("react-native");
|
|
6
|
+
//#region src/fontScaling/useFontScale.ts
|
|
7
|
+
function subscribe(onStoreChange) {
|
|
8
|
+
const subscription = react_native.Dimensions.addEventListener("change", onStoreChange);
|
|
9
|
+
return () => subscription.remove();
|
|
10
|
+
}
|
|
11
|
+
function getFontScale() {
|
|
12
|
+
return react_native.Dimensions.get("window").fontScale;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The current OS font scale, clamped to `[1, cap]`, for sizing containers
|
|
16
|
+
* around scaled text (e.g. a checkbox box growing with its checkmark).
|
|
17
|
+
*
|
|
18
|
+
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
19
|
+
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
20
|
+
* is never below 1 so containers never shrink under their token metrics
|
|
21
|
+
* (font scales < 1 shrink text only, as today).
|
|
22
|
+
*
|
|
23
|
+
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
24
|
+
* components re-render solely when the user changes the OS text size.
|
|
25
|
+
*/
|
|
26
|
+
function useFontScale(cap) {
|
|
27
|
+
const fontScale = (0, react.useSyncExternalStore)(subscribe, getFontScale, getFontScale);
|
|
28
|
+
const effectiveCap = typeof cap === "number" && cap >= 1 ? cap : Number.POSITIVE_INFINITY;
|
|
29
|
+
return Math.max(1, Math.min(fontScale, effectiveCap));
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.useFontScale = useFontScale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/fontScaling/useFontScale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The current OS font scale, clamped to `[1, cap]`, for sizing containers
|
|
5
|
+
* around scaled text (e.g. a checkbox box growing with its checkmark).
|
|
6
|
+
*
|
|
7
|
+
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
8
|
+
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
9
|
+
* is never below 1 so containers never shrink under their token metrics
|
|
10
|
+
* (font scales < 1 shrink text only, as today).
|
|
11
|
+
*
|
|
12
|
+
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
13
|
+
* components re-render solely when the user changes the OS text size.
|
|
14
|
+
*/
|
|
15
|
+
declare function useFontScale(cap?: number | null): number;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useFontScale };
|
|
18
|
+
//# sourceMappingURL=useFontScale.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFontScale.d.cts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":";;;;;;;;;;;;;;iBA0BS,YAAA,CAAa,GAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/fontScaling/useFontScale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The current OS font scale, clamped to `[1, cap]`, for sizing containers
|
|
5
|
+
* around scaled text (e.g. a checkbox box growing with its checkmark).
|
|
6
|
+
*
|
|
7
|
+
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
8
|
+
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
9
|
+
* is never below 1 so containers never shrink under their token metrics
|
|
10
|
+
* (font scales < 1 shrink text only, as today).
|
|
11
|
+
*
|
|
12
|
+
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
13
|
+
* components re-render solely when the user changes the OS text size.
|
|
14
|
+
*/
|
|
15
|
+
declare function useFontScale(cap?: number | null): number;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useFontScale };
|
|
18
|
+
//# sourceMappingURL=useFontScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFontScale.d.ts","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"mappings":";;;;;;;;;;;;;;iBA0BS,YAAA,CAAa,GAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
4
|
+
//#region src/fontScaling/useFontScale.ts
|
|
5
|
+
function subscribe(onStoreChange) {
|
|
6
|
+
const subscription = Dimensions.addEventListener("change", onStoreChange);
|
|
7
|
+
return () => subscription.remove();
|
|
8
|
+
}
|
|
9
|
+
function getFontScale() {
|
|
10
|
+
return Dimensions.get("window").fontScale;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The current OS font scale, clamped to `[1, cap]`, for sizing containers
|
|
14
|
+
* around scaled text (e.g. a checkbox box growing with its checkmark).
|
|
15
|
+
*
|
|
16
|
+
* `cap` uses the same semantics as `maxFontSizeMultiplier`: a number >= 1
|
|
17
|
+
* caps the scale; `null`, `0`, or `undefined` leave it uncapped. The result
|
|
18
|
+
* is never below 1 so containers never shrink under their token metrics
|
|
19
|
+
* (font scales < 1 shrink text only, as today).
|
|
20
|
+
*
|
|
21
|
+
* Subscribes to font-scale changes only — rotation does not re-render, and
|
|
22
|
+
* components re-render solely when the user changes the OS text size.
|
|
23
|
+
*/
|
|
24
|
+
function useFontScale(cap) {
|
|
25
|
+
const fontScale = useSyncExternalStore(subscribe, getFontScale, getFontScale);
|
|
26
|
+
const effectiveCap = typeof cap === "number" && cap >= 1 ? cap : Number.POSITIVE_INFINITY;
|
|
27
|
+
return Math.max(1, Math.min(fontScale, effectiveCap));
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useFontScale };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=useFontScale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFontScale.js","names":[],"sources":["../../src/fontScaling/useFontScale.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\nimport { Dimensions } from 'react-native';\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 current OS font scale, clamped to `[1, cap]`, for sizing containers\n * around scaled text (e.g. a checkbox box growing with its 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 * 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 */\nfunction useFontScale(cap?: number | null): number {\n const fontScale = useSyncExternalStore(subscribe, getFontScale, getFontScale);\n const effectiveCap = typeof cap === 'number' && cap >= 1 ? cap : Number.POSITIVE_INFINITY;\n return Math.max(1, Math.min(fontScale, effectiveCap));\n}\n\nexport { useFontScale };\n"],"mappings":";;;;AAGA,SAAS,UAAU,eAAuC;CACxD,MAAM,eAAe,WAAW,iBAAiB,UAAU,cAAc;CACzE,aAAa,aAAa,QAAQ;;AAKpC,SAAS,eAAuB;CAC9B,OAAO,WAAW,IAAI,SAAS,CAAC;;;;;;;;;;;;;;AAelC,SAAS,aAAa,KAA6B;CACjD,MAAM,YAAY,qBAAqB,WAAW,cAAc,aAAa;CAC7E,MAAM,eAAe,OAAO,QAAQ,YAAY,OAAO,IAAI,MAAM,OAAO;CACxE,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,WAAW,aAAa,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_fontScaling_FontScalingContext = require("./FontScalingContext.cjs");
|
|
5
|
+
const require_fontScaling_resolveMaxFontSizeMultiplier = require("./resolveMaxFontSizeMultiplier.cjs");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
//#region src/fontScaling/useMaxFontSizeMultiplier.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the `maxFontSizeMultiplier` for a text variant (or `'control'` for
|
|
10
|
+
* control-internal text/icons), combining an explicit prop value, the nearest
|
|
11
|
+
* `UDSFontScalingProvider` config, and the built-in defaults.
|
|
12
|
+
*
|
|
13
|
+
* Returns a value to pass directly to React Native: a cap (>= 1), `0`
|
|
14
|
+
* (force-uncap), or `undefined` (native default / inherit).
|
|
15
|
+
*/
|
|
16
|
+
function useMaxFontSizeMultiplier(variant, explicit) {
|
|
17
|
+
return require_fontScaling_resolveMaxFontSizeMultiplier.resolveMaxFontSizeMultiplier({
|
|
18
|
+
explicit,
|
|
19
|
+
config: (0, react.useContext)(require_fontScaling_FontScalingContext.FontScalingContext),
|
|
20
|
+
variant
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.useMaxFontSizeMultiplier = useMaxFontSizeMultiplier;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/fontScaling/useMaxFontSizeMultiplier.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the `maxFontSizeMultiplier` for a text variant (or `'control'` for
|
|
7
|
+
* control-internal text/icons), combining an explicit prop value, the nearest
|
|
8
|
+
* `UDSFontScalingProvider` config, and the built-in defaults.
|
|
9
|
+
*
|
|
10
|
+
* Returns a value to pass directly to React Native: a cap (>= 1), `0`
|
|
11
|
+
* (force-uncap), or `undefined` (native default / inherit).
|
|
12
|
+
*/
|
|
13
|
+
declare function useMaxFontSizeMultiplier(variant?: TextVariant | 'control', explicit?: number | null): number | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useMaxFontSizeMultiplier };
|
|
16
|
+
//# sourceMappingURL=useMaxFontSizeMultiplier.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMaxFontSizeMultiplier.d.cts","names":[],"sources":["../../src/fontScaling/useMaxFontSizeMultiplier.ts"],"mappings":";;;;;;AAEsD;;;;;;iBAY7C,wBAAA,CACP,OAAA,GAAU,WAAA,cACV,QAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextVariant } from "../components/Text.js";
|
|
3
|
+
|
|
4
|
+
//#region src/fontScaling/useMaxFontSizeMultiplier.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the `maxFontSizeMultiplier` for a text variant (or `'control'` for
|
|
7
|
+
* control-internal text/icons), combining an explicit prop value, the nearest
|
|
8
|
+
* `UDSFontScalingProvider` config, and the built-in defaults.
|
|
9
|
+
*
|
|
10
|
+
* Returns a value to pass directly to React Native: a cap (>= 1), `0`
|
|
11
|
+
* (force-uncap), or `undefined` (native default / inherit).
|
|
12
|
+
*/
|
|
13
|
+
declare function useMaxFontSizeMultiplier(variant?: TextVariant | 'control', explicit?: number | null): number | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useMaxFontSizeMultiplier };
|
|
16
|
+
//# sourceMappingURL=useMaxFontSizeMultiplier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMaxFontSizeMultiplier.d.ts","names":[],"sources":["../../src/fontScaling/useMaxFontSizeMultiplier.ts"],"mappings":";;;;;;AAEsD;;;;;;iBAY7C,wBAAA,CACP,OAAA,GAAU,WAAA,cACV,QAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { FontScalingContext } from "./FontScalingContext.js";
|
|
3
|
+
import { resolveMaxFontSizeMultiplier } from "./resolveMaxFontSizeMultiplier.js";
|
|
4
|
+
import { useContext } from "react";
|
|
5
|
+
//#region src/fontScaling/useMaxFontSizeMultiplier.ts
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the `maxFontSizeMultiplier` for a text variant (or `'control'` for
|
|
8
|
+
* control-internal text/icons), combining an explicit prop value, the nearest
|
|
9
|
+
* `UDSFontScalingProvider` config, and the built-in defaults.
|
|
10
|
+
*
|
|
11
|
+
* Returns a value to pass directly to React Native: a cap (>= 1), `0`
|
|
12
|
+
* (force-uncap), or `undefined` (native default / inherit).
|
|
13
|
+
*/
|
|
14
|
+
function useMaxFontSizeMultiplier(variant, explicit) {
|
|
15
|
+
return resolveMaxFontSizeMultiplier({
|
|
16
|
+
explicit,
|
|
17
|
+
config: useContext(FontScalingContext),
|
|
18
|
+
variant
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useMaxFontSizeMultiplier };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=useMaxFontSizeMultiplier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMaxFontSizeMultiplier.js","names":[],"sources":["../../src/fontScaling/useMaxFontSizeMultiplier.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport type { TextVariant } from '../components/Text';\nimport { FontScalingContext } from './FontScalingContext';\nimport { resolveMaxFontSizeMultiplier } from './resolveMaxFontSizeMultiplier';\n\n/**\n * Resolves the `maxFontSizeMultiplier` for a text variant (or `'control'` for\n * control-internal text/icons), combining an explicit prop value, the nearest\n * `UDSFontScalingProvider` config, and the built-in defaults.\n *\n * Returns a value to pass directly to React Native: a cap (>= 1), `0`\n * (force-uncap), or `undefined` (native default / inherit).\n */\nfunction useMaxFontSizeMultiplier(\n variant?: TextVariant | 'control',\n explicit?: number | null,\n): number | undefined {\n const config = useContext(FontScalingContext);\n return resolveMaxFontSizeMultiplier({ explicit, config, variant });\n}\n\nexport { useMaxFontSizeMultiplier };\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,yBACP,SACA,UACoB;CAEpB,OAAO,6BAA6B;EAAE;EAAU,QADjC,WAAW,mBAC4B;EAAE;EAAS,CAAC"}
|
|
@@ -76,20 +76,33 @@ const Platform = {
|
|
|
76
76
|
};
|
|
77
77
|
const SCREEN_WIDTH = 375;
|
|
78
78
|
const SCREEN_HEIGHT = 812;
|
|
79
|
+
let mockFontScale = 1;
|
|
80
|
+
const dimensionListeners = /* @__PURE__ */ new Set();
|
|
81
|
+
/** Set the mocked OS font scale and notify Dimensions 'change' listeners. */
|
|
82
|
+
const __setMockFontScale = (fontScale) => {
|
|
83
|
+
mockFontScale = fontScale;
|
|
84
|
+
dimensionListeners.forEach((listener) => listener());
|
|
85
|
+
};
|
|
86
|
+
const __resetMockFontScale = () => {
|
|
87
|
+
__setMockFontScale(1);
|
|
88
|
+
};
|
|
79
89
|
const Dimensions = {
|
|
80
90
|
get: (_dim) => ({
|
|
81
91
|
width: SCREEN_WIDTH,
|
|
82
92
|
height: SCREEN_HEIGHT,
|
|
83
93
|
scale: 2,
|
|
84
|
-
fontScale:
|
|
94
|
+
fontScale: mockFontScale
|
|
85
95
|
}),
|
|
86
96
|
set: jest.fn(),
|
|
87
|
-
addEventListener: jest.fn(() =>
|
|
97
|
+
addEventListener: jest.fn((_event, listener) => {
|
|
98
|
+
dimensionListeners.add(listener);
|
|
99
|
+
return { remove: () => dimensionListeners.delete(listener) };
|
|
100
|
+
}),
|
|
88
101
|
removeEventListener: jest.fn()
|
|
89
102
|
};
|
|
90
103
|
const PixelRatio = {
|
|
91
104
|
get: () => 2,
|
|
92
|
-
getFontScale: () =>
|
|
105
|
+
getFontScale: () => mockFontScale,
|
|
93
106
|
getPixelSizeForLayoutSize: (size) => size * 2,
|
|
94
107
|
roundToNearestPixel: (size) => Math.round(size * 2) / 2
|
|
95
108
|
};
|
|
@@ -155,7 +168,7 @@ const useWindowDimensions = () => ({
|
|
|
155
168
|
width: SCREEN_WIDTH,
|
|
156
169
|
height: SCREEN_HEIGHT,
|
|
157
170
|
scale: 2,
|
|
158
|
-
fontScale:
|
|
171
|
+
fontScale: mockFontScale
|
|
159
172
|
});
|
|
160
173
|
const ReactNative = {
|
|
161
174
|
View,
|
|
@@ -222,6 +235,8 @@ exports.TouchableHighlight = TouchableHighlight;
|
|
|
222
235
|
exports.TouchableOpacity = TouchableOpacity;
|
|
223
236
|
exports.TouchableWithoutFeedback = TouchableWithoutFeedback;
|
|
224
237
|
exports.View = View;
|
|
238
|
+
exports.__resetMockFontScale = __resetMockFontScale;
|
|
239
|
+
exports.__setMockFontScale = __setMockFontScale;
|
|
225
240
|
exports.default = ReactNative;
|
|
226
241
|
exports.useColorScheme = useColorScheme;
|
|
227
242
|
exports.useWindowDimensions = useWindowDimensions;
|
|
@@ -63,6 +63,9 @@ declare const Platform: {
|
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
+
/** Set the mocked OS font scale and notify Dimensions 'change' listeners. */
|
|
67
|
+
declare const __setMockFontScale: (fontScale: number) => void;
|
|
68
|
+
declare const __resetMockFontScale: () => void;
|
|
66
69
|
declare const Dimensions: {
|
|
67
70
|
get: (_dim: "window" | "screen") => {
|
|
68
71
|
width: number;
|
|
@@ -72,8 +75,8 @@ declare const Dimensions: {
|
|
|
72
75
|
};
|
|
73
76
|
set: jest.Mock<any, any, any>;
|
|
74
77
|
addEventListener: jest.Mock<{
|
|
75
|
-
remove:
|
|
76
|
-
}, [], any>;
|
|
78
|
+
remove: () => boolean;
|
|
79
|
+
}, [_event: "change", listener: () => void], any>;
|
|
77
80
|
removeEventListener: jest.Mock<any, any, any>;
|
|
78
81
|
};
|
|
79
82
|
declare const PixelRatio: {
|
|
@@ -228,8 +231,8 @@ declare const ReactNative: {
|
|
|
228
231
|
};
|
|
229
232
|
set: jest.Mock<any, any, any>;
|
|
230
233
|
addEventListener: jest.Mock<{
|
|
231
|
-
remove:
|
|
232
|
-
}, [], any>;
|
|
234
|
+
remove: () => boolean;
|
|
235
|
+
}, [_event: "change", listener: () => void], any>;
|
|
233
236
|
removeEventListener: jest.Mock<any, any, any>;
|
|
234
237
|
};
|
|
235
238
|
PixelRatio: {
|
|
@@ -317,5 +320,5 @@ declare const ReactNative: {
|
|
|
317
320
|
};
|
|
318
321
|
};
|
|
319
322
|
//#endregion
|
|
320
|
-
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
323
|
+
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, __resetMockFontScale, __setMockFontScale, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
321
324
|
//# sourceMappingURL=react-native.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.d.cts","names":[],"sources":["../../../src/jest/mocks/react-native.tsx"],"mappings":";;;;UAgBU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,KAAA;EACA,MAAA;EACA,iBAAA;EACA,kBAAA;EAAA,CACC,GAAA;AAAA;AAAA,cAaG,IAAA,EAAI,KAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,kBAAA,WAAA,KAAA,CAAA,aAAA;AAAA,cACJ,IAAA,EAAI,KAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,kBAAA,WAAA,KAAA,CAAA,aAAA;AAAA,cACJ,KAAA,EAAK,KAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,kBAAA,WAAA,KAAA,CAAA,aAAA;AAAA,cACL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AA,CAAA,IAAA;YAAA,IAAA,CAAA,IAAA;;;;;cAGK,OAAA;;;;;;;;cAQA,QAAA;;;;;;;cAOA,iBAAA;;;;;;;cAOA,kBAAA;EACJ,WAAA,EAAW,IAAA,CAAA,IAAA;;;EACX,cAAA,EAAc,IAAA,CAAA,IAAA;EACd,kBAAA,EAAkB,IAAA,CAAA,IAAA;AAAA;AAAA,cAId,UAAA;;;;;;;cAOA,cAAA;AAAA,cAGA,mBAAA;;;;;;cAQA,WAAA;;;;;;;;;;;;;;;;;;;uBA3Je,MAAA,kBAAsB,MAAA,EAAU,CAAA,KAAI,CAAA;;8BAO/B,MAAA;;;;;;;;;;;;;;;;;;;;uBAUL,MAAA,mBAAuB,MAAA,EAAU,CAAA,KAAI,CAAA,OAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAmE3B,KAAA,CAAM,aAAA,KAAa,KAAA,CAAA,aAAA;EAAA"}
|
|
@@ -63,6 +63,9 @@ declare const Platform: {
|
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
+
/** Set the mocked OS font scale and notify Dimensions 'change' listeners. */
|
|
67
|
+
declare const __setMockFontScale: (fontScale: number) => void;
|
|
68
|
+
declare const __resetMockFontScale: () => void;
|
|
66
69
|
declare const Dimensions: {
|
|
67
70
|
get: (_dim: "window" | "screen") => {
|
|
68
71
|
width: number;
|
|
@@ -72,8 +75,8 @@ declare const Dimensions: {
|
|
|
72
75
|
};
|
|
73
76
|
set: jest.Mock<any, any, any>;
|
|
74
77
|
addEventListener: jest.Mock<{
|
|
75
|
-
remove:
|
|
76
|
-
}, [], any>;
|
|
78
|
+
remove: () => boolean;
|
|
79
|
+
}, [_event: "change", listener: () => void], any>;
|
|
77
80
|
removeEventListener: jest.Mock<any, any, any>;
|
|
78
81
|
};
|
|
79
82
|
declare const PixelRatio: {
|
|
@@ -228,8 +231,8 @@ declare const ReactNative: {
|
|
|
228
231
|
};
|
|
229
232
|
set: jest.Mock<any, any, any>;
|
|
230
233
|
addEventListener: jest.Mock<{
|
|
231
|
-
remove:
|
|
232
|
-
}, [], any>;
|
|
234
|
+
remove: () => boolean;
|
|
235
|
+
}, [_event: "change", listener: () => void], any>;
|
|
233
236
|
removeEventListener: jest.Mock<any, any, any>;
|
|
234
237
|
};
|
|
235
238
|
PixelRatio: {
|
|
@@ -317,5 +320,5 @@ declare const ReactNative: {
|
|
|
317
320
|
};
|
|
318
321
|
};
|
|
319
322
|
//#endregion
|
|
320
|
-
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
323
|
+
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, __resetMockFontScale, __setMockFontScale, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
321
324
|
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.d.ts","names":[],"sources":["../../../src/jest/mocks/react-native.tsx"],"mappings":";;;;UAgBU,kBAAA;EACR,QAAA,GAAW,SAAA;EACX,KAAA;EACA,MAAA;EACA,iBAAA;EACA,kBAAA;EAAA,CACC,GAAA;AAAA;AAAA,cAaG,IAAA,EAAI,KAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,kBAAA,WAAA,KAAA,CAAA,aAAA;A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UAAA;;;;;;;;;;;;;cAgBA,UAAA;;;;;;cAQA,QAAA;;;;;;;;;;;;;;;;uCAaiC,KAAA,CAAM,aAAA,KAAa,KAAA,CAAA,aAAA;AAAA;AAAA,cAIpD,QAAA;;;;;;;;cAOA,WAAA;;;;;;cAKA,WAAA;;YAKL,IAAA,CAAA,IAAA;YAAA,IAAA,CAAA,IAAA;;;;;cAGK,OAAA;;;;;;;;cAQA,QAAA;;;;;;;cAOA,iBAAA;;;;;;;cAOA,kBAAA;EACJ,WAAA,EAAW,IAAA,CAAA,IAAA;;;EACX,cAAA,EAAc,IAAA,CAAA,IAAA;EACd,kBAAA,EAAkB,IAAA,CAAA,IAAA;AAAA;AAAA,cAId,UAAA;;;;;;;cAOA,cAAA;AAAA,cAGA,mBAAA;;;;;;cAQA,WAAA;;;;;;;;;;;;;;;;;;;uBA3Je,MAAA,kBAAsB,MAAA,EAAU,CAAA,KAAI,CAAA;;8BAO/B,MAAA;;;;;;;;;;;;;;;;;;;;uBAUL,MAAA,mBAAuB,MAAA,EAAU,CAAA,KAAI,CAAA,OAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAmE3B,KAAA,CAAM,aAAA,KAAa,KAAA,CAAA,aAAA;EAAA"}
|
|
@@ -70,20 +70,33 @@ const Platform = {
|
|
|
70
70
|
};
|
|
71
71
|
const SCREEN_WIDTH = 375;
|
|
72
72
|
const SCREEN_HEIGHT = 812;
|
|
73
|
+
let mockFontScale = 1;
|
|
74
|
+
const dimensionListeners = /* @__PURE__ */ new Set();
|
|
75
|
+
/** Set the mocked OS font scale and notify Dimensions 'change' listeners. */
|
|
76
|
+
const __setMockFontScale = (fontScale) => {
|
|
77
|
+
mockFontScale = fontScale;
|
|
78
|
+
dimensionListeners.forEach((listener) => listener());
|
|
79
|
+
};
|
|
80
|
+
const __resetMockFontScale = () => {
|
|
81
|
+
__setMockFontScale(1);
|
|
82
|
+
};
|
|
73
83
|
const Dimensions = {
|
|
74
84
|
get: (_dim) => ({
|
|
75
85
|
width: SCREEN_WIDTH,
|
|
76
86
|
height: SCREEN_HEIGHT,
|
|
77
87
|
scale: 2,
|
|
78
|
-
fontScale:
|
|
88
|
+
fontScale: mockFontScale
|
|
79
89
|
}),
|
|
80
90
|
set: jest.fn(),
|
|
81
|
-
addEventListener: jest.fn(() =>
|
|
91
|
+
addEventListener: jest.fn((_event, listener) => {
|
|
92
|
+
dimensionListeners.add(listener);
|
|
93
|
+
return { remove: () => dimensionListeners.delete(listener) };
|
|
94
|
+
}),
|
|
82
95
|
removeEventListener: jest.fn()
|
|
83
96
|
};
|
|
84
97
|
const PixelRatio = {
|
|
85
98
|
get: () => 2,
|
|
86
|
-
getFontScale: () =>
|
|
99
|
+
getFontScale: () => mockFontScale,
|
|
87
100
|
getPixelSizeForLayoutSize: (size) => size * 2,
|
|
88
101
|
roundToNearestPixel: (size) => Math.round(size * 2) / 2
|
|
89
102
|
};
|
|
@@ -149,7 +162,7 @@ const useWindowDimensions = () => ({
|
|
|
149
162
|
width: SCREEN_WIDTH,
|
|
150
163
|
height: SCREEN_HEIGHT,
|
|
151
164
|
scale: 2,
|
|
152
|
-
fontScale:
|
|
165
|
+
fontScale: mockFontScale
|
|
153
166
|
});
|
|
154
167
|
const ReactNative = {
|
|
155
168
|
View,
|
|
@@ -186,6 +199,6 @@ const ReactNative = {
|
|
|
186
199
|
useWindowDimensions
|
|
187
200
|
};
|
|
188
201
|
//#endregion
|
|
189
|
-
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
202
|
+
export { AccessibilityInfo, ActivityIndicator, Animated, AppState, Appearance, BackHandler, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, NativeEventEmitter, PixelRatio, Platform, Pressable, RefreshControl, SafeAreaView, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback, View, __resetMockFontScale, __setMockFontScale, ReactNative as default, useColorScheme, useWindowDimensions };
|
|
190
203
|
|
|
191
204
|
//# sourceMappingURL=react-native.js.map
|