react-native-smooth-clip-view 0.2.9 → 0.4.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/README.md +132 -349
- package/android/build.gradle +8 -4
- package/android/proguard-rules.pro +3 -3
- package/android/src/main/cpp/SmoothClipAndroid.h +13 -6
- package/android/src/main/cpp/SmoothClipBindings.cpp +605 -123
- package/android/src/main/cpp/SmoothClipRegistry.cpp +975 -209
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +192 -118
- package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +22 -4
- package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +81 -56
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +449 -240
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +150 -38
- package/cpp/SmoothClipAnimationCurve.h +317 -397
- package/cpp/SmoothClipRegistry.h +84 -20
- package/cpp/SmoothClipSharedGeometry.h +131 -22
- package/cpp/SmoothClipVelocityTracker.h +16 -12
- package/ios/SmoothClipGeometry.h +188 -21
- package/ios/SmoothClipRegistry.mm +869 -368
- package/ios/SmoothClipRegistrySnapshot.h +13 -0
- package/ios/SmoothClipTurboModule.cpp +513 -156
- package/ios/SmoothClipTurboModule.h +123 -56
- package/ios/SmoothClipView.mm +1074 -449
- package/ios/SmoothClipViewRegistry.h +3 -7
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/NativeSmoothClipModule.js.map +1 -1
- package/lib/module/SmoothClipView.ios.js +94 -11
- package/lib/module/SmoothClipView.ios.js.map +1 -1
- package/lib/module/SmoothClipView.js +1 -46
- package/lib/module/SmoothClipView.js.map +1 -1
- package/lib/module/SmoothClipViewNativeComponent.ts +32 -12
- package/lib/module/capabilities.js +4 -0
- package/lib/module/capabilities.js.map +1 -0
- package/lib/module/capabilities.native.js +18 -0
- package/lib/module/capabilities.native.js.map +1 -0
- package/lib/module/capabilityTypes.js +2 -0
- package/lib/module/capabilityTypes.js.map +1 -0
- package/lib/module/controllerInternals.js +28 -0
- package/lib/module/controllerInternals.js.map +1 -0
- package/lib/module/controllerLifecycle.js +9 -0
- package/lib/module/controllerLifecycle.js.map +1 -0
- package/lib/module/controllerTypes.js +4 -0
- package/lib/module/controllerTypes.js.map +1 -0
- package/lib/module/controllers.android.js +4 -0
- package/lib/module/controllers.android.js.map +1 -0
- package/lib/module/controllers.ios.js +4 -0
- package/lib/module/controllers.ios.js.map +1 -0
- package/lib/module/controllers.js +4 -0
- package/lib/module/controllers.js.map +1 -0
- package/lib/module/controllers.native.js +89 -0
- package/lib/module/controllers.native.js.map +1 -0
- package/lib/module/geometry.js +180 -30
- package/lib/module/geometry.js.map +1 -1
- package/lib/module/groupTypes.js +4 -0
- package/lib/module/groupTypes.js.map +1 -0
- package/lib/module/groups.android.js +4 -0
- package/lib/module/groups.android.js.map +1 -0
- package/lib/module/groups.ios.js +4 -0
- package/lib/module/groups.ios.js.map +1 -0
- package/lib/module/groups.js +4 -0
- package/lib/module/groups.js.map +1 -0
- package/lib/module/groups.native.js +399 -0
- package/lib/module/groups.native.js.map +1 -0
- package/lib/module/ids.js +8 -0
- package/lib/module/ids.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeCompletion.js +37 -16
- package/lib/module/nativeCompletion.js.map +1 -1
- package/lib/module/presentationCodec.js +81 -0
- package/lib/module/presentationCodec.js.map +1 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts +20 -4
- package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.d.ts +2 -10
- package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.ios.d.ts +139 -4
- package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +16 -3
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/capabilities.d.ts +3 -0
- package/lib/typescript/src/capabilities.d.ts.map +1 -0
- package/lib/typescript/src/capabilities.native.d.ts +3 -0
- package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
- package/lib/typescript/src/capabilityTypes.d.ts +4 -0
- package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
- package/lib/typescript/src/controllerInternals.d.ts +14 -0
- package/lib/typescript/src/controllerInternals.d.ts.map +1 -0
- package/lib/typescript/src/controllerLifecycle.d.ts +3 -0
- package/lib/typescript/src/controllerLifecycle.d.ts.map +1 -0
- package/lib/typescript/src/controllerTypes.d.ts +62 -0
- package/lib/typescript/src/controllerTypes.d.ts.map +1 -0
- package/lib/typescript/src/controllers.android.d.ts +2 -0
- package/lib/typescript/src/controllers.android.d.ts.map +1 -0
- package/lib/typescript/src/controllers.d.ts +2 -0
- package/lib/typescript/src/controllers.d.ts.map +1 -0
- package/lib/typescript/src/controllers.ios.d.ts +2 -0
- package/lib/typescript/src/controllers.ios.d.ts.map +1 -0
- package/lib/typescript/src/controllers.native.d.ts +3 -0
- package/lib/typescript/src/controllers.native.d.ts.map +1 -0
- package/lib/typescript/src/geometry.d.ts +49 -5
- package/lib/typescript/src/geometry.d.ts.map +1 -1
- package/lib/typescript/src/groupTypes.d.ts +31 -0
- package/lib/typescript/src/groupTypes.d.ts.map +1 -0
- package/lib/typescript/src/groups.android.d.ts +2 -0
- package/lib/typescript/src/groups.android.d.ts.map +1 -0
- package/lib/typescript/src/groups.d.ts +2 -0
- package/lib/typescript/src/groups.d.ts.map +1 -0
- package/lib/typescript/src/groups.ios.d.ts +2 -0
- package/lib/typescript/src/groups.ios.d.ts.map +1 -0
- package/lib/typescript/src/groups.native.d.ts +3 -0
- package/lib/typescript/src/groups.native.d.ts.map +1 -0
- package/lib/typescript/src/ids.d.ts +2 -0
- package/lib/typescript/src/ids.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeCompletion.d.ts +16 -6
- package/lib/typescript/src/nativeCompletion.d.ts.map +1 -1
- package/lib/typescript/src/presentationCodec.d.ts +10 -0
- package/lib/typescript/src/presentationCodec.d.ts.map +1 -0
- package/package.json +17 -13
- package/src/NativeSmoothClipModule.ts +80 -56
- package/src/SmoothClipView.ios.tsx +142 -16
- package/src/SmoothClipView.tsx +6 -76
- package/src/SmoothClipViewNativeComponent.ts +32 -12
- package/src/capabilities.native.ts +19 -0
- package/src/capabilities.ts +2 -0
- package/src/capabilityTypes.ts +3 -0
- package/src/controllerInternals.ts +52 -0
- package/src/controllerLifecycle.ts +6 -0
- package/src/controllerTypes.ts +87 -0
- package/src/controllers.android.ts +1 -0
- package/src/controllers.ios.ts +1 -0
- package/src/controllers.native.ts +104 -0
- package/src/controllers.ts +1 -0
- package/src/geometry.ts +293 -45
- package/src/groupTypes.ts +53 -0
- package/src/groups.android.ts +1 -0
- package/src/groups.ios.ts +1 -0
- package/src/groups.native.ts +604 -0
- package/src/groups.ts +1 -0
- package/src/ids.ts +6 -0
- package/src/index.ts +32 -12
- package/src/nativeCompletion.ts +67 -32
- package/src/presentationCodec.ts +134 -0
- package/lib/module/SmoothClipView.web.js +0 -54
- package/lib/module/SmoothClipView.web.js.map +0 -1
- package/lib/module/driverState.js +0 -110
- package/lib/module/driverState.js.map +0 -1
- package/lib/module/driverTypes.js +0 -4
- package/lib/module/driverTypes.js.map +0 -1
- package/lib/module/drivers.android.js +0 -6
- package/lib/module/drivers.android.js.map +0 -1
- package/lib/module/drivers.ios.js +0 -6
- package/lib/module/drivers.ios.js.map +0 -1
- package/lib/module/drivers.js +0 -284
- package/lib/module/drivers.js.map +0 -1
- package/lib/module/drivers.native.js +0 -556
- package/lib/module/drivers.native.js.map +0 -1
- package/lib/module/index.web.js +0 -8
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/reactRequests.js +0 -56
- package/lib/module/reactRequests.js.map +0 -1
- package/lib/module/webClipPath.js +0 -25
- package/lib/module/webClipPath.js.map +0 -1
- package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
- package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
- package/lib/typescript/src/driverState.d.ts +0 -31
- package/lib/typescript/src/driverState.d.ts.map +0 -1
- package/lib/typescript/src/driverTypes.d.ts +0 -107
- package/lib/typescript/src/driverTypes.d.ts.map +0 -1
- package/lib/typescript/src/drivers.android.d.ts +0 -3
- package/lib/typescript/src/drivers.android.d.ts.map +0 -1
- package/lib/typescript/src/drivers.d.ts +0 -5
- package/lib/typescript/src/drivers.d.ts.map +0 -1
- package/lib/typescript/src/drivers.ios.d.ts +0 -3
- package/lib/typescript/src/drivers.ios.d.ts.map +0 -1
- package/lib/typescript/src/drivers.native.d.ts +0 -5
- package/lib/typescript/src/drivers.native.d.ts.map +0 -1
- package/lib/typescript/src/index.web.d.ts +0 -9
- package/lib/typescript/src/index.web.d.ts.map +0 -1
- package/lib/typescript/src/reactRequests.d.ts +0 -9
- package/lib/typescript/src/reactRequests.d.ts.map +0 -1
- package/lib/typescript/src/webClipPath.d.ts +0 -7
- package/lib/typescript/src/webClipPath.d.ts.map +0 -1
- package/src/SmoothClipView.web.tsx +0 -66
- package/src/driverState.ts +0 -158
- package/src/driverTypes.ts +0 -140
- package/src/drivers.android.ts +0 -8
- package/src/drivers.ios.ts +0 -8
- package/src/drivers.native.ts +0 -899
- package/src/drivers.ts +0 -427
- package/src/index.web.ts +0 -23
- package/src/reactRequests.ts +0 -76
- package/src/webClipPath.ts +0 -30
package/lib/module/geometry.js
CHANGED
|
@@ -1,60 +1,210 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/* eslint-disable no-bitwise -- React Native colors are converted to RRGGBBAA */
|
|
4
|
+
|
|
5
|
+
import { processColor } from 'react-native-reanimated';
|
|
6
|
+
|
|
7
|
+
/** One numeric outset shadow following React Native's `boxShadow` field names. */
|
|
8
|
+
|
|
9
|
+
const DEFAULT_SHADOW_COLOR = '#000000ff';
|
|
10
|
+
function isClipCurve(curve) {
|
|
11
|
+
'worklet';
|
|
12
|
+
|
|
13
|
+
return curve === undefined || curve === 'circular' || curve === 'continuous';
|
|
14
|
+
}
|
|
15
|
+
function isFiniteOptionalNumber(value) {
|
|
16
|
+
'worklet';
|
|
17
|
+
|
|
18
|
+
return value === undefined || Number.isFinite(value);
|
|
19
|
+
}
|
|
20
|
+
function canonicalizeClipBoxShadow(shadow) {
|
|
4
21
|
'worklet';
|
|
5
22
|
|
|
23
|
+
if (shadow === undefined) return undefined;
|
|
24
|
+
const {
|
|
25
|
+
offsetX,
|
|
26
|
+
offsetY
|
|
27
|
+
} = shadow;
|
|
28
|
+
const blurRadius = shadow.blurRadius ?? 0;
|
|
29
|
+
const spreadDistance = shadow.spreadDistance ?? 0;
|
|
30
|
+
if (!Number.isFinite(offsetX) || !Number.isFinite(offsetY) || !Number.isFinite(blurRadius) || !Number.isFinite(spreadDistance)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const processedColor = shadow.color === undefined ? processColor(DEFAULT_SHADOW_COLOR) : processColor(shadow.color);
|
|
34
|
+
// Platform and dynamic colors cannot be represented by the scalar native
|
|
35
|
+
// animation protocol. Callers can resolve those colors before presenting.
|
|
36
|
+
if (typeof processedColor !== 'number') return null;
|
|
37
|
+
const unsignedProcessedColor = processedColor >>> 0;
|
|
38
|
+
const color = (unsignedProcessedColor << 8 | unsignedProcessedColor >>> 24) >>> 0;
|
|
6
39
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
40
|
+
color: color,
|
|
41
|
+
offsetX,
|
|
42
|
+
offsetY,
|
|
43
|
+
blurRadius: Math.max(0, blurRadius),
|
|
44
|
+
spreadDistance
|
|
10
45
|
};
|
|
11
46
|
}
|
|
47
|
+
function clipBoxShadowEquals(first, second) {
|
|
48
|
+
'worklet';
|
|
49
|
+
|
|
50
|
+
if (first === undefined || second === undefined) return first === second;
|
|
51
|
+
const canonicalFirst = canonicalizeClipBoxShadow(first);
|
|
52
|
+
const canonicalSecond = canonicalizeClipBoxShadow(second);
|
|
53
|
+
return canonicalFirst !== null && canonicalFirst !== undefined && canonicalSecond !== null && canonicalSecond !== undefined && canonicalFirst.color === canonicalSecond.color && canonicalFirst.offsetX === canonicalSecond.offsetX && canonicalFirst.offsetY === canonicalSecond.offsetY && canonicalFirst.blurRadius === canonicalSecond.blurRadius && canonicalFirst.spreadDistance === canonicalSecond.spreadDistance;
|
|
54
|
+
}
|
|
12
55
|
export function isFiniteClipGeometry(geometry) {
|
|
13
56
|
'worklet';
|
|
14
57
|
|
|
15
|
-
|
|
58
|
+
const width = Math.max(0, geometry.width);
|
|
59
|
+
const height = Math.max(0, geometry.height);
|
|
60
|
+
return Number.isFinite(geometry.x) && Number.isFinite(geometry.y) && Number.isFinite(geometry.width) && Number.isFinite(geometry.height) && Number.isFinite(geometry.radius) && Number.isFinite(geometry.x + width) && Number.isFinite(geometry.y + height) && isFiniteOptionalNumber(geometry.topLeftRadius) && isFiniteOptionalNumber(geometry.topRightRadius) && isFiniteOptionalNumber(geometry.bottomRightRadius) && isFiniteOptionalNumber(geometry.bottomLeftRadius) && isClipCurve(geometry.curve);
|
|
61
|
+
}
|
|
62
|
+
function resolvedTopLeftRadius(geometry) {
|
|
63
|
+
'worklet';
|
|
64
|
+
|
|
65
|
+
return geometry.topLeftRadius ?? geometry.radius;
|
|
66
|
+
}
|
|
67
|
+
function resolvedTopRightRadius(geometry) {
|
|
68
|
+
'worklet';
|
|
69
|
+
|
|
70
|
+
return geometry.topRightRadius ?? geometry.radius;
|
|
71
|
+
}
|
|
72
|
+
function resolvedBottomRightRadius(geometry) {
|
|
73
|
+
'worklet';
|
|
74
|
+
|
|
75
|
+
return geometry.bottomRightRadius ?? geometry.radius;
|
|
76
|
+
}
|
|
77
|
+
function resolvedBottomLeftRadius(geometry) {
|
|
78
|
+
'worklet';
|
|
79
|
+
|
|
80
|
+
return geometry.bottomLeftRadius ?? geometry.radius;
|
|
81
|
+
}
|
|
82
|
+
function resolvedCurve(geometry) {
|
|
83
|
+
'worklet';
|
|
84
|
+
|
|
85
|
+
return geometry.curve ?? 'circular';
|
|
16
86
|
}
|
|
17
87
|
export function clipGeometryEquals(first, second) {
|
|
18
88
|
'worklet';
|
|
19
89
|
|
|
20
|
-
return first !== null && first.x === second.x && first.y === second.y && first.width === second.width && first.height === second.height && first.radius === second.radius;
|
|
90
|
+
return first !== null && first.x === second.x && first.y === second.y && first.width === second.width && first.height === second.height && first.radius === second.radius && resolvedTopLeftRadius(first) === resolvedTopLeftRadius(second) && resolvedTopRightRadius(first) === resolvedTopRightRadius(second) && resolvedBottomRightRadius(first) === resolvedBottomRightRadius(second) && resolvedBottomLeftRadius(first) === resolvedBottomLeftRadius(second) && resolvedCurve(first) === resolvedCurve(second);
|
|
91
|
+
}
|
|
92
|
+
function resolvedContentScale(presentation) {
|
|
93
|
+
'worklet';
|
|
94
|
+
|
|
95
|
+
return presentation.contentScale ?? 1;
|
|
21
96
|
}
|
|
22
97
|
export function isFiniteClipPresentation(presentation) {
|
|
23
98
|
'worklet';
|
|
24
99
|
|
|
25
|
-
|
|
100
|
+
const contentScale = resolvedContentScale(presentation);
|
|
101
|
+
const shadow = canonicalizeClipBoxShadow(presentation.boxShadow);
|
|
102
|
+
return isFiniteClipGeometry(presentation.clip) && Number.isFinite(presentation.contentTranslateX) && Number.isFinite(presentation.contentTranslateY) && Number.isFinite(contentScale) && contentScale > 0 && shadow !== null;
|
|
26
103
|
}
|
|
27
104
|
export function clipPresentationEquals(first, second) {
|
|
28
105
|
'worklet';
|
|
29
106
|
|
|
30
|
-
return first !== null && clipGeometryEquals(first.clip, second.clip) && first.contentTranslateX === second.contentTranslateX && first.contentTranslateY === second.contentTranslateY;
|
|
107
|
+
return first !== null && clipGeometryEquals(first.clip, second.clip) && first.contentTranslateX === second.contentTranslateX && first.contentTranslateY === second.contentTranslateY && resolvedContentScale(first) === resolvedContentScale(second) && clipBoxShadowEquals(first.boxShadow, second.boxShadow);
|
|
31
108
|
}
|
|
109
|
+
function createCanonicalClipGeometry(geometry, x, y, width, height) {
|
|
110
|
+
'worklet';
|
|
32
111
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const
|
|
112
|
+
const topLeftRadius = Math.max(0, resolvedTopLeftRadius(geometry));
|
|
113
|
+
const topRightRadius = Math.max(0, resolvedTopRightRadius(geometry));
|
|
114
|
+
const bottomRightRadius = Math.max(0, resolvedBottomRightRadius(geometry));
|
|
115
|
+
const bottomLeftRadius = Math.max(0, resolvedBottomLeftRadius(geometry));
|
|
116
|
+
|
|
117
|
+
// CSS corner-overlap reduction uses one common factor so all four corners
|
|
118
|
+
// retain their proportions when either pair exceeds the available edge.
|
|
119
|
+
let scale = 1;
|
|
120
|
+
const top = topLeftRadius + topRightRadius;
|
|
121
|
+
const right = topRightRadius + bottomRightRadius;
|
|
122
|
+
const bottom = bottomLeftRadius + bottomRightRadius;
|
|
123
|
+
const left = topLeftRadius + bottomLeftRadius;
|
|
124
|
+
if (top > 0) scale = Math.min(scale, width / top);
|
|
125
|
+
if (right > 0) scale = Math.min(scale, height / right);
|
|
126
|
+
if (bottom > 0) scale = Math.min(scale, width / bottom);
|
|
127
|
+
if (left > 0) scale = Math.min(scale, height / left);
|
|
128
|
+
scale = Math.max(0, Math.min(1, scale));
|
|
129
|
+
const canonicalTopLeftRadius = topLeftRadius * scale;
|
|
130
|
+
const canonicalTopRightRadius = topRightRadius * scale;
|
|
131
|
+
const canonicalBottomRightRadius = bottomRightRadius * scale;
|
|
132
|
+
const canonicalBottomLeftRadius = bottomLeftRadius * scale;
|
|
133
|
+
const radius = canonicalTopLeftRadius === canonicalTopRightRadius && canonicalTopRightRadius === canonicalBottomRightRadius && canonicalBottomRightRadius === canonicalBottomLeftRadius ? canonicalTopLeftRadius : 0;
|
|
52
134
|
return {
|
|
53
|
-
x
|
|
54
|
-
y
|
|
135
|
+
x,
|
|
136
|
+
y,
|
|
55
137
|
width,
|
|
56
138
|
height,
|
|
57
|
-
radius
|
|
139
|
+
radius,
|
|
140
|
+
topLeftRadius: canonicalTopLeftRadius,
|
|
141
|
+
topRightRadius: canonicalTopRightRadius,
|
|
142
|
+
bottomRightRadius: canonicalBottomRightRadius,
|
|
143
|
+
bottomLeftRadius: canonicalBottomLeftRadius,
|
|
144
|
+
curve: resolvedCurve(geometry)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Expands presentation defaults and applies CSS proportional corner scaling.
|
|
150
|
+
*/
|
|
151
|
+
export function canonicalizeClipGeometry(geometry) {
|
|
152
|
+
'worklet';
|
|
153
|
+
|
|
154
|
+
if (!isFiniteClipGeometry(geometry)) return null;
|
|
155
|
+
const width = Math.max(0, geometry.width);
|
|
156
|
+
const height = Math.max(0, geometry.height);
|
|
157
|
+
return createCanonicalClipGeometry(geometry, geometry.x, geometry.y, width, height);
|
|
158
|
+
}
|
|
159
|
+
export function canonicalizeClipPresentation(presentation) {
|
|
160
|
+
'worklet';
|
|
161
|
+
|
|
162
|
+
if (!isFiniteClipPresentation(presentation)) return null;
|
|
163
|
+
const clip = canonicalizeClipGeometry(presentation.clip);
|
|
164
|
+
if (clip === null) return null;
|
|
165
|
+
const boxShadow = canonicalizeClipBoxShadow(presentation.boxShadow);
|
|
166
|
+
if (boxShadow === null) return null;
|
|
167
|
+
return {
|
|
168
|
+
clip,
|
|
169
|
+
contentTranslateX: presentation.contentTranslateX,
|
|
170
|
+
contentTranslateY: presentation.contentTranslateY,
|
|
171
|
+
contentScale: resolvedContentScale(presentation),
|
|
172
|
+
...(boxShadow === undefined ? {} : {
|
|
173
|
+
boxShadow
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Keep this below the canonicalization helpers so the worklet never closes
|
|
179
|
+
// over a helper declared later in this module.
|
|
180
|
+
export function createClipPresentation(clip, contentTranslateX = 0, contentTranslateY = 0, contentScale = 1, boxShadow) {
|
|
181
|
+
'worklet';
|
|
182
|
+
|
|
183
|
+
const canonicalClip = canonicalizeClipGeometry(clip);
|
|
184
|
+
const canonicalShadow = canonicalizeClipBoxShadow(boxShadow);
|
|
185
|
+
return {
|
|
186
|
+
// Keep invalid input observably invalid so downstream validation remains
|
|
187
|
+
// atomic instead of accidentally sanitizing a required scalar.
|
|
188
|
+
clip: canonicalClip ?? {
|
|
189
|
+
x: clip.x,
|
|
190
|
+
y: clip.y,
|
|
191
|
+
width: clip.width,
|
|
192
|
+
height: clip.height,
|
|
193
|
+
radius: clip.radius,
|
|
194
|
+
topLeftRadius: resolvedTopLeftRadius(clip),
|
|
195
|
+
topRightRadius: resolvedTopRightRadius(clip),
|
|
196
|
+
bottomRightRadius: resolvedBottomRightRadius(clip),
|
|
197
|
+
bottomLeftRadius: resolvedBottomLeftRadius(clip),
|
|
198
|
+
curve: resolvedCurve(clip)
|
|
199
|
+
},
|
|
200
|
+
contentTranslateX,
|
|
201
|
+
contentTranslateY,
|
|
202
|
+
contentScale,
|
|
203
|
+
...(canonicalShadow === undefined ? {} : {
|
|
204
|
+
// Match the geometry constructor's invalid-input behavior: retain the
|
|
205
|
+
// bad source value so the driver's atomic validation rejects it.
|
|
206
|
+
boxShadow: canonicalShadow ?? boxShadow
|
|
207
|
+
})
|
|
58
208
|
};
|
|
59
209
|
}
|
|
60
210
|
//# sourceMappingURL=geometry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["processColor","DEFAULT_SHADOW_COLOR","isClipCurve","curve","undefined","isFiniteOptionalNumber","value","Number","isFinite","canonicalizeClipBoxShadow","shadow","offsetX","offsetY","blurRadius","spreadDistance","processedColor","color","unsignedProcessedColor","Math","max","clipBoxShadowEquals","first","second","canonicalFirst","canonicalSecond","isFiniteClipGeometry","geometry","width","height","x","y","radius","topLeftRadius","topRightRadius","bottomRightRadius","bottomLeftRadius","resolvedTopLeftRadius","resolvedTopRightRadius","resolvedBottomRightRadius","resolvedBottomLeftRadius","resolvedCurve","clipGeometryEquals","resolvedContentScale","presentation","contentScale","isFiniteClipPresentation","boxShadow","clip","contentTranslateX","contentTranslateY","clipPresentationEquals","createCanonicalClipGeometry","scale","top","right","bottom","left","min","canonicalTopLeftRadius","canonicalTopRightRadius","canonicalBottomRightRadius","canonicalBottomLeftRadius","canonicalizeClipGeometry","canonicalizeClipPresentation","createClipPresentation","canonicalClip","canonicalShadow"],"sourceRoot":"../../src","sources":["geometry.ts"],"mappings":";;AAAA;;AAEA,SAASA,YAAY,QAAQ,yBAAyB;;AAItD;;AAgEA,MAAMC,oBAAoB,GAAG,WAAW;AAExC,SAASC,WAAWA,CAACC,KAA4B,EAAW;EAC1D,SAAS;;EACT,OAAOA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,UAAU,IAAIA,KAAK,KAAK,YAAY;AAC9E;AAEA,SAASE,sBAAsBA,CAACC,KAAyB,EAAW;EAClE,SAAS;;EACT,OAAOA,KAAK,KAAKF,SAAS,IAAIG,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC;AACtD;AAEA,SAASG,yBAAyBA,CAChCC,MAAiC,EACU;EAC3C,SAAS;;EACT,IAAIA,MAAM,KAAKN,SAAS,EAAE,OAAOA,SAAS;EAC1C,MAAM;IAAEO,OAAO;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EACnC,MAAMG,UAAU,GAAGH,MAAM,CAACG,UA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S,GAC7B,CAAC,CAAC,GACF;MACE;MACA;MACA0C,SAAS,EAAGoB,eAAe,IAAIpB;IACjC,CAAC;EACP,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["groupTypes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSmoothClipGroup"],"sourceRoot":"../../src","sources":["groups.android.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSmoothClipGroup"],"sourceRoot":"../../src","sources":["groups.ios.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSmoothClipGroup"],"sourceRoot":"../../src","sources":["groups.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,oBAAiB","ignoreList":[]}
|