@oxyhq/bloom 0.26.1 → 0.27.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.
Files changed (48) hide show
  1. package/lib/commonjs/avatar/Avatar.js +67 -96
  2. package/lib/commonjs/avatar/Avatar.js.map +1 -1
  3. package/lib/commonjs/avatar/AvatarRing.js +183 -0
  4. package/lib/commonjs/avatar/AvatarRing.js.map +1 -0
  5. package/lib/commonjs/avatar/index.js.map +1 -1
  6. package/lib/commonjs/avatar/squircle-path.js +14 -0
  7. package/lib/commonjs/avatar/squircle-path.js.map +1 -0
  8. package/lib/commonjs/avatar/svg-module.js +15 -0
  9. package/lib/commonjs/avatar/svg-module.js.map +1 -0
  10. package/lib/module/avatar/Avatar.js +66 -96
  11. package/lib/module/avatar/Avatar.js.map +1 -1
  12. package/lib/module/avatar/AvatarRing.js +177 -0
  13. package/lib/module/avatar/AvatarRing.js.map +1 -0
  14. package/lib/module/avatar/index.js.map +1 -1
  15. package/lib/module/avatar/squircle-path.js +10 -0
  16. package/lib/module/avatar/squircle-path.js.map +1 -0
  17. package/lib/module/avatar/svg-module.js +11 -0
  18. package/lib/module/avatar/svg-module.js.map +1 -0
  19. package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
  20. package/lib/typescript/commonjs/avatar/AvatarRing.d.ts +27 -0
  21. package/lib/typescript/commonjs/avatar/AvatarRing.d.ts.map +1 -0
  22. package/lib/typescript/commonjs/avatar/index.d.ts +1 -1
  23. package/lib/typescript/commonjs/avatar/index.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/avatar/squircle-path.d.ts +8 -0
  25. package/lib/typescript/commonjs/avatar/squircle-path.d.ts.map +1 -0
  26. package/lib/typescript/commonjs/avatar/svg-module.d.ts +8 -0
  27. package/lib/typescript/commonjs/avatar/svg-module.d.ts.map +1 -0
  28. package/lib/typescript/commonjs/avatar/types.d.ts +30 -0
  29. package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -1
  30. package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
  31. package/lib/typescript/module/avatar/AvatarRing.d.ts +27 -0
  32. package/lib/typescript/module/avatar/AvatarRing.d.ts.map +1 -0
  33. package/lib/typescript/module/avatar/index.d.ts +1 -1
  34. package/lib/typescript/module/avatar/index.d.ts.map +1 -1
  35. package/lib/typescript/module/avatar/squircle-path.d.ts +8 -0
  36. package/lib/typescript/module/avatar/squircle-path.d.ts.map +1 -0
  37. package/lib/typescript/module/avatar/svg-module.d.ts +8 -0
  38. package/lib/typescript/module/avatar/svg-module.d.ts.map +1 -0
  39. package/lib/typescript/module/avatar/types.d.ts +30 -0
  40. package/lib/typescript/module/avatar/types.d.ts.map +1 -1
  41. package/package.json +2 -1
  42. package/src/avatar/Avatar.stories.tsx +95 -0
  43. package/src/avatar/Avatar.tsx +61 -110
  44. package/src/avatar/AvatarRing.tsx +170 -0
  45. package/src/avatar/index.ts +6 -1
  46. package/src/avatar/squircle-path.ts +11 -0
  47. package/src/avatar/svg-module.ts +11 -0
  48. package/src/avatar/types.ts +32 -0
