react-grid-layout 1.5.2 → 2.0.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 (94) hide show
  1. package/README.md +1075 -432
  2. package/css/styles.css +6 -4
  3. package/dist/ResponsiveGridLayout-CH4s0tKj.d.ts +124 -0
  4. package/dist/ResponsiveGridLayout-D6lFRE3f.d.mts +124 -0
  5. package/dist/calculate-CwYDW8na.d.mts +168 -0
  6. package/dist/calculate-mgLpNJ5O.d.ts +168 -0
  7. package/dist/chunk-2KUHNJXF.mjs +90 -0
  8. package/dist/chunk-2KUHNJXF.mjs.map +1 -0
  9. package/dist/chunk-3WO4SAYB.js +868 -0
  10. package/dist/chunk-3WO4SAYB.js.map +1 -0
  11. package/dist/chunk-4HNUMWQK.mjs +822 -0
  12. package/dist/chunk-4HNUMWQK.mjs.map +1 -0
  13. package/dist/chunk-BFTKGAP3.js +1309 -0
  14. package/dist/chunk-BFTKGAP3.js.map +1 -0
  15. package/dist/chunk-F6NQPYKT.js +98 -0
  16. package/dist/chunk-F6NQPYKT.js.map +1 -0
  17. package/dist/chunk-H5KMDLY3.js +434 -0
  18. package/dist/chunk-H5KMDLY3.js.map +1 -0
  19. package/dist/chunk-PBQSHIID.js +4 -0
  20. package/dist/chunk-PBQSHIID.js.map +1 -0
  21. package/dist/chunk-R35HZZTA.mjs +1300 -0
  22. package/dist/chunk-R35HZZTA.mjs.map +1 -0
  23. package/dist/chunk-ZCXE6SR5.mjs +428 -0
  24. package/dist/chunk-ZCXE6SR5.mjs.map +1 -0
  25. package/dist/chunk-ZWN22PS2.mjs +3 -0
  26. package/dist/chunk-ZWN22PS2.mjs.map +1 -0
  27. package/dist/core.d.mts +33 -0
  28. package/dist/core.d.ts +33 -0
  29. package/dist/core.js +218 -0
  30. package/dist/core.js.map +1 -0
  31. package/dist/core.mjs +5 -0
  32. package/dist/core.mjs.map +1 -0
  33. package/dist/extras.d.mts +78 -0
  34. package/dist/extras.d.ts +78 -0
  35. package/dist/extras.js +91 -0
  36. package/dist/extras.js.map +1 -0
  37. package/dist/extras.mjs +89 -0
  38. package/dist/extras.mjs.map +1 -0
  39. package/dist/index.d.mts +7 -0
  40. package/dist/index.d.ts +7 -0
  41. package/dist/index.js +154 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/index.mjs +7 -0
  44. package/dist/index.mjs.map +1 -0
  45. package/dist/legacy.d.mts +163 -0
  46. package/dist/legacy.d.ts +163 -0
  47. package/dist/legacy.js +319 -0
  48. package/dist/legacy.js.map +1 -0
  49. package/dist/legacy.mjs +307 -0
  50. package/dist/legacy.mjs.map +1 -0
  51. package/dist/position-BmN1z36J.d.mts +319 -0
  52. package/dist/position-Dk2b4ZMS.d.ts +319 -0
  53. package/dist/react.d.mts +351 -0
  54. package/dist/react.d.ts +351 -0
  55. package/dist/react.js +96 -0
  56. package/dist/react.js.map +1 -0
  57. package/dist/react.mjs +7 -0
  58. package/dist/react.mjs.map +1 -0
  59. package/dist/responsive-C4L1ESlm.d.ts +145 -0
  60. package/dist/responsive-CJxefsYw.d.mts +145 -0
  61. package/dist/types-Cxf4nHNr.d.mts +375 -0
  62. package/dist/types-Cxf4nHNr.d.ts +375 -0
  63. package/index-dev.js +8 -0
  64. package/package.json +132 -39
  65. package/.babelrc.js +0 -22
  66. package/.browserslistrc +0 -3
  67. package/.eslintignore +0 -4
  68. package/.flowconfig +0 -20
  69. package/.prettierignore +0 -4
  70. package/.prettierrc +0 -17
  71. package/CHANGELOG.md +0 -985
  72. package/build/GridItem.js +0 -640
  73. package/build/ReactGridLayout.js +0 -744
  74. package/build/ReactGridLayoutPropTypes.js +0 -210
  75. package/build/ResponsiveReactGridLayout.js +0 -294
  76. package/build/calculateUtils.js +0 -165
  77. package/build/components/WidthProvider.js +0 -111
  78. package/build/fastRGLPropsEqual.js +0 -5
  79. package/build/responsiveUtils.js +0 -101
  80. package/build/utils.js +0 -834
  81. package/dist/react-grid-layout.min.js +0 -2
  82. package/dist/react-grid-layout.min.js.map +0 -1
  83. package/index.js.flow +0 -8
  84. package/ip_fetcher +0 -0
  85. package/ip_fetcher.c +0 -47
  86. package/lib/GridItem.jsx +0 -689
  87. package/lib/ReactGridLayout.jsx +0 -855
  88. package/lib/ReactGridLayoutPropTypes.js +0 -241
  89. package/lib/ResponsiveReactGridLayout.jsx +0 -349
  90. package/lib/calculateUtils.js +0 -169
  91. package/lib/components/WidthProvider.jsx +0 -110
  92. package/lib/fastRGLPropsEqual.js +0 -46
  93. package/lib/responsiveUtils.js +0 -118
  94. package/lib/utils.js +0 -979
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Core types for react-grid-layout v2
3
+ *
4
+ * These types are framework-agnostic and define the data structures
5
+ * used by the layout algorithms.
6
+ */
7
+ /**
8
+ * Axis identifiers for resize handles.
9
+ * - Cardinal: 'n', 's', 'e', 'w' (north, south, east, west)
10
+ * - Diagonal: 'ne', 'nw', 'se', 'sw'
11
+ */
12
+ type ResizeHandleAxis = "s" | "w" | "e" | "n" | "sw" | "nw" | "se" | "ne";
13
+ /**
14
+ * A single item in the grid layout.
15
+ *
16
+ * Position (x, y) is in grid units, not pixels.
17
+ * Size (w, h) is in grid units.
18
+ */
19
+ interface LayoutItem {
20
+ /** Unique identifier for this item */
21
+ i: string;
22
+ /** X position in grid units (0-indexed from left) */
23
+ x: number;
24
+ /** Y position in grid units (0-indexed from top) */
25
+ y: number;
26
+ /** Width in grid units */
27
+ w: number;
28
+ /** Height in grid units */
29
+ h: number;
30
+ /** Minimum width in grid units */
31
+ minW?: number;
32
+ /** Minimum height in grid units */
33
+ minH?: number;
34
+ /** Maximum width in grid units */
35
+ maxW?: number;
36
+ /** Maximum height in grid units */
37
+ maxH?: number;
38
+ /**
39
+ * If true, item cannot be dragged or resized, and other items
40
+ * will move around it during compaction.
41
+ */
42
+ static?: boolean;
43
+ /**
44
+ * If false, item cannot be dragged (but may still be resizable).
45
+ * Overrides grid-level isDraggable for this item.
46
+ */
47
+ isDraggable?: boolean;
48
+ /**
49
+ * If false, item cannot be resized (but may still be draggable).
50
+ * Overrides grid-level isResizable for this item.
51
+ */
52
+ isResizable?: boolean;
53
+ /**
54
+ * Which resize handles to show for this item.
55
+ * Overrides grid-level resizeHandles for this item.
56
+ */
57
+ resizeHandles?: ResizeHandleAxis[];
58
+ /**
59
+ * If true, item is constrained to the grid container bounds.
60
+ * Overrides grid-level isBounded for this item.
61
+ */
62
+ isBounded?: boolean;
63
+ /**
64
+ * Internal flag set during drag/resize operations to indicate
65
+ * the item has moved from its original position.
66
+ * @internal
67
+ */
68
+ moved?: boolean;
69
+ }
70
+ /**
71
+ * A layout is a readonly array of layout items.
72
+ * Layouts should be treated as immutable.
73
+ */
74
+ type Layout = readonly LayoutItem[];
75
+ /**
76
+ * Pixel position and size of an element.
77
+ */
78
+ interface Position {
79
+ left: number;
80
+ top: number;
81
+ width: number;
82
+ height: number;
83
+ }
84
+ /**
85
+ * Partial position (just coordinates, no size).
86
+ */
87
+ interface PartialPosition {
88
+ left: number;
89
+ top: number;
90
+ }
91
+ /**
92
+ * Size in pixels.
93
+ */
94
+ interface Size {
95
+ width: number;
96
+ height: number;
97
+ }
98
+ /**
99
+ * Position when dropping an external element onto the grid.
100
+ */
101
+ interface DroppingPosition {
102
+ left: number;
103
+ top: number;
104
+ e: Event;
105
+ }
106
+ /**
107
+ * Data provided by react-draggable during drag operations.
108
+ */
109
+ interface ReactDraggableCallbackData {
110
+ node: HTMLElement;
111
+ x?: number;
112
+ y?: number;
113
+ deltaX: number;
114
+ deltaY: number;
115
+ lastX?: number;
116
+ lastY?: number;
117
+ }
118
+ /**
119
+ * Grid-level drag event data.
120
+ */
121
+ interface GridDragEvent {
122
+ e: Event;
123
+ node: HTMLElement;
124
+ newPosition: PartialPosition;
125
+ }
126
+ /**
127
+ * Grid-level resize event data.
128
+ */
129
+ interface GridResizeEvent {
130
+ e: Event;
131
+ node: HTMLElement;
132
+ size: Size;
133
+ handle: ResizeHandleAxis;
134
+ }
135
+ /**
136
+ * Drag-over event with layer coordinates.
137
+ */
138
+ interface DragOverEvent extends MouseEvent {
139
+ nativeEvent: Event & {
140
+ layerX: number;
141
+ layerY: number;
142
+ };
143
+ }
144
+ /**
145
+ * Type of compaction to apply to the layout.
146
+ * - 'vertical': Items compact upward (default)
147
+ * - 'horizontal': Items compact leftward
148
+ * - null: No compaction (free-form positioning)
149
+ */
150
+ type CompactType = "horizontal" | "vertical" | null;
151
+ /**
152
+ * Standard callback signature for layout change events.
153
+ *
154
+ * @param layout - The current layout after the change
155
+ * @param oldItem - The item before the change (null if not applicable)
156
+ * @param newItem - The item after the change (null if not applicable)
157
+ * @param placeholder - The placeholder item during drag/resize (null at start)
158
+ * @param event - The DOM event that triggered the change
159
+ * @param element - The DOM element being manipulated (null if not applicable)
160
+ */
161
+ type EventCallback = (layout: Layout, oldItem: LayoutItem | null, newItem: LayoutItem | null, placeholder: LayoutItem | null, event: Event, element: HTMLElement | null) => void;
162
+ /**
163
+ * Callback when layout changes for any reason.
164
+ */
165
+ type OnLayoutChangeCallback = (layout: Layout) => void;
166
+ /**
167
+ * Interface for layout compaction strategies.
168
+ *
169
+ * Implement this interface to create custom compaction algorithms.
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * const myCompactor: Compactor = {
174
+ * type: 'vertical',
175
+ * allowOverlap: false,
176
+ * compact(layout, cols) {
177
+ * // Custom compaction logic
178
+ * return compactedLayout;
179
+ * },
180
+ * onMove(layout, item, x, y, cols) {
181
+ * // Handle item movement
182
+ * return updatedLayout;
183
+ * }
184
+ * };
185
+ * ```
186
+ */
187
+ interface Compactor {
188
+ /** Compaction type identifier */
189
+ readonly type: CompactType;
190
+ /** Whether overlapping items are allowed */
191
+ readonly allowOverlap: boolean;
192
+ /** Whether to prevent collisions instead of pushing items */
193
+ readonly preventCollision?: boolean;
194
+ /**
195
+ * Compact the layout.
196
+ *
197
+ * @param layout - The layout to compact
198
+ * @param cols - Number of columns in the grid
199
+ * @returns The compacted layout
200
+ */
201
+ compact(layout: Layout, cols: number): Layout;
202
+ /**
203
+ * Handle item movement, returning the updated layout.
204
+ *
205
+ * @param layout - Current layout
206
+ * @param item - The item being moved
207
+ * @param x - New x position
208
+ * @param y - New y position
209
+ * @param cols - Number of columns
210
+ * @returns Updated layout after the move
211
+ */
212
+ onMove(layout: Layout, item: LayoutItem, x: number, y: number, cols: number): Layout;
213
+ }
214
+ /**
215
+ * Interface for CSS positioning strategies.
216
+ *
217
+ * Implement this interface to customize how items are positioned in the DOM.
218
+ * Built-in strategies: transformStrategy, absoluteStrategy.
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * // Use transform-based positioning (default, better performance)
223
+ * <GridLayout positionStrategy={transformStrategy} />
224
+ *
225
+ * // Use top/left positioning (for environments where transforms cause issues)
226
+ * <GridLayout positionStrategy={absoluteStrategy} />
227
+ *
228
+ * // Use scaled transforms (for scaled containers)
229
+ * <GridLayout positionStrategy={createScaledStrategy(0.5)} />
230
+ * ```
231
+ */
232
+ interface PositionStrategy {
233
+ /** Strategy type identifier */
234
+ readonly type: "transform" | "absolute";
235
+ /** Scale factor for drag/resize calculations */
236
+ readonly scale: number;
237
+ /**
238
+ * Convert pixel position to CSS style object.
239
+ *
240
+ * @param pos - Position in pixels
241
+ * @returns CSS properties for positioning the element
242
+ */
243
+ calcStyle(pos: Position): React.CSSProperties;
244
+ /**
245
+ * Calculate position during drag operations, accounting for transforms and scale.
246
+ *
247
+ * @param clientX - Mouse client X position
248
+ * @param clientY - Mouse client Y position
249
+ * @param offsetX - Offset from element origin X
250
+ * @param offsetY - Offset from element origin Y
251
+ * @returns Adjusted left/top position
252
+ */
253
+ calcDragPosition(clientX: number, clientY: number, offsetX: number, offsetY: number): PartialPosition;
254
+ }
255
+ /**
256
+ * Grid measurement configuration.
257
+ * Groups all grid metrics (columns, row height, margins).
258
+ */
259
+ interface GridConfig {
260
+ /** Number of columns in the grid (default: 12) */
261
+ cols: number;
262
+ /** Height of a single row in pixels (default: 150) */
263
+ rowHeight: number;
264
+ /** [horizontal, vertical] margin between items in pixels (default: [10, 10]) */
265
+ margin: readonly [number, number];
266
+ /** [horizontal, vertical] padding inside the container (default: null, uses margin) */
267
+ containerPadding: readonly [number, number] | null;
268
+ /** Maximum number of rows (default: Infinity) */
269
+ maxRows: number;
270
+ }
271
+ /** Default grid configuration */
272
+ declare const defaultGridConfig: GridConfig;
273
+ /**
274
+ * Drag behavior configuration.
275
+ * Groups all drag-related settings.
276
+ */
277
+ interface DragConfig {
278
+ /** Whether items can be dragged (default: true) */
279
+ enabled: boolean;
280
+ /** Whether items are bounded to the container (default: false) */
281
+ bounded: boolean;
282
+ /** CSS selector for drag handle (e.g., '.drag-handle') */
283
+ handle?: string;
284
+ /** CSS selector for elements that should not trigger drag */
285
+ cancel?: string;
286
+ /**
287
+ * Minimum pixels to move before drag starts.
288
+ * Helps distinguish click from drag (fixes #1341, #1401).
289
+ * @default 3
290
+ */
291
+ threshold: number;
292
+ }
293
+ /** Default drag configuration */
294
+ declare const defaultDragConfig: DragConfig;
295
+ /**
296
+ * Resize behavior configuration.
297
+ * Groups all resize-related settings.
298
+ */
299
+ interface ResizeConfig {
300
+ /** Whether items can be resized (default: true) */
301
+ enabled: boolean;
302
+ /** Which resize handles to show (default: ['se']) */
303
+ handles: readonly ResizeHandleAxis[];
304
+ /**
305
+ * Custom resize handle component.
306
+ * Can be a React node or a function that receives the axis.
307
+ */
308
+ handleComponent?: React.ReactNode | ((axis: ResizeHandleAxis, ref: React.Ref<HTMLElement>) => React.ReactNode);
309
+ }
310
+ /** Default resize configuration */
311
+ declare const defaultResizeConfig: ResizeConfig;
312
+ /**
313
+ * Drop configuration (for dropping external elements).
314
+ * Groups all drop-related settings.
315
+ */
316
+ interface DropConfig {
317
+ /** Whether external elements can be dropped on the grid (default: false) */
318
+ enabled: boolean;
319
+ /** Default size for dropped items (default: { w: 1, h: 1 }) */
320
+ defaultItem: {
321
+ w: number;
322
+ h: number;
323
+ };
324
+ /**
325
+ * Called when dragging over the grid.
326
+ * Return dimensions to override defaultItem, or false to reject the drop.
327
+ */
328
+ onDragOver?: (e: DragEvent) => {
329
+ w?: number;
330
+ h?: number;
331
+ } | false | void;
332
+ }
333
+ /** Default drop configuration */
334
+ declare const defaultDropConfig: DropConfig;
335
+ /**
336
+ * Breakpoint name (e.g., 'lg', 'md', 'sm', 'xs', 'xxs').
337
+ */
338
+ type Breakpoint = string;
339
+ /**
340
+ * Map of breakpoint name to pixel width.
341
+ * Generic type B allows custom breakpoint strings.
342
+ */
343
+ type Breakpoints<B extends Breakpoint = Breakpoint> = Record<B, number>;
344
+ /**
345
+ * Map of breakpoint name to number of columns.
346
+ * Generic type B allows custom breakpoint strings.
347
+ */
348
+ type BreakpointCols<B extends Breakpoint = Breakpoint> = Record<B, number>;
349
+ /**
350
+ * Map of breakpoint name to layout.
351
+ * Generic type B allows custom breakpoint strings.
352
+ */
353
+ type ResponsiveLayouts<B extends Breakpoint = Breakpoint> = Partial<Record<B, Layout>>;
354
+ /**
355
+ * Callback when breakpoint changes.
356
+ */
357
+ type OnBreakpointChangeCallback<B extends Breakpoint = Breakpoint> = (newBreakpoint: B, cols: number) => void;
358
+ /**
359
+ * Makes all properties in T mutable (removes readonly).
360
+ */
361
+ type Mutable<T> = {
362
+ -readonly [P in keyof T]: T[P];
363
+ };
364
+ /**
365
+ * Deep partial - all properties and nested properties are optional.
366
+ */
367
+ type DeepPartial<T> = {
368
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
369
+ };
370
+ /**
371
+ * Extract the element type from an array type.
372
+ */
373
+ type ArrayElement<T> = T extends readonly (infer U)[] ? U : never;
374
+
375
+ export { type ArrayElement as A, type Breakpoint as B, type CompactType as C, type DroppingPosition as D, type EventCallback as E, type GridDragEvent as G, type Layout as L, type Mutable as M, type OnLayoutChangeCallback as O, type Position as P, type ResponsiveLayouts as R, type Size as S, type LayoutItem as a, type Breakpoints as b, type Compactor as c, type ResizeHandleAxis as d, type GridResizeEvent as e, type PartialPosition as f, type ReactDraggableCallbackData as g, type DragOverEvent as h, type PositionStrategy as i, type GridConfig as j, type DragConfig as k, type ResizeConfig as l, type DropConfig as m, type BreakpointCols as n, type OnBreakpointChangeCallback as o, type DeepPartial as p, defaultGridConfig as q, defaultDragConfig as r, defaultResizeConfig as s, defaultDropConfig as t };
package/index-dev.js ADDED
@@ -0,0 +1,8 @@
1
+ // Development entry point - uses new TypeScript source directly
2
+ module.exports = require("./src/legacy/ReactGridLayout").default;
3
+ module.exports.utils = require("./src/legacy/utils-compat");
4
+ module.exports.calculateUtils = require("./src/legacy/calculate-compat");
5
+ module.exports.Responsive =
6
+ require("./src/legacy/ResponsiveReactGridLayout").default;
7
+ module.exports.Responsive.utils = require("./src/legacy/responsive-compat");
8
+ module.exports.WidthProvider = require("./src/legacy/WidthProvider").default;
package/package.json CHANGED
@@ -1,18 +1,84 @@
1
1
  {
2
2
  "name": "react-grid-layout",
3
- "version": "1.5.2",
3
+ "version": "2.0.0",
4
4
  "description": "A draggable and resizable grid layout with responsive breakpoints, for React.",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "./core": {
20
+ "import": {
21
+ "types": "./dist/core.d.mts",
22
+ "default": "./dist/core.mjs"
23
+ },
24
+ "require": {
25
+ "types": "./dist/core.d.ts",
26
+ "default": "./dist/core.js"
27
+ }
28
+ },
29
+ "./react": {
30
+ "import": {
31
+ "types": "./dist/react.d.mts",
32
+ "default": "./dist/react.mjs"
33
+ },
34
+ "require": {
35
+ "types": "./dist/react.d.ts",
36
+ "default": "./dist/react.js"
37
+ }
38
+ },
39
+ "./legacy": {
40
+ "import": {
41
+ "types": "./dist/legacy.d.mts",
42
+ "default": "./dist/legacy.mjs"
43
+ },
44
+ "require": {
45
+ "types": "./dist/legacy.d.ts",
46
+ "default": "./dist/legacy.js"
47
+ }
48
+ },
49
+ "./extras": {
50
+ "import": {
51
+ "types": "./dist/extras.d.mts",
52
+ "default": "./dist/extras.mjs"
53
+ },
54
+ "require": {
55
+ "types": "./dist/extras.d.ts",
56
+ "default": "./dist/extras.js"
57
+ }
58
+ },
59
+ "./css/styles.css": "./css/styles.css"
60
+ },
61
+ "sideEffects": [
62
+ "*.css"
63
+ ],
64
+ "files": [
65
+ "dist",
66
+ "css",
67
+ "index.js",
68
+ "index-dev.js"
69
+ ],
6
70
  "scripts": {
7
71
  "lint": "make lint",
8
72
  "test": "make test",
9
73
  "build": "make build",
74
+ "build:ts": "tsup",
75
+ "build:ts:watch": "tsup --watch",
76
+ "typecheck": "tsc --noEmit",
10
77
  "build-example": "make build-example",
11
78
  "view-example": "make view-example",
12
79
  "dev": "make dev",
13
80
  "prepublishOnly": "make build",
14
81
  "validate": "npm ls",
15
- "flow": "flow",
16
82
  "fmt": "prettier --write .",
17
83
  "fmt:check": "prettier --check ."
18
84
  },
