@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,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* These functions are necessary to deal with the win32 platform issue of d2d1 not supporting SVG <Mask> elements.
|
|
4
4
|
* We can support them indirectly by inverting a <ClipPath> element, with the troublesome issue of there being
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* This solution is far from ideal and may have incompatibilities with <ClipPath> features; for Shimmer, it's sufficient,
|
|
14
14
|
* as we only support rounded rects and circles, with a circle being a rounded rect of borderRadius=length/2=width/2.
|
|
15
15
|
*/
|
|
16
|
-
Object.defineProperty(exports,
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.convertRectToSvgPath = convertRectToSvgPath;
|
|
18
18
|
exports.convertCircleToSvgPath = convertCircleToSvgPath;
|
|
19
19
|
// Note for explicit clarity: length and width represent the full length and width of the rect, and not
|
|
@@ -21,142 +21,128 @@ exports.convertCircleToSvgPath = convertCircleToSvgPath;
|
|
|
21
21
|
// borderRadius[X|Y] cannot be larger than [length/2 or width]/2; it would not be able to connect to the edge
|
|
22
22
|
// segments of the rect if so, and will be reduced to the maximum values accordingly.
|
|
23
23
|
function convertRoundedRectToSvgPath(x, y, borderRadiusX, borderRadiusY, width, height) {
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
24
|
+
// Reduce borderRadii to maximum usable size.
|
|
25
|
+
if (borderRadiusX * 2 > width) {
|
|
26
|
+
borderRadiusX = width / 2;
|
|
27
|
+
}
|
|
28
|
+
if (borderRadiusY * 2 > height) {
|
|
29
|
+
borderRadiusY = height / 2;
|
|
30
|
+
}
|
|
31
|
+
const horizontalEdgeLength = width - borderRadiusX * 2;
|
|
32
|
+
const verticalEdgeLength = height - borderRadiusY * 2;
|
|
33
|
+
const xAxisRotation = 0;
|
|
34
|
+
const largeArcFlag = 0;
|
|
35
|
+
const sweepArcFlag = 1;
|
|
36
|
+
/**
|
|
37
|
+
* The general manner in which we will draw our rounded rect is in the following
|
|
38
|
+
* order of points.
|
|
39
|
+
*
|
|
40
|
+
* - Forward (/) and back (\) slashes represent borderRadiusY and borderRadiusX, respectively.
|
|
41
|
+
* - The un-rounded rect points are represented by center dots (and steal 1 unit from the borderRadii).
|
|
42
|
+
* - x and y parameters are left out as path arguments use relative coordinates (vs absolute coordinates).
|
|
43
|
+
* - Coordinate axis aids are present to avoid counting for any necessary clarification.
|
|
44
|
+
*
|
|
45
|
+
* x: arbitrary
|
|
46
|
+
* y: arbitrary
|
|
47
|
+
* width: 24
|
|
48
|
+
* height: 12
|
|
49
|
+
* borderRadiusX: 5
|
|
50
|
+
* borderRadiusY: 3
|
|
51
|
+
*
|
|
52
|
+
* 0123456789012345678901234
|
|
53
|
+
*
|
|
54
|
+
* (1+9) (2)
|
|
55
|
+
* ⬇ ⬇
|
|
56
|
+
* 0 •\\\\--------------\\\\•
|
|
57
|
+
* 1 / /
|
|
58
|
+
* 2 / /
|
|
59
|
+
* 3 (8) ➡ | | ⬅ (3)
|
|
60
|
+
* 4 | |
|
|
61
|
+
* 5 | |
|
|
62
|
+
* 6 | |
|
|
63
|
+
* 7 | |
|
|
64
|
+
* 8 | |
|
|
65
|
+
* 9 (7) ➡ | | ⬅ (4)
|
|
66
|
+
* 0 / /
|
|
67
|
+
* 1 / /
|
|
68
|
+
* 2 •\\\\--------------\\\\•
|
|
69
|
+
* ⬆ ⬆
|
|
70
|
+
* (6) (5)
|
|
71
|
+
*
|
|
72
|
+
* Which would generate the following path:
|
|
73
|
+
* const path = 'M {x+5} ${y+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' +
|
|
78
|
+
* 'h -14 ' +
|
|
79
|
+
* 'a 5 3 0 0 1 -5 -3' +
|
|
80
|
+
* 'v -6 ' +
|
|
81
|
+
* 'a 5 3 0 0 1 5 -3 Z';
|
|
82
|
+
*/
|
|
83
|
+
// We start at the left-most point of the top edge.
|
|
84
|
+
// M: lift and move the pen to [x] [y] coordinates -- does not draw.
|
|
85
|
+
let path = ['M', x + borderRadiusX, y];
|
|
86
|
+
// draw to the right-most point of the top edge.
|
|
87
|
+
// h: horizontally draw a line [n] units relative to the current pen position.
|
|
88
|
+
path = path.concat(['h', horizontalEdgeLength]);
|
|
89
|
+
/**
|
|
90
|
+
* draw the arc for the top-right corner. If the rect is not rounded, the arc will be 0 length.
|
|
91
|
+
* a: draw an arc relative to the current pen position with the following parameters:
|
|
92
|
+
* rx: X-axis ellipse radius
|
|
93
|
+
* ry: Y-axis ellipse radius
|
|
94
|
+
* x-axis-rotation: rotation of the ellipse relative to the current coordinate system
|
|
95
|
+
* large-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
|
|
96
|
+
* sweep-arc-flag: See https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
|
|
97
|
+
* (dx, dy): relative end coordinate
|
|
98
|
+
*
|
|
99
|
+
* 'a rx ry x-axis-rotation large-arc-flag sweep-arc-flag dx dy'
|
|
100
|
+
*
|
|
101
|
+
* We will use x-axis-rotation = 0, large-arc-flag = 0, and sweep-arc-flag = 1 for our path generation.
|
|
102
|
+
* */
|
|
103
|
+
path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, borderRadiusY]);
|
|
104
|
+
/**
|
|
105
|
+
* Draw to the bottom-most point of the right edge.
|
|
106
|
+
* v: vertically draw a line [n] units relative to the current pen position.
|
|
107
|
+
*/
|
|
108
|
+
path = path.concat(['v', verticalEdgeLength]);
|
|
109
|
+
/**
|
|
110
|
+
* Draw the arc for the bottom-right corner.
|
|
111
|
+
*/
|
|
112
|
+
path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, borderRadiusY]);
|
|
113
|
+
/**
|
|
114
|
+
* Draw to the left-most point of the bottom edge.
|
|
115
|
+
*/
|
|
116
|
+
path = path.concat(['h', -horizontalEdgeLength]);
|
|
117
|
+
/**
|
|
118
|
+
* Draw the bottom-left corner.
|
|
119
|
+
*/
|
|
120
|
+
path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, -borderRadiusX, -borderRadiusY]);
|
|
121
|
+
/**
|
|
122
|
+
* Draw to the top-most point of the left edge.
|
|
123
|
+
*/
|
|
124
|
+
path = path.concat(['v', -verticalEdgeLength]);
|
|
125
|
+
/**
|
|
126
|
+
* Draw the top-left corner.
|
|
127
|
+
*/
|
|
128
|
+
path = path.concat(['a', borderRadiusX, borderRadiusY, xAxisRotation, largeArcFlag, sweepArcFlag, borderRadiusX, -borderRadiusY]);
|
|
129
|
+
/**
|
|
130
|
+
* Finally, close the shape. While we have manually returned to the same coordinate we started with, closing and not-closing the shape
|
|
131
|
+
* can have different behavior depending on other properties.
|
|
132
|
+
* z or Z: close the shape.
|
|
133
|
+
*/
|
|
134
|
+
path = path.concat('z');
|
|
135
|
+
/**
|
|
136
|
+
* Join all arguments with spaces and return the completed path.
|
|
137
|
+
*/
|
|
138
|
+
return path.join(' ');
|
|
139
139
|
}
|
|
140
140
|
function convertRectToSvgPath(rectShape) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
rectShape.x ? rectShape.x : 0,
|
|
144
|
-
rectShape.y ? rectShape.y : 0,
|
|
145
|
-
rectShape.borderRadiusX ? rectShape.borderRadiusX : 0,
|
|
146
|
-
rectShape.borderRadiusX ? rectShape.borderRadiusY : 0,
|
|
147
|
-
rectShape.width ? rectShape.width : 100,
|
|
148
|
-
rectShape.height ? rectShape.height : 16,
|
|
149
|
-
);
|
|
141
|
+
// Extract necessary args and generate the corresponding path for the shape.
|
|
142
|
+
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);
|
|
150
143
|
}
|
|
151
144
|
function convertCircleToSvgPath(circleShape) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
circleShape.cx ? circleShape.cx - circleShape.radius : 12,
|
|
155
|
-
circleShape.cy ? circleShape.cy - circleShape.radius : 12,
|
|
156
|
-
radius,
|
|
157
|
-
radius,
|
|
158
|
-
radius * 2,
|
|
159
|
-
radius * 2,
|
|
160
|
-
);
|
|
145
|
+
const radius = circleShape.radius ? circleShape.radius : 12;
|
|
146
|
+
return convertRoundedRectToSvgPath(circleShape.cx ? circleShape.cx - circleShape.radius : 12, circleShape.cy ? circleShape.cy - circleShape.radius : 12, radius, radius, radius * 2, radius * 2);
|
|
161
147
|
}
|
|
162
|
-
//# sourceMappingURL=SvgShapeToPath.js.map
|
|
148
|
+
//# 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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) Microsoft Corporation.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
-
Object.defineProperty(exports,
|
|
8
|
-
const react_native_1 = require(
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
9
|
exports.default = (0, react_native_1.requireNativeComponent)('RCTNativeAnimatedShimmer');
|
|
10
|
-
//# sourceMappingURL=Win32ShimmerNativeComponent.js.map
|
|
10
|
+
//# sourceMappingURL=Win32ShimmerNativeComponent.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = void 0;
|
|
4
4
|
exports.shimmerDefaultAngle = 45;
|
|
5
5
|
exports.shimmerDefaultDelay = 0;
|
|
6
6
|
exports.shimmerDefaultDuration = 1000;
|
|
7
|
-
//# sourceMappingURL=consts.android.js.map
|
|
7
|
+
//# sourceMappingURL=consts.android.js.map
|
package/lib-commonjs/consts.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = void 0;
|
|
4
4
|
exports.shimmerDefaultAngle = 0;
|
|
5
5
|
exports.shimmerDefaultDelay = 0;
|
|
6
6
|
exports.shimmerDefaultDuration = 1000;
|
|
7
|
-
//# sourceMappingURL=consts.ios.js.map
|
|
7
|
+
//# sourceMappingURL=consts.ios.js.map
|
package/lib-commonjs/consts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = void 0;
|
|
4
4
|
exports.shimmerDefaultAngle = 0;
|
|
5
5
|
exports.shimmerDefaultDelay = 0;
|
|
6
6
|
exports.shimmerDefaultDuration = 7000;
|
|
7
|
-
//# sourceMappingURL=consts.js.map
|
|
7
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = void 0;
|
|
4
4
|
exports.shimmerDefaultAngle = 0;
|
|
5
5
|
exports.shimmerDefaultDelay = 500;
|
|
6
6
|
exports.shimmerDefaultDuration = 2000;
|
|
7
|
-
//# sourceMappingURL=consts.win32.js.map
|
|
7
|
+
//# sourceMappingURL=consts.win32.js.map
|
package/lib-commonjs/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-commonjs/index.js
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = exports.shimmerName = exports.Shimmer = void 0;
|
|
4
|
-
const Shimmer_1 = require(
|
|
5
|
-
Object.defineProperty(exports,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return Shimmer_types_1.shimmerName;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
const consts_1 = require('./consts');
|
|
19
|
-
Object.defineProperty(exports, 'shimmerDefaultAngle', {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return consts_1.shimmerDefaultAngle;
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, 'shimmerDefaultDelay', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return consts_1.shimmerDefaultDelay;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, 'shimmerDefaultDuration', {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return consts_1.shimmerDefaultDuration;
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
const Shimmer_1 = require("./Shimmer");
|
|
5
|
+
Object.defineProperty(exports, "Shimmer", { enumerable: true, get: function () { return Shimmer_1.Shimmer; } });
|
|
6
|
+
const Shimmer_types_1 = require("./Shimmer.types");
|
|
7
|
+
Object.defineProperty(exports, "shimmerName", { enumerable: true, get: function () { return Shimmer_types_1.shimmerName; } });
|
|
8
|
+
const consts_1 = require("./consts");
|
|
9
|
+
Object.defineProperty(exports, "shimmerDefaultAngle", { enumerable: true, get: function () { return consts_1.shimmerDefaultAngle; } });
|
|
10
|
+
Object.defineProperty(exports, "shimmerDefaultDelay", { enumerable: true, get: function () { return consts_1.shimmerDefaultDelay; } });
|
|
11
|
+
Object.defineProperty(exports, "shimmerDefaultDuration", { enumerable: true, get: function () { return consts_1.shimmerDefaultDuration; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/experimental-shimmer",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "A cross-platform Fluent Shimmer component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "",
|
|
5
7
|
"repository": {
|
|
6
8
|
"type": "git",
|
|
7
9
|
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
8
10
|
"directory": "packages/experimental/Shimmer"
|
|
9
11
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
+
"main": "lib-commonjs/index.js",
|
|
13
|
+
"module": "lib/index.js",
|
|
14
|
+
"types": "lib/index.d.ts",
|
|
12
15
|
"exports": {
|
|
13
16
|
".": {
|
|
14
17
|
"types": "./lib/index.d.ts",
|
|
15
18
|
"import": "./lib/index.js",
|
|
16
|
-
"require": "./lib-commonjs/index.js"
|
|
19
|
+
"require": "./lib-commonjs/index.js",
|
|
20
|
+
"default": "./src/index.ts"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
|
-
"main": "lib-commonjs/index.js",
|
|
20
|
-
"module": "lib/index.js",
|
|
21
|
-
"types": "lib/index.d.ts",
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "fluentui-scripts build",
|
|
24
25
|
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
25
|
-
"build-
|
|
26
|
+
"build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
26
27
|
"clean": "fluentui-scripts clean",
|
|
27
28
|
"depcheck": "fluentui-scripts depcheck",
|
|
28
|
-
"
|
|
29
|
+
"format": "fluentui-scripts format",
|
|
30
|
+
"lint": "fluentui-scripts lint",
|
|
29
31
|
"lint-package": "fluentui-scripts lint-package",
|
|
30
|
-
"prettier": "fluentui-scripts prettier",
|
|
31
32
|
"test": "fluentui-scripts jest",
|
|
32
33
|
"update-snapshots": "fluentui-scripts jest -u"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@fluentui-react-native/framework": "0.15.
|
|
36
|
-
"@fluentui-react-native/theming-utils": "0.27.
|
|
37
|
-
"@fluentui-react-native/tokens": "0.24.
|
|
38
|
-
"@fluentui-react-native/use-styling": "0.14.
|
|
36
|
+
"@fluentui-react-native/framework": "0.15.3",
|
|
37
|
+
"@fluentui-react-native/theming-utils": "0.27.3",
|
|
38
|
+
"@fluentui-react-native/tokens": "0.24.3",
|
|
39
|
+
"@fluentui-react-native/use-styling": "0.14.3",
|
|
39
40
|
"assert-never": "^1.2.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@babel/core": "^7.20.0",
|
|
43
44
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
44
|
-
"@fluentui-react-native/
|
|
45
|
-
"@fluentui-react-native/
|
|
46
|
-
"@fluentui-react-native/jest-config": "0.1.1",
|
|
45
|
+
"@fluentui-react-native/framework-base": "0.3.3",
|
|
46
|
+
"@fluentui-react-native/jest-config": "0.1.0",
|
|
47
47
|
"@fluentui-react-native/kit-config": "0.1.2",
|
|
48
|
-
"@fluentui-react-native/
|
|
48
|
+
"@fluentui-react-native/lint-config-rules": "0.1.3",
|
|
49
|
+
"@fluentui-react-native/scripts": "0.1.0",
|
|
49
50
|
"@react-native-community/cli": "^20.0.0",
|
|
50
51
|
"@react-native-community/cli-platform-android": "^20.0.0",
|
|
51
52
|
"@react-native-community/cli-platform-ios": "^20.0.0",
|
|
52
53
|
"@react-native/babel-preset": "^0.81.0",
|
|
53
54
|
"@react-native/metro-config": "^0.81.0",
|
|
54
|
-
"@types/react": "~19.1.
|
|
55
|
+
"@types/react": "~19.1.4",
|
|
55
56
|
"@types/react-test-renderer": "^19.1.0",
|
|
56
|
-
"react": "19.1.
|
|
57
|
-
"react-native": "^0.81.
|
|
57
|
+
"react": "19.1.4",
|
|
58
|
+
"react-native": "^0.81.6",
|
|
58
59
|
"react-native-macos": "^0.81.0",
|
|
59
60
|
"react-native-svg": "^15.12.1",
|
|
60
61
|
"react-native-windows": "^0.81.0",
|
|
61
|
-
"react-test-renderer": "19.1.
|
|
62
|
+
"react-test-renderer": "19.1.4"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
65
|
-
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.
|
|
66
|
-
"react": "18.2.0 || 19.0.0 || 19.1.
|
|
67
|
-
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.
|
|
66
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
|
|
67
|
+
"react": "18.2.0 || 19.0.0 || 19.1.4",
|
|
68
|
+
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
|
|
68
69
|
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
69
70
|
"react-native-svg": ">=15.0.0 <15.13.0 || >=15.4.0 <15.13.0 || ^15.11.2 || ^15.12.1",
|
|
70
71
|
"react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
|
package/src/Shimmer.test.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import * as renderer from 'react-test-renderer';
|
|
|
5
5
|
import { Shimmer } from './Shimmer';
|
|
6
6
|
import type { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
|
|
7
7
|
|
|
8
|
-
function shimmerRects():
|
|
8
|
+
function shimmerRects(): (ShimmerRectElement | ShimmerCircleElement)[] {
|
|
9
9
|
return [
|
|
10
10
|
{
|
|
11
11
|
type: 'rect',
|
package/src/Shimmer.tsx
CHANGED
|
@@ -27,7 +27,7 @@ export const Shimmer = compose<ShimmerType>({
|
|
|
27
27
|
const memoizedShimmerData = useMemo(
|
|
28
28
|
() => ({
|
|
29
29
|
angle: props.angle ? props.angle : tokens['angle'],
|
|
30
|
-
backgroundColor: props?.style?.['backgroundColor'] ? props?.style['backgroundColor'] : tokens['backgroundColor'] ?? 'transparent',
|
|
30
|
+
backgroundColor: props?.style?.['backgroundColor'] ? props?.style['backgroundColor'] : (tokens['backgroundColor'] ?? 'transparent'),
|
|
31
31
|
containerBorderRadius: props?.style?.['borderRadius'] ? props?.style['borderRadius'] : 0,
|
|
32
32
|
containerWidth: props?.style?.['width'] ? props?.style['width'] : '100%',
|
|
33
33
|
containerHeight: props?.style?.['height'] ? props?.style['height'] : '100%',
|
|
@@ -38,17 +38,7 @@ export const Shimmer = compose<ShimmerType>({
|
|
|
38
38
|
shimmerWaveColor: props.shimmerWaveColor ? props.shimmerWaveColor : tokens['shimmerWaveColor'],
|
|
39
39
|
shimmerWaveColorOpacity: tokens['shimmerWaveColorOpacity'],
|
|
40
40
|
}),
|
|
41
|
-
[
|
|
42
|
-
props.angle,
|
|
43
|
-
props.backgroundColor,
|
|
44
|
-
props.delay,
|
|
45
|
-
props.duration,
|
|
46
|
-
props.shimmerColor,
|
|
47
|
-
props.shimmerColorOpacity,
|
|
48
|
-
props.shimmerWaveColor,
|
|
49
|
-
props.shimmerWaveColorOpacity,
|
|
50
|
-
props.style,
|
|
51
|
-
],
|
|
41
|
+
[props.angle, props.delay, props.duration, props.shimmerColor, props.shimmerWaveColor, props.style, tokens],
|
|
52
42
|
);
|
|
53
43
|
|
|
54
44
|
/* The shimmer animation is implemented using a LinearGradient which travels from left to right.
|
|
@@ -69,11 +59,11 @@ export const Shimmer = compose<ShimmerType>({
|
|
|
69
59
|
useNativeDriver: true,
|
|
70
60
|
}),
|
|
71
61
|
).start();
|
|
72
|
-
}, [memoizedShimmerData.delay, memoizedShimmerData.duration]);
|
|
62
|
+
}, [endValue, memoizedShimmerData.delay, memoizedShimmerData.duration, x1]);
|
|
73
63
|
|
|
74
64
|
useEffect(() => {
|
|
75
65
|
shimmerAnimation();
|
|
76
|
-
});
|
|
66
|
+
}, [shimmerAnimation]);
|
|
77
67
|
|
|
78
68
|
return (rest: ShimmerProps) => {
|
|
79
69
|
const { elements, ...mergedProps } = mergeProps(props, rest);
|
|
@@ -161,7 +161,7 @@ export interface ShimmerProps extends ViewProps, ShimmerTokens {
|
|
|
161
161
|
/**
|
|
162
162
|
* Shimmer shapes that define the masking effect of the Shimmer control.
|
|
163
163
|
*/
|
|
164
|
-
elements:
|
|
164
|
+
elements: ShimmerElementTypes[];
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export interface ShimmerType {
|
package/src/ShimmerTokens.ios.ts
CHANGED
package/src/ShimmerTokens.ts
CHANGED
|
@@ -15,4 +15,4 @@ export const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme> = (theme:
|
|
|
15
15
|
shimmerColorOpacity: 1,
|
|
16
16
|
shimmerWaveColor: getCurrentAppearance(theme.host.appearance, 'light') === 'light' ? 'white' : 'black',
|
|
17
17
|
shimmerWaveColorOpacity: 1,
|
|
18
|
-
} as ShimmerTokens
|
|
18
|
+
}) as ShimmerTokens;
|