react-native-unistyles 2.4.0-rc.0 → 2.4.0-rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/README.md +5 -2
  2. package/android/src/main/cxx/cpp-adapter.cpp +28 -13
  3. package/android/src/main/cxx/helpers.cpp +21 -56
  4. package/android/src/main/cxx/helpers.h +3 -3
  5. package/android/src/main/java/com/unistyles/Config.kt +116 -0
  6. package/android/src/main/java/com/unistyles/Insets.kt +138 -0
  7. package/android/src/main/java/com/unistyles/Models.kt +85 -0
  8. package/android/src/main/java/com/unistyles/Platform.kt +10 -79
  9. package/android/src/main/java/com/unistyles/UnistylesModule.kt +85 -25
  10. package/cxx/UnistylesRuntime.cpp +57 -42
  11. package/cxx/UnistylesRuntime.h +30 -19
  12. package/ios/UnistylesModule.mm +20 -6
  13. package/ios/platform/Platform_iOS.h +5 -4
  14. package/ios/platform/Platform_iOS.mm +35 -22
  15. package/ios/platform/Platform_macOS.h +5 -4
  16. package/ios/platform/Platform_macOS.mm +18 -25
  17. package/lib/commonjs/common.js +7 -0
  18. package/lib/commonjs/common.js.map +1 -1
  19. package/lib/commonjs/core/UnistylesModule.js +6 -0
  20. package/lib/commonjs/core/UnistylesModule.js.map +1 -1
  21. package/lib/commonjs/core/UnistylesRuntime.js +8 -0
  22. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  23. package/lib/commonjs/hooks/useUnistyles.js +18 -1
  24. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  25. package/lib/module/common.js +7 -0
  26. package/lib/module/common.js.map +1 -1
  27. package/lib/module/core/UnistylesModule.js +6 -0
  28. package/lib/module/core/UnistylesModule.js.map +1 -1
  29. package/lib/module/core/UnistylesRuntime.js +8 -0
  30. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  31. package/lib/module/hooks/useUnistyles.js +18 -1
  32. package/lib/module/hooks/useUnistyles.js.map +1 -1
  33. package/lib/typescript/src/common.d.ts +8 -1
  34. package/lib/typescript/src/common.d.ts.map +1 -1
  35. package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -1
  36. package/lib/typescript/src/core/UnistylesRuntime.d.ts +6 -1
  37. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  38. package/lib/typescript/src/hooks/useUnistyles.d.ts +14 -0
  39. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  40. package/lib/typescript/src/types/unistyles.d.ts +6 -2
  41. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/src/common.ts +8 -1
  44. package/src/core/UnistylesModule.ts +8 -2
  45. package/src/core/UnistylesRuntime.ts +8 -0
  46. package/src/hooks/useUnistyles.ts +18 -1
  47. package/src/types/unistyles.ts +6 -2
  48. package/windows/ReactNativeUnistyles/ReactNativeUnistyles.h +1 -1
  49. package/windows/ReactNativeUnistyles/ReactNativeUnistyles.vcxproj +8 -1
  50. package/windows/ReactNativeUnistyles/ReactNativeUnistyles.vcxproj.filters +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS,2CAEnB;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;;;OAKG;IACI,WAAW,SAAU,MAAM,eAAe,mBAAmB,eAAe,CAAC,MAAM,eAAe,CAAC,KAAK,eAAe,CAAC,MAAM,eAAe,CAAC,UAEpJ;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
1
+ {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS,wCAEnB;IAED;;;OAGG;IACH,IAAW,aAAa,wCAEvB;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;;;OAKG;IACI,WAAW,SAAU,MAAM,eAAe,mBAAmB,eAAe,CAAC,MAAM,eAAe,CAAC,KAAK,eAAe,CAAC,MAAM,eAAe,CAAC,UAEpJ;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
@@ -8,6 +8,20 @@ export declare const useUnistyles: () => {
8
8
  width: number;
9
9
  height: number;
10
10
  };
11
+ statusBar: {
12
+ width: number;
13
+ height: number;
14
+ };
15
+ navigationBar: {
16
+ width: number;
17
+ height: number;
18
+ };
19
+ insets: {
20
+ top: number;
21
+ bottom: number;
22
+ left: number;
23
+ right: number;
24
+ };
11
25
  };
12
26
  contentSizeCategory: import("../common").IOSContentSizeCategory | import("../common").AndroidContentSizeCategory;
13
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;;CAuDxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;CAwExB,CAAA"}
@@ -9,7 +9,7 @@ export type ScreenInsets = {
9
9
  bottom: number;
10
10
  left: number;
11
11
  };
