@fluentui-react-native/experimental-shimmer 0.14.0 → 0.14.3

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/lib/Shimmer.d.ts +2 -7
  3. package/lib/Shimmer.d.ts.map +1 -1
  4. package/lib/Shimmer.js +77 -149
  5. package/lib/Shimmer.js.map +1 -1
  6. package/lib/Shimmer.styling.d.ts +1 -1
  7. package/lib/Shimmer.styling.js +26 -29
  8. package/lib/Shimmer.styling.win32.d.ts +1 -1
  9. package/lib/Shimmer.styling.win32.js +24 -36
  10. package/lib/Shimmer.test.d.ts +1 -1
  11. package/lib/Shimmer.test.js +45 -45
  12. package/lib/Shimmer.test.js.map +1 -1
  13. package/lib/Shimmer.types.d.ts +2 -10
  14. package/lib/Shimmer.types.js +1 -1
  15. package/lib/Shimmer.types.shared.d.ts +123 -123
  16. package/lib/Shimmer.types.shared.d.ts.map +1 -1
  17. package/lib/Shimmer.types.shared.js +1 -1
  18. package/lib/Shimmer.types.win32.d.ts +26 -26
  19. package/lib/Shimmer.types.win32.js +1 -1
  20. package/lib/Shimmer.win32.d.ts +2 -7
  21. package/lib/Shimmer.win32.js +107 -137
  22. package/lib/ShimmerTokens.android.d.ts +1 -1
  23. package/lib/ShimmerTokens.android.js +8 -8
  24. package/lib/ShimmerTokens.android.js.map +1 -1
  25. package/lib/ShimmerTokens.d.ts +1 -1
  26. package/lib/ShimmerTokens.ios.d.ts +1 -1
  27. package/lib/ShimmerTokens.ios.js +8 -8
  28. package/lib/ShimmerTokens.ios.js.map +1 -1
  29. package/lib/ShimmerTokens.js +9 -9
  30. package/lib/ShimmerTokens.js.map +1 -1
  31. package/lib/ShimmerTokens.win32.d.ts +1 -1
  32. package/lib/ShimmerTokens.win32.js +10 -10
  33. package/lib/ShimmerTokens.win32.js.map +1 -1
  34. package/lib/SvgShapeToPath.d.ts +1 -1
  35. package/lib/SvgShapeToPath.js +120 -134
  36. package/lib/Win32ShimmerNativeComponent.d.ts +4 -4
  37. package/lib/Win32ShimmerNativeComponent.js +1 -1
  38. package/lib/consts.android.d.ts +1 -1
  39. package/lib/consts.android.js +1 -1
  40. package/lib/consts.d.ts +1 -1
  41. package/lib/consts.ios.d.ts +1 -1
  42. package/lib/consts.ios.js +1 -1
  43. package/lib/consts.js +1 -1
  44. package/lib/consts.win32.d.ts +1 -1
  45. package/lib/consts.win32.js +1 -1
  46. package/lib/index.d.ts +2 -10
  47. package/lib/index.js +1 -1
  48. package/lib-commonjs/Shimmer.d.ts +2 -7
  49. package/lib-commonjs/Shimmer.d.ts.map +1 -1
  50. package/lib-commonjs/Shimmer.js +89 -163
  51. package/lib-commonjs/Shimmer.js.map +1 -1
  52. package/lib-commonjs/Shimmer.styling.d.ts +1 -1
  53. package/lib-commonjs/Shimmer.styling.js +31 -34
  54. package/lib-commonjs/Shimmer.styling.win32.d.ts +1 -1
  55. package/lib-commonjs/Shimmer.styling.win32.js +29 -41
  56. package/lib-commonjs/Shimmer.test.d.ts +1 -1
  57. package/lib-commonjs/Shimmer.test.js +79 -96
  58. package/lib-commonjs/Shimmer.test.js.map +1 -1
  59. package/lib-commonjs/Shimmer.types.d.ts +2 -10
  60. package/lib-commonjs/Shimmer.types.js +5 -10
  61. package/lib-commonjs/Shimmer.types.shared.d.ts +123 -123
  62. package/lib-commonjs/Shimmer.types.shared.d.ts.map +1 -1
  63. package/lib-commonjs/Shimmer.types.shared.js +3 -3
  64. package/lib-commonjs/Shimmer.types.win32.d.ts +26 -26
  65. package/lib-commonjs/Shimmer.types.win32.js +5 -10
  66. package/lib-commonjs/Shimmer.win32.d.ts +2 -7
  67. package/lib-commonjs/Shimmer.win32.js +120 -164
  68. package/lib-commonjs/ShimmerTokens.android.d.ts +1 -1
  69. package/lib-commonjs/ShimmerTokens.android.js +11 -11
  70. package/lib-commonjs/ShimmerTokens.android.js.map +1 -1
  71. package/lib-commonjs/ShimmerTokens.d.ts +1 -1
  72. package/lib-commonjs/ShimmerTokens.ios.d.ts +1 -1
  73. package/lib-commonjs/ShimmerTokens.ios.js +11 -11
  74. package/lib-commonjs/ShimmerTokens.ios.js.map +1 -1
  75. package/lib-commonjs/ShimmerTokens.js +13 -13
  76. package/lib-commonjs/ShimmerTokens.js.map +1 -1
  77. package/lib-commonjs/ShimmerTokens.win32.d.ts +1 -1
  78. package/lib-commonjs/ShimmerTokens.win32.js +13 -13
  79. package/lib-commonjs/ShimmerTokens.win32.js.map +1 -1
  80. package/lib-commonjs/SvgShapeToPath.d.ts +1 -1
  81. package/lib-commonjs/SvgShapeToPath.js +122 -136
  82. package/lib-commonjs/Win32ShimmerNativeComponent.d.ts +4 -4
  83. package/lib-commonjs/Win32ShimmerNativeComponent.js +4 -4
  84. package/lib-commonjs/consts.android.d.ts +1 -1
  85. package/lib-commonjs/consts.android.js +3 -3
  86. package/lib-commonjs/consts.d.ts +1 -1
  87. package/lib-commonjs/consts.ios.d.ts +1 -1
  88. package/lib-commonjs/consts.ios.js +3 -3
  89. package/lib-commonjs/consts.js +3 -3
  90. package/lib-commonjs/consts.win32.d.ts +1 -1
  91. package/lib-commonjs/consts.win32.js +3 -3
  92. package/lib-commonjs/index.d.ts +2 -10
  93. package/lib-commonjs/index.js +11 -36
  94. package/package.json +26 -25
  95. package/src/Shimmer.test.tsx +1 -1
  96. package/src/Shimmer.tsx +4 -14
  97. package/src/Shimmer.types.shared.ts +1 -1
  98. package/src/ShimmerTokens.android.ts +1 -1
  99. package/src/ShimmerTokens.ios.ts +1 -1
  100. package/src/ShimmerTokens.ts +1 -1
  101. package/src/ShimmerTokens.win32.ts +1 -1
  102. package/eslint.config.js +0 -3