@@ -33,9 +99,9 @@
33
99
  "author": "Samuel Reed <samuel.trace.reed@gmail.com> (http://strml.net/)",
34
100
  "license": "MIT",
35
101
  "bugs": {
36
- "url": "https://github.com/STRML/react-grid-layout/issues"
102
+ "url": "https://github.com/react-grid-layout/react-grid-layout/issues"
37
103
  },
38
- "homepage": "https://github.com/STRML/react-grid-layout",
104
+ "homepage": "https://github.com/react-grid-layout/react-grid-layout",
39
105
  "dependencies": {
40
106
  "clsx": "^2.1.1",
41
107
  "fast-equals": "^4.0.3",
@@ -52,44 +118,51 @@
52
118
  "@babel/core": "^7.27.4",
53
119
  "@babel/eslint-parser": "^7.27.5",
54
120
  "@babel/plugin-transform-class-properties": "^7.18.6",
55
- "@babel/plugin-transform-flow-comments": "^7.27.3",
56
121
  "@babel/preset-env": "^7.27.2",
57
- "@babel/preset-flow": "^7.27.1",
58
122
  "@babel/preset-react": "^7.27.1",
123
+ "@babel/preset-typescript": "^7.28.5",
59
124
  "@babel/register": "^7.27.1",
60
- "@webpack-cli/serve": "^2.0.5",
61
- "babel-jest": "^29.7.0",
62
- "babel-loader": "^9.1.3",
125
+ "@eslint/compat": "^1.2.0",
126
+ "@eslint/js": "^9.0.0",
127
+ "@testing-library/dom": "^10.4.0",
128
+ "@testing-library/jest-dom": "^6.6.3",
129
+ "@testing-library/react": "^16.1.0",
130
+ "@types/node": "^24.10.1",
131
+ "@types/react": "^19.2.7",
132
+ "@webpack-cli/serve": "^3.0.1",
133
+ "babel-jest": "^30.2.0",
134
+ "babel-loader": "^10.0.0",
63
135
  "babel-plugin-preval": "^5.1.0",
64
- "css-loader": "^6.8.1",
136
+ "css-loader": "^7.1.2",
65
137
  "ejs": "^3.1.10",
66
- "enzyme": "^3.11.0",
67
- "enzyme-adapter-react-16": "^1.15.8",
68
- "enzyme-to-json": "^3.6.2",
69
- "eslint": "^8.54.0",
70
- "eslint-plugin-flowtype": "^8.0.3",
71
- "eslint-plugin-mocha": "^10.2.0",
138
+ "eslint": "^9.39.1",
139
+ "eslint-plugin-mocha": "^11.2.0",
72
140
  "eslint-plugin-react": "^7.33.2",
73
- "eslint-plugin-unicorn": "^49.0.0",
74
- "exports-loader": "^4.0.0",
75
- "flow-bin": "^0.172.0",
76
- "husky": "^8.0.3",
77
- "imports-loader": "^4.0.1",
78
- "jest": "^29.7.0",
79
- "jest-environment-jsdom": "^29.7.0",
80
- "lint-staged": "^15.1.0",
141
+ "eslint-plugin-react-hooks": "^7.0.1",
142
+ "eslint-plugin-unicorn": "^62.0.0",
143
+ "exports-loader": "^5.0.0",
144
+ "globals": "^16.0.0",
145
+ "husky": "^9.1.7",
146
+ "imports-loader": "^5.0.0",
147
+ "jest": "^30.2.0",
148
+ "jest-environment-jsdom": "^30.2.0",
149
+ "lint-staged": "^16.2.7",
81
150
  "lodash": "^4.17.21",
82
151
  "opener": "^1.5.2",
83
152
  "prettier": "^3.1.0",
84
- "react": "^16.13.1",
85
- "react-dom": "^16.13.1",
153
+ "react": "^18.3.1",
154
+ "react-dom": "^18.3.1",
155
+ "react-grab": "^0.0.71",
86
156
  "react-hot-loader": "^4.13.1",
87
157
  "react-transform-hmr": "^1.0.2",
88
- "style-loader": "^3.3.3",
158
+ "style-loader": "^4.0.0",
89
159
  "timsort": "^0.3.0",
90
- "webpack": "^5.89.0",
91
- "webpack-cli": "^5.1.4",
92
- "webpack-dev-server": "^4.15.1"
160
+ "tsup": "^8.5.1",
161
+ "typescript": "^5.9.3",
162
+ "typescript-eslint": "^8.49.0",
163
+ "webpack": "^5.92.0",
164
+ "webpack-cli": "^6.0.1",
165
+ "webpack-dev-server": "^5.2.2"
93
166
  },
