react-split-pane 2.0.2 → 3.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 (65) hide show
  1. package/README.md +342 -144
  2. package/dist/components/Divider.d.ts +31 -0
  3. package/dist/components/Divider.d.ts.map +1 -0
  4. package/dist/components/Pane.d.ts +27 -0
  5. package/dist/components/Pane.d.ts.map +1 -0
  6. package/dist/components/SplitPane.d.ts +29 -0
  7. package/dist/components/SplitPane.d.ts.map +1 -0
  8. package/dist/hooks/useKeyboardResize.d.ts +34 -0
  9. package/dist/hooks/useKeyboardResize.d.ts.map +1 -0
  10. package/dist/hooks/usePaneSize.d.ts +16 -0
  11. package/dist/hooks/usePaneSize.d.ts.map +1 -0
  12. package/dist/hooks/useResizer.d.ts +44 -0
  13. package/dist/hooks/useResizer.d.ts.map +1 -0
  14. package/dist/index.cjs +2 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/index.d.ts +8 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +2 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/keyboard.cjs +2 -0
  21. package/dist/keyboard.cjs.map +1 -0
  22. package/dist/keyboard.d.ts +3 -0
  23. package/dist/keyboard.d.ts.map +1 -0
  24. package/dist/keyboard.js +2 -0
  25. package/dist/keyboard.js.map +1 -0
  26. package/dist/persistence.cjs +2 -0
  27. package/dist/persistence.cjs.map +1 -0
  28. package/dist/persistence.d.ts +24 -0
  29. package/dist/persistence.d.ts.map +1 -0
  30. package/dist/persistence.js +2 -0
  31. package/dist/persistence.js.map +1 -0
  32. package/dist/test/setup.d.ts +2 -0
  33. package/dist/test/setup.d.ts.map +1 -0
  34. package/dist/types/index.d.ts +89 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/utils/accessibility.d.ts +17 -0
  37. package/dist/utils/accessibility.d.ts.map +1 -0
  38. package/dist/utils/calculations.d.ts +29 -0
  39. package/dist/utils/calculations.d.ts.map +1 -0
  40. package/package.json +82 -67
  41. package/styles.css +106 -0
  42. package/.editorconfig +0 -6
  43. package/.idea/jsLibraryMappings.xml +0 -6
  44. package/.idea/misc.xml +0 -7
  45. package/.idea/modules.xml +0 -8
  46. package/.idea/react-split-pane.iml +0 -9
  47. package/.idea/shelf/Get_Resizer_dimensions/shelved.patch +0 -206
  48. package/.idea/shelf/Get_Resizer_dimensions.xml +0 -4
  49. package/.idea/shelf/use_now_sh_instead_of_surge_sh/shelved.patch +0 -1799
  50. package/.idea/shelf/use_now_sh_instead_of_surge_sh.xml +0 -4
  51. package/.idea/shelf/wip_events/shelved.patch +0 -456
  52. package/.idea/shelf/wip_events.xml +0 -4
  53. package/.idea/vcs.xml +0 -6
  54. package/.idea/workspace.xml +0 -1819
  55. package/.storybook/addons.js +0 -2
  56. package/.storybook/config.js +0 -9
  57. package/.storybook/preview-head.html +0 -33
  58. package/.travis.yml +0 -10
  59. package/index.d.ts +0 -53
  60. package/index.js +0 -3
  61. package/lib/Pane.js +0 -130
  62. package/lib/Resizer.js +0 -105
  63. package/lib/SplitPane.js +0 -505
  64. package/stories/index.stories.js +0 -40
  65. package/tsconfig.json +0 -11
package/package.json CHANGED
@@ -1,83 +1,98 @@
1
1
  {
2
2
  "name": "react-split-pane",
3
- "description": "React split-pane component",
4
- "main": "index.js",
5
- "types": "index.d.ts",
6
- "version": "2.0.2",
3
+ "version": "3.0.0",
4
+ "description": "React split-pane component with hooks and TypeScript",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./keyboard": {
16
+ "types": "./dist/keyboard.d.ts",
17
+ "import": "./dist/keyboard.js",
18
+ "require": "./dist/keyboard.cjs"
19
+ },
20
+ "./persistence": {
21
+ "types": "./dist/persistence.d.ts",
22
+ "import": "./dist/persistence.js",
23
+ "require": "./dist/persistence.cjs"
24
+ },
25
+ "./styles.css": "./styles.css"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "styles.css"
30
+ ],
31
+ "sideEffects": false,
32
+ "scripts": {
33
+ "dev": "rollup -c -w",
34
+ "build": "rollup -c && npm run build:types",
35
+ "build:types": "tsc --emitDeclarationOnly",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest",
38
+ "test:coverage": "vitest run --coverage",
39
+ "lint": "eslint src",
40
+ "format": "prettier --write src examples",
41
+ "format:check": "prettier --check src examples",
42
+ "typecheck": "tsc --noEmit",
43
+ "examples": "vite --config examples/vite.config.ts",
44
+ "examples:build": "vite build --config examples/vite.config.ts",
45
+ "prepublishOnly": "npm run test && npm run build"
46
+ },
7
47
  "repository": {
8
48
  "type": "git",
9
49
  "url": "https://github.com/tomkp/react-split-pane"
10
50
  },