@@ -5,9 +5,11 @@ import { View, Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
5
5
  import { useTheme } from "../theme/use-theme.js";
6
6
  import { useImageResolver } from "../image-resolver/context.js";
7
7
  import { Z_INDEX } from "../styles/z-index.js";
8
- import { lazyRequire } from "../utils/lazy-require.js";
9
8
  import { useAvatarPlaceholder } from "./placeholder-context.js";
10
9
  import { LiveBadge } from "./LiveBadge.js";
10
+ import { AvatarRing, getRingOuterSize } from "./AvatarRing.js";
11
+ import { getSvgModule } from "./svg-module.js";
12
+ import { SQUIRCLE_PATH } from "./squircle-path.js";
11
13
  // Google Contacts-inspired palette used to pick a deterministic background
12
14
  // color for name-based placeholder avatars.
13
15
  const NAME_AVATAR_COLORS = ['#D93025', '#E8710A', '#F9AB00', '#1E8E3E', '#12B5CB', '#1A73E8', '#7627BB', '#C5221F', '#0B8043', '#A142F4'];
@@ -32,24 +34,8 @@ function getNameColor(name) {
32
34
  // `.jpg` asset import (and no ambient `*.jpg` module declaration) is required for
33
35
  // consumers compiling Bloom's source files directly.
34
36
  import DEFAULT_AVATAR_IMAGE from "./default-avatar.js";
35
-
36
- // Squircle clip path normalized to 0–1 coordinate space (viewBox="0 0 1 1").
37
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
38
- const SQUIRCLE_PATH = 'M0 0.5 L0.00122 0.31674 L0.00489 0.25123 L0.01103 0.20331 L0.01969 0.16478 L0.03097 0.13257 L0.04495 0.10518 L0.0618 0.08177 L0.08177 0.0618 L0.10518 0.04495 L0.13257 0.03097 L0.16478 0.01969 L0.20331 0.01103 L0.25123 0.00489 L0.31674 0.00122 L0.5 0' + ' L0.68895 0.0014 L0.7564 0.00561 L0.80559 0.01267 L0.84499 0.02264 L0.87771 0.03564 L0.9053 0.05181 L0.92862 0.07138 L0.94819 0.0947 L0.96436 0.12228 L0.97736 0.15501 L0.98733 0.19441 L0.99439 0.2436 L0.9986 0.31105 L1 0.5' + ' L0.9986 0.68895 L0.99439 0.7564 L0.98733 0.80559 L0.97736 0.84499 L0.96436 0.87771 L0.94819 0.9053 L0.92862 0.92862 L0.9053 0.94819 L0.87771 0.96436 L0.84499 0.97736 L0.80559 0.98733 L0.7564 0.99439 L0.68895 0.9986 L0.5 1' + ' L0.31105 0.9986 L0.2436 0.99439 L0.19441 0.98733 L0.15501 0.97736 L0.12228 0.96436 L0.0947 0.94819 L0.07138 0.92862 L0.05181 0.9053 L0.03564 0.87771 L0.02264 0.84499 L0.01267 0.80559 L0.00561 0.7564 L0.0014 0.68895 L0 0.5Z';
37
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
39
38
  let clipIdCounter = 0;
40
-
41
- // Lazy-loaded SVG components for squircle shape.
42
- // Returns null if react-native-svg is not installed.
43
-
44
- const getSvgModule = lazyRequire('react-native-svg');
45
-
46
- /**
47
- * Live-ring drawing config passed down to shape renderers.
48
- * - `color`: resolved ring color (theme `negative` or `liveColor` override).
49
- * - `strokeWidth`: stroke width in the squircle's 0–1 path coordinate space.
50
- * - `borderWidth`: ring border width in pixels for the circle fallback.
51
- */
52
-
53
39
  function SquircleImage({
54
40
  uri,
55
41
  fallbackSource,
@@ -57,24 +43,18 @@ function SquircleImage({
57
43
  fallbackColor,
58
44
  placeholderIcon,
59
45
  name,
60
- onError,
61
- liveRing
46
+ onError
62
47
  }) {
48
+ const clipId = useMemo(() => `bloom-sqc${clipIdCounter++}`, []);
63
49
  const svg = getSvgModule();
64
50
  if (!svg) {
65
- // Fallback to circle if react-native-svg is not installed. The circle
66
- // fallback also gets a circle live ring (matching its rendered shape).
67
- return /*#__PURE__*/_jsxs(_Fragment, {
68
- children: [/*#__PURE__*/_jsx(CircleFallback, {
69
- size: size,
70
- fallbackColor: fallbackColor,
71
- icon: placeholderIcon,
72
- name: name
73
- }), liveRing && /*#__PURE__*/_jsx(CircleLiveRing, {
74
- radius: size / 2,
75
- color: liveRing.color,
76
- borderWidth: liveRing.borderWidth
77
- })]
51
+ // Fallback to a circle if react-native-svg is not installed. The ring (if
52
+ // any) is drawn separately by AvatarRing, which also degrades to a circle.
53
+ return /*#__PURE__*/_jsx(CircleFallback, {
54
+ size: size,
55
+ fallbackColor: fallbackColor,
56
+ icon: placeholderIcon,
57
+ name: name
78
58
  });
79
59
  }
80
60
  const {
@@ -84,22 +64,15 @@ function SquircleImage({
84
64
  Path,
85
65
  Image: SvgImage
86
66
  } = svg;
87
- const clipId = useMemo(() => `bloom-sqc${clipIdCounter++}`, []);
88
67
  const href = uri ? {
89
68
  uri
90
69
  } : fallbackSource;
91
70
  if (!href) {
92
- return /*#__PURE__*/_jsxs(_Fragment, {
93
- children: [/*#__PURE__*/_jsx(CircleFallback, {
94
- size: size,
95
- fallbackColor: fallbackColor,
96
- icon: placeholderIcon,
97
- name: name
98
- }), liveRing && /*#__PURE__*/_jsx(CircleLiveRing, {
99
- radius: size / 2,
100
- color: liveRing.color,
101
- borderWidth: liveRing.borderWidth
102
- })]
71
+ return /*#__PURE__*/_jsx(CircleFallback, {
72
+ size: size,
73
+ fallbackColor: fallbackColor,
74
+ icon: placeholderIcon,
75
+ name: name
103
76
  });
104
77
  }
105
78
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -126,11 +99,6 @@ function SquircleImage({
126
99
  height: 1,
127
100
  preserveAspectRatio: "xMidYMid slice",
128
101
  clipPath: `url(#${clipId})`
129
- }), liveRing && /*#__PURE__*/_jsx(Path, {
130
- d: SQUIRCLE_PATH,
131
- fill: "none",
132
- stroke: liveRing.color,
133
- strokeWidth: liveRing.strokeWidth
134
102
  })]
135
103
  })]
136
104
  });
@@ -179,28 +147,6 @@ function CircleFallback({
179
147
  }))
180
148
  });
181
149
  }
182
-
183
- /**
184
- * Solid live ring for circular avatars — an absolutely-positioned inset-0
185
- * overlay whose border overlays the avatar edge (drawn on top of the image,
186
- * never a border on the image itself). Also used as the fallback ring for a
187
- * squircle avatar when react-native-svg is unavailable.
188
- */
189
- function CircleLiveRing({
190
- radius,
191
- color,
192
- borderWidth
193
- }) {
194
- return /*#__PURE__*/_jsx(View, {
195
- style: [StyleSheet.absoluteFill, {
196
- borderRadius: radius,
197
- borderColor: color,
198
- borderWidth,
199
- zIndex: Z_INDEX.raised,
200
- pointerEvents: 'none'
201
- }]
202
- });
203
- }
204
150
  const AvatarComponent = ({
205
151
  source,
206
152
  uri,
@@ -220,6 +166,7 @@ const AvatarComponent = ({
220
166
  hideLiveBadge = false,
221
167
  liveLabel = 'LIVE',
222
168
  liveColor,
169
+ ring,
223
170
  testID
224
171
  }) => {
225
172
  const [errored, setErrored] = useState(false);
@@ -277,26 +224,40 @@ const AvatarComponent = ({
277
224
  return fallbackSource;
278
225
  }, [effectiveUri, resolvedImageSource, fallbackSource]);
279
226
 
280
- // Live indicator (modeled on Bluesky): a solid ring around the avatar plus,
281
- // unless suppressed, a "LIVE" pill hanging off the bottom-center. Colors come
282
- // from the theme (`negative` / `negativeForeground`) with an optional
283
- // `liveColor` override. The badge is only shown for `size > 16`.
284
- const liveRingColor = liveColor ?? theme.colors.negative;
285
- const liveBorderWidth = size > 16 ? 2 : 1;
286
- const liveRing = live ? {
287
- color: liveRingColor,
288
- // The squircle path is in 0–1 space; center-stroking it and letting the
289
- // viewport clip the outer half yields a ~`liveBorderWidth`-px inset ring.
290
- strokeWidth: liveBorderWidth / size * 2,
291
- borderWidth: liveBorderWidth
227
+ // Resolve a SINGLE ring config shared by `live` and the public `ring` prop.
228
+ // An explicit `ring` wins for geometry and colors; otherwise `live` derives a
229
+ // solid theme-`negative` ring (modeled on Bluesky's live indicator). The
230
+ // "LIVE" badge stays independently controlled by `live` / `hideLiveBadge` and
231
+ // uses the theme `negative` color regardless of the ring's colors.
232
+ const liveBadgeColor = liveColor ?? theme.colors.negative;
233
+ const resolvedRing = ring ? ring : live ? {
234
+ colors: liveBadgeColor,
235
+ width: size > 16 ? 2 : 1,
236
+ gap: 0
292
237
  } : undefined;
238
+ const ringWidth = resolvedRing?.width ?? (size > 16 ? 2 : 1);
239
+ const ringGap = resolvedRing?.gap ?? 0;
240
+ // When gap > 0 the ring sits outside the avatar and the footprint grows so the
241
+ // avatar can be centered inside; gap 0 overlays the edge (footprint unchanged).
242
+ const outer = resolvedRing ? getRingOuterSize(size, ringWidth, ringGap) : size;
293
243
  const showLiveBadge = live && size > 16 && !hideLiveBadge;
294
- const content = /*#__PURE__*/_jsxs(View, {
295
- style: [styles.container, {
244
+ const ringElement = resolvedRing ? /*#__PURE__*/_jsx(AvatarRing, {
245
+ size: size,
246
+ shape: shape,
247
+ colors: resolvedRing.colors,
248
+ width: ringWidth,
249
+ gap: ringGap,
250
+ gradientDirection: resolvedRing.gradientDirection ?? 'diagonal'
251
+ }) : null;
252
+
253
+ // The avatar box holds the image and the badges (which hug the avatar). When
254
+ // gap > 0 this box is centered inside the larger container; when gap is 0 it
255
+ // fills the container exactly.
256
+ const avatarBox = /*#__PURE__*/_jsxs(View, {
257
+ style: [styles.avatarBox, {
296
258
  width: size,
297
259
  height: size
298
- }, style],
299
- testID: testID,
260
+ }],
300
261
  children: [shape === 'squircle' ? /*#__PURE__*/_jsx(SquircleImage, {
301
262
  uri: effectiveUri,
302
263
  fallbackSource: fallbackSource,
@@ -304,8 +265,7 @@ const AvatarComponent = ({
304
265
  fallbackColor: fallbackColor,
305
266
  placeholderIcon: resolvedPlaceholderIcon,
306
267
  name: name,
307
- onError: () => setErrored(true),
308
- liveRing: liveRing
268
+ onError: () => setErrored(true)
309
269
  }) : /*#__PURE__*/_jsx(View, {
310
270
  style: [styles.imageContainer, {
311
271
  width: size,
@@ -325,11 +285,7 @@ const AvatarComponent = ({
325
285
  icon: resolvedPlaceholderIcon,
326
286
  name: name
327
287
  })
328
- }), live && shape !== 'squircle' && /*#__PURE__*/_jsx(CircleLiveRing, {
329
- radius: radius,
330
- color: liveRingColor,
331
- borderWidth: liveBorderWidth
332
- }), verified && verifiedIcon && /*#__PURE__*/_jsx(View, {
288
+ }), ringGap === 0 ? ringElement : null, verified && verifiedIcon && /*#__PURE__*/_jsx(View, {
333
289
  style: [styles.verifiedBadge, {
334
290
  width: size * 0.36,
335
291
  height: size * 0.36
@@ -338,10 +294,18 @@ const AvatarComponent = ({
338
294
  }), showLiveBadge && /*#__PURE__*/_jsx(LiveBadge, {
339
295
  variant: size > 32 ? 'small' : 'tiny',
340
296
  label: liveLabel,
341
- backgroundColor: liveRingColor,
297
+ backgroundColor: liveBadgeColor,
342
298
  textColor: theme.colors.negativeForeground
343
299
  })]
344
300
  });
301
+ const content = /*#__PURE__*/_jsxs(View, {
302
+ style: [styles.container, {
303
+ width: outer,
304
+ height: outer
305
+ }, style],
306
+ testID: testID,
307
+ children: [ringGap > 0 ? ringElement : null, avatarBox]
308
+ });
345
309
  if (onPress) {
346
310
  return /*#__PURE__*/_jsx(TouchableOpacity, {
347
311
  onPress: onPress,
@@ -357,6 +321,12 @@ const styles = StyleSheet.create({
357
321
  justifyContent: 'center',
358
322
  alignItems: 'center'
359
323
  },
324
+ avatarBox: {
325
+ position: 'relative',
326
+ overflow: 'visible',
327
+ justifyContent: 'center',
328
+ alignItems: 'center'
329
+ },
360
330
  imageContainer: {
361
331
  overflow: 'hidden',
362
332
  justifyContent: 'center',
@@ -1 +1 @@
1
- {"version":3,"names":["React","memo","useMemo","useRef","useState","View","Image","StyleSheet","Text","TouchableOpacity","useTheme","useImageResolver","Z_INDEX","lazyRequire","useAvatarPlaceholder","LiveBadge","NAME_AVATAR_COLORS","getInitial","name","trimmed","trim","firstCodePoint","toUpperCase","getNameColor","hash","i","length","charCodeAt","index","Math","abs","DEFAULT_AVATAR_IMAGE","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SQUIRCLE_PATH","clipIdCounter","getSvgModule","SquircleImage","uri","fallbackSource","size","fallbackColor","placeholderIcon","onError","liveRing","svg","children","CircleFallback","icon","CircleLiveRing","radius","color","borderWidth","default","Svg","Defs","ClipPath","Path","SvgImage","clipId","href","source","style","styles","errorDetector","width","height","viewBox","id","d","preserveAspectRatio","clipPath","fill","stroke","strokeWidth","hasName","initialStyle","fontSize","round","fontWeight","lineHeight","textAlign","includeFontPadding","borderRadius","backgroundColor","justifyContent","alignItems","overflow","allowFontScaling","numberOfLines","resizeMode","absoluteFill","borderColor","zIndex","raised","pointerEvents","AvatarComponent","variant","verified","verifiedIcon","shape","imageStyle","placeholderColor","onPress","live","hideLiveBadge","liveLabel","liveColor","testID","errored","setErrored","theme","placeholderConfig","colors","backgroundTertiary","resolvedPlaceholderIcon","undefined","prevSourceRef","prevUriRef","prevVariantRef","current","imageResolver","resolvedUri","startsWith","resolvedImageSource","effectiveUri","imageSource","liveRingColor","negative","liveBorderWidth","showLiveBadge","content","container","imageContainer","verifiedBadge","label","textColor","negativeForeground","create","position","bottom","right","opacity","Avatar","displayName"],"sourceRoot":"../../../src","sources":["avatar/Avatar.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,I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C+C,MAAM,CAACC,WAAW,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["React","memo","useMemo","useRef","useState","View","Image","StyleSheet","Text","TouchableOpacity","useTheme","useImageResolver","Z_INDEX","useAvatarPlaceholder","LiveBadge","AvatarRing","getRingOuterSize","getSvgModule","SQUIRCLE_PATH","NAME_AVATAR_COLORS","getInitial","name","trimmed","trim","firstCodePoint","toUpperCase","getNameColor","hash","i","length","charCodeAt","index","Math","abs","DEFAULT_AVATAR_IMAGE","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","clipIdCounter","SquircleImage","uri","fallbackSource","size","fallbackColor","placeholderIcon","onError","clipId","svg","CircleFallback","icon","default","Svg","Defs","ClipPath","Path","SvgImage","href","children","source","style","styles","errorDetector","width","height","viewBox","id","d","preserveAspectRatio","clipPath","radius","hasName","initialStyle","color","fontSize","round","fontWeight","lineHeight","textAlign","includeFontPadding","borderRadius","backgroundColor","justifyContent","alignItems","overflow","allowFontScaling","numberOfLines","resizeMode","AvatarComponent","variant","verified","verifiedIcon","shape","imageStyle","placeholderColor","onPress","live","hideLiveBadge","liveLabel","liveColor","ring","testID","errored","setErrored","theme","placeholderConfig","colors","backgroundTertiary","resolvedPlaceholderIcon","undefined","prevSourceRef","prevUriRef","prevVariantRef","current","imageResolver","resolvedUri","startsWith","resolvedImageSource","effectiveUri","imageSource","liveBadgeColor","negative","resolvedRing","gap","ringWidth","ringGap","outer","showLiveBadge","ringElement","gradientDirection","avatarBox","imageContainer","absoluteFill","verifiedBadge","label","textColor","negativeForeground","content","container","create","position","bottom","right","zIndex","raised","opacity","Avatar","displayName"],"sourceRoot":"../../../src","sources":["avatar/Avatar.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,SAASC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAG9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D,SAAS,EAAE;IACTE,QAAQ,EAAE,UAAU;IACpBxD,QAAQ,EAAE,SAAS;IACnBF,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACD+C,SAAS,EAAE;IACTU,QAAQ,EAAE,UAAU;IACpBxD,QAAQ,EAAE,SAAS;IACnBF,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDgD,cAAc,EAAE;IACd/C,QAAQ,EAAE,QAAQ;IAClBF,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDkD,aAAa,EAAE;IACbO,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC,CAAC;IACVC,KAAK,EAAE,CAAC,CAAC;IACT5D,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpB4D,MAAM,EAAErI,OAAO,CAACsI;EAClB,CAAC;EACDlF,aAAa,EAAE;IACb8E,QAAQ,EAAE,UAAU;IACpB7E,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTiF,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,OAAO,MAAMC,MAAM,gBAAGnJ,IAAI,CAACyF,eAAe,CAAC;AAC3C0D,MAAM,CAACC,WAAW,GAAG,QAAQ","ignoreList":[]}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ import React, { memo, useMemo } from 'react';
4
+ import { View, StyleSheet } from 'react-native';
5
+ import { Z_INDEX } from "../styles/z-index.js";
6
+ import { getSvgModule } from "./svg-module.js";
7
+ import { SQUIRCLE_PATH } from "./squircle-path.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ // Module counter for unique gradient element ids — mirrors the `clipIdCounter`
10
+ // pattern in `Avatar.tsx`. Deterministic (no `Math.random()`) so ids are stable
11
+ // per mounted instance.
12
+ let ringGradientIdCounter = 0;
13
+
14
+ /**
15
+ * Size of the box the ring occupies. With `gap === 0` the ring overlays the
16
+ * avatar edge and the box equals the avatar size (footprint unchanged). With
17
+ * `gap > 0` the ring sits OUTSIDE the avatar, so the box grows and the avatar is
18
+ * centered inside it. Exported so `Avatar` reserves the same footprint with a
19
+ * single source for the geometry formula.
20
+ */
21
+ export function getRingOuterSize(size, width, gap) {
22
+ return gap > 0 ? size + 2 * (width + gap) : size;
23
+ }
24
+ function gradientCoords(direction) {
25
+ switch (direction) {
26
+ case 'horizontal':
27
+ return {
28
+ x1: '0',
29
+ y1: '0',
30
+ x2: '1',
31
+ y2: '0'
32
+ };
33
+ case 'vertical':
34
+ return {
35
+ x1: '0',
36
+ y1: '0',
37
+ x2: '0',
38
+ y2: '1'
39
+ };
40
+ case 'diagonal':
41
+ default:
42
+ return {
43
+ x1: '0',
44
+ y1: '0',
45
+ x2: '1',
46
+ y2: '1'
47
+ };
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Single ring primitive shared by the `live` indicator and the public `ring`
53
+ * prop. Renders either a solid or a gradient ring, for both `circle` and
54
+ * `squircle` avatars.
55
+ *
56
+ * - Solid circle → a plain bordered `<View>` (no `react-native-svg` needed).
57
+ * - Solid squircle → an SVG `<Path>` stroking the squircle outline.
58
+ * - Gradient (either shape) → an SVG `<LinearGradient>` stroke; degrades to a
59
+ * solid ring of the first color when `react-native-svg` is unavailable (a
60
+ * squircle then degrades to a circle border, matching the avatar's own no-SVG
61
+ * circle fallback).
62
+ *
63
+ * Internal to the avatar family — not exported from the package.
64
+ */
65
+ const AvatarRingComponent = ({
66
+ size,
67
+ shape,
68
+ colors,
69
+ width,
70
+ gap,
71
+ gradientDirection
72
+ }) => {
73
+ const gradientId = useMemo(() => `bloom-ring-grad${ringGradientIdCounter++}`, []);
74
+ const colorList = Array.isArray(colors) ? colors : [colors];
75
+ const wantsGradient = colorList.length >= 2;
76
+ const solidColor = colorList[0] ?? '#000000';
77
+ const outer = getRingOuterSize(size, width, gap);
78
+ // The ring's visible band is always the outermost `width` px inside the outer
79
+ // box; when it degrades to a circle border it is a full circle → radius
80
+ // `outer / 2`.
81
+ const ringRadius = outer / 2;
82
+
83
+ // `react-native-svg` is required for gradients (both shapes) and for the
84
+ // squircle outline. A solid circle ring is a plain border and never needs it.
85
+ const needsSvg = wantsGradient || shape === 'squircle';
86
+ const svg = needsSvg ? getSvgModule() : null;
87
+
88
+ // No SVG available (or a solid circle, which never needs SVG): draw a plain
89
+ // bordered View. A gradient degrades to its first color; a squircle degrades
90
+ // to a circle border.
91
+ if (!svg) {
92
+ return /*#__PURE__*/_jsx(View, {
93
+ pointerEvents: "none",
94
+ style: {
95
+ position: 'absolute',
96
+ top: 0,
97
+ left: 0,
98
+ width: outer,
99
+ height: outer,
100
+ borderRadius: ringRadius,
101
+ borderColor: solidColor,
102
+ borderWidth: width,
103
+ zIndex: gap > 0 ? Z_INDEX.base : Z_INDEX.raised
104
+ }
105
+ });
106
+ }
107
+ const {
108
+ default: Svg,
109
+ Defs,
110
+ LinearGradient,
111
+ Stop,
112
+ Circle,
113
+ Path
114
+ } = svg;
115
+ const stroke = wantsGradient ? `url(#${gradientId})` : solidColor;
116
+ const coords = gradientCoords(gradientDirection);
117
+ const gradientDefs = wantsGradient ? /*#__PURE__*/_jsx(Defs, {
118
+ children: /*#__PURE__*/_jsx(LinearGradient, {
119
+ id: gradientId,
120
+ x1: coords.x1,
121
+ y1: coords.y1,
122
+ x2: coords.x2,
123
+ y2: coords.y2,
124
+ children: colorList.map((color, index) => /*#__PURE__*/_jsx(Stop, {
125
+ offset: colorList.length === 1 ? 0 : index / (colorList.length - 1),
126
+ stopColor: color
127
+ }, `${gradientId}-${index}`))
128
+ })
129
+ }) : null;
130
+
131
+ // The overlay fills its parent; the SVG within is sized to the ring box so a
132
+ // `gap === 0` ring overlays the avatar edge exactly and a `gap > 0` ring sits
133
+ // on the reserved outer perimeter.
134
+ const overlayStyle = [StyleSheet.absoluteFill, {
135
+ zIndex: gap > 0 ? Z_INDEX.base : Z_INDEX.raised
136
+ }];
137
+ if (shape === 'squircle') {
138
+ // The path lives in 0–1 space, so the stroke width is expressed in the same
139
+ // units; center-stroking it and letting the viewport clip the outer half
140
+ // yields a ~`width`-px band on the inner edge of the outer box.
141
+ return /*#__PURE__*/_jsx(View, {
142
+ pointerEvents: "none",
143
+ style: overlayStyle,
144
+ children: /*#__PURE__*/_jsxs(Svg, {
145
+ width: outer,
146
+ height: outer,
147
+ viewBox: "0 0 1 1",
148
+ children: [gradientDefs, /*#__PURE__*/_jsx(Path, {
149
+ d: SQUIRCLE_PATH,
150
+ fill: "none",
151
+ stroke: stroke,
152
+ strokeWidth: width / outer * 2
153
+ })]
154
+ })
155
+ });
156
+ }
157
+ return /*#__PURE__*/_jsx(View, {
158
+ pointerEvents: "none",
159
+ style: overlayStyle,
160
+ children: /*#__PURE__*/_jsxs(Svg, {
161
+ width: outer,
162
+ height: outer,
163
+ viewBox: `0 0 ${outer} ${outer}`,
164
+ children: [gradientDefs, /*#__PURE__*/_jsx(Circle, {
165
+ cx: outer / 2,
166
+ cy: outer / 2,
167
+ r: (outer - width) / 2,
168
+ fill: "none",
169
+ stroke: stroke,
170
+ strokeWidth: width
171
+ })]
172
+ })
173
+ });
174
+ };
175
+ export const AvatarRing = /*#__PURE__*/memo(AvatarRingComponent);
176
+ AvatarRing.displayName = 'AvatarRing';
177
+ //# sourceMappingURL=AvatarRing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","useMemo","View","StyleSheet","Z_INDEX","getSvgModule","SQUIRCLE_PATH","jsx","_jsx","jsxs","_jsxs","ringGradientIdCounter","getRingOuterSize","size","width","gap","gradientCoords","direction","x1","y1","x2","y2","AvatarRingComponent","shape","colors","gradientDirection","gradientId","colorList","Array","isArray","wantsGradient","length","solidColor","outer","ringRadius","needsSvg","svg","pointerEvents","style","position","top","left","height","borderRadius","borderColor","borderWidth","zIndex","base","raised","default","Svg","Defs","LinearGradient","Stop","Circle","Path","stroke","coords","gradientDefs","children","id","map","color","index","offset","stopColor","overlayStyle","absoluteFill","viewBox","d","fill","strokeWidth","cx","cy","r","AvatarRing","displayName"],"sourceRoot":"../../../src","sources":["avatar/AvatarRing.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAC5C,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAE/C,SAASC,OAAO,QAAQ,sBAAmB;AAC3C,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,aAAa,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGhD;AACA;AACA;AACA,IAAIC,qBAAqB,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,IAAY,EAAEC,KAAa,EAAEC,GAAW,EAAU;EACjF,OAAOA,GAAG,GAAG,CAAC,GAAGF,IAAI,GAAG,CAAC,IAAIC,KAAK,GAAGC,GAAG,CAAC,GAAGF,IAAI;AAClD;AAiBA,SAASG,cAAcA,CAACC,SAAsC,EAAE;EAC9D,QAAQA,SAAS;IACf,KAAK,YAAY;MACf,OAAO;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE;MAAI,CAAC;IAC/C,KAAK,UAAU;MACb,OAAO;QAAEH,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE;MAAI,CAAC;IAC/C,KAAK,UAAU;IACf;MACE,OAAO;QAAEH,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE,GAAG;QAAEC,EAAE,EAAE;MAAI,CAAC;EACjD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAA8C,GAAGA,CAAC;EACtDT,IAAI;EACJU,K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AY,eACblD,IAAA,CAAC+C,IAAI;UAACc,CAAC,EAAE/D,aAAc;UAACgE,IAAI,EAAC,MAAM;UAACd,MAAM,EAAEA,MAAO;UAACe,WAAW,EAAGzD,KAAK,GAAGmB,KAAK,GAAI;QAAE,CAAE,CAAC;MAAA,CACrF;IAAC,CACF,CAAC;EAEX;EAEA,oBACEzB,IAAA,CAACN,IAAI;IAACmC,aAAa,EAAC,MAAM;IAACC,KAAK,EAAE4B,YAAa;IAAAP,QAAA,eAC7CjD,KAAA,CAACwC,GAAG;MAACpC,KAAK,EAAEmB,KAAM;MAACS,MAAM,EAAET,KAAM;MAACmC,OAAO,EAAE,OAAOnC,KAAK,IAAIA,KAAK,EAAG;MAAA0B,QAAA,GAChED,YAAY,eACblD,IAAA,CAAC8C,MAAM;QACLkB,EAAE,EAAEvC,KAAK,GAAG,CAAE;QACdwC,EAAE,EAAExC,KAAK,GAAG,CAAE;QACdyC,CAAC,EAAE,CAACzC,KAAK,GAAGnB,KAAK,IAAI,CAAE;QACvBwD,IAAI,EAAC,MAAM;QACXd,MAAM,EAAEA,MAAO;QACfe,WAAW,EAAEzD;MAAM,CACpB,CAAC;IAAA,CACC;EAAC,CACF,CAAC;AAEX,CAAC;AAED,OAAO,MAAM6D,UAAU,gBAAG3E,IAAI,CAACsB,mBAAmB,CAAC;AACnDqD,UAAU,CAACC,WAAW,GAAG,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Avatar","AvatarPlaceholderProvider","defaultAvatar","defaultAvatarSource"],"sourceRoot":"../../../src","sources":["avatar/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;AACjC,SAASC,yBAAyB,QAAQ,0BAAuB;AAIjE;AACA;AACA,OAAOC,aAAa,MAAM,qBAAkB;;AAE5C;AACA,OAAO,MAAMC,mBAAmB,GAAGD,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["Avatar","AvatarPlaceholderProvider","defaultAvatar","defaultAvatarSource"],"sourceRoot":"../../../src","sources":["avatar/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;AACjC,SAASC,yBAAyB,QAAQ,0BAAuB;AASjE;AACA;AACA,OAAOC,aAAa,MAAM,qBAAkB;;AAE5C;AACA,OAAO,MAAMC,mBAAmB,GAAGD,aAAa","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Squircle clip/outline path normalized to a 0–1 coordinate space
5
+ * (viewBox="0 0 1 1"). Shared by the squircle avatar image clip in `Avatar.tsx`
6
+ * and the squircle outline in `AvatarRing.tsx` so the geometry has a single
7
+ * source of truth.
8
+ */
9
+ export const SQUIRCLE_PATH = 'M0 0.5 L0.00122 0.31674 L0.00489 0.25123 L0.01103 0.20331 L0.01969 0.16478 L0.03097 0.13257 L0.04495 0.10518 L0.0618 0.08177 L0.08177 0.0618 L0.10518 0.04495 L0.13257 0.03097 L0.16478 0.01969 L0.20331 0.01103 L0.25123 0.00489 L0.31674 0.00122 L0.5 0' + ' L0.68895 0.0014 L0.7564 0.00561 L0.80559 0.01267 L0.84499 0.02264 L0.87771 0.03564 L0.9053 0.05181 L0.92862 0.07138 L0.94819 0.0947 L0.96436 0.12228 L0.97736 0.15501 L0.98733 0.19441 L0.99439 0.2436 L0.9986 0.31105 L1 0.5' + ' L0.9986 0.68895 L0.99439 0.7564 L0.98733 0.80559 L0.97736 0.84499 L0.96436 0.87771 L0.94819 0.9053 L0.92862 0.92862 L0.9053 0.94819 L0.87771 0.96436 L0.84499 0.97736 L0.80559 0.98733 L0.7564 0.99439 L0.68895 0.9986 L0.5 1' + ' L0.31105 0.9986 L0.2436 0.99439 L0.19441 0.98733 L0.15501 0.97736 L0.12228 0.96436 L0.0947 0.94819 L0.07138 0.92862 L0.05181 0.9053 L0.03564 0.87771 L0.02264 0.84499 L0.01267 0.80559 L0.00561 0.7564 L0.0014 0.68895 L0 0.5Z';
10
+ //# sourceMappingURL=squircle-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SQUIRCLE_PATH"],"sourceRoot":"../../../src","sources":["avatar/squircle-path.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GACxB,2PAA2P,GAC3P,gOAAgO,GAChO,gOAAgO,GAChO,iOAAiO","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { lazyRequire } from "../utils/lazy-require.js";
4
+ /**
5
+ * Lazily loads `react-native-svg`, returning `null` when it is not installed
6
+ * (e.g. a web bundle that does not ship the optional peer). Shared by the
7
+ * squircle avatar image clip in `Avatar.tsx` and the `AvatarRing` so there is a
8
+ * single loader rather than one per call site.
9
+ */
10
+ export const getSvgModule = lazyRequire('react-native-svg');
11
+ //# sourceMappingURL=svg-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["lazyRequire","getSvgModule"],"sourceRoot":"../../../src","sources":["avatar/svg-module.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,0BAAuB;AAInD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGD,WAAW,CAAgB,kBAAkB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA+a3C,eAAO,MAAM,MAAM,yCAAwB,CAAC"}
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AA4X7D,eAAO,MAAM,MAAM,yCAAwB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { AvatarRingGradientDirection, AvatarShape } from './types';
3
+ /**
4
+ * Size of the box the ring occupies. With `gap === 0` the ring overlays the
5
+ * avatar edge and the box equals the avatar size (footprint unchanged). With
6
+ * `gap > 0` the ring sits OUTSIDE the avatar, so the box grows and the avatar is
7
+ * centered inside it. Exported so `Avatar` reserves the same footprint with a
8
+ * single source for the geometry formula.
9
+ */
10
+ export declare function getRingOuterSize(size: number, width: number, gap: number): number;
11
+ interface AvatarRingProps {
12
+ /** Avatar diameter in px (the inner content size, before any gap). */
13
+ size: number;
14
+ /** Matches the avatar shape. */
15
+ shape: AvatarShape;
16
+ /** Solid ring: one color. Gradient ring: 2+ colors. */
17
+ colors: string | string[];
18
+ /** Ring stroke width in px. */
19
+ width: number;
20
+ /** Gap between the avatar edge and the ring (0 = overlay the edge). */
21
+ gap: number;
22
+ /** Gradient sweep direction for multi-color rings. */
23
+ gradientDirection: AvatarRingGradientDirection;
24
+ }
25
+ export declare const AvatarRing: React.NamedExoticComponent<AvatarRingProps>;
26
+ export {};
27
+ //# sourceMappingURL=AvatarRing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarRing.d.ts","sourceRoot":"","sources":["../../../../src/avatar/AvatarRing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAM7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOxE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,UAAU,eAAe;IACvB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,uDAAuD;IACvD,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,iBAAiB,EAAE,2BAA2B,CAAC;CAChD;AAmID,eAAO,MAAM,UAAU,6CAA4B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export { Avatar } from './Avatar';
2
2
  export { AvatarPlaceholderProvider } from './placeholder-context';
3
3
  export type { AvatarPlaceholderConfig } from './placeholder-context';
4
- export type { AvatarProps, AvatarShape } from './types';
4
+ export type { AvatarProps, AvatarShape, AvatarRingConfig, AvatarRingGradientDirection, } from './types';
5
5
  /** Default avatar placeholder image — use as `fallbackSource` on Avatar or in AvatarPlaceholderProvider */
6
6
  export declare const defaultAvatarSource: {
7
7
  uri: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/avatar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMxD,2GAA2G;AAC3G,eAAO,MAAM,mBAAmB;;CAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/avatar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AAMjB,2GAA2G;AAC3G,eAAO,MAAM,mBAAmB;;CAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Squircle clip/outline path normalized to a 0–1 coordinate space
3
+ * (viewBox="0 0 1 1"). Shared by the squircle avatar image clip in `Avatar.tsx`
4
+ * and the squircle outline in `AvatarRing.tsx` so the geometry has a single
5
+ * source of truth.
6
+ */
7
+ export declare const SQUIRCLE_PATH: string;
8
+ //# sourceMappingURL=squircle-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"squircle-path.d.ts","sourceRoot":"","sources":["../../../../src/avatar/squircle-path.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAIyM,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Lazily loads `react-native-svg`, returning `null` when it is not installed
3
+ * (e.g. a web bundle that does not ship the optional peer). Shared by the
4
+ * squircle avatar image clip in `Avatar.tsx` and the `AvatarRing` so there is a
5
+ * single loader rather than one per call site.
6
+ */
7
+ export declare const getSvgModule: () => typeof import("react-native-svg") | null;
8
+ //# sourceMappingURL=svg-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-module.d.ts","sourceRoot":"","sources":["../../../../src/avatar/svg-module.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,gDAAiD,CAAC"}