@ankhorage/surface 9.1.12 → 9.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 9.1.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 91a7891: Keep image-source narrowing and layout dimensions compatible across the supported React Native 0.86 and 0.87 lines.
8
+ - 89e24aa: Update Renovate-managed workflows.
9
+
10
+ ## 9.1.13
11
+
12
+ ### Patch Changes
13
+
14
+ - 5c7d9ff: Update dependencies: `react-native-safe-area-context`.
15
+ - 651f094: Update dependencies: `@ankhorage/contracts`, `@ankhorage/utility`.
16
+
3
17
  ## 9.1.12
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/surface
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v9.1.12](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v9.1.14](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"getSourceKey.js","sourceRoot":"","sources":["../../../../src/features/image/utils/getSour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gBAAgB,CAAC,MAA2B;IACnD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,IAAI,MAAM,CAAC;AACvD,CAAC;AAED,8EAA8E;AAC9E,SAAS,oBAAoB,CAAC,MAA2B;IACvD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { ImageSourcePropType, ImageURISource } from 'react-native';\n\nimport type { SurfaceImageSource } from '../../../types/image';\n\n/*** Derives a stable runtime key for one Surface image source. */\nexport function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {\n if (source === null || source === undefined) return null;\n if (typeof source === 'string') return `uri:${source}`;\n if (typeof source === 'number') return `asset:${source}`;\n if (isImageUriSourceList(source)) {\n const parts = source\n .map((item) => item.uri)\n .filter((value): value is string => typeof value === 'string');\n return `uri-set:${parts.join('|')}`;\n }\n\n const uri = getUriFromSource(source);\n if (uri) return `uri:${uri}`;\n\n try {\n return `src:${JSON.stringify(source)}`;\n } catch {\n return 'src:unknown';\n }\n}\n\n/*** Reads the first URI represented by a React Native image source. */\nfunction getUriFromSource(source: ImageSourcePropType): string | undefined {\n if (isImageUriSourceList(source)) return source[0]?.uri;\n if (typeof source === 'number') return undefined;\n return isImageUriSource(source) ? source.uri : undefined;\n}\n\n/*** Narrows a React Native image source to one URI-bearing source object. */\nfunction isImageUriSource(source: ImageSourcePropType): source is ImageURISource {\n return typeof source === 'object' && 'uri' in source;\n}\n\n/*** Narrows a React Native image source to the readonly multi-source form. */\nfunction isImageUriSourceList(source: ImageSourcePropType): source is readonly ImageURISource[] {\n return Array.isArray(source);\n}\n"]}
1
+ {"version":3,"file":"getSourceKey.js","sourceRoot":"","sources":["../../../../src/features/image/utils/getSourceKey.ts"],"names":[],"mappings":"AAIA,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,MAA6C;IACxE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzD,IA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KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { ImageSourcePropType, ImageURISource } from 'react-native';\n\nimport type { SurfaceImageSource } from '../../../types/image';\n\n/*** Derives a stable runtime key for one Surface image source. */\nexport function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {\n if (source === null || source === undefined) return null;\n if (typeof source === 'string') return `uri:${source}`;\n if (typeof source === 'number') return `asset:${source}`;\n if (isImageUriSourceList(source)) {\n const parts = source\n .map((item) => item.uri)\n .filter((value): value is string => typeof value === 'string');\n return `uri-set:${parts.join('|')}`;\n }\n\n const uri = getUriFromSource(source);\n if (uri) return `uri:${uri}`;\n\n try {\n return `src:${JSON.stringify(source)}`;\n } catch {\n return 'src:unknown';\n }\n}\n\n/*** Reads the first URI represented by a React Native image source. */\nfunction getUriFromSource(source: ImageSourcePropType): string | undefined {\n if (isImageUriSourceList(source)) return source[0]?.uri;\n if (typeof source === 'number') return undefined;\n return isImageUriSource(source) ? source.uri : undefined;\n}\n\n/*** Narrows a React Native image source to one URI-bearing source object. */\nfunction isImageUriSource(source: ImageSourcePropType): source is ImageURISource {\n return typeof source === 'object' && 'uri' in source;\n}\n\n/*** Narrows a React Native image source to the readonly multi-source form. */\nfunction isImageUriSourceList(source: ImageSourcePropType): source is ImageURISource[] {\n return Array.isArray(source);\n}\n"]}
@@ -8,7 +8,7 @@ export function resolveViewStyles(theme, breakpoint, props) {
8
8
  ...resolveSpacingStyles(theme, breakpoint, props),
9
9
  ...resolveVisualStyles(theme, breakpoint, props),
10
10
  ...resolveDimensionStyles(theme, breakpoint, props),
11
- ...resolveLayoutStyles(breakpoint, props),
11
+ ...resolveLayoutStyles(theme, breakpoint, props),
12
12
  };
