@peter.naydenov/shortcuts 3.5.1 → 4.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.
- package/API.md +939 -0
- package/CODE_OF_CONDUCT.md +84 -0
- package/CONTRIBUTING.md +476 -0
- package/Changelog.md +30 -1
- package/How.to.create.plugins.md +929 -0
- package/Migration.guide.md +48 -0
- package/README.md +396 -24
- package/dist/main.d.ts +54 -2
- package/dist/methods/_normalizeWithPlugins.d.ts +63 -1
- package/dist/methods/_readShortcutWithPlugins.d.ts +8 -1
- package/dist/methods/_setupPlugin.d.ts +9 -0
- package/dist/methods/_systemAction.d.ts +8 -1
- package/dist/methods/changeContext.d.ts +8 -1
- package/dist/methods/index.d.ts +2 -0
- package/dist/methods/listShortcuts.d.ts +1 -16
- package/dist/methods/load.d.ts +8 -1
- package/dist/methods/unload.d.ts +8 -1
- package/dist/plugins/click/_findTarget.d.ts +9 -1
- package/dist/plugins/click/_listenDOM.d.ts +76 -3
- package/dist/plugins/click/_normalizeShortcutName.d.ts +7 -1
- package/dist/plugins/click/_registerShortcutEvents.d.ts +26 -0
- package/dist/plugins/click/index.d.ts +6 -5
- package/dist/plugins/form/_defaults.d.ts +13 -1
- package/dist/plugins/form/_listenDOM.d.ts +66 -3
- package/dist/plugins/form/_registerShortcutEvents.d.ts +95 -1
- package/dist/plugins/form/index.d.ts +2 -3
- package/dist/plugins/hover/_findTarget.d.ts +10 -0
- package/dist/plugins/hover/_listenDOM.d.ts +68 -0
- package/dist/plugins/hover/_normalizeShortcutName.d.ts +2 -0
- package/dist/plugins/hover/_registerShortcutEvents.d.ts +28 -0
- package/dist/plugins/hover/index.d.ts +14 -0
- package/dist/plugins/key/_listenDOM.d.ts +61 -3
- package/dist/plugins/key/_registerShortcutEvents.d.ts +26 -0
- package/dist/plugins/key/_specialChars.d.ts +6 -31
- package/dist/plugins/key/index.d.ts +2 -3
- package/dist/plugins/scroll/_listenDOM.d.ts +58 -0
- package/dist/plugins/scroll/_normalizeShortcutName.d.ts +2 -0
- package/dist/plugins/scroll/_registerShortcutEvents.d.ts +28 -0
- package/dist/plugins/scroll/index.d.ts +16 -0
- package/dist/shortcuts.cjs +1 -1
- package/dist/shortcuts.esm.mjs +1 -1
- package/dist/shortcuts.umd.js +1 -1
- package/eslint.config.js +80 -0
- package/html/assets/index-COTh6lXR.css +1 -0
- package/html/assets/index-DOkKC3NI.js +53 -0
- package/html/bg.png +0 -0
- package/html/favicon.ico +0 -0
- package/html/favicon.svg +5 -0
- package/html/html.meta.json.gz +0 -0
- package/html/index.html +32 -0
- package/package.json +16 -12
- package/shortcuts.png +0 -0
- package/src/main.js +52 -22
- package/src/methods/_normalizeWithPlugins.js +26 -2
- package/src/methods/_readShortcutWithPlugins.js +9 -2
- package/src/methods/_setupPlugin.js +93 -0
- package/src/methods/_systemAction.js +12 -4
- package/src/methods/changeContext.js +11 -3
- package/src/methods/index.js +2 -0
- package/src/methods/listShortcuts.js +5 -12
- package/src/methods/load.js +11 -4
- package/src/methods/unload.js +8 -1
- package/src/plugins/click/_findTarget.js +11 -5
- package/src/plugins/click/_listenDOM.js +58 -20
- package/src/plugins/click/_normalizeShortcutName.js +11 -4
- package/src/plugins/click/_readClickEvent.js +1 -1
- package/src/plugins/click/_registerShortcutEvents.js +33 -5
- package/src/plugins/click/index.js +34 -51
- package/src/plugins/form/_defaults.js +13 -3
- package/src/plugins/form/_listenDOM.js +46 -9
- package/src/plugins/form/_normalizeShortcutName.js +2 -2
- package/src/plugins/form/_registerShortcutEvents.js +93 -17
- package/src/plugins/form/index.js +26 -47
- package/src/plugins/hover/_findTarget.js +26 -0
- package/src/plugins/hover/_listenDOM.js +154 -0
- package/src/plugins/hover/_normalizeShortcutName.js +21 -0
- package/src/plugins/hover/_registerShortcutEvents.js +51 -0
- package/src/plugins/hover/index.js +71 -0
- package/src/plugins/key/_listenDOM.js +67 -33
- package/src/plugins/key/_normalizeShortcutName.js +4 -3
- package/src/plugins/key/_readKeyEvent.js +1 -1
- package/src/plugins/key/_registerShortcutEvents.js +34 -5
- package/src/plugins/key/_specialChars.js +5 -0
- package/src/plugins/key/index.js +35 -50
- package/src/plugins/scroll/_listenDOM.js +141 -0
- package/src/plugins/scroll/_normalizeShortcutName.js +21 -0
- package/src/plugins/scroll/_registerShortcutEvents.js +50 -0
- package/src/plugins/scroll/index.js +61 -0
- package/test/01-general.test.js +92 -23
- package/test/02-key.test.js +241 -40
- package/test/03-click.test.js +291 -47
- package/test/04-form.test.js +241 -47
- package/test/05-hover.test.js +463 -0
- package/test/06-scroll.test.js +374 -0
- package/test-helpers/Block.jsx +3 -2
- package/test-helpers/style.css +6 -1
- package/vitest.config.js +13 -11
- package/How..to.make.plugins.md +0 -41
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of:
|
|
6
|
+
|
|
7
|
+
- Age, body size, disability, ethnicity, gender identity and expression
|
|
8
|
+
- Level of experience, education, socioeconomic status, nationality, personal appearance
|
|
9
|
+
- Race, religion, or sexual identity and orientation
|
|
10
|
+
|
|
11
|
+
## Our Standards
|
|
12
|
+
|
|
13
|
+
**Positive behavior that contributes to a welcoming environment:**
|
|
14
|
+
|
|
15
|
+
- Using welcoming and inclusive language
|
|
16
|
+
- Being respectful of differing viewpoints and experiences
|
|
17
|
+
- Gracefully accepting constructive criticism
|
|
18
|
+
- Focusing on what is best for the community
|
|
19
|
+
- Showing empathy towards other community members
|
|
20
|
+
|
|
21
|
+
**Unacceptable behavior:**
|
|
22
|
+
|
|
23
|
+
- Harassment, trolling, or deliberate intimidation
|
|
24
|
+
- Publishing private information without explicit permission
|
|
25
|
+
- Any conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct. Project maintainers who do not follow the Code of Conduct may face temporary or permanent repercussions.
|
|
30
|
+
|
|
31
|
+
## Reporting Guidelines
|
|
32
|
+
|
|
33
|
+
If you experience or witness unacceptable behavior, please report it through one of the following channels:
|
|
34
|
+
|
|
35
|
+
**For public issues:**
|
|
36
|
+
- Create an issue with the "Code of Conduct" label
|
|
37
|
+
- Contact any project maintainer directly
|
|
38
|
+
|
|
39
|
+
**For private or sensitive matters:**
|
|
40
|
+
- Email: peter.naydenov@gmail.com
|
|
41
|
+
- GitHub: @PeterNaydenov
|
|
42
|
+
|
|
43
|
+
When reporting, please include:
|
|
44
|
+
- Description of the incident
|
|
45
|
+
- People involved (if applicable)
|
|
46
|
+
- Any relevant context or screenshots
|
|
47
|
+
- Your preferred resolution (if any)
|
|
48
|
+
|
|
49
|
+
## Enforcement Process
|
|
50
|
+
|
|
51
|
+
1. **Initial Review** - Maintainers will review the report within 48 hours
|
|
52
|
+
2. **Investigation** - We'll gather facts and speak with involved parties if needed
|
|
53
|
+
3. **Action** - We'll take appropriate action based on severity
|
|
54
|
+
4. **Follow-up** - We'll monitor the situation and ensure resolution
|
|
55
|
+
|
|
56
|
+
## Consequences
|
|
57
|
+
|
|
58
|
+
Unacceptable behavior may result in:
|
|
59
|
+
|
|
60
|
+
- **Warning** - For minor first offenses
|
|
61
|
+
- **Temporary suspension** - For repeated or serious offenses
|
|
62
|
+
- **Permanent ban** - For severe violations or repeated offenses after warnings
|
|
63
|
+
|
|
64
|
+
## Scope
|
|
65
|
+
|
|
66
|
+
This Code of Conduct applies to:
|
|
67
|
+
|
|
68
|
+
- All project spaces (GitHub, Discord, email, etc.)
|
|
69
|
+
- Public and private interactions
|
|
70
|
+
- In-person events related to the project
|
|
71
|
+
|
|
72
|
+
## Attribution
|
|
73
|
+
|
|
74
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
75
|
+
|
|
76
|
+
For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
**Contact for enforcement issues:**
|
|
81
|
+
- Email: peter.naydenov@gmail.com
|
|
82
|
+
- GitHub: @PeterNaydenov
|
|
83
|
+
|
|
84
|
+
**Last updated:** November 2025
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
# Contributing to @peter.naydenov/shortcuts
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the shortcuts library! This document provides guidelines and information for contributors.
|
|
4
|
+
|
|
5
|
+
## 🤝 Code of Conduct
|
|
6
|
+
|
|
7
|
+
### Our Pledge
|
|
8
|
+
|
|
9
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of:
|
|
10
|
+
|
|
11
|
+
- Age, body size, disability, ethnicity, gender identity and expression
|
|
12
|
+
- Level of experience, education, socioeconomic status, nationality, personal appearance
|
|
13
|
+
- Race, religion, or sexual identity and orientation
|
|
14
|
+
|
|
15
|
+
### Our Standards
|
|
16
|
+
|
|
17
|
+
**Positive behavior that contributes to a welcoming environment:**
|
|
18
|
+
- Using welcoming and inclusive language
|
|
19
|
+
- Being respectful of differing viewpoints and experiences
|
|
20
|
+
- Gracefully accepting constructive criticism
|
|
21
|
+
- Focusing on what is best for the community
|
|
22
|
+
- Showing empathy towards other community members
|
|
23
|
+
|
|
24
|
+
**Unacceptable behavior:**
|
|
25
|
+
- Harassment, trolling, or deliberate intimidation
|
|
26
|
+
- Publishing private information without explicit permission
|
|
27
|
+
- Any conduct which could reasonably be considered inappropriate in a professional setting
|
|
28
|
+
|
|
29
|
+
### Enforcement
|
|
30
|
+
|
|
31
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct. Project maintainers who do not follow the Code of Conduct may face temporary or permanent repercussions.
|
|
32
|
+
|
|
33
|
+
**Contact for enforcement issues:**
|
|
34
|
+
- Email: peter.naydenov@gmail.com
|
|
35
|
+
- GitHub: @PeterNaydenov
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## 🚀 Getting Started
|
|
41
|
+
|
|
42
|
+
### Prerequisites
|
|
43
|
+
|
|
44
|
+
- Node.js 16 or higher
|
|
45
|
+
- Git
|
|
46
|
+
- Basic knowledge of JavaScript
|
|
47
|
+
- Familiarity with DOM events and browser APIs
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Development Setup
|
|
51
|
+
|
|
52
|
+
1. **Fork the repository**
|
|
53
|
+
```bash
|
|
54
|
+
# Fork on GitHub, then clone your fork
|
|
55
|
+
git clone https://github.com/PeterNaydenov/shortcuts.git
|
|
56
|
+
cd shortcuts
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **Install dependencies**
|
|
60
|
+
```bash
|
|
61
|
+
npm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. **Start development server**
|
|
65
|
+
```bash
|
|
66
|
+
npm run dev
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. **Run tests to verify setup**
|
|
70
|
+
```bash
|
|
71
|
+
npm test
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Project Structure
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
shortcuts/
|
|
78
|
+
├── src/ # Source code
|
|
79
|
+
│ ├── methods/ # Core library methods
|
|
80
|
+
│ ├── plugins/ # Plugin implementations
|
|
81
|
+
│ └── main.js # Main entry point
|
|
82
|
+
├── test/ # Test files
|
|
83
|
+
├── test-helpers/ # Test utilities
|
|
84
|
+
└── dist/ # Built distribution files
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## 📝 Contribution Types
|
|
92
|
+
|
|
93
|
+
### Bug Reports
|
|
94
|
+
|
|
95
|
+
Before creating a bug report, please check:
|
|
96
|
+
|
|
97
|
+
1. **Existing issues** - Search for similar issues
|
|
98
|
+
2. **Latest version** - Ensure you're using the latest version
|
|
99
|
+
3. **Minimal reproduction** - Create a minimal test case
|
|
100
|
+
|
|
101
|
+
**Bug report template:**
|
|
102
|
+
```markdown
|
|
103
|
+
## Bug Description
|
|
104
|
+
Brief description of the issue
|
|
105
|
+
|
|
106
|
+
## Steps to Reproduce
|
|
107
|
+
1. Step one
|
|
108
|
+
2. Step two
|
|
109
|
+
3. Step three
|
|
110
|
+
|
|
111
|
+
## Expected Behavior
|
|
112
|
+
What should happen
|
|
113
|
+
|
|
114
|
+
## Actual Behavior
|
|
115
|
+
What actually happens
|
|
116
|
+
|
|
117
|
+
## Environment
|
|
118
|
+
- OS: [e.g., Windows 11, macOS 13.0]
|
|
119
|
+
- Browser: [e.g., Chrome 119, Firefox 118]
|
|
120
|
+
- Library version: [e.g., 3.5.2]
|
|
121
|
+
|
|
122
|
+
## Additional Context
|
|
123
|
+
Any other relevant information
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Feature Requests
|
|
127
|
+
|
|
128
|
+
**Feature request template:**
|
|
129
|
+
```markdown
|
|
130
|
+
## Feature Description
|
|
131
|
+
Clear description of the proposed feature
|
|
132
|
+
|
|
133
|
+
## Problem Statement
|
|
134
|
+
What problem does this feature solve?
|
|
135
|
+
|
|
136
|
+
## Proposed Solution
|
|
137
|
+
How should this feature work?
|
|
138
|
+
|
|
139
|
+
## Alternatives Considered
|
|
140
|
+
What other approaches did you consider?
|
|
141
|
+
|
|
142
|
+
## Additional Context
|
|
143
|
+
Any other relevant information
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Code Contributions
|
|
149
|
+
|
|
150
|
+
#### Development Workflow
|
|
151
|
+
|
|
152
|
+
1. **Create a feature branch**
|
|
153
|
+
```bash
|
|
154
|
+
git checkout -b feature/your-feature-name
|
|
155
|
+
# or
|
|
156
|
+
git checkout -b fix/your-bug-fix
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
2. **Make your changes**
|
|
160
|
+
- Follow existing code style and patterns
|
|
161
|
+
- Add tests for new functionality
|
|
162
|
+
- Update documentation if needed
|
|
163
|
+
|
|
164
|
+
3. **Run quality checks**
|
|
165
|
+
```bash
|
|
166
|
+
npm run lint # Check code style
|
|
167
|
+
npm run test # Run all tests
|
|
168
|
+
npm run test:coverage # Check test coverage
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
4. **Commit your changes**
|
|
172
|
+
```bash
|
|
173
|
+
git add .
|
|
174
|
+
git commit -m "feat: add new plugin feature"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
5. **Push and create PR**
|
|
178
|
+
```bash
|
|
179
|
+
git push origin feature/your-feature-name
|
|
180
|
+
# Create pull request on GitHub
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Commit Message Convention
|
|
184
|
+
|
|
185
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
<type>[optional scope]: <description>
|
|
189
|
+
|
|
190
|
+
[optional body]
|
|
191
|
+
|
|
192
|
+
[optional footer(s)]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Types:**
|
|
196
|
+
- `feat`: New feature
|
|
197
|
+
- `fix`: Bug fix
|
|
198
|
+
- `docs`: Documentation changes
|
|
199
|
+
- `style`: Code style changes (formatting, etc.)
|
|
200
|
+
- `refactor`: Code refactoring
|
|
201
|
+
- `test`: Adding or updating tests
|
|
202
|
+
- `chore`: Maintenance tasks
|
|
203
|
+
|
|
204
|
+
**Examples:**
|
|
205
|
+
```
|
|
206
|
+
feat(click): add support for multiple target attributes
|
|
207
|
+
fix(hover): resolve hover detection on nested elements
|
|
208
|
+
docs: update API documentation for v4.0.0
|
|
209
|
+
test: add coverage for scroll plugin edge cases
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 🧪 Testing Guidelines
|
|
213
|
+
|
|
214
|
+
### Test Requirements
|
|
215
|
+
|
|
216
|
+
- **Unit tests** for all new functions
|
|
217
|
+
- **Integration tests** for plugin interactions
|
|
218
|
+
- **Browser tests** for DOM-related functionality
|
|
219
|
+
- **Minimum 80% code coverage** for new code
|
|
220
|
+
|
|
221
|
+
### Test Structure
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
// test/07-your-plugin.test.js
|
|
225
|
+
import { beforeEach, afterEach, describe, it, test, expect } from 'vitest'
|
|
226
|
+
import { shortcuts, pluginYourPlugin } from '../src/main.js'
|
|
227
|
+
|
|
228
|
+
describe('YourPlugin', () => {
|
|
229
|
+
let short
|
|
230
|
+
|
|
231
|
+
beforeEach(() => {
|
|
232
|
+
short = shortcuts()
|
|
233
|
+
short.enablePlugin(pluginYourPlugin)
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
afterEach(() => {
|
|
237
|
+
short.reset()
|
|
238
|
+
short.disablePlugin('yourPlugin')
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
it('should register shortcuts correctly', () => {
|
|
242
|
+
// Test implementation
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
it('should handle events properly', () => {
|
|
246
|
+
// Test implementation
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Running Tests
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# Run all tests
|
|
255
|
+
npm test
|
|
256
|
+
|
|
257
|
+
# Run tests in watch mode
|
|
258
|
+
npm run test:watch
|
|
259
|
+
|
|
260
|
+
# Run tests with coverage
|
|
261
|
+
npm run test:coverage
|
|
262
|
+
|
|
263
|
+
# Run specific test file
|
|
264
|
+
npm test 07-your-plugin.test.js
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## 📚 Documentation Contributions
|
|
268
|
+
|
|
269
|
+
### Types of Documentation
|
|
270
|
+
|
|
271
|
+
1. **Code Documentation** - JSDoc comments in source code
|
|
272
|
+
2. **API Documentation** - Technical API reference
|
|
273
|
+
3. **User Documentation** - README, examples, tutorials
|
|
274
|
+
4. **Developer Documentation** - Plugin development guides
|
|
275
|
+
|
|
276
|
+
### Documentation Standards
|
|
277
|
+
|
|
278
|
+
- **Clear and concise** language
|
|
279
|
+
- **Code examples** for all major features
|
|
280
|
+
- **Consistent formatting** with existing docs
|
|
281
|
+
- **Cross-references** to related topics
|
|
282
|
+
|
|
283
|
+
### Plugin Documentation
|
|
284
|
+
|
|
285
|
+
When creating a new plugin, include:
|
|
286
|
+
|
|
287
|
+
1. **Plugin purpose and use cases**
|
|
288
|
+
2. **Installation instructions**
|
|
289
|
+
3. **Configuration options**
|
|
290
|
+
4. **API reference**
|
|
291
|
+
5. **Usage examples**
|
|
292
|
+
6. **Migration guide** (if breaking changes)
|
|
293
|
+
|
|
294
|
+
## 🔧 Plugin Development
|
|
295
|
+
|
|
296
|
+
### Plugin Requirements
|
|
297
|
+
|
|
298
|
+
1. **Follow standard plugin structure**
|
|
299
|
+
2. **Implement required methods** (`getPrefix`, `shortcutName`, etc.)
|
|
300
|
+
3. **Handle edge cases** gracefully
|
|
301
|
+
4. **Provide comprehensive tests**
|
|
302
|
+
5. **Include TypeScript definitions**
|
|
303
|
+
|
|
304
|
+
### Plugin Structure
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
// src/plugins/yourPlugin/index.js
|
|
308
|
+
import _normalizeShortcutName from './_normalizeShortcutName.js'
|
|
309
|
+
import _registerShortcutEvents from './_registerShortcutEvents.js'
|
|
310
|
+
import _listenDOM from './_listenDOM.js'
|
|
311
|
+
|
|
312
|
+
function pluginYourPlugin(setupPlugin, options = {}) {
|
|
313
|
+
const deps = {
|
|
314
|
+
regex: /YOUR_PLUGIN:.+/i,
|
|
315
|
+
// ... other dependencies
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const pluginState = {
|
|
319
|
+
active: false,
|
|
320
|
+
defaultOptions: {
|
|
321
|
+
// Default configuration
|
|
322
|
+
},
|
|
323
|
+
listenOptions: {},
|
|
324
|
+
// ... plugin-specific state
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function resetState() {
|
|
328
|
+
// Cleanup logic
|
|
329
|
+
}
|
|
330
|
+
deps.resetState = resetState
|
|
331
|
+
|
|
332
|
+
return setupPlugin({
|
|
333
|
+
prefix: 'yourPlugin',
|
|
334
|
+
_normalizeShortcutName,
|
|
335
|
+
_registerShortcutEvents,
|
|
336
|
+
_listenDOM,
|
|
337
|
+
pluginState,
|
|
338
|
+
deps
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export default pluginYourPlugin
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## 📋 Pull Request Process
|
|
346
|
+
|
|
347
|
+
### Before Submitting
|
|
348
|
+
|
|
349
|
+
1. **Code Quality**
|
|
350
|
+
- [ ] Code follows project style guidelines
|
|
351
|
+
- [ ] All tests pass
|
|
352
|
+
- [ ] Test coverage is maintained or improved
|
|
353
|
+
- [ ] Documentation is updated
|
|
354
|
+
|
|
355
|
+
2. **Functionality**
|
|
356
|
+
- [ ] Feature works as expected
|
|
357
|
+
- [ ] No breaking changes (unless documented)
|
|
358
|
+
- [ ] Backward compatibility maintained
|
|
359
|
+
|
|
360
|
+
3. **Documentation**
|
|
361
|
+
- [ ] README updated if needed
|
|
362
|
+
- [ ] API docs updated
|
|
363
|
+
- [ ] Examples provided for new features
|
|
364
|
+
|
|
365
|
+
### Pull Request Template
|
|
366
|
+
|
|
367
|
+
```markdown
|
|
368
|
+
## Description
|
|
369
|
+
Brief description of changes
|
|
370
|
+
|
|
371
|
+
## Type of Change
|
|
372
|
+
- [ ] Bug fix
|
|
373
|
+
- [ ] New feature
|
|
374
|
+
- [ ] Breaking change
|
|
375
|
+
- [ ] Documentation update
|
|
376
|
+
|
|
377
|
+
## Testing
|
|
378
|
+
- [ ] All tests pass
|
|
379
|
+
- [ ] New tests added for new functionality
|
|
380
|
+
- [ ] Manual testing completed
|
|
381
|
+
|
|
382
|
+
## Checklist
|
|
383
|
+
- [ ] Code follows style guidelines
|
|
384
|
+
- [ ] Self-review completed
|
|
385
|
+
- [ ] Documentation updated
|
|
386
|
+
- [ ] No breaking changes (or documented)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Review Process
|
|
390
|
+
|
|
391
|
+
1. **Automated checks** - CI/CD pipeline runs tests
|
|
392
|
+
2. **Code review** - Maintainer review for quality and standards
|
|
393
|
+
3. **Testing** - Additional testing if needed
|
|
394
|
+
4. **Approval** - Merge after approval and checks pass
|
|
395
|
+
|
|
396
|
+
## ⚖️ Legal and Licensing
|
|
397
|
+
|
|
398
|
+
### Contributor License Agreement (CLA)
|
|
399
|
+
|
|
400
|
+
By contributing to this project, you agree that your contributions will be licensed under the same license as the project (MIT License).
|
|
401
|
+
|
|
402
|
+
### Intellectual Property
|
|
403
|
+
|
|
404
|
+
- Ensure you have rights to contribute the code
|
|
405
|
+
- Don't include proprietary or confidential information
|
|
406
|
+
- Respect third-party licenses and copyrights
|
|
407
|
+
- Attribute properly when using external code
|
|
408
|
+
|
|
409
|
+
### License Compliance
|
|
410
|
+
|
|
411
|
+
- All contributions must be compatible with MIT License
|
|
412
|
+
- Include license headers for significant files
|
|
413
|
+
- Document any third-party dependencies
|
|
414
|
+
- Keep license information up to date
|
|
415
|
+
|
|
416
|
+
## 🆘 Getting Help
|
|
417
|
+
|
|
418
|
+
### Communication Channels
|
|
419
|
+
|
|
420
|
+
- **GitHub Issues** - Bug reports and feature requests
|
|
421
|
+
- **GitHub Discussions** - General questions and community discussion
|
|
422
|
+
- **Email** - Private or security-related matters
|
|
423
|
+
|
|
424
|
+
### Resources
|
|
425
|
+
|
|
426
|
+
- [API Documentation](./API.md)
|
|
427
|
+
- [Plugin Development Guide](./How.to.create.plugins.md)
|
|
428
|
+
- [Migration Guide](./Migration.guide.md)
|
|
429
|
+
- [Examples](./EXAMPLES.md)
|
|
430
|
+
|
|
431
|
+
## 🏆 Recognition
|
|
432
|
+
|
|
433
|
+
### Contributor Recognition
|
|
434
|
+
|
|
435
|
+
- **Contributors list** in README
|
|
436
|
+
- **Release notes** mention significant contributors
|
|
437
|
+
- **GitHub badges** for active contributors
|
|
438
|
+
- **Community spotlight** in project updates
|
|
439
|
+
|
|
440
|
+
### Becoming a Maintainer
|
|
441
|
+
|
|
442
|
+
Active contributors who demonstrate:
|
|
443
|
+
- Consistent quality contributions
|
|
444
|
+
- Good understanding of the codebase
|
|
445
|
+
- Helpful community engagement
|
|
446
|
+
- Commitment to project goals
|
|
447
|
+
|
|
448
|
+
May be invited to become maintainers with merge access.
|
|
449
|
+
|
|
450
|
+
## 📈 Project Goals
|
|
451
|
+
|
|
452
|
+
### Current Focus Areas
|
|
453
|
+
|
|
454
|
+
1. **Plugin ecosystem expansion**
|
|
455
|
+
2. **Performance optimization**
|
|
456
|
+
3. **TypeScript improvements**
|
|
457
|
+
4. **Browser compatibility**
|
|
458
|
+
5. **Documentation enhancement**
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
### Long-term Vision
|
|
465
|
+
|
|
466
|
+
- Become the de facto standard for user interaction with the interface;
|
|
467
|
+
- Support for emerging input methods (touch, voice, etc.);
|
|
468
|
+
- Comprehensive plugin marketplace;
|
|
469
|
+
- Strong community-driven development;
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
Thank you for contributing to @peter.naydenov/shortcuts! Your contributions help make this project better for everyone.
|
|
474
|
+
|
|
475
|
+
**Last updated:** November 2025
|
|
476
|
+
**Version:** 4.0.0
|
package/Changelog.md
CHANGED
|
@@ -2,14 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
### 4.0.0 ( 2025-11-?? )
|
|
6
|
+
- [x] New plugin 'hover';
|
|
7
|
+
- [x] New plugin 'scroll';
|
|
8
|
+
- [x] Refactoring on plugin API. New method for building plugin interface;
|
|
9
|
+
- [x] API documentation;
|
|
10
|
+
- [x] Code: Plugin 'form' upgrade. Now you can take 'dependencies' on 'form:action' level. It's higher level that all declared actions can use. Minimize 'dependencies' declarations. Other named arguments are not available on top level;
|
|
11
|
+
- [x] Plugin 'click' has different parameters for maximum number of clicks for left and right mouse buttons;
|
|
12
|
+
- [x] Code: Plugin 'form' uses general app error event;
|
|
13
|
+
- [x] Code: Plugin 'form'. Event 'form:watch' has named argument 'dependencies';
|
|
14
|
+
- [x] Fix: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
15
|
+
- [x] Feature: Plugin 'click' parameter 'clickTarget' now accepts array of attribute names (default: ['data-click', 'href']);
|
|
16
|
+
- [x] Feature: Plugin 'hover' parameter 'hoverTarget' now accepts array of attribute names (default: ['data-hover']);
|
|
17
|
+
- [x] Documentation: Updated README.md and JSDoc comments to reflect array-based target attributes;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### 3.5.2 ( 2025-10-20 )
|
|
22
|
+
- [x] Types update;
|
|
23
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
24
|
+
|
|
25
|
+
|
|
5
26
|
### 3.5.1 ( 2025-10-20 )
|
|
6
27
|
- [x] Update in package.json. Field 'types' was added;
|
|
7
|
-
|
|
28
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
8
29
|
|
|
9
30
|
|
|
10
31
|
### 3.5.0 ( 2025-10-19)
|
|
11
32
|
- [x] Featire: New method 'listPlugins' to get list of enabled plugins;
|
|
12
33
|
- [x] Upgrade: Improvment of type definitions. New d.ts files were added;
|
|
34
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
13
35
|
|
|
14
36
|
|
|
15
37
|
|
|
@@ -24,6 +46,7 @@
|
|
|
24
46
|
- [x] Fix: Cleaning plugin-state variables on plugin stop;
|
|
25
47
|
- [x] Fix: Wrong plugin name detection in 'enablePlugin' method;
|
|
26
48
|
- [x] Fix: Custom events for plugins with works only with nomrmalized event-names. Fixed - event name normalization could be done from the enabled plugins;
|
|
49
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
27
50
|
|
|
28
51
|
|
|
29
52
|
|
|
@@ -32,6 +55,7 @@
|
|
|
32
55
|
- [ ] Bug: Cleaning plugin-state variables on plugin stop;
|
|
33
56
|
- [ ] Bug: Wrong plugin name detection in 'enablePlugin' method;
|
|
34
57
|
- [ ] Bug: Custom events for plugins with works only with nomrmalized event-names;
|
|
58
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
35
59
|
|
|
36
60
|
|
|
37
61
|
|
|
@@ -41,6 +65,8 @@
|
|
|
41
65
|
- [ ] Bug: Cleaning plugin-state variables on plugin stop;
|
|
42
66
|
- [ ] Bug: Wrong plugin name detection in 'enablePlugin' method;
|
|
43
67
|
- [ ] Bug: Custom events for plugins with works only with nomrmalized event-names;
|
|
68
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
69
|
+
|
|
44
70
|
|
|
45
71
|
|
|
46
72
|
### 3.2.1 ( 2025-08-15)
|
|
@@ -49,6 +75,8 @@
|
|
|
49
75
|
- [ ] Bug: Cleaning plugin-state variables on plugin stop;
|
|
50
76
|
- [ ] Bug: Wrong plugin name detection in 'enablePlugin' method;
|
|
51
77
|
- [ ] Bug: Custom events for plugins with works only with nomrmalized event-names;
|
|
78
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
79
|
+
|
|
52
80
|
|
|
53
81
|
|
|
54
82
|
### 3.2.0 ( 2025-08-15)
|
|
@@ -58,6 +86,7 @@
|
|
|
58
86
|
- [ ] Bug: Cleaning plugin-state variables on plugin stop;
|
|
59
87
|
- [ ] Bug: Wrong plugin name detection in 'enablePlugin' method;
|
|
60
88
|
- [ ] Bug: Custom events for plugins with works only with nomrmalized event-names;
|
|
89
|
+
- [ ] Bug: Plugin 'form' on event 'form:define' - argument should be a named argument;
|
|
61
90
|
|
|
62
91
|
|
|
63
92
|
|