@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.
- package/CHANGELOG.md +35 -0
- package/lib/Shimmer.d.ts +2 -7
- package/lib/Shimmer.d.ts.map +1 -1
- package/lib/Shimmer.js +77 -149
- package/lib/Shimmer.js.map +1 -1
- package/lib/Shimmer.styling.d.ts +1 -1
- package/lib/Shimmer.styling.js +26 -29
- package/lib/Shimmer.styling.win32.d.ts +1 -1
- package/lib/Shimmer.styling.win32.js +24 -36
- package/lib/Shimmer.test.d.ts +1 -1
- package/lib/Shimmer.test.js +45 -45
- package/lib/Shimmer.test.js.map +1 -1
- package/lib/Shimmer.types.d.ts +2 -10
- package/lib/Shimmer.types.js +1 -1
- package/lib/Shimmer.types.shared.d.ts +123 -123
- package/lib/Shimmer.types.shared.d.ts.map +1 -1
- package/lib/Shimmer.types.shared.js +1 -1
- package/lib/Shimmer.types.win32.d.ts +26 -26
- package/lib/Shimmer.types.win32.js +1 -1
- package/lib/Shimmer.win32.d.ts +2 -7
- package/lib/Shimmer.win32.js +107 -137
- package/lib/ShimmerTokens.android.d.ts +1 -1
- package/lib/ShimmerTokens.android.js +8 -8
- package/lib/ShimmerTokens.android.js.map +1 -1
- package/lib/ShimmerTokens.d.ts +1 -1
- package/lib/ShimmerTokens.ios.d.ts +1 -1
- package/lib/ShimmerTokens.ios.js +8 -8
- package/lib/ShimmerTokens.ios.js.map +1 -1
- package/lib/ShimmerTokens.js +9 -9
- package/lib/ShimmerTokens.js.map +1 -1
- package/lib/ShimmerTokens.win32.d.ts +1 -1
- package/lib/ShimmerTokens.win32.js +10 -10
- package/lib/ShimmerTokens.win32.js.map +1 -1
- package/lib/SvgShapeToPath.d.ts +1 -1
- package/lib/SvgShapeToPath.js +120 -134
- package/lib/Win32ShimmerNativeComponent.d.ts +4 -4
- package/lib/Win32ShimmerNativeComponent.js +1 -1
- package/lib/consts.android.d.ts +1 -1
- package/lib/consts.android.js +1 -1
- package/lib/consts.d.ts +1 -1
- package/lib/consts.ios.d.ts +1 -1
- package/lib/consts.ios.js +1 -1
- package/lib/consts.js +1 -1
- package/lib/consts.win32.d.ts +1 -1
- package/lib/consts.win32.js +1 -1
- package/lib/index.d.ts +2 -10
- package/lib/index.js +1 -1
- package/lib-commonjs/Shimmer.d.ts +2 -7
- package/lib-commonjs/Shimmer.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.js +89 -163
- package/lib-commonjs/Shimmer.js.map +1 -1
- package/lib-commonjs/Shimmer.styling.d.ts +1 -1
- package/lib-commonjs/Shimmer.styling.js +31 -34
- package/lib-commonjs/Shimmer.styling.win32.d.ts +1 -1
- package/lib-commonjs/Shimmer.styling.win32.js +29 -41
- package/lib-commonjs/Shimmer.test.d.ts +1 -1
- package/lib-commonjs/Shimmer.test.js +79 -96
- package/lib-commonjs/Shimmer.test.js.map +1 -1
- package/lib-commonjs/Shimmer.types.d.ts +2 -10
- package/lib-commonjs/Shimmer.types.js +5 -10
- package/lib-commonjs/Shimmer.types.shared.d.ts +123 -123
- package/lib-commonjs/Shimmer.types.shared.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.types.shared.js +3 -3
- package/lib-commonjs/Shimmer.types.win32.d.ts +26 -26
- package/lib-commonjs/Shimmer.types.win32.js +5 -10
- package/lib-commonjs/Shimmer.win32.d.ts +2 -7
- package/lib-commonjs/Shimmer.win32.js +120 -164
- package/lib-commonjs/ShimmerTokens.android.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.android.js +11 -11
- package/lib-commonjs/ShimmerTokens.android.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.ios.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.ios.js +11 -11
- package/lib-commonjs/ShimmerTokens.ios.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.js +13 -13
- package/lib-commonjs/ShimmerTokens.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.win32.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.win32.js +13 -13
- package/lib-commonjs/ShimmerTokens.win32.js.map +1 -1
- package/lib-commonjs/SvgShapeToPath.d.ts +1 -1
- package/lib-commonjs/SvgShapeToPath.js +122 -136
- package/lib-commonjs/Win32ShimmerNativeComponent.d.ts +4 -4
- package/lib-commonjs/Win32ShimmerNativeComponent.js +4 -4
- package/lib-commonjs/consts.android.d.ts +1 -1
- package/lib-commonjs/consts.android.js +3 -3
- package/lib-commonjs/consts.d.ts +1 -1
- package/lib-commonjs/consts.ios.d.ts +1 -1
- package/lib-commonjs/consts.ios.js +3 -3
- package/lib-commonjs/consts.js +3 -3
- package/lib-commonjs/consts.win32.d.ts +1 -1
- package/lib-commonjs/consts.win32.js +3 -3
- package/lib-commonjs/index.d.ts +2 -10
- package/lib-commonjs/index.js +11 -36
- package/package.json +26 -25
- package/src/Shimmer.test.tsx +1 -1
- package/src/Shimmer.tsx +4 -14
- package/src/Shimmer.types.shared.ts +1 -1
- package/src/ShimmerTokens.android.ts +1 -1
- package/src/ShimmerTokens.ios.ts +1 -1
- package/src/ShimmerTokens.ts +1 -1
- package/src/ShimmerTokens.win32.ts +1 -1
- 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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,
|
|
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"}
|
package/lib/ShimmerTokens.d.ts
CHANGED
|
@@ -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
|
package/lib/ShimmerTokens.ios.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { shimmerDefaultAngle, shimmerDefaultDelay, shimmerDefaultDuration } from './consts';
|
|
2
2
|
export const defaultShimmerTokens = (theme) => ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,
|
|
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"}
|
package/lib/ShimmerTokens.js
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
package/lib/ShimmerTokens.js.map
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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,
|
|
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"}
|
package/lib/SvgShapeToPath.d.ts
CHANGED
|
@@ -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
|
package/lib/SvgShapeToPath.js
CHANGED
|
@@ -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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
149
|
-
|
|
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
|
-
|
|
10
|
-
|
|
9
|
+
delay?: Double;
|
|
10
|
+
duration?: Double;
|
|
11
11
|
}
|
|
12
|
-
declare const _default: import(
|
|
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
|
package/lib/consts.android.d.ts
CHANGED
package/lib/consts.android.js
CHANGED
package/lib/consts.d.ts
CHANGED
package/lib/consts.ios.d.ts
CHANGED
package/lib/consts.ios.js
CHANGED
package/lib/consts.js
CHANGED
package/lib/consts.win32.d.ts
CHANGED
package/lib/consts.win32.js
CHANGED
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,8 +1,3 @@
|
|
|
1
1
|
import type { ShimmerProps } from './Shimmer.types';
|
|
2
|
-
export declare const Shimmer: import(
|
|
3
|
-
|
|
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,
|
|
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"}
|