@oxyhq/bloom 1.12.0 → 1.14.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 (114) hide show
  1. package/README.md +1 -1
  2. package/docs/avatar.mdx +46 -5
  3. package/docs/index.mdx +1 -1
  4. package/docs/layout.mdx +21 -35
  5. package/docs/tab-bar.mdx +35 -0
  6. package/lib/commonjs/avatar/Avatar.js +24 -8
  7. package/lib/commonjs/avatar/Avatar.js.map +1 -1
  8. package/lib/commonjs/avatar/AvatarRing.js +13 -12
  9. package/lib/commonjs/avatar/AvatarRing.js.map +1 -1
  10. package/lib/commonjs/avatar/index.js +19 -0
  11. package/lib/commonjs/avatar/index.js.map +1 -1
  12. package/lib/commonjs/avatar/resolve-shape.js +43 -0
  13. package/lib/commonjs/avatar/resolve-shape.js.map +1 -0
  14. package/lib/commonjs/avatar/shape-paths.js +174 -0
  15. package/lib/commonjs/avatar/shape-paths.js.map +1 -0
  16. package/lib/commonjs/fab/Fab.js +4 -55
  17. package/lib/commonjs/fab/Fab.js.map +1 -1
  18. package/lib/commonjs/fab/Fab.web.js +1 -29
  19. package/lib/commonjs/fab/Fab.web.js.map +1 -1
  20. package/lib/commonjs/layout/bottom-edge.js +47 -92
  21. package/lib/commonjs/layout/bottom-edge.js.map +1 -1
  22. package/lib/commonjs/layout/index.js +0 -6
  23. package/lib/commonjs/layout/index.js.map +1 -1
  24. package/lib/commonjs/tab-bar/TabBarBase.js +59 -29
  25. package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -1
  26. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js +5 -0
  27. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js.map +1 -1
  28. package/lib/module/avatar/Avatar.js +24 -8
  29. package/lib/module/avatar/Avatar.js.map +1 -1
  30. package/lib/module/avatar/AvatarRing.js +13 -12
  31. package/lib/module/avatar/AvatarRing.js.map +1 -1
  32. package/lib/module/avatar/index.js +1 -0
  33. package/lib/module/avatar/index.js.map +1 -1
  34. package/lib/module/avatar/resolve-shape.js +40 -0
  35. package/lib/module/avatar/resolve-shape.js.map +1 -0
  36. package/lib/module/avatar/shape-paths.js +170 -0
  37. package/lib/module/avatar/shape-paths.js.map +1 -0
  38. package/lib/module/fab/Fab.js +6 -57
  39. package/lib/module/fab/Fab.js.map +1 -1
  40. package/lib/module/fab/Fab.web.js +2 -30
  41. package/lib/module/fab/Fab.web.js.map +1 -1
  42. package/lib/module/layout/bottom-edge.js +47 -91
  43. package/lib/module/layout/bottom-edge.js.map +1 -1
  44. package/lib/module/layout/index.js +1 -1
  45. package/lib/module/layout/index.js.map +1 -1
  46. package/lib/module/tab-bar/TabBarBase.js +60 -30
  47. package/lib/module/tab-bar/TabBarBase.js.map +1 -1
  48. package/lib/module/tab-bar/expo-router/RouterTabBar.js +5 -0
  49. package/lib/module/tab-bar/expo-router/RouterTabBar.js.map +1 -1
  50. package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/avatar/AvatarRing.d.ts +4 -3
  52. package/lib/typescript/commonjs/avatar/AvatarRing.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/avatar/index.d.ts +3 -1
  54. package/lib/typescript/commonjs/avatar/index.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/avatar/resolve-shape.d.ts +17 -0
  56. package/lib/typescript/commonjs/avatar/resolve-shape.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/avatar/shape-paths.d.ts +27 -0
  58. package/lib/typescript/commonjs/avatar/shape-paths.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/avatar/types.d.ts +30 -3
  60. package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/fab/Fab.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/fab/Fab.web.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/layout/bottom-edge.d.ts +31 -57
  64. package/lib/typescript/commonjs/layout/bottom-edge.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/layout/index.d.ts +1 -1
  66. package/lib/typescript/commonjs/layout/index.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts +5 -0
  69. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/tab-bar/types.d.ts +36 -5
  71. package/lib/typescript/commonjs/tab-bar/types.d.ts.map +1 -1
  72. package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
  73. package/lib/typescript/module/avatar/AvatarRing.d.ts +4 -3
  74. package/lib/typescript/module/avatar/AvatarRing.d.ts.map +1 -1
  75. package/lib/typescript/module/avatar/index.d.ts +3 -1
  76. package/lib/typescript/module/avatar/index.d.ts.map +1 -1
  77. package/lib/typescript/module/avatar/resolve-shape.d.ts +17 -0
  78. package/lib/typescript/module/avatar/resolve-shape.d.ts.map +1 -0
  79. package/lib/typescript/module/avatar/shape-paths.d.ts +27 -0
  80. package/lib/typescript/module/avatar/shape-paths.d.ts.map +1 -0
  81. package/lib/typescript/module/avatar/types.d.ts +30 -3
  82. package/lib/typescript/module/avatar/types.d.ts.map +1 -1
  83. package/lib/typescript/module/fab/Fab.d.ts.map +1 -1
  84. package/lib/typescript/module/fab/Fab.web.d.ts.map +1 -1
  85. package/lib/typescript/module/layout/bottom-edge.d.ts +31 -57
  86. package/lib/typescript/module/layout/bottom-edge.d.ts.map +1 -1
  87. package/lib/typescript/module/layout/index.d.ts +1 -1
  88. package/lib/typescript/module/layout/index.d.ts.map +1 -1
  89. package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -1
  90. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts +5 -0
  91. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -1
  92. package/lib/typescript/module/tab-bar/types.d.ts +36 -5
  93. package/lib/typescript/module/tab-bar/types.d.ts.map +1 -1
  94. package/package.json +1 -1
  95. package/src/avatar/Avatar.tsx +27 -10
  96. package/src/avatar/AvatarRing.tsx +21 -14
  97. package/src/avatar/index.ts +7 -0
  98. package/src/avatar/resolve-shape.ts +33 -0
  99. package/src/avatar/shape-paths.ts +150 -0
  100. package/src/avatar/types.ts +32 -3
  101. package/src/fab/Fab.tsx +4 -57
  102. package/src/fab/Fab.web.tsx +2 -31
  103. package/src/layout/bottom-edge.tsx +54 -108
  104. package/src/layout/index.ts +1 -6
  105. package/src/tab-bar/TabBarBase.tsx +74 -37
  106. package/src/tab-bar/expo-router/RouterTabBar.tsx +5 -0
  107. package/src/tab-bar/types.ts +36 -5
  108. package/src/__tests__/support/collision-fixture-barrel.ts +0 -20
  109. package/src/__tests__/support/constructed-style-sheets.ts +0 -68
  110. package/src/__tests__/support/press-host.ts +0 -30
  111. package/src/__tests__/support/rendered-style.ts +0 -99
  112. package/src/__tests__/support/unread-hook-fixture.ts +0 -33
  113. package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +0 -7682
  114. package/src/theme/__tests__/fixtures/color-engine-golden.json +0 -1
