react-broadcast-sync 1.6.0 → 1.9.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 (53) hide show
  1. package/README.md +83 -13
  2. package/dist/BroadcastProvider.d.ts +2 -1
  3. package/dist/index.cjs.js +1 -1
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +1 -1
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/types/types.d.ts +17 -0
  8. package/package.json +6 -1
  9. package/.eslintignore +0 -5
  10. package/.github/workflows/ci.yml +0 -61
  11. package/.github/workflows/release.yml +0 -39
  12. package/.husky/pre-commit +0 -5
  13. package/.nvmrc +0 -1
  14. package/.prettierignore +0 -4
  15. package/.prettierrc +0 -9
  16. package/.releaserc.json +0 -22
  17. package/CHANGELOG.md +0 -97
  18. package/assets/react-broadcast-sync-logo.png +0 -0
  19. package/commitlint.config.js +0 -3
  20. package/demo/react-broadcast-sync-demo/README.md +0 -130
  21. package/demo/react-broadcast-sync-demo/index.html +0 -14
  22. package/demo/react-broadcast-sync-demo/package-lock.json +0 -6379
  23. package/demo/react-broadcast-sync-demo/package.json +0 -42
  24. package/demo/react-broadcast-sync-demo/public/assets/react-broadcast-sync-demo-video.gif +0 -0
  25. package/demo/react-broadcast-sync-demo/public/assets/react-broadcast-sync-logo.png +0 -0
  26. package/demo/react-broadcast-sync-demo/src/App.tsx +0 -277
  27. package/demo/react-broadcast-sync-demo/src/components/Counter.tsx +0 -63
  28. package/demo/react-broadcast-sync-demo/src/components/TextSync.tsx +0 -61
  29. package/demo/react-broadcast-sync-demo/src/components/TodoList.tsx +0 -186
  30. package/demo/react-broadcast-sync-demo/src/hooks/useCounterBroadcast.ts +0 -96
  31. package/demo/react-broadcast-sync-demo/src/hooks/useTextBroadcast.ts +0 -37
  32. package/demo/react-broadcast-sync-demo/src/hooks/useTodoBroadcast.ts +0 -249
  33. package/demo/react-broadcast-sync-demo/src/main.tsx +0 -11
  34. package/demo/react-broadcast-sync-demo/src/theme.ts +0 -62
  35. package/demo/react-broadcast-sync-demo/tsconfig.json +0 -26
  36. package/demo/react-broadcast-sync-demo/tsconfig.node.json +0 -10
  37. package/demo/react-broadcast-sync-demo/vite.config.ts +0 -12
  38. package/eslint.config.js +0 -38
  39. package/jest.config.cjs +0 -9
  40. package/jest.setup.ts +0 -1
  41. package/rollup.config.mjs +0 -98
  42. package/src/BroadcastProvider.tsx +0 -28
  43. package/src/hooks/useBroadcastChannel.ts +0 -513
  44. package/src/index.ts +0 -9
  45. package/src/tests/BroadcastProvider.test.tsx +0 -157
  46. package/src/tests/debug.test.ts +0 -273
  47. package/src/tests/messageUtils.test.ts +0 -252
  48. package/src/tests/useBroadcastChannel.same-tab.test.tsx +0 -992
  49. package/src/tests/useBroadcastChannel.test.tsx +0 -1243
  50. package/src/types/types.ts +0 -124
  51. package/src/utils/debug.ts +0 -80
  52. package/src/utils/messageUtils.ts +0 -122
  53. package/tsconfig.json +0 -36