94
167
  "resolutions": {
95
168
  "**/cheerio": "npm:cheerio@1.0.0-rc.12"
@@ -108,11 +181,10 @@
108
181
  "setupFilesAfterEnv": [
109
182
  "<rootDir>test/util/setupTests.js"
110
183
  ],
111
- "snapshotSerializers": [
112
- "enzyme-to-json/serializer"
113
- ],
114
184
  "testMatch": [
115
- "<rootDir>/test/spec/*.js"
185
+ "<rootDir>/test/spec/*.js",
186
+ "<rootDir>/test/spec/*.ts",
187
+ "<rootDir>/test/spec/*.tsx"
116
188
  ],
117
189
  "testEnvironment": "jsdom",
118
190
  "testEnvironmentOptions": {
@@ -120,11 +192,32 @@
120
192
  },
121
193
  "coverageThreshold": {
122
194
  "global": {
123
- "statements": 77,
124
- "branches": 72,
125
- "functions": 77,
126
- "lines": 78
195
+ "statements": 65,
196
+ "branches": 60,
197
+ "functions": 65,
198
+ "lines": 65
127
199
  }
200
+ },
201
+ "transform": {
202
+ "^.+\\.(js|jsx)$": "babel-jest",
203
+ "^.+\\.(ts|tsx)$": [
204
+ "babel-jest",
205
+ {
206
+ "presets": [
207
+ "@babel/preset-typescript"
208
+ ]
209
+ }
210
+ ]
211
+ },
212
+ "moduleFileExtensions": [
213
+ "ts",
214
+ "tsx",
215
+ "js",
216
+ "jsx",
217
+ "json"
218
+ ],
219
+ "moduleNameMapper": {
220
+ "^(\\.{1,2}/.*)\\.js$": "$1"
128
221
  }
129
222
  },
