taraskevizer 10.2.9 → 10.3.2

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/dist/bin.js CHANGED
@@ -7,7 +7,7 @@ process.argv.splice(0, 2);
7
7
  const firstArg = process.argv[0];
8
8
  if (firstArg) {
9
9
  if (firstArg === '-v' || firstArg === '--version') {
10
- printWithPrefix("10.2.9");
10
+ printWithPrefix("10.3.2");
11
11
  process.exit(0);
12
12
  }
13
13
  if (firstArg === '-h' || firstArg === '--help') {
@@ -5,7 +5,7 @@ import type { CallableDict } from '../types';
5
5
  * so {@link Alphabet.lower} should replace both
6
6
  * upper and lower case letters.
7
7
  */
8
- export type Alphabet = {
9
- lower: CallableDict;
10
- upper?: CallableDict;
8
+ export type Alphabet<LowerPattern = RegExp, UpperPattern = LowerPattern> = {
9
+ lower: CallableDict<LowerPattern>;
10
+ upper?: CallableDict<UpperPattern>;
11
11
  };
@@ -1,7 +1,7 @@
1
- export type Dict<T = RegExp> = readonly (readonly [T, string])[];
2
- export type CallableDict<T = RegExp> = {
1
+ export type Dict<Pattern = RegExp> = readonly (readonly [Pattern, string])[];
2
+ export type CallableDict<Pattern = RegExp> = {
3
3
  (value: string): string;
4
- value: Dict<T>;
4
+ value: Dict<Pattern>;
5
5
  };
6
6
  /**
7
7
  * Useful if you want to modify the dictionary.
@@ -9,4 +9,4 @@ export type CallableDict<T = RegExp> = {
9
9
  * Consider converting it to the type {@link Dict} or {@link CallableDict}
10
10
  * if you no longer need to modify it.
11
11
  */
12
- export type WritableDict<T = RegExp> = [T, string][];
12
+ export type WritableDict<Pattern = RegExp> = [Pattern, string][];
@@ -2,15 +2,8 @@ import type { Wrappers } from './wrappers';
2
2
  type ChangeableElement = HTMLElement & {
3
3
  seqNum: number;
4
4
  };
5
- type NodeList<T extends Node> = T[] | NodeListOf<T>;
6
5
  export declare const createInteractiveTags: ({ variable, letterH }?: Omit<Record<keyof Wrappers, string>, "fix">) => {
7
6
  update: (root: Element) => void;
8
7
  tryAlternate: (el: Element | ChangeableElement) => void;
9
8
  };
10
- export declare const apply: (elems: NodeList<ChangeableElement>) => void;
11
- /**
12
- * @param el non-changeable elements are ignored
13
- * @deprecated
14
- **/
15
- export declare const tryAlternate: (el: Element | ChangeableElement) => void;
16
9
  export {};
@@ -80,73 +80,3 @@ export const createInteractiveTags = ({ variable, letterH } = {
80
80
  },
81
81
  };
82
82
  };
83
- const changeList = [];
84
-
85
- export const apply = (elems) => {
86
- if (changeList.length > elems.length) {
87
- changeList.length = elems.length;
88
- }
89
- else {
90
- while (changeList.length < elems.length) {
91
- changeList.push(0);
92
- }
93
- }
94
- for (let i = 0; i < changeList.length; i++) {
95
- const el = elems[i];
96
- el.seqNum = i;
97
- if (changeList[i]) {
98
- switch (el.tagName) {
99
- case 'TARH':
100
- {
101
- applyG(el);
102
- }
103
- break;
104
- case 'TARL': {
105
- let data = el.dataset.l;
106
- if (data.includes(',')) {
107
- const dataArr = data.split(',');
108
- data = el.innerHTML;
109
- for (let j = 0; j < changeList[i]; ++j) {
110
- dataArr.push(data);
111
- data = dataArr.shift();
112
- }
113
- el.dataset.l = dataArr.join(',');
114
- }
115
- else {
116
- el.dataset.l = el.innerHTML;
117
- }
118
- el.innerHTML = data;
119
- }
120
- }
121
- }
122
- }
123
- };
124
-
125
- export const tryAlternate = (el) => {
126
- if ('seqNum' in el) {
127
- switch (el.tagName) {
128
- case 'TARH':
129
- {
130
- changeList[el.seqNum] = changeList[el.seqNum] ? 0 : 1;
131
- applyG(el);
132
- }
133
- break;
134
- case 'TARL': {
135
- let data = el.dataset.l;
136
- if (data.includes(',')) {
137
- const dataArr = data.split(',');
138
- dataArr.push(el.innerHTML);
139
- data = dataArr.shift();
140
- changeList[el.seqNum] =
141
- (changeList[el.seqNum] + 1) % (dataArr.length + 1);
142
- el.dataset.l = dataArr.join(',');
143
- }
144
- else {
145
- changeList[el.seqNum] = changeList[el.seqNum] ? 0 : 1;
146
- el.dataset.l = el.innerHTML;
147
- }
148
- el.innerHTML = data;
149
- }
150
- }
151
- }
152
- };
@@ -30,13 +30,13 @@ export const highlightDiff = (text, orig, isCyrillic, highlight) => {
30
30
  continue;
31
31
  }
32
32
  if (isCyrillic) {
33
- const word1 = word.replace(/ь/g, '');
33
+ const noSoftWord = word.replace(/ь/g, '');
34
34
  switch (oWord) {
35
- case word1:
35
+ case noSoftWord:
36
36
  text[i] = word.replace(/ь/g, highlight('ь'));
37
37
  continue;
38
- case word1 + 'ь':
39
- text[i] = word.slice(0, -1).replace(/ь/g, highlight('ь')) + 'ь';
38
+ case noSoftWord + 'ь':
39
+ text[i] = word.replace(/ь(?!$)/g, highlight('ь'));
40
40
  continue;
41
41
  }
42
42
  }
@@ -18,4 +18,4 @@ import type { TaraskStep } from '@/steps/types';
18
18
  * );
19
19
  * };
20
20
  */
21
- export declare const mutatingStep: <T extends object = object>(callback: (...args: Parameters<TaraskStep<T>>) => string) => TaraskStep<T>;
21
+ export declare const mutatingStep: <TStorage extends object = object>(callback: (...args: Parameters<TaraskStep<TStorage>>) => string) => TaraskStep<TStorage>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "10.2.9",
3
+ "version": "10.3.2",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
package/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 GooseOb
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.