@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,145 +1,145 @@
1
1
  import type { ColorValue, ViewProps } from 'react-native';
2
2
  import type { IBackgroundColorTokens } from '@fluentui-react-native/tokens';
3
3
  import type { SvgProps } from 'react-native-svg';
4
- export declare const shimmerName = 'Shimmer';
4
+ export declare const shimmerName = "Shimmer";
5
5
  /**
6
6
  * Properties necessary to define a circular Shimmer element.
7
7
  */
8
8
  export interface ShimmerCircleElement {
9
- /**
10
- * Shimmer element type.
11
- */
12
- type: 'circle';
13
- /**
14
- * Radius of the circle element.
15
- * @defaultValue 12
16
- */
17
- radius?: number;
18
- /**
19
- * Note: cx and cy should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
20
- * Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
21
- */
22
- /**
23
- * The x-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
24
- */
25
- cx: number;
26
- /**
27
- * The y-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
28
- */
29
- cy: number;
9
+ /**
10
+ * Shimmer element type.
11
+ */
12
+ type: 'circle';
13
+ /**
14
+ * Radius of the circle element.
15
+ * @defaultValue 12
16
+ */
17
+ radius?: number;
18
+ /**
19
+ * Note: cx and cy should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
20
+ * Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
21
+ */
22
+ /**
23
+ * The x-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
24
+ */
25
+ cx: number;
26
+ /**
27
+ * The y-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
28
+ */
29
+ cy: number;
30
30
  }
31
31
  /**
32
32
  * Properties necessary to define a rectangular Shimmer element.
33
33
  */
34
34
  export interface ShimmerRectElement {
35
- /**
36
- * Shimmer element type.
37
- */
38
- type: 'rect';
39
- /**
40
- * Width of the rect.
41
- * @defaultValue 100%
42
- */
43
- width?: number;
44
- /**
45
- * Height of the rect.
46
- * @defaultValue 16
47
- */
48
- height?: number;
49
- /**
50
- * Border radius for the x-axis of a rounded rect.
51
- * @defaultValue 0
52
- */
53
- borderRadiusX?: number;
54
- /**
55
- * Border radius for the y-axis of a rounded rect.
56
- * @defaultValue 0
57
- */
58
- borderRadiusY?: number;
59
- /**
60
- * Note: x and y should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
61
- * Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
62
- */
63
- /**
64
- * The x-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
65
- */
66
- x: number;
67
- /**
68
- * The y-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
69
- */
70
- y: number;
35
+ /**
36
+ * Shimmer element type.
37
+ */
38
+ type: 'rect';
39
+ /**
40
+ * Width of the rect.
41
+ * @defaultValue 100%
42
+ */
43
+ width?: number;
44
+ /**
45
+ * Height of the rect.
46
+ * @defaultValue 16
47
+ */
48
+ height?: number;
49
+ /**
50
+ * Border radius for the x-axis of a rounded rect.
51
+ * @defaultValue 0
52
+ */
53
+ borderRadiusX?: number;
54
+ /**
55
+ * Border radius for the y-axis of a rounded rect.
56
+ * @defaultValue 0
57
+ */
58
+ borderRadiusY?: number;
59
+ /**
60
+ * Note: x and y should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
61
+ * Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
62
+ */
63
+ /**
64
+ * The x-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
65
+ */
66
+ x: number;
67
+ /**
68
+ * The y-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
69
+ */
70
+ y: number;
71
71
  }
72
72
  export type ShimmerElementTypes = ShimmerCircleElement | ShimmerRectElement;
