@luckylca/react-native-liquid-glass 0.2.0 → 0.3.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 +20 -33
- package/README.zh-CN.md +20 -33
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/android/build.gradle +4 -4
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/EffectiveScrollInputBridge.kt +2 -2
- package/android/src/main/java/expo/modules/{newhuliquidglass/ExpoGlassProviderCoreView.kt → liquidglass/GlassCaptureView.kt} +39 -39
- package/android/src/main/java/expo/modules/{newhuliquidglass/CoreLiquidGlassRegistry.kt → liquidglass/GlassRegistry.kt} +7 -7
- package/android/src/main/java/expo/modules/{newhuliquidglass/ExpoGlassSurfaceCoreView.kt → liquidglass/GlassSurfaceView.kt} +17 -17
- package/android/src/main/java/expo/modules/liquidglass/LiquidGlassModule.kt +205 -0
- package/android/src/main/java/expo/modules/{localglass/ExpoLocalGlassEngineModule.kt → liquidglass/LocalMaterialView.kt} +24 -27
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/PassSurfaceSuppression.kt +1 -1
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/SharedGlassPassProbeLog.kt +1 -1
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/SharedGlassPassWiring.kt +3 -3
- package/android-core/build.gradle +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/BackdropRecorder.kt +4 -4
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/FrozenBackdrop.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassBackdropCoordinator.kt +5 -5
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassBackdropSourceHandle.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassScrollSource.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassViewController.kt +119 -722
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/LiquidGlassProviderLayout.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/LiquidGlassView.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/StableSceneTexturePolicy.kt +1 -1
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceFrameBuilder.kt +278 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceInteraction.kt +359 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassFrame.kt +110 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassViewRenderer.kt +728 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/ReferenceParityPasses.kt +705 -0
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/internal/ReferenceTabSampling.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/internal/SharedSceneCapture.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassCapabilities.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassEngine.kt +7 -7
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassMaterial.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassMath.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassOpticalInsets.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassRenderTier.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassShapePacker.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassSurfaceState.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassUniforms.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/LiquidGlassShaders.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/SharedGlassPass.kt +6 -6
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/geometry/G2RoundedRectangle.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +1 -1
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceGlassUniforms.kt +4 -4
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceParityGlassShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/SdfScaleLensShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassMaterial.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassRenderer.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassRuntimeShader.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassView.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/GlassMotionDriver.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/GlassMotionState.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/PointerVelocityTracker.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/SpringSpec.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/G2Corner.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassMaterial.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassOpticsShader.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassParityProbe.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassShapeGeometry.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassUniformBinder.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/PixelDiff.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/ReferenceOptics.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/GlassSurfaceHost.kt +17 -17
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/GlassSurfaceRenderer.kt +9 -9
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/RetainedBackdropLayer.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/scheduler/GlassFrameScheduler.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +13 -13
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/GlassTelemetry.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +13 -13
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LiquidGlassTrace.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LocalGlassTelemetry.kt +1 -1
- package/docs/architecture.md +61 -0
- package/docs/migration-0.3.md +19 -0
- package/docs/publishing.md +29 -7
- package/expo-module.config.json +4 -4
- package/lib/commonjs/GlassSurface.js +157 -585
- package/lib/commonjs/GlassSurface.js.map +1 -1
- package/lib/commonjs/GlassTabBar.js +18 -957
- package/lib/commonjs/GlassTabBar.js.map +1 -1
- package/lib/commonjs/LocalGlassMaterial.js +3 -9
- package/lib/commonjs/LocalGlassMaterial.js.map +1 -1
- package/lib/commonjs/glassController.js +3 -7
- package/lib/commonjs/glassController.js.map +1 -1
- package/lib/commonjs/glassRuntime.js +7 -19
- package/lib/commonjs/glassRuntime.js.map +1 -1
- package/lib/commonjs/localGlassTelemetry.js +4 -13
- package/lib/commonjs/localGlassTelemetry.js.map +1 -1
- package/lib/commonjs/nativeGlassViews.js +8 -11
- package/lib/commonjs/nativeGlassViews.js.map +1 -1
- package/lib/commonjs/performanceTelemetry.js +2 -6
- package/lib/commonjs/performanceTelemetry.js.map +1 -1
- package/lib/commonjs/surface/InlineSurface.js +134 -0
- package/lib/commonjs/surface/InlineSurface.js.map +1 -0
- package/lib/commonjs/surface/MaterialProvider.js +78 -0
- package/lib/commonjs/surface/MaterialProvider.js.map +1 -0
- package/lib/commonjs/surface/NativeSurface.js +55 -0
- package/lib/commonjs/surface/NativeSurface.js.map +1 -0
- package/lib/commonjs/surface/PortalLayers.js +331 -0
- package/lib/commonjs/surface/PortalLayers.js.map +1 -0
- package/lib/commonjs/surface/contexts.js +108 -0
- package/lib/commonjs/surface/contexts.js.map +1 -0
- package/lib/commonjs/surface/registry.js +113 -0
- package/lib/commonjs/surface/registry.js.map +1 -0
- package/lib/commonjs/surface/styles.js +34 -0
- package/lib/commonjs/surface/styles.js.map +1 -0
- package/lib/commonjs/surface/types.js +3 -0
- package/lib/commonjs/surface/types.js.map +1 -0
- package/lib/commonjs/tabs/GlassTabItem.js +66 -0
- package/lib/commonjs/tabs/GlassTabItem.js.map +1 -0
- package/lib/commonjs/tabs/InlineTabBar.js +867 -0
- package/lib/commonjs/tabs/InlineTabBar.js.map +1 -0
- package/lib/commonjs/tabs/tabConstants.js +22 -0
- package/lib/commonjs/tabs/tabConstants.js.map +1 -0
- package/lib/commonjs/tabs/tabDebug.js +50 -0
- package/lib/commonjs/tabs/tabDebug.js.map +1 -0
- package/lib/commonjs/tabs/tabStyles.js +107 -0
- package/lib/commonjs/tabs/tabStyles.js.map +1 -0
- package/lib/commonjs/tabs/useInlineTabGesture.js +227 -0
- package/lib/commonjs/tabs/useInlineTabGesture.js.map +1 -0
- package/lib/commonjs/theme/buildTheme.js +1 -1
- package/lib/commonjs/theme/buildTheme.js.map +1 -1
- package/lib/module/GlassSurface.js +135 -563
- package/lib/module/GlassSurface.js.map +1 -1
- package/lib/module/GlassTabBar.js +18 -925
- package/lib/module/GlassTabBar.js.map +1 -1
- package/lib/module/LocalGlassMaterial.js +5 -11
- package/lib/module/LocalGlassMaterial.js.map +1 -1
- package/lib/module/glassController.js +3 -7
- package/lib/module/glassController.js.map +1 -1
- package/lib/module/glassRuntime.js +7 -19
- package/lib/module/glassRuntime.js.map +1 -1
- package/lib/module/localGlassTelemetry.js +4 -13
- package/lib/module/localGlassTelemetry.js.map +1 -1
- package/lib/module/nativeGlassViews.js +7 -10
- package/lib/module/nativeGlassViews.js.map +1 -1
- package/lib/module/performanceTelemetry.js +2 -6
- package/lib/module/performanceTelemetry.js.map +1 -1
- package/lib/module/surface/InlineSurface.js +97 -0
- package/lib/module/surface/InlineSurface.js.map +1 -0
- package/lib/module/surface/MaterialProvider.js +74 -0
- package/lib/module/surface/MaterialProvider.js.map +1 -0
- package/lib/module/surface/NativeSurface.js +47 -0
- package/lib/module/surface/NativeSurface.js.map +1 -0
- package/lib/module/surface/PortalLayers.js +292 -0
- package/lib/module/surface/PortalLayers.js.map +1 -0
- package/lib/module/surface/contexts.js +96 -0
- package/lib/module/surface/contexts.js.map +1 -0
- package/lib/module/surface/registry.js +103 -0
- package/lib/module/surface/registry.js.map +1 -0
- package/lib/module/surface/styles.js +31 -0
- package/lib/module/surface/styles.js.map +1 -0
- package/lib/module/surface/types.js +2 -0
- package/lib/module/surface/types.js.map +1 -0
- package/lib/module/tabs/GlassTabItem.js +30 -0
- package/lib/module/tabs/GlassTabItem.js.map +1 -0
- package/lib/module/tabs/InlineTabBar.js +829 -0
- package/lib/module/tabs/InlineTabBar.js.map +1 -0
- package/lib/module/tabs/tabConstants.js +19 -0
- package/lib/module/tabs/tabConstants.js.map +1 -0
- package/lib/module/tabs/tabDebug.js +13 -0
- package/lib/module/tabs/tabDebug.js.map +1 -0
- package/lib/module/tabs/tabStyles.js +104 -0
- package/lib/module/tabs/tabStyles.js.map +1 -0
- package/lib/module/tabs/useInlineTabGesture.js +221 -0
- package/lib/module/tabs/useInlineTabGesture.js.map +1 -0
- package/lib/module/theme/buildTheme.js +1 -1
- package/lib/module/theme/buildTheme.js.map +1 -1
- package/lib/types/GlassSurface.d.ts +17 -86
- package/lib/types/GlassTabBar.d.ts +1 -0
- package/lib/types/glassNativeEngine.d.ts +1 -1
- package/lib/types/glassRuntime.d.ts +5 -2
- package/lib/types/localGlassTelemetry.d.ts +2 -2
- package/lib/types/nativeGlassViews.d.ts +2 -4
- package/lib/types/surface/InlineSurface.d.ts +42 -0
- package/lib/types/surface/MaterialProvider.d.ts +46 -0
- package/lib/types/surface/NativeSurface.d.ts +11 -0
- package/lib/types/surface/PortalLayers.d.ts +33 -0
- package/lib/types/surface/contexts.d.ts +66 -0
- package/lib/types/surface/registry.d.ts +6 -0
- package/lib/types/surface/styles.d.ts +74 -0
- package/lib/types/surface/types.d.ts +118 -0
- package/lib/types/tabs/GlassTabItem.d.ts +20 -0
- package/lib/types/tabs/InlineTabBar.d.ts +5 -0
- package/lib/types/tabs/tabConstants.d.ts +34 -0
- package/lib/types/tabs/tabDebug.d.ts +15 -0
- package/lib/types/tabs/tabStyles.d.ts +119 -0
- package/lib/types/tabs/useInlineTabGesture.d.ts +34 -0
- package/package.json +6 -14
- package/src/GlassSurface.tsx +227 -1337
- package/src/GlassTabBar.tsx +43 -1241
- package/src/LocalGlassMaterial.tsx +5 -11
- package/src/glassController.ts +3 -7
- package/src/glassRuntime.ts +9 -26
- package/src/localGlassTelemetry.ts +6 -15
- package/src/nativeGlassViews.ts +7 -10
- package/src/performanceTelemetry.ts +2 -6
- package/src/surface/InlineSurface.tsx +299 -0
- package/src/surface/MaterialProvider.tsx +235 -0
- package/src/surface/NativeSurface.tsx +115 -0
- package/src/surface/PortalLayers.tsx +574 -0
- package/src/surface/contexts.tsx +188 -0
- package/src/surface/registry.ts +109 -0
- package/src/surface/styles.ts +31 -0
- package/src/surface/types.ts +139 -0
- package/src/tabs/GlassTabItem.tsx +100 -0
- package/src/tabs/InlineTabBar.tsx +1193 -0
- package/src/tabs/tabConstants.ts +35 -0
- package/src/tabs/tabDebug.ts +29 -0
- package/src/tabs/tabStyles.ts +104 -0
- package/src/tabs/useInlineTabGesture.ts +306 -0
- package/src/theme/buildTheme.ts +1 -1
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassModule.kt +0 -341
- package/android/src/main/java/expo/modules/localglass/LocalGlassShader.kt +0 -59
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassCoreModule.kt +0 -226
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/GlassViewRenderer.kt +0 -1459
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/HeightFieldGlassShader.kt +0 -7
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassEngineSelection.kt +0 -30
- package/patches/liquid-glass-kit+1.0.0.patch +0 -2015
- package/patches/liquid-glass-kit-invalidation-coalescing.diff +0 -249
- package/patches/liquid-glass-kit-native-infra.diff +0 -624
- package/scripts/apply-legacy-patches.mjs +0 -116
|
@@ -33,18 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.GlassSurface = void 0;
|
|
37
|
-
exports.GlassPortalScrollScope = GlassPortalScrollScope;
|
|
38
|
-
exports.GlassRouteTransitionScope = GlassRouteTransitionScope;
|
|
39
|
-
exports.useGlassReducedMotion = useGlassReducedMotion;
|
|
40
|
-
exports.useGlassInsideScroll = useGlassInsideScroll;
|
|
41
|
-
exports.useGlassInsideCaptureScope = useGlassInsideCaptureScope;
|
|
42
|
-
exports.useGlassAppearance = useGlassAppearance;
|
|
43
|
-
exports.useGlassSamplingProviderId = useGlassSamplingProviderId;
|
|
44
|
-
exports.RouteGlassCaptureScope = RouteGlassCaptureScope;
|
|
45
|
-
exports.RouteGlassCaptureSource = RouteGlassCaptureSource;
|
|
46
|
-
exports.GlassAppearanceProvider = GlassAppearanceProvider;
|
|
47
|
-
exports.GlassMaterialProvider = GlassMaterialProvider;
|
|
36
|
+
exports.GlassMaterialProvider = exports.GlassAppearanceProvider = exports.RouteGlassCaptureSource = exports.RouteGlassCaptureScope = exports.useGlassSamplingProviderId = exports.useGlassAppearance = exports.useGlassInsideCaptureScope = exports.useGlassInsideScroll = exports.useGlassReducedMotion = exports.GlassRouteTransitionScope = exports.GlassPortalScrollScope = exports.GlassSurface = void 0;
|
|
48
37
|
exports.useGlassProviderId = useGlassProviderId;
|
|
49
38
|
exports.useGlassOverlayHostRef = useGlassOverlayHostRef;
|
|
50
39
|
exports.GlassOverlay = GlassOverlay;
|
|
@@ -52,490 +41,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
52
41
|
const react_1 = __importStar(require("react"));
|
|
53
42
|
const react_native_1 = require("react-native");
|
|
54
43
|
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const nativeGlassViews_1 = require("./nativeGlassViews");
|
|
59
|
-
const AnimatedLegacyGlassSurfaceView = react_native_reanimated_1.default.createAnimatedComponent(nativeGlassViews_1.LegacyGlassSurfaceView);
|
|
60
|
-
const AnimatedCoreGlassSurfaceView = nativeGlassViews_1.CoreGlassSurfaceView
|
|
61
|
-
? react_native_reanimated_1.default.createAnimatedComponent(nativeGlassViews_1.CoreGlassSurfaceView)
|
|
62
|
-
: null;
|
|
63
|
-
const GlassRuntimeContext = (0, react_1.createContext)(null);
|
|
64
|
-
const GlassCaptureSourceContext = (0, react_1.createContext)(null);
|
|
65
|
-
const GlassNativeEngineContext = (0, react_1.createContext)('legacy');
|
|
66
|
-
const GlassRouteTransitionContext = (0, react_1.createContext)(null);
|
|
67
|
-
const GlassPortalScrollContext = (0, react_1.createContext)({ offsets: [], layoutRevision: 0, groupKey: '' });
|
|
68
|
-
const GlassMeasureOnlyContext = (0, react_1.createContext)(false);
|
|
69
|
-
/** Keeps backdrop surfaces aligned with content inside a scroll container. */
|
|
70
|
-
function GlassPortalScrollScope({ scrollOffset, layoutRevision = 0, children, }) {
|
|
71
|
-
const scopeId = (0, react_1.useId)();
|
|
72
|
-
const parent = (0, react_1.useContext)(GlassPortalScrollContext);
|
|
73
|
-
const value = (0, react_1.useMemo)(() => ({
|
|
74
|
-
offsets: [...parent.offsets, scrollOffset],
|
|
75
|
-
layoutRevision: parent.layoutRevision + layoutRevision,
|
|
76
|
-
groupKey: parent.groupKey ? `${parent.groupKey}|${scopeId}` : scopeId,
|
|
77
|
-
}), [layoutRevision, parent, scopeId, scrollOffset]);
|
|
78
|
-
return (0, jsx_runtime_1.jsx)(GlassPortalScrollContext.Provider, { value: value, children: children });
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Shares a route's horizontal transition with portaled glass surfaces.
|
|
82
|
-
* Backdrop surfaces live in a host-level overlay, so an ancestor transform is
|
|
83
|
-
* not inherited automatically. This scope keeps their window frames and the
|
|
84
|
-
* visible React Native content on the same animation value.
|
|
85
|
-
*/
|
|
86
|
-
function GlassRouteTransitionScope({ translateX, children, }) {
|
|
87
|
-
return (0, jsx_runtime_1.jsx)(GlassRouteTransitionContext.Provider, { value: translateX, children: children });
|
|
88
|
-
}
|
|
89
|
-
function useGlassReducedMotion() {
|
|
90
|
-
return (0, react_1.useContext)(GlassRuntimeContext)?.reducedMotion ?? false;
|
|
91
|
-
}
|
|
92
|
-
function useGlassInsideScroll() {
|
|
93
|
-
return (0, react_1.useContext)(GlassPortalScrollContext).offsets.length > 0;
|
|
94
|
-
}
|
|
95
|
-
function useGlassInsideCaptureScope() {
|
|
96
|
-
return (0, react_1.useContext)(GlassCaptureSourceContext) !== null;
|
|
97
|
-
}
|
|
98
|
-
function useGlassAppearance() {
|
|
99
|
-
return (0, react_1.useContext)(GlassRuntimeContext);
|
|
100
|
-
}
|
|
101
|
-
/** Resolve the provider that represents the visible scene for a glass consumer. */
|
|
102
|
-
function useGlassSamplingProviderId(source = 'routeScene') {
|
|
103
|
-
const host = (0, react_1.useContext)(GlassHostContext);
|
|
104
|
-
const captureSourceProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
105
|
-
if (!host)
|
|
106
|
-
return null;
|
|
107
|
-
return source === 'themeBackdrop'
|
|
108
|
-
? host.themeBackdropProviderId
|
|
109
|
-
: captureSourceProviderId ?? host.routeSceneProviderId ?? host.themeBackdropProviderId;
|
|
110
|
-
}
|
|
111
|
-
function createEntryRegistry() {
|
|
112
|
-
const entries = new Map();
|
|
113
|
-
const listeners = new Set();
|
|
114
|
-
let snapshot = [];
|
|
115
|
-
const publish = () => {
|
|
116
|
-
snapshot = Array.from(entries.entries());
|
|
117
|
-
for (const listener of listeners)
|
|
118
|
-
listener();
|
|
119
|
-
};
|
|
120
|
-
return {
|
|
121
|
-
getSnapshot: () => snapshot,
|
|
122
|
-
subscribe: (listener) => {
|
|
123
|
-
listeners.add(listener);
|
|
124
|
-
return () => listeners.delete(listener);
|
|
125
|
-
},
|
|
126
|
-
update: (id, entry, equals) => {
|
|
127
|
-
const previous = entries.get(id);
|
|
128
|
-
if (previous !== undefined && equals(previous, entry))
|
|
129
|
-
return;
|
|
130
|
-
entries.set(id, entry);
|
|
131
|
-
publish();
|
|
132
|
-
},
|
|
133
|
-
remove: (id) => {
|
|
134
|
-
if (!entries.delete(id))
|
|
135
|
-
return;
|
|
136
|
-
publish();
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function useRegistrySnapshot(registry) {
|
|
141
|
-
return react_1.default.useSyncExternalStore(registry.subscribe, registry.getSnapshot, registry.getSnapshot);
|
|
142
|
-
}
|
|
143
|
-
function sameSurface(previous, next) {
|
|
144
|
-
return previous.frame.x === next.frame.x && previous.frame.y === next.frame.y &&
|
|
145
|
-
previous.frame.width === next.frame.width && previous.frame.height === next.frame.height &&
|
|
146
|
-
previous.positioning === next.positioning && previous.samplingSource === next.samplingSource &&
|
|
147
|
-
previous.samplingProviderId === next.samplingProviderId &&
|
|
148
|
-
previous.tintColor === next.tintColor && previous.portalContent === next.portalContent &&
|
|
149
|
-
previous.contentAboveGlass === next.contentAboveGlass && previous.content === next.content && previous.contentStyle === next.contentStyle &&
|
|
150
|
-
previous.variant === next.variant && previous.interactive === next.interactive && previous.continuous === next.continuous &&
|
|
151
|
-
previous.sharedSource === next.sharedSource && previous.captureProbe === next.captureProbe &&
|
|
152
|
-
previous.opticalProgress === next.opticalProgress && previous.scrollGroupKey === next.scrollGroupKey && previous.scrollOffsets === next.scrollOffsets && previous.routeTransitionX === next.routeTransitionX && previous.portalOffsetStyle === next.portalOffsetStyle && previous.portalTranslateX === next.portalTranslateX && previous.portalTranslateY === next.portalTranslateY && previous.portalScaleX === next.portalScaleX && previous.portalScaleY === next.portalScaleY && previous.pointerEvent === next.pointerEvent && previous.pointerEventValue === next.pointerEventValue && previous.pointerEventSink === next.pointerEventSink && previous.valueEvent === next.valueEvent && previous.valueEventSink === next.valueEventSink && previous.opticalToggleFraction === next.opticalToggleFraction && previous.opticalProgressValue === next.opticalProgressValue && previous.opticalPointX === next.opticalPointX && previous.opticalPointY === next.opticalPointY && previous.opticalMotionX === next.opticalMotionX && previous.opticalMotionY === next.opticalMotionY &&
|
|
153
|
-
previous.opticalVelocityX === next.opticalVelocityX && previous.opticalVelocityY === next.opticalVelocityY &&
|
|
154
|
-
previous.materialOverrides === next.materialOverrides && previous.displacementOnlyDebug === next.displacementOnlyDebug &&
|
|
155
|
-
previous.syncContentTransform === next.syncContentTransform &&
|
|
156
|
-
previous.shapeMaskText === next.shapeMaskText && previous.shapeMaskFontSize === next.shapeMaskFontSize && previous.shapeMaskFontWeight === next.shapeMaskFontWeight &&
|
|
157
|
-
previous.progressiveBlurIntensity === next.progressiveBlurIntensity &&
|
|
158
|
-
previous.animatedStyle === next.animatedStyle && previous.placement === next.placement &&
|
|
159
|
-
previous.bottomInset === next.bottomInset && previous.zIndex === next.zIndex;
|
|
160
|
-
}
|
|
161
|
-
function sameOverlay(previous, next) {
|
|
162
|
-
return previous.children === next.children && previous.style === next.style &&
|
|
163
|
-
previous.frame?.x === next.frame?.x && previous.frame?.y === next.frame?.y &&
|
|
164
|
-
previous.frame?.width === next.frame?.width && previous.frame?.height === next.frame?.height &&
|
|
165
|
-
previous.scrollOffsets === next.scrollOffsets && previous.routeTransitionX === next.routeTransitionX &&
|
|
166
|
-
previous.portalOffsetStyle === next.portalOffsetStyle && previous.zIndex === next.zIndex;
|
|
167
|
-
}
|
|
168
|
-
function selectBalancedShaderSurfaces(entries) {
|
|
169
|
-
// Every mounted backdrop surface keeps the same renderer regardless of
|
|
170
|
-
// quality preset; display cadence is selected by the native provider.
|
|
171
|
-
return new Set(entries.map(([id]) => id));
|
|
172
|
-
}
|
|
173
|
-
const GlassHostContext = (0, react_1.createContext)(null);
|
|
174
|
-
function RouteGlassCaptureScope({ children, active = true, scopeId = 'page-content' }) {
|
|
175
|
-
const host = (0, react_1.useContext)(GlassHostContext);
|
|
176
|
-
const parentActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
177
|
-
const parentProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
178
|
-
const baseId = parentProviderId ?? host?.providerId ?? null;
|
|
179
|
-
const providerId = baseId ? `${baseId}:${scopeId}` : null;
|
|
180
|
-
return ((0, jsx_runtime_1.jsx)(GlassScopeActiveContext.Provider, { value: active && parentActive, children: (0, jsx_runtime_1.jsx)(GlassCaptureSourceContext.Provider, { value: providerId, children: children }) }));
|
|
181
|
-
}
|
|
182
|
-
function RouteGlassCaptureSource({ children, captureMode, captureOnly = false, sourceRevision, underlayProviderId, style, }) {
|
|
183
|
-
const host = (0, react_1.useContext)(GlassHostContext);
|
|
184
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
185
|
-
const scopedProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
186
|
-
const scopeActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
187
|
-
const inactiveId = (0, react_1.useId)();
|
|
188
|
-
// Pager siblings share a route-scene alias. A hidden page must retain its
|
|
189
|
-
// native tree without replacing the visible page in the provider registry.
|
|
190
|
-
const providerId = !scopeActive && scopedProviderId
|
|
191
|
-
? `${scopedProviderId}:inactive:${inactiveId}`
|
|
192
|
-
: scopedProviderId;
|
|
193
|
-
if (!host || !providerId || !runtime?.tokens.enabled)
|
|
194
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
195
|
-
const resolvedCaptureMode = !scopeActive ? 'frozen'
|
|
196
|
-
: captureMode ?? (react_native_1.Platform.OS === 'android' && (0, glassNativeEngine_1.getGlassNativeEngine)() === 'core' ? 'oneShotPassThrough' : 'live');
|
|
197
|
-
const resolvedUnderlay = underlayProviderId === null
|
|
198
|
-
? undefined
|
|
199
|
-
: underlayProviderId ?? host.routeSceneProviderId ?? host.themeBackdropProviderId;
|
|
200
|
-
return ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: resolvedUnderlay, captureMode: resolvedCaptureMode, captureOnly: (0, glassNativeEngine_1.getGlassNativeEngine)() === 'core' ? captureOnly : undefined, sourceRevision: sourceRevision, pointerEvents: "box-none", style: [styles.captureSource, style], children: children }));
|
|
201
|
-
}
|
|
202
|
-
function NativeBackdropSurface({ opticsModel, sdfDisplacementMapDebug, sdfContrast, sdfBrightness, sdfSaturation, sdfOuterShadowAlpha, sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY, sdfInnerShadowAlpha, sdfInnerShadowExtent, shapeMaskText, shapeMaskFontSize, shapeMaskFontWeight, sharedPassOrder, sharedPassZIndex, pointerEventSink, valueEventSink, syncContentTransform, renderingEnabled = true, ...props }) {
|
|
203
|
-
const nativeEngine = (0, react_1.useContext)(GlassNativeEngineContext);
|
|
204
|
-
const nativeViewRef = (0, react_1.useRef)(null);
|
|
205
|
-
(0, react_1.useEffect)(() => {
|
|
206
|
-
const viewTag = nativeEngine === 'core' && nativeViewRef.current
|
|
207
|
-
? (0, react_native_1.findNodeHandle)(nativeViewRef.current)
|
|
208
|
-
: null;
|
|
209
|
-
if (pointerEventSink) {
|
|
210
|
-
pointerEventSink.current = viewTag == null
|
|
211
|
-
? null
|
|
212
|
-
: (payload) => (0, glassController_1.forwardPointerToSurface)(viewTag, payload);
|
|
213
|
-
}
|
|
214
|
-
if (valueEventSink) {
|
|
215
|
-
valueEventSink.current = viewTag == null
|
|
216
|
-
? null
|
|
217
|
-
: (payload) => (0, glassController_1.forwardValueToSurface)(viewTag, payload);
|
|
218
|
-
}
|
|
219
|
-
return () => {
|
|
220
|
-
if (pointerEventSink)
|
|
221
|
-
pointerEventSink.current = null;
|
|
222
|
-
if (valueEventSink)
|
|
223
|
-
valueEventSink.current = null;
|
|
224
|
-
};
|
|
225
|
-
}, [nativeEngine, pointerEventSink, valueEventSink]);
|
|
226
|
-
// 'core' is the default, but the core view only exists on Android. Falling back
|
|
227
|
-
// to the legacy view there keeps iOS and any missing registration drawing
|
|
228
|
-
// something instead of nothing.
|
|
229
|
-
if (nativeEngine === 'core') {
|
|
230
|
-
if (props.animatedProps == null && nativeGlassViews_1.CoreGlassSurfaceView) {
|
|
231
|
-
const { animatedProps: _unused, ...staticProps } = props;
|
|
232
|
-
return ((0, jsx_runtime_1.jsx)(nativeGlassViews_1.CoreGlassSurfaceView, { ref: nativeViewRef, renderingEnabled: renderingEnabled, ...staticProps, sharedPassOrder: sharedPassOrder, sharedPassZIndex: sharedPassZIndex, opticsModel: opticsModel, sdfDisplacementMapDebug: sdfDisplacementMapDebug, sdfContrast: sdfContrast, sdfBrightness: sdfBrightness, sdfSaturation: sdfSaturation, sdfOuterShadowAlpha: sdfOuterShadowAlpha, sdfOuterShadowBlurRadius: sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY: sdfOuterShadowOffsetY, sdfInnerShadowAlpha: sdfInnerShadowAlpha, sdfInnerShadowExtent: sdfInnerShadowExtent, shapeMaskText: shapeMaskText, shapeMaskFontSize: shapeMaskFontSize, shapeMaskFontWeight: shapeMaskFontWeight, syncContentTransform: syncContentTransform }));
|
|
233
|
-
}
|
|
234
|
-
if (AnimatedCoreGlassSurfaceView) {
|
|
235
|
-
return ((0, jsx_runtime_1.jsx)(AnimatedCoreGlassSurfaceView, { ref: nativeViewRef, renderingEnabled: renderingEnabled, ...props, sharedPassOrder: sharedPassOrder, sharedPassZIndex: sharedPassZIndex, opticsModel: opticsModel, sdfDisplacementMapDebug: sdfDisplacementMapDebug, sdfContrast: sdfContrast, sdfBrightness: sdfBrightness, sdfSaturation: sdfSaturation, sdfOuterShadowAlpha: sdfOuterShadowAlpha, sdfOuterShadowBlurRadius: sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY: sdfOuterShadowOffsetY, sdfInnerShadowAlpha: sdfInnerShadowAlpha, sdfInnerShadowExtent: sdfInnerShadowExtent, shapeMaskText: shapeMaskText, shapeMaskFontSize: shapeMaskFontSize, shapeMaskFontWeight: shapeMaskFontWeight, syncContentTransform: syncContentTransform }));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return (0, jsx_runtime_1.jsx)(AnimatedLegacyGlassSurfaceView, { ...props, style: [props.style, !renderingEnabled ? { opacity: 0 } : undefined] });
|
|
239
|
-
}
|
|
240
|
-
function GlassCaptureSourceView({ children, ...props }) {
|
|
241
|
-
const nativeEngine = (0, react_1.useContext)(GlassNativeEngineContext);
|
|
242
|
-
if (nativeEngine === 'core' && nativeGlassViews_1.CoreGlassCaptureSource) {
|
|
243
|
-
return (0, jsx_runtime_1.jsx)(nativeGlassViews_1.CoreGlassCaptureSource, { ...props, children: children });
|
|
244
|
-
}
|
|
245
|
-
return (0, jsx_runtime_1.jsx)(nativeGlassViews_1.LegacyGlassCaptureSource, { ...props, children: children });
|
|
246
|
-
}
|
|
247
|
-
const GlassOverlayHostContext = (0, react_1.createContext)(null);
|
|
248
|
-
/**
|
|
249
|
-
* Page-level scope for glass surfaces.
|
|
250
|
-
*
|
|
251
|
-
* Every page under a PagerView shares one provider id (`host.providerId +
|
|
252
|
-
* ':page-content'`) and one registry, and GlassSurfacePortalLayer draws every
|
|
253
|
-
* registered entry in a provider-level layer above page content. So a kept-alive
|
|
254
|
-
* page's surfaces paint on top of whichever page is actually visible: on Home
|
|
255
|
-
* that showed up as an empty 344x55dp panel under the search bar, which turned
|
|
256
|
-
* out to be the User page's segmented control.
|
|
257
|
-
*
|
|
258
|
-
* A surface whose scope is inactive stops publishing. Layout is untouched; only
|
|
259
|
-
* the registry entry goes away, so nothing is drawn for it.
|
|
260
|
-
*/
|
|
261
|
-
const GlassScopeActiveContext = (0, react_1.createContext)(true);
|
|
262
|
-
function GlassAppearanceProvider({ children, tokens, dark, reducedMotion = false }) {
|
|
263
|
-
const runtime = (0, react_1.useMemo)(() => ({ tokens, dark, reducedMotion }), [tokens, dark, reducedMotion]);
|
|
264
|
-
return (0, jsx_runtime_1.jsx)(GlassRuntimeContext.Provider, { value: runtime, children: children });
|
|
265
|
-
}
|
|
266
|
-
function GlassMaterialProvider({ children, backdrop, themeBackdrop, themeBackdropRevision, inlineBackdropByDefault = false, defaultSamplingSource = 'routeScene', providerId: providerIdProp, style, tokens, dark, reducedMotion = false, active = true }) {
|
|
267
|
-
const hostRef = (0, react_1.useRef)(null);
|
|
268
|
-
const generatedProviderId = (0, react_1.useId)();
|
|
269
|
-
const providerId = providerIdProp ?? generatedProviderId;
|
|
270
|
-
const routeSceneProviderId = backdrop !== undefined ? providerId : null;
|
|
271
|
-
const generatedThemeBackdropProviderId = (0, react_1.useId)();
|
|
272
|
-
// When a separate stable theme backdrop was not supplied, the provider's
|
|
273
|
-
// base backdrop is the stable scene. Aliasing its id avoids recording that
|
|
274
|
-
// exact scene into a second native source just to support inline lenses.
|
|
275
|
-
const themeBackdropProviderId = themeBackdrop !== undefined ? generatedThemeBackdropProviderId : providerId;
|
|
276
|
-
const surfaceRegistryRef = (0, react_1.useRef)(null);
|
|
277
|
-
const overlayRegistryRef = (0, react_1.useRef)(null);
|
|
278
|
-
if (!surfaceRegistryRef.current)
|
|
279
|
-
surfaceRegistryRef.current = createEntryRegistry();
|
|
280
|
-
if (!overlayRegistryRef.current)
|
|
281
|
-
overlayRegistryRef.current = createEntryRegistry();
|
|
282
|
-
const surfaceRegistry = surfaceRegistryRef.current;
|
|
283
|
-
const overlayRegistry = overlayRegistryRef.current;
|
|
284
|
-
const runtime = (0, react_1.useMemo)(() => ({ tokens, dark, reducedMotion }), [tokens, dark, reducedMotion]);
|
|
285
|
-
const nativeEngine = (0, react_1.useSyncExternalStore)(glassNativeEngine_1.subscribeGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine);
|
|
286
|
-
const updateSurface = (0, react_1.useCallback)((id, entry) => {
|
|
287
|
-
surfaceRegistry.update(id, entry, sameSurface);
|
|
288
|
-
}, [surfaceRegistry]);
|
|
289
|
-
const updateOverlay = (0, react_1.useCallback)((id, entry) => {
|
|
290
|
-
overlayRegistry.update(id, entry, sameOverlay);
|
|
291
|
-
}, [overlayRegistry]);
|
|
292
|
-
const removeOverlay = (0, react_1.useCallback)((id) => {
|
|
293
|
-
overlayRegistry.remove(id);
|
|
294
|
-
}, [overlayRegistry]);
|
|
295
|
-
const remove = (0, react_1.useCallback)((id) => {
|
|
296
|
-
surfaceRegistry.remove(id);
|
|
297
|
-
overlayRegistry.remove(id);
|
|
298
|
-
}, [surfaceRegistry, overlayRegistry]);
|
|
299
|
-
const hasSeparateBackdrop = backdrop !== undefined;
|
|
300
|
-
const context = (0, react_1.useMemo)(() => ({ providerId, routeSceneProviderId, themeBackdropProviderId, inlineBackdropByDefault, hasSeparateBackdrop, defaultSamplingSource, hostRef, updateSurface, updateOverlay, removeOverlay, remove }), [providerId, routeSceneProviderId, themeBackdropProviderId, inlineBackdropByDefault, hasSeparateBackdrop, defaultSamplingSource, updateSurface, updateOverlay, removeOverlay, remove]);
|
|
301
|
-
const overlayContext = (0, react_1.useMemo)(() => ({ providerId, updateOverlay, remove }), [providerId, updateOverlay, remove]);
|
|
302
|
-
const recording = active && tokens.enabled;
|
|
303
|
-
return ((0, jsx_runtime_1.jsx)(GlassNativeEngineContext.Provider, { value: nativeEngine, children: (0, jsx_runtime_1.jsx)(GlassRuntimeContext.Provider, { value: runtime, children: (0, jsx_runtime_1.jsx)(GlassHostContext.Provider, { value: context, children: (0, jsx_runtime_1.jsx)(GlassOverlayHostContext.Provider, { value: overlayContext, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: hostRef, collapsable: false, style: [styles.root, style], children: (0, jsx_runtime_1.jsxs)(GlassScopeActiveContext.Provider, { value: recording, children: [recording && themeBackdrop !== undefined ? ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: themeBackdropProviderId, captureMode: "static", sourceRevision: themeBackdropRevision, pointerEvents: "none", style: react_native_1.StyleSheet.absoluteFill, children: themeBackdrop })) : null, hasSeparateBackdrop ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: themeBackdrop !== undefined ? themeBackdropProviderId : undefined, captureMode: recording ? 'live' : 'frozen', style: react_native_1.StyleSheet.absoluteFill, children: backdrop }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: children })] })) : ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: themeBackdrop !== undefined ? themeBackdropProviderId : undefined, captureMode: recording ? 'live' : 'frozen', style: react_native_1.StyleSheet.absoluteFill, children: children })), (0, jsx_runtime_1.jsx)(GlassSurfacePortalLayer, { registry: surfaceRegistry, tokens: tokens }), (0, jsx_runtime_1.jsx)(GlassRouteOverlayLayer, { registry: overlayRegistry, enabled: recording })] }) }) }) }) }) }));
|
|
304
|
-
}
|
|
305
|
-
function GlassSurfacePortalLayer({ registry, tokens }) {
|
|
306
|
-
const entries = useRegistrySnapshot(registry);
|
|
307
|
-
const balancedShaderSurfaces = (0, react_1.useMemo)(() => selectBalancedShaderSurfaces(entries), [entries]);
|
|
308
|
-
const groups = (0, react_1.useMemo)(() => {
|
|
309
|
-
const list = [];
|
|
310
|
-
const byKey = new Map();
|
|
311
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
312
|
-
const pair = entries[i];
|
|
313
|
-
const entry = pair[1];
|
|
314
|
-
const routeId = getSharedValueId(entry.routeTransitionX);
|
|
315
|
-
const key = `${entry.zIndex}::${entry.scrollGroupKey}::${routeId}`;
|
|
316
|
-
let group = byKey.get(key);
|
|
317
|
-
if (!group) {
|
|
318
|
-
group = {
|
|
319
|
-
key,
|
|
320
|
-
zIndex: entry.zIndex,
|
|
321
|
-
offsets: entry.scrollOffsets,
|
|
322
|
-
routeTransitionX: entry.routeTransitionX,
|
|
323
|
-
items: [],
|
|
324
|
-
};
|
|
325
|
-
byKey.set(key, group);
|
|
326
|
-
list.push(group);
|
|
327
|
-
}
|
|
328
|
-
group.items.push(pair);
|
|
329
|
-
}
|
|
330
|
-
return list;
|
|
331
|
-
}, [entries]);
|
|
332
|
-
if (!tokens.enabled)
|
|
333
|
-
return null;
|
|
334
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: groups.map((group) => {
|
|
335
|
-
const content = group.items.map(([id, entry]) => ((0, jsx_runtime_1.jsx)(PortalGlassSurface, { providerId: entry.samplingProviderId, entry: entry, drawOrder: 0, shaderEnabled: tokens.quality === 'high' || (tokens.quality === 'balanced' && balancedShaderSurfaces.has(id)) }, id)));
|
|
336
|
-
if (group.offsets.length === 0 && !group.routeTransitionX) {
|
|
337
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, { zIndex: group.zIndex }], children: content }, group.key));
|
|
338
|
-
}
|
|
339
|
-
return ((0, jsx_runtime_1.jsx)(PortalScrollGroupContainer, { offsets: group.offsets, routeTransitionX: group.routeTransitionX, zIndex: group.zIndex, children: content }, group.key));
|
|
340
|
-
}) }));
|
|
341
|
-
}
|
|
342
|
-
const sharedValueGroupIds = new WeakMap();
|
|
343
|
-
let nextSharedValueGroupId = 1;
|
|
344
|
-
function getSharedValueId(value) {
|
|
345
|
-
if (!value)
|
|
346
|
-
return 0;
|
|
347
|
-
let id = sharedValueGroupIds.get(value);
|
|
348
|
-
if (id == null) {
|
|
349
|
-
id = nextSharedValueGroupId++;
|
|
350
|
-
sharedValueGroupIds.set(value, id);
|
|
351
|
-
}
|
|
352
|
-
return id;
|
|
353
|
-
}
|
|
354
|
-
const PortalScrollGroupContainer = react_1.default.memo(function PortalScrollGroupContainer({ offsets, routeTransitionX, zIndex, children, }) {
|
|
355
|
-
const groupTransformStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
356
|
-
let scrollY = 0;
|
|
357
|
-
for (let index = 0; index < offsets.length; index += 1) {
|
|
358
|
-
scrollY += offsets[index].value;
|
|
359
|
-
}
|
|
360
|
-
return {
|
|
361
|
-
transform: [
|
|
362
|
-
{ translateX: routeTransitionX?.value ?? 0 },
|
|
363
|
-
{ translateY: -scrollY },
|
|
364
|
-
],
|
|
365
|
-
};
|
|
366
|
-
}, [offsets, routeTransitionX]);
|
|
367
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, groupTransformStyle, { zIndex }], children: children }));
|
|
368
|
-
});
|
|
369
|
-
function GlassRouteOverlayLayer({ registry, enabled }) {
|
|
370
|
-
const entries = useRegistrySnapshot(registry);
|
|
371
|
-
if (!enabled)
|
|
372
|
-
return null;
|
|
373
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: entries.map(([id, entry]) => (0, jsx_runtime_1.jsx)(RouteOverlayView, { entry: entry }, id)) }));
|
|
374
|
-
}
|
|
375
|
-
const RouteOverlayView = react_1.default.memo(function RouteOverlayView({ entry }) {
|
|
376
|
-
const offsets = entry.scrollOffsets;
|
|
377
|
-
const routeTransitionX = entry.routeTransitionX;
|
|
378
|
-
const scrollTransformStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
379
|
-
let scrollY = 0;
|
|
380
|
-
if (offsets) {
|
|
381
|
-
for (let index = 0; index < offsets.length; index += 1) {
|
|
382
|
-
scrollY += offsets[index].value;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return {
|
|
386
|
-
transform: [
|
|
387
|
-
{ translateX: routeTransitionX?.value ?? 0 },
|
|
388
|
-
{ translateY: -scrollY },
|
|
389
|
-
],
|
|
390
|
-
};
|
|
391
|
-
}, [offsets, routeTransitionX]);
|
|
392
|
-
const hasScrollOrRoute = (offsets != null && offsets.length > 0) || routeTransitionX != null;
|
|
393
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, entry.style, { zIndex: entry.zIndex }], children: entry.frame ? ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [
|
|
394
|
-
{ position: 'absolute', left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
395
|
-
hasScrollOrRoute ? scrollTransformStyle : undefined,
|
|
396
|
-
entry.portalOffsetStyle,
|
|
397
|
-
], children: entry.children })) : entry.children }));
|
|
398
|
-
});
|
|
399
|
-
const PortalGlassSurface = react_1.default.memo(function PortalGlassSurface({ providerId, entry, drawOrder, shaderEnabled }) {
|
|
400
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
401
|
-
const opticalProgress = entry.opticalProgress;
|
|
402
|
-
const pointerEvent = entry.pointerEvent;
|
|
403
|
-
const pointerEventValue = entry.pointerEventValue;
|
|
404
|
-
const pointerEventSink = entry.pointerEventSink;
|
|
405
|
-
const valueEvent = entry.valueEvent;
|
|
406
|
-
const valueEventSink = entry.valueEventSink;
|
|
407
|
-
const opticalToggleFraction = entry.opticalToggleFraction;
|
|
408
|
-
const opticalProgressValue = entry.opticalProgressValue;
|
|
409
|
-
const opticalPointX = entry.opticalPointX;
|
|
410
|
-
const opticalPointY = entry.opticalPointY;
|
|
411
|
-
const opticalVelocityX = entry.opticalVelocityX;
|
|
412
|
-
const opticalVelocityY = entry.opticalVelocityY;
|
|
413
|
-
const opticalMotionX = entry.opticalMotionX;
|
|
414
|
-
const opticalMotionY = entry.opticalMotionY;
|
|
415
|
-
const hasAnimatedOptics = Boolean(opticalPointX || opticalPointY || opticalVelocityX || opticalVelocityY ||
|
|
416
|
-
opticalProgressValue != null || opticalProgress || opticalToggleFraction ||
|
|
417
|
-
opticalMotionX || opticalMotionY);
|
|
418
|
-
const animatedOptics = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
419
|
-
interactionVelocityX: opticalVelocityX?.value,
|
|
420
|
-
interactionVelocityY: opticalVelocityY?.value,
|
|
421
|
-
interactionPointX: opticalPointX?.value,
|
|
422
|
-
interactionPointY: opticalPointY?.value,
|
|
423
|
-
interactionProgress: opticalProgressValue ?? opticalProgress?.value ?? 0,
|
|
424
|
-
toggleFraction: opticalToggleFraction?.value ?? 0,
|
|
425
|
-
motionX: opticalMotionX ? Math.max(-1, Math.min(1, opticalMotionX.value / 1800)) : undefined,
|
|
426
|
-
motionY: opticalMotionY ? Math.max(-1, Math.min(1, opticalMotionY.value / 1800)) : undefined,
|
|
427
|
-
}), [opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalProgress, pointerEventValue, valueEvent, opticalToggleFraction, opticalProgressValue, opticalMotionX, opticalMotionY]);
|
|
428
|
-
if (!runtime)
|
|
429
|
-
return null;
|
|
430
|
-
const { tokens, dark, reducedMotion } = runtime;
|
|
431
|
-
// Backdrop glass is drawn in a sibling overlay, above the actual control.
|
|
432
|
-
// Some native render backends still participate in Android hit testing even
|
|
433
|
-
// with pointerEvents="none" on the native view itself, so make the whole
|
|
434
|
-
// portal subtree untargetable for passive lenses. Keep box-none where its
|
|
435
|
-
// React content or an explicitly interactive surface needs to receive input.
|
|
436
|
-
const portalPointerEvents = entry.interactive || entry.portalContent || entry.contentAboveGlass
|
|
437
|
-
? 'box-none'
|
|
438
|
-
: 'none';
|
|
439
|
-
const material = entry.materialOverrides
|
|
440
|
-
? { ...tokens.materials[entry.variant], ...entry.materialOverrides }
|
|
441
|
-
: tokens.materials[entry.variant];
|
|
442
|
-
const qualityScale = material.opticsModel === 'referenceParity'
|
|
443
|
-
? 1
|
|
444
|
-
: tokens.quality === 'high' ? 1.2 : tokens.quality === 'fallback' ? 0.45 : 1;
|
|
445
|
-
if (!shaderEnabled)
|
|
446
|
-
return (0, jsx_runtime_1.jsx)(PortalFallbackSurface, { entry: entry });
|
|
447
|
-
const nativeSurface = ((0, jsx_runtime_1.jsx)(NativeBackdropSurface, { providerId: providerId, sharedPassZIndex: entry.zIndex, sharedPassOrder: drawOrder, opticsModel: material.opticsModel, shapeMaskText: entry.shapeMaskText, shapeMaskFontSize: entry.shapeMaskFontSize, shapeMaskFontWeight: entry.shapeMaskFontWeight, progressiveBlurIntensity: entry.progressiveBlurIntensity, depthEffect: material.referenceDepthEffect ?? false, highlightStyle: material.referenceHighlightStyle, interactionProfile: material.referenceInteractionProfile, contentScaleX: material.referenceContentScaleX, contentScaleY: material.referenceContentScaleY, sampleOffsetX: material.referenceSampleOffsetX, sampleOffsetY: material.referenceSampleOffsetY, toggleTrackColorOff: material.referenceToggleTrackColorOff, toggleTrackColorOn: material.referenceToggleTrackColorOn, toggleTrackWidth: material.referenceToggleTrackWidth, toggleTrackHeight: material.referenceToggleTrackHeight, toggleSolidBackdropColor: material.referenceToggleSolidBackdropColor, brightness: material.brightness ?? 0, contrast: material.contrast ?? 1, highlightFalloff: material.highlightFalloff ?? 1, sdfContrast: material.sdfScaleLens?.contrast, sdfBrightness: material.sdfScaleLens?.brightness, sdfSaturation: material.sdfScaleLens?.saturation, sdfOuterShadowAlpha: material.sdfScaleLens?.outerShadowAlpha, sdfOuterShadowBlurRadius: material.sdfScaleLens?.outerShadowBlurRadius, sdfOuterShadowOffsetY: material.sdfScaleLens?.outerShadowOffsetY, sdfInnerShadowAlpha: material.sdfScaleLens?.innerShadowAlpha, sdfInnerShadowExtent: material.sdfScaleLens?.innerShadowExtent, cornerRadius: material.radius, blurRadius: material.blurRadius * qualityScale, refractionHeight: material.refractionHeight * qualityScale, refractionAmount: material.refractionAmount * qualityScale, bodyRefractionAmount: (material.refractionBodyAmount ?? 2.5) * qualityScale, interactionProgress: opticalProgressValue ?? 0,
|
|
448
|
-
// The pointer stream must be a real prop, not only an animated one:
|
|
449
|
-
// Reanimated's animatedProps path does not reach an Expo Modules view's
|
|
450
|
-
// prop setter, so a gesture sent only there is silently dropped and the
|
|
451
|
-
// native driver never sees a single event.
|
|
452
|
-
pointerEvent: entry.pointerEventValue, pointerEventSink: pointerEventSink, valueEvent: entry.valueEvent, valueEventSink: valueEventSink, saturation: material.saturation, chromaticAberration: material.opticsModel === 'referenceParity' || tokens.quality === 'high' || entry.variant === 'tabSelectionLens'
|
|
453
|
-
? material.chromaticAberration
|
|
454
|
-
: 0, highlightAlpha: material.highlightAlpha, highlightWidth: material.highlightWidth, lightAngle: material.highlightAngle ?? 45, highlightColor: material.highlightColor ? (dark ? material.highlightColor.dark : material.highlightColor.light) : undefined, tintAlpha: material.tintAlpha ?? 1, specularStrength: material.specularStrength ?? 1, fresnelStrength: material.fresnelStrength ?? 0.85, innerShadowStrength: material.innerShadowStrength ?? (material.opticsModel === 'referenceParity' ? 0 : 0.18), shadowOpacity: material.shadowOpacity ?? (material.opticsModel === 'referenceParity' ? 0 : 0.1), shadowRadius: material.shadowRadius ?? (material.opticsModel === 'referenceParity' ? 0 : 24), shadowOffsetY: material.shadowOffsetY ?? (material.opticsModel === 'referenceParity' ? 0 : 4), tint: entry.tintColor ?? (dark ? tokens.tint.dark : tokens.tint.light), surfaceColor: material.surfaceColor ? (dark ? material.surfaceColor.dark : material.surfaceColor.light) : undefined, interactive: entry.interactive && tokens.interaction.enabled && !reducedMotion, pointerEvents: entry.interactive && tokens.interaction.enabled && !reducedMotion ? 'auto' : 'none', continuous: entry.continuous, sharedSource: entry.sharedSource, captureProbe: entry.captureProbe, motionX: undefined, motionY: undefined, displacementOnlyDebug: entry.displacementOnlyDebug, syncContentTransform: entry.syncContentTransform, animatedProps: hasAnimatedOptics ? animatedOptics : undefined, style: [
|
|
455
|
-
styles.nativeSurface,
|
|
456
|
-
entry.placement === 'layout'
|
|
457
|
-
? react_native_1.StyleSheet.absoluteFill
|
|
458
|
-
: { width: entry.frame.width > 0 ? entry.frame.width : undefined },
|
|
459
|
-
{ borderRadius: material.radius },
|
|
460
|
-
] }));
|
|
461
|
-
if (entry.placement === 'bottom' || entry.placement === 'center') {
|
|
462
|
-
const hasMotion = entry.animatedStyle != null || entry.portalOffsetStyle != null;
|
|
463
|
-
if (!hasMotion) {
|
|
464
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: portalPointerEvents, style: [
|
|
465
|
-
react_native_1.StyleSheet.absoluteFill,
|
|
466
|
-
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
467
|
-
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
468
|
-
], children: nativeSurface }));
|
|
469
|
-
}
|
|
470
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
471
|
-
react_native_1.StyleSheet.absoluteFill,
|
|
472
|
-
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
473
|
-
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
474
|
-
entry.animatedStyle,
|
|
475
|
-
entry.portalOffsetStyle,
|
|
476
|
-
], children: nativeSurface }));
|
|
477
|
-
}
|
|
478
|
-
const portalContent = entry.portalContent && entry.placement === 'layout' ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [react_native_1.StyleSheet.absoluteFill, styles.portalContentOverlay, { borderRadius: material.radius }], children: entry.portalContent })) : null;
|
|
479
|
-
const innerContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [nativeSurface, entry.contentAboveGlass && entry.content ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: material.radius }, styles.contentAboveGlass], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: entry.contentStyle, children: entry.content }) })) : null, portalContent] }));
|
|
480
|
-
const hasMotion = (entry.positioning === 'floating' && entry.animatedStyle != null) || entry.portalOffsetStyle != null;
|
|
481
|
-
if (!hasMotion) {
|
|
482
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: portalPointerEvents, collapsable: !entry.syncContentTransform, style: [
|
|
483
|
-
styles.portalSurface,
|
|
484
|
-
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
485
|
-
], children: innerContent }));
|
|
486
|
-
}
|
|
487
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, collapsable: !entry.syncContentTransform, style: [
|
|
488
|
-
styles.portalSurface,
|
|
489
|
-
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
490
|
-
entry.positioning === 'floating' ? entry.animatedStyle : undefined,
|
|
491
|
-
entry.portalOffsetStyle,
|
|
492
|
-
], children: innerContent }));
|
|
493
|
-
});
|
|
494
|
-
const PortalFallbackSurface = react_1.default.memo(function PortalFallbackSurface({ entry }) {
|
|
495
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
496
|
-
if (!runtime)
|
|
497
|
-
return null;
|
|
498
|
-
const { tokens, dark } = runtime;
|
|
499
|
-
const portalPointerEvents = entry.interactive || entry.portalContent || entry.contentAboveGlass
|
|
500
|
-
? 'box-none'
|
|
501
|
-
: 'none';
|
|
502
|
-
const material = tokens.materials[entry.variant];
|
|
503
|
-
const fallbackSurface = ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
|
|
504
|
-
styles.fallbackSurface,
|
|
505
|
-
entry.placement === 'layout'
|
|
506
|
-
? react_native_1.StyleSheet.absoluteFill
|
|
507
|
-
: { width: entry.frame.width > 0 ? entry.frame.width : undefined },
|
|
508
|
-
{
|
|
509
|
-
backgroundColor: dark ? tokens.fallbackTint.dark : tokens.fallbackTint.light,
|
|
510
|
-
borderColor: dark ? tokens.fallbackBorder.dark : tokens.fallbackBorder.light,
|
|
511
|
-
borderRadius: material.radius,
|
|
512
|
-
},
|
|
513
|
-
] }));
|
|
514
|
-
if (entry.placement === 'bottom' || entry.placement === 'center') {
|
|
515
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
516
|
-
react_native_1.StyleSheet.absoluteFill,
|
|
517
|
-
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
518
|
-
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
519
|
-
entry.animatedStyle,
|
|
520
|
-
entry.portalOffsetStyle,
|
|
521
|
-
], children: fallbackSurface }));
|
|
522
|
-
}
|
|
523
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
524
|
-
styles.portalSurface,
|
|
525
|
-
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
526
|
-
entry.animatedStyle,
|
|
527
|
-
entry.portalOffsetStyle,
|
|
528
|
-
], children: fallbackSurface }));
|
|
529
|
-
});
|
|
44
|
+
const contexts_1 = require("./surface/contexts");
|
|
45
|
+
const InlineSurface_1 = require("./surface/InlineSurface");
|
|
46
|
+
const styles_1 = require("./surface/styles");
|
|
530
47
|
/** Theme-driven glass material. Callers select a role; all optical settings live in AppTheme. */
|
|
531
48
|
exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 'surface', surfaceRole = 'staticGroup', positioning, sampling, samplingSource, tintColor, portalContent, portalInteractionContent, contentPlacement = 'inFlow', measurementContent, inlineBackdrop, intrinsicInlineBackdrop = false, renderMode, pointerEvents, interactive = false, continuous = false, sharedSource = false, captureProbe = false, opticalProgress, pointerEvent, pointerEventValue, pointerEventSink, valueEvent, valueEventSink, opticalToggleFraction, opticalProgressValue, opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalMotionX, opticalMotionY, fallbackAnimatedStyle, materialOverrides, shapeMaskText, shapeMaskFontSize = 0, shapeMaskFontWeight = 700, progressiveBlurIntensity = 0, displacementOnlyDebug = false, syncContentTransform = false, providerIdOverride = null, style, contentStyle, onLayout: onLayoutProp, animatedStyle, portalTranslateX, portalTranslateY, portalScaleX, portalScaleY, placement = 'layout', bottomInset, zIndex = 1, children, frameOverride, }) {
|
|
532
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
533
|
-
const host = (0, react_1.useContext)(GlassHostContext);
|
|
534
|
-
const captureSourceProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
535
|
-
const scopeActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
536
|
-
const routeTransitionX = (0, react_1.useContext)(GlassRouteTransitionContext);
|
|
537
|
-
const portalScroll = (0, react_1.useContext)(GlassPortalScrollContext);
|
|
538
|
-
const measureOnly = (0, react_1.useContext)(GlassMeasureOnlyContext);
|
|
49
|
+
const runtime = (0, react_1.useContext)(contexts_1.GlassRuntimeContext);
|
|
50
|
+
const host = (0, react_1.useContext)(contexts_1.GlassHostContext);
|
|
51
|
+
const captureSourceProviderId = (0, react_1.useContext)(contexts_1.GlassCaptureSourceContext);
|
|
52
|
+
const scopeActive = (0, react_1.useContext)(contexts_1.GlassScopeActiveContext);
|
|
53
|
+
const routeTransitionX = (0, react_1.useContext)(contexts_1.GlassRouteTransitionContext);
|
|
54
|
+
const portalScroll = (0, react_1.useContext)(contexts_1.GlassPortalScrollContext);
|
|
55
|
+
const measureOnly = (0, react_1.useContext)(contexts_1.GlassMeasureOnlyContext);
|
|
539
56
|
const hasPortalMotion = portalTranslateX != null || portalTranslateY != null || portalScaleX != null || portalScaleY != null;
|
|
540
57
|
const portalOffsetStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
541
58
|
transform: [
|
|
@@ -553,23 +70,24 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
553
70
|
// preference. Before 2026-11-15 a referenceParity material silently promoted
|
|
554
71
|
// every local surface into a real backdrop consumer, which overrode Hyper UI's
|
|
555
72
|
// `sampling="local"` cards and made the local strategy unreachable.
|
|
556
|
-
const resolvedSampling = sampling ??
|
|
557
|
-
|
|
558
|
-
: resolvedPositioning === 'floating' ? 'backdrop' : 'local')
|
|
73
|
+
const resolvedSampling = sampling ??
|
|
74
|
+
renderMode ??
|
|
75
|
+
(referenceParity ? 'backdrop' : resolvedPositioning === 'floating' ? 'backdrop' : 'local');
|
|
559
76
|
const resolvedSamplingSource = samplingSource ?? host?.defaultSamplingSource ?? 'routeScene';
|
|
560
77
|
const resolvedSamplingProviderId = providerIdOverride != null
|
|
561
78
|
? providerIdOverride
|
|
562
79
|
: resolvedSamplingSource === 'themeBackdrop'
|
|
563
80
|
? host?.themeBackdropProviderId
|
|
564
|
-
: captureSourceProviderId ?? host?.routeSceneProviderId ?? host?.themeBackdropProviderId;
|
|
81
|
+
: (captureSourceProviderId ?? host?.routeSceneProviderId ?? host?.themeBackdropProviderId);
|
|
565
82
|
// A routeScene provider records route content. Keep its consumers outside
|
|
566
83
|
// that source tree or the RenderNode can sample itself recursively.
|
|
567
84
|
// Inline rendering remains valid when it samples the separate theme
|
|
568
85
|
// backdrop provider (including the routeScene fallback without a scope)
|
|
569
86
|
// or an explicit parent/underlay providerIdOverride outside the inner capture scope.
|
|
570
|
-
const samplesOwnCaptureSource = captureSourceProviderId !== null &&
|
|
571
|
-
|
|
572
|
-
|
|
87
|
+
const samplesOwnCaptureSource = captureSourceProviderId !== null &&
|
|
88
|
+
(providerIdOverride != null
|
|
89
|
+
? providerIdOverride === captureSourceProviderId
|
|
90
|
+
: resolvedSamplingSource === 'routeScene');
|
|
573
91
|
// With a separate `backdrop` the route tree is already a sibling above the
|
|
574
92
|
// capture source, so an in-flow surface can sample it directly through the
|
|
575
93
|
// inline path. That removes the per-surface measureInWindow bridge round
|
|
@@ -587,10 +105,13 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
587
105
|
!hasPortalMotion;
|
|
588
106
|
const resolvedInlineBackdrop = (inlineBackdrop ?? (autoInlineBackdrop || host?.inlineBackdropByDefault === true)) &&
|
|
589
107
|
!samplesOwnCaptureSource;
|
|
590
|
-
const resolvedIntrinsicInlineBackdrop = intrinsicInlineBackdrop ||
|
|
591
|
-
(autoInlineBackdrop && typeof flatSurfaceStyle?.height !== 'number');
|
|
108
|
+
const resolvedIntrinsicInlineBackdrop = intrinsicInlineBackdrop || (autoInlineBackdrop && typeof flatSurfaceStyle?.height !== 'number');
|
|
592
109
|
const contentAboveGlass = contentPlacement === 'aboveGlass' && resolvedSampling === 'backdrop';
|
|
593
|
-
const resolvedRenderMode = runtime?.tokens.enabled &&
|
|
110
|
+
const resolvedRenderMode = runtime?.tokens.enabled &&
|
|
111
|
+
resolvedSampling === 'backdrop' &&
|
|
112
|
+
react_native_1.Platform.OS === 'android' &&
|
|
113
|
+
host &&
|
|
114
|
+
runtime.tokens.quality !== 'fallback'
|
|
594
115
|
? 'backdrop'
|
|
595
116
|
: 'local';
|
|
596
117
|
const id = (0, react_1.useId)();
|
|
@@ -622,7 +143,11 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
622
143
|
width,
|
|
623
144
|
height,
|
|
624
145
|
};
|
|
625
|
-
setFrame((current) => current &&
|
|
146
|
+
setFrame((current) => current &&
|
|
147
|
+
current.x === next.x &&
|
|
148
|
+
current.y === next.y &&
|
|
149
|
+
current.width === width &&
|
|
150
|
+
current.height === height
|
|
626
151
|
? current
|
|
627
152
|
: next);
|
|
628
153
|
});
|
|
@@ -639,12 +164,24 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
639
164
|
(0, react_1.useEffect)(() => {
|
|
640
165
|
if (!host)
|
|
641
166
|
return;
|
|
642
|
-
if (measureOnly ||
|
|
167
|
+
if (measureOnly ||
|
|
168
|
+
!scopeActive ||
|
|
169
|
+
!runtime?.tokens.enabled ||
|
|
170
|
+
resolvedRenderMode !== 'backdrop' ||
|
|
171
|
+
resolvedInlineBackdrop ||
|
|
172
|
+
!frame ||
|
|
173
|
+
frame.width <= 0 ||
|
|
174
|
+
frame.height <= 0) {
|
|
643
175
|
host.remove(id);
|
|
644
176
|
return;
|
|
645
177
|
}
|
|
646
178
|
const publishedFrame = frameOverride
|
|
647
|
-
? {
|
|
179
|
+
? {
|
|
180
|
+
x: frameOverride.x,
|
|
181
|
+
y: frameOverride.y,
|
|
182
|
+
width: frameOverride.width,
|
|
183
|
+
height: frameOverride.height,
|
|
184
|
+
}
|
|
648
185
|
: frame;
|
|
649
186
|
host.updateSurface(id, {
|
|
650
187
|
frame: publishedFrame,
|
|
@@ -708,12 +245,85 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
708
245
|
else {
|
|
709
246
|
host.removeOverlay(id);
|
|
710
247
|
}
|
|
711
|
-
}, [
|
|
248
|
+
}, [
|
|
249
|
+
measureOnly,
|
|
250
|
+
scopeActive,
|
|
251
|
+
runtime?.tokens.enabled,
|
|
252
|
+
resolvedRenderMode,
|
|
253
|
+
resolvedInlineBackdrop,
|
|
254
|
+
host,
|
|
255
|
+
id,
|
|
256
|
+
frame,
|
|
257
|
+
frameOverride,
|
|
258
|
+
resolvedPositioning,
|
|
259
|
+
resolvedSamplingSource,
|
|
260
|
+
resolvedSamplingProviderId,
|
|
261
|
+
tintColor,
|
|
262
|
+
portalContent,
|
|
263
|
+
portalInteractionContent,
|
|
264
|
+
contentAboveGlass,
|
|
265
|
+
children,
|
|
266
|
+
variant,
|
|
267
|
+
interactive,
|
|
268
|
+
continuous,
|
|
269
|
+
sharedSource,
|
|
270
|
+
captureProbe,
|
|
271
|
+
opticalProgress,
|
|
272
|
+
routeTransitionX,
|
|
273
|
+
portalScroll.offsets,
|
|
274
|
+
portalScroll.groupKey,
|
|
275
|
+
hasPortalMotion,
|
|
276
|
+
portalOffsetStyle,
|
|
277
|
+
portalTranslateX,
|
|
278
|
+
portalTranslateY,
|
|
279
|
+
portalScaleX,
|
|
280
|
+
portalScaleY,
|
|
281
|
+
pointerEvent,
|
|
282
|
+
pointerEventValue,
|
|
283
|
+
pointerEventSink,
|
|
284
|
+
valueEvent,
|
|
285
|
+
valueEventSink,
|
|
286
|
+
opticalToggleFraction,
|
|
287
|
+
opticalProgressValue,
|
|
288
|
+
opticalPointX,
|
|
289
|
+
opticalPointY,
|
|
290
|
+
opticalVelocityX,
|
|
291
|
+
opticalVelocityY,
|
|
292
|
+
opticalMotionX,
|
|
293
|
+
opticalMotionY,
|
|
294
|
+
materialOverrides,
|
|
295
|
+
shapeMaskText,
|
|
296
|
+
shapeMaskFontSize,
|
|
297
|
+
shapeMaskFontWeight,
|
|
298
|
+
progressiveBlurIntensity,
|
|
299
|
+
displacementOnlyDebug,
|
|
300
|
+
syncContentTransform,
|
|
301
|
+
animatedStyle,
|
|
302
|
+
placement,
|
|
303
|
+
bottomInset,
|
|
304
|
+
zIndex,
|
|
305
|
+
]);
|
|
712
306
|
if (measureOnly) {
|
|
713
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: style, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: resolvedInlineBackdrop
|
|
307
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: style, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: resolvedInlineBackdrop
|
|
308
|
+
? resolvedIntrinsicInlineBackdrop
|
|
309
|
+
? styles_1.styles.inlineBackdropIntrinsicSurface
|
|
310
|
+
: styles_1.styles.inlineBackdropSurface
|
|
311
|
+
: undefined, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
312
|
+
contentAboveGlass || resolvedIntrinsicInlineBackdrop
|
|
313
|
+
? styles_1.styles.portalContentIntrinsic
|
|
314
|
+
: placement === 'layout'
|
|
315
|
+
? styles_1.styles.portalContentLayout
|
|
316
|
+
: styles_1.styles.portalContentWrap,
|
|
317
|
+
contentStyle,
|
|
318
|
+
], children: children }) }) }));
|
|
714
319
|
}
|
|
715
320
|
if (!runtime?.tokens.enabled) {
|
|
716
|
-
return (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [
|
|
321
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [
|
|
322
|
+
style,
|
|
323
|
+
animatedStyle,
|
|
324
|
+
hasPortalMotion ? portalOffsetStyle : undefined,
|
|
325
|
+
fallbackAnimatedStyle,
|
|
326
|
+
], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: contentStyle, children: children }) }));
|
|
717
327
|
}
|
|
718
328
|
// Keep inline renderers and their foreground subtrees mounted across page
|
|
719
329
|
// activation. Replacing this branch with LocalGlassSurface rebuilt text,
|
|
@@ -726,70 +336,35 @@ exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 's
|
|
|
726
336
|
// every surface fell through to the local renderer and no native view, no
|
|
727
337
|
// motion driver and no press animation was ever created.
|
|
728
338
|
if (resolvedInlineBackdrop) {
|
|
729
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: pointerEvents, onLayout: onLayoutProp, style: [style, animatedStyle, hasPortalMotion ? portalOffsetStyle : undefined], children: (0, jsx_runtime_1.jsx)(InlineBackdropSurface, { renderingEnabled: scopeActive, providerId: resolvedSamplingProviderId ?? '', variant: variant, tintColor: tintColor, interactive: interactive, continuous: continuous, sharedSource: sharedSource, captureProbe: captureProbe, opticalProgress: opticalProgress, pointerEvent: pointerEvent, pointerEventValue: pointerEventValue, pointerEventSink: pointerEventSink, valueEventSink: valueEventSink, valueEvent: valueEvent, opticalToggleFraction: opticalToggleFraction, opticalPointX: opticalPointX, opticalPointY: opticalPointY, opticalVelocityX: opticalVelocityX, opticalVelocityY: opticalVelocityY, opticalMotionX: opticalMotionX, opticalMotionY: opticalMotionY, materialOverrides: materialOverrides, displacementOnlyDebug: displacementOnlyDebug, syncContentTransform: syncContentTransform, intrinsicLayout: resolvedIntrinsicInlineBackdrop, contentStyle: contentStyle, placement: placement, children: children }) }));
|
|
339
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: pointerEvents, onLayout: onLayoutProp, style: [style, animatedStyle, hasPortalMotion ? portalOffsetStyle : undefined], children: (0, jsx_runtime_1.jsx)(InlineSurface_1.InlineBackdropSurface, { renderingEnabled: scopeActive, providerId: resolvedSamplingProviderId ?? '', variant: variant, tintColor: tintColor, interactive: interactive, continuous: continuous, sharedSource: sharedSource, captureProbe: captureProbe, opticalProgress: opticalProgress, pointerEvent: pointerEvent, pointerEventValue: pointerEventValue, pointerEventSink: pointerEventSink, valueEventSink: valueEventSink, valueEvent: valueEvent, opticalToggleFraction: opticalToggleFraction, opticalPointX: opticalPointX, opticalPointY: opticalPointY, opticalVelocityX: opticalVelocityX, opticalVelocityY: opticalVelocityY, opticalMotionX: opticalMotionX, opticalMotionY: opticalMotionY, materialOverrides: materialOverrides, displacementOnlyDebug: displacementOnlyDebug, syncContentTransform: syncContentTransform, intrinsicLayout: resolvedIntrinsicInlineBackdrop, contentStyle: contentStyle, placement: placement, children: children }) }));
|
|
730
340
|
}
|
|
731
341
|
if (resolvedRenderMode === 'local' || !host || !scopeActive) {
|
|
732
|
-
return ((0, jsx_runtime_1.jsx)(LocalGlassSurface, { variant: variant, surfaceRole: surfaceRole, style: style, contentStyle: contentStyle, animatedStyle: hasPortalMotion ? portalOffsetStyle : animatedStyle, fallbackAnimatedStyle: fallbackAnimatedStyle, pointerEvents: pointerEvents, onLayout: onLayout, children: children }));
|
|
342
|
+
return ((0, jsx_runtime_1.jsx)(InlineSurface_1.LocalGlassSurface, { variant: variant, surfaceRole: surfaceRole, style: style, contentStyle: contentStyle, animatedStyle: hasPortalMotion ? portalOffsetStyle : animatedStyle, fallbackAnimatedStyle: fallbackAnimatedStyle, pointerEvents: pointerEvents, onLayout: onLayout, children: children }));
|
|
733
343
|
}
|
|
734
|
-
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { ref: viewRef, collapsable: false, pointerEvents: pointerEvents, onLayout: onLayout, style: [style, animatedStyle, styles.measureOnly], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
344
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { ref: viewRef, collapsable: false, pointerEvents: pointerEvents, onLayout: onLayout, style: [style, animatedStyle, styles_1.styles.measureOnly], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
345
|
+
contentAboveGlass
|
|
346
|
+
? styles_1.styles.portalContentIntrinsic
|
|
347
|
+
: placement === 'layout'
|
|
348
|
+
? styles_1.styles.portalContentLayout
|
|
349
|
+
: styles_1.styles.portalContentWrap,
|
|
350
|
+
contentStyle,
|
|
351
|
+
], children: contentAboveGlass ? (
|
|
735
352
|
// The visible copy lives in the overlay; this one only exists
|
|
736
353
|
// so a content-sized surface still measures. alpha 0 keeps it
|
|
737
354
|
// out of the recorded scene, which is the whole point.
|
|
738
|
-
(0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.contentAboveGlassMeasure, { opacity: 0 }], children: (0, jsx_runtime_1.jsx)(GlassMeasureOnlyContext.Provider, { value: true, children: measurementContent ?? children }) })) : children }) }));
|
|
355
|
+
(0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles_1.styles.contentAboveGlassMeasure, { opacity: 0 }], children: (0, jsx_runtime_1.jsx)(contexts_1.GlassMeasureOnlyContext.Provider, { value: true, children: measurementContent ?? children }) })) : (children) }) }));
|
|
739
356
|
});
|
|
740
|
-
const InlineBackdropSurface = react_1.default.memo(function InlineBackdropSurface({ renderingEnabled, providerId, variant, tintColor, interactive, continuous, sharedSource, captureProbe, opticalProgress, pointerEvent, pointerEventValue, pointerEventSink, valueEventSink, valueEvent, opticalToggleFraction, opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalMotionX, opticalMotionY, materialOverrides, displacementOnlyDebug, syncContentTransform, intrinsicLayout, contentStyle, placement, children, }) {
|
|
741
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
742
|
-
const hasAnimatedOptics = Boolean(opticalPointX || opticalPointY || opticalVelocityX || opticalVelocityY ||
|
|
743
|
-
opticalProgress || opticalToggleFraction || opticalMotionX || opticalMotionY);
|
|
744
|
-
const animatedOptics = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
745
|
-
interactionVelocityX: opticalVelocityX?.value,
|
|
746
|
-
interactionVelocityY: opticalVelocityY?.value,
|
|
747
|
-
interactionPointX: opticalPointX?.value,
|
|
748
|
-
interactionPointY: opticalPointY?.value,
|
|
749
|
-
interactionProgress: opticalProgress?.value ?? 0,
|
|
750
|
-
toggleFraction: opticalToggleFraction?.value ?? 0,
|
|
751
|
-
motionX: opticalMotionX ? Math.max(-1, Math.min(1, opticalMotionX.value / 1800)) : undefined,
|
|
752
|
-
motionY: opticalMotionY ? Math.max(-1, Math.min(1, opticalMotionY.value / 1800)) : undefined,
|
|
753
|
-
}), [opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalProgress, pointerEventValue, valueEvent, opticalToggleFraction, opticalMotionX, opticalMotionY]);
|
|
754
|
-
if (!runtime)
|
|
755
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
756
|
-
const { tokens, dark, reducedMotion } = runtime;
|
|
757
|
-
const material = materialOverrides
|
|
758
|
-
? { ...tokens.materials[variant], ...materialOverrides }
|
|
759
|
-
: tokens.materials[variant];
|
|
760
|
-
const qualityScale = material.opticsModel === 'referenceParity'
|
|
761
|
-
? 1
|
|
762
|
-
: tokens.quality === 'high' ? 1.2 : tokens.quality === 'fallback' ? 0.45 : 1;
|
|
763
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { collapsable: !syncContentTransform, style: intrinsicLayout ? styles.inlineBackdropIntrinsicSurface : styles.inlineBackdropSurface, children: [(0, jsx_runtime_1.jsx)(NativeBackdropSurface, { renderingEnabled: renderingEnabled, providerId: providerId, opticsModel: material.opticsModel, depthEffect: material.referenceDepthEffect ?? false, highlightStyle: material.referenceHighlightStyle, interactionProfile: material.referenceInteractionProfile, contentScaleX: material.referenceContentScaleX, contentScaleY: material.referenceContentScaleY, sampleOffsetX: material.referenceSampleOffsetX, sampleOffsetY: material.referenceSampleOffsetY, toggleTrackColorOff: material.referenceToggleTrackColorOff, toggleTrackColorOn: material.referenceToggleTrackColorOn, toggleTrackWidth: material.referenceToggleTrackWidth, toggleTrackHeight: material.referenceToggleTrackHeight, toggleSolidBackdropColor: material.referenceToggleSolidBackdropColor, brightness: material.brightness ?? 0, contrast: material.contrast ?? 1, highlightFalloff: material.highlightFalloff ?? 1, sdfContrast: material.sdfScaleLens?.contrast, sdfBrightness: material.sdfScaleLens?.brightness, sdfSaturation: material.sdfScaleLens?.saturation, sdfOuterShadowAlpha: material.sdfScaleLens?.outerShadowAlpha, sdfOuterShadowBlurRadius: material.sdfScaleLens?.outerShadowBlurRadius, sdfOuterShadowOffsetY: material.sdfScaleLens?.outerShadowOffsetY, sdfInnerShadowAlpha: material.sdfScaleLens?.innerShadowAlpha, sdfInnerShadowExtent: material.sdfScaleLens?.innerShadowExtent, cornerRadius: material.radius, blurRadius: material.blurRadius * qualityScale, refractionHeight: material.refractionHeight * qualityScale, refractionAmount: material.refractionAmount * qualityScale, bodyRefractionAmount: (material.refractionBodyAmount ?? 2.5) * qualityScale, interactionProgress: 0, pointerEvent: pointerEventValue, pointerEventSink: pointerEventSink, valueEventSink: valueEventSink, valueEvent: valueEvent, saturation: material.saturation, chromaticAberration: material.opticsModel === 'referenceParity' || tokens.quality === 'high' || variant === 'tabSelectionLens' ? material.chromaticAberration : 0, highlightAlpha: material.highlightAlpha, highlightWidth: material.highlightWidth, lightAngle: material.highlightAngle ?? 45, highlightColor: material.highlightColor ? (dark ? material.highlightColor.dark : material.highlightColor.light) : undefined, tintAlpha: material.tintAlpha ?? 1, specularStrength: material.specularStrength ?? 1, fresnelStrength: material.fresnelStrength ?? 0.85, innerShadowStrength: material.innerShadowStrength ?? (material.opticsModel === 'referenceParity' ? 0 : 0.18), shadowOpacity: material.shadowOpacity ?? (material.opticsModel === 'referenceParity' ? 0 : 0.1), shadowRadius: material.shadowRadius ?? (material.opticsModel === 'referenceParity' ? 0 : 24), shadowOffsetY: material.shadowOffsetY ?? (material.opticsModel === 'referenceParity' ? 0 : 4), tint: tintColor ?? (dark ? tokens.tint.dark : tokens.tint.light), surfaceColor: material.surfaceColor ? (dark ? material.surfaceColor.dark : material.surfaceColor.light) : undefined, interactive: interactive && tokens.interaction.enabled && !reducedMotion, continuous: continuous, sharedSource: sharedSource, captureProbe: captureProbe, displacementOnlyDebug: displacementOnlyDebug, syncContentTransform: syncContentTransform, animatedProps: hasAnimatedOptics ? animatedOptics : undefined, pointerEvents: interactive ? undefined : 'none', style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: material.radius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [intrinsicLayout ? styles.portalContentIntrinsic : placement === 'layout' ? styles.portalContentLayout : styles.portalContentWrap, contentStyle], children: children })] }));
|
|
764
|
-
});
|
|
765
|
-
function LocalGlassSurface({ variant, surfaceRole, style, contentStyle, animatedStyle, fallbackAnimatedStyle, pointerEvents, onLayout, children, }) {
|
|
766
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
767
|
-
if (!runtime?.tokens.enabled)
|
|
768
|
-
return (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { onLayout: onLayout, style: [style, animatedStyle, fallbackAnimatedStyle], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: contentStyle, children: children }) });
|
|
769
|
-
const { tokens, dark } = runtime;
|
|
770
|
-
const material = tokens.materials[variant ?? 'surface'];
|
|
771
|
-
const fallback = tokens.quality === 'fallback';
|
|
772
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { pointerEvents: pointerEvents, onLayout: onLayout, style: [styles.localSurface, { borderRadius: material.radius, backgroundColor: 'transparent' }, style, animatedStyle, fallbackAnimatedStyle], children: [fallback ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
|
|
773
|
-
react_native_1.StyleSheet.absoluteFill,
|
|
774
|
-
{
|
|
775
|
-
backgroundColor: dark ? tokens.fallbackTint.dark : tokens.fallbackTint.light,
|
|
776
|
-
borderColor: dark ? tokens.fallbackBorder.dark : tokens.fallbackBorder.light,
|
|
777
|
-
borderWidth: react_native_1.StyleSheet.hairlineWidth,
|
|
778
|
-
borderRadius: material.radius,
|
|
779
|
-
},
|
|
780
|
-
] })) : ((0, jsx_runtime_1.jsx)(LocalGlassMaterial_1.LocalGlassMaterial, { tokens: tokens, material: material, dark: dark, surfaceRole: surfaceRole })), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.localContent, contentStyle], children: children })] }));
|
|
781
|
-
}
|
|
782
357
|
function useGlassProviderId() {
|
|
783
|
-
return (0, react_1.useContext)(GlassHostContext)?.providerId ?? null;
|
|
358
|
+
return (0, react_1.useContext)(contexts_1.GlassHostContext)?.providerId ?? null;
|
|
784
359
|
}
|
|
785
360
|
/** Ref for converting window-measured anchors into the route overlay's local coordinates. */
|
|
786
361
|
function useGlassOverlayHostRef() {
|
|
787
|
-
return (0, react_1.useContext)(GlassHostContext)?.hostRef ?? null;
|
|
362
|
+
return (0, react_1.useContext)(contexts_1.GlassHostContext)?.hostRef ?? null;
|
|
788
363
|
}
|
|
789
364
|
/** Route-level view overlay for sheets/dialogs; its children remain ordinary native views. */
|
|
790
365
|
function GlassOverlay({ children, zIndex = 100 }) {
|
|
791
|
-
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
792
|
-
const host = (0, react_1.useContext)(GlassOverlayHostContext);
|
|
366
|
+
const runtime = (0, react_1.useContext)(contexts_1.GlassRuntimeContext);
|
|
367
|
+
const host = (0, react_1.useContext)(contexts_1.GlassOverlayHostContext);
|
|
793
368
|
const id = (0, react_1.useId)();
|
|
794
369
|
(0, react_1.useEffect)(() => () => host?.remove(id), [host, id]);
|
|
795
370
|
(0, react_1.useEffect)(() => {
|
|
@@ -804,29 +379,26 @@ function GlassOverlay({ children, zIndex = 100 }) {
|
|
|
804
379
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
805
380
|
return null;
|
|
806
381
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
bottomPlacement: { alignItems: 'center', justifyContent: 'flex-end' },
|
|
830
|
-
centerPlacement: { alignItems: 'center', justifyContent: 'center' },
|
|
831
|
-
});
|
|
382
|
+
var contexts_2 = require("./surface/contexts");
|
|
383
|
+
Object.defineProperty(exports, "GlassPortalScrollScope", { enumerable: true, get: function () { return contexts_2.GlassPortalScrollScope; } });
|
|
384
|
+
var contexts_3 = require("./surface/contexts");
|
|
385
|
+
Object.defineProperty(exports, "GlassRouteTransitionScope", { enumerable: true, get: function () { return contexts_3.GlassRouteTransitionScope; } });
|
|
386
|
+
var contexts_4 = require("./surface/contexts");
|
|
387
|
+
Object.defineProperty(exports, "useGlassReducedMotion", { enumerable: true, get: function () { return contexts_4.useGlassReducedMotion; } });
|
|
388
|
+
var contexts_5 = require("./surface/contexts");
|
|
389
|
+
Object.defineProperty(exports, "useGlassInsideScroll", { enumerable: true, get: function () { return contexts_5.useGlassInsideScroll; } });
|
|
390
|
+
var contexts_6 = require("./surface/contexts");
|
|
391
|
+
Object.defineProperty(exports, "useGlassInsideCaptureScope", { enumerable: true, get: function () { return contexts_6.useGlassInsideCaptureScope; } });
|
|
392
|
+
var contexts_7 = require("./surface/contexts");
|
|
393
|
+
Object.defineProperty(exports, "useGlassAppearance", { enumerable: true, get: function () { return contexts_7.useGlassAppearance; } });
|
|
394
|
+
var contexts_8 = require("./surface/contexts");
|
|
395
|
+
Object.defineProperty(exports, "useGlassSamplingProviderId", { enumerable: true, get: function () { return contexts_8.useGlassSamplingProviderId; } });
|
|
396
|
+
var contexts_9 = require("./surface/contexts");
|
|
397
|
+
Object.defineProperty(exports, "RouteGlassCaptureScope", { enumerable: true, get: function () { return contexts_9.RouteGlassCaptureScope; } });
|
|
398
|
+
var contexts_10 = require("./surface/contexts");
|
|
399
|
+
Object.defineProperty(exports, "RouteGlassCaptureSource", { enumerable: true, get: function () { return contexts_10.RouteGlassCaptureSource; } });
|
|
400
|
+
var MaterialProvider_1 = require("./surface/MaterialProvider");
|
|
401
|
+
Object.defineProperty(exports, "GlassAppearanceProvider", { enumerable: true, get: function () { return MaterialProvider_1.GlassAppearanceProvider; } });
|
|
402
|
+
var MaterialProvider_2 = require("./surface/MaterialProvider");
|
|
403
|
+
Object.defineProperty(exports, "GlassMaterialProvider", { enumerable: true, get: function () { return MaterialProvider_2.GlassMaterialProvider; } });
|
|
832
404
|
//# sourceMappingURL=GlassSurface.js.map
|