react-native-smooth-clip-view 0.1.0
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/LICENSE +20 -0
- package/README.md +170 -0
- package/SmoothClipView.podspec +24 -0
- package/android/build.gradle +63 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +93 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +190 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +104 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipViewPackage.kt +21 -0
- package/ios/SmoothClipGeometry.h +41 -0
- package/ios/SmoothClipView.h +9 -0
- package/ios/SmoothClipView.mm +224 -0
- package/lib/module/SmoothClipView.js +35 -0
- package/lib/module/SmoothClipView.js.map +1 -0
- package/lib/module/SmoothClipView.web.js +38 -0
- package/lib/module/SmoothClipView.web.js.map +1 -0
- package/lib/module/SmoothClipViewNativeComponent.ts +34 -0
- package/lib/module/geometry.js +41 -0
- package/lib/module/geometry.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +5 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/webClipPath.js +25 -0
- package/lib/module/webClipPath.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/SmoothClipView.d.ts +12 -0
- package/lib/typescript/src/SmoothClipView.d.ts.map +1 -0
- package/lib/typescript/src/SmoothClipView.web.d.ts +12 -0
- package/lib/typescript/src/SmoothClipView.web.d.ts.map +1 -0
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +15 -0
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/geometry.d.ts +19 -0
- package/lib/typescript/src/geometry.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/index.web.d.ts +5 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -0
- package/lib/typescript/src/webClipPath.d.ts +7 -0
- package/lib/typescript/src/webClipPath.d.ts.map +1 -0
- package/package.json +201 -0
- package/src/SmoothClipView.tsx +72 -0
- package/src/SmoothClipView.web.tsx +62 -0
- package/src/SmoothClipViewNativeComponent.ts +34 -0
- package/src/geometry.ts +83 -0
- package/src/index.ts +4 -0
- package/src/index.web.ts +4 -0
- package/src/webClipPath.ts +30 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#import <CoreGraphics/CoreGraphics.h>
|
|
2
|
+
|
|
3
|
+
#include <math.h>
|
|
4
|
+
|
|
5
|
+
typedef struct {
|
|
6
|
+
CGRect rect;
|
|
7
|
+
CGFloat radius;
|
|
8
|
+
} SmoothNormalizedClipGeometry;
|
|
9
|
+
|
|
10
|
+
/** Mirrors the Android and JavaScript geometry contract without allocating. */
|
|
11
|
+
NS_INLINE BOOL SmoothClipNormalizeGeometry(
|
|
12
|
+
CGFloat x,
|
|
13
|
+
CGFloat y,
|
|
14
|
+
CGFloat width,
|
|
15
|
+
CGFloat height,
|
|
16
|
+
CGFloat radius,
|
|
17
|
+
CGSize hostSize,
|
|
18
|
+
SmoothNormalizedClipGeometry *result) {
|
|
19
|
+
if (!isfinite(x) || !isfinite(y) || !isfinite(width) ||
|
|
20
|
+
!isfinite(height) || !isfinite(radius) ||
|
|
21
|
+
!isfinite(hostSize.width) || !isfinite(hostSize.height)) {
|
|
22
|
+
return NO;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CGFloat hostWidth = MAX(0, hostSize.width);
|
|
26
|
+
const CGFloat hostHeight = MAX(0, hostSize.height);
|
|
27
|
+
const CGFloat requestedWidth = MAX(0, width);
|
|
28
|
+
const CGFloat requestedHeight = MAX(0, height);
|
|
29
|
+
const CGFloat requestedRight = x + requestedWidth;
|
|
30
|
+
const CGFloat requestedBottom = y + requestedHeight;
|
|
31
|
+
const CGFloat left = MIN(hostWidth, MAX(0, x));
|
|
32
|
+
const CGFloat top = MIN(hostHeight, MAX(0, y));
|
|
33
|
+
const CGFloat right = MIN(hostWidth, MAX(0, requestedRight));
|
|
34
|
+
const CGFloat bottom = MIN(hostHeight, MAX(0, requestedBottom));
|
|
35
|
+
const CGFloat visibleWidth = MAX(0, right - left);
|
|
36
|
+
const CGFloat visibleHeight = MAX(0, bottom - top);
|
|
37
|
+
|
|
38
|
+
result->rect = CGRectMake(left, top, visibleWidth, visibleHeight);
|
|
39
|
+
result->radius = MIN(MAX(0, radius), MIN(visibleWidth, visibleHeight) / 2.0);
|
|
40
|
+
return YES;
|
|
41
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#import "SmoothClipView.h"
|
|
2
|
+
#import "SmoothClipGeometry.h"
|
|
3
|
+
|
|
4
|
+
#import <QuartzCore/QuartzCore.h>
|
|
5
|
+
#import <React/RCTConversions.h>
|
|
6
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
7
|
+
#import <react/renderer/components/SmoothClipViewSpec/ComponentDescriptors.h>
|
|
8
|
+
#import <react/renderer/components/SmoothClipViewSpec/Props.h>
|
|
9
|
+
#import <react/renderer/components/SmoothClipViewSpec/RCTComponentViewHelpers.h>
|
|
10
|
+
|
|
11
|
+
using namespace facebook::react;
|
|
12
|
+
|
|
13
|
+
@interface SmoothClipView () <RCTSmoothClipViewViewProtocol>
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
@implementation SmoothClipView {
|
|
17
|
+
UIView *_clipContainer;
|
|
18
|
+
CGRect _requestedClip;
|
|
19
|
+
CGRect _normalizedClip;
|
|
20
|
+
CGFloat _requestedRadius;
|
|
21
|
+
CGFloat _normalizedRadius;
|
|
22
|
+
BOOL _hasLayout;
|
|
23
|
+
BOOL _commandIsAuthoritative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
27
|
+
return concreteComponentDescriptorProvider<SmoothClipViewComponentDescriptor>();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (BOOL)shouldBeRecycled {
|
|
31
|
+
return NO;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
35
|
+
if (self = [super initWithFrame:frame]) {
|
|
36
|
+
static const auto defaultProps =
|
|
37
|
+
std::make_shared<const SmoothClipViewProps>();
|
|
38
|
+
_props = defaultProps;
|
|
39
|
+
|
|
40
|
+
_clipContainer = [[UIView alloc] initWithFrame:CGRectZero];
|
|
41
|
+
_clipContainer.clipsToBounds = YES;
|
|
42
|
+
_clipContainer.hidden = YES;
|
|
43
|
+
_clipContainer.accessibilityElementsHidden = YES;
|
|
44
|
+
[self addSubview:_clipContainer];
|
|
45
|
+
|
|
46
|
+
_requestedClip = CGRectZero;
|
|
47
|
+
_normalizedClip = CGRectZero;
|
|
48
|
+
_requestedRadius = 0;
|
|
49
|
+
_normalizedRadius = 0;
|
|
50
|
+
_hasLayout = NO;
|
|
51
|
+
_commandIsAuthoritative = NO;
|
|
52
|
+
}
|
|
53
|
+
return self;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
57
|
+
index:(NSInteger)index {
|
|
58
|
+
NSAssert(childComponentView.superview == nil,
|
|
59
|
+
@"SmoothClipView attempted to mount an already-mounted child");
|
|
60
|
+
[_clipContainer insertSubview:childComponentView atIndex:index];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
64
|
+
index:(NSInteger)index {
|
|
65
|
+
NSAssert(childComponentView.superview == _clipContainer,
|
|
66
|
+
@"SmoothClipView attempted to unmount a child from another parent");
|
|
67
|
+
NSAssert(index < _clipContainer.subviews.count &&
|
|
68
|
+
_clipContainer.subviews[index] == childComponentView,
|
|
69
|
+
@"SmoothClipView child index mismatch");
|
|
70
|
+
[childComponentView removeFromSuperview];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
- (void)setRequestedClipX:(CGFloat)x
|
|
74
|
+
y:(CGFloat)y
|
|
75
|
+
width:(CGFloat)width
|
|
76
|
+
height:(CGFloat)height
|
|
77
|
+
radius:(CGFloat)radius {
|
|
78
|
+
if (!isfinite(x) || !isfinite(y) || !isfinite(width) ||
|
|
79
|
+
!isfinite(height) || !isfinite(radius)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_requestedClip = CGRectMake(x, y, MAX(0, width), MAX(0, height));
|
|
84
|
+
_requestedRadius = MAX(0, radius);
|
|
85
|
+
[self applyRequestedClip];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
- (void)applyRequestedClip {
|
|
89
|
+
if (!_hasLayout) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const CGFloat hostWidth = MAX(0, self.bounds.size.width);
|
|
94
|
+
const CGFloat hostHeight = MAX(0, self.bounds.size.height);
|
|
95
|
+
SmoothNormalizedClipGeometry geometry;
|
|
96
|
+
if (!SmoothClipNormalizeGeometry(
|
|
97
|
+
CGRectGetMinX(_requestedClip),
|
|
98
|
+
CGRectGetMinY(_requestedClip),
|
|
99
|
+
CGRectGetWidth(_requestedClip),
|
|
100
|
+
CGRectGetHeight(_requestedClip),
|
|
101
|
+
_requestedRadius,
|
|
102
|
+
CGSizeMake(hostWidth, hostHeight),
|
|
103
|
+
&geometry)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const BOOL rectChanged = !CGRectEqualToRect(_normalizedClip, geometry.rect);
|
|
108
|
+
const BOOL radiusChanged = _normalizedRadius != geometry.radius;
|
|
109
|
+
const BOOL isEmpty = CGRectIsEmpty(geometry.rect);
|
|
110
|
+
const BOOL hiddenChanged = _clipContainer.hidden != isEmpty;
|
|
111
|
+
const BOOL accessibilityChanged =
|
|
112
|
+
_clipContainer.accessibilityElementsHidden != isEmpty;
|
|
113
|
+
|
|
114
|
+
_normalizedClip = geometry.rect;
|
|
115
|
+
_normalizedRadius = geometry.radius;
|
|
116
|
+
if (!rectChanged && !radiusChanged && !hiddenChanged &&
|
|
117
|
+
!accessibilityChanged) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[CATransaction begin];
|
|
122
|
+
[CATransaction setDisableActions:YES];
|
|
123
|
+
if (rectChanged) {
|
|
124
|
+
_clipContainer.bounds = _normalizedClip;
|
|
125
|
+
_clipContainer.center = CGPointMake(
|
|
126
|
+
CGRectGetMidX(_normalizedClip), CGRectGetMidY(_normalizedClip));
|
|
127
|
+
}
|
|
128
|
+
if (radiusChanged) {
|
|
129
|
+
_clipContainer.layer.cornerRadius = _normalizedRadius;
|
|
130
|
+
}
|
|
131
|
+
if (hiddenChanged) {
|
|
132
|
+
_clipContainer.hidden = isEmpty;
|
|
133
|
+
}
|
|
134
|
+
if (accessibilityChanged) {
|
|
135
|
+
_clipContainer.accessibilityElementsHidden = isEmpty;
|
|
136
|
+
}
|
|
137
|
+
[CATransaction commit];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
- (void)updateProps:(const Props::Shared &)props
|
|
141
|
+
oldProps:(const Props::Shared &)oldProps {
|
|
142
|
+
const auto &newProps =
|
|
143
|
+
*std::static_pointer_cast<const SmoothClipViewProps>(props);
|
|
144
|
+
[super updateProps:props oldProps:oldProps];
|
|
145
|
+
|
|
146
|
+
if (!_commandIsAuthoritative) {
|
|
147
|
+
[self setRequestedClipX:newProps.initialClipX
|
|
148
|
+
y:newProps.initialClipY
|
|
149
|
+
width:newProps.initialClipWidth
|
|
150
|
+
height:newProps.initialClipHeight
|
|
151
|
+
radius:newProps.initialClipRadius];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
156
|
+
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics {
|
|
157
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
158
|
+
_hasLayout = YES;
|
|
159
|
+
[self applyRequestedClip];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
|
|
163
|
+
if (![super pointInside:point withEvent:event] ||
|
|
164
|
+
CGRectIsEmpty(_normalizedClip) ||
|
|
165
|
+
!CGRectContainsPoint(_normalizedClip, point)) {
|
|
166
|
+
return NO;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const CGFloat radius = _normalizedRadius;
|
|
170
|
+
if (radius <= 0) {
|
|
171
|
+
return YES;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const CGFloat innerLeft = CGRectGetMinX(_normalizedClip) + radius;
|
|
175
|
+
const CGFloat innerRight = CGRectGetMaxX(_normalizedClip) - radius;
|
|
176
|
+
const CGFloat innerTop = CGRectGetMinY(_normalizedClip) + radius;
|
|
177
|
+
const CGFloat innerBottom = CGRectGetMaxY(_normalizedClip) - radius;
|
|
178
|
+
if ((point.x >= innerLeft && point.x <= innerRight) ||
|
|
179
|
+
(point.y >= innerTop && point.y <= innerBottom)) {
|
|
180
|
+
return YES;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const CGFloat centerX = point.x < innerLeft ? innerLeft : innerRight;
|
|
184
|
+
const CGFloat centerY = point.y < innerTop ? innerTop : innerBottom;
|
|
185
|
+
const CGFloat dx = point.x - centerX;
|
|
186
|
+
const CGFloat dy = point.y - centerY;
|
|
187
|
+
return dx * dx + dy * dy <= radius * radius;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
#pragma mark - Native commands
|
|
191
|
+
|
|
192
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args {
|
|
193
|
+
RCTSmoothClipViewHandleCommand(self, commandName, args);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
- (void)setClipGeometry:(double)x
|
|
197
|
+
y:(double)y
|
|
198
|
+
width:(double)width
|
|
199
|
+
height:(double)height
|
|
200
|
+
radius:(double)radius {
|
|
201
|
+
_commandIsAuthoritative = YES;
|
|
202
|
+
[self setRequestedClipX:x y:y width:width height:height radius:radius];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- (void)prepareForRecycle {
|
|
206
|
+
[super prepareForRecycle];
|
|
207
|
+
_requestedClip = CGRectZero;
|
|
208
|
+
_normalizedClip = CGRectZero;
|
|
209
|
+
_requestedRadius = 0;
|
|
210
|
+
_normalizedRadius = 0;
|
|
211
|
+
_hasLayout = NO;
|
|
212
|
+
_commandIsAuthoritative = NO;
|
|
213
|
+
|
|
214
|
+
[CATransaction begin];
|
|
215
|
+
[CATransaction setDisableActions:YES];
|
|
216
|
+
_clipContainer.bounds = CGRectZero;
|
|
217
|
+
_clipContainer.center = CGPointZero;
|
|
218
|
+
_clipContainer.layer.cornerRadius = 0;
|
|
219
|
+
_clipContainer.hidden = YES;
|
|
220
|
+
_clipContainer.accessibilityElementsHidden = YES;
|
|
221
|
+
[CATransaction commit];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Animated, { dispatchCommand, useAnimatedReaction, useAnimatedRef } from 'react-native-reanimated';
|
|
4
|
+
import NativeSmoothClipView from './SmoothClipViewNativeComponent';
|
|
5
|
+
import { clipGeometryEquals, isFiniteClipGeometry } from "./geometry.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const AnimatedNativeSmoothClipView = Animated.createAnimatedComponent(NativeSmoothClipView);
|
|
8
|
+
export function SmoothClipView({
|
|
9
|
+
initialClip,
|
|
10
|
+
animatedClip,
|
|
11
|
+
children,
|
|
12
|
+
...viewProps
|
|
13
|
+
}) {
|
|
14
|
+
const nativeRef = useAnimatedRef();
|
|
15
|
+
useAnimatedReaction(() => animatedClip.value, (clip, previousClip) => {
|
|
16
|
+
if (!isFiniteClipGeometry(clip) || clipGeometryEquals(previousClip, clip)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
dispatchCommand(nativeRef, 'setClipGeometry', [clip.x, clip.y, clip.width, clip.height, clip.radius]);
|
|
20
|
+
}, [nativeRef, animatedClip]);
|
|
21
|
+
const nativeProps = {
|
|
22
|
+
...viewProps,
|
|
23
|
+
initialClipX: initialClip.x,
|
|
24
|
+
initialClipY: initialClip.y,
|
|
25
|
+
initialClipWidth: initialClip.width,
|
|
26
|
+
initialClipHeight: initialClip.height,
|
|
27
|
+
initialClipRadius: initialClip.radius
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/_jsx(AnimatedNativeSmoothClipView, {
|
|
30
|
+
ref: nativeRef,
|
|
31
|
+
...nativeProps,
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=SmoothClipView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","dispatchCommand","useAnimatedReaction","useAnimatedRef","NativeSmoothClipView","clipGeometryEquals","isFiniteClipGeometry","jsx","_jsx","AnimatedNativeSmoothClipView","createAnimatedComponent","SmoothClipView","initialClip","animatedClip","children","viewProps","nativeRef","value","clip","previousClip","x","y","width","height","radius","nativeProps","initialClipX","initialClipY","initialClipWidth","initialClipHeight","initialClipRadius","ref"],"sourceRoot":"../../src","sources":["SmoothClipView.tsx"],"mappings":";;AAGA,OAAOA,QAAQ,IACbC,eAAe,EACfC,mBAAmB,EACnBC,cAAc,QAET,yBAAyB;AAChC,OAAOC,oBAAoB,MAEpB,iCAAiC;AACxC,SACEC,kBAAkB,EAClBC,oBAAoB,QAEf,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpB,MAAMC,4BAA4B,GAChCT,QAAQ,CAACU,uBAAuB,CAACN,oBAAoB,CAAC;AAQxD,OAAO,SAASO,cAAcA,CAAC;EAC7BC,WAAW;EACXC,YAAY;EACZC,QAAQ;EACR,GAAGC;AACgB,CAAC,EAAE;EACtB,MAAMC,SAAS,GACbb,cAAc,CAAkD,CAAC;EAEnED,mBAAmB,CACjB,MAAMW,YAAY,CAACI,KAAK,EACxB,CAACC,IAAI,EAAEC,YAAY,KAAK;IACtB,IACE,CAACb,oBAAoB,CAACY,IAAI,CAAC,IAC3Bb,kBAAkB,CAACc,YAAY,EAAED,IAAI,CAAC,EACtC;MACA;IACF;IAEAjB,eAAe,CAACe,SAAS,EAAE,iBAAiB,EAAE,CAC5CE,IAAI,CAACE,CAAC,EACNF,IAAI,CAACG,CAAC,EACNH,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,MAAM,EACXL,IAAI,CAACM,MAAM,CACZ,CAAC;EACJ,CAAC,EACD,CAACR,SAAS,EAAEH,YAAY,CAC1B,CAAC;EAED,MAAMY,WAAwB,GAAG;IAC/B,GAAGV,SAAS;IACZW,YAAY,EAAEd,WAAW,CAACQ,CAAC;IAC3BO,YAAY,EAAEf,WAAW,CAACS,CAAC;IAC3BO,gBAAgB,EAAEhB,WAAW,CAACU,KAAK;IACnCO,iBAAiB,EAAEjB,WAAW,CAACW,MAAM;IACrCO,iBAAiB,EAAElB,WAAW,CAACY;EACjC,CAAC;EAED,oBACEhB,IAAA,CAACC,4BAA4B;IAACsB,GAAG,EAAEf,SAAU;IAAA,GAAKS,WAAW;IAAAX,QAAA,EAC1DA;EAAQ,CACmB,CAAC;AAEnC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Animated, { useAnimatedReaction, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
import { clipGeometryEquals, isFiniteClipGeometry } from "./geometry.js";
|
|
5
|
+
import { createWebClipPath } from "./webClipPath.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/** Build-safe fallback. Web performance is intentionally outside the POC. */
|
|
8
|
+
export function SmoothClipView({
|
|
9
|
+
initialClip,
|
|
10
|
+
animatedClip,
|
|
11
|
+
children,
|
|
12
|
+
style,
|
|
13
|
+
...viewProps
|
|
14
|
+
}) {
|
|
15
|
+
const acceptedClip = useSharedValue(initialClip);
|
|
16
|
+
const initialClipStyle = {
|
|
17
|
+
clipPath: createWebClipPath(initialClip),
|
|
18
|
+
overflow: 'hidden'
|
|
19
|
+
};
|
|
20
|
+
useAnimatedReaction(() => animatedClip.value, (clip, previousClip) => {
|
|
21
|
+
if (isFiniteClipGeometry(clip) && !clipGeometryEquals(previousClip, clip)) {
|
|
22
|
+
acceptedClip.value = clip;
|
|
23
|
+
}
|
|
24
|
+
}, [animatedClip, acceptedClip]);
|
|
25
|
+
const clipStyle = useAnimatedStyle(() => {
|
|
26
|
+
const clip = acceptedClip.value;
|
|
27
|
+
return {
|
|
28
|
+
clipPath: createWebClipPath(clip),
|
|
29
|
+
overflow: 'hidden'
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
33
|
+
...viewProps,
|
|
34
|
+
style: [style, initialClipStyle, clipStyle],
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=SmoothClipView.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","useAnimatedReaction","useAnimatedStyle","useSharedValue","clipGeometryEquals","isFiniteClipGeometry","createWebClipPath","jsx","_jsx","SmoothClipView","initialClip","animatedClip","children","style","viewProps","acceptedClip","initialClipStyle","clipPath","overflow","value","clip","previousClip","clipStyle","View"],"sourceRoot":"../../src","sources":["SmoothClipView.web.tsx"],"mappings":";;AAEA,OAAOA,QAAQ,IACbC,mBAAmB,EACnBC,gBAAgB,EAChBC,cAAc,QAET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
type ViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
export interface NativeProps extends ViewProps {
|
|
10
|
+
initialClipX: CodegenTypes.Double;
|
|
11
|
+
initialClipY: CodegenTypes.Double;
|
|
12
|
+
initialClipWidth: CodegenTypes.Double;
|
|
13
|
+
initialClipHeight: CodegenTypes.Double;
|
|
14
|
+
initialClipRadius: CodegenTypes.Double;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface NativeCommands {
|
|
18
|
+
setClipGeometry: (
|
|
19
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
20
|
+
x: CodegenTypes.Double,
|
|
21
|
+
y: CodegenTypes.Double,
|
|
22
|
+
width: CodegenTypes.Double,
|
|
23
|
+
height: CodegenTypes.Double,
|
|
24
|
+
radius: CodegenTypes.Double
|
|
25
|
+
) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
29
|
+
supportedCommands: ['setClipGeometry'],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default codegenNativeComponent<NativeProps>(
|
|
33
|
+
'SmoothClipView'
|
|
34
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function isFiniteClipGeometry(geometry) {
|
|
4
|
+
'worklet';
|
|
5
|
+
|
|
6
|
+
return Number.isFinite(geometry.x) && Number.isFinite(geometry.y) && Number.isFinite(geometry.width) && Number.isFinite(geometry.height) && Number.isFinite(geometry.radius);
|
|
7
|
+
}
|
|
8
|
+
export function clipGeometryEquals(first, second) {
|
|
9
|
+
'worklet';
|
|
10
|
+
|
|
11
|
+
return first !== null && first.x === second.x && first.y === second.y && first.width === second.width && first.height === second.height && first.radius === second.radius;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Mirrors the native geometry contract for tests and non-native fallbacks.
|
|
16
|
+
* Native remains authoritative because its bounds are the actual rendered size.
|
|
17
|
+
*/
|
|
18
|
+
export function normalizeClipGeometry(geometry, bounds) {
|
|
19
|
+
'worklet';
|
|
20
|
+
|
|
21
|
+
const values = [geometry.x, geometry.y, geometry.width, geometry.height, geometry.radius, bounds.width, bounds.height];
|
|
22
|
+
if (!values.every(Number.isFinite)) return null;
|
|
23
|
+
const boundsWidth = Math.max(0, bounds.width);
|
|
24
|
+
const boundsHeight = Math.max(0, bounds.height);
|
|
25
|
+
const requestedWidth = Math.max(0, geometry.width);
|
|
26
|
+
const requestedHeight = Math.max(0, geometry.height);
|
|
27
|
+
const left = Math.min(boundsWidth, Math.max(0, geometry.x));
|
|
28
|
+
const top = Math.min(boundsHeight, Math.max(0, geometry.y));
|
|
29
|
+
const right = Math.min(boundsWidth, Math.max(0, geometry.x + requestedWidth));
|
|
30
|
+
const bottom = Math.min(boundsHeight, Math.max(0, geometry.y + requestedHeight));
|
|
31
|
+
const width = Math.max(0, right - left);
|
|
32
|
+
const height = Math.max(0, bottom - top);
|
|
33
|
+
return {
|
|
34
|
+
x: left,
|
|
35
|
+
y: top,
|
|
36
|
+
width,
|
|
37
|
+
height,
|
|
38
|
+
radius: Math.min(Math.max(0, geometry.radius), Math.min(width, height) / 2)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isFiniteClipGeometry","geometry","Number","isFinite","x","y","width","height","radius","clipGeometryEquals","first","second","normalizeClipGeometry","bounds","values","every","boundsWidth","Math","max","boundsHeight","requestedWidth","requestedHeight","left","min","top","right","bottom"],"sourceRoot":"../../src","sources":["geometry.ts"],"mappings":";;AAaA,OAAO,SAASA,oBAAoBA,CAACC,QAAsB,EAAW;EACpE,SAAS;;EACT,OACEC,MAAM,CAACC,QAAQ,CAACF,QAAQ,CAACG,CAAC,CAAC,IAC3BF,MAAM,CAACC,QAAQ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ources":["index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,qBAAqB,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SmoothClipView","normalizeClipGeometry"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,yBAAsB;AAErD,SAASC,qBAAqB,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function px(value) {
|
|
4
|
+
'worklet';
|
|
5
|
+
|
|
6
|
+
return `${value}px`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a fixed-host CSS clip. Percentage/right/bottom anchored descendants
|
|
11
|
+
* continue resolving against the host because this never changes its layout.
|
|
12
|
+
*/
|
|
13
|
+
export function createWebClipPath(geometry) {
|
|
14
|
+
'worklet';
|
|
15
|
+
|
|
16
|
+
const width = Math.max(0, geometry.width);
|
|
17
|
+
const height = Math.max(0, geometry.height);
|
|
18
|
+
const left = Math.max(0, geometry.x);
|
|
19
|
+
const top = Math.max(0, geometry.y);
|
|
20
|
+
const rightEdge = Math.max(0, geometry.x + width);
|
|
21
|
+
const bottomEdge = Math.max(0, geometry.y + height);
|
|
22
|
+
const radius = Math.min(Math.max(0, geometry.radius), Math.min(width, height) / 2);
|
|
23
|
+
return `inset(${px(top)} max(0px, calc(100% - ${px(rightEdge)})) max(0px, calc(100% - ${px(bottomEdge)})) ${px(left)} round ${px(radius)})`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=webClipPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["px","value","createWebClipPath","geometry","width","Math","max","height","left","x","top","y","rightEdge","bottomEdge","radius","min"],"sourceRoot":"../../src","sources":["web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'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { type ViewProps } from 'react-native';
|
|
4
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
5
|
+
import { type ClipGeometry } from './geometry.js';
|
|
6
|
+
export type SmoothClipViewProps = ViewProps & {
|
|
7
|
+
initialClip: ClipGeometry;
|
|
8
|
+
animatedClip: SharedValue<ClipGeometry>;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function SmoothClipView({ initialClip, animatedClip, children, ...viewProps }: SmoothClipViewProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SmoothClipView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmoothClipView.d.ts","sourceRoot":"","sources":["../../../src/SmoothClipView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAiB,EAIf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,eAAY,CAAC;AAKpB,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,WAAW,EAAE,YAAY,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,mBAAmB,qBAuCrB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ViewProps } from 'react-native';
|
|
3
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import { type ClipGeometry } from './geometry.js';
|
|
5
|
+
export type SmoothClipViewProps = ViewProps & {
|
|
6
|
+
initialClip: ClipGeometry;
|
|
7
|
+
animatedClip: SharedValue<ClipGeometry>;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/** Build-safe fallback. Web performance is intentionally outside the POC. */
|
|
11
|
+
export declare function SmoothClipView({ initialClip, animatedClip, children, style, ...viewProps }: SmoothClipViewProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SmoothClipView.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmoothClipView.web.d.ts","sourceRoot":"","sources":["../../../src/SmoothClipView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAC9D,OAAiB,EAIf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,eAAY,CAAC;AAGpB,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,WAAW,EAAE,YAAY,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,GAAG,SAAS,EACb,EAAE,mBAAmB,+BAiCrB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CodegenTypes, type HostComponent, type ViewProps } from 'react-native';
|
|
2
|
+
export interface NativeProps extends ViewProps {
|
|
3
|
+
initialClipX: CodegenTypes.Double;
|
|
4
|
+
initialClipY: CodegenTypes.Double;
|
|
5
|
+
initialClipWidth: CodegenTypes.Double;
|
|
6
|
+
initialClipHeight: CodegenTypes.Double;
|
|
7
|
+
initialClipRadius: CodegenTypes.Double;
|
|
8
|
+
}
|
|
9
|
+
interface NativeCommands {
|
|
10
|
+
setClipGeometry: (viewRef: React.ElementRef<HostComponent<NativeProps>>, x: CodegenTypes.Double, y: CodegenTypes.Double, width: CodegenTypes.Double, height: CodegenTypes.Double, radius: CodegenTypes.Double) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const Commands: NativeCommands;
|
|
13
|
+
declare const _default: HostComponent<NativeProps>;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=SmoothClipViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmoothClipViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/SmoothClipViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC;IAClC,gBAAgB,EAAE,YAAY,CAAC,MAAM,CAAC;IACtC,iBAAiB,EAAE,YAAY,CAAC,MAAM,CAAC;IACvC,iBAAiB,EAAE,YAAY,CAAC,MAAM,CAAC;CACxC;AAED,UAAU,cAAc;IACtB,eAAe,EAAE,CACf,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACrD,CAAC,EAAE,YAAY,CAAC,MAAM,EACtB,CAAC,EAAE,YAAY,CAAC,MAAM,EACtB,KAAK,EAAE,YAAY,CAAC,MAAM,EAC1B,MAAM,EAAE,YAAY,CAAC,MAAM,EAC3B,MAAM,EAAE,YAAY,CAAC,MAAM,KACxB,IAAI,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;wBAIE,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ClipGeometry = Readonly<{
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
}>;
|
|
8
|
+
export type ClipBounds = Readonly<{
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function isFiniteClipGeometry(geometry: ClipGeometry): boolean;
|
|
13
|
+
export declare function clipGeometryEquals(first: ClipGeometry | null, second: ClipGeometry): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Mirrors the native geometry contract for tests and non-native fallbacks.
|
|
16
|
+
* Native remains authoritative because its bounds are the actual rendered size.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeClipGeometry(geometry: ClipGeometry, bounds: ClipBounds): ClipGeometry | null;
|
|
19
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../src/geometry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CASpE;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,IAAI,EAC1B,MAAM,EAAE,YAAY,GACnB,OAAO,CAUT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,UAAU,GACjB,YAAY,GAAG,IAAI,CAoCrB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SmoothClipView } from './SmoothClipView';
|
|
2
|
+
export type { SmoothClipViewProps } from './SmoothClipView';
|
|
3
|
+
export { normalizeClipGeometry } from './geometry.js';
|
|
4
|
+
export type { ClipBounds, ClipGeometry } from './geometry.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAY,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SmoothClipView } from './SmoothClipView.web.js';
|
|
2
|
+
export type { SmoothClipViewProps } from './SmoothClipView.web.js';
|
|
3
|
+
export { normalizeClipGeometry } from './geometry.js';
|
|
4
|
+
export type { ClipBounds, ClipGeometry } from './geometry.js';
|
|
5
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAsB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAsB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAY,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClipGeometry } from './geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a fixed-host CSS clip. Percentage/right/bottom anchored descendants
|
|
4
|
+
* continue resolving against the host because this never changes its layout.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createWebClipPath(geometry: ClipGeometry): string;
|
|
7
|
+
//# sourceMappingURL=webClipPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webClipPath.d.ts","sourceRoot":"","sources":["../../../src/webClipPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAY,CAAC;AAO/C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAkBhE"}
|