@oxy.so/bloom 22.1.1 → 22.1.3

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 (43) hide show
  1. package/docs/adoption-matrix.mdx +2 -2
  2. package/docs/dialog.mdx +4 -0
  3. package/docs/list.mdx +5 -1
  4. package/docs/task-catalog.json +1 -1
  5. package/docs/task-catalog.mdx +1 -1
  6. package/lib/commonjs/bottom-bar/BottomBarBase.js +6 -1
  7. package/lib/commonjs/bottom-bar/BottomBarBase.js.map +1 -1
  8. package/lib/commonjs/dialog/DetailDialogBase.js +25 -27
  9. package/lib/commonjs/dialog/DetailDialogBase.js.map +1 -1
  10. package/lib/commonjs/list/VirtualList.web.js +6 -0
  11. package/lib/commonjs/list/VirtualList.web.js.map +1 -1
  12. package/lib/commonjs/list/row-measurement.web.js +74 -0
  13. package/lib/commonjs/list/row-measurement.web.js.map +1 -0
  14. package/lib/commonjs/mail-thread/MailMessage.js +1 -1
  15. package/lib/commonjs/mail-thread/MailMessage.js.map +1 -1
  16. package/lib/module/bottom-bar/BottomBarBase.js +6 -1
  17. package/lib/module/bottom-bar/BottomBarBase.js.map +1 -1
  18. package/lib/module/dialog/DetailDialogBase.js +25 -27
  19. package/lib/module/dialog/DetailDialogBase.js.map +1 -1
  20. package/lib/module/list/VirtualList.web.js +8 -1
  21. package/lib/module/list/VirtualList.web.js.map +1 -1
  22. package/lib/module/list/row-measurement.web.js +70 -0
  23. package/lib/module/list/row-measurement.web.js.map +1 -0
  24. package/lib/module/mail-thread/MailMessage.js +1 -1
  25. package/lib/module/mail-thread/MailMessage.js.map +1 -1
  26. package/lib/typescript/commonjs/bottom-bar/BottomBarBase.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/dialog/DetailDialogBase.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/list/VirtualList.web.d.ts.map +1 -1
  29. package/lib/typescript/commonjs/list/row-measurement.web.d.ts +9 -0
  30. package/lib/typescript/commonjs/list/row-measurement.web.d.ts.map +1 -0
  31. package/lib/typescript/commonjs/mail-thread/MailMessage.d.ts.map +1 -1
  32. package/lib/typescript/module/bottom-bar/BottomBarBase.d.ts.map +1 -1
  33. package/lib/typescript/module/dialog/DetailDialogBase.d.ts.map +1 -1
  34. package/lib/typescript/module/list/VirtualList.web.d.ts.map +1 -1
  35. package/lib/typescript/module/list/row-measurement.web.d.ts +9 -0
  36. package/lib/typescript/module/list/row-measurement.web.d.ts.map +1 -0
  37. package/lib/typescript/module/mail-thread/MailMessage.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/bottom-bar/BottomBarBase.tsx +10 -1
  40. package/src/dialog/DetailDialogBase.tsx +29 -32
  41. package/src/list/VirtualList.web.tsx +9 -0
  42. package/src/list/row-measurement.web.ts +86 -0
  43. package/src/mail-thread/MailMessage.tsx +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MailMessage.d.ts","sourceRoot":"","sources":["../../../../src/mail-thread/MailMessage.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,EAAE,EACF,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAuB,EACvB,gBAAgB,EAChB,MAAc,EACd,OAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,+BAoOlB"}
