@oxy.so/bloom 7.1.1 → 7.1.4
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/assets/character-runtime/README.md +114 -19
- package/assets/character-runtime/authored-parts.mjs +754 -0
- package/assets/character-runtime/catalog-parts.mjs +362 -0
- package/assets/character-runtime/character-recipe.mjs +247 -0
- package/assets/character-runtime/clippo-geometry.mjs +679 -0
- package/assets/character-runtime/controller-mode.mjs +208 -0
- package/assets/character-runtime/cyclops-geometry.mjs +180 -0
- package/assets/character-runtime/legacy-engine.mjs +406 -54
- package/assets/character-runtime/legacy-geometry.mjs +242 -85
- package/assets/character-runtime/legacy-worker.mjs +82 -23
- package/assets/character-runtime/managed-avatar.mjs +12 -17
- package/assets/character-runtime/migrated-contours.mjs +2067 -0
- package/assets/character-runtime/migrated-faces.mjs +59 -0
- package/assets/character-runtime/pose-transition.mjs +523 -0
- package/assets/character-runtime/preparation-cache.mjs +60 -0
- package/assets/character-runtime/render-budget.mjs +5 -3
- package/assets/character-runtime/render-errors.mjs +180 -0
- package/assets/character-runtime/resolution.mjs +10 -0
- package/assets/character-runtime/runtime.mjs +744 -295
- package/assets/character-runtime/sha256.mjs +44 -0
- package/assets/character-runtime/shared-programs.mjs +534 -0
- package/assets/character-runtime/shared-surface.mjs +490 -0
- package/assets/character-runtime/shared-textures.mjs +420 -0
- package/assets/character-runtime/thumbnails/eyes/todd.png +0 -0
- package/docs/adoption-matrix.mdx +2 -2
- package/docs/agent-avatar.mdx +45 -8
- package/docs/agent-creator.mdx +13 -3
- package/docs/bottom-sheet.mdx +1 -1
- package/lib/commonjs/agent-avatar/AgentAvatar.js +1 -1
- package/lib/commonjs/agent-avatar/AgentAvatar.js.map +1 -1
- package/lib/commonjs/agent-avatar/CharacterAvatar.js +2 -1
- package/lib/commonjs/agent-avatar/CharacterAvatar.js.map +1 -1
- package/lib/commonjs/agent-avatar/character-colors.js +19 -0
- package/lib/commonjs/agent-avatar/character-colors.js.map +1 -0
- package/lib/commonjs/agent-avatar/character-shapes.js +106 -0
- package/lib/commonjs/agent-avatar/character-shapes.js.map +1 -0
- package/lib/commonjs/agent-avatar/config-character.js +4 -0
- package/lib/commonjs/agent-avatar/config-character.js.map +1 -1
- package/lib/commonjs/agent-avatar/legacy-recipe.js +19 -6
- package/lib/commonjs/agent-avatar/legacy-recipe.js.map +1 -1
- package/lib/commonjs/agent-creator/AgentCreatorBase.js +67 -107
- package/lib/commonjs/agent-creator/AgentCreatorBase.js.map +1 -1
- package/lib/commonjs/agent-creator/CharacterControls.js +23 -5
- package/lib/commonjs/agent-creator/CharacterControls.js.map +1 -1
- package/lib/commonjs/agent-creator/ClippoArtwork.js +63 -0
- package/lib/commonjs/agent-creator/ClippoArtwork.js.map +1 -0
- package/lib/commonjs/agent-creator/CyclopsArtwork.js +45 -0
- package/lib/commonjs/agent-creator/CyclopsArtwork.js.map +1 -0
- package/lib/commonjs/agent-creator/EmotionPicker.js +8 -1
- package/lib/commonjs/agent-creator/EmotionPicker.js.map +1 -1
- package/lib/commonjs/agent-creator/ShapeSilhouette.js +8 -1
- package/lib/commonjs/agent-creator/ShapeSilhouette.js.map +1 -1
- package/lib/commonjs/agent-creator/ToddArtwork.js +29 -0
- package/lib/commonjs/agent-creator/ToddArtwork.js.map +1 -0
- package/lib/commonjs/agent-creator/constants.js +16 -17
- package/lib/commonjs/agent-creator/constants.js.map +1 -1
- package/lib/commonjs/agent-creator/messages.js +1 -1
- package/lib/commonjs/agent-creator/messages.js.map +1 -1
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +33 -49
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/locale/translations/ar.js +1 -1
- package/lib/commonjs/locale/translations/ar.js.map +1 -1
- package/lib/commonjs/locale/translations/bn.js +1 -1
- package/lib/commonjs/locale/translations/bn.js.map +1 -1
- package/lib/commonjs/locale/translations/ca.js +1 -1
- package/lib/commonjs/locale/translations/ca.js.map +1 -1
- package/lib/commonjs/locale/translations/de.js +1 -1
- package/lib/commonjs/locale/translations/de.js.map +1 -1
- package/lib/commonjs/locale/translations/es.js +1 -1
- package/lib/commonjs/locale/translations/es.js.map +1 -1
- package/lib/commonjs/locale/translations/fr.js +1 -1
- package/lib/commonjs/locale/translations/fr.js.map +1 -1
- package/lib/commonjs/locale/translations/hi.js +1 -1
- package/lib/commonjs/locale/translations/hi.js.map +1 -1
- package/lib/commonjs/locale/translations/id.js +1 -1
- package/lib/commonjs/locale/translations/id.js.map +1 -1
- package/lib/commonjs/locale/translations/it.js +1 -1
- package/lib/commonjs/locale/translations/it.js.map +1 -1
- package/lib/commonjs/locale/translations/ja.js +1 -1
- package/lib/commonjs/locale/translations/ja.js.map +1 -1
- package/lib/commonjs/locale/translations/pt.js +1 -1
- package/lib/commonjs/locale/translations/pt.js.map +1 -1
- package/lib/commonjs/locale/translations/ru.js +1 -1
- package/lib/commonjs/locale/translations/ru.js.map +1 -1
- package/lib/commonjs/locale/translations/tr.js +1 -1
- package/lib/commonjs/locale/translations/tr.js.map +1 -1
- package/lib/commonjs/locale/translations/zh.js +1 -1
- package/lib/commonjs/locale/translations/zh.js.map +1 -1
- package/lib/commonjs/surface/SurfacePaint.js +17 -4
- package/lib/commonjs/surface/SurfacePaint.js.map +1 -1
- package/lib/module/agent-avatar/AgentAvatar.js +1 -1
- package/lib/module/agent-avatar/AgentAvatar.js.map +1 -1
- package/lib/module/agent-avatar/CharacterAvatar.js +2 -1
- package/lib/module/agent-avatar/CharacterAvatar.js.map +1 -1
- package/lib/module/agent-avatar/character-colors.js +15 -0
- package/lib/module/agent-avatar/character-colors.js.map +1 -0
- package/lib/module/agent-avatar/character-shapes.js +97 -0
- package/lib/module/agent-avatar/character-shapes.js.map +1 -0
- package/lib/module/agent-avatar/config-character.js +4 -0
- package/lib/module/agent-avatar/config-character.js.map +1 -1
- package/lib/module/agent-avatar/legacy-recipe.js +19 -6
- package/lib/module/agent-avatar/legacy-recipe.js.map +1 -1
- package/lib/module/agent-creator/AgentCreatorBase.js +69 -109
- package/lib/module/agent-creator/AgentCreatorBase.js.map +1 -1
- package/lib/module/agent-creator/CharacterControls.js +24 -6
- package/lib/module/agent-creator/CharacterControls.js.map +1 -1
- package/lib/module/agent-creator/ClippoArtwork.js +59 -0
- package/lib/module/agent-creator/ClippoArtwork.js.map +1 -0
- package/lib/module/agent-creator/CyclopsArtwork.js +41 -0
- package/lib/module/agent-creator/CyclopsArtwork.js.map +1 -0
- package/lib/module/agent-creator/EmotionPicker.js +8 -1
- package/lib/module/agent-creator/EmotionPicker.js.map +1 -1
- package/lib/module/agent-creator/ShapeSilhouette.js +8 -1
- package/lib/module/agent-creator/ShapeSilhouette.js.map +1 -1
- package/lib/module/agent-creator/ToddArtwork.js +25 -0
- package/lib/module/agent-creator/ToddArtwork.js.map +1 -0
- package/lib/module/agent-creator/constants.js +8 -16
- package/lib/module/agent-creator/constants.js.map +1 -1
- package/lib/module/agent-creator/messages.js +1 -1
- package/lib/module/agent-creator/messages.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +33 -49
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +1 -1
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/locale/translations/ar.js +1 -1
- package/lib/module/locale/translations/ar.js.map +1 -1
- package/lib/module/locale/translations/bn.js +1 -1
- package/lib/module/locale/translations/bn.js.map +1 -1
- package/lib/module/locale/translations/ca.js +1 -1
- package/lib/module/locale/translations/ca.js.map +1 -1
- package/lib/module/locale/translations/de.js +1 -1
- package/lib/module/locale/translations/de.js.map +1 -1
- package/lib/module/locale/translations/es.js +1 -1
- package/lib/module/locale/translations/es.js.map +1 -1
- package/lib/module/locale/translations/fr.js +1 -1
- package/lib/module/locale/translations/fr.js.map +1 -1
- package/lib/module/locale/translations/hi.js +1 -1
- package/lib/module/locale/translations/hi.js.map +1 -1
- package/lib/module/locale/translations/id.js +1 -1
- package/lib/module/locale/translations/id.js.map +1 -1
- package/lib/module/locale/translations/it.js +1 -1
- package/lib/module/locale/translations/it.js.map +1 -1
- package/lib/module/locale/translations/ja.js +1 -1
- package/lib/module/locale/translations/ja.js.map +1 -1
- package/lib/module/locale/translations/pt.js +1 -1
- package/lib/module/locale/translations/pt.js.map +1 -1
- package/lib/module/locale/translations/ru.js +1 -1
- package/lib/module/locale/translations/ru.js.map +1 -1
- package/lib/module/locale/translations/tr.js +1 -1
- package/lib/module/locale/translations/tr.js.map +1 -1
- package/lib/module/locale/translations/zh.js +1 -1
- package/lib/module/locale/translations/zh.js.map +1 -1
- package/lib/module/surface/SurfacePaint.js +18 -5
- package/lib/module/surface/SurfacePaint.js.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/CharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/character-colors.d.ts +13 -0
- package/lib/typescript/commonjs/agent-avatar/character-colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/character-shapes.d.ts +19 -0
- package/lib/typescript/commonjs/agent-avatar/character-shapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/config-character.d.ts +4 -0
- package/lib/typescript/commonjs/agent-avatar/config-character.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/legacy-recipe.d.ts +2 -10
- package/lib/typescript/commonjs/agent-avatar/legacy-recipe.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/AgentCreatorBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/CharacterControls.d.ts +2 -1
- package/lib/typescript/commonjs/agent-creator/CharacterControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/ClippoArtwork.d.ts +6 -0
- package/lib/typescript/commonjs/agent-creator/ClippoArtwork.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-creator/CyclopsArtwork.d.ts +5 -0
- package/lib/typescript/commonjs/agent-creator/CyclopsArtwork.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-creator/EmotionPicker.d.ts +1 -0
- package/lib/typescript/commonjs/agent-creator/EmotionPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/ShapeSilhouette.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/ToddArtwork.d.ts +6 -0
- package/lib/typescript/commonjs/agent-creator/ToddArtwork.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-creator/constants.d.ts +7 -15
- package/lib/typescript/commonjs/agent-creator/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +1 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/surface/SurfacePaint.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/CharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/character-colors.d.ts +13 -0
- package/lib/typescript/module/agent-avatar/character-colors.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/character-shapes.d.ts +19 -0
- package/lib/typescript/module/agent-avatar/character-shapes.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/config-character.d.ts +4 -0
- package/lib/typescript/module/agent-avatar/config-character.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/legacy-recipe.d.ts +2 -10
- package/lib/typescript/module/agent-avatar/legacy-recipe.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/AgentCreatorBase.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/CharacterControls.d.ts +2 -1
- package/lib/typescript/module/agent-creator/CharacterControls.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/ClippoArtwork.d.ts +6 -0
- package/lib/typescript/module/agent-creator/ClippoArtwork.d.ts.map +1 -0
- package/lib/typescript/module/agent-creator/CyclopsArtwork.d.ts +5 -0
- package/lib/typescript/module/agent-creator/CyclopsArtwork.d.ts.map +1 -0
- package/lib/typescript/module/agent-creator/EmotionPicker.d.ts +1 -0
- package/lib/typescript/module/agent-creator/EmotionPicker.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/ShapeSilhouette.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/ToddArtwork.d.ts +6 -0
- package/lib/typescript/module/agent-creator/ToddArtwork.d.ts.map +1 -0
- package/lib/typescript/module/agent-creator/constants.d.ts +7 -15
- package/lib/typescript/module/agent-creator/constants.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/messages.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +1 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/surface/SurfacePaint.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent-avatar/AgentAvatar.tsx +1 -1
- package/src/agent-avatar/CharacterAvatar.tsx +4 -1
- package/src/agent-avatar/character-colors.ts +12 -0
- package/src/agent-avatar/character-shapes.ts +122 -0
- package/src/agent-avatar/config-character.ts +39 -6
- package/src/agent-avatar/legacy-recipe.ts +34 -6
- package/src/agent-creator/AgentCreatorBase.tsx +121 -152
- package/src/agent-creator/CharacterControls.tsx +39 -14
- package/src/agent-creator/ClippoArtwork.tsx +49 -0
- package/src/agent-creator/CyclopsArtwork.tsx +27 -0
- package/src/agent-creator/EmotionPicker.tsx +55 -16
- package/src/agent-creator/ShapeSilhouette.tsx +16 -1
- package/src/agent-creator/ToddArtwork.tsx +24 -0
- package/src/agent-creator/constants.ts +47 -14
- package/src/agent-creator/messages.ts +2 -1
- package/src/bottom-sheet/BottomSheetBase.tsx +24 -34
- package/src/bottom-sheet/types.ts +1 -0
- package/src/dialog/DialogBottomSheet.tsx +1 -1
- package/src/locale/translations/ar.ts +1 -1
- package/src/locale/translations/bn.ts +1 -1
- package/src/locale/translations/ca.ts +1 -1
- package/src/locale/translations/de.ts +1 -1
- package/src/locale/translations/es.ts +1 -1
- package/src/locale/translations/fr.ts +1 -1
- package/src/locale/translations/hi.ts +1 -1
- package/src/locale/translations/id.ts +1 -1
- package/src/locale/translations/it.ts +1 -1
- package/src/locale/translations/ja.ts +1 -1
- package/src/locale/translations/pt.ts +1 -1
- package/src/locale/translations/ru.ts +1 -1
- package/src/locale/translations/tr.ts +1 -1
- package/src/locale/translations/zh.ts +1 -1
- package/src/surface/SurfacePaint.tsx +14 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import { CHARACTER_COLORS } from './constants';
|
|
3
|
+
|
|
4
|
+
/** Static Todd body outline: 128 projected triangle intersections from the
|
|
5
|
+
* original lime_frog mesh (2,502 vertices), with engine Y-up reflected for SVG.
|
|
6
|
+
* This selector does not load the renderer or substitute another body shape.
|
|
7
|
+
*/
|
|
8
|
+
export function ToddArtwork() {
|
|
9
|
+
return (
|
|
10
|
+
<Svg
|
|
11
|
+
width={56}
|
|
12
|
+
height={56}
|
|
13
|
+
viewBox="-1.04785 -0.86450 2.09611 1.69982"
|
|
14
|
+
preserveAspectRatio="xMidYMid meet"
|
|
15
|
+
accessible={false}
|
|
16
|
+
pointerEvents="none"
|
|
17
|
+
>
|
|
18
|
+
<Path
|
|
19
|
+
d="M0.9822 0.0000 L0.9686 -0.0476 L0.9504 -0.0936 L0.9289 -0.1378 L0.8988 -0.1788 L0.8645 -0.2165 L0.8334 -0.2528 L0.8060 -0.2884 L0.7878 -0.3263 L0.7842 -0.3709 L0.7896 -0.4221 L0.7977 -0.4781 L0.7977 -0.5330 L0.7882 -0.5845 L0.7697 -0.6317 L0.7439 -0.6742 L0.7120 -0.7120 L0.6747 -0.7444 L0.6333 -0.7717 L0.5869 -0.7914 L0.5384 -0.8058 L0.4878 -0.8139 L0.4348 -0.8135 L0.3814 -0.8063 L0.3272 -0.7900 L0.2726 -0.7618 L0.2193 -0.7230 L0.1675 -0.6686 L0.1242 -0.6245 L0.0877 -0.5910 L0.0565 -0.5733 L0.0277 -0.5641 L0.0000 -0.5610 L-0.0277 -0.5636 L-0.0563 -0.5720 L-0.0876 -0.5906 L-0.1236 -0.6212 L-0.1670 -0.6665 L-0.2181 -0.7190 L-0.2733 -0.7638 L-0.3269 -0.7893 L-0.3814 -0.8064 L-0.4354 -0.8146 L-0.4878 -0.8139 L-0.5385 -0.8060 L-0.5874 -0.7921 L-0.6331 -0.7714 L-0.6751 -0.7449 L-0.7120 -0.7120 L-0.7443 -0.6746 L-0.7697 -0.6316 L-0.7875 -0.5840 L-0.7971 -0.5326 L-0.7983 -0.4785 L-0.7901 -0.4223 L-0.7830 -0.3703 L-0.7880 -0.3264 L-0.8071 -0.2888 L-0.8338 -0.2529 L-0.8655 -0.2168 L-0.8995 -0.1789 L-0.9306 -0.1380 L-0.9510 -0.0937 L-0.9680 -0.0476 L-0.9814 -0.0000 L-0.9905 0.0487 L-0.9963 0.0981 L-0.9977 0.1480 L-0.9949 0.1979 L-0.9894 0.2478 L-0.9778 0.2966 L-0.9633 0.3447 L-0.9445 0.3912 L-0.9222 0.4362 L-0.8967 0.4793 L-0.8671 0.5197 L-0.8348 0.5578 L-0.8002 0.5934 L-0.7633 0.6264 L-0.7239 0.6561 L-0.6831 0.6831 L-0.6404 0.7066 L-0.5966 0.7269 L-0.5520 0.7443 L-0.5063 0.7578 L-0.4614 0.7698 L-0.4151 0.7766 L-0.3696 0.7816 L-0.3252 0.7850 L-0.2809 0.7851 L-0.2382 0.7851 L-0.1967 0.7851 L-0.1562 0.7851 L-0.1165 0.7852 L-0.0773 0.7852 L-0.0386 0.7852 L-0.0000 0.7852 L0.0386 0.7853 L0.0773 0.7853 L0.1165 0.7853 L0.1562 0.7853 L0.1967 0.7854 L0.2382 0.7854 L0.2810 0.7854 L0.3247 0.7840 L0.3699 0.7820 L0.4151 0.7766 L0.4614 0.7697 L0.5064 0.7578 L0.5522 0.7446 L0.5960 0.7262 L0.6403 0.7064 L0.6829 0.6829 L0.7237 0.6559 L0.7631 0.6262 L0.8002 0.5935 L0.8348 0.5578 L0.8675 0.5200 L0.8963 0.4791 L0.9217 0.4359 L0.9446 0.3913 L0.9632 0.3447 L0.9779 0.2966 L0.9887 0.2477 L0.9951 0.1979 L0.9977 0.1480 L0.9961 0.0981 L0.9912 0.0487Z"
|
|
20
|
+
fill={CHARACTER_COLORS.pink}
|
|
21
|
+
/>
|
|
22
|
+
</Svg>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NATIVE_CHARACTER_SHAPES } from '../agent-avatar/character-shapes';
|
|
1
2
|
import type { AgentLanguage, AgentPreferences } from './types';
|
|
2
3
|
export const AGENT_LANGUAGES = [
|
|
3
4
|
{ id: 'auto', label: 'Auto-detect' },
|
|
@@ -58,6 +59,7 @@ export const PREVIEW_TEXT: Record<AgentLanguage, string> = {
|
|
|
58
59
|
|
|
59
60
|
// Recovered engine catalog metadata. IDs are renderer selections; titles retain the beta catalog's English defaults.
|
|
60
61
|
export const CHARACTER_PRESETS = [
|
|
62
|
+
{ id: 'clippo', title: 'Clippo' },
|
|
61
63
|
{ id: 'blue_beret', title: 'Felipe' },
|
|
62
64
|
{ id: 'alfred', title: 'Alfred' },
|
|
63
65
|
{ id: 'purple_heart', title: 'Jojo' },
|
|
@@ -68,20 +70,51 @@ export const CHARACTER_PRESETS = [
|
|
|
68
70
|
{ id: 'lime_headphones', title: 'Iggy' },
|
|
69
71
|
] as const;
|
|
70
72
|
export const CHARACTER_OPTIONS = {
|
|
71
|
-
shape:
|
|
72
|
-
|
|
73
|
-
['
|
|
74
|
-
['
|
|
75
|
-
['
|
|
73
|
+
shape: NATIVE_CHARACTER_SHAPES,
|
|
74
|
+
color: [
|
|
75
|
+
['pink', 'Pink'],
|
|
76
|
+
['orchid', 'Orchid'],
|
|
77
|
+
['violet', 'Violet'],
|
|
78
|
+
['blue', 'Blue'],
|
|
79
|
+
['cyan', 'Cyan'],
|
|
80
|
+
['teal', 'Teal'],
|
|
81
|
+
['lime', 'Lime'],
|
|
82
|
+
['yellow', 'Yellow'],
|
|
83
|
+
['coral', 'Coral'],
|
|
84
|
+
],
|
|
85
|
+
eyes: [
|
|
86
|
+
['cyclops', 'Single eye'],
|
|
87
|
+
['clippo', 'Clippo'],
|
|
88
|
+
['todd', 'Todd'],
|
|
89
|
+
['swept_lids', 'Swept lids'],
|
|
90
|
+
['oval', 'Oval'],
|
|
91
|
+
['sparkle_capsules', 'Sparkle capsules'],
|
|
92
|
+
['highlight_capsules', 'Highlight capsules'],
|
|
93
|
+
['dots', 'Dots'],
|
|
94
|
+
['double_highlights', 'Round highlights'],
|
|
95
|
+
['round_inset', 'Round inset'],
|
|
96
|
+
['crescent_inset', 'Crescent inset'],
|
|
97
|
+
['sleepy_lids', 'Sleepy lids'],
|
|
98
|
+
],
|
|
99
|
+
eyewear: [
|
|
100
|
+
['none', 'None'],
|
|
101
|
+
['monocle', 'Monocle'],
|
|
102
|
+
['tall_oval_frames', 'Tall oval frames'],
|
|
103
|
+
['separate_trapezoid_lenses', 'Separate trapezoid lenses'],
|
|
104
|
+
['classic_sunglasses', 'Classic sunglasses'],
|
|
105
|
+
['round_sunglasses', 'Round sunglasses'],
|
|
106
|
+
],
|
|
107
|
+
accessory: [
|
|
108
|
+
['headphones', 'Headphones'],
|
|
109
|
+
['bow', 'Bow tie'],
|
|
110
|
+
['beanie', 'Beanie'],
|
|
111
|
+
['hat', 'Hat'],
|
|
112
|
+
['beret', 'Beret'],
|
|
113
|
+
['felipe_beret', 'Felipe’s beret'],
|
|
114
|
+
['orb', 'Bulb'],
|
|
115
|
+
['three_lobe', 'Tuft'],
|
|
116
|
+
['crown', 'Crown'],
|
|
76
117
|
],
|
|
77
|
-
color: [['pink', 'Pink'], ['orchid', 'Orchid'], ['violet', 'Violet'], ['blue', 'Blue'], ['cyan', 'Cyan'], ['teal', 'Teal'], ['lime', 'Lime'], ['yellow', 'Yellow'], ['coral', 'Coral']],
|
|
78
|
-
eyes: [['swept_lids', 'Swept lids'], ['oval', 'Oval'], ['sparkle_capsules', 'Sparkle capsules'], ['highlight_capsules', 'Highlight capsules'], ['dots', 'Dots'], ['double_highlights', 'Round highlights'], ['round_inset', 'Round inset'], ['crescent_inset', 'Crescent inset'], ['sleepy_lids', 'Sleepy lids']],
|
|
79
|
-
eyewear: [['none', 'None'], ['monocle', 'Monocle'], ['tall_oval_frames', 'Tall oval frames'], ['separate_trapezoid_lenses', 'Separate trapezoid lenses'], ['classic_sunglasses', 'Classic sunglasses'], ['round_sunglasses', 'Round sunglasses']],
|
|
80
|
-
accessory: [['headphones', 'Headphones'], ['bow', 'Bow tie'], ['beanie', 'Beanie'], ['hat', 'Hat'], ['beret', 'Beret'], ['orb', 'Bulb'], ['three_lobe', 'Tuft'], ['crown', 'Crown']],
|
|
81
118
|
} as const;
|
|
82
119
|
|
|
83
|
-
|
|
84
|
-
export const CHARACTER_COLORS = {
|
|
85
|
-
pink: '#fa70ab', orchid: '#dd6adc', violet: '#a25bff', blue: '#4778ff', cyan: '#00b1ff',
|
|
86
|
-
teal: '#04bb9f', lime: '#b6d80b', yellow: '#ffcc38', coral: '#ff8066',
|
|
87
|
-
} as const;
|
|
120
|
+
export { CHARACTER_COLORS } from '../agent-avatar/character-colors';
|
|
@@ -114,7 +114,8 @@ export const AGENT_CREATOR_MESSAGES: MessageCatalog<AgentCreatorMessages> =
|
|
|
114
114
|
betaEyes: 'Eye style',
|
|
115
115
|
eyewear: 'Eyewear',
|
|
116
116
|
accessory: 'Accessory',
|
|
117
|
-
characterOption: (
|
|
117
|
+
characterOption: (category, id, title) =>
|
|
118
|
+
category === 'eyes' && id === 'cyclops' ? 'Single eye' : String(title),
|
|
118
119
|
editor: 'Agent editor',
|
|
119
120
|
newBot: 'New bot',
|
|
120
121
|
closeEditor: 'Close agent editor',
|
|
@@ -133,14 +133,11 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
133
133
|
const bodyPanRef = useRef<GestureType | undefined>(undefined);
|
|
134
134
|
const handlePanRef = useRef<GestureType | undefined>(undefined);
|
|
135
135
|
|
|
136
|
-
//
|
|
136
|
+
// Completion is not a user request: once closed, every owner must hear it.
|
|
137
|
+
// Vetoes are checked before a user-triggered close starts, never after it.
|
|
137
138
|
const safeClose = useCallback(() => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
} else if (!onDismissAttempt) {
|
|
141
|
-
onDismiss?.();
|
|
142
|
-
}
|
|
143
|
-
}, [onDismissAttempt, onDismiss]);
|
|
139
|
+
onDismiss?.();
|
|
140
|
+
}, [onDismiss]);
|
|
144
141
|
|
|
145
142
|
// Mirror `safeClose` and `rendered` into refs so the unmount cleanup can
|
|
146
143
|
// fire the latest dismiss callback when needed, without re-binding the
|
|
@@ -251,6 +248,20 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
251
248
|
};
|
|
252
249
|
}, [colors.border]);
|
|
253
250
|
|
|
251
|
+
// Gesture callbacks cross to JS before consulting the consumer's veto.
|
|
252
|
+
// A refused drag springs back; it never hides the Modal or strands its owner.
|
|
253
|
+
const requestPanDismiss = useCallback((generation: number, velocity: number) => {
|
|
254
|
+
if (closeGenerationRef.current !== generation || hasClosedRef.current) return;
|
|
255
|
+
if (onDismissAttempt && !onDismissAttempt()) {
|
|
256
|
+
translateY.value = withSpring(0, { ...SPRING_CONFIG, velocity });
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
translateY.value = withSpring(screenHeightSV.value, { ...SPRING_CONFIG, velocity });
|
|
260
|
+
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
261
|
+
if (finished) runOnJS(finishClose)(generation);
|
|
262
|
+
});
|
|
263
|
+
}, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose]);
|
|
264
|
+
|
|
254
265
|
const present = useCallback(() => {
|
|
255
266
|
setRendered(true);
|
|
256
267
|
setVisible(true);
|
|
@@ -336,15 +347,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
336
347
|
(distance > closeThreshold && velocity > -300);
|
|
337
348
|
|
|
338
349
|
if (shouldClose) {
|
|
339
|
-
|
|
340
|
-
// moment the close gesture commits. The completion
|
|
341
|
-
// callback only fires `finishClose` if no reopen
|
|
342
|
-
// bumped the generation in between.
|
|
343
|
-
const generation = closeGeneration.value;
|
|
344
|
-
translateY.value = withSpring(screenHeightSV.value, { ...SPRING_CONFIG, velocity });
|
|
345
|
-
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
346
|
-
if (finished) runOnJS(finishClose)(generation);
|
|
347
|
-
});
|
|
350
|
+
runOnJS(requestPanDismiss)(closeGeneration.value, velocity);
|
|
348
351
|
} else {
|
|
349
352
|
translateY.value = withSpring(0, { ...SPRING_CONFIG, velocity });
|
|
350
353
|
}
|
|
@@ -396,16 +399,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
396
399
|
(distance > closeThreshold && velocity > -300);
|
|
397
400
|
|
|
398
401
|
if (shouldClose) {
|
|
399
|
-
|
|
400
|
-
translateY.value = withSpring(screenHeightSV.value, {
|
|
401
|
-
...SPRING_CONFIG,
|
|
402
|
-
velocity: velocity,
|
|
403
|
-
});
|
|
404
|
-
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
405
|
-
if (finished) {
|
|
406
|
-
runOnJS(finishClose)(generation);
|
|
407
|
-
}
|
|
408
|
-
});
|
|
402
|
+
runOnJS(requestPanDismiss)(closeGeneration.value, velocity);
|
|
409
403
|
} else {
|
|
410
404
|
translateY.value = withSpring(0, {
|
|
411
405
|
...SPRING_CONFIG,
|
|
@@ -417,7 +411,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
417
411
|
// values that change the gesture's behavior. `finishClose` is stable
|
|
418
412
|
// (useCallback with stable deps).
|
|
419
413
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
420
|
-
}, [enablePanDownToClose, detached, manualActivation, nativeGesture,
|
|
414
|
+
}, [enablePanDownToClose, detached, manualActivation, nativeGesture, requestPanDismiss]);
|
|
421
415
|
|
|
422
416
|
// Dedicated handle pan — only built in `manualActivation` mode. Always
|
|
423
417
|
// active so users can drag the handle even while content is mid-scroll.
|
|
@@ -456,17 +450,13 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
456
450
|
(distance > closeThreshold && velocity > -300);
|
|
457
451
|
|
|
458
452
|
if (shouldClose) {
|
|
459
|
-
|
|
460
|
-
translateY.value = withSpring(screenHeightSV.value, { ...SPRING_CONFIG, velocity });
|
|
461
|
-
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
462
|
-
if (finished) runOnJS(finishClose)(generation);
|
|
463
|
-
});
|
|
453
|
+
runOnJS(requestPanDismiss)(closeGeneration.value, velocity);
|
|
464
454
|
} else {
|
|
465
455
|
translateY.value = withSpring(0, { ...SPRING_CONFIG, velocity });
|
|
466
456
|
}
|
|
467
457
|
});
|
|
468
458
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
469
|
-
}, [manualActivation, enablePanDownToClose, enableHandlePanningGesture, detached,
|
|
459
|
+
}, [manualActivation, enablePanDownToClose, enableHandlePanningGesture, detached, requestPanDismiss]);
|
|
470
460
|
|
|
471
461
|
// CRITICAL — the shared values each `useAnimatedStyle` READS (translateY,
|
|
472
462
|
// opacity, screenHeightSV, keyboardHeight) MUST be listed in its dependency
|
|
@@ -698,7 +688,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
698
688
|
: <View style={[styles.nonScrollableContent, surfaceCorners, { overflow: 'hidden' }]}>{surfaceChildren}</View>;
|
|
699
689
|
|
|
700
690
|
return (
|
|
701
|
-
<Shell visible={rendered} onRequestClose={
|
|
691
|
+
<Shell visible={rendered} onRequestClose={handleBackdropPress} keyboardHeight={keyboardHeight}>
|
|
702
692
|
{/* Web keyboard and focus: in on open, back on close, Tab kept in
|
|
703
693
|
the sheet, Escape a USER dismissal — through `onDismissAttempt`,
|
|
704
694
|
exactly like the backdrop. The sheet had no keyboard path at
|
|
@@ -38,6 +38,7 @@ export interface BottomSheetProps {
|
|
|
38
38
|
*/
|
|
39
39
|
style?: StyleProp<AnimatedStyle<ViewStyle>>;
|
|
40
40
|
enableHandlePanningGesture?: boolean;
|
|
41
|
+
/** Veto user Back/backdrop/Escape/pan requests before closing; imperative dismiss bypasses it. */
|
|
41
42
|
onDismissAttempt?: () => boolean;
|
|
42
43
|
detached?: boolean; // If true, shows with margins and rounded corners. If false, full width with rounded top only.
|
|
43
44
|
/**
|
|
@@ -197,7 +197,7 @@ export function DialogBottomSheet({
|
|
|
197
197
|
const maxHeightPercent: `${number}%` = `${Math.round(maxHeightRatio * 100)}%`;
|
|
198
198
|
return [
|
|
199
199
|
{
|
|
200
|
-
backgroundColor:
|
|
200
|
+
backgroundColor: theme.colors.background,
|
|
201
201
|
...surfaceStyle(SURFACE_SHAPES.sheet),
|
|
202
202
|
maxHeight: maxHeightPercent,
|
|
203
203
|
},
|
|
@@ -34,7 +34,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
34
34
|
betaEyes: "نمط العيون",
|
|
35
35
|
eyewear: "نظارات",
|
|
36
36
|
accessory: "إكسسوار",
|
|
37
|
-
characterOption: (
|
|
37
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "عين واحدة" : String(title),
|
|
38
38
|
editor: "محرر الوكيل",
|
|
39
39
|
newBot: "روبوت جديد",
|
|
40
40
|
closeEditor: "إغلاق محرر الوكيل",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "চোখের ধরন",
|
|
25
25
|
eyewear: "চশমা",
|
|
26
26
|
accessory: "অনুষঙ্গ",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "একটি চোখ" : String(title),
|
|
28
28
|
editor: "এজেন্ট সম্পাদক",
|
|
29
29
|
newBot: "নতুন বট",
|
|
30
30
|
closeEditor: "এজেন্ট সম্পাদক বন্ধ করুন",
|
|
@@ -31,7 +31,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
31
31
|
betaEyes: "Estil dels ulls",
|
|
32
32
|
eyewear: "Ulleres",
|
|
33
33
|
accessory: "Accessori",
|
|
34
|
-
characterOption: (
|
|
34
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Un sol ull" : String(title),
|
|
35
35
|
editor: "Editor de l’agent",
|
|
36
36
|
newBot: "Bot nou",
|
|
37
37
|
closeEditor: "Tanca l’editor de l’agent",
|
|
@@ -26,7 +26,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
26
26
|
betaEyes: "Augenstil",
|
|
27
27
|
eyewear: "Brille",
|
|
28
28
|
accessory: "Accessoire",
|
|
29
|
-
characterOption: (
|
|
29
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Einzelnes Auge" : String(title),
|
|
30
30
|
editor: "Agenten-Editor",
|
|
31
31
|
newBot: "Neuer Bot",
|
|
32
32
|
closeEditor: "Agenten-Editor schließen",
|
|
@@ -31,7 +31,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
31
31
|
betaEyes: "Estilo de ojos",
|
|
32
32
|
eyewear: "Gafas",
|
|
33
33
|
accessory: "Accesorio",
|
|
34
|
-
characterOption: (
|
|
34
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Un solo ojo" : String(title),
|
|
35
35
|
editor: "Editor del agente",
|
|
36
36
|
newBot: "Nuevo bot",
|
|
37
37
|
closeEditor: "Cerrar editor del agente",
|
|
@@ -31,7 +31,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
31
31
|
betaEyes: "Style des yeux",
|
|
32
32
|
eyewear: "Lunettes",
|
|
33
33
|
accessory: "Accessoire",
|
|
34
|
-
characterOption: (
|
|
34
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Œil unique" : String(title),
|
|
35
35
|
editor: "Éditeur de l’agent",
|
|
36
36
|
newBot: "Nouveau bot",
|
|
37
37
|
closeEditor: "Fermer l’éditeur de l’agent",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "आँखों की शैली",
|
|
25
25
|
eyewear: "चश्मा",
|
|
26
26
|
accessory: "सहायक वस्तु",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "एक आँख" : String(title),
|
|
28
28
|
editor: "एजेंट संपादक",
|
|
29
29
|
newBot: "नया बॉट",
|
|
30
30
|
closeEditor: "एजेंट संपादक बंद करें",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "Gaya mata",
|
|
25
25
|
eyewear: "Kacamata",
|
|
26
26
|
accessory: "Aksesori",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Satu mata" : String(title),
|
|
28
28
|
editor: "Editor agen",
|
|
29
29
|
newBot: "Bot baru",
|
|
30
30
|
closeEditor: "Tutup editor agen",
|
|
@@ -31,7 +31,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
31
31
|
betaEyes: "Stile degli occhi",
|
|
32
32
|
eyewear: "Occhiali",
|
|
33
33
|
accessory: "Accessorio",
|
|
34
|
-
characterOption: (
|
|
34
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Occhio singolo" : String(title),
|
|
35
35
|
editor: "Editor dell’agente",
|
|
36
36
|
newBot: "Nuovo bot",
|
|
37
37
|
closeEditor: "Chiudi l’editor dell’agente",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "目のスタイル",
|
|
25
25
|
eyewear: "眼鏡",
|
|
26
26
|
accessory: "アクセサリー",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "一つ目" : String(title),
|
|
28
28
|
editor: "エージェント編集",
|
|
29
29
|
newBot: "新しいボット",
|
|
30
30
|
closeEditor: "エージェント編集を閉じる",
|
|
@@ -31,7 +31,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
31
31
|
betaEyes: "Estilo dos olhos",
|
|
32
32
|
eyewear: "Óculos",
|
|
33
33
|
accessory: "Acessório",
|
|
34
|
-
characterOption: (
|
|
34
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Olho único" : String(title),
|
|
35
35
|
editor: "Editor do agente",
|
|
36
36
|
newBot: "Novo bot",
|
|
37
37
|
closeEditor: "Fechar editor do agente",
|
|
@@ -27,7 +27,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
27
27
|
betaEyes: "Стиль глаз",
|
|
28
28
|
eyewear: "Очки",
|
|
29
29
|
accessory: "Аксессуар",
|
|
30
|
-
characterOption: (
|
|
30
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Один глаз" : String(title),
|
|
31
31
|
editor: "Редактор агента",
|
|
32
32
|
newBot: "Новый бот",
|
|
33
33
|
closeEditor: "Закрыть редактор агента",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "Göz stili",
|
|
25
25
|
eyewear: "Gözlük",
|
|
26
26
|
accessory: "Aksesuar",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "Tek göz" : String(title),
|
|
28
28
|
editor: "Ajan düzenleyici",
|
|
29
29
|
newBot: "Yeni bot",
|
|
30
30
|
closeEditor: "Ajan düzenleyiciyi kapat",
|
|
@@ -24,7 +24,7 @@ const AGENT_CREATOR_MESSAGES: Translations['AGENT_CREATOR_MESSAGES'] = {
|
|
|
24
24
|
betaEyes: "眼睛风格",
|
|
25
25
|
eyewear: "眼镜",
|
|
26
26
|
accessory: "配饰",
|
|
27
|
-
characterOption: (
|
|
27
|
+
characterOption: (category, id, title) => category === "eyes" && id === "cyclops" ? "单眼" : String(title),
|
|
28
28
|
editor: "智能体编辑器",
|
|
29
29
|
newBot: "新机器人",
|
|
30
30
|
closeEditor: "关闭智能体编辑器",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { surfaceStyle } from '../shapes/surface-style';
|
|
2
2
|
import type { SurfaceShape } from '../shapes/corner-types';
|
|
3
|
-
import React, { memo, useEffect } from 'react';
|
|
4
|
-
import { Platform, StyleSheet, View, type ViewStyle } from 'react-native';
|
|
3
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { Platform, StyleSheet, View, type LayoutChangeEvent, type ViewStyle } from 'react-native';
|
|
5
5
|
import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
|
|
6
6
|
import { useSvgIdPrefix } from '../styles/svg-id';
|
|
7
7
|
import { StyledView } from '../styles/styled-primitives';
|
|
@@ -47,6 +47,13 @@ export const SurfacePaint = memo(function SurfacePaint({
|
|
|
47
47
|
const resolvedFill = resolveSurfaceTint(fill ?? 'transparent');
|
|
48
48
|
const id = useSvgIdPrefix('bloom-surface');
|
|
49
49
|
const isWeb = Platform.OS === 'web';
|
|
50
|
+
const [nativeSize, setNativeSize] = useState<{ width: number; height: number } | null>(null);
|
|
51
|
+
const onNativeLayout = useCallback((event: LayoutChangeEvent) => {
|
|
52
|
+
const { width, height } = event.nativeEvent.layout;
|
|
53
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return;
|
|
54
|
+
setNativeSize(previous => previous?.width === width && previous.height === height
|
|
55
|
+
? previous : { width, height });
|
|
56
|
+
}, []);
|
|
50
57
|
useSurfaceRefraction(isWeb);
|
|
51
58
|
useEffect(() => {
|
|
52
59
|
if (isWeb) adoptStyleSheet('bloom-surface-paint-web-css', WEB_PAINT_CSS);
|
|
@@ -67,17 +74,20 @@ export const SurfacePaint = memo(function SurfacePaint({
|
|
|
67
74
|
return (
|
|
68
75
|
<View
|
|
69
76
|
testID={testID}
|
|
77
|
+
onLayout={onNativeLayout}
|
|
70
78
|
pointerEvents="none"
|
|
71
79
|
style={[StyleSheet.absoluteFill, geometry, { overflow: 'hidden' }]}
|
|
72
80
|
>
|
|
81
|
+
{/* Android SVG percentage paths cache canvas dimensions after first paint.
|
|
82
|
+
Update the actual Rect geometry when this backing View changes size. */}
|
|
73
83
|
<Svg width="100%" height="100%" style={StyleSheet.absoluteFill}>
|
|
74
84
|
<Defs>
|
|
75
85
|
{sheen ? <LinearGradient id={`${id}-sheen`} x1="0" y1="0" x2="0" y2="1">
|
|
76
86
|
{optics.sheen.map(stop => <Stop key={stop.offset} offset={String(stop.offset)} stopColor={stop.color} stopOpacity={stop.opacity} />)}
|
|
77
87
|
</LinearGradient> : null}
|
|
78
88
|
</Defs>
|
|
79
|
-
{fill !== undefined ? <Rect x="0" y="0" width=
|
|
80
|
-
{sheen ? <Rect x="0" y="0" width=
|
|
89
|
+
{fill !== undefined ? <Rect x="0" y="0" width={nativeSize?.width ?? '100%'} height={nativeSize?.height ?? '100%'} fill={base.color} fillOpacity={base.opacity} /> : null}
|
|
90
|
+
{sheen ? <Rect x="0" y="0" width={nativeSize?.width ?? '100%'} height={nativeSize?.height ?? '100%'} fill={`url(#${id}-sheen)`} /> : null}
|
|
81
91
|
</Svg>
|
|
82
92
|
<View pointerEvents="none" style={[StyleSheet.absoluteFill, geometry, { boxShadow: optics.rim }]} />
|
|
83
93
|
</View>
|