@@ -27,32 +27,27 @@
27
27
  * edge, so two surfaces at that edge overlap rather than stack; the tallest is
28
28
  * what a new surface has to clear. Summing would strand it at twice the height.
29
29
  *
30
- * ## A size and a state, because they travel differently
31
- *
32
- * A surface that collapses — the tab bar minimizes 58 -> 44 on scroll publishes
33
- * two things, and only one of them is a measurement:
34
- *
35
- * - RESERVED (`useBottomEdgeInset`) never shrinks while the claimant is
36
- * mounted. It is what must be kept permanently free: a list's bottom
37
- * padding, a toast stack's offset. Shrinking it on collapse would jitter a
38
- * list's content size on every scroll and jump a toast 14px mid-display,
39
- * because the bar re-expands the instant the user scrolls back up.
40
- * - COLLAPSED (`useBottomEdgeCollapsed`) is a boolean, deliberately, and this
41
- * is the part that was learned the hard way. It first shipped as a live
42
- * PIXEL height so a FAB could ride down with the bar — and it felt broken on
43
- * a device. The bar animates on the UI thread; a React consumer learns about
44
- * the change through `runOnJS` plus two render passes, so its motion STARTS
45
- * one to three frames late, worst exactly while scrolling because that is
46
- * when the JS thread is busiest. No spring config fixes a variable start
47
- * delay.
48
- *
49
- * Two things moving together betray that lag; a state change does not. A reader
50
- * that FADES on this boolean has no spatial relationship to violate, so the same
51
- * few frames of latency are imperceptible. That is why the channel is a state and
52
- * not a geometry: it is the shape of signal that survives the trip to the JS
53
- * thread. Anything that genuinely must track the collapse per-frame has to read
54
- * the tab bar's own shared value on the UI thread instead — React state is the
55
- * wrong transport for it, at any width.
30
+ * ## What does NOT belong here: the collapse
31
+ *
32
+ * The tab bar minimizes 58 -> 44 on scroll, and this registry twice tried to
33
+ * publish that so a FAB could react first as a live pixel height (1.11.0), then
34
+ * as a boolean (1.12.0). Both felt wrong on a device, for the same reason, and
35
+ * the reason is structural rather than a matter of tuning:
36
+ *
37
+ * the bar animates on the UI thread, while anything reading it from here
38
+ * arrives via `runOnJS` plus two React render passes.
39
+ *
40
+ * So a consumer's reaction STARTS one to three frames after the bar's, and the
41
+ * delay is variable worst exactly while scrolling, because that is when the JS
42
+ * thread is busiest. Fading instead of moving does not hide it either: the eye
43
+ * still sees two pieces of chrome change at different moments.
44
+ *
45
+ * A collapse is MOTION, and motion that must stay in lock-step with a
46
+ * reanimated animation has to travel as a shared value on the UI thread. React
47
+ * state is the wrong transport at any width, so it is not offered here at all.
48
+ * The app owns that signal — Mention drives its header, its bar and its FAB from
49
+ * one `SharedValue` through `useAnimatedStyle` and this registry stays what it
50
+ * is good at: GEOMETRY. Where things are, not when they move.
56
51
  *
57
52
  * ## Why an external store
58
53
  *
@@ -74,15 +69,13 @@ export declare namespace BottomEdgeProvider {
74
69
  var displayName: string;
75
70
  }