12
- export type StatusBarDimensions = {
12
+ export type ScreenDimensions = {
13
13
  height: number;
14
14
  width: number;
15
15
  };
@@ -30,7 +30,8 @@ export type UnistylesBridge = {
30
30
  contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory;
31
31
  sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
32
32
  insets: ScreenInsets;
33
- statusBar: StatusBarDimensions;
33
+ statusBar: ScreenDimensions;
34
+ navigationBar: ScreenDimensions;
34
35
  themes: Array<keyof UnistylesThemes>;
35
36
  useBreakpoints(breakpoints: UnistylesBreakpoints): void;
36
37
  useTheme(name: keyof UnistylesThemes): void;
@@ -49,6 +50,9 @@ export type UnistylesMobileLayoutEvent = {
49
50
  type: UnistylesEventType.Layout;
50
51
  payload: {
51
52
  screen: ScreenSize;
53
+ statusBar: ScreenDimensions;
54
+ navigationBar: ScreenDimensions;
55
+ insets: ScreenInsets;
52
56
  breakpoint: keyof UnistylesBreakpoints;
53
57
  orientation: typeof ScreenOrientation[keyof typeof ScreenOrientation];
54
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mB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AAO,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACrD,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC;IAC/B,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,aAAa,EAAE,gBAAgB,CAAC;QAChC,MAAM,EAAE,YAAY,CAAC;QACrB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;KACxE,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,kBAAkB,CAAC,eAAe,CAAC;IACzC,OAAO,EAAE;QACL,mBAAmB,EAAE,sBAAsB,GAAG,0BAA0B,CAAA;KAC3E,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,GAAG,6BAA6B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.4.0-rc.0",
3
+ "version": "2.4.0-rc.2",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/common.ts CHANGED
@@ -16,6 +16,11 @@ export const ScreenOrientation = {
16
16
  } as const
17
17
 
18
18
  export enum IOSContentSizeCategory {
19
+ AccessibilityExtraExtraExtraLarge = 'accessibilityExtraExtraExtraLarge',
20
+ AccessibilityExtraExtraLarge = 'accessibilityExtraExtraLarge',
21
+ AccessibilityExtraLarge = 'accessibilityExtraLarge',
22
+ AccessibilityLarge = 'accessibilityLarge',
23
+ AccessibilityMedium = 'accessibilityMedium',
19
24
  ExtraExtraExtraLarge = 'xxxLarge',
20
25
  ExtraExtraLarge = 'xxLarge',
21
26
  ExtraLarge = 'xLarge',
@@ -31,7 +36,9 @@ export enum AndroidContentSizeCategory {
31
36
  Default = 'Default',
32
37
  Large = 'Large',
33
38
  ExtraLarge = 'ExtraLarge',
34
- Huge = 'Huge'
39
+ Huge = 'Huge',
40
+ ExtraHuge = 'ExtraHuge',
41
+ ExtraExtraHuge = 'ExtraExtraHuge'
35
42
  }
36
43
 
37
44
  export enum UnistylesEventType {
@@ -1,6 +1,6 @@
1
1
  import { NativeEventEmitter, NativeModules } from 'react-native'
2
2
  import type { UnistylesThemes, UnistylesBreakpoints } from 'react-native-unistyles'
3
- import type { ColorSchemeName, ScreenInsets, StatusBarDimensions } from '../types'
3
+ import type { ColorSchemeName, ScreenInsets, ScreenDimensions } from '../types'
4
4
  import { normalizeWebStylesPlugin } from '../plugins'
5
5
  import { isServer } from '../common'
6
6
 
@@ -25,7 +25,11 @@ export class UnistylesBridgeWeb {
25
25
  bottom: 0,
26
26
  left: 0
27
27
  }
28
- #statusBar: StatusBarDimensions = {
28
+ #statusBar: ScreenDimensions = {
29
+ height: 0,
30
+ width: 0
31
+ }
32
+ #navigationBar: ScreenDimensions = {
29
33
  height: 0,
30
34
  width: 0
31
35
  }
@@ -68,6 +72,8 @@ export class UnistylesBridgeWeb {
68
72
  return this.#insets
69
73
  case 'statusBar':
70
74
  return this.#statusBar
75
+ case 'navigationBar':
76
+ return this.#navigationBar
71
77
  case 'useTheme':
72
78
  return (themeName: keyof UnistylesThemes) => this.useTheme(themeName)
73
79
  case 'updateTheme':
@@ -92,6 +92,14 @@ export class UnistylesRuntime {
92
92
  return this.unistylesBridge.statusBar
93
93
  }
94
94
 
95
+ /**
96
+ * Get the navigation bar info (Android)
97
+ * @returns - The navigation bar size { width, height }
98
+ */
99
+ public get navigationBar() {
100
+ return this.unistylesBridge.navigationBar
101
+ }
102
+
95
103
  /**
96
104
  * Get the screen orientation
97
105
  * @returns - The screen orientation
@@ -16,6 +16,20 @@ export const useUnistyles = () => {
16
16
  screenSize: {
17
17
  width: unistyles.runtime.screen.width,
18
18
  height: unistyles.runtime.screen.height
19
+ },
20
+ statusBar: {
21
+ width: unistyles.runtime.statusBar.width,
22
+ height: unistyles.runtime.statusBar.height
23
+ },
24
+ navigationBar: {
25
+ width: unistyles.runtime.navigationBar.width,
26
+ height: unistyles.runtime.navigationBar.height
27
+ },
28
+ insets: {
29
+ top: unistyles.runtime.insets.top,
30
+ bottom: unistyles.runtime.insets.bottom,
31
+ left: unistyles.runtime.insets.left,
32
+ right: unistyles.runtime.insets.right
19
33
  }
20
34
  })
21
35
 
@@ -35,7 +49,10 @@ export const useUnistyles = () => {
35
49
  return setLayout({
36
50
  breakpoint: layoutEvent.payload.breakpoint,
37
51
  orientation: layoutEvent.payload.orientation,
38
- screenSize: layoutEvent.payload.screen
52
+ screenSize: layoutEvent.payload.screen,
53
+ statusBar: layoutEvent.payload.statusBar,
54
+ insets: layoutEvent.payload.insets,
55
+ navigationBar: layoutEvent.payload.navigationBar
39
56
  })
40
57
  }
41
58
  case UnistylesEventType.Plugin: {
@@ -12,7 +12,7 @@ export type ScreenInsets = {
12
12
  left: number
13
13
  }
14
14
 
15
- export type StatusBarDimensions = {
15
+ export type ScreenDimensions = {
16
16
  height: number,
17
17
  width: number
18
18
  }
@@ -36,7 +36,8 @@ export type UnistylesBridge = {
36
36
  contentSizeCategory: IOSContentSizeCategory | AndroidContentSizeCategory,
37
37
  sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>,
38
38
  insets: ScreenInsets,
39
- statusBar: StatusBarDimensions,
39
+ statusBar: ScreenDimensions,
40
+ navigationBar: ScreenDimensions
40
41
 
41
42
  // setters
42
43
  themes: Array<keyof UnistylesThemes>,
@@ -59,6 +60,9 @@ export type UnistylesMobileLayoutEvent = {
59
60
  type: UnistylesEventType.Layout,
60
61
  payload: {
61
62
  screen: ScreenSize,
63
+ statusBar: ScreenDimensions,
64
+ navigationBar: ScreenDimensions,
65
+ insets: ScreenInsets,
62
66
  breakpoint: keyof UnistylesBreakpoints,
63
67
  orientation: typeof ScreenOrientation[keyof typeof ScreenOrientation]
64
68
  }
@@ -39,7 +39,7 @@ struct Unistyles {
39
39
  auto bounds = Window::Current().Bounds();
40
40
 
41
41
  if (this->unistylesRuntime != nullptr) {
42
- ((UnistylesRuntime*)this->unistylesRuntime)->handleScreenSizeChange((int)bounds.Width, (int)bounds.Height, this.getInsets(), this.getStatusBarDimensions());
42
+ ((UnistylesRuntime*)this->unistylesRuntime)->handleScreenSizeChange((int)bounds.Width, (int)bounds.Height, this->getInsets(), this->getStatusBarDimensions());
43
43
  }
44
44
  }));
45
45
 
@@ -102,6 +102,8 @@
102
102
  <ClCompile>
103
103
  <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
104
104
  <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">../../cxx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
105
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../cxx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
106
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../cxx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
105
107
  </ClCompile>
106
108
  </ItemDefinitionGroup>
107
109
  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
@@ -119,6 +121,11 @@
119
121
  <ItemGroup>
120
122
  <ClCompile Include="..\..\cxx\UnistylesRuntime.cpp">
121
123
  <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">NotUsing</PrecompiledHeader>
124
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
125
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
126
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
127
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">NotUsing</PrecompiledHeader>
128
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
122
129
  </ClCompile>
123
130
  <ClCompile Include="pch.cpp">
124
131
  <PrecompiledHeader>Create</PrecompiledHeader>
@@ -147,4 +154,4 @@
147
154
  <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
148
155
  <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
149
156
  </Target>
150
- </Project>
157
+ </Project>
@@ -7,6 +7,7 @@
7
7
  <ClCompile Include="pch.cpp" />
8
8
  <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
9
9
  <ClCompile Include="ReactPackageProvider.cpp" />
10
+ <ClCompile Include="..\..\cxx\UnistylesRuntime.cpp" />
10
11
  </ItemGroup>
11
12
  <ItemGroup>
12
13
  <ClInclude Include="pch.h" />
@@ -16,4 +17,4 @@
16
17
  <ItemGroup>
17
18
  <None Include="PropertySheet.props" />
18
19
  </ItemGroup>
19
- </Project>
20
+ </Project>