@@ -1,11 +1,11 @@
1
1
  import { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
2
2
  export const defaultShimmerTokens = (theme) => ({
3
- angle: shimmerDefaultAngle,
4
- delay: shimmerDefaultDelay,
5
- duration: shimmerDefaultDuration,
6
- shimmerColor: theme.colors.neutralStencil1,
7
- shimmerColorOpacity: 1,
8
- shimmerWaveColor: theme.colors.neutralStencil2,
9
- shimmerWaveColorOpacity: 1,
3
+ angle: shimmerDefaultAngle,
4
+ delay: shimmerDefaultDelay,
5
+ duration: shimmerDefaultDuration,
6
+ shimmerColor: theme.colors.neutralStencil1,
7
+ shimmerColorOpacity: 1,
8
+ shimmerWaveColor: theme.colors.neutralStencil2,
9
+ shimmerWaveColorOpacity: 1,
10
10
  });
11
- //# sourceMappingURL=ShimmerTokens.android.js.map
11
+ //# sourceMappingURL=ShimmerTokens.android.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShimmerTokens.android.js","sourceRoot":"","sources":["../src/ShimmerTokens.android.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,EACvF;IACC,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CACT,CAAA,CAAC"}
1
+ {"version":3,"file":"ShimmerTokens.android.js","sourceRoot":"","sources":["../src/ShimmerTokens.android.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC"}
@@ -2,4 +2,4 @@ import type { Theme } from '@fluentui-react-native/framework';
2
2
  import type { TokenSettings } from '@fluentui-react-native/use-styling';
3
3
  import type { ShimmerTokens } from './Shimmer.types';
4
4
  export declare const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme>;
5
- //# sourceMappingURL=ShimmerTokens.d.ts.map
5
+ //# sourceMappingURL=ShimmerTokens.d.ts.map
@@ -2,4 +2,4 @@ import type { Theme } from '@fluentui-react-native/framework';
2
2
  import type { TokenSettings } from '@fluentui-react-native/use-styling';
3
3
  import type { ShimmerTokens } from './Shimmer.types';
4
4
  export declare const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme>;
5
- //# sourceMappingURL=ShimmerTokens.ios.d.ts.map
5
+ //# sourceMappingURL=ShimmerTokens.ios.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
2
2
  export const defaultShimmerTokens = (theme) => ({
3
- angle: shimmerDefaultAngle,
4
- delay: shimmerDefaultDelay,
5
- duration: shimmerDefaultDuration,
6
- shimmerColor: theme.colors.neutralStencil1,
7
- shimmerColorOpacity: 1,
8
- shimmerWaveColor: theme.colors.neutralStencil2,
9
- shimmerWaveColorOpacity: 1,
3
+ angle: shimmerDefaultAngle,
4
+ delay: shimmerDefaultDelay,
5
+ duration: shimmerDefaultDuration,
6
+ shimmerColor: theme.colors.neutralStencil1,
7
+ shimmerColorOpacity: 1,
8
+ shimmerWaveColor: theme.colors.neutralStencil2,
9
+ shimmerWaveColorOpacity: 1,
10
10
  });
11
- //# sourceMappingURL=ShimmerTokens.ios.js.map
11
+ //# sourceMappingURL=ShimmerTokens.ios.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShimmerTokens.ios.js","sourceRoot":"","sources":["../src/ShimmerTokens.ios.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,EACvF;IACC,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CACT,CAAA,CAAC"}
1
+ {"version":3,"file":"ShimmerTokens.ios.js","sourceRoot":"","sources":["../src/ShimmerTokens.ios.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { getCurrentAppearance } from '@fluentui-react-native/theming-utils';
2
2
  import { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
3
3
  export const defaultShimmerTokens = (theme) => ({
4
- angle: shimmerDefaultAngle,
5
- backgroundColor: theme.colors.transparentBackground,
6
- delay: shimmerDefaultDelay,
7
- duration: shimmerDefaultDuration,
8
- shimmerColor: getCurrentAppearance(theme.host.appearance, 'light') === 'light' ? '#E1E1E1' : '#404040',
9
- shimmerColorOpacity: 1,
10
- shimmerWaveColor: getCurrentAppearance(theme.host.appearance, 'light') === 'light' ? 'white' : 'black',
11
- shimmerWaveColorOpacity: 1,
4
+ angle: shimmerDefaultAngle,
5
+ backgroundColor: theme.colors.transparentBackground,
6
+ delay: shimmerDefaultDelay,
7
+ duration: shimmerDefaultDuration,
8
+ shimmerColor: getCurrentAppearance(theme.host.appearance, 'light') === 'light' ? '#E1E1E1' : '#404040',
9
+ shimmerColorOpacity: 1,
10
+ shimmerWaveColor: getCurrentAppearance(theme.host.appearance, 'light') === 'light' ? 'white' : 'black',
11
+ shimmerWaveColorOpacity: 1,
12
12
  });
13
- //# sourceMappingURL=ShimmerTokens.js.map
13
+ //# sourceMappingURL=ShimmerTokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShimmerTokens.js","sourceRoot":"","sources":["../src/ShimmerTokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,EACvF;IACC,KAAK,EAAE,mBAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB;IACnD,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;IACtG,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;IACtG,uBAAuB,EAAE,CAAC;CACT,CAAA,CAAC"}
1
+ {"version":3,"file":"ShimmerTokens.js","sourceRoot":"","sources":["../src/ShimmerTokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,mBAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB;IACnD,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;IACtG,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;IACtG,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC"}
@@ -2,4 +2,4 @@ import type { Theme } from '@fluentui-react-native/framework';
2
2
  import type { TokenSettings } from '@fluentui-react-native/use-styling';
3
3
  import type { ShimmerTokens } from './Shimmer.types';
4
4
  export declare const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme>;
5
- //# sourceMappingURL=ShimmerTokens.win32.d.ts.map
5
+ //# sourceMappingURL=ShimmerTokens.win32.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
2
2
  export const defaultShimmerTokens = (theme) => ({
3
- angle: shimmerDefaultAngle,
4
- backgroundColor: theme.colors.background,
5
- delay: shimmerDefaultDelay,
6
- duration: shimmerDefaultDuration,
7
- shimmerColor: theme.colors.bodyFrameDivider,
8
- shimmerColorOpacity: 1,
9
- shimmerWaveColor: '#E1E1E1',
10
- shimmerWaveColorOpacity: 1,
11
- shimmerWaveWidth: '100%',
3
+ angle: shimmerDefaultAngle,
4
+ backgroundColor: theme.colors.background,
5
+ delay: shimmerDefaultDelay,
6
+ duration: shimmerDefaultDuration,
7
+ shimmerColor: theme.colors.bodyFrameDivider,
8
+ shimmerColorOpacity: 1,
9
+ shimmerWaveColor: '#E1E1E1',
10
+ shimmerWaveColorOpacity: 1,
11
+ shimmerWaveWidth: '100%',
12
12
  });
13
- //# sourceMappingURL=ShimmerTokens.win32.js.map
13
+ //# sourceMappingURL=ShimmerTokens.win32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShimmerTokens.win32.js","sourceRoot":"","sources":["../src/ShimmerTokens.win32.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,EACvF;IACC,KAAK,EAAE,mBAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;IACxC,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;IAC3C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,SAAS;IAC3B,uBAAuB,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM;CACP,CAAA,CAAC"}
1
+ {"version":3,"file":"ShimmerTokens.win32.js","sourceRoot":"","sources":["../src/ShimmerTokens.win32.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,mBAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;IACxC,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;IAC3C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,SAAS;IAC3B,uBAAuB,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM;CACzB,CAAkB,CAAC"}
@@ -15,4 +15,4 @@
15
15
  import type { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
16
16
  export declare function convertRectToSvgPath(rectShape: ShimmerRectElement): string;
17
17
  export declare function convertCircleToSvgPath(circleShape: ShimmerCircleElement): string;
18
- //# sourceMappingURL=SvgShapeToPath.d.ts.map
18
+ //# sourceMappingURL=SvgShapeToPath.d.ts.map
@@ -17,142 +17,128 @@
17
17
  // borderRadius[X|Y] cannot be larger than [length/2 or width]/2; it would not be able to connect to the edge
18
18
  // segments of the rect if so, and will be reduced to the maximum values accordingly.
19
19
  function convertRoundedRectToSvgPath(x, y, borderRadiusX, borderRadiusY, width, height) {
20
- // Reduce borderRadii to maximum usable size.
21
- if (borderRadiusX * 2 > width) {
22
- borderRadiusX = width / 2;
23
- }
24
- if (borderRadiusY * 2 > height) {
25
- borderRadiusY = height / 2;
26
- }
27
- const horizontalEdgeLength = width - borderRadiusX * 2;
28
- const verticalEdgeLength = height - borderRadiusY * 2;
29
- const xAxisRotation = 0;
30
- const largeArcFlag = 0;
31
- const sweepArcFlag = 1;
32
- /**
33
- * The general manner in which we will draw our rounded rect is in the following
34
- * order of points.
35
- *
36
- * - Forward (/) and back (\) slashes represent borderRadiusY and borderRadiusX, respectively.
37
- * - The un-rounded rect points are represented by center dots (and steal 1 unit from the borderRadii).
38
- * - x and y parameters are left out as path arguments use relative coordinates (vs absolute coordinates).
39
- * - Coordinate axis aids are present to avoid counting for any necessary clarification.
40
- *
41
- * x: arbitrary
42
- * y: arbitrary
43
- * width: 24
44
- * height: 12
45
- * borderRadiusX: 5
46
- * borderRadiusY: 3
47
- *
48
- * 0123456789012345678901234
49
- *
50
- * (1+9) (2)
51
- * ⬇ ⬇
52
- * 0 •\\\\--------------\\\\•
53
- * 1 / /
54
- * 2 / /
55
- * 3 (8) ➡ | | ⬅ (3)
56
- * 4 | |
57
- * 5 | |
58
- * 6 | |
59
- * 7 | |
60
- * 8 | |
61
- * 9 (7) ➡ | | ⬅ (4)
62
- * 0 / /
63
- * 1 / /
64
- * 2 •\\\\--------------\\\\•
65
- * ⬆ ⬆
66
- * (6) (5)
67
- *
68
- * Which would generate the following path:
69
- * const path = 'M {x+5} ${y+3} ' +
70
- * 'h 14 ' +
71
- * 'a 5 3 0 0 1 5 3' +
72
- * 'v 6 ' +
73
- * 'a 5 3 0 0 1 -5 3' +
74
- * 'h -14 ' +
75
- * 'a 5 3 0 0 1 -5 -3' +
76
- * 'v -6 ' +
77
- * 'a 5 3 0 0 1 5 -3 Z';
78
- */
79
- // We start at the left-most point of the top edge.
80
- // M: lift and move the pen to [x] [y] coordinates -- does not draw.
81
- let path = ['M', x + borderRadiusX, y];
82
- // draw to the right-most point of the top edge.
83
- // h: horizontally draw a line [n] units relative to the current pen position.
84
- path = path.concat(['h', horizontalEdgeLength]);
85
- /**
86
- * draw the arc for the top-right corner. If the rect is not rounded, the arc will be 0 length.
87
- * a: draw an arc relative to the current pen position with the following parameters:
88
- * rx: X-axis ellipse radius
89
- * ry: Y-axis ellipse radius
90
- * x-axis-rotation: rotation of the ellipse relative to the current coordinate system
91
- * large-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
92
- * sweep-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
93
- * (dx, dy): relative end coordinate
94
- *
95
- * 'a rx ry x-axis-rotation large-arc-flag sweep-arc-flag dx dy'
96
- *
97
- * We will use x-axis-rotation = 0, large-arc-flag = 0, and sweep-arc-flag = 1 for our path generation.
98
- * */
99
- path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, borderRadiusY]);
100
- /**
101
- * Draw to the bottom-most point of the right edge.
102
- * v: vertically draw a line [n] units relative to the current pen position.
103
- */
104
- path = path.concat(['v', verticalEdgeLength]);
105
- /**
106
- * Draw the arc for the bottom-right corner.
107
- */
108
- path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, borderRadiusY]);
109
- /**
110
- * Draw to the left-most point of the bottom edge.
111
- */
112
- path = path.concat(['h', -horizontalEdgeLength]);
113
- /**
114
- * Draw the bottom-left corner.
115
- */
116
- path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, -borderRadiusY]);
117
- /**
118
- * Draw to the top-most point of the left edge.
119
- */
120
- path = path.concat(['v', -verticalEdgeLength]);
121
- /**
122
- * Draw the top-left corner.
123
- */
124
- path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, -borderRadiusY]);
125
- /**
126
- * Finally, close the shape. While we have manually returned to the same coordinate we started with, closing and not-closing the shape
127
- * can have different behavior depending on other properties.
128
- * z or Z: close the shape.
129
- */
130
- path = path.concat('z');
131
- /**
132
- * Join all arguments with spaces and return the completed path.
133
- */
134
- return path.join(' ');
20
+ // Reduce borderRadii to maximum usable size.
21
+ if (borderRadiusX * 2 > width) {
22
+ borderRadiusX = width / 2;
23
+ }
24
+ if (borderRadiusY * 2 > height) {
25
+ borderRadiusY = height / 2;
26
+ }
27
+ const horizontalEdgeLength = width - borderRadiusX * 2;
28
+ const verticalEdgeLength = height - borderRadiusY * 2;
29
+ const xAxisRotation = 0;
30
+ const largeArcFlag = 0;
31
+ const sweepArcFlag = 1;
32
+ /**
33
+ * The general manner in which we will draw our rounded rect is in the following
34
+ * order of points.
35
+ *
36
+ * - Forward (/) and back (\) slashes represent borderRadiusY and borderRadiusX, respectively.
37
+ * - The un-rounded rect points are represented by center dots (and steal 1 unit from the borderRadii).
38
+ * - x and y parameters are left out as path arguments use relative coordinates (vs absolute coordinates).
39
+ * - Coordinate axis aids are present to avoid counting for any necessary clarification.
40
+ *
41
+ * x: arbitrary
42
+ * y: arbitrary
43
+ * width: 24
44
+ * height: 12
45
+ * borderRadiusX: 5
46
+ * borderRadiusY: 3
47
+ *
48
+ * 0123456789012345678901234
49
+ *
50
+ * (1+9) (2)
51
+ * ⬇ ⬇
52
+ * 0 •\\\\--------------\\\\•
53
+ * 1 / /
54
+ * 2 / /
55
+ * 3 (8) ➡ | | ⬅ (3)
56
+ * 4 | |
57
+ * 5 | |
58
+ * 6 | |
59
+ * 7 | |
60
+ * 8 | |
61
+ * 9 (7) ➡ | | ⬅ (4)
62
+ * 0 / /
63
+ * 1 / /
64
+ * 2 •\\\\--------------\\\\•
65
+ * ⬆ ⬆
66
+ * (6) (5)
67
+ *
68
+ * Which would generate the following path:
69
+ * const path = 'M {x+5} ${y+3} ' +
70
+ * 'h 14 ' +
71
+ * 'a 5 3 0 0 1 5 3' +
72
+ * 'v 6 ' +
73
+ * 'a 5 3 0 0 1 -5 3' +
74
+ * 'h -14 ' +
75
+ * 'a 5 3 0 0 1 -5 -3' +
76
+ * 'v -6 ' +
77
+ * 'a 5 3 0 0 1 5 -3 Z';
78
+ */
79
+ // We start at the left-most point of the top edge.
80
+ // M: lift and move the pen to [x] [y] coordinates -- does not draw.
81
+ let path = ['M', x + borderRadiusX, y];
82
+ // draw to the right-most point of the top edge.
83
+ // h: horizontally draw a line [n] units relative to the current pen position.
84
+ path = path.concat(['h', horizontalEdgeLength]);
85
+ /**
86
+ * draw the arc for the top-right corner. If the rect is not rounded, the arc will be 0 length.
87
+ * a: draw an arc relative to the current pen position with the following parameters:
88
+ * rx: X-axis ellipse radius
89
+ * ry: Y-axis ellipse radius
90
+ * x-axis-rotation: rotation of the ellipse relative to the current coordinate system
91
+ * large-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
92
+ * sweep-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
93
+ * (dx, dy): relative end coordinate
94
+ *
95
+ * 'a rx ry x-axis-rotation large-arc-flag sweep-arc-flag dx dy'
96
+ *
97
+ * We will use x-axis-rotation = 0, large-arc-flag = 0, and sweep-arc-flag = 1 for our path generation.
98
+ * */
99
+ path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, borderRadiusY]);
100
+ /**
101
+ * Draw to the bottom-most point of the right edge.
102
+ * v: vertically draw a line [n] units relative to the current pen position.
103
+ */
104
+ path = path.concat(['v', verticalEdgeLength]);
105
+ /**
106
+ * Draw the arc for the bottom-right corner.
107
+ */
108
+ path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, borderRadiusY]);
109
+ /**
110
+ * Draw to the left-most point of the bottom edge.
111
+ */
112
+ path = path.concat(['h', -horizontalEdgeLength]);
113
+ /**
114
+ * Draw the bottom-left corner.
115
+ */
116
+ path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, -borderRadiusY]);
117
+ /**
118
+ * Draw to the top-most point of the left edge.
119
+ */
120
+ path = path.concat(['v', -verticalEdgeLength]);
121
+ /**
122
+ * Draw the top-left corner.
123
+ */
124
+ path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, -borderRadiusY]);
125
+ /**
126
+ * Finally, close the shape. While we have manually returned to the same coordinate we started with, closing and not-closing the shape
127
+ * can have different behavior depending on other properties.
128
+ * z or Z: close the shape.
129
+ */
130
+ path = path.concat('z');
131
+ /**
132
+ * Join all arguments with spaces and return the completed path.
133
+ */
134
+ return path.join(' ');
135
135
  }