73
73
  export interface ShimmerTokens extends IBackgroundColorTokens {
74
- /**
75
- * Specifies the Shimmer effect angle in degrees (produced by a gradient).
76
- *
77
- * @defaultValue 45 on @platform Android
78
- * @defaultValue 0 on other platforms.
79
- */
80
- angle?: number;
81
- /**
82
- * Specifies the animation delay time in milliseconds.
83
- *
84
- * @defaultValue 500 on @platform win32
85
- * @defaultValue 0 on other platforms.
86
- */
87
- delay?: number;
88
- /**
89
- * Specifies the time required to traverse the control in milliseconds.
90
- *
91
- * @defaultValue 1000 on @platform Android
92
- * @defaultValue 2000 on @platform win32
93
- * @defaultValue 7000 on other platforms.
94
- */
95
- duration?: number;
96
- /**
97
- * Specifies the opacity of the shimmer color.
98
- * @defaultValue 1
99
- */
100
- shimmerColorOpacity?: number;
101
- /**
102
- * Specifies the opacity of the wave color.
103
- * @defaultValue 1
104
- */
105
- shimmerWaveColorOpacity?: number;
106
- /**
107
- * Color you see when the shimmer wave is not animating.
108
- *
109
- * @defaultValue theme.colors.neutralStencil1 on @platform Android
110
- * @defaultValue theme.colors.bodyFrameDivider on @platform win32
111
- * @defaultValue #E1E1E1/#404040 for light/dark theme on other platforms.
112
- */
113
- shimmerColor?: ColorValue;
114
- /**
115
- * Defines the tip color of the wave which has a linear gradient.
116
- * from shimmerColor to shimmerWaveColor to shimmerColor.
117
- *
118
- * @defaultValue theme.colors.neutralStencil2 on @platform Android
119
- * @defaultValue #E1E1E1 on @platform win32
120
- * @defaultValue white/black for light/dark theme on other platforms.
121
- */
122
- shimmerWaveColor?: ColorValue;
123
- /**
124
- * Width of the Shimmer wave.
125
- *
126
- * @defaultValue '100%' of the 'width' property
127
- * @platform win32
128
- */
129
- shimmerWaveWidth?: number | string;
74
+ /**
75
+ * Specifies the Shimmer effect angle in degrees (produced by a gradient).
76
+ *
77
+ * @defaultValue 45 on @platform Android
78
+ * @defaultValue 0 on other platforms.
79
+ */
80
+ angle?: number;
81
+ /**
82
+ * Specifies the animation delay time in milliseconds.
83
+ *
84
+ * @defaultValue 500 on @platform win32
85
+ * @defaultValue 0 on other platforms.
86
+ */
87
+ delay?: number;
88
+ /**
89
+ * Specifies the time required to traverse the control in milliseconds.
90
+ *
91
+ * @defaultValue 1000 on @platform Android
92
+ * @defaultValue 2000 on @platform win32
93
+ * @defaultValue 7000 on other platforms.
94
+ */
95
+ duration?: number;
96
+ /**
97
+ * Specifies the opacity of the shimmer color.
98
+ * @defaultValue 1
99
+ */
100
+ shimmerColorOpacity?: number;
101
+ /**
102
+ * Specifies the opacity of the wave color.
103
+ * @defaultValue 1
104
+ */
105
+ shimmerWaveColorOpacity?: number;
106
+ /**
107
+ * Color you see when the shimmer wave is not animating.
108
+ *
109
+ * @defaultValue theme.colors.neutralStencil1 on @platform Android
110
+ * @defaultValue theme.colors.bodyFrameDivider on @platform win32
111
+ * @defaultValue #E1E1E1/#404040 for light/dark theme on other platforms.
112
+ */
113
+ shimmerColor?: ColorValue;
114
+ /**
115
+ * Defines the tip color of the wave which has a linear gradient.
116
+ * from shimmerColor to shimmerWaveColor to shimmerColor.
117
+ *
118
+ * @defaultValue theme.colors.neutralStencil2 on @platform Android
119
+ * @defaultValue #E1E1E1 on @platform win32
120
+ * @defaultValue white/black for light/dark theme on other platforms.
121
+ */
122
+ shimmerWaveColor?: ColorValue;
123
+ /**
124
+ * Width of the Shimmer wave.
125
+ *
126
+ * @defaultValue '100%' of the 'width' property
127
+ * @platform win32
128
+ */
129
+ shimmerWaveWidth?: number | string;
130
130
  }
131
131
  export interface ShimmerSlotProps {
132
- root: SvgProps;
132
+ root: SvgProps;
133
133
  }
134
134
  export interface ShimmerProps extends ViewProps, ShimmerTokens {
135
- /**
136
- * Shimmer shapes that define the masking effect of the Shimmer control.
137
- */
138
- elements: Array<ShimmerElementTypes>;
135
+ /**
136
+ * Shimmer shapes that define the masking effect of the Shimmer control.
137
+ */
138
+ elements: ShimmerElementTypes[];
139
139
  }