1
+ {"version":3,"file":"MailMessage.d.ts","sourceRoot":"","sources":["../../../../src/mail-thread/MailMessage.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,EAAE,EACF,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAuB,EACvB,gBAAgB,EAChB,MAAc,EACd,OAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,+BAsOlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/bloom",
3
- "version": "22.1.1",
3
+ "version": "22.1.3",
4
4
  "packageManager": "bun@1.4.3",
5
5
  "description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
6
6
  "main": "lib/commonjs/index.js",
@@ -571,7 +571,16 @@ export function BottomBarBase({
571
571
  {...(dock ? {} : actionMeasurement)}
572
572
  style={{
573
573
  flexShrink: 0,
574
- ...(dock || fillAction || actionWidth == null ? {} : { width: actionWidth }),
574
+ // Measure the intrinsic action independently of the animated
575
+ // outer width. A hidden desktop bar reports zero; feeding that
576
+ // back into this measurer locks it at zero on compact reveal.
577
+ ...(dock || fillAction
578
+ ? {}
579
+ : IS_WEB
580
+ ? { width: cssLength('max-content') }
581
+ : actionWidth == null
582
+ ? {}
583
+ : { width: actionWidth }),
575
584
  }}
576
585
  >
577
586
  <SearchPresentationContext.Provider value={adaptiveAction ? searchHost : null}>
@@ -94,7 +94,7 @@ export function createDetailDialog({
94
94
  );
95
95
  return (
96
96
  <Motion>
97
- <StyledView
97
+ <Screen
98
98
  style={{
99
99
  flex: 1,
100
100
  minHeight: 0,
@@ -104,38 +104,35 @@ export function createDetailDialog({
104
104
  backgroundColor: colors.card,
105
105
  }}
106
106
  testID={`${testID}-surface`}
107
+ kind={contentKind}
108
+ scroll={scrollable ? 'content' : 'none'}
109
+ navigationScope="isolated"
110
+ headerPlacement={scrollable ? 'overlay' : 'inset'}
111
+ header={
112
+ <PageHeader
113
+ testID={`${testID}-header`}
114
+ title={header}
115
+ subtitle={subtitle}
116
+ actions={
117
+ <>
118
+ {actions}
119
+ <Button
120
+ appearance="outline"
121
+ tone="neutral"
122
+ iconOnly
123
+ icon={<RiCloseLine />}
124
+ accessibilityLabel={closeLabel ?? common.close}
125
+ onPress={() => close()}
126
+ />
127
+ </>
128
+ }
129
+ />
130
+ }
131
+ bottomBar={footer}
132
+ bottomBarKeyboardBehavior={footerKeyboardBehavior}
107
133
  >
108
- <Screen
109
- kind={contentKind}
110
- scroll={scrollable ? 'content' : 'none'}
111
- navigationScope="isolated"
112
- headerPlacement={scrollable ? 'overlay' : 'inset'}
113
- header={
114
- <PageHeader
115
- testID={`${testID}-header`}
116
- title={header}
117
- subtitle={subtitle}
118
- actions={
119
- <>
120
- {actions}
121
- <Button
122
- appearance="outline"
123
- tone="neutral"
124
- iconOnly
125
- icon={<RiCloseLine />}
126
- accessibilityLabel={closeLabel ?? common.close}
127
- onPress={() => close()}
128
- />
129
- </>
130
- }
131
- />
132
- }
133
- bottomBar={footer}
134
- bottomBarKeyboardBehavior={footerKeyboardBehavior}
135
- >
136
- <BodyViewport body={body} scrollable={scrollable} testID={testID} />
137
- </Screen>
138
- </StyledView>
134
+ <BodyViewport body={body} scrollable={scrollable} testID={testID} />
135
+ </Screen>
139
136
  </Motion>
140
137
  );
141
138
  }
@@ -67,6 +67,7 @@ import {
67
67
  } from '@tanstack/react-virtual';
68
68
 
69
69
  import type { VirtualListHandle, VirtualListProps, VirtualListSlot } from './types';
70
+ import { createStableRowMeasurement } from './row-measurement.web';
70
71
 
71
72
  // Rows in these lists (user rows, pack cards) are short and fairly uniform; a
72
73
  // small estimate + per-row measurement keeps the mounted node count bounded.
@@ -220,6 +221,13 @@ function VirtualListWebInner<T>(
220
221
  const viewport = useScreenViewport();
221
222
  const scroller = viewport?.kind === 'element' ? viewport.scrollRef : null;
222
223
  const active = viewport?.active !== false;
224
+ const activeRef = React.useRef(active);
225
+ activeRef.current = active;
226
+ const rowMeasurement = React.useMemo(
227
+ () => createStableRowMeasurement(() => activeRef.current),
228
+ [],
229
+ );
230
+ React.useLayoutEffect(() => () => rowMeasurement.cancel(), [rowMeasurement, active]);
223
231
  const [scrollElement, setScrollElement] = React.useState<HTMLElement | null>(null);
224
232
  // Parent host refs attach after child layout effects. Publish the resolved
225
233
  // element after commit so TanStack binds it even without another app render.
@@ -298,6 +306,7 @@ function VirtualListWebInner<T>(
298
306
  scrollMargin,
299
307
  useFlushSync: false,
300
308
  rangeExtractor,
309
+ measureElement: rowMeasurement.measure,
301
310
  getItemKey: keyExtractor ? (row: number) => itemKey(firstItemOf(row)) : undefined,
302
311
  };
303
312
  // Owner changes and inactivity detach observers, not the measurement model.
@@ -0,0 +1,86 @@
1
+ import { measureElement, type Virtualizer } from '@tanstack/react-virtual';
2
+ import { panelGeometryTransitions } from '../app-shell/panel-transitions';
3
+
4
+ type RowVirtualizer = Virtualizer<HTMLElement | Window, HTMLDivElement>;
5
+
6
+ /** A panel's in-flight box is not a new intrinsic size for its retained rows. */
7
+ export function createStableRowMeasurement(isActive: () => boolean) {
8
+ const pending = new Map<HTMLDivElement, RowVirtualizer>();
9
+ let generation = 0;
10
+ let waiting = false;
11
+
12
+ const transitionsFor = (node: HTMLElement) => {
13
+ const owners: HTMLElement[] = [];
14
+ for (let parent = node.parentElement; parent; parent = parent.parentElement) {
15
+ if (
16
+ parent.hasAttribute('data-bloom-panel-owner') ||
17
+ parent.hasAttribute('data-bloom-reading-envelope') ||
18
+ parent.hasAttribute('data-bloom-shell-frame')
19
+ )
20
+ owners.push(parent);
21
+ }
22
+ return panelGeometryTransitions(owners);
23
+ };
24
+
25
+ const flushWhenSettled = (request: number) => {
26
+ if (request !== generation) return;
27
+ if (!isActive()) {
28
+ pending.clear();
29
+ waiting = false;
30
+ return;
31
+ }
32
+ const animations = new Set(
33
+ [...pending.keys()].filter((node) => node.isConnected).flatMap(transitionsFor),
34
+ );
35
+ if (animations.size) {
36
+ void Promise.allSettled([...animations].map((animation) => animation.finished)).then(() =>
37
+ flushWhenSettled(request),
38
+ );
39
+ return;
40
+ }
41
+ const rows = [...pending];
42
+ pending.clear();
43
+ waiting = false;
44
+ for (const [node, instance] of rows) {
45
+ if (!node.isConnected || node.getBoundingClientRect().width <= 0) continue;
46
+ const index = instance.indexFromElement(node);
47
+ if (index < 0 || index >= instance.options.count) continue;
48
+ const key = instance.options.getItemKey(index);
49
+ if (instance.elementsCache.get(key) !== node) continue;
50
+ // A final RO entry can arrive before transition.finished. Re-read the
51
+ // settled box once; measureElement's no-entry path intentionally caches.
52
+ instance.resizeItem(index, node.offsetHeight);
53
+ }
54
+ };
55
+
56
+ return {
57
+ measure(
58
+ node: HTMLDivElement,
59
+ entry: ResizeObserverEntry | undefined,
60
+ instance: RowVirtualizer,
61
+ ) {
62
+ const index = instance.indexFromElement(node);
63
+ const key = instance.options.getItemKey(index);
64
+ const previous = instance.itemSizeCache.get(key) ?? instance.options.estimateSize(index);
65
+ if (!isActive()) return previous;
66
+ const width = entry?.borderBoxSize?.[0]?.inlineSize ?? node.getBoundingClientRect().width;
67
+ // Keep observing: the next nonzero box reports itself without a timer.
68
+ if (width <= 0) return previous;
69
+ if (transitionsFor(node).length) {
70
+ pending.set(node, instance);
71
+ if (!waiting) {
72
+ waiting = true;
73
+ flushWhenSettled(generation);
74
+ }
75
+ return previous;
76
+ }
77
+ pending.delete(node);
78
+ return measureElement(node, entry, instance);
79
+ },
80
+ cancel() {
81
+ generation++;
82
+ pending.clear();
83
+ waiting = false;
84
+ },
85
+ };
86
+ }
@@ -135,7 +135,9 @@ export function MailMessage({
135
135
  // that the group keeps the glyphs and drops the words, which is what
136
136
  // `Button` is built for — the accessible name is the label either
137
137
  // way, so nothing is lost by the labels going.
138
- const compactReplies = !replyLabelsFit(width);
138
+ const compactReplies = !replyLabelsFit(
139
+ width === null ? null : Math.max(0, width - MAIL_BODY_INSET - geo.paddingHorizontal),
140
+ );
139
141
  return (
140
142
  <Card
141
143
  appearance="solid"