136
136
  export function convertRectToSvgPath(rectShape) {
137
- // Extract necessary args and generate the corresponding path for the shape.
138
- return convertRoundedRectToSvgPath(
139
- rectShape.x ? rectShape.x : 0,
140
- rectShape.y ? rectShape.y : 0,
141
- rectShape.borderRadiusX ? rectShape.borderRadiusX : 0,
142
- rectShape.borderRadiusX ? rectShape.borderRadiusY : 0,
143
- rectShape.width ? rectShape.width : 100,
144
- rectShape.height ? rectShape.height : 16,
145
- );
137
+ // Extract necessary args and generate the corresponding path for the shape.
138
+ return convertRoundedRectToSvgPath(rectShape.x ? rectShape.x : 0, rectShape.y ? rectShape.y : 0, rectShape.borderRadiusX ? rectShape.borderRadiusX : 0, rectShape.borderRadiusX ? rectShape.borderRadiusY : 0, rectShape.width ? rectShape.width : 100, rectShape.height ? rectShape.height : 16);
146
139
  }
147
140
  export function convertCircleToSvgPath(circleShape) {
148
- const radius = circleShape.radius ? circleShape.radius : 12;
149
- return convertRoundedRectToSvgPath(
150
- circleShape.cx ? circleShape.cx - circleShape.radius : 12,
151
- circleShape.cy ? circleShape.cy - circleShape.radius : 12,
152
- radius,
153
- radius,
154
- radius * 2,
155
- radius * 2,
156
- );
141
+ const radius = circleShape.radius ? circleShape.radius : 12;
142
+ return convertRoundedRectToSvgPath(circleShape.cx ? circleShape.cx - circleShape.radius : 12, circleShape.cy ? circleShape.cy - circleShape.radius : 12, radius, radius, radius * 2, radius * 2);
157
143
  }
