@office-iss/react-native-win32 0.71.13 → 0.71.15

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.json CHANGED
@@ -2,7 +2,43 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 04 Aug 2023 23:48:53 GMT",
5
+ "date": "Mon, 28 Aug 2023 15:14:00 GMT",
6
+ "tag": "@office-iss/react-native-win32_v0.71.15",
7
+ "version": "0.71.15",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "krsiler@microsoft.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "3183aace3dc9e1a687df06c6c86792d96619c285",
14
+ "comment": "fix a11yState and add support for aria-required and -multiselectable"
15
+ },
16
+ {
17
+ "author": "30809111+acoates-ms@users.noreply.github.com",
18
+ "package": "@office-iss/react-native-win32",
19
+ "commit": "acc90938f92e73823f2137ae2d8d958c8983f310",
20
+ "comment": "Remove flow usage from saveAssetPlugin codeflow"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Fri, 11 Aug 2023 00:26:16 GMT",
27
+ "tag": "@office-iss/react-native-win32_v0.71.14",
28
+ "version": "0.71.14",
29
+ "comments": {
30
+ "patch": [
31
+ {
32
+ "author": "30809111+acoates-ms@users.noreply.github.com",
33
+ "package": "@office-iss/react-native-win32",
34
+ "commit": "819530506ec8814c704ca77907c632b75fc9d451",
35
+ "comment": "Add saveAssetPlugin to fix long path assets"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Fri, 04 Aug 2023 23:49:15 GMT",
6
42
  "tag": "@office-iss/react-native-win32_v0.71.13",
7
43
  "version": "0.71.13",
8
44
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,34 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- This log was last generated on Fri, 04 Aug 2023 23:48:53 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 28 Aug 2023 15:14:00 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.71.13
7
+ ## 0.71.15
8
8
 
9
- Fri, 04 Aug 2023 23:48:53 GMT
9
+ Mon, 28 Aug 2023 15:14:00 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - add isDefaultButton check to win32 (email not defined)
13
+ - fix a11yState and add support for aria-required and -multiselectable (krsiler@microsoft.com)
14
+ - Remove flow usage from saveAssetPlugin codeflow (30809111+acoates-ms@users.noreply.github.com)
14
15
 
16
+ ## 0.71.14
17
+
18
+ Fri, 11 Aug 2023 00:26:16 GMT
19
+
20
+ ### Patches
21
+
22
+ - Add saveAssetPlugin to fix long path assets (30809111+acoates-ms@users.noreply.github.com)
23
+
24
+ ## 0.71.13
25
+
26
+ Fri, 04 Aug 2023 23:49:15 GMT
27
+
28
+ ### Patches
29
+
30
+ - add isDefaultButton check to win32 (email not defined)
31
+
15
32
  ## 0.71.12
16
33
 
17
34
  Thu, 06 Jul 2023 20:21:35 GMT
@@ -74,6 +74,8 @@ type Props = $ReadOnly<{|
74
74
  'aria-disabled'?: ?boolean,
75
75
  'aria-expanded'?: ?boolean,
76
76
  'aria-selected'?: ?boolean,
77
+ 'aria-multiselectable'?: ?boolean, // Win32
78
+ 'aria-required'?: ?boolean, // Win32
77
79
  /**
78
80
  * A value indicating whether the accessibility elements contained within
79
81
  * this accessibility element are hidden.
@@ -257,6 +259,8 @@ function Pressable(props: Props, forwardedRef): React.Node {
257
259
  'aria-disabled': ariaDisabled,
258
260
  'aria-expanded': ariaExpanded,
259
261
  'aria-label': ariaLabel,
262
+ 'aria-multiselectable': ariaMultiselectable, // Win32
263
+ 'aria-required': ariaRequired, // Win32
260
264
  'aria-selected': ariaSelected,
261
265
  cancelable,
262
266
  children,
@@ -297,6 +301,8 @@ function Pressable(props: Props, forwardedRef): React.Node {
297
301
  checked: ariaChecked ?? accessibilityState?.checked,
298
302
  disabled: ariaDisabled ?? accessibilityState?.disabled,
299
303
  expanded: ariaExpanded ?? accessibilityState?.expanded,
304
+ multiselectable: ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
305
+ required: ariaRequired ?? accessibilityState?.required, // Win32
300
306
  selected: ariaSelected ?? accessibilityState?.selected,
301
307
  };
302
308
 
@@ -1101,6 +1101,8 @@ function InternalTextInput(props: Props): React.Node {
1101
1101
  'aria-disabled': ariaDisabled,
1102
1102
  'aria-expanded': ariaExpanded,
1103
1103
  'aria-selected': ariaSelected,
1104
+ 'aria-multiselectable': ariaMultiselectable, // Win32
1105
+ 'aria-required': ariaRequired, // Win32
1104
1106
  accessibilityState,
1105
1107
  id,
1106
1108
  tabIndex,
@@ -1491,6 +1493,8 @@ function InternalTextInput(props: Props): React.Node {
1491
1493
  ariaChecked != null ||
1492
1494
  ariaDisabled != null ||
1493
1495
  ariaExpanded != null ||
1496
+ ariaMultiselectable != null ||
1497
+ ariaRequired != null ||
1494
1498
  ariaSelected != null
1495
1499
  ) {
1496
1500
  _accessibilityState = {
@@ -1498,6 +1502,9 @@ function InternalTextInput(props: Props): React.Node {
1498
1502
  checked: ariaChecked ?? accessibilityState?.checked,
1499
1503
  disabled: ariaDisabled ?? accessibilityState?.disabled,
1500
1504
  expanded: ariaExpanded ?? accessibilityState?.expanded,
1505
+ multiselectable:
1506
+ ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
1507
+ required: ariaRequired ?? accessibilityState?.required, // Win32
1501
1508
  selected: ariaSelected ?? accessibilityState?.selected,
1502
1509
  };
1503
1510
  }
@@ -50,6 +50,8 @@ const View: React.AbstractComponent<
50
50
  'aria-label': ariaLabel,
51
51
  'aria-labelledby': ariaLabelledBy,
52
52
  'aria-live': ariaLive,
53
+ 'aria-multiselectable': ariaMultiselectable, // Win32
54
+ 'aria-required': ariaRequired, // Win32
53
55
  'aria-selected': ariaSelected,
54
56
  'aria-valuemax': ariaValueMax,
55
57
  'aria-valuemin': ariaValueMin,
@@ -76,6 +78,8 @@ const View: React.AbstractComponent<
76
78
  ariaChecked != null ||
77
79
  ariaDisabled != null ||
78
80
  ariaExpanded != null ||
81
+ ariaMultiselectable != null ||
82
+ ariaRequired != null ||
79
83
  ariaSelected != null
80
84
  ) {
81
85
  _accessibilityState = {
@@ -83,6 +87,9 @@ const View: React.AbstractComponent<
83
87
  checked: ariaChecked ?? accessibilityState?.checked,
84
88
  disabled: ariaDisabled ?? accessibilityState?.disabled,
85
89
  expanded: ariaExpanded ?? accessibilityState?.expanded,
90
+ multiselectable:
91
+ ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
92
+ required: ariaRequired ?? accessibilityState?.required, // Win32
86
93
  selected: ariaSelected ?? accessibilityState?.selected,
87
94
  };
88
95
  }
@@ -57,6 +57,8 @@ export interface AccessibilityProps
57
57
  'aria-checked'?: boolean | 'mixed' | undefined;
58
58
  'aria-disabled'?: boolean | undefined;
59
59
  'aria-expanded'?: boolean | undefined;
60
+ 'aria-multiselectable'?: boolean | undefined; // Win32
61
+ 'aria-required'?: boolean | undefined; // Win32
60
62
  'aria-selected'?: boolean | undefined;
61
63
 
62
64
  /**
@@ -152,6 +152,8 @@ export type AccessibilityState = {
152
152
  checked?: ?boolean | 'mixed',
153
153
  busy?: boolean,
154
154
  expanded?: boolean,
155
+ multiselectable?: boolean, // Win32
156
+ required?: boolean, // Win32
155
157
  ...
156
158
  };
157
159
 
@@ -467,6 +467,8 @@ type WindowsViewProps = $ReadOnly<{|
467
467
 
468
468
  accessibilityPosInSet?: ?number,
469
469
  accessibilitySetSize?: ?number,
470
+ 'aria-multiselectable'?: ?boolean,
471
+ 'aria-required'?: ?boolean,
470
472
 
471
473
  /**
472
474
  * Specifies if the control should show System focus visuals
@@ -170,6 +170,8 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
170
170
  'aria-checked': ariaChecked,
171
171
  'aria-disabled': ariaDisabled,
172
172
  'aria-expanded': ariaExpanded,
173
+ 'aria-multiselectable': ariaMultiselectable, // Win32
174
+ 'aria-required': ariaRequired, // Win32
173
175
  'aria-selected': ariaSelected,
174
176
  height,
175
177
  src,
@@ -182,6 +184,9 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
182
184
  checked: ariaChecked ?? props.accessibilityState?.checked,
183
185
  disabled: ariaDisabled ?? props.accessibilityState?.disabled,
184
186
  expanded: ariaExpanded ?? props.accessibilityState?.expanded,
187
+ multiselectable:
188
+ ariaMultiselectable ?? props.accessibilityState?.multiselectable, // Win32
189
+ required: ariaRequired ?? props.accessibilityState?.required, // Win32
185
190
  selected: ariaSelected ?? props.accessibilityState?.selected,
186
191
  };
187
192
  const accessibilityLabel = props['aria-label'] ?? props.accessibilityLabel;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Dont use flow here, since this file is used by saveAssetPlugin.js which will run without flow transform
6
+ * @format
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ // Some windows machines may not have long paths enabled
12
+ // https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
13
+ // Assets in nested node_modules (common when using pnpm) - end up creating very long paths
14
+ // Using this function we shorten longer paths to prevent paths from hitting the path limit
15
+ function ensureShortPath(str) {
16
+ if (str.length < 40) return str;
17
+
18
+ const assetsPrefix = 'assets/';
19
+
20
+ if (!str.startsWith(assetsPrefix)) {
21
+ console.warn(`Unexpected asset uri - ${str} may not load correctly.`);
22
+ }
23
+
24
+ const postStr = str.slice(assetsPrefix.length);
25
+ var hash = 0,
26
+ i,
27
+ chr;
28
+ for (i = 0; i < postStr.length; i++) {
29
+ chr = postStr.charCodeAt(i);
30
+ hash = (hash << 5) - hash + chr;
31
+ hash |= 0; // Convert to 32bit integer
32
+ }
33
+ return assetsPrefix + hash.toString();
34
+ }
35
+
36
+ module.exports = ensureShortPath;
@@ -10,6 +10,7 @@
10
10
 
11
11
  const resolveAssetSource = require('./resolveAssetSource.js'); // Get base impl
12
12
  const Platform = require('../Utilities/Platform');
13
+ const ensureShortPath = require('./assetPaths.js');
13
14
 
14
15
  type IPackagerAsset = {
15
16
  __packager_asset: boolean,
@@ -56,7 +57,7 @@ class AssetResolverLateScaleResolution {
56
57
  */
57
58
  _scaledAssetURLInBundle() {
58
59
  const path = this._resolver.bundleUrl || 'file://';
59
- return this._fromSource(path + this._getAssetPath());
60
+ return this._fromSource(path + this._getAssetPath(true));
60
61
  }
61
62
 
62
63
  /**
@@ -66,7 +67,7 @@ class AssetResolverLateScaleResolution {
66
67
  _assetServerURL() {
67
68
  return this._fromSource(
68
69
  this._resolver.serverUrl +
69
- this._getAssetPath() +
70
+ this._getAssetPath(false) +
70
71
  '?platform=' +
71
72
  Platform.OS +
72
73
  '&hash=' +
@@ -77,8 +78,8 @@ class AssetResolverLateScaleResolution {
77
78
  /**
78
79
  * Returns a path like 'assets/AwesomeModule/icon.png'
79
80
  */
80
- _getAssetPath(): string {
81
- const assetDir = this._getBasePath();
81
+ _getAssetPath(local: boolean): string {
82
+ const assetDir = this._getBasePath(local);
82
83
  return (
83
84
  assetDir +
84
85
  '/' +
@@ -88,7 +89,19 @@ class AssetResolverLateScaleResolution {
88
89
  );
89
90
  }
90
91
 
91
- _getBasePath() {
92
+ _getBasePath(local: boolean) {
93
+ if (local) {
94
+ const safePath = this._resolver.asset.httpServerLocation
95
+ .substr(1)
96
+ .replace(/\.\.\//g, '_');
97
+ // If this asset was created with the newer saveAssetPlugin, then we should shorten the path
98
+ // This conditional is added to allow back compat of older bundles which might have been created without the saveAssetPlugin
99
+ if (this._resolver.asset.__useShortPath) {
100
+ return ensureShortPath(safePath);
101
+ }
102
+ return safePath;
103
+ }
104
+
92
105
  let basePath = this._resolver.asset.httpServerLocation;
93
106
  if (basePath[0] === '/') {
94
107
  basePath = basePath.substr(1);
package/metro.config.js CHANGED
@@ -14,3 +14,5 @@ if (
14
14
 
15
15
  const {makeMetroConfig} = require('@rnw-scripts/metro-dev-config');
16
16
  module.exports = makeMetroConfig();
17
+ // Enable this when RN CLI gets support for saveAssetPlugins: https://github.com/react-native-community/cli/pull/2002
18
+ // module.exports.transformer.assetPlugins = [require.resolve('./metroShortPathAssetDataPlugin.js')];
@@ -0,0 +1,15 @@
1
+ // @ts-check
2
+ /**
3
+ * @typedef {import("metro").AssetData} AssetData;
4
+ **/
5
+
6
+ /**
7
+ * @param {AssetData & {__useShortPath: boolean}} asset
8
+ * @returns {Promise<AssetData>}
9
+ */
10
+ async function metroShortPathAssetDataPlugin(asset) {
11
+ asset.__useShortPath = true;
12
+ return Promise.resolve(asset);
13
+ }
14
+
15
+ module.exports = metroShortPathAssetDataPlugin;
package/overrides.json CHANGED
@@ -221,6 +221,10 @@
221
221
  "baseHash": "37908d71eb9a61c619f700795ff2d692410c5a57",
222
222
  "issue": 5170
223
223
  },
224
+ {
225
+ "type": "platform",
226
+ "file": "src/Libraries/Image/assetPaths.js"
227
+ },
224
228
  {
225
229
  "type": "derived",
226
230
  "file": "src/Libraries/Image/Image.win32.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.71.13",
3
+ "version": "0.71.15",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "license": "MIT",
6
6
  "main": "./index.win32.js",
@@ -7,6 +7,8 @@ module.exports = {
7
7
  projectConfig: (projectRoot, projectParams) => null,
8
8
  dependencyConfig: (projectRoot, dependencyParams) => null,
9
9
  npmPackageName: '@office-iss/react-native-win32',
10
+ // Enable once CLI config supports it - https://github.com/react-native-community/cli/pull/2002
11
+ // saveAssetsPlugin: '@office-iss/react-native-win32/saveAssetPlugin'
10
12
  },
11
13
  },
12
14
  };
@@ -0,0 +1,45 @@
1
+ // @ts-check
2
+ const path = require('path');
3
+ const ensureShortPath = require('./Libraries/Image/assetPaths');
4
+
5
+ /**
6
+ * @typedef {import("metro").AssetData} AssetData;
7
+ **/
8
+
9
+ /**
10
+ * @param {AssetData} asset
11
+ * @param {number} scale
12
+ * @returns {string}
13
+ */
14
+ function getAssetDestPath(asset, scale) {
15
+ const suffix = scale === 1 ? '' : `@${scale}x`;
16
+ const fileName = `${asset.name + suffix}.${asset.type}`;
17
+ return path.join(
18
+ // Assets can have relative paths outside of the project root.
19
+ // Replace `../` with `_` to make sure they don't end up outside of
20
+ // the expected assets directory.
21
+ ensureShortPath(asset.httpServerLocation.substr(1).replace(/\.\.\//g, '_')),
22
+ fileName,
23
+ );
24
+ }
25
+
26
+ /**
27
+ * @param {ReadonlyArray<AssetData>} assets
28
+ * @param {string} _platform
29
+ * @param {string | undefined} _assetsDest
30
+ * @param {string | undefined} _assetCatalogDest
31
+ * @param {(asset: AssetData, allowedScales: number[] | undefined, getAssetDestPath: (asset: AssetData, scale: number) => string) => void} addAssetToCopy
32
+ */
33
+ function saveAssetsWin32(
34
+ assets,
35
+ _platform,
36
+ _assetsDest,
37
+ _assetCatalogDest,
38
+ addAssetToCopy,
39
+ ) {
40
+ assets.forEach((asset) =>
41
+ addAssetToCopy(asset, undefined, getAssetDestPath),
42
+ );
43
+ }
44
+
45
+ module.exports = saveAssetsWin32;
@@ -57,6 +57,8 @@ export interface AccessibilityProps
57
57
  'aria-checked'?: boolean | 'mixed' | undefined;
58
58
  'aria-disabled'?: boolean | undefined;
59
59
  'aria-expanded'?: boolean | undefined;
60
+ 'aria-multiselectable'?: boolean | undefined; // Win32
61
+ 'aria-required'?: boolean | undefined; // Win32
60
62
  'aria-selected'?: boolean | undefined;
61
63
 
62
64
  /**