web-window-manager 1.0.7 → 1.0.9
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/LICENSE +21 -0
- package/README.md +102 -50
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Triston Armstrong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
+
<!-- PSA SECTION _____________________________ -->
|
|
2
|
+
|
|
1
3
|
# PSA
|
|
4
|
+
|
|
2
5
|
THIS PACKAGE IS NOT READY FOR USE IN YOUR PROJECTS
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
|
|
8
|
+
<!-- TODO SECTION _____________________________ -->
|
|
5
9
|
|
|
6
10
|
# TODO
|
|
11
|
+
|
|
7
12
|
- [x] Add appropriate readme boilerplate
|
|
8
13
|
- [ ] Add complete readme details
|
|
9
14
|
- [ ] Add examples
|
|
10
15
|
- [ ] abstract cache manager to new npm package
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
|
|
18
|
+
<!-- MAIN SECTION INTRO _____________________________ -->
|
|
13
19
|
|
|
14
20
|
# Web-Window-Manager
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
A Window Manger for managing the creation and deletion of windows/tabs within a web based application.
|
|
23
|
+
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
<!-- BADGES SECTION _____________________________ -->
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
## Badges
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
[](https://npm.im/npm)
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
[](https://github.com/Tarmstrong95/component-test-helper/actions/workflows/release-package.yml)
|
|
23
32
|
|
|
24
33
|
<div id="top"></div>
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
<hr/>
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
[![Forks][forks-shield]][forks-url]
|
|
30
|
-
[![Stargazers][stars-shield]][stars-url]
|
|
31
|
-
[![Issues][issues-shield]][issues-url]
|
|
32
|
-
[![MIT License][license-shield]][license-url]
|
|
33
|
-
[![LinkedIn][linkedin-shield]][linkedin-url]
|
|
37
|
+
<!-- TABLE OF CONTENTS SECTION _____________________________ -->
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
<br />
|
|
39
|
+
## Table Of Contents
|
|
37
40
|
|
|
38
|
-
<!-- TABLE OF CONTENTS -->
|
|
39
41
|
<details>
|
|
40
42
|
<summary>Table of Contents</summary>
|
|
41
43
|
<ol>
|
|
@@ -61,87 +63,137 @@ TODO: add release detials here
|
|
|
61
63
|
</ol>
|
|
62
64
|
</details>
|
|
63
65
|
|
|
64
|
-
<
|
|
66
|
+
<hr/>
|
|
65
67
|
|
|
66
|
-
<!-- ABOUT
|
|
68
|
+
<!-- ABOUT SECTION _____________________________ -->
|
|
67
69
|
|
|
68
70
|
## About The Project
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
This package allows developers to build applications that can open windows/tabs at an infinite depth (theoretically) and close all windows/tabs, based on some "event", that are "children" of the window/tab that triggered the event. This solves the problem some web applications have with persistence and ensuring all children are closed given various edge cases.
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
- EVENT: a button click, hot key, or anything else (fully customizable)
|
|
75
|
+
- CHILDREN: a window/tab that was opened by a given window/tab
|
|
76
|
+
|
|
77
|
+
<!-- BUILT WITH SECTION _____________________________ -->
|
|
73
78
|
|
|
74
79
|
### Built With
|
|
75
80
|
|
|
76
81
|
- [TypeScript](https://www.typescriptlang.org/)
|
|
82
|
+
- [Lodash](https://lodash.com/)
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
<!-- GETTING STARTED SECTION _____________________________ -->
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
<hr/>
|
|
81
87
|
|
|
82
88
|
## Getting Started
|
|
83
89
|
|
|
84
|
-
To get the
|
|
90
|
+
To get started with the `Web-Window-Manager`, you will need to have the following prerequisites installed:
|
|
85
91
|
|
|
86
|
-
|
|
92
|
+
- Node.js
|
|
93
|
+
- [npm](https://www.npmjs.com/) (comes with Node.js)
|
|
87
94
|
|
|
88
|
-
using
|
|
95
|
+
Once you have these prerequisites installed, you can proceed to install the Web-Window-Manager package using npm:
|
|
89
96
|
|
|
90
97
|
```bash
|
|
91
98
|
npm i web-window-manager
|
|
92
99
|
```
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
After installing the package, you can import and use it in your project as shown in the Usage section above.
|
|
102
|
+
|
|
103
|
+
<hr/>
|
|
95
104
|
|
|
96
|
-
<!-- USAGE
|
|
105
|
+
<!-- USAGE SECTION _____________________________ -->
|
|
97
106
|
|
|
98
107
|
## Usage
|
|
108
|
+
Import the Web-Window-Manager file into your entry file (e.g. app.tsx in a React project):
|
|
109
|
+
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
```typescript
|
|
112
|
+
import 'web-window-manager';
|
|
113
|
+
```
|
|
101
114
|
|
|
115
|
+
Replace any window.open() calls in your code with window.windowManager.open():
|
|
116
|
+
```typescript
|
|
117
|
+
// Before
|
|
118
|
+
window.open('https://www.example.com', '_blank');
|
|
102
119
|
|
|
103
|
-
|
|
120
|
+
// After
|
|
121
|
+
window.windowManager.open('https://www.example.com', '_blank');
|
|
122
|
+
```
|
|
104
123
|
|
|
105
|
-
|
|
124
|
+
This will use the Web-Window-Manager to open the new window/tab, allowing you to track and manage it within your application.
|
|
106
125
|
|
|
107
|
-
|
|
126
|
+
Add a simple React button with an onClick prop that calls window.windowManager.recursivelyCloseChildren() with a label of "Logout":
|
|
108
127
|
|
|
109
|
-
|
|
128
|
+
```javascript
|
|
129
|
+
import 'web-window-manager';
|
|
110
130
|
|
|
111
|
-
|
|
131
|
+
// Initialize the window manager with a custom event
|
|
132
|
+
const windowManager = new WebWindowManager('custom-event');
|
|
112
133
|
|
|
113
|
-
|
|
134
|
+
function App() {
|
|
135
|
+
return (
|
|
136
|
+
<button onClick={() => window.windowManager.recursivelyCloseChildren()}>
|
|
137
|
+
Logout
|
|
138
|
+
</button>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
114
141
|
|
|
115
|
-
|
|
142
|
+
```
|
|
116
143
|
|
|
117
|
-
|
|
118
|
-
Don't forget to give the project a star! Thanks again!
|
|
144
|
+
When the user clicks the "Logout" button, this will close all child windows/tabs that were opened by the current window/tab.
|
|
119
145
|
|
|
120
|
-
|
|
121
|
-
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
122
|
-
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
123
|
-
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
124
|
-
5. Open a Pull Request
|
|
146
|
+
For more detailed usage instructions and examples, please see the `Web-Window-Manager` documentation [examples](https://github.com/Tarmstrong95/WindowManger/tree/main/src/examples).
|
|
125
147
|
|
|
126
|
-
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
127
148
|
|
|
128
|
-
<!-- LICENSE -->
|
|
129
149
|
|
|
130
|
-
|
|
150
|
+
_See the [open issues](https://github.com/Tarmstrong95/WebWindowManager/issues) for a full list of proposed features (and known issues)._
|
|
131
151
|
|
|
132
|
-
|
|
152
|
+
<hr/>
|
|
153
|
+
|
|
154
|
+
<!-- ROADMAP SECTION _____________________________ -->
|
|
133
155
|
|
|
134
|
-
|
|
156
|
+
## Roadmap
|
|
135
157
|
|
|
136
|
-
|
|
158
|
+
1. The Web-Window-Manager package is still in development, and the following features are planned for future releases:
|
|
137
159
|
|
|
160
|
+
1. Abstract the cache manager to a separate npm package
|
|
161
|
+
Add more detailed examples and usage instructions in the readme
|
|
162
|
+
|
|
163
|
+
<hr/>
|
|
164
|
+
|
|
165
|
+
<!-- CONTRIBUTING SECTION _____________________________ -->
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
If you would like to contribute to the development of the Web-Window-Manager package, please follow these steps:
|
|
170
|
+
|
|
171
|
+
1. Fork the repository
|
|
172
|
+
2. Create a new branch for your changes (e.g. feature/new-feature)
|
|
173
|
+
3. Make your changes and commit them to your branch
|
|
174
|
+
4. Push your branch to your forked repository
|
|
175
|
+
5. Open a new pull request from your branch to the master branch of the original repository
|
|
176
|
+
|
|
177
|
+
<hr/>
|
|
178
|
+
<!-- LICENSE SECTION _____________________________ -->
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
Distributed under the MIT License. See `LICENSE.txt` for more information.
|
|
182
|
+
|
|
183
|
+
<hr/>
|
|
184
|
+
<!-- CONTACT SECTION _____________________________ -->
|
|
138
185
|
## Contact
|
|
139
186
|
|
|
140
187
|
Me - [@Triston08227721](https://twitter.com/Triston08227721) - triston95strong@gmail.com
|
|
141
188
|
|
|
142
189
|
Project Link: [https://github.com/Tarmstrong95/WebWindowManager](https://github.com/Tarmstrong95/WebWindowManager)
|
|
143
190
|
|
|
144
|
-
|
|
191
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
192
|
+
|
|
193
|
+
### Acknowledgments
|
|
194
|
+
|
|
195
|
+
- [Shields.io](https://shields.io/) for providing the badges used in the readme.
|
|
196
|
+
- [Lodash](https://lodash.com/) for providing the utility functions used in the package.
|
|
145
197
|
|
|
146
198
|
<!-- MARKDOWN LINKS & IMAGES -->
|
|
147
199
|
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
@@ -157,4 +209,4 @@ Project Link: [https://github.com/Tarmstrong95/WebWindowManager](https://github.
|
|
|
157
209
|
[license-shield]: https://img.shields.io/github/license/Tarmstrong95/WebWindowManager.svg?style=for-the-badge
|
|
158
210
|
[license-url]: https://github.com/Tarmstrong95/WebWindowManager/blob/main/LICENSE
|
|
159
211
|
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
|
|
160
|
-
[linkedin-url]: https://linkedin.com/in/triston95strong
|
|
212
|
+
[linkedin-url]: https://linkedin.com/in/triston95strong
|