158
- //# sourceMappingURL=SvgShapeToPath.js.map
144
+ //# sourceMappingURL=SvgShapeToPath.js.map
@@ -6,9 +6,9 @@
6
6
  import type { ViewProps } from 'react-native';
7
7
  import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
8
8
  export interface NativeProps extends ViewProps {
9
- delay?: Double;
10
- duration?: Double;
9
+ delay?: Double;
10
+ duration?: Double;
11
11
  }
12
- declare const _default: import('react-native').HostComponent<NativeProps>;
12
+ declare const _default: import("react-native").HostComponent<NativeProps>;
13
13
  export default _default;
14
- //# sourceMappingURL=Win32ShimmerNativeComponent.d.ts.map
14
+ //# sourceMappingURL=Win32ShimmerNativeComponent.d.ts.map
@@ -5,4 +5,4 @@
5
5
  */
6
6
  import { requireNativeComponent } from 'react-native';
7
7
  export default requireNativeComponent('RCTNativeAnimatedShimmer');
8
- //# sourceMappingURL=Win32ShimmerNativeComponent.js.map
8
+ //# sourceMappingURL=Win32ShimmerNativeComponent.js.map
@@ -1,4 +1,4 @@
1
1
  export declare const shimmerDefaultAngle = 45;
2
2
  export declare const shimmerDefaultDelay = 0;
