@ankhorage/surface 3.0.1 → 3.0.2

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,11 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 6151096: Compile React Native Web box pointer-event modes through static styles so empty overlay roots no longer intercept application controls.
8
+
3
9
  ## 3.0.1
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePointerEvents.d.ts","sourceRoot":"","sources":["../../src/internal/resolvePointerEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAExF,UAAU,qBAAqB;IAC7B,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,GACrD,qBAAqB,CAEvB;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,EACtD,QAAQ,EAAE,OAAO,QAAQ,CAAC,EAAE,GAC3B,qBAAqB,CAYvB"}
1
+ {"version":3,"file":"resolvePointerEvents.d.ts","sourceRoot":"","sources":["../../src/internal/resolvePointerEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpG,UAAU,qBAAqB;IAC7B,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC7B;AASD,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,GACrD,qBAAqB,CAEvB;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,EACtD,QAAQ,EAAE,OAAO,QAAQ,CAAC,EAAE,GAC3B,qBAAqB,CAYvB"}
@@ -1,4 +1,10 @@
1
- import { Platform } from 'react-native';
1
+ import { Platform, StyleSheet } from 'react-native';
2
+ const webPointerEventStyles = StyleSheet.create({
3
+ auto: { pointerEvents: 'auto' },
4
+ 'box-none': { pointerEvents: 'box-none' },
5
+ 'box-only': { pointerEvents: 'box-only' },
6
+ none: { pointerEvents: 'none' },
7
+ });
2
8
  export function resolvePointerEvents(pointerEvents) {
3
9
  return resolvePointerEventsForPlatform(pointerEvents, Platform.OS);
4
10
  }
@@ -6,7 +12,7 @@ export function resolvePointerEventsForPlatform(pointerEvents, platform) {
6
12
  if (platform === 'web') {
7
13
  return {
8
14
  props: {},
9
- style: { pointerEvents },
15
+ style: getWebPointerEventStyle(pointerEvents),
10
16
  };
11
17
  }
12
18
  return {
@@ -14,4 +20,16 @@ export function resolvePointerEventsForPlatform(pointerEvents, platform) {
14
20
  style: null,
15
21
  };
16
22
  }
23
+ function getWebPointerEventStyle(pointerEvents) {
24
+ switch (pointerEvents) {
25
+ case 'auto':
26
+ return webPointerEventStyles.auto;
27
+ case 'box-none':
28
+ return webPointerEventStyles['box-none'];
29
+ case 'box-only':
30
+ return webPointerEventStyles['box-only'];
31
+ case 'none':
32
+ return webPointerEventStyles.none;
33
+ }
34
+ }
17
35
  //# sourceMappingURL=resolvePointerEvents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePointerEvents.js","sourceRoot":"","sources":["../../src/internal/resolvePointerEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkD,MAAM,cAAc,CAAC;AAOxF,MAAM,UAAU,oBAAoB,CAClC,aAAsD;IAEtD,OAAO,+BAA+B,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,aAAsD,EACtD,QAA4B;IAE5B,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,OAAO;YACL,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE,aAAa,EAAE;SACzB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,EAAE,aAAa,EAAE;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { Platform, type StyleProp, type ViewProps, type ViewStyle } from 'react-native';\n\ninterface ResolvedPointerEvents {\n props: Pick<ViewProps, 'pointerEvents'>;\n style: StyleProp<ViewStyle>;\n}\n\nexport function resolvePointerEvents(\n pointerEvents: NonNullable<ViewProps['pointerEvents']>,\n): ResolvedPointerEvents {\n return resolvePointerEventsForPlatform(pointerEvents, Platform.OS);\n}\n\nexport function resolvePointerEventsForPlatform(\n pointerEvents: NonNullable<ViewProps['pointerEvents']>,\n platform: typeof Platform.OS,\n): ResolvedPointerEvents {\n if (platform === 'web') {\n return {\n props: {},\n style: { pointerEvents },\n };\n }\n\n return {\n props: { pointerEvents },\n style: null,\n };\n}\n"]}
1
+ {"version":3,"file":"resolvePointerEvents.js","sourceRoot":"","sources":["../../src/internal/resolvePointerEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,UAAU,EAAkC,MAAM,cAAc,CAAC;AAOpG,MAAM,qBAAqB,GAAG,UAAU,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;IAC/B,UAAU,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE;IACzC,UAAU,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE;IACzC,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;CAChC,CAAC,CAAC;AAEH,MAAM,UAAU,oBAAoB,CAClC,aAAsD;IAEtD,OAAO,+BAA+B,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,aAAsD,EACtD,QAA4B;IAE5B,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,OAAO;YACL,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,uBAAuB,CAAC,aAAa,CAAC;SAC9C,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,EAAE,aAAa,EAAE;QACxB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,aAAsD;IAEtD,QAAQ,aAAa,EAAE,CAAC;QACtB,KAAK,MAAM;YACT,OAAO,qBAAqB,CAAC,IAAI,CAAC;QACpC,KAAK,UAAU;YACb,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC3C,KAAK,UAAU;YACb,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC3C,KAAK,MAAM;YACT,OAAO,qBAAqB,CAAC,IAAI,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["import { Platform, type StyleProp, StyleSheet, type ViewProps, type ViewStyle } from 'react-native';\n\ninterface ResolvedPointerEvents {\n props: Pick<ViewProps, 'pointerEvents'>;\n style: StyleProp<ViewStyle>;\n}\n\nconst webPointerEventStyles = StyleSheet.create({\n auto: { pointerEvents: 'auto' },\n 'box-none': { pointerEvents: 'box-none' },\n 'box-only': { pointerEvents: 'box-only' },\n none: { pointerEvents: 'none' },\n});\n\nexport function resolvePointerEvents(\n pointerEvents: NonNullable<ViewProps['pointerEvents']>,\n): ResolvedPointerEvents {\n return resolvePointerEventsForPlatform(pointerEvents, Platform.OS);\n}\n\nexport function resolvePointerEventsForPlatform(\n pointerEvents: NonNullable<ViewProps['pointerEvents']>,\n platform: typeof Platform.OS,\n): ResolvedPointerEvents {\n if (platform === 'web') {\n return {\n props: {},\n style: getWebPointerEventStyle(pointerEvents),\n };\n }\n\n return {\n props: { pointerEvents },\n style: null,\n };\n}\n\nfunction getWebPointerEventStyle(\n pointerEvents: NonNullable<ViewProps['pointerEvents']>,\n): ViewStyle {\n switch (pointerEvents) {\n case 'auto':\n return webPointerEventStyles.auto;\n case 'box-none':\n return webPointerEventStyles['box-none'];\n case 'box-only':\n return webPointerEventStyles['box-only'];\n case 'none':\n return webPointerEventStyles.none;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
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": {
@@ -65,7 +65,7 @@
65
65
  "changeset": "changeset",
66
66
  "changeset:status": "changeset status --since=origin/main",
67
67
  "docs": "paradox && ankhorage-prettier --write README.md paradox",
68
- "knip": "ankhorage-knip",
68
+ "knip:check": "ankhorage-knip",
69
69
  "lint": "ankhorage-eslint . --max-warnings=0",
70
70
  "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
71
71
  "format": "ankhorage-prettier --write .",
@@ -76,8 +76,8 @@
76
76
  "version-packages": "changeset version"
77
77
  },
78
78
  "devDependencies": {
79
- "@ankhorage/devtools": "^1.6.0",
80
- "@ankhorage/paradox": "^0.1.21",
79
+ "@ankhorage/devtools": "^1.7.0",
80
+ "@ankhorage/paradox": "^0.1.24",
81
81
  "@react-native-vector-icons/fontawesome": "^13.1.3",
82
82
  "@react-native-vector-icons/fontawesome5": "^13.1.3",
83
83
  "@react-native-vector-icons/fontawesome6": "^13.1.3",
@@ -1,10 +1,17 @@
1
- import { Platform, type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
1
+ import { Platform, type StyleProp, StyleSheet, type ViewProps, type ViewStyle } from 'react-native';
2
2
 
3
3
  interface ResolvedPointerEvents {
4
4
  props: Pick<ViewProps, 'pointerEvents'>;
5
5
  style: StyleProp<ViewStyle>;
6
6
  }
7
7
 
8
+ const webPointerEventStyles = StyleSheet.create({
9
+ auto: { pointerEvents: 'auto' },
10
+ 'box-none': { pointerEvents: 'box-none' },
11
+ 'box-only': { pointerEvents: 'box-only' },
12
+ none: { pointerEvents: 'none' },
13
+ });
14
+
8
15
  export function resolvePointerEvents(
9
16
  pointerEvents: NonNullable<ViewProps['pointerEvents']>,
10
17
  ): ResolvedPointerEvents {
@@ -18,7 +25,7 @@ export function resolvePointerEventsForPlatform(
18
25
  if (platform === 'web') {
19
26
  return {
20
27
  props: {},
21
- style: { pointerEvents },
28
+ style: getWebPointerEventStyle(pointerEvents),
22
29
  };
23
30
  }
24
31
 
@@ -27,3 +34,18 @@ export function resolvePointerEventsForPlatform(
27
34
  style: null,
28
35
  };
29
36
  }
37
+
38
+ function getWebPointerEventStyle(
39
+ pointerEvents: NonNullable<ViewProps['pointerEvents']>,
40
+ ): ViewStyle {
41
+ switch (pointerEvents) {
42
+ case 'auto':
43
+ return webPointerEventStyles.auto;
44
+ case 'box-none':
45
+ return webPointerEventStyles['box-none'];
46
+ case 'box-only':
47
+ return webPointerEventStyles['box-only'];
48
+ case 'none':
49
+ return webPointerEventStyles.none;
50
+ }
51
+ }
@@ -12,6 +12,7 @@ const { Container } = await import('./layout/Container');
12
12
  const { Grid } = await import('./layout/Grid');
13
13
  const { ScrollArea } = await import('./layout/ScrollArea');
14
14
  const { Show } = await import('./layout/Show');
15
+ const { OverlayProvider } = await import('./internal/overlay/OverlayProvider');
15
16
  const { ThemeProvider } = await import('./theme/ThemeContext');
16
17
 
17
18
  function ResponsiveAcceptanceTree() {
@@ -82,3 +83,14 @@ test('RN Web 0.21 statically renders and hydrates representative responsive prim
82
83
  Reflect.deleteProperty(globalThis, 'window');
83
84
  }
84
85
  });
86
+
87
+ test('RN Web 0.21 compiles box-none overlay pointer events into a hit-test-safe class', () => {
88
+ const markup = renderToString(
89
+ <OverlayProvider>
90
+ <ReactNativeWeb.View testID="interactive-content" />
91
+ </OverlayProvider>,
92
+ );
93
+
94
+ expect(markup).toContain('data-testid="interactive-content"');
95
+ expect(markup).toContain('r-pointerEvents-');
96
+ });