@design-edito/tools 0.5.6 → 0.5.8
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/agnostic/arrays/index.d.ts +2 -2
- package/agnostic/arrays/index.js +2 -2
- package/agnostic/colors/index.d.ts +2 -2
- package/agnostic/colors/index.js +2 -2
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +10 -10
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +10 -10
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +2 -2
- package/agnostic/html/index.d.ts +1 -1
- package/agnostic/html/index.js +1 -1
- package/agnostic/index.d.ts +5 -4
- package/agnostic/index.js +5 -4
- package/agnostic/misc/index.d.ts +3 -3
- package/agnostic/misc/index.js +3 -3
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/objects/index.d.ts +2 -2
- package/agnostic/objects/index.js +2 -2
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/subtitles/index.d.ts +2 -0
- package/agnostic/subtitles/index.js +2 -0
- package/agnostic/subtitles/parse-srt/index.d.ts +17 -0
- package/agnostic/subtitles/parse-srt/index.js +67 -0
- package/agnostic/subtitles/parse-srt/index.test.d.ts +1 -0
- package/agnostic/subtitles/parse-srt/index.test.js +94 -0
- package/agnostic/subtitles/parse-srt/types.d.ts +22 -0
- package/agnostic/subtitles/parse-srt/types.js +1 -0
- package/agnostic/subtitles/srt-timecode-to-ms/index.d.ts +14 -0
- package/agnostic/subtitles/srt-timecode-to-ms/index.js +36 -0
- package/agnostic/subtitles/srt-timecode-to-ms/index.test.d.ts +1 -0
- package/agnostic/subtitles/srt-timecode-to-ms/index.test.js +44 -0
- package/components/BeforeAfter/index.controlled.d.ts +5 -4
- package/components/BeforeAfter/index.controlled.js +6 -6
- package/components/Drawer/index.d.ts +3 -1
- package/components/Drawer/index.js +5 -2
- package/components/Iframe/index.d.ts +4 -0
- package/components/Iframe/index.js +8 -1
- package/components/Input/index.d.ts +4 -0
- package/components/Input/index.js +9 -1
- package/components/ListLoader/index.controlled.d.ts +11 -3
- package/components/ListLoader/index.controlled.js +6 -3
- package/components/ListLoader/index.d.ts +1 -1
- package/components/ListLoader/index.js +2 -2
- package/components/ResizeObserver/index.d.ts +6 -1
- package/components/ResizeObserver/index.js +7 -2
- package/components/Scrllgngn/index.d.ts +37 -7
- package/components/Scrllgngn/index.js +81 -24
- package/components/Scrllgngn/styles.module.css +30 -5
- package/components/Scrllgngn/utils.d.ts +87 -4
- package/components/Scrllgngn/utils.js +142 -8
- package/components/ScrollListener/index.d.ts +12 -3
- package/components/ScrollListener/index.js +12 -3
- package/components/Select/index.d.ts +4 -0
- package/components/Select/index.js +9 -1
- package/components/Sequencer/index.d.ts +10 -1
- package/components/Sequencer/index.js +7 -3
- package/components/ShadowRoot/index.d.ts +4 -0
- package/components/ShadowRoot/index.js +5 -1
- package/components/Subtitles/index.d.ts +53 -62
- package/components/Subtitles/index.js +90 -158
- package/components/Subtitles/utils.d.ts +60 -0
- package/components/Subtitles/utils.js +76 -0
- package/components/Textarea/index.d.ts +4 -0
- package/components/Textarea/index.js +9 -1
- package/components/Video/index.controlled.d.ts +13 -2
- package/components/Video/index.controlled.js +37 -6
- package/components/Video/index.d.ts +47 -9
- package/components/Video/index.js +71 -20
- package/components/Video/utils.d.ts +14 -0
- package/components/Video/utils.js +18 -0
- package/components/index.d.ts +5 -5
- package/components/index.js +5 -5
- package/components/utils/types.d.ts +32 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/node/@aws-s3/storage/directory/index.d.ts +1 -1
- package/node/@aws-s3/storage/directory/index.js +1 -1
- package/node/@aws-s3/storage/file/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/index.js +1 -1
- package/node/@google-cloud/storage/directory/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.js +1 -1
- package/node/@google-cloud/storage/file/index.d.ts +3 -3
- package/node/@google-cloud/storage/file/index.js +3 -3
- package/node/cloud-storage/operations/index.d.ts +2 -2
- package/node/cloud-storage/operations/index.js +2 -2
- package/node/images/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +5 -5
- package/node/images/transform/operations/index.js +5 -5
- package/node/index.d.ts +1 -1
- package/node/index.js +1 -1
- package/node/sftp/file/index.d.ts +1 -1
- package/node/sftp/file/index.js +1 -1
- package/package.json +26 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
|
-
export * as isArrayOf from './is-array-of/index.js'
|
|
4
3
|
export * as make from './make/index.js'
|
|
5
|
-
export * as
|
|
4
|
+
export * as isArrayOf from './is-array-of/index.js'
|
|
6
5
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
+
export * as randomPick from './random-pick/index.js'
|
package/agnostic/arrays/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
|
-
export * as isArrayOf from './is-array-of/index.js'
|
|
4
3
|
export * as make from './make/index.js'
|
|
5
|
-
export * as
|
|
4
|
+
export * as isArrayOf from './is-array-of/index.js'
|
|
6
5
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
+
export * as randomPick from './random-pick/index.js'
|
|
@@ -4,9 +4,9 @@ export * as convert from './convert/index.js'
|
|
|
4
4
|
export * as distance from './distance/index.js'
|
|
5
5
|
export * as grayscale from './grayscale/index.js'
|
|
6
6
|
export * as invert from './invert/index.js'
|
|
7
|
-
export * as luminance from './luminance/index.js'
|
|
8
|
-
export * as lerp from './lerp/index.js'
|
|
9
7
|
export * as palette from './palette/index.js'
|
|
8
|
+
export * as lerp from './lerp/index.js'
|
|
10
9
|
export * as tidy from './tidy/index.js'
|
|
11
10
|
export * as rotate from './rotate/index.js'
|
|
12
11
|
export * as typechecks from './typechecks/index.js'
|
|
12
|
+
export * as luminance from './luminance/index.js'
|
package/agnostic/colors/index.js
CHANGED
|
@@ -4,9 +4,9 @@ export * as convert from './convert/index.js'
|
|
|
4
4
|
export * as distance from './distance/index.js'
|
|
5
5
|
export * as grayscale from './grayscale/index.js'
|
|
6
6
|
export * as invert from './invert/index.js'
|
|
7
|
-
export * as luminance from './luminance/index.js'
|
|
8
|
-
export * as lerp from './lerp/index.js'
|
|
9
7
|
export * as palette from './palette/index.js'
|
|
8
|
+
export * as lerp from './lerp/index.js'
|
|
10
9
|
export * as tidy from './tidy/index.js'
|
|
11
10
|
export * as rotate from './rotate/index.js'
|
|
12
11
|
export * as typechecks from './typechecks/index.js'
|
|
12
|
+
export * as luminance from './luminance/index.js'
|
package/agnostic/css/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as bem from './bem/index.js'
|
|
2
|
-
export * as clss from './clss/index.js'
|
|
3
2
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
3
|
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
4
|
+
export * as clss from './clss/index.js'
|
|
5
5
|
export * as scale from './scale/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
package/agnostic/css/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as bem from './bem/index.js'
|
|
2
|
-
export * as clss from './clss/index.js'
|
|
3
2
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
3
|
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
4
|
+
export * as clss from './clss/index.js'
|
|
5
5
|
export * as scale from './scale/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
export * as add from './add/index.js'
|
|
2
2
|
export * as addclass from './addclass/index.js'
|
|
3
3
|
export * as and from './and/index.js'
|
|
4
|
-
export * as append from './append/index.js'
|
|
5
|
-
export * as clone from './clone/index.js'
|
|
6
4
|
export * as at from './at/index.js'
|
|
5
|
+
export * as append from './append/index.js'
|
|
7
6
|
export * as call from './call/index.js'
|
|
8
7
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
8
|
+
export * as clone from './clone/index.js'
|
|
9
9
|
export * as equals from './equals/index.js'
|
|
10
10
|
export * as getattribute from './getattribute/index.js'
|
|
11
11
|
export * as getproperties from './getproperties/index.js'
|
|
12
|
-
export * as getproperty from './getproperty/index.js'
|
|
13
12
|
export * as hjparse from './hjparse/index.js'
|
|
13
|
+
export * as getproperty from './getproperty/index.js'
|
|
14
14
|
export * as hjstringify from './hjstringify/index.js'
|
|
15
|
-
export * as initialize from './initialize/index.js'
|
|
16
15
|
export * as if from './if/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as map from './map/index.js'
|
|
16
|
+
export * as initialize from './initialize/index.js'
|
|
19
17
|
export * as length from './length/index.js'
|
|
18
|
+
export * as map from './map/index.js'
|
|
20
19
|
export * as negate from './negate/index.js'
|
|
21
20
|
export * as notrailing from './notrailing/index.js'
|
|
21
|
+
export * as or from './or/index.js'
|
|
22
22
|
export * as pickrandom from './pickrandom/index.js'
|
|
23
23
|
export * as populate from './populate/index.js'
|
|
24
|
+
export * as join from './join/index.js'
|
|
24
25
|
export * as print from './print/index.js'
|
|
25
|
-
export * as or from './or/index.js'
|
|
26
26
|
export * as pusheach from './pusheach/index.js'
|
|
27
27
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
28
|
+
export * as push from './push/index.js'
|
|
28
29
|
export * as removeattribute from './removeattribute/index.js'
|
|
29
30
|
export * as removeclass from './removeclass/index.js'
|
|
30
|
-
export * as push from './push/index.js'
|
|
31
31
|
export * as renameproperty from './renameproperty/index.js'
|
|
32
32
|
export * as replace from './replace/index.js'
|
|
33
33
|
export * as select from './select/index.js'
|
|
34
|
-
export * as set from './set/index.js'
|
|
35
34
|
export * as setattribute from './setattribute/index.js'
|
|
35
|
+
export * as set from './set/index.js'
|
|
36
36
|
export * as setproperty from './setproperty/index.js'
|
|
37
37
|
export * as sorton from './sorton/index.js'
|
|
38
38
|
export * as split from './split/index.js'
|
|
@@ -48,5 +48,5 @@ export * as torecord from './torecord/index.js'
|
|
|
48
48
|
export * as toref from './toref/index.js'
|
|
49
49
|
export * as tostring from './tostring/index.js'
|
|
50
50
|
export * as totext from './totext/index.js'
|
|
51
|
-
export * as trim from './trim/index.js'
|
|
52
51
|
export * as transformselected from './transformselected/index.js'
|
|
52
|
+
export * as trim from './trim/index.js'
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
export * as add from './add/index.js'
|
|
2
2
|
export * as addclass from './addclass/index.js'
|
|
3
3
|
export * as and from './and/index.js'
|
|
4
|
-
export * as append from './append/index.js'
|
|
5
|
-
export * as clone from './clone/index.js'
|
|
6
4
|
export * as at from './at/index.js'
|
|
5
|
+
export * as append from './append/index.js'
|
|
7
6
|
export * as call from './call/index.js'
|
|
8
7
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
8
|
+
export * as clone from './clone/index.js'
|
|
9
9
|
export * as equals from './equals/index.js'
|
|
10
10
|
export * as getattribute from './getattribute/index.js'
|
|
11
11
|
export * as getproperties from './getproperties/index.js'
|
|
12
|
-
export * as getproperty from './getproperty/index.js'
|
|
13
12
|
export * as hjparse from './hjparse/index.js'
|
|
13
|
+
export * as getproperty from './getproperty/index.js'
|
|
14
14
|
export * as hjstringify from './hjstringify/index.js'
|
|
15
|
-
export * as initialize from './initialize/index.js'
|
|
16
15
|
export * as if from './if/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as map from './map/index.js'
|
|
16
|
+
export * as initialize from './initialize/index.js'
|
|
19
17
|
export * as length from './length/index.js'
|
|
18
|
+
export * as map from './map/index.js'
|
|
20
19
|
export * as negate from './negate/index.js'
|
|
21
20
|
export * as notrailing from './notrailing/index.js'
|
|
21
|
+
export * as or from './or/index.js'
|
|
22
22
|
export * as pickrandom from './pickrandom/index.js'
|
|
23
23
|
export * as populate from './populate/index.js'
|
|
24
|
+
export * as join from './join/index.js'
|
|
24
25
|
export * as print from './print/index.js'
|
|
25
|
-
export * as or from './or/index.js'
|
|
26
26
|
export * as pusheach from './pusheach/index.js'
|
|
27
27
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
28
|
+
export * as push from './push/index.js'
|
|
28
29
|
export * as removeattribute from './removeattribute/index.js'
|
|
29
30
|
export * as removeclass from './removeclass/index.js'
|
|
30
|
-
export * as push from './push/index.js'
|
|
31
31
|
export * as renameproperty from './renameproperty/index.js'
|
|
32
32
|
export * as replace from './replace/index.js'
|
|
33
33
|
export * as select from './select/index.js'
|
|
34
|
-
export * as set from './set/index.js'
|
|
35
34
|
export * as setattribute from './setattribute/index.js'
|
|
35
|
+
export * as set from './set/index.js'
|
|
36
36
|
export * as setproperty from './setproperty/index.js'
|
|
37
37
|
export * as sorton from './sorton/index.js'
|
|
38
38
|
export * as split from './split/index.js'
|
|
@@ -48,5 +48,5 @@ export * as torecord from './torecord/index.js'
|
|
|
48
48
|
export * as toref from './toref/index.js'
|
|
49
49
|
export * as tostring from './tostring/index.js'
|
|
50
50
|
export * as totext from './totext/index.js'
|
|
51
|
-
export * as trim from './trim/index.js'
|
|
52
51
|
export * as transformselected from './transformselected/index.js'
|
|
52
|
+
export * as trim from './trim/index.js'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export * as any from './any/index.js'
|
|
2
|
-
export * as boolean from './boolean/index.js'
|
|
3
2
|
export * as array from './array/index.js'
|
|
3
|
+
export * as boolean from './boolean/index.js'
|
|
4
4
|
export * as element from './element/index.js'
|
|
5
5
|
export * as get from './get/index.js'
|
|
6
6
|
export * as guess from './guess/index.js'
|
|
7
7
|
export * as null from './null/index.js'
|
|
8
8
|
export * as nodelist from './nodelist/index.js'
|
|
9
9
|
export * as number from './number/index.js'
|
|
10
|
-
export * as record from './record/index.js'
|
|
11
10
|
export * as ref from './ref/index.js'
|
|
11
|
+
export * as record from './record/index.js'
|
|
12
12
|
export * as string from './string/index.js'
|
|
13
13
|
export * as text from './text/index.js'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export * as any from './any/index.js'
|
|
2
|
-
export * as boolean from './boolean/index.js'
|
|
3
2
|
export * as array from './array/index.js'
|
|
3
|
+
export * as boolean from './boolean/index.js'
|
|
4
4
|
export * as element from './element/index.js'
|
|
5
5
|
export * as get from './get/index.js'
|
|
6
6
|
export * as guess from './guess/index.js'
|
|
7
7
|
export * as null from './null/index.js'
|
|
8
8
|
export * as nodelist from './nodelist/index.js'
|
|
9
9
|
export * as number from './number/index.js'
|
|
10
|
-
export * as record from './record/index.js'
|
|
11
10
|
export * as ref from './ref/index.js'
|
|
11
|
+
export * as record from './record/index.js'
|
|
12
12
|
export * as string from './string/index.js'
|
|
13
13
|
export * as text from './text/index.js'
|
package/agnostic/html/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as deepSelect from './deep-select/index.js'
|
|
2
|
-
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
3
2
|
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
4
3
|
export * as hyperJson from './hyper-json/index.js'
|
|
5
4
|
export * as insertNode from './insert-node/index.js'
|
|
5
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
6
6
|
export * as placeholders from './placeholders/index.js'
|
|
7
7
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
8
8
|
export * as selectorToElement from './selector-to-element/index.js'
|
package/agnostic/html/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as deepSelect from './deep-select/index.js'
|
|
2
|
-
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
3
2
|
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
4
3
|
export * as hyperJson from './hyper-json/index.js'
|
|
5
4
|
export * as insertNode from './insert-node/index.js'
|
|
5
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
6
6
|
export * as placeholders from './placeholders/index.js'
|
|
7
7
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
8
8
|
export * as selectorToElement from './selector-to-element/index.js'
|
package/agnostic/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export * as arrays from './arrays/index.js'
|
|
2
2
|
export * as booleans from './booleans/index.js'
|
|
3
|
-
export * as colors from './colors/index.js'
|
|
4
3
|
export * as css from './css/index.js'
|
|
5
4
|
export * as errors from './errors/index.js'
|
|
6
5
|
export * as html from './html/index.js'
|
|
7
|
-
export * as misc from './misc/index.js'
|
|
8
6
|
export * as numbers from './numbers/index.js'
|
|
7
|
+
export * as misc from './misc/index.js'
|
|
9
8
|
export * as objects from './objects/index.js'
|
|
9
|
+
export * as colors from './colors/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
|
-
export * as random from './random/index.js'
|
|
12
11
|
export * as regexps from './regexps/index.js'
|
|
12
|
+
export * as random from './random/index.js'
|
|
13
13
|
export * as sanitization from './sanitization/index.js'
|
|
14
14
|
export * as strings from './strings/index.js'
|
|
15
|
-
export * as
|
|
15
|
+
export * as subtitles from './subtitles/index.js'
|
|
16
16
|
export * as typescript from './typescript/index.js'
|
|
17
|
+
export * as time from './time/index.js'
|
package/agnostic/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export * as arrays from './arrays/index.js'
|
|
2
2
|
export * as booleans from './booleans/index.js'
|
|
3
|
-
export * as colors from './colors/index.js'
|
|
4
3
|
export * as css from './css/index.js'
|
|
5
4
|
export * as errors from './errors/index.js'
|
|
6
5
|
export * as html from './html/index.js'
|
|
7
|
-
export * as misc from './misc/index.js'
|
|
8
6
|
export * as numbers from './numbers/index.js'
|
|
7
|
+
export * as misc from './misc/index.js'
|
|
9
8
|
export * as objects from './objects/index.js'
|
|
9
|
+
export * as colors from './colors/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
|
-
export * as random from './random/index.js'
|
|
12
11
|
export * as regexps from './regexps/index.js'
|
|
12
|
+
export * as random from './random/index.js'
|
|
13
13
|
export * as sanitization from './sanitization/index.js'
|
|
14
14
|
export * as strings from './strings/index.js'
|
|
15
|
-
export * as
|
|
15
|
+
export * as subtitles from './subtitles/index.js'
|
|
16
16
|
export * as typescript from './typescript/index.js'
|
|
17
|
+
export * as time from './time/index.js'
|
package/agnostic/misc/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as assert from './assert/index.js'
|
|
2
|
-
export * as
|
|
2
|
+
export * as cast from './cast/index.js'
|
|
3
3
|
export * as crawler from './crawler/index.js'
|
|
4
4
|
export * as crossenv from './crossenv/index.js'
|
|
5
|
+
export * as connection from './connection/index.js'
|
|
5
6
|
export * as dataSize from './data-size/index.js'
|
|
6
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
7
8
|
export * as isNullish from './is-nullish/index.js'
|
|
8
|
-
export * as cast from './cast/index.js'
|
|
9
9
|
export * as logs from './logs/index.js'
|
|
10
10
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
|
-
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
11
|
export * as outcome from './outcome/index.js'
|
|
12
|
+
export * as normalizeExtension from './normalize-extension/index.js'
|
package/agnostic/misc/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as assert from './assert/index.js'
|
|
2
|
-
export * as
|
|
2
|
+
export * as cast from './cast/index.js'
|
|
3
3
|
export * as crawler from './crawler/index.js'
|
|
4
4
|
export * as crossenv from './crossenv/index.js'
|
|
5
|
+
export * as connection from './connection/index.js'
|
|
5
6
|
export * as dataSize from './data-size/index.js'
|
|
6
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
7
8
|
export * as isNullish from './is-nullish/index.js'
|
|
8
|
-
export * as cast from './cast/index.js'
|
|
9
9
|
export * as logs from './logs/index.js'
|
|
10
10
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
|
-
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
11
|
export * as outcome from './outcome/index.js'
|
|
12
|
+
export * as normalizeExtension from './normalize-extension/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as clamp from './clamp/index.js'
|
|
3
2
|
export * as approximateRational from './approximate-rational/index.js'
|
|
3
|
+
export * as clamp from './clamp/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
5
|
export * as interpolate from './interpolate/index.js'
|
|
6
6
|
export * as round from './round/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as clamp from './clamp/index.js'
|
|
3
2
|
export * as approximateRational from './approximate-rational/index.js'
|
|
3
|
+
export * as clamp from './clamp/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
5
|
export * as interpolate from './interpolate/index.js'
|
|
6
6
|
export * as round from './round/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
|
-
export * as enums from './enums/index.js'
|
|
3
2
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
|
-
export * as isRecord from './is-record/index.js'
|
|
5
3
|
export * as isObject from './is-object/index.js'
|
|
6
4
|
export * as recordFormat from './record-format/index.js'
|
|
5
|
+
export * as isRecord from './is-record/index.js'
|
|
7
6
|
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as enums from './enums/index.js'
|
|
8
8
|
export * as sortKeys from './sort-keys/index.js'
|
|
9
9
|
export * as validation from './validation/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
|
-
export * as enums from './enums/index.js'
|
|
3
2
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
|
-
export * as isRecord from './is-record/index.js'
|
|
5
3
|
export * as isObject from './is-object/index.js'
|
|
6
4
|
export * as recordFormat from './record-format/index.js'
|
|
5
|
+
export * as isRecord from './is-record/index.js'
|
|
7
6
|
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as enums from './enums/index.js'
|
|
8
8
|
export * as sortKeys from './sort-keys/index.js'
|
|
9
9
|
export * as validation from './validation/index.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
3
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as replaceAll from './replace-all/index.js'
|
|
4
5
|
export * as parseTable from './parse-table/index.js'
|
|
5
6
|
export * as splitTrim from './split-trim/index.js'
|
|
6
7
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
8
|
export * as trim from './trim/index.js'
|
|
8
|
-
export * as replaceAll from './replace-all/index.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
3
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as replaceAll from './replace-all/index.js'
|
|
4
5
|
export * as parseTable from './parse-table/index.js'
|
|
5
6
|
export * as splitTrim from './split-trim/index.js'
|
|
6
7
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
8
|
export * as trim from './trim/index.js'
|
|
8
|
-
export * as replaceAll from './replace-all/index.js'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SrtCue } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses an SRT subtitle file.
|
|
4
|
+
*
|
|
5
|
+
* Cues are delimited by blank lines, which is the format's only structural marker —
|
|
6
|
+
* reading line by line instead would leave the parser guessing, and a cue whose text
|
|
7
|
+
* is a bare number (`1914`) would read as the next cue's id.
|
|
8
|
+
*
|
|
9
|
+
* Line endings are normalised first, so a CRLF file — the format's de facto norm —
|
|
10
|
+
* parses like any other.
|
|
11
|
+
*
|
|
12
|
+
* @param rawSrt - The file's contents.
|
|
13
|
+
* @returns The cues that parsed, in file order. A block missing a usable timecode or
|
|
14
|
+
* any text is dropped rather than returned half-built, so the result never holds a
|
|
15
|
+
* cue a consumer has to check.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseSrt(rawSrt: string): SrtCue[];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { srtTimecodeToMs } from '../srt-timecode-to-ms/index.js';
|
|
2
|
+
/** Splits on the blank line that separates two cues, whatever the line endings were. */
|
|
3
|
+
const cueSeparatorRegexp = /\n[ \t]*\n/v;
|
|
4
|
+
const idRegexp = /^\d+$/v;
|
|
5
|
+
const cueArrow = '-->';
|
|
6
|
+
/** Reads `hh:mm:ss,mmm --> hh:mm:ss,mmm`, or nothing. */
|
|
7
|
+
function parseTimecodeLine(line) {
|
|
8
|
+
if (!line.includes(cueArrow))
|
|
9
|
+
return null;
|
|
10
|
+
const [rawStart = '', rawEnd = ''] = line.split(cueArrow);
|
|
11
|
+
const start = srtTimecodeToMs(rawStart);
|
|
12
|
+
const end = srtTimecodeToMs(rawEnd);
|
|
13
|
+
if (start === null || end === null)
|
|
14
|
+
return null;
|
|
15
|
+
return { start, end };
|
|
16
|
+
}
|
|
17
|
+
/** Turns one blank-line-delimited block into a cue, or drops it. */
|
|
18
|
+
function parseCue(block, fallbackId) {
|
|
19
|
+
const lines = block.split('\n');
|
|
20
|
+
const firstLine = lines[0];
|
|
21
|
+
if (firstLine === undefined)
|
|
22
|
+
return null;
|
|
23
|
+
// The id line is optional: some writers leave it out, and skipping it here is what
|
|
24
|
+
// lets the timecode line be found either way.
|
|
25
|
+
const hasIdLine = idRegexp.test(firstLine.trim());
|
|
26
|
+
const id = hasIdLine ? parseInt(firstLine.trim(), 10) : fallbackId;
|
|
27
|
+
const rest = hasIdLine ? lines.slice(1) : lines;
|
|
28
|
+
const timecodeLine = rest[0];
|
|
29
|
+
if (timecodeLine === undefined)
|
|
30
|
+
return null;
|
|
31
|
+
const timecode = parseTimecodeLine(timecodeLine);
|
|
32
|
+
if (timecode === null)
|
|
33
|
+
return null;
|
|
34
|
+
const content = rest.slice(1).join('\n').trim();
|
|
35
|
+
if (content === '')
|
|
36
|
+
return null;
|
|
37
|
+
return { id, ...timecode, content };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parses an SRT subtitle file.
|
|
41
|
+
*
|
|
42
|
+
* Cues are delimited by blank lines, which is the format's only structural marker —
|
|
43
|
+
* reading line by line instead would leave the parser guessing, and a cue whose text
|
|
44
|
+
* is a bare number (`1914`) would read as the next cue's id.
|
|
45
|
+
*
|
|
46
|
+
* Line endings are normalised first, so a CRLF file — the format's de facto norm —
|
|
47
|
+
* parses like any other.
|
|
48
|
+
*
|
|
49
|
+
* @param rawSrt - The file's contents.
|
|
50
|
+
* @returns The cues that parsed, in file order. A block missing a usable timecode or
|
|
51
|
+
* any text is dropped rather than returned half-built, so the result never holds a
|
|
52
|
+
* cue a consumer has to check.
|
|
53
|
+
*/
|
|
54
|
+
export function parseSrt(rawSrt) {
|
|
55
|
+
const cues = [];
|
|
56
|
+
const blocks = rawSrt
|
|
57
|
+
.replace(/\r\n?/gv, '\n')
|
|
58
|
+
.split(cueSeparatorRegexp);
|
|
59
|
+
for (const block of blocks) {
|
|
60
|
+
if (block.trim() === '')
|
|
61
|
+
continue;
|
|
62
|
+
const cue = parseCue(block, cues.length + 1);
|
|
63
|
+
if (cue !== null)
|
|
64
|
+
cues.push(cue);
|
|
65
|
+
}
|
|
66
|
+
return cues;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { parseSrt } from './index.js';
|
|
3
|
+
const twoCues = `1
|
|
4
|
+
00:00:01,000 --> 00:00:02,000
|
|
5
|
+
Bonjour
|
|
6
|
+
|
|
7
|
+
2
|
|
8
|
+
00:00:03,000 --> 00:00:04,000
|
|
9
|
+
Au revoir`;
|
|
10
|
+
describe('parseSrt', () => {
|
|
11
|
+
it('reads a cue whole', () => {
|
|
12
|
+
expect(parseSrt(twoCues)[0]).toMatchObject({
|
|
13
|
+
id: 1,
|
|
14
|
+
start: 1000,
|
|
15
|
+
end: 2000,
|
|
16
|
+
content: 'Bonjour'
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it('keeps the file order', () => {
|
|
20
|
+
expect(parseSrt(twoCues).map(cue => cue.content)).toEqual(['Bonjour', 'Au revoir']);
|
|
21
|
+
});
|
|
22
|
+
describe('line endings', () => {
|
|
23
|
+
it('parses a CRLF file, the format de facto norm', () => {
|
|
24
|
+
expect(parseSrt(twoCues.replace(/\n/g, '\r\n'))).toHaveLength(2);
|
|
25
|
+
});
|
|
26
|
+
it('parses a lone-CR file', () => {
|
|
27
|
+
expect(parseSrt(twoCues.replace(/\n/g, '\r'))).toHaveLength(2);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('block delimiting', () => {
|
|
31
|
+
it('reads a bare number as text, not as the next cue id', () => {
|
|
32
|
+
const cues = parseSrt(`1
|
|
33
|
+
00:00:01,000 --> 00:00:02,000
|
|
34
|
+
1914
|
|
35
|
+
|
|
36
|
+
2
|
|
37
|
+
00:00:03,000 --> 00:00:04,000
|
|
38
|
+
La guerre`);
|
|
39
|
+
expect(cues).toHaveLength(2);
|
|
40
|
+
expect(cues[0]?.content).toBe('1914');
|
|
41
|
+
});
|
|
42
|
+
it('keeps the newlines inside a multi-line cue', () => {
|
|
43
|
+
const cues = parseSrt(`1
|
|
44
|
+
00:00:01,000 --> 00:00:02,000
|
|
45
|
+
Première ligne
|
|
46
|
+
Deuxième ligne`);
|
|
47
|
+
expect(cues[0]?.content).toBe('Première ligne\nDeuxième ligne');
|
|
48
|
+
});
|
|
49
|
+
it('tolerates a separator line holding spaces', () => {
|
|
50
|
+
expect(parseSrt(twoCues.replace('\n\n', '\n \n'))).toHaveLength(2);
|
|
51
|
+
});
|
|
52
|
+
it('tolerates blank lines around the file', () => {
|
|
53
|
+
expect(parseSrt(`\n\n${twoCues}\n\n`)).toHaveLength(2);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
describe('the id line', () => {
|
|
57
|
+
it('keeps the number written in the file, however it is numbered', () => {
|
|
58
|
+
const cues = parseSrt(`57
|
|
59
|
+
00:00:01,000 --> 00:00:02,000
|
|
60
|
+
Bonjour`);
|
|
61
|
+
expect(cues[0]?.id).toBe(57);
|
|
62
|
+
});
|
|
63
|
+
it('numbers a cue by its position when the file leaves the id out', () => {
|
|
64
|
+
const cues = parseSrt(`00:00:01,000 --> 00:00:02,000
|
|
65
|
+
Bonjour
|
|
66
|
+
|
|
67
|
+
00:00:03,000 --> 00:00:04,000
|
|
68
|
+
Au revoir`);
|
|
69
|
+
expect(cues.map(cue => cue.id)).toEqual([1, 2]);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe('dropping what cannot be read', () => {
|
|
73
|
+
it('drops a block whose timecode is malformed', () => {
|
|
74
|
+
const cues = parseSrt(`1
|
|
75
|
+
00:00:01,000 -> 00:00:02,000
|
|
76
|
+
Bonjour
|
|
77
|
+
|
|
78
|
+
2
|
|
79
|
+
00:00:03,000 --> 00:00:04,000
|
|
80
|
+
Au revoir`);
|
|
81
|
+
expect(cues.map(cue => cue.content)).toEqual(['Au revoir']);
|
|
82
|
+
});
|
|
83
|
+
it('drops a block with a timecode but no text', () => {
|
|
84
|
+
expect(parseSrt(`1
|
|
85
|
+
00:00:01,000 --> 00:00:02,000`)).toEqual([]);
|
|
86
|
+
});
|
|
87
|
+
it('returns nothing at all for an empty file', () => {
|
|
88
|
+
expect(parseSrt('')).toEqual([]);
|
|
89
|
+
});
|
|
90
|
+
it('returns nothing for a file that is not SRT', () => {
|
|
91
|
+
expect(parseSrt('<!doctype html><title>404</title>')).toEqual([]);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One subtitle, complete.
|
|
3
|
+
*
|
|
4
|
+
* Every field is required: a cue missing its timecode or its text is not a cue the
|
|
5
|
+
* parser should be handing out, and a consumer shouldn't have to defend itself
|
|
6
|
+
* against the parser's own intermediate states.
|
|
7
|
+
*
|
|
8
|
+
* @property id - The cue number as written in the file. Kept because a consumer may
|
|
9
|
+
* want to show it, but it carries no meaning for the parser: a concatenated or
|
|
10
|
+
* hand-edited file numbers its cues however it likes. Order and identity come from
|
|
11
|
+
* the position in the returned array.
|
|
12
|
+
* @property start - Start position in milliseconds.
|
|
13
|
+
* @property end - End position in milliseconds.
|
|
14
|
+
* @property content - The cue's text, newlines preserved, surrounding whitespace
|
|
15
|
+
* trimmed.
|
|
16
|
+
*/
|
|
17
|
+
export type SrtCue = {
|
|
18
|
+
id: number;
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
content: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an SRT timecode to milliseconds.
|
|
3
|
+
*
|
|
4
|
+
* @param timecode - A timecode in `hh:mm:ss,mmm` form. Surrounding whitespace is
|
|
5
|
+
* tolerated; anything else is not a timecode.
|
|
6
|
+
* @returns The position in milliseconds, or `null` when `timecode` doesn't parse —
|
|
7
|
+
* a caller reading a subtitle file needs to tell a malformed line from one that
|
|
8
|
+
* legitimately sits at zero.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* srtTimecodeToMs('00:00:01,500') // 1500
|
|
12
|
+
* srtTimecodeToMs('00:00:01,5') // 1500, not 1005
|
|
13
|
+
*/
|
|
14
|
+
export declare function srtTimecodeToMs(timecode: string): number | null;
|