@oxyhq/bloom 0.6.20 → 0.6.22

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 (56) hide show
  1. package/lib/commonjs/scroll/index.js +39 -0
  2. package/lib/commonjs/scroll/index.js.map +1 -0
  3. package/lib/commonjs/scroll/index.web.js +143 -0
  4. package/lib/commonjs/scroll/index.web.js.map +1 -0
  5. package/lib/commonjs/scroll/scrollable.web.js +64 -0
  6. package/lib/commonjs/scroll/scrollable.web.js.map +1 -0
  7. package/lib/commonjs/scroll/store.js +90 -0
  8. package/lib/commonjs/scroll/store.js.map +1 -0
  9. package/lib/commonjs/scroll/types.js +6 -0
  10. package/lib/commonjs/scroll/types.js.map +1 -0
  11. package/lib/commonjs/theme/color-scope/index.web.js +18 -5
  12. package/lib/commonjs/theme/color-scope/index.web.js.map +1 -1
  13. package/lib/module/scroll/index.js +34 -0
  14. package/lib/module/scroll/index.js.map +1 -0
  15. package/lib/module/scroll/index.web.js +137 -0
  16. package/lib/module/scroll/index.web.js.map +1 -0
  17. package/lib/module/scroll/scrollable.web.js +60 -0
  18. package/lib/module/scroll/scrollable.web.js.map +1 -0
  19. package/lib/module/scroll/store.js +84 -0
  20. package/lib/module/scroll/store.js.map +1 -0
  21. package/lib/module/scroll/types.js +4 -0
  22. package/lib/module/scroll/types.js.map +1 -0
  23. package/lib/module/theme/color-scope/index.web.js +18 -5
  24. package/lib/module/theme/color-scope/index.web.js.map +1 -1
  25. package/lib/typescript/commonjs/scroll/index.d.ts +27 -0
  26. package/lib/typescript/commonjs/scroll/index.d.ts.map +1 -0
  27. package/lib/typescript/commonjs/scroll/index.web.d.ts +22 -0
  28. package/lib/typescript/commonjs/scroll/index.web.d.ts.map +1 -0
  29. package/lib/typescript/commonjs/scroll/scrollable.web.d.ts +17 -0
  30. package/lib/typescript/commonjs/scroll/scrollable.web.d.ts.map +1 -0
  31. package/lib/typescript/commonjs/scroll/store.d.ts +46 -0
  32. package/lib/typescript/commonjs/scroll/store.d.ts.map +1 -0
  33. package/lib/typescript/commonjs/scroll/types.d.ts +46 -0
  34. package/lib/typescript/commonjs/scroll/types.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts.map +1 -1
  36. package/lib/typescript/module/scroll/index.d.ts +27 -0
  37. package/lib/typescript/module/scroll/index.d.ts.map +1 -0
  38. package/lib/typescript/module/scroll/index.web.d.ts +22 -0
  39. package/lib/typescript/module/scroll/index.web.d.ts.map +1 -0
  40. package/lib/typescript/module/scroll/scrollable.web.d.ts +17 -0
  41. package/lib/typescript/module/scroll/scrollable.web.d.ts.map +1 -0
  42. package/lib/typescript/module/scroll/store.d.ts +46 -0
  43. package/lib/typescript/module/scroll/store.d.ts.map +1 -0
  44. package/lib/typescript/module/scroll/types.d.ts +46 -0
  45. package/lib/typescript/module/scroll/types.d.ts.map +1 -0
  46. package/lib/typescript/module/theme/color-scope/index.web.d.ts.map +1 -1
  47. package/package.json +22 -1
  48. package/src/__tests__/BloomColorScope.test.tsx +67 -0
  49. package/src/__tests__/scroll-native.test.ts +25 -0
  50. package/src/__tests__/scroll-store.test.ts +85 -0
  51. package/src/scroll/index.ts +47 -0
  52. package/src/scroll/index.web.tsx +167 -0
  53. package/src/scroll/scrollable.web.ts +75 -0
  54. package/src/scroll/store.ts +84 -0
  55. package/src/scroll/types.ts +48 -0
  56. package/src/theme/color-scope/index.web.tsx +26 -2
@@ -21,8 +21,25 @@ export interface BloomColorScopeProps {
21
21
  children: React.ReactNode;
22
22
  }
23
23
 
24
+ /**
25
+ * On web, the single `asChild` child is frequently a react-native-web
26
+ * component (e.g. RN `<View>`) whose `style` prop is a *style array* (or a
27
+ * numeric registered-style id), not a plain `React.CSSProperties` object.
28
+ * react-native-web flattens nested style arrays, so the cloned child must
29
+ * receive an array — spreading an array into an object literal would copy its
30
+ * numeric indices as keys and crash RNW when it commits them to the DOM
31
+ * (`Failed to set an indexed property [0] on 'CSSStyleDeclaration'`).
32
+ */
33
+ type WebStyle =
34
+ | React.CSSProperties
35
+ | number
36
+ | null
37
+ | undefined
38
+ | false
39
+ | ReadonlyArray<WebStyle>;
40
+
24
41
  interface StyleableProps {
25
- style?: React.CSSProperties;
42
+ style?: WebStyle;
26
43
  }
27
44
 
28
45
  export function BloomColorScope({
@@ -58,10 +75,17 @@ export function BloomColorScope({
58
75
  'BloomColorScope with `asChild` requires a single React element child that accepts a `style` prop.',
59
76
  );
60
77
  }
78
+ // Merge as a style ARRAY (the RNW-safe form): scope vars first, then the
79
+ // caller's `style`, then the child's own `style` last so its explicit
80
+ // styles win. react-native-web flattens nested arrays correctly; spreading
81
+ // the child's style (which is often an RN style array or numeric id) into an
82
+ // object literal would copy numeric indices as keys and crash RNW.
61
83
  const childStyle = child.props.style;
62
- const mergedStyle: React.CSSProperties = { ...varsStyle, ...style, ...childStyle };
84
+ const mergedStyle: WebStyle = [varsStyle, style, childStyle];
63
85
  content = cloneElement(child, { style: mergedStyle });
64
86
  } else {
87
+ // A plain DOM `<div>` does NOT accept style arrays — only the cloned child
88
+ // path can, so the wrapper keeps using an object spread.
65
89
  const mergedStyle: React.CSSProperties = { ...varsStyle, ...style };
66
90
  content = <div style={mergedStyle}>{children}</div>;
67
91
  }