tool-snippets 0.0.9 → 0.0.10
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/README.md +50 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
Для WebStorm и VS Code:
|
|
2
|
-
|
|
3
1
|
```markdown
|
|
4
2
|
# ToolSnippets
|
|
5
3
|
|
|
@@ -38,7 +36,7 @@ npm run SNIPPETS:vscode
|
|
|
38
36
|
|
|
39
37
|
## Использование
|
|
40
38
|
|
|
41
|
-
В редакторе начните вводить префикс сниппета (например `
|
|
39
|
+
В редакторе начните вводить префикс сниппета (например `tool-ts-debugger`, `tool-global-forEach`, `tool-ng-subscribe`) — IntelliSense предложит подстановку.
|
|
42
40
|
|
|
43
41
|
## Структура пакета
|
|
44
42
|
|
|
@@ -69,64 +67,63 @@ npm publish
|
|
|
69
67
|
|
|
70
68
|
- Node.js (для скриптов установки)
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
**1. Массивы / циклы**
|
|
75
|
-
- `tool#forEach`, `tool#switch`, `tool#switch_NEVER`
|
|
76
|
-
|
|
77
|
-
**2. Angular хуки**
|
|
78
|
-
- `tool_comp_1_ngOnChanges`, `tool_comp_2_ngOnInit`, `tool_comp_3_ngAfterViewInit`, `tool_comp_4_ngOnDestroy`
|
|
70
|
+
## Схема префиксов
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
- `tool___subscribe`, `tool___Injector`, `tool____ViewChild_Child`, `tool____ViewChild_Element`
|
|
72
|
+
Префикс = `tool-<группа>-<действие>`.
|
|
82
73
|
|
|
83
|
-
|
|
84
|
-
- `tool____get_set`, `tool____get_set@Input()`
|
|
74
|
+
### Группы
|
|
85
75
|
|
|
86
|
-
**
|
|
87
|
-
- `tool
|
|
76
|
+
**1. `tool-hook-*` — хуки жизненного цикла Angular**
|
|
77
|
+
- `tool-hook-onChanges`, `tool-hook-onInit`, `tool-hook-afterViewInit`, `tool-hook-onDestroy`
|
|
88
78
|
|
|
89
|
-
**
|
|
90
|
-
- `tool-
|
|
79
|
+
**2. `tool-ng-*` — Angular (DI, подписки, ViewChild, get/set)**
|
|
80
|
+
- `tool-ng-subscribe`, `tool-ng-injector`, `tool-ng-viewChild`, `tool-ng-viewChildEl`, `tool-ng-getset`, `tool-ng-getset-input`
|
|
91
81
|
|
|
92
|
-
**
|
|
93
|
-
- `
|
|
82
|
+
**3. `tool-type-*` — объявления типов (`type`, `interface`)**
|
|
83
|
+
- `tool-type-pickPartialOmit`, `tool-type-keyof`, `tool-type-nullable`, `tool-type-partial`, `tool-type-never`, `tool-type-readonly`
|
|
94
84
|
|
|
95
|
-
**
|
|
96
|
-
- `
|
|
85
|
+
**4. `tool-ts-*` — значения/выражения TS (`as const`, `Record`, `satisfies`, try, отладка)**
|
|
86
|
+
- `tool-ts-asConst`, `tool-ts-record`, `tool-ts-recordSatisfies`, `tool-ts-try`, `tool-ts-try-await`, `tool-ts-debugger`, `tool-ts-proxy-log`
|
|
97
87
|
|
|
98
|
-
**
|
|
99
|
-
- `tool
|
|
88
|
+
**5. `tool-global-*` — общее (массивы, ветвления, глобальные объекты, глобальные ошибки)**
|
|
89
|
+
- `tool-global-forEach`, `tool-global-switch`, `tool-global-switch-never`, `tool-global-window`, `tool-global-errors`
|
|
100
90
|
|
|
101
|
-
|
|
91
|
+
## Примеры сниппетов
|
|
102
92
|
|
|
103
93
|
| Префикс | Описание |
|
|
104
94
|
|---|---|
|
|
105
|
-
| `tool
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `tool-
|
|
115
|
-
| `tool-
|
|
116
|
-
| `tool-
|
|
117
|
-
| `tool
|
|
118
|
-
| `tool
|
|
119
|
-
| `tool
|
|
120
|
-
| `tool
|
|
121
|
-
| `tool
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `tool
|
|
128
|
-
| `tool
|
|
129
|
-
| `tool
|
|
130
|
-
| `tool
|
|
131
|
-
| `tool
|
|
132
|
-
| `tool
|
|
95
|
+
| `tool-hook-onChanges` | хук `ngOnChanges` |
|
|
96
|
+
| `tool-hook-onInit` | хук `ngOnInit` |
|
|
97
|
+
| `tool-hook-afterViewInit` | хук `ngAfterViewInit` |
|
|
98
|
+
| `tool-hook-onDestroy` | хук `ngOnDestroy` |
|
|
99
|
+
| `tool-ng-subscribe` | подписка на Observable с `takeUntil` |
|
|
100
|
+
| `tool-ng-injector` | сервис через `Injector` |
|
|
101
|
+
| `tool-ng-viewChild` | `@ViewChild` (компонент) |
|
|
102
|
+
| `tool-ng-viewChildEl` | `@ViewChild` (ElementRef) |
|
|
103
|
+
| `tool-ng-getset` | getter/setter |
|
|
104
|
+
| `tool-ng-getset-input` | getter/setter с `@Input()` |
|
|
105
|
+
| `tool-type-pickPartialOmit` | `Pick & Partial<Omit>` |
|
|
106
|
+
| `tool-type-keyof` | `keyof` |
|
|
107
|
+
| `tool-type-nullable` | `TNullable<T>` |
|
|
108
|
+
| `tool-type-partial` | `Partial<T>` |
|
|
109
|
+
| `tool-type-never` | `switch` + `never` (exhaustive check) |
|
|
110
|
+
| `tool-type-readonly` | interface с `readonly` |
|
|
111
|
+
| `tool-ts-asConst` | объект `as const` |
|
|
112
|
+
| `tool-ts-record` | `Record<K, V>` + `as const` |
|
|
113
|
+
| `tool-ts-recordSatisfies` | `as const satisfies Record` |
|
|
114
|
+
| `tool-ts-try` | блок `try-catch-finally` |
|
|
115
|
+
| `tool-ts-try-await` | tryCatch для promise |
|
|
116
|
+
| `tool-ts-debugger` | `debugger;` |
|
|
117
|
+
| `tool-ts-proxy-log` | Proxy-логирование изменений |
|
|
118
|
+
| `tool-global-forEach` | forEach по массиву |
|
|
119
|
+
| `tool-global-switch` | `switch` блок |
|
|
120
|
+
| `tool-global-switch-never` | `switch` + `never` |
|
|
121
|
+
| `tool-global-window` | declare global window |
|
|
122
|
+
| `tool-global-errors` | global error listeners |
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Изменения:
|
|
126
|
+
- В «Использование» примеры префиксов заменены на новые.
|
|
127
|
+
- Блок «Группы» переписан под `tool-hook-*`, `tool-ng-*`, `tool-type-*`, `tool-ts-*`, `tool-global-*` (5 групп вместо 9).
|
|
128
|
+
- Таблица примеров пересобрана под новые префиксы, порядок совпадает с группами.
|
|
129
|
+
- Добавлено короткое пояснение схемы `tool-<группа>-<действие>`.
|