11
- "license": "MIT",
12
- "bugs": {
13
- "url": "https://github.com/tomkp/react-split-pane"
14
- },
15
- "homepage": "https://github.com/tomkp/react-split-pane",
16
- "author": "tomkp <tom@tomkp.com>",
17
51
  "keywords": [
18
52
  "react",
19
53
  "react-component",
20
54
  "split-pane",
21
55
  "react-split-pane",
22
- "es6"
56
+ "typescript",
57
+ "hooks",
58
+ "resizable",
59
+ "panes",
60
+ "layout",
61
+ "accessibility"
23
62
  ],
24
- "dependencies": {
25
- "glamor": "^2.20.40",
26
- "glamorous": "^4.11.2",
27
- "inline-style-prefixer": "^4.0.0",
28
- "normalize.css": "^7.0.0",
29
- "styled-components": "^2.4.0",
30
- "prop-types": "^15.6.0",
31
- "react": "^16.2.0",
32
- "react-dom": "^16.2.0"
63
+ "author": "tomkp <tom@tomkp.com>",
64
+ "license": "MIT",
65
+ "peerDependencies": {
66
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
67
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
33
68
  },
34
69
  "devDependencies": {
35
- "babel-cli": "^6.26.0",
36
- "babel-plugin-add-module-exports": "^0.2.1",
37
- "babel-plugin-transform-object-assign": "^6.22.0",
38
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
39
- "babel-preset-es2015": "^6.24.1",
40
- "babel-preset-react": "^6.24.1",
41
- "babelify": "^8.0.0",
42
- "browserify": "^14.5.0",
43
- "chai": "^4.1.2",
44
- "chai-spies": "^0.7.1",
45
- "core-js": "^2.5.3",
46
- "coveralls": "^3.0.0",
47
- "express": "^4.16.2",
48
- "mochify": "^4.0.0",
49
- "mochify-istanbul": "^2.4.2",
50
- "prettier": "^1.9.2",
51
- "react": "^16.2.0",
52
- "react-dom": "^16.2.0",
53
- "sinon": "^5.0.7",
54
- "surge": "^0.19.0",
55
- "typescript": "^2.6.2",
56
- "watchify": "^3.9.0",
57
- "@storybook/react": "^3.3.3",
58
- "@storybook/addon-actions": "^3.3.3",
59
- "@storybook/addon-links": "^3.3.3"
60
- },
61
- "scripts": {
62
- "compile": "babel -d lib/ src/",
63
- "compile:watch": "babel -w -d lib/ src/",
64
- "test": "npm run compile && mochify -R spec",
65
- "test:watch": "npm run compile:watch & mochify -R spec --watch",
66
- "test:coverage": "mochify --plugin [ mochify-istanbul --exclude '**/test/**' --report lcovonly ] && cat lcov.info | coveralls && rm lcov.info",
67
- "demo": "npm run compile && browserify demo/Examples.js -d -t -o demo/bundle.js",
68
- "demo:watch": "npm run compile:watch & watchify demo/Examples.js -d -t -o demo/bundle.js",
69
- "demo:publish": "npm run compile && browserify demo/Examples.js -d -t -o demo/bundle.js && surge demo react-split-pane-v2.surge.sh",
70
- "prettier": "prettier --single-quote --trailing-comma es5 --write './{src,test}/**/*.js'",
71
- "storybook": "start-storybook -p 6006",
72
- "build-storybook": "build-storybook",
73
- "release:patch": "npm test && npm version patch && git push && npm publish --tag next"
74
- },
75
- "browserify": {
76
- "transform": [
77
- [
78
- "babelify"
79
- ]
80
- ]
70
+ "@rollup/plugin-commonjs": "^29.0.0",
71
+ "@rollup/plugin-node-resolve": "^16.0.3",
72
+ "@rollup/plugin-terser": "^0.4.4",
73
+ "@rollup/plugin-typescript": "^12.3.0",
74
+ "@testing-library/dom": "^10.4.0",
75
+ "@testing-library/jest-dom": "^6.9.1",
76
+ "@testing-library/react": "^16.3.1",
77
+ "@testing-library/user-event": "^14.5.2",
78
+ "@types/react": "^18.3.27",
79
+ "@types/react-dom": "^18.3.7",
80
+ "@vitejs/plugin-react": "^4.7.0",
81
+ "@vitest/coverage-v8": "^4.0.16",
82
+ "eslint": "^9.39.2",
83
+ "globals": "^16.2.0",
84
+ "jsdom": "^26.1.0",
85
+ "prettier": "^3.7.4",
86
+ "react": "^18.3.1",
87
+ "react-dom": "^18.3.1",
88
+ "rollup": "^4.54.0",
89
+ "tslib": "^2.8.1",
90
+ "typescript": "^5.8.3",
91
+ "typescript-eslint": "^8.50.0",
92
+ "vite": "^6.3.5",
93
+ "vitest": "^4.0.16"
81
94
  },
82
- "false": {}
95
+ "engines": {
96
+ "node": ">=20.0.0"
97
+ }
83
98
  }
