@oxy.so/bloom 4.13.3 → 4.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 (42) hide show
  1. package/docs/ai-chat.mdx +4 -0
  2. package/lib/commonjs/ai-chat/AiChatMessages.js +2 -0
  3. package/lib/commonjs/ai-chat/AiChatMessages.js.map +1 -1
  4. package/lib/commonjs/breadcrumb/Breadcrumb.js +1 -0
  5. package/lib/commonjs/breadcrumb/Breadcrumb.js.map +1 -1
  6. package/lib/commonjs/styles/base-web-css.js +35 -0
  7. package/lib/commonjs/styles/base-web-css.js.map +1 -0
  8. package/lib/commonjs/theme/BloomThemeProvider.js +8 -0
  9. package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
  10. package/lib/commonjs/web-search/WebSearch.js +5 -0
  11. package/lib/commonjs/web-search/WebSearch.js.map +1 -1
  12. package/lib/module/ai-chat/AiChatMessages.js +2 -0
  13. package/lib/module/ai-chat/AiChatMessages.js.map +1 -1
  14. package/lib/module/breadcrumb/Breadcrumb.js +1 -0
  15. package/lib/module/breadcrumb/Breadcrumb.js.map +1 -1
  16. package/lib/module/styles/base-web-css.js +31 -0
  17. package/lib/module/styles/base-web-css.js.map +1 -0
  18. package/lib/module/theme/BloomThemeProvider.js +8 -0
  19. package/lib/module/theme/BloomThemeProvider.js.map +1 -1
  20. package/lib/module/web-search/WebSearch.js +5 -0
  21. package/lib/module/web-search/WebSearch.js.map +1 -1
  22. package/lib/typescript/commonjs/ai-chat/AiChatMessages.d.ts +1 -1
  23. package/lib/typescript/commonjs/ai-chat/AiChatMessages.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/ai-chat/types.d.ts +6 -0
  25. package/lib/typescript/commonjs/ai-chat/types.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/styles/base-web-css.d.ts +15 -0
  27. package/lib/typescript/commonjs/styles/base-web-css.d.ts.map +1 -0
  28. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
  29. package/lib/typescript/module/ai-chat/AiChatMessages.d.ts +1 -1
  30. package/lib/typescript/module/ai-chat/AiChatMessages.d.ts.map +1 -1
  31. package/lib/typescript/module/ai-chat/types.d.ts +6 -0
  32. package/lib/typescript/module/ai-chat/types.d.ts.map +1 -1
  33. package/lib/typescript/module/styles/base-web-css.d.ts +15 -0
  34. package/lib/typescript/module/styles/base-web-css.d.ts.map +1 -0
  35. package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/ai-chat/AiChatMessages.tsx +2 -2
  38. package/src/ai-chat/types.ts +6 -0
  39. package/src/breadcrumb/Breadcrumb.tsx +1 -1
  40. package/src/styles/base-web-css.ts +29 -0
  41. package/src/theme/BloomThemeProvider.tsx +8 -0
  42. package/src/web-search/WebSearch.tsx +5 -5
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Bloom's base web rules: the few that hold for every family, adopted once by
3
+ * `BloomThemeProvider`.
4
+ *
5
+ * - **A control is not text.** React Native never makes text selectable unless
6
+ * asked (`selectable`); react-native-web renders every `Text` selectable, so
7
+ * on web a drag across the sidebar, a press on a menu item or a double-click
8
+ * on a tab painted a text selection over the interface. Controls take no
9
+ * selection, as a browser's own `<button>` does, whatever family drew them
10
+ * and however their labels are nested. Links are left alone on purpose: they
11
+ * sit inside prose, and a selection across a paragraph must include them.
12
+ */
13
+ export const BASE_WEB_CSS_ID = 'bloom-base';
14
+
15
+ export const BASE_WEB_CSS = `
16
+ button,
17
+ [role="button"],
18
+ [role="tab"],
19
+ [role="menuitem"],
20
+ [role="menuitemradio"],
21
+ [role="menuitemcheckbox"],
22
+ [role="option"],
23
+ [role="radio"],
24
+ [role="checkbox"],
25
+ [role="switch"] {
26
+ -webkit-user-select: none;
27
+ user-select: none;
28
+ }
29
+ `;
@@ -33,6 +33,8 @@ import { buildSeedScopeVars } from './color-scope/seed-scope';
33
33
  import { type AppColorName } from './color-presets';