76
71
  /**
77
- * How much of the bottom edge is permanently RESERVED, in px.
72
+ * How much of the bottom edge is already occupied, in px.
78
73
  *
79
- * Never shrinks while its claimant is mounted, so it is the number for anything
80
- * that must not move as the user scrolls — a list's bottom padding, a toast
81
- * stack's offset:
74
+ * Add it to whatever offset the surface would otherwise use:
82
75
  *
83
76
  * ```tsx
84
- * const reserved = useBottomEdgeInset();
85
- * <FlatList contentContainerStyle={{ paddingBottom: reserved + 12 }} />
77
+ * const occupied = useBottomEdgeInset();
78
+ * <View style={{ position: 'absolute', bottom: windowEdgeGap(insets.bottom) + occupied }} />
86
79
  * ```
87
80
  *
88
81
  * `0` outside a provider, and `0` on the first commit even inside one — a claim
@@ -92,34 +85,15 @@ export declare namespace BottomEdgeProvider {
92
85
  */
93
86
  export declare function useBottomEdgeInset(): number;
94
87
  /**
95
- * Whether the surface owning the bottom edge is currently COLLAPSED the tab
96
- * bar minimized on scroll.
97
- *
98
- * A boolean rather than a live height, on purpose: see the note at the top of
99
- * this file. A reader should FADE or otherwise change state on it, never try to
100
- * stay geometrically locked to the collapsing surface — that lock is what a
101
- * React-state channel cannot deliver, because the surface animates on the UI
102
- * thread and this arrives one to three frames later.
103
- *
104
- * ```tsx
105
- * const collapsed = useBottomEdgeCollapsed();
106
- * // fade out; do not chase the bar's new top edge
107
- * ```
108
- *
109
- * `false` outside a provider.
110
- */
111
- export declare function useBottomEdgeCollapsed(): boolean;
112
- /**
113
- * Claim the bottom edge for as long as the caller is mounted.
88
+ * Claim `height` px of the bottom edge for as long as the caller is mounted.
114
89
  *
115
90
  * The claimant owns its own placement — claiming does not move it. It declares
116
- * the space it occupies so that everything reading the edge stays off it. Pass
117
- * the FULL footprint (the surface's height plus the gap it holds off the window
118
- * edge), which is the same number the surface positions itself with, and keep it
119
- * at the surface's FULL size even while collapsed: `reserved` is what must stay
120
- * permanently free, and the collapse is reported separately by `collapsed`.
91
+ * the space it occupies so that everything reading `useBottomEdgeInset()` stays
92
+ * off it. Pass the FULL footprint (the surface's height plus the gap it holds
93
+ * off the window edge), which is the same number the surface positions itself
94
+ * with.
121
95
  *
122
96
  * A no-op outside a provider, so a surface stays usable standalone.
123
97
  */
124
- export declare function useClaimBottomEdge(reserved: number, collapsed?: boolean): void;
98
+ export declare function useClaimBottomEdge(height: number): void;
125
99
  //# sourceMappingURL=bottom-edge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-edge.d.ts","sourceRoot":"","sources":["../../../../src/layout/bottom-edge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAyEf;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAGjE;yBAHe,kBAAkB;;;AAalC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAOhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,IAAI,CAS5E"}