3
3
  export declare const shimmerDefaultDuration = 1000;
4
- //# sourceMappingURL=consts.android.d.ts.map
4
+ //# sourceMappingURL=consts.android.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const shimmerDefaultAngle = 45;
2
2
  export const shimmerDefaultDelay = 0;
3
3
  export const shimmerDefaultDuration = 1000;
4
- //# sourceMappingURL=consts.android.js.map
4
+ //# sourceMappingURL=consts.android.js.map
package/lib/consts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const shimmerDefaultAngle = 0;
2
2
  export declare const shimmerDefaultDelay = 0;
3
3
  export declare const shimmerDefaultDuration = 7000;
4
- //# sourceMappingURL=consts.d.ts.map
4
+ //# sourceMappingURL=consts.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const shimmerDefaultAngle = 0;
2
2
  export declare const shimmerDefaultDelay = 0;
3
3
  export declare const shimmerDefaultDuration = 1000;
4
- //# sourceMappingURL=consts.ios.d.ts.map
4
+ //# sourceMappingURL=consts.ios.d.ts.map
package/lib/consts.ios.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export const shimmerDefaultAngle = 0;
2
2
  export const shimmerDefaultDelay = 0;
3
3
  export const shimmerDefaultDuration = 1000;
4
- //# sourceMappingURL=consts.ios.js.map
4
+ //# sourceMappingURL=consts.ios.js.map
package/lib/consts.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export const shimmerDefaultAngle = 0;
2
2
  export const shimmerDefaultDelay = 0;