34
34
  import { buildScopeVars, getVariableContextProvider } from './color-scope/style-builder';
35
35
  import { applyVarsToRootVariables } from './native-root-vars';
36
+ import { adoptStyleSheet } from '../styles/adopt-style-sheet';
37
+ import { BASE_WEB_CSS, BASE_WEB_CSS_ID } from '../styles/base-web-css';
36
38
  import {
37
39
  readPersistedTheme,
38
40
  readPersistedThemeSync,
@@ -447,6 +449,12 @@ export function BloomThemeProvider({
447
449
  applyVarsToRootVariables(themeVars);
448
450
  }, [themeVars]);
449
451
 
452
+ // Web: the rules every family relies on (`styles/base-web-css.ts`). A no-op
453
+ // on native and during SSR, where there is no document to adopt into.
454
+ useIsomorphicLayoutEffect(() => {
455
+ if (Platform.OS === 'web') adoptStyleSheet(BASE_WEB_CSS_ID, BASE_WEB_CSS);
456
+ }, []);
457
+
450
458
  const contextValue = useMemo<BloomThemeContextValue>(
451
459
  () => ({
452
460
  theme: themeColors,
@@ -521,7 +521,7 @@ function SourceLinkRow({
521
521
  textStyle,
522
522
  ]}
523
523
  >
524
- <Text
524
+ <Text selectable={false}
525
525
  variant="body-regular"
526
526
  numberOfLines={1}
527
527
  style={{ flex: 1, minWidth: 0, color: palette.textSecondary }}
@@ -529,7 +529,7 @@ function SourceLinkRow({
529
529
  {source.title}
530
530
  </Text>
531
531
  {showDomain ? (
532
- <Text variant="caption-1-regular" style={{ flexShrink: 0, color: palette.textTertiary }}>
532
+ <Text selectable={false} variant="caption-1-regular" style={{ flexShrink: 0, color: palette.textTertiary }}>
533
533
  {source.domain}
534
534
  </Text>
535
535
  ) : null}
@@ -731,7 +731,7 @@ function SourcesRow({
731
731
  ringStyle,
732
732
  ]}
733
733
  >
734
- <Text variant="body-regular" style={{ color: palette.textSecondary }}>
734
+ <Text selectable={false} variant="body-regular" style={{ color: palette.textSecondary }}>
735
735
  {label}
736
736
  </Text>
737
737
  <Animated.View
@@ -821,7 +821,7 @@ function StepContent({
821
821
  return (
822
822
  <View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 8 }}>
823
823
  <StepGlyph step={step} palette={palette} />
824
- <Text variant="body-regular" style={{ flex: 1, minWidth: 0, color: palette.textSecondary }}>
824
+ <Text selectable={false} variant="body-regular" style={{ flex: 1, minWidth: 0, color: palette.textSecondary }}>
825
825
  {active ? <AgentLogShimmerText>{step.label}</AgentLogShimmerText> : step.label}
826
826
  {step.query ? (
827
827
  <RNText
@@ -837,7 +837,7 @@ function StepContent({
837
837
  ) : null}
838
838
  </Text>
839
839
  {step.meta ? (
840
- <Text
840
+ <Text selectable={false}
841
841
  variant="body-regular"
842
842
  style={[{ flexShrink: 0, paddingTop: 1, color: palette.textTertiary }, TABULAR]}
843
843
  >