1
+ {"version":3,"file":"bottom-edge.d.ts","sourceRoot":"","sources":["../../../../src/layout/bottom-edge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAsDf;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAGjE;yBAHe,kBAAkB;;;AAYlC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASvD"}
@@ -5,5 +5,5 @@
5
5
  * parked there". A surface that floats at the bottom needs both.
6
6
  */
7
7
  export { EDGE_GAP, windowEdgeGap } from './edge';
8
- export { BottomEdgeProvider, useBottomEdgeInset, useBottomEdgeCollapsed, useClaimBottomEdge, } from './bottom-edge';
8
+ export { BottomEdgeProvider, useBottomEdgeInset, useClaimBottomEdge } from './bottom-edge';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabBarBase.d.ts","sourceRoot":"","sources":["../../../../src/tab-bar/TabBarBase.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAoBf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAiBL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAe,MAAM,SAAS,CAAC;AA2kB3E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAC1C,IAAI,EAAE,aAAa,CAAC,oBAAoB,CAAC;YAElB,WAAW;;EAGnC;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC;YAC1C,iBAAiB;;EAG/C"}
1
+ {"version":3,"file":"TabBarBase.d.ts","sourceRoot":"","sources":["../../../../src/tab-bar/TabBarBase.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAoBf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAiBL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAe,MAAM,SAAS,CAAC;AAinB3E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAC1C,IAAI,EAAE,aAAa,CAAC,oBAAoB,CAAC;YAElB,WAAW;;EAGnC;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC;YAC1C,iBAAiB;;EAG/C"}
@@ -16,6 +16,11 @@ import type { TabBarItem, TabBarProps } from '../types';
16
16
  * by each trigger's own focus (see `RouterTabBarButton`), which is what keeps it
17
17
  * correct through deep links, back gestures and any other programmatic
18
18
  * navigation. Setting both would put two writers on one shared value.
19
+ *
20
+ * `activeProgress` is NOT omitted, and that is not an oversight. It answers a
21
+ * different question — where the highlight is, not whether there is one — so a
22
+ * router-focused bar whose screens are PAGED can pass it and keep the focus
23
+ * path for selection. See `TabBarProps.activeProgress`.
19
24
  */
20
25
  export type RouterTabBarProps = TabListProps & Omit<TabBarProps, 'activeIndex'>;
21
26
  export type RouterTabBarButtonProps = TabTriggerSlotProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"RouterTabBar.d.ts","sourceRoot":"","sources":["../../../../../src/tab-bar/expo-router/RouterTabBar.tsx"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;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,EAI3B,OAAO,EAAE,QAAQ,EACjB,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAEnB;yBARe,YAAY;;;AAY5B;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,KAAK,EAIL,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAEzB;yBAVe,kBAAkB"}
@@ -4,14 +4,21 @@
4
4
  *
5
5
  * Public API types for `@oxyhq/bloom/tab-bar`.
6
6
  *
7
- * This module imports from `react` and `react-native` ONLY. It is resolved by a
8
- * consumer's `tsc`, by Metro, and by every web bundler alike, so a platform
9
- * import here (expo-glass-effect / expo-symbols / expo-router) would break all
10
- * three at once. Platform behaviour lives in `surface.native.tsx` /
11
- * `glyph.native.tsx` / `surface.web.tsx` and the `expo-router/` adapter.
7
+ * This module names no PLATFORM package. It is resolved by a consumer's `tsc`,
8
+ * by Metro, and by every web bundler alike, so an import here of
9
+ * expo-glass-effect / expo-symbols / expo-router / react-native-screens would
10
+ * break all three at once. Platform behaviour lives in `surface.native.tsx` /
11
+ * `glyph.native.tsx` / `surface.web.tsx` and the `expo-router/` adapter; the
12
+ * gate is `src/__tests__/TabBarWebFork.test.ts`.
13
+ *
14
+ * `react-native-reanimated` is exempt and always was: it is a REQUIRED peer that
15
+ * every neutral module in this family already imports at runtime
16
+ * (`TabBarBase.tsx`), and the one reference below is `import type`, erased
17
+ * before any bundler sees it.
12
18
  */
13
19
  import type { ReactNode } from 'react';
14
20
  import type { PressableProps, ViewProps } from 'react-native';
21
+ import type { SharedValue } from 'react-native-reanimated';
15
22
  export type TabBarItem = {
16
23
  /** Stable identity for the tab (a route name in router-driven usage). */
17
24
  name: string;
@@ -89,6 +96,30 @@ export type TabBarProps = ViewProps & {
89
96
  * highlight from its own `isFocused`.
90
97
  */
91
98
  activeIndex?: number;
99
+ /**
100
+ * DRIVEN path — the highlight's live position, in TAB UNITS, on the UI thread.
101
+ * A pager writes its own page position here (`1.4` is 40% of the way from the
102
+ * second tab to the third) and the highlight tracks the finger 1:1 instead of
103
+ * springing to a settled index after the navigation commits.
104
+ *
105
+ * It says WHERE the highlight is, never WHETHER there is one. Selection stays
106
+ * with the path already in play: `activeIndex` when the bar is controlled (an
107
+ * index naming no tab still fades the highlight out — see above), each
108
+ * button's `isFocused` when it is not. Passing this alone, with neither, is a
109
+ * bar that is always selected, which is what the focus-driven path already
110
+ * means.
111
+ *
112
+ * PRECEDENCE, because a shared value with two writers is a race: the SCRUB
113
+ * always wins — a finger on the bar is a direct manipulation of the bar, and
114
+ * releasing it reports through `onIndexChange` like any other selection. Below
115
+ * that, this value wins over every discrete writer: while it is supplied, the
116
+ * controlled effect, the focus effect and a `TabBarButton`'s own press all
117
+ * stop writing the position and leave it to the driver. So a consumer that
118
+ * passes this must keep it truthful — spring it to the settled index after a
119
+ * commit, and after any navigation it did not cause (a deep link, a back
120
+ * gesture), or the highlight stays where the last gesture left it.
121
+ */
122
+ activeProgress?: SharedValue<number>;
92
123
  /**
93
124
  * Called with the chosen index when a tab is picked by tap, by scrub release,
94
125
  * or by keyboard/assistive-technology activation of a `TabBarButton`.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/tab-bar/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG;IACvB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;OAUG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;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;IAClB;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG;IAC/C,IAAI,EAAE,UAAU,CAAC;IACjB,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/bloom",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "packageManager": "bun@1.3.14",
5
5
  "description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
6
6
  "main": "lib/commonjs/index.js",
@@ -10,8 +10,8 @@ import { Z_INDEX } from '../styles/z-index';
10
10
  import { useAvatarPlaceholder } from './context';
11
11
  import { LiveBadge } from './LiveBadge';
12
12
  import { AvatarRing, getRingOuterSize } from './AvatarRing';
13
- import { SQUIRCLE_PATH } from './squircle-path';
14
- import type { AvatarProps, AvatarRingConfig } from './types';
13
+ import { resolveAvatarShape } from './resolve-shape';
14
+ import type { AvatarProps, AvatarRingConfig, AvatarShapePath } from './types';
15
15
 
16
16
  // Google Contacts-inspired palette used to pick a deterministic background
17
17
  // color for name-based placeholder avatars.
@@ -45,10 +45,19 @@ import DEFAULT_AVATAR_IMAGE from './default-avatar';
45
45
 
46
46
  let clipIdCounter = 0;
47
47
 
48
- function SquircleImage({
48
+ /**
49
+ * Renders the avatar image clipped to an arbitrary outline.
50
+ *
51
+ * The path and the SVG viewport share one coordinate space, so a 0–1 squircle
52
+ * and a 0–100 named shape both work without rewriting their numbers: the
53
+ * viewport is declared at the path's own scale and the whole thing is drawn at
54
+ * `size` pixels.
55
+ */
56
+ function ClippedImage({
49
57
  uri,
50
58
  fallbackSource,
51
59
  size,
60
+ shape,
52
61
  fallbackColor,
53
62
  placeholderIcon,
54
63
  name,
@@ -57,6 +66,7 @@ function SquircleImage({
57
66
  uri?: string;
58
67
  fallbackSource?: AvatarProps['fallbackSource'];
59
68
  size: number;
69
+ shape: AvatarShapePath;
60
70
  fallbackColor: string;
61
71
  placeholderIcon?: React.ReactNode;
62
72
  name?: string;
@@ -71,6 +81,8 @@ function SquircleImage({
71
81
  );
72
82
  }
73
83
 
84
+ const span = shape.viewBox ?? 1;
85
+
74
86
  return (
75
87
  <>
76
88
  {/* Hidden RN Image for error detection on remote URIs */}
@@ -81,16 +93,16 @@ function SquircleImage({
81
93
  onError={onError}
82
94
  />
83
95
  )}
84
- <Svg width={size} height={size} viewBox="0 0 1 1">
96
+ <Svg width={size} height={size} viewBox={`0 0 ${span} ${span}`}>
85
97
  <Defs>
86
98
  <ClipPath id={clipId}>
87
- <Path d={SQUIRCLE_PATH} />
99
+ <Path d={shape.d} />
88
100
  </ClipPath>
89
101
  </Defs>
90
102
  <SvgImage
91
103
  href={href}
92
- width={1}
93
- height={1}
104
+ width={span}
105
+ height={span}
94
106
  preserveAspectRatio="xMidYMid slice"
95
107
  clipPath={`url(#${clipId})`}
96
108
  />
@@ -183,6 +195,10 @@ const AvatarComponent: React.FC<AvatarProps> = ({
183
195
  const theme = useTheme();
184
196
  const placeholderConfig = useAvatarPlaceholder();
185
197
  const radius = size / 2;
198
+ // `null` means "a circle", which is drawn with borderRadius and never reaches
199
+ // the SVG renderer. Memoised so an inline `shape={{ d: … }}` object literal
200
+ // does not produce a new clip descriptor on every render.
201
+ const clipShape = useMemo(() => resolveAvatarShape(shape), [shape]);
186
202
  const hasName = typeof name === 'string' && name.trim().length > 0;
187
203
  // Priority: explicit placeholderColor > deterministic color from name > theme default.
188
204
  const fallbackColor =
@@ -265,7 +281,7 @@ const AvatarComponent: React.FC<AvatarProps> = ({
265
281
  const ringElement = resolvedRing ? (
266
282
  <AvatarRing
267
283
  size={size}
268
- shape={shape}
284
+ shape={clipShape}
269
285
  colors={resolvedRing.colors}
270
286
  width={ringWidth}
271
287
  gap={ringGap}
@@ -278,11 +294,12 @@ const AvatarComponent: React.FC<AvatarProps> = ({
278
294
  // fills the container exactly.
279
295
  const avatarBox = (
280
296
  <View style={[styles.avatarBox, { width: size, height: size }]}>
281
- {shape === 'squircle' ? (
282
- <SquircleImage
297
+ {clipShape ? (
298
+ <ClippedImage
283
299
  uri={effectiveUri}
284
300
  fallbackSource={fallbackSource}
285
301
  size={size}
302
+ shape={clipShape}
286
303
  fallbackColor={fallbackColor}
287
304
  placeholderIcon={resolvedPlaceholderIcon}
288
305
  name={name}
@@ -3,8 +3,8 @@ import { View, StyleSheet } from 'react-native';
3
3
  import Svg, { Circle, Defs, LinearGradient, Path, Stop } from 'react-native-svg';
4
4
 
5
5
  import { Z_INDEX } from '../styles/z-index';
6
- import { SQUIRCLE_PATH } from './squircle-path';
7
- import type { AvatarRingGradientDirection, AvatarShape } from './types';
6
+ import type { ResolvedAvatarShape } from './resolve-shape';
7
+ import type { AvatarRingGradientDirection } from './types';
8
8
 
9
9
  // Module counter for unique gradient element ids — mirrors the `clipIdCounter`
10
10
  // pattern in `Avatar.tsx`. Deterministic (no `Math.random()`) so ids are stable
@@ -25,8 +25,8 @@ export function getRingOuterSize(size: number, width: number, gap: number): numb
25
25
  interface AvatarRingProps {
26
26
  /** Avatar diameter in px (the inner content size, before any gap). */
27
27
  size: number;
28
- /** Matches the avatar shape. */
29
- shape: AvatarShape;
28
+ /** The avatar's resolved outline, or `null` for a circle. */
29
+ shape: ResolvedAvatarShape;
30
30
  /** Solid ring: one color. Gradient ring: 2+ colors. */
31
31
  colors: string | string[];
32
32
  /** Ring stroke width in px. */
@@ -79,10 +79,10 @@ const AvatarRingComponent: React.FC<AvatarRingProps> = ({
79
79
  // box; drawn as a plain border it is a full circle → radius `outer / 2`.
80
80
  const ringRadius = outer / 2;
81
81
 
82
- // SVG is only needed for gradients (both shapes) and for the squircle
83
- // outline. A solid circle ring is a plain bordered View — cheaper, and it
84
- // keeps the common case off the SVG renderer entirely.
85
- const needsSvg = wantsGradient || shape === 'squircle';
82
+ // SVG is only needed for gradients and for non-circular outlines. A solid
83
+ // circle ring is a plain bordered View — cheaper, and it keeps the common
84
+ // case off the SVG renderer entirely.
85
+ const needsSvg = wantsGradient || shape !== null;
86
86
 
87
87
  if (!needsSvg) {
88
88
  return (
@@ -127,15 +127,22 @@ const AvatarRingComponent: React.FC<AvatarRingProps> = ({
127
127
  { zIndex: gap > 0 ? Z_INDEX.base : Z_INDEX.raised },
128
128
  ];
129
129
 
130
- if (shape === 'squircle') {
131
- // The path lives in 0–1 space, so the stroke width is expressed in the same
132
- // units; center-stroking it and letting the viewport clip the outer half
133
- // yields a ~`width`-px band on the inner edge of the outer box.
130
+ if (shape !== null) {
131
+ // The path lives in its own square space, so the stroke width has to be
132
+ // expressed in those units too: one unit is `outer / span` px. Center-
133
+ // stroking and letting the viewport clip the outer half yields a
134
+ // ~`width`-px band on the inner edge of the outer box, hence the doubling.
135
+ const span = shape.viewBox ?? 1;
134
136
  return (
135
137
  <View pointerEvents="none" style={overlayStyle}>
136
- <Svg width={outer} height={outer} viewBox="0 0 1 1">
138
+ <Svg width={outer} height={outer} viewBox={`0 0 ${span} ${span}`}>
137
139
  {gradientDefs}
138
- <Path d={SQUIRCLE_PATH} fill="none" stroke={stroke} strokeWidth={(width / outer) * 2} />
140
+ <Path
141
+ d={shape.d}
142
+ fill="none"
143
+ stroke={stroke}
144
+ strokeWidth={(width / outer) * 2 * span}
145
+ />
139
146
  </Svg>
140
147
  </View>
141
148
  );
@@ -4,7 +4,14 @@ export type { AvatarPlaceholderConfig } from './context';
4
4
  export type {
5
5
  AvatarProps,
6
6
  AvatarShape,
7
+ AvatarShapePath,
7
8
  AvatarRingConfig,
8
9
  AvatarRingGradientDirection,
9
10
  } from './types';
10
11
  export { defaultAvatarSource } from './default-avatar';
12
+ export {
13
+ AVATAR_SHAPE_PATHS,
14
+ AVATAR_SHAPE_LABELS,
15
+ NAMED_SHAPE_VIEW_BOX,
16
+ } from './shape-paths';
17
+ export type { AvatarShapeName } from './shape-paths';
@@ -0,0 +1,33 @@
1
+ import { SQUIRCLE_PATH } from './squircle-path';
2
+ import { AVATAR_SHAPE_PATHS, NAMED_SHAPE_VIEW_BOX } from './shape-paths';
3
+ import type { AvatarShape, AvatarShapePath } from './types';
4
+
5
+ /**
6
+ * A shape reduced to what the renderers need: either nothing (a circle, drawn
7
+ * with `borderRadius` and no SVG at all) or one outline plus the size of the
8
+ * square space it is drawn in.
9
+ */
10
+ export type ResolvedAvatarShape = AvatarShapePath | null;
11
+
12
+ /**
13
+ * Turns the public `shape` prop into an outline.
14
+ *
15
+ * Returns `null` for a circle so callers can keep the cheap `borderRadius`
16
+ * path — the common case never touches `react-native-svg`. An unknown string
17
+ * also returns `null`: a shape name that does not resolve should degrade to a
18
+ * plain circular avatar, never to a blank hole where a face should be.
19
+ */
20
+ export function resolveAvatarShape(shape: AvatarShape | AvatarShapePath | undefined): ResolvedAvatarShape {
21
+ if (!shape || shape === 'circle') return null;
22
+
23
+ if (typeof shape !== 'string') {
24
+ return { d: shape.d, viewBox: shape.viewBox ?? 1 };
25
+ }
26
+
27
+ if (shape === 'squircle') {
28
+ return { d: SQUIRCLE_PATH, viewBox: 1 };
29
+ }
30
+
31
+ const named = AVATAR_SHAPE_PATHS[shape];
32
+ return named ? { d: named, viewBox: NAMED_SHAPE_VIEW_BOX } : null;
33
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Named avatar outlines.
3
+ *
4
+ * Each entry is an SVG path drawn in a 100×100 square coordinate space, scaled
5
+ * at render time to the avatar's pixel size. That space is declared once in
6
+ * {@link NAMED_SHAPE_VIEW_BOX} rather than baked into the numbers, so the paths
7
+ * can be read and edited at human-friendly magnitudes. The built-in squircle
8
+ * lives in `squircle-path.ts` and uses a 0–1 space; both are supported because
9
+ * {@link AvatarShapePath} carries its own `viewBox`.
10
+ *
11
+ * `circle` is deliberately absent: a circular avatar is rendered with
12
+ * `borderRadius` and never reaches the SVG renderer.
13
+ */
14
+
15
+ /** Side length of the coordinate space every path below is drawn in. */
16
+ export const NAMED_SHAPE_VIEW_BOX = 100;
17
+
18
+ export type AvatarShapeName =
19
+ | 'square' | 'slanted' | 'arch' | 'semicircle'
20
+ | 'oval' | 'pill' | 'triangle' | 'arrow' | 'fan'
21
+ | 'diamond' | 'clamshell' | 'pentagon' | 'gem' | 'very-sunny'
22
+ | 'sunny' | '4-sided-cookie' | '6-sided-cookie' | '7-sided-cookie'
23
+ | '9-sided-cookie' | '12-sided-cookie' | '4-leaf-clover'
24
+ | '8-leaf-clover' | 'burst' | 'soft-burst' | 'boom' | 'soft-boom'
25
+ | 'flower' | 'puffy' | 'puffy-diamond' | 'ghost-ish'
26
+ | 'pixel-circle' | 'pixel-triangle' | 'bun' | 'heart';
27
+
28
+ export const AVATAR_SHAPE_PATHS: Record<AvatarShapeName, string> = {
29
+ // --- Basic ---
30
+ square:
31
+ 'M12 0H88Q100 0 100 12V88Q100 100 88 100H12Q0 100 0 88V12Q0 0 12 0Z',
32
+ slanted:
33
+ 'M22 0H88Q100 0 100 12V78Q100 100 78 100H12Q0 100 0 88V22Q0 0 22 0Z',
34
+ arch:
35
+ 'M50 0Q100 0 100 50V88Q100 100 88 100H12Q0 100 0 88V50Q0 0 50 0Z',
36
+ semicircle:
37
+ 'M0 50A50 50 0 0 1 100 50V88Q100 100 88 100H12Q0 100 0 88Z',
38
+
39
+ // --- Organic ---
40
+ oval:
41
+ 'M50 2C78 2 96 22 96 50S78 98 50 98S4 78 4 50S22 2 50 2Z',
42
+ pill:
43
+ 'M34 4H66Q96 4 96 34V66Q96 96 66 96H34Q4 96 4 66V34Q4 4 34 4Z',
44
+ triangle:
45
+ 'M50 5L95 90Q97 95 92 95H8Q3 95 5 90Z',
46
+ arrow:
47
+ 'M50 0L100 45Q100 52 94 52H68V92Q68 100 58 100H42Q32 100 32 92V52H6Q0 52 0 45Z',
48
+ fan:
49
+ 'M50 8Q90 8 96 48Q100 78 70 96Q50 108 30 96Q0 78 4 48Q10 8 50 8Z',
50
+
51
+ // --- Geometric ---
52
+ diamond:
53
+ 'M50 2L96 50L50 98L4 50Z',
54
+ clamshell:
55
+ 'M10 20Q10 4 26 4H74Q90 4 90 20V60Q90 96 50 96Q10 96 10 60Z',
56
+ pentagon:
57
+ 'M50 2L97 36L79 96H21L3 36Z',
58
+ gem:
59
+ 'M30 4H70L98 36L50 98L2 36Z',
60
+
61
+ // --- Sunny/Cookie ---
62
+ 'very-sunny':
63
+ 'M50 0L58 20L78 6L72 28L96 22L82 42L100 50L82 58L96 78L72 72L78 94L58 80L50 100L42 80L22 94L28 72L4 78L18 58L0 50L18 42L4 22L28 28L22 6L42 20Z',
64
+ sunny:
65
+ 'M50 4L60 24L80 10L74 32L98 28L84 48L100 50L84 52L98 72L74 68L80 90L60 76L50 96L40 76L20 90L26 68L2 72L16 52L0 50L16 48L2 28L26 32L20 10L40 24Z',
66
+ '4-sided-cookie':
67
+ 'M50 2Q76 22 76 50Q76 78 50 98Q24 78 24 50Q24 22 50 2Z',
68
+ '6-sided-cookie':
69
+ 'M50 2Q72 10 82 30Q92 52 80 74Q66 96 44 96Q22 96 10 74Q-2 52 10 30Q22 10 50 2Z',
70
+ '7-sided-cookie':
71
+ 'M50 2Q70 6 84 22Q96 40 94 62Q90 82 74 94Q56 102 38 96Q20 88 10 70Q2 50 8 32Q18 10 50 2Z',
72
+ '9-sided-cookie':
73
+ 'M50 2Q64 4 76 14Q86 26 92 42Q94 58 88 72Q78 86 64 94Q50 98 36 94Q22 86 12 72Q6 58 8 42Q14 26 24 14Q36 4 50 2Z',
74
+ '12-sided-cookie':
75
+ 'M50 2L62 6L74 14L84 26L90 40L92 54L88 68L80 80L68 88L54 92L40 90L28 84L18 72L10 58L8 44L12 30L20 18L32 10L44 4Z',
76
+
77
+ // --- Nature ---
78
+ '4-leaf-clover':
79
+ 'M50 4Q70 4 70 26Q96 26 96 50Q96 74 70 74Q70 96 50 96Q30 96 30 74Q4 74 4 50Q4 26 30 26Q30 4 50 4Z',
80
+ '8-leaf-clover':
81
+ 'M50 2Q60 16 72 8Q84 16 80 30Q96 32 92 46Q100 60 86 66Q92 80 78 84Q76 98 60 92Q52 100 42 92Q28 98 24 84Q10 80 16 66Q2 60 10 46Q6 32 22 30Q18 16 30 8Q42 16 50 2Z',
82
+ burst:
83
+ 'M50 0L56 30L80 6L62 34L100 26L70 44L100 50L70 56L100 74L62 66L80 94L56 70L50 100L44 70L20 94L38 66L0 74L30 56L0 50L30 44L0 26L38 34L20 6L44 30Z',
84
+ 'soft-burst':
85
+ 'M50 4L58 28L78 8L66 32L96 24L76 44L98 50L76 56L96 76L66 68L78 92L58 72L50 96L42 72L22 92L34 68L4 76L24 56L2 50L24 44L4 24L34 32L22 8L42 28Z',
86
+ boom:
87
+ 'M50 0L54 18L62 2L60 20L76 6L68 24L88 14L76 30L98 24L82 38L100 38L86 46L100 50L86 54L100 62L82 62L98 76L76 70L88 86L68 76L76 94L60 80L62 98L54 82L50 100L46 82L38 98L40 80L24 94L32 76L12 86L24 70L2 76L18 62L0 62L14 54L0 50L14 46L0 38L18 38L2 24L24 30L12 14L32 24L24 6L40 20L38 2L46 18Z',
88
+ 'soft-boom':
89
+ 'M50 4L56 22L68 6L64 26L82 14L74 32L94 24L82 40L100 36L86 48L100 50L86 52L100 64L82 60L94 76L74 68L82 86L64 74L68 94L56 78L50 96L44 78L32 94L36 74L18 86L26 68L6 76L18 60L0 64L14 52L0 50L14 48L0 36L18 40L6 24L26 32L18 14L36 26L32 6L44 22Z',
90
+ flower:
91
+ 'M50 4Q62 18 72 10Q82 18 76 32Q90 30 88 44Q98 50 88 56Q90 70 76 68Q82 82 72 90Q62 82 50 96Q38 82 28 90Q18 82 24 68Q10 70 12 56Q2 50 12 44Q10 30 24 32Q18 18 28 10Q38 18 50 4Z',
92
+ puffy:
93
+ 'M34 6Q50-4 66 6Q84 6 90 22Q104 34 96 50Q104 66 90 78Q84 94 66 94Q50 104 34 94Q16 94 10 78Q-4 66 4 50Q-4 34 10 22Q16 6 34 6Z',
94
+ 'puffy-diamond':
95
+ 'M50 2Q66 10 72 4Q86 12 84 28Q98 32 94 48Q100 64 86 70Q88 86 72 88Q62 98 48 94Q34 100 26 86Q12 88 8 72Q-2 62 6 48Q0 32 16 28Q14 12 28 4Q38 10 50 2Z',
96
+
97
+ // --- Fun ---
98
+ 'ghost-ish':
99
+ 'M20 96V40Q20 4 50 4Q80 4 80 40V96L70 86L60 96L50 86L40 96L30 86Z',
100
+ 'pixel-circle':
101
+ 'M30 4H70V4H86V14H96V30H100V70H96V86H86V96H70V100H30V96H14V86H4V70H0V30H4V14H14V4H30Z',
102
+ 'pixel-triangle':
103
+ 'M42 4H58V18H70V32H82V46H94V60H100V100H0V60H6V46H18V32H30V18H42Z',
104
+ bun:
105
+ 'M12 54Q-4 24 20 8Q44-6 68 8Q92 22 94 50Q96 72 76 88Q56 100 36 96Q14 90 12 54Z',
106
+ heart:
107
+ 'M50 90C25 70 2 55 2 32Q2 10 24 6Q40 2 50 18Q60 2 76 6Q98 10 98 32Q98 55 75 70Z',
108
+ };
109
+
110
+ /**
111
+ * Display labels for the named shapes, in the order a picker should show them.
112
+ * Exported so consumers building a shape picker do not re-derive the order (or
113
+ * the capitalisation) themselves.
114
+ */
115
+ export const AVATAR_SHAPE_LABELS: { name: AvatarShapeName; label: string }[] = [
116
+ { name: 'square', label: 'Square' },
117
+ { name: 'slanted', label: 'Slanted' },
118
+ { name: 'arch', label: 'Arch' },
119
+ { name: 'semicircle', label: 'Semicircle' },
120
+ { name: 'oval', label: 'Oval' },
121
+ { name: 'pill', label: 'Pill' },
122
+ { name: 'triangle', label: 'Triangle' },
123
+ { name: 'arrow', label: 'Arrow' },
124
+ { name: 'fan', label: 'Fan' },
125
+ { name: 'diamond', label: 'Diamond' },
126
+ { name: 'clamshell', label: 'Clamshell' },
127
+ { name: 'pentagon', label: 'Pentagon' },
128
+ { name: 'gem', label: 'Gem' },
129
+ { name: 'very-sunny', label: 'Very Sunny' },
130
+ { name: 'sunny', label: 'Sunny' },
131
+ { name: '4-sided-cookie', label: '4-Sided Cookie' },
132
+ { name: '6-sided-cookie', label: '6-Sided Cookie' },
133
+ { name: '7-sided-cookie', label: '7-Sided Cookie' },
134
+ { name: '9-sided-cookie', label: '9-Sided Cookie' },
135
+ { name: '12-sided-cookie', label: '12-Sided Cookie' },
136
+ { name: '4-leaf-clover', label: '4-Leaf Clover' },
137
+ { name: '8-leaf-clover', label: '8-Leaf Clover' },
138
+ { name: 'burst', label: 'Burst' },
139
+ { name: 'soft-burst', label: 'Soft Burst' },
140
+ { name: 'boom', label: 'Boom' },
141
+ { name: 'soft-boom', label: 'Soft Boom' },
142
+ { name: 'flower', label: 'Flower' },
143
+ { name: 'puffy', label: 'Puffy' },
144
+ { name: 'puffy-diamond', label: 'Puffy Diamond' },
145
+ { name: 'ghost-ish', label: 'Ghost-ish' },
146
+ { name: 'pixel-circle', label: 'Pixel Circle' },
147
+ { name: 'pixel-triangle', label: 'Pixel Triangle' },
148
+ { name: 'bun', label: 'Bun' },
149
+ { name: 'heart', label: 'Heart' },
150
+ ];