13
13
  }
14
14
  /*** Resolves padding, margin, and gap styles from responsive spacing props. */
@@ -54,12 +54,12 @@ function resolveDimensionStyles(theme, breakpoint, props) {
54
54
  };
55
55
  }
56
56
  /*** Resolves responsive flex, positioning, and visibility styles. */
57
- function resolveLayoutStyles(breakpoint, props) {
57
+ function resolveLayoutStyles(theme, breakpoint, props) {
58
58
  return {
59
59
  flex: resolveResponsive(props.flex, breakpoint),
60
60
  flexGrow: resolveResponsive(props.flexGrow, breakpoint),
61
61
  flexShrink: resolveResponsive(props.flexShrink, breakpoint),
62
- flexBasis: resolveResponsive(props.flexBasis, breakpoint),
62
+ flexBasis: resolveDimension(theme, resolveResponsive(props.flexBasis, breakpoint)),
63
63
  flexDirection: resolveResponsive(props.direction, breakpoint),
64
64
  alignItems: resolveResponsive(props.align, breakpoint),
65
65
  justifyContent: resolveResponsive(props.justify, breakpoint),
@@ -83,8 +83,17 @@ function resolveRadius(theme, value) {
83
83
  function resolveColor(theme, value) {
84
84
  return resolveToken(theme.colors, value);
85
85
  }
86
- /*** Resolves spacing-token dimensions while preserving raw dimension strings. */
86
+ /*** Resolves spacing-token dimensions into values portable across supported React Native lines. */
87
87
  function resolveDimension(theme, value) {
88
- return resolveToken(theme.spacing, value);
88
+ const resolved = resolveToken(theme.spacing, value);
89
+ if (resolved === undefined || typeof resolved === 'number')
90
+ return resolved;
91
+ if (isPortableDimensionString(resolved))
92
+ return resolved;
93
+ throw new Error(`Unsupported Surface dimension: ${JSON.stringify(resolved)}.`);
94
+ }
95
+ /*** Narrows raw dimension strings to the React Native values shared by supported versions. */
96
+ function isPortableDimensionString(value) {
97
+ return value === 'auto' || /^-?(?:\d+(?:\.\d+)?|\.\d+)%$/u.test(value);
89
98
  }
90
99
  //# sourceMappingURL=resolveViewStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveViewStyles.js","sourceRoot":"","sources":["../../src/utils/resolveViewStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,sFAAsF;AACtF,MAAM,UAAU,iBA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BAAgB,CACvB,KAAmB,EACnB,KAAkC;IAElC,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import type { ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint } from '../core/responsive/types';\nimport { resolveToken } from '../features/theme/utils/resolveToken';\nimport type { ColorValue, ViewStyleProps } from '../types/layout';\nimport type { SurfaceTheme } from '../types/theme';\nimport { resolveSpacing } from './resolveSpacing';\n\n/*** Resolves responsive Surface View style props into one React Native view style. */\nexport function resolveViewStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n elevation: 0,\n ...resolveSpacingStyles(theme, breakpoint, props),\n ...resolveVisualStyles(theme, breakpoint, props),\n ...resolveDimensionStyles(theme, breakpoint, props),\n ...resolveLayoutStyles(breakpoint, props),\n };\n}\n\n/*** Resolves padding, margin, and gap styles from responsive spacing props. */\nfunction resolveSpacingStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),\n paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),\n paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),\n paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),\n paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),\n paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),\n paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),\n margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),\n marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),\n marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),\n marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),\n marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),\n marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),\n marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),\n gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),\n rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),\n columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),\n };\n}\n\n/*** Resolves background, radius, and border styles. */\nfunction resolveVisualStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),\n borderWidth: resolveResponsive(props.borderWidth, breakpoint),\n borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n };\n}\n\n/*** Resolves responsive dimension props through spacing tokens. */\nfunction resolveDimensionStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n width: resolveDimension(theme, resolveResponsive(props.width, breakpoint)),\n height: resolveDimension(theme, resolveResponsive(props.height, breakpoint)),\n minWidth: resolveDimension(theme, resolveResponsive(props.minWidth, breakpoint)),\n maxWidth: resolveDimension(theme, resolveResponsive(props.maxWidth, breakpoint)),\n minHeight: resolveDimension(theme, resolveResponsive(props.minHeight, breakpoint)),\n maxHeight: resolveDimension(theme, resolveResponsive(props.maxHeight, breakpoint)),\n };\n}\n\n/*** Resolves responsive flex, positioning, and visibility styles. */\nfunction resolveLayoutStyles(breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle {\n return {\n flex: resolveResponsive(props.flex, breakpoint),\n flexGrow: resolveResponsive(props.flexGrow, breakpoint),\n flexShrink: resolveResponsive(props.flexShrink, breakpoint),\n flexBasis: resolveResponsive(props.flexBasis, breakpoint),\n flexDirection: resolveResponsive(props.direction, breakpoint),\n alignItems: resolveResponsive(props.align, breakpoint),\n justifyContent: resolveResponsive(props.justify, breakpoint),\n flexWrap: resolveResponsive(props.wrap, breakpoint),\n alignSelf: resolveResponsive(props.alignSelf, breakpoint),\n position: resolveResponsive(props.position, breakpoint),\n top: resolveResponsive(props.top, breakpoint),\n bottom: resolveResponsive(props.bottom, breakpoint),\n left: resolveResponsive(props.left, breakpoint),\n right: resolveResponsive(props.right, breakpoint),\n overflow: resolveResponsive(props.overflow, breakpoint),\n zIndex: resolveResponsive(props.zIndex, breakpoint),\n opacity: resolveResponsive(props.opacity, breakpoint),\n };\n}\n\n/*** Resolves a Surface radius token or raw number. */\nfunction resolveRadius(\n theme: SurfaceTheme,\n value: number | keyof SurfaceTheme['radii'] | undefined,\n): number | undefined {\n return resolveToken(theme.radii, value);\n}\n\n/*** Resolves a Surface color token while preserving arbitrary color strings. */\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n return resolveToken(theme.colors, value);\n}\n\n/*** Resolves spacing-token dimensions while preserving raw dimension strings. */\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n return resolveToken(theme.spacing, value);\n}\n"]}
1
+ {"version":3,"file":"resolveViewStyles.js","sourceRoot":"","sources":["../../src/utils/resolveViewStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAC/B,KAAmB,EACnB,UAAsB,EACtB,KAAqB;IAErB,OAAO;QACL,SAAS,EAAE,CAAC;QACZ,GAAG,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC;QACjD,GAAG,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC;QAChD,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O,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC5E,IAAI,yBAAyB,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzD,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACjF,CAAC;AAED,8FAA8F;AAC9F,SAAS,yBAAyB,CAAC,KAAa;IAC9C,OAAO,KAAK,KAAK,MAAM,IAAI,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import type { ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint } from '../core/responsive/types';\nimport { resolveToken } from '../features/theme/utils/resolveToken';\nimport type { ColorValue, ViewStyleProps } from '../types/layout';\nimport type { SurfaceTheme } from '../types/theme';\nimport { resolveSpacing } from './resolveSpacing';\n\n/*** Resolves responsive Surface View style props into one React Native view style. */\nexport function resolveViewStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n elevation: 0,\n ...resolveSpacingStyles(theme, breakpoint, props),\n ...resolveVisualStyles(theme, breakpoint, props),\n ...resolveDimensionStyles(theme, breakpoint, props),\n ...resolveLayoutStyles(theme, breakpoint, props),\n };\n}\n\n/*** Resolves padding, margin, and gap styles from responsive spacing props. */\nfunction resolveSpacingStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),\n paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),\n paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),\n paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),\n paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),\n paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),\n paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),\n margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),\n marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),\n marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),\n marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),\n marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),\n marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),\n marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),\n gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),\n rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),\n columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),\n };\n}\n\n/*** Resolves background, radius, and border styles. */\nfunction resolveVisualStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),\n borderWidth: resolveResponsive(props.borderWidth, breakpoint),\n borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n };\n}\n\n/*** Resolves responsive dimension props through spacing tokens. */\nfunction resolveDimensionStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n width: resolveDimension(theme, resolveResponsive(props.width, breakpoint)),\n height: resolveDimension(theme, resolveResponsive(props.height, breakpoint)),\n minWidth: resolveDimension(theme, resolveResponsive(props.minWidth, breakpoint)),\n maxWidth: resolveDimension(theme, resolveResponsive(props.maxWidth, breakpoint)),\n minHeight: resolveDimension(theme, resolveResponsive(props.minHeight, breakpoint)),\n maxHeight: resolveDimension(theme, resolveResponsive(props.maxHeight, breakpoint)),\n };\n}\n\n/*** Resolves responsive flex, positioning, and visibility styles. */\nfunction resolveLayoutStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n flex: resolveResponsive(props.flex, breakpoint),\n flexGrow: resolveResponsive(props.flexGrow, breakpoint),\n flexShrink: resolveResponsive(props.flexShrink, breakpoint),\n flexBasis: resolveDimension(theme, resolveResponsive(props.flexBasis, breakpoint)),\n flexDirection: resolveResponsive(props.direction, breakpoint),\n alignItems: resolveResponsive(props.align, breakpoint),\n justifyContent: resolveResponsive(props.justify, breakpoint),\n flexWrap: resolveResponsive(props.wrap, breakpoint),\n alignSelf: resolveResponsive(props.alignSelf, breakpoint),\n position: resolveResponsive(props.position, breakpoint),\n top: resolveResponsive(props.top, breakpoint),\n bottom: resolveResponsive(props.bottom, breakpoint),\n left: resolveResponsive(props.left, breakpoint),\n right: resolveResponsive(props.right, breakpoint),\n overflow: resolveResponsive(props.overflow, breakpoint),\n zIndex: resolveResponsive(props.zIndex, breakpoint),\n opacity: resolveResponsive(props.opacity, breakpoint),\n };\n}\n\n/*** Resolves a Surface radius token or raw number. */\nfunction resolveRadius(\n theme: SurfaceTheme,\n value: number | keyof SurfaceTheme['radii'] | undefined,\n): number | undefined {\n return resolveToken(theme.radii, value);\n}\n\n/*** Resolves a Surface color token while preserving arbitrary color strings. */\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n return resolveToken(theme.colors, value);\n}\n\ntype PortableDimensionValue = number | 'auto' | `${number}%`;\n\n/*** Resolves spacing-token dimensions into values portable across supported React Native lines. */\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): PortableDimensionValue | undefined {\n const resolved = resolveToken(theme.spacing, value);\n if (resolved === undefined || typeof resolved === 'number') return resolved;\n if (isPortableDimensionString(resolved)) return resolved;\n throw new Error(`Unsupported Surface dimension: ${JSON.stringify(resolved)}.`);\n}\n\n/*** Narrows raw dimension strings to the React Native values shared by supported versions. */\nfunction isPortableDimensionString(value: string): value is 'auto' | `${number}%` {\n return value === 'auto' || /^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)%$/u.test(value);\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "9.1.12",
4
+ "version": "9.1.14",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@ankhorage/color-theory": "^0.3.1",
47
- "@ankhorage/contracts": "^22.8.5",
48
- "@ankhorage/utility": "^1.9.1",
47
+ "@ankhorage/contracts": "^22.8.6",
48
+ "@ankhorage/utility": "^1.9.3",
49
49
  "@gorhom/bottom-sheet": "^5.2.14"
50
50
  },
51
51
  "files": [
@@ -37,6 +37,6 @@ function isImageUriSource(source: ImageSourcePropType): source is ImageURISource
37
37
  }
38
38
 
39
39
  /*** Narrows a React Native image source to the readonly multi-source form. */
40
- function isImageUriSourceList(source: ImageSourcePropType): source is readonly ImageURISource[] {
40
+ function isImageUriSourceList(source: ImageSourcePropType): source is ImageURISource[] {
41
41
  return Array.isArray(source);
42
42
  }
@@ -63,6 +63,23 @@ describe('resolveViewStyles visual and dimension styles', () => {
63
63
  expect(styles.maxWidth).toBe('50%');
64
64
  });
65
65
 
66
+ test('supports portable raw dimensions across React Native versions', () => {
67
+ const styles = resolveViewStyles(mockTheme, 'base', {
68
+ width: '50%',
69
+ height: 'auto',
70
+ flexBasis: '25%',
71
+ });
72
+ expect(styles.width).toBe('50%');
73
+ expect(styles.height).toBe('auto');
74
+ expect(styles.flexBasis).toBe('25%');
75
+ });
76
+
77
+ test('rejects raw dimensions that are not portable React Native values', () => {
78
+ expect(() => resolveViewStyles(mockTheme, 'base', { width: '100vh' })).toThrow(
79
+ 'Unsupported Surface dimension',
80
+ );
81
+ });
82
+
66
83
  test('handles undefined props gracefully', () => {
67
84
  const styles = resolveViewStyles(mockTheme, 'base', {});
68
85
  expect(styles.padding).toBeUndefined();
@@ -18,7 +18,7 @@ export function resolveViewStyles(
18
18
  ...resolveSpacingStyles(theme, breakpoint, props),
19
19
  ...resolveVisualStyles(theme, breakpoint, props),
20
20
  ...resolveDimensionStyles(theme, breakpoint, props),
21
- ...resolveLayoutStyles(breakpoint, props),
21
+ ...resolveLayoutStyles(theme, breakpoint, props),
22
22
  };
23
23
  }
24
24
 
@@ -80,12 +80,16 @@ function resolveDimensionStyles(
80
80
  }
81
81
 
82
82
  /*** Resolves responsive flex, positioning, and visibility styles. */
83
- function resolveLayoutStyles(breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle {
83
+ function resolveLayoutStyles(
84
+ theme: SurfaceTheme,
85
+ breakpoint: Breakpoint,
86
+ props: ViewStyleProps,
87
+ ): ViewStyle {
84
88
  return {
85
89
  flex: resolveResponsive(props.flex, breakpoint),
86
90
  flexGrow: resolveResponsive(props.flexGrow, breakpoint),
87
91
  flexShrink: resolveResponsive(props.flexShrink, breakpoint),
88
- flexBasis: resolveResponsive(props.flexBasis, breakpoint),
92
+ flexBasis: resolveDimension(theme, resolveResponsive(props.flexBasis, breakpoint)),
89
93
  flexDirection: resolveResponsive(props.direction, breakpoint),
90
94
  alignItems: resolveResponsive(props.align, breakpoint),
91
95
  justifyContent: resolveResponsive(props.justify, breakpoint),
@@ -115,10 +119,20 @@ function resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): strin
115
119
  return resolveToken(theme.colors, value);
116
120
  }
117
121
 
118
- /*** Resolves spacing-token dimensions while preserving raw dimension strings. */
122
+ type PortableDimensionValue = number | 'auto' | `${number}%`;
123
+
124
+ /*** Resolves spacing-token dimensions into values portable across supported React Native lines. */
119
125
  function resolveDimension(
120
126
  theme: SurfaceTheme,
121
127
  value: number | string | undefined,
122
- ): number | string | undefined {
123
- return resolveToken(theme.spacing, value);
128
+ ): PortableDimensionValue | undefined {
129
+ const resolved = resolveToken(theme.spacing, value);
130
+ if (resolved === undefined || typeof resolved === 'number') return resolved;
131
+ if (isPortableDimensionString(resolved)) return resolved;
132
+ throw new Error(`Unsupported Surface dimension: ${JSON.stringify(resolved)}.`);
133
+ }
134
+
135
+ /*** Narrows raw dimension strings to the React Native values shared by supported versions. */
136
+ function isPortableDimensionString(value: string): value is 'auto' | `${number}%` {
137
+ return value === 'auto' || /^-?(?:\d+(?:\.\d+)?|\.\d+)%$/u.test(value);
124
138
  }