@octanejs/window 0.0.18 → 0.0.19

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/window",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -48,14 +48,14 @@
48
48
  "devDependencies": {
49
49
  "@testing-library/jest-dom": "^6.9.1",
50
50
  "@testing-library/react": "16.3.2",
51
- "@tsrx/react": "^0.2.63",
51
+ "@tsrx/react": "^0.2.67",
52
52
  "esbuild": "^0.28.1",
53
53
  "react": "^19.2.7",
54
54
  "react-dom": "^19.2.7",
55
55
  "react-window": "2.3.0",
56
56
  "vitest": "^4.1.10",
57
- "@octanejs/testing-library": "0.1.49",
58
- "octane": "0.2.0"
57
+ "@octanejs/testing-library": "0.1.50",
58
+ "octane": "0.2.4"
59
59
  },
60
60
  "scripts": {
61
61
  "adapted:generate": "node ../../scripts/react-port/materialize.mjs run --package-dir .",
@@ -2,10 +2,11 @@ import type {
2
2
  ComponentProps,
3
3
  CSSProperties,
4
4
  HTMLAttributes,
5
- ReactElement,
6
- ReactNode,
5
+ Key,
6
+ OctaneElement,
7
+ OctaneNode,
7
8
  Ref,
8
- } from 'react';
9
+ } from 'octane';
9
10
  import type { TagNames } from '../../types.js';
10
11
 
11
12
  type ForbiddenKeys = 'ariaAttributes' | 'columnIndex' | 'rowIndex' | 'style';
@@ -15,7 +16,7 @@ type ExcludeForbiddenKeys<Type> = {
15
16
 
16
17
  export type GridProps<CellProps extends object, TagName extends TagNames = 'div'> = Omit<
17
18
  HTMLAttributes<HTMLDivElement>,
18
- 'onResize'
19
+ 'onResize' | 'style'
19
20
  > & {
20
21
  /**
21
22
  * React component responsible for rendering a cell.
@@ -35,7 +36,7 @@ export type GridProps<CellProps extends object, TagName extends TagNames = 'div'
35
36
  rowIndex: number;
36
37
  style: CSSProperties;
37
38
  } & CellProps,
38
- ) => ReactElement | null;
39
+ ) => OctaneElement | null;
39
40
 
40
41
  /**
41
42
  * Additional props to be passed to the cell-rendering component.
@@ -49,7 +50,7 @@ export type GridProps<CellProps extends object, TagName extends TagNames = 'div'
49
50
  * Additional content to be rendered within the grid (above cells).
50
51
  * This property can be used to render things like overlays or tooltips.
51
52
  */
52
- children?: ReactNode;
53
+ children?: OctaneNode;
53
54
 
54
55
  /**
55
56
  * CSS class name.
@@ -72,7 +73,7 @@ export type GridProps<CellProps extends object, TagName extends TagNames = 'div'
72
73
  * ⚠️ This prop cannot be auto-memoized because it is called during render.
73
74
  * It is important to always `useCallback` for this prop; do not use an inline function.
74
75
  */
75
- columnKey?: (args: { columnIndex: number; data: CellProps; rowIndex: number }) => React.Key;
76
+ columnKey?: (args: { columnIndex: number; data: CellProps; rowIndex: number }) => Key;
76
77
 
77
78
  /**
78
79
  * Column width; the following formats are supported:
@@ -219,7 +220,7 @@ export type GridProps<CellProps extends object, TagName extends TagNames = 'div'
219
220
  * ⚠️ This prop cannot be auto-memoized because it is called during render.
220
221
  * It is important to always `useCallback` for this prop; do not use an inline function.
221
222
  */
222
- rowKey?: (args: { data: CellProps; rowIndex: number }) => React.Key;
223
+ rowKey?: (args: { data: CellProps; rowIndex: number }) => Key;
223
224
 
224
225
  /**
225
226
  * Optional CSS properties.
@@ -2,10 +2,11 @@ import type {
2
2
  ComponentProps,
3
3
  CSSProperties,
4
4
  HTMLAttributes,
5
- ReactElement,
6
- ReactNode,
5
+ Key,
6
+ OctaneElement,
7
+ OctaneNode,
7
8
  Ref,
8
- } from 'react';
9
+ } from 'octane';
9
10
  import type { TagNames } from '../../types.js';
10
11
 
11
12
  export type DynamicRowHeight = {
@@ -22,13 +23,13 @@ type ExcludeForbiddenKeys<Type> = {
22
23
 
23
24
  export type ListProps<RowProps extends object, TagName extends TagNames = 'div'> = Omit<
24
25
  HTMLAttributes<HTMLDivElement>,
25
- 'onResize'
26
+ 'onResize' | 'style'
26
27
  > & {
27
28
  /**
28
29
  * Additional content to be rendered within the list (above cells).
29
30
  * This property can be used to render things like overlays or tooltips.
30
31
  */
31
- children?: ReactNode;
32
+ children?: OctaneNode;
32
33
 
33
34
  /**
34
35
  * CSS class name.
@@ -111,7 +112,7 @@ export type ListProps<RowProps extends object, TagName extends TagNames = 'div'>
111
112
  index: number;
112
113
  style: CSSProperties;
113
114
  } & RowProps,
114
- ) => ReactElement | null;
115
+ ) => OctaneElement | null;
115
116
 
116
117
  /**
117
118
  * Number of items to be rendered in the list.
@@ -141,7 +142,7 @@ export type ListProps<RowProps extends object, TagName extends TagNames = 'div'>
141
142
  * ⚠️ This prop cannot be auto-memoized because it is called during render.
142
143
  * It is important to always `useCallback` for this prop; do not use an inline function.
143
144
  */
144
- rowKey?: (index: number, data: RowProps) => React.Key;
145
+ rowKey?: (index: number, data: RowProps) => Key;
145
146
 
146
147
  /**
147
148
  * Additional props to be passed to the row-rendering component.
@@ -6,9 +6,13 @@ export function useMemoizedObject<Type extends object>(
6
6
  ...rest: unknown[]
7
7
  ): Type {
8
8
  const slot = getSlot(rest);
9
- return useMemo(
10
- () => unstableObject,
11
- Object.values(unstableObject),
12
- subSlot(slot, 'memoized-object'),
13
- );
9
+ const dependencies: unknown[] = Object.keys(unstableObject);
10
+ const keyCount = dependencies.length;
11
+ // The count must be first: memo compares only common prefixes when lengths
12
+ // change, and an old value can equal a newly inserted key.
13
+ for (let index = 0; index < keyCount; index++) {
14
+ dependencies.push(unstableObject[dependencies[index] as keyof Type]);
15
+ }
16
+ dependencies.unshift(keyCount);
17
+ return useMemo(() => unstableObject, dependencies, subSlot(slot, 'memoized-object'));
14
18
  }
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'react';
1
+ import type { JSX } from 'octane';
2
2
 
3
3
  export type Align = 'auto' | 'center' | 'end' | 'smart' | 'start';
4
4