140
140
  export interface ShimmerType {
141
- props: ShimmerProps;
142
- slotProps: ShimmerSlotProps;
143
- tokens: ShimmerTokens;
141
+ props: ShimmerProps;
142
+ slotProps: ShimmerSlotProps;
143
+ tokens: ShimmerTokens;
144
144
  }
145
- //# sourceMappingURL=Shimmer.types.shared.d.ts.map
145
+ //# sourceMappingURL=Shimmer.types.shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Shimmer.types.shared.d.ts","sourceRoot":"","sources":["../src/Shimmer.types.shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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vB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IAEH;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IAEV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;AAE5E,MAAM,WAAW,aAAc,SAAQ,sBAAsB;IAC3D;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAE9B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,SAAS,EAAE,aAAa;IAC5D;;OAEG;IACH,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;CACvB"}
@@ -1,2 +1,2 @@
1
1
  export const shimmerName = 'Shimmer';
2
- //# sourceMappingURL=Shimmer.types.shared.js.map
2
+ //# sourceMappingURL=Shimmer.types.shared.js.map
@@ -4,36 +4,36 @@ export type { ShimmerProps, ShimmerTokens };
4
4
  export type { ShimmerRectElement, ShimmerElementTypes, ShimmerCircleElement } from './Shimmer.types.shared';
5
5
  export { shimmerName } from './Shimmer.types.shared';
6
6
  export interface ClippingMaskProps extends ShimmerTokens {
7
- /**
8
- * Extra parameter necessary to provide the mask effect generated from the provided ShimmerElements.
9
- *
10
- * @defaultValue null
11
- */
12
- clipPath?: string;
13
- /**
14
- * The height and width of the viewBox are internal props used by the SVG to size themselves and
15
- * set up their viewBox to establish coordinate space for DPI scaling purposes.
16
- */
17
- viewBoxHeight: number;
18
- viewBoxWidth: number;
7
+ /**
8
+ * Extra parameter necessary to provide the mask effect generated from the provided ShimmerElements.
9
+ *
10
+ * @defaultValue null
11
+ */
12
+ clipPath?: string;
13
+ /**
14
+ * The height and width of the viewBox are internal props used by the SVG to size themselves and
15
+ * set up their viewBox to establish coordinate space for DPI scaling purposes.
16
+ */
17
+ viewBoxHeight: number;
18
+ viewBoxWidth: number;
19
19
  }
20
20
  export interface ShimmerWaveProps extends ShimmerTokens {
21
- /**
22
- * The height and width of the viewBox are internal props used by the SVG to size themselves and
23
- * set up their viewBox to establish coordinate space for DPI scaling purposes.
24
- */
25
- viewBoxHeight: number;
26
- viewBoxWidth: number;
21
+ /**
22
+ * The height and width of the viewBox are internal props used by the SVG to size themselves and
23
+ * set up their viewBox to establish coordinate space for DPI scaling purposes.
24
+ */
25
+ viewBoxHeight: number;
26
+ viewBoxWidth: number;
27
27
  }
28
28
  export interface ShimmerSlotProps {
29
- root: ViewProps;
30
- clippingMask: ClippingMaskProps;
31
- shimmerWave: ShimmerWaveProps;
32
- shimmerWaveContainer: React.PropsWithChildren<ShimmerWaveProps>;
29
+ root: ViewProps;
30
+ clippingMask: ClippingMaskProps;
31
+ shimmerWave: ShimmerWaveProps;
32
+ shimmerWaveContainer: React.PropsWithChildren<ShimmerWaveProps>;
33
33
  }
34
34
  export interface ShimmerType {
35
- props: ShimmerProps;
36
- slotProps: ShimmerSlotProps;
37
- tokens: ShimmerTokens;
35
+ props: ShimmerProps;
36
+ slotProps: ShimmerSlotProps;
37
+ tokens: ShimmerTokens;
38
38
  }
39
- //# sourceMappingURL=Shimmer.types.win32.d.ts.map
39
+ //# sourceMappingURL=Shimmer.types.win32.d.ts.map
@@ -1,2 +1,2 @@
1
1
  export { shimmerName } from './Shimmer.types.shared';