package/CHANGELOG.md DELETED
@@ -1,97 +0,0 @@
1
- # [1.6.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.5.1...v1.6.0) (2025-09-03)
2
-
3
-
4
- ### Features
5
-
6
- * improve error messaging for debug mode ([3a1016f](https://github.com/IdanShalem/react-broadcast-sync/commit/3a1016f45244f412eaa96d8ca8310b5ca72cd73a))
7
-
8
- ## [1.5.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.5.0...v1.5.1) (2025-07-03)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * added readme for batching ([568a52c](https://github.com/IdanShalem/react-broadcast-sync/commit/568a52c4d23443a1e4c2a0c2ab10a6c618c68529))
14
-
15
- # [1.5.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.4.0...v1.5.0) (2025-07-03)
16
-
17
-
18
- ### Features
19
-
20
- * batch messages with delay ([6dde9fa](https://github.com/IdanShalem/react-broadcast-sync/commit/6dde9fa441e2f5fc4745c00fdbabdf48f697d58b))
21
-
22
- # [1.4.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.3.0...v1.4.0) (2025-06-29)
23
-
24
-
25
- ### Features
26
-
27
- * ping for other sources ([794631a](https://github.com/IdanShalem/react-broadcast-sync/commit/794631ae118da61dd888b18ca3d960ae4869498d))
28
-
29
- # [1.3.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.2.1...v1.3.0) (2025-06-16)
30
-
31
-
32
- ### Features
33
-
34
- * added getLatestMessage and closeChannel methods ([2ca0c32](https://github.com/IdanShalem/react-broadcast-sync/commit/2ca0c320c6558fd4205a8965d364d49c07609e97))
35
-
36
- ## [1.2.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.2.0...v1.2.1) (2025-06-11)
37
-
38
-
39
- ### Bug Fixes
40
-
41
- * added unit testing for same tab scenarios ([5e3df1d](https://github.com/IdanShalem/react-broadcast-sync/commit/5e3df1deab456565a09f0dfda84b21b526f157ba))
42
-
43
- # [1.2.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.4...v1.2.0) (2025-06-08)
44
-
45
-
46
- ### Features
47
-
48
- * clearReceivedMessages and clearSentMessages improved logic ([92916d8](https://github.com/IdanShalem/react-broadcast-sync/commit/92916d80f3a79cadb2f34c11f3f9759f6d74f8b2))
49
-
50
- ## [1.1.4](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.3...v1.1.4) (2025-06-03)
51
-
52
-
53
- ### Bug Fixes
54
-
55
- * removed icon ([3488a8d](https://github.com/IdanShalem/react-broadcast-sync/commit/3488a8d9526e5561f5ffdd14dfcce5ebb20c6838))
56
-
57
- ## [1.1.3](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.2...v1.1.3) (2025-06-03)
58
-
59
-
60
- ### Bug Fixes
61
-
62
- * updated readme ([621d73b](https://github.com/IdanShalem/react-broadcast-sync/commit/621d73bc93c0b5538faf158e97a06696a8ad1f0e))
63
-
64
- ## [1.1.2](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.1...v1.1.2) (2025-06-03)
65
-
66
-
67
- ### Bug Fixes
68
-
69
- * added demo gif presentation ([23781aa](https://github.com/IdanShalem/react-broadcast-sync/commit/23781aa4b61ab30ae9c37fd2b017446bc9cf039e))
70
-
71
- ## [1.1.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.0...v1.1.1) (2025-06-03)
72
-
73
-
74
- ### Bug Fixes
75
-
76
- * fixed sync problem in counter demo app ([481bda7](https://github.com/IdanShalem/react-broadcast-sync/commit/481bda79f55b3b902861877d4446bc4adaa76941))
77
-
78
- # [1.1.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.0.0...v1.1.0) (2025-06-03)
79
-
80
-
81
- ### Features
82
-
83
- * added demo app deployment ([755bee2](https://github.com/IdanShalem/react-broadcast-sync/commit/755bee2c11bafcaa0653917bae8e288500f6dec6))
84
-
85
- # 1.0.0 (2025-05-30)
86
-
87
-
88
- ### Bug Fixes
89
-
90
- * update favicon path and remove duplicate link ([c6bb7d8](https://github.com/IdanShalem/react-broadcast-sync/commit/c6bb7d85f09e36eb2e3c5da71485c247bd29ba37))
91
- * updated readme and fixed ci ([56d76d0](https://github.com/IdanShalem/react-broadcast-sync/commit/56d76d0ee342cce9e29968e9fb8b0fe9ee8b89fd))
92
-
93
-
94
- ### Features
95
-
96
- * demo app ([0717637](https://github.com/IdanShalem/react-broadcast-sync/commit/07176372544f2c29ad184d8107fc176881397e5b))
97
- * fix ci flow ([3dfd575](https://github.com/IdanShalem/react-broadcast-sync/commit/3dfd575db288b2f1923859ccc2acc3d52de4c70c))
@@ -1,3 +0,0 @@
1
- export default {
2
- extends: ['@commitlint/config-conventional'],
3
- };
@@ -1,130 +0,0 @@
1
- # React Broadcast Sync Demo
2
-
3
- A showcase application demonstrating the capabilities of `react-broadcast-sync` - a library for synchronizing state across browser tabs.
4
-
5
- ## 🚀 Live Demo
6
-
7
- Check out the [live demo](https://react-broadcast-sync.vercel.app) to see the synchronization in action!
8
-
9
- ## 🎯 Features
10
-
11
- The demo showcases three main features:
12
-
13
- 1. **Counter Synchronization**
14
-
15
- - Real-time counter updates across tabs
16
- - Visual feedback for sync status
17
- - Smooth animations
18
-
19
- 2. **Text Synchronization**
20
-
21
- - Real-time text input sync
22
- - Multi-line support
23
- - Instant updates
24
-
25
- 3. **Todo List**
26
- - Synchronized todo items
27
- - Real-time hover effects
28
- - Scroll position sync
29
- - Completion status sync
30
- - Delete functionality
31
-
32
- ## 🛠️ Technologies Used
33
-
34
- - React 19
35
- - TypeScript
36
- - Material-UI
37
- - Framer Motion
38
- - Vite
39
-
40
- ## 🚀 Getting Started
41
-
42
- 1. Clone the repository:
43
-
44
- ```bash
45
- git clone https://github.com/IdanShalem/react-broadcast-sync.git
46
- cd react-broadcast-sync/demo/react-broadcast-sync-demo
47
- ```
48
-
49
- 2. Install dependencies:
50
-
51
- ```bash
52
- npm install
53
- ```
54
-
55
- 3. Start the development server:
56
-
57
- ```bash
58
- npm run dev
59
- ```
60
-
61
- 4. Open multiple browser tabs to see the synchronization in action!
62
-
63
- ## 📁 Project Structure
64
-
65
- ```
66
- src/
67
- ├── components/
68
- │ ├── Counter.tsx
69
- │ ├── TextSync.tsx
70
- │ └── TodoList.tsx
71
- ├── hooks/
72
- │ ├── useCounterBroadcast.ts
73
- │ ├── useTextBroadcast.ts
74
- │ └── useTodoBroadcast.ts
75
- ├── App.tsx
76
- ├── main.tsx
77
- └── theme.ts
78
- ```
79
-
80
- ## 💡 Implementation Details
81
-
82
- ### Counter Synchronization
83
-
84
- ```typescript
85
- const { messages, postMessage } = useBroadcastChannel('counter', {
86
- keepLatestMessage: true,
87
- namespace: 'demo-app',
88
- });
89
- ```
90
-
91
- ### Text Synchronization
92
-
93
- ```typescript
94
- const { messages, postMessage } = useBroadcastChannel('text', {
95
- keepLatestMessage: true,
96
- namespace: 'demo-app',
97
- });
98
- ```
99
-
100
- ### Todo List Synchronization
101
-
102
- ```typescript
103
- const { messages, postMessage } = useBroadcastChannel('todos', {
104
- keepLatestMessage: true,
105
- namespace: 'demo-app',
106
- });
107
- ```
108
-
109
- ## 🎨 UI/UX Features
110
-
111
- - Responsive design
112
- - Smooth animations
113
- - Visual feedback for sync status
114
- - Modern Material-UI components
115
- - Dark mode support
116
-
117
- ## 🤝 Contributing
118
-
119
- Contributions are welcome! Please feel free to submit a Pull Request.
120
-
121
- ## 📝 License
122
-
123
- This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
124
-
125
- ## 👥 Author
126
-
127
- Idan Shalem
128
-
129
- - GitHub: [@IdanShalem](https://github.com/IdanShalem)
130
- - LinkedIn: [Idan Shalem](https://www.linkedin.com/in/idan-shalem-3a1781169/)
@@ -1,14 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/png" href="/assets/react-broadcast-sync-logo.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>React Broadcast Sync Demo</title>
8
- </head>
9
-
10
- <body>
11
- <div id="root"></div>
12
- <script type="module" src="/src/main.tsx"></script>
13
- </body>
14
- </html>