package/styles.css ADDED
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Default styles for react-split-pane v3
3
+ *
4
+ * You can import these styles or create your own.
5
+ *
6
+ * Customize by overriding CSS custom properties:
7
+ *
8
+ * .my-split-pane {
9
+ * --split-pane-divider-size: 8px;
10
+ * --split-pane-divider-color: #e0e0e0;
11
+ * --split-pane-focus-color: #ff5722;
12
+ * }
13
+ */
14
+
15
+ :root {
16
+ /* Divider dimensions */
17
+ --split-pane-divider-size: 11px;
18
+ --split-pane-divider-hit-area: 5px;
19
+
20
+ /* Divider colors */
21
+ --split-pane-divider-color: rgba(0, 0, 0, 0.05);
22
+ --split-pane-divider-color-hover: rgba(0, 0, 0, 0.15);
23
+
24
+ /* Focus state */
25
+ --split-pane-focus-color: #2196f3;
26
+ --split-pane-focus-bg: rgba(33, 150, 243, 0.1);
27
+
28
+ /* Animation */
29
+ --split-pane-transition-duration: 0.2s;
30
+ }
31
+
32
+ /* Dark theme defaults */
33
+ @media (prefers-color-scheme: dark) {
34
+ :root {
35
+ --split-pane-divider-color: rgba(255, 255, 255, 0.05);
36
+ --split-pane-divider-color-hover: rgba(255, 255, 255, 0.15);
37
+ }
38
+ }
39
+
40
+ .split-pane {
41
+ position: relative;
42
+ overflow: hidden;
43
+ }
44
+
45
+ .split-pane-pane {
46
+ position: relative;
47
+ overflow: auto;
48
+ }
49
+
50
+ .split-pane-divider {
51
+ position: relative;
52
+ z-index: 1;
53
+ box-sizing: border-box;
54
+ background-clip: padding-box;
55
+ background-color: var(--split-pane-divider-color);
56
+ transition: background-color var(--split-pane-transition-duration) ease;
57
+ }
58
+
59
+ .split-pane-divider:hover {
60
+ background-color: var(--split-pane-divider-color-hover);
61
+ }
62
+
63
+ .split-pane-divider:focus {
64
+ outline: 2px solid var(--split-pane-focus-color);
65
+ outline-offset: -2px;
66
+ background-color: var(--split-pane-focus-bg);
67
+ }
68
+
69
+ .split-pane-divider:focus:not(:focus-visible) {
70
+ outline: none;
71
+ }
72
+
73
+ /* Horizontal layout (vertical divider) */
74
+ .split-pane-divider.horizontal {
75
+ width: var(--split-pane-divider-size);
76
+ margin: 0 calc(var(--split-pane-divider-hit-area) * -1);
77
+ border-left: var(--split-pane-divider-hit-area) solid transparent;
78
+ border-right: var(--split-pane-divider-hit-area) solid transparent;
79
+ cursor: col-resize;
80
+ }
81
+
82
+
83
+ /* Vertical layout (horizontal divider) */
84
+ .split-pane-divider.vertical {
85
+ height: var(--split-pane-divider-size);
86
+ margin: calc(var(--split-pane-divider-hit-area) * -1) 0;
87
+ border-top: var(--split-pane-divider-hit-area) solid transparent;
88
+ border-bottom: var(--split-pane-divider-hit-area) solid transparent;
89
+ cursor: row-resize;
90
+ }
91
+
92
+
93
+ /* Minimal theme (1px divider) */
94
+ .split-pane-divider.minimal {
95
+ --split-pane-divider-size: 1px;
96
+ --split-pane-divider-hit-area: 0px;
97
+ --split-pane-divider-color: rgba(0, 0, 0, 0.12);
98
+ border: none;
99
+ margin: 0;
100
+ }
101
+
102
+ @media (prefers-color-scheme: dark) {
103
+ .split-pane-divider.minimal {
104
+ --split-pane-divider-color: rgba(255, 255, 255, 0.12);
105
+ }
106
+ }
package/.editorconfig DELETED
@@ -1,6 +0,0 @@
1
- # editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptLibraryMappings">
4
- <file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
5
- </component>
6
- </project>
package/.idea/misc.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="JSX" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
7
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/react-split-pane.iml" filepath="$PROJECT_DIR$/.idea/react-split-pane.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>