2
- //# sourceMappingURL=Shimmer.types.win32.js.map
2
+ //# sourceMappingURL=Shimmer.types.win32.js.map
@@ -5,10 +5,5 @@
5
5
  */
6
6
  import type { ShimmerProps, ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types.shared';
7
7
  export type { ShimmerCircleElement, ShimmerRectElement };
8
- export declare const Shimmer: import('@fluentui-react-native/framework').ComposableComponent<
9
- ShimmerProps,
10
- import('./Shimmer.types.win32').ShimmerSlotProps,
11
- import('./Shimmer.types.shared').ShimmerTokens,
12
- import('@fluentui-react-native/framework-base').ObjectBase
13
- >;
14
- //# sourceMappingURL=Shimmer.win32.d.ts.map
8
+ export declare const Shimmer: import("@fluentui-react-native/framework").ComposableComponent<ShimmerProps, import("./Shimmer.types.win32").ShimmerSlotProps, import("./Shimmer.types.shared").ShimmerTokens, import("@fluentui-react-native/framework-base").ObjectBase>;
9
+ //# sourceMappingURL=Shimmer.win32.d.ts.map
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from '@fluentui-react-native/framework-base/jsx-runtime';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui-react-native/framework-base/jsx-runtime";
2
2
  /**
3
3
  * Copyright (c) Microsoft Corporation.
4
4
  * Licensed under the MIT License.
@@ -14,146 +14,116 @@ import { shimmerName } from './Shimmer.types.shared';
14
14
  import { convertRectToSvgPath, convertCircleToSvgPath } from './SvgShapeToPath';
15
15
  import RCTNativeAnimatedShimmer from './Win32ShimmerNativeComponent';
16
16
  const clippingMask = (props) => {
17
- /**
18
- * Absolute positioning is used to overlay the clipping mask on top of the shimmer wave.
19
- *
20
- * preserveAspectRatio = 'xMinYMin slice' asks the SVG to scale the viewBox up to fit the
21
- * viewPort, starting from the origin of the viewPort and minimum coordinates of the viewBox.
22
- * 'slice' removes the unnecessary remainder.
23
- */
24
- const { backgroundColor, viewBoxHeight, viewBoxWidth } = props;
25
- const svgProps = {
26
- style: { position: 'absolute', height: viewBoxHeight, width: viewBoxWidth },
27
- viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight,
28
- preserveAspectRatio: 'xMinYMin slice',
29
- };
30
- return _jsxs(Svg, {
31
- ...svgProps,
32
- children: [
33
- _jsx(Defs, { children: _jsx(ClipPath, { id: 'shimmerCuts', children: _jsx(Path, { d: props.clipPath, clipRule: 'evenodd' }) }) }),
34
- _jsx(Rect, { width: '100%', height: '100%', fill: backgroundColor, clipPath: 'url(#shimmerCuts)' }),
35
- ],
36
- });
17
+ /**
18
+ * Absolute positioning is used to overlay the clipping mask on top of the shimmer wave.
19
+ *
20
+ * preserveAspectRatio = 'xMinYMin slice' asks the SVG to scale the viewBox up to fit the
21
+ * viewPort, starting from the origin of the viewPort and minimum coordinates of the viewBox.
22
+ * 'slice' removes the unnecessary remainder.
23
+ */
24
+ const { backgroundColor, viewBoxHeight, viewBoxWidth } = props;
25
+ const svgProps = {
26
+ style: { position: 'absolute', height: viewBoxHeight, width: viewBoxWidth },
27
+ viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight,
28
+ preserveAspectRatio: 'xMinYMin slice',
29
+ };
30
+ return (_jsxs(Svg, { ...svgProps, children: [
31
+ _jsx(Defs, { children: _jsx(ClipPath, { id: "shimmerCuts", children: _jsx(Path, { d: props.clipPath, clipRule: "evenodd" }) }) }), _jsx(Rect, { width: "100%", height: "100%", fill: backgroundColor, clipPath: "url(#shimmerCuts)" })
32
+ ] }));
37
33
  };