130
223
  "lint-staged": {
package/.babelrc.js DELETED
@@ -1,22 +0,0 @@
1
- // @flow
2
-
3
- const es6Compat =
4
- process.env.BABEL_ES_COMPAT === "6" || process.env.NODE_ENV === "test";
5
-
6
- module.exports = {
7
- presets: [
8
- [
9
- "@babel/preset-env",
10
- {
11
- targets: es6Compat ? "maintained node versions" : "> 0.25%, not dead"
12
- }
13
- ],
14
- "@babel/react",
15
- "@babel/preset-flow"
16
- ],
17
- plugins: [
18
- "@babel/plugin-transform-flow-comments",
19
- "@babel/plugin-transform-class-properties",
20
- "babel-plugin-preval"
21
- ]
22
- };
package/.browserslistrc DELETED
@@ -1,3 +0,0 @@
1
- > 0.25%
2
- ie 11
3
- not dead
package/.eslintignore DELETED
@@ -1,4 +0,0 @@
1
- node_modules/**/*
2
- build
3
- dist
4
- flow-typed
package/.flowconfig DELETED
@@ -1,20 +0,0 @@
1
- [version]
2
- ^0.172.0
3
-
4
- [ignore]
5
- <PROJECT_ROOT>/build/.*
6
- <PROJECT_ROOT>/dist/.*
7
- <PROJECT_ROOT>/node_modules/resolve/.*
8
- <PROJECT_ROOT>/node_modules/.*/resolve/.*
9
- # Speeds parsing:
10
- .*/node_modules/@babel.*
11
- .*/node_modules/babel.*
12
-
13
- [include]
14
-
15
- [libs]
16
- flow-typed/
17
-
18
- [options]
19
- emoji=true
20
- module.use_strict=true
package/.prettierignore DELETED
@@ -1,4 +0,0 @@
1
- dist/
2
- examples/
3
- __mocks__/
4
- flow-typed/
package/.prettierrc DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "printWidth": 80,
3
- "tabWidth": 2,
4
- "useTabs": false,
5
- "semi": true,
6
- "singleQuote": false,
7
- "quoteProps": "as-needed",
8
- "jsxSingleQuote": false,
9
- "trailingComma": "none",
10
- "bracketSpacing": true,
11
- "arrowParens": "avoid",
12
- "requirePragma": false,
13
- "insertPragma": false,
14
- "proseWrap": "preserve",
15
- "htmlWhitespaceSensitivity": "css",
16
- "endOfLine": "auto"
17
- }