3
3
  export const shimmerDefaultDuration = 7000;
4
- //# sourceMappingURL=consts.js.map
4
+ //# sourceMappingURL=consts.js.map
@@ -1,4 +1,4 @@
1
1
  export declare const shimmerDefaultAngle = 0;
2
2
  export declare const shimmerDefaultDelay = 500;
3
3
  export declare const shimmerDefaultDuration = 2000;
4
- //# sourceMappingURL=consts.win32.d.ts.map
4
+ //# sourceMappingURL=consts.win32.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const shimmerDefaultAngle = 0;
2
2
  export const shimmerDefaultDelay = 500;
3
3
  export const shimmerDefaultDuration = 2000;
4
- //# sourceMappingURL=consts.win32.js.map
4
+ //# sourceMappingURL=consts.win32.js.map
package/lib/index.d.ts CHANGED
@@ -1,13 +1,5 @@
1
1
  export { Shimmer } from './Shimmer';
2
2
  export { shimmerName } from './Shimmer.types';
3
- export type {
4
- ShimmerCircleElement,
5
- ShimmerElementTypes,
6
- ShimmerProps,
7
- ShimmerRectElement,
8
- ShimmerSlotProps,
9
- ShimmerTokens,
10
- ShimmerType,
11
- } from './Shimmer.types';
3
+ export type { ShimmerCircleElement, ShimmerElementTypes, ShimmerProps, ShimmerRectElement, ShimmerSlotProps, ShimmerTokens, ShimmerType, } from './Shimmer.types';
12
4
  export { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
13
- //# sourceMappingURL=index.d.ts.map
5
+ //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Shimmer } from './Shimmer';
2
2
  export { shimmerName } from './Shimmer.types';
3
3
  export { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -1,8 +1,3 @@
1
1
  import type { ShimmerProps } from './Shimmer.types';
2
- export declare const Shimmer: import('@fluentui-react-native/framework').ComposableComponent<
3
- ShimmerProps,
4
- import('./Shimmer.types.shared').ShimmerSlotProps,
5
- import('./Shimmer.types.shared').ShimmerTokens,
6
- import('@fluentui-react-native/framework').ObjectBase
7
- >;
8
- //# sourceMappingURL=Shimmer.d.ts.map
2
+ export declare const Shimmer: import("@fluentui-react-native/framework").ComposableComponent<ShimmerProps, import("./Shimmer.types.shared").ShimmerSlotProps, import("./Shimmer.types.shared").ShimmerTokens, import("@fluentui-react-native/framework").ObjectBase>;
3
+ //# sourceMappingURL=Shimmer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../src/Shimmer.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAIjE,eAAO,MAAM,OAAO,wOAmIlB,CAAC"}
1
+ {"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../src/Shimmer.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAIjE,eAAO,MAAM,OAAO,wOAyHlB,CAAC"}