38
34
  const wave = (props) => {
39
- const { shimmerColor, shimmerColorOpacity, shimmerWaveColor, shimmerWaveColorOpacity, viewBoxHeight, viewBoxWidth } = props;
40
- /**
41
- * See the comment above for an explanation of preserveAspectRatio.
42
- */
43
- const svgProps = {
44
- style: { height: viewBoxHeight, width: viewBoxWidth },
45
- viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight,
46
- preserveAspectRatio: 'xMinYMin slice',
47
- };
48
- /**
49
- * React-Native-SVG doesn't process opaque color values correctly for gradients, directly invoking `processColor`
50
- * and squashing in the opacity value of the color stop. This handling scheme is incompatible with OpaqueColorValue type
51
- * colors e.g. PlatformColor, and will show nothing. As a short-term solution, provide alternate non-gradient handling
52
- * of the wave color as a solid color.
53
- */
54
- if (typeof processColor(shimmerWaveColor) !== 'object' && typeof processColor(shimmerColor) !== 'object') {
55
- // The typical path where the provided shimmer colors are not OpaqueColorValues.
56
- return _jsxs(Svg, {
57
- ...svgProps,
58
- children: [
59
- _jsxs(LinearGradient, {
60
- id: 'gradient',
61
- children: [
62
- _jsx(Stop, { stopColor: shimmerColor, stopOpacity: shimmerColorOpacity }),
63
- _jsx(Stop, { offset: '20%', stopColor: shimmerWaveColor, stopOpacity: shimmerWaveColorOpacity }),
64
- _jsx(Stop, { offset: '40%', stopColor: shimmerColor, stopOpacity: shimmerColorOpacity }),
65
- ],
66
- }),
67
- _jsx(Rect, { width: props.shimmerWaveWidth, height: '100%', fill: 'url(#gradient)' }),
68
- ],
69
- });
70
- } else {
71
- // The unexpected path where either of the provided shimmer colors are OpaqueColorValues.
72
- // scaleX is used to mimic the gradient occupying 40% of the fill since we don't know the provided width of the
73
- // shimmer wave.
74
- return _jsx(Svg, {
75
- ...svgProps,
76
- children: _jsx(Rect, {
77
- width: props.shimmerWaveWidth,
78
- height: '100%',
79
- fill: shimmerWaveColor,
80
- fillOpacity: shimmerWaveColorOpacity,
81
- scaleX: '0.4',
82
- }),
83
- });
84
- }
35
+ const { shimmerColor, shimmerColorOpacity, shimmerWaveColor, shimmerWaveColorOpacity, viewBoxHeight, viewBoxWidth } = props;
36
+ /**
37
+ * See the comment above for an explanation of preserveAspectRatio.
38
+ */
39
+ const svgProps = {
40
+ style: { height: viewBoxHeight, width: viewBoxWidth },
41
+ viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight,
42
+ preserveAspectRatio: 'xMinYMin slice',
43
+ };
44
+ /**
45
+ * React-Native-SVG doesn't process opaque color values correctly for gradients, directly invoking `processColor`
46
+ * and squashing in the opacity value of the color stop. This handling scheme is incompatible with OpaqueColorValue type
47
+ * colors e.g. PlatformColor, and will show nothing. As a short-term solution, provide alternate non-gradient handling
48
+ * of the wave color as a solid color.
49
+ */
50
+ if (typeof processColor(shimmerWaveColor) !== 'object' && typeof processColor(shimmerColor) !== 'object') {
51
+ // The typical path where the provided shimmer colors are not OpaqueColorValues.
52
+ return (_jsxs(Svg, { ...svgProps, children: [
53
+ _jsxs(LinearGradient, { id: "gradient", children: [
54
+ _jsx(Stop, { stopColor: shimmerColor, stopOpacity: shimmerColorOpacity }), _jsx(Stop, { offset: "20%", stopColor: shimmerWaveColor, stopOpacity: shimmerWaveColorOpacity }), _jsx(Stop, { offset: "40%", stopColor: shimmerColor, stopOpacity: shimmerColorOpacity })
55
+ ] }), _jsx(Rect, { width: props.shimmerWaveWidth, height: "100%", fill: "url(#gradient)" })
56
+ ] }));
57
+ }
58
+ else {
59
+ // The unexpected path where either of the provided shimmer colors are OpaqueColorValues.
60
+ // scaleX is used to mimic the gradient occupying 40% of the fill since we don't know the provided width of the
61
+ // shimmer wave.
62
+ return (_jsx(Svg, { ...svgProps, children: _jsx(Rect, { width: props.shimmerWaveWidth, height: "100%", fill: shimmerWaveColor, fillOpacity: shimmerWaveColorOpacity, scaleX: "0.4" }) }));
63
+ }
85
64
  };
86
65
  const waveContainer = (props) => {
87
- const { shimmerColor, viewBoxHeight, viewBoxWidth } = props;
88
- return _jsx(RCTNativeAnimatedShimmer, {
89
- ...props,
90
- style: { backgroundColor: shimmerColor, height: viewBoxHeight, width: viewBoxWidth, overflow: 'hidden' },
91
- });
66
+ const { shimmerColor, viewBoxHeight, viewBoxWidth } = props;
67
+ return (_jsx(RCTNativeAnimatedShimmer, { ...props, style: { backgroundColor: shimmerColor, height: viewBoxHeight, width: viewBoxWidth, overflow: 'hidden' } }));
92
68
  };
93
69
  export const Shimmer = compose({
94
- displayName: shimmerName,
95
- ...stylingSettings,
96
- slots: {
97
- root: View,
98
- clippingMask: clippingMask,
99
- shimmerWave: wave,
100
- shimmerWaveContainer: waveContainer,
101
- },
102
- useRender: (props, useSlots) => {
103
- const Slots = useSlots(props);
104
- return (rest) => {
105
- const { elements, ...mergedProps } = mergeProps(props, rest);
106
- /**
107
- * Generate a clip path from the provided element shapes, with their path parameter strings generated from their corresponding properties.
108
- * Ideally this would be better possible with functions from the shape elements themselves and not to rely on our own calculations.
109
- *
110
- * One nuanced consideration is scaling the SVG with DPI. Without specifying a viewBox, points are considered to be pixels on an SVG canvas.
111
- * When the native control is scaled the SVG canvas will scale up -- but pixel coordinates will not, changing the visual for different pixel densities.
112
- * By providing a viewBox appropriate for our SVG the viewBox containing the graphics will be scaled up to fit the viewPort.
113
- * Since we're programmatically generating the visual, we can assert our viewBox is `0 0 xMax yMax` where xMax and yMax are the greatest
114
- * X and Y points used by a shape.
115
- */
116
- let clipPathsAsMask = [];
117
- let xMax = 0;
118
- let yMax = 0;
119
- if (elements) {
120
- elements.forEach((element) => {
121
- if (element.type == 'circle') {
122
- clipPathsAsMask = clipPathsAsMask.concat(convertCircleToSvgPath(element));
123
- const xMaxCandidate = element.cx + element.radius;
124
- const yMaxCandidate = element.cy + element.radius;
125
- xMax = xMax >= xMaxCandidate ? xMax : xMaxCandidate;
126
- yMax = yMax >= yMaxCandidate ? yMax : yMaxCandidate;
127
- } else if (element.type == 'rect') {
128
- clipPathsAsMask = clipPathsAsMask.concat(convertRectToSvgPath(element));
129
- const xMaxCandidate = element.x + element.width;
130
- const yMaxCandidate = element.y + element.height;
131
- xMax = xMax >= xMaxCandidate ? xMax : xMaxCandidate;
132
- yMax = yMax >= yMaxCandidate ? yMax : yMaxCandidate;
133
- } else {
134
- assertNever(element);
135
- }
136
- });
137
- }
138
- /**
139
- * Win32 D2D1 doesn't directly support SVG mask elements, so we're going to generate a mask
140
- * by manipulating our clip path for the same effect. We do so utilizing the clip-rule='evenodd'
141
- * and drawing a rectangle around the entire svg viewBox, causing all inner elements to be "clipped out"
142
- * instead of "clipped around," generating the visual we desire with the linear gradient below the mask.
143
- */
144
- const mergedClipPath = clipPathsAsMask.join(' ').concat('M 0 0 h ' + xMax + ' v ' + yMax + ' h -' + xMax + ' z ');
145
- return _jsxs(Slots.root, {
146
- ...mergedProps,
147
- children: [
148
- _jsx(Slots.shimmerWaveContainer, {
149
- viewBoxHeight: yMax,
150
- viewBoxWidth: xMax,
151
- children: _jsx(Slots.shimmerWave, { viewBoxHeight: yMax, viewBoxWidth: xMax }),
152
- }),
153
- _jsx(Slots.clippingMask, { clipPath: mergedClipPath, viewBoxHeight: yMax, viewBoxWidth: xMax }),
154
- ],
155
- });
156
- };
157
- },
70
+ displayName: shimmerName,
71
+ ...stylingSettings,
72
+ slots: {
73
+ root: View,
74
+ clippingMask: clippingMask,
75
+ shimmerWave: wave,
76
+ shimmerWaveContainer: waveContainer,
77
+ },
78
+ useRender: (props, useSlots) => {
79
+ const Slots = useSlots(props);
80
+ return (rest) => {
81
+ const { elements, ...mergedProps } = mergeProps(props, rest);
82
+ /**
83
+ * Generate a clip path from the provided element shapes, with their path parameter strings generated from their corresponding properties.
84
+ * Ideally this would be better possible with functions from the shape elements themselves and not to rely on our own calculations.
85
+ *
86
+ * One nuanced consideration is scaling the SVG with DPI. Without specifying a viewBox, points are considered to be pixels on an SVG canvas.
87
+ * When the native control is scaled the SVG canvas will scale up -- but pixel coordinates will not, changing the visual for different pixel densities.
88
+ * By providing a viewBox appropriate for our SVG the viewBox containing the graphics will be scaled up to fit the viewPort.
89
+ * Since we're programmatically generating the visual, we can assert our viewBox is `0 0 xMax yMax` where xMax and yMax are the greatest
90
+ * X and Y points used by a shape.
91
+ */
92
+ let clipPathsAsMask = [];
93
+ let xMax = 0;
94
+ let yMax = 0;
95
+ if (elements) {
96
+ elements.forEach((element) => {
97
+ if (element.type == 'circle') {
98
+ clipPathsAsMask = clipPathsAsMask.concat(convertCircleToSvgPath(element));
99
+ const xMaxCandidate = element.cx + element.radius;
100
+ const yMaxCandidate = element.cy + element.radius;
101
+ xMax = xMax >= xMaxCandidate ? xMax : xMaxCandidate;
102
+ yMax = yMax >= yMaxCandidate ? yMax : yMaxCandidate;
103
+ }
104
+ else if (element.type == 'rect') {
105
+ clipPathsAsMask = clipPathsAsMask.concat(convertRectToSvgPath(element));
106
+ const xMaxCandidate = element.x + element.width;
107
+ const yMaxCandidate = element.y + element.height;
108
+ xMax = xMax >= xMaxCandidate ? xMax : xMaxCandidate;
109
+ yMax = yMax >= yMaxCandidate ? yMax : yMaxCandidate;
110
+ }
111
+ else {
112
+ assertNever(element);
113
+ }
114
+ });
115
+ }
116
+ /**
117
+ * Win32 D2D1 doesn't directly support SVG mask elements, so we're going to generate a mask
118
+ * by manipulating our clip path for the same effect. We do so utilizing the clip-rule='evenodd'
119
+ * and drawing a rectangle around the entire svg viewBox, causing all inner elements to be "clipped out"
120
+ * instead of "clipped around," generating the visual we desire with the linear gradient below the mask.
121
+ */
122
+ const mergedClipPath = clipPathsAsMask.join(' ').concat('M 0 0 h ' + xMax + ' v ' + yMax + ' h -' + xMax + ' z ');
123
+ return (_jsxs(Slots.root, { ...mergedProps, children: [
124
+ _jsx(Slots.shimmerWaveContainer, { viewBoxHeight: yMax, viewBoxWidth: xMax, children: _jsx(Slots.shimmerWave, { viewBoxHeight: yMax, viewBoxWidth: xMax }) }), _jsx(Slots.clippingMask, { clipPath: mergedClipPath, viewBoxHeight: yMax, viewBoxWidth: xMax })
125
+ ] }));
126
+ };
127
+ },
158
128
  });
159
- //# sourceMappingURL=Shimmer.win32.js.map
129
+ //# sourceMappingURL=Shimmer.win32.js.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.android.d.ts.map
5
+ //# sourceMappingURL=ShimmerTokens.android.d.ts.map