@design-edito/tools 0.5.29 → 0.5.31
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 +1 -1
- package/agnostic/arrays/index.js +1 -1
- package/agnostic/colors/index.d.ts +1 -1
- package/agnostic/colors/index.js +1 -1
- package/agnostic/css/index.d.ts +3 -3
- package/agnostic/css/index.js +3 -3
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +9 -9
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +9 -9
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +3 -3
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
- package/agnostic/html/index.d.ts +3 -3
- package/agnostic/html/index.js +3 -3
- package/agnostic/index.d.ts +4 -4
- package/agnostic/index.js +4 -4
- package/agnostic/misc/index.d.ts +2 -2
- package/agnostic/misc/index.js +2 -2
- package/agnostic/numbers/index.d.ts +2 -2
- package/agnostic/numbers/index.js +2 -2
- package/agnostic/objects/index.d.ts +2 -2
- package/agnostic/objects/index.js +2 -2
- package/agnostic/random/index.d.ts +1 -1
- package/agnostic/random/index.js +1 -1
- package/agnostic/sanitization/index.d.ts +1 -1
- package/agnostic/sanitization/index.js +1 -1
- package/agnostic/strings/index.d.ts +2 -2
- package/agnostic/strings/index.js +2 -2
- package/agnostic/time/dates/index.d.ts +1 -1
- package/agnostic/time/dates/index.js +1 -1
- package/components/GalleryAlt/index.d.ts +76 -0
- package/components/GalleryAlt/index.js +188 -0
- package/components/GalleryAlt/styles.module.css +33 -0
- package/components/GalleryAlt/utils.d.ts +36 -0
- package/components/GalleryAlt/utils.js +58 -0
- package/components/Sequencer/index.d.ts +13 -1
- package/components/Sequencer/index.js +42 -28
- package/components/index.d.ts +3 -2
- package/components/index.js +3 -2
- package/components/public-classnames.d.ts +1 -0
- package/components/public-classnames.js +1 -0
- 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/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/ftps/file/index.d.ts +1 -1
- package/node/ftps/file/index.js +1 -1
- package/node/images/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +1 -1
- package/node/images/transform/operations/index.js +1 -1
- package/node/process/index.d.ts +1 -1
- package/node/process/index.js +1 -1
- package/package.json +8 -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
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
-
export * as make from './make/index.js'
|
|
5
4
|
export * as randomPick from './random-pick/index.js'
|
|
6
5
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
+
export * as make from './make/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
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
-
export * as make from './make/index.js'
|
|
5
4
|
export * as randomPick from './random-pick/index.js'
|
|
6
5
|
export * as shuffle from './shuffle/index.js'
|
|
6
|
+
export * as make from './make/index.js'
|
|
@@ -6,7 +6,7 @@ export * as grayscale from './grayscale/index.js'
|
|
|
6
6
|
export * as invert from './invert/index.js'
|
|
7
7
|
export * as lerp from './lerp/index.js'
|
|
8
8
|
export * as luminance from './luminance/index.js'
|
|
9
|
-
export * as palette from './palette/index.js'
|
|
10
9
|
export * as rotate from './rotate/index.js'
|
|
10
|
+
export * as palette from './palette/index.js'
|
|
11
11
|
export * as tidy from './tidy/index.js'
|
|
12
12
|
export * as typechecks from './typechecks/index.js'
|
package/agnostic/colors/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * as grayscale from './grayscale/index.js'
|
|
|
6
6
|
export * as invert from './invert/index.js'
|
|
7
7
|
export * as lerp from './lerp/index.js'
|
|
8
8
|
export * as luminance from './luminance/index.js'
|
|
9
|
-
export * as palette from './palette/index.js'
|
|
10
9
|
export * as rotate from './rotate/index.js'
|
|
10
|
+
export * as palette from './palette/index.js'
|
|
11
11
|
export * as tidy from './tidy/index.js'
|
|
12
12
|
export * as typechecks from './typechecks/index.js'
|
package/agnostic/css/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as bem from './bem/index.js'
|
|
2
1
|
export * as clss from './clss/index.js'
|
|
2
|
+
export * as bem from './bem/index.js'
|
|
3
3
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
5
|
-
export * as scale from './scale/index.js'
|
|
6
4
|
export * as stylesSet from './styles-set/index.js'
|
|
5
|
+
export * as scale from './scale/index.js'
|
|
6
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
package/agnostic/css/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as bem from './bem/index.js'
|
|
2
1
|
export * as clss from './clss/index.js'
|
|
2
|
+
export * as bem from './bem/index.js'
|
|
3
3
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
5
|
-
export * as scale from './scale/index.js'
|
|
6
4
|
export * as stylesSet from './styles-set/index.js'
|
|
5
|
+
export * as scale from './scale/index.js'
|
|
6
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
@@ -6,37 +6,38 @@ export * as at from './at/index.js'
|
|
|
6
6
|
export * as call from './call/index.js'
|
|
7
7
|
export * as clone from './clone/index.js'
|
|
8
8
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
9
|
-
export * as equals from './equals/index.js'
|
|
10
9
|
export * as getattribute from './getattribute/index.js'
|
|
10
|
+
export * as equals from './equals/index.js'
|
|
11
11
|
export * as getproperties from './getproperties/index.js'
|
|
12
12
|
export * as getproperty from './getproperty/index.js'
|
|
13
13
|
export * as hjparse from './hjparse/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'
|
|
16
|
+
export * as initialize from './initialize/index.js'
|
|
17
17
|
export * as join from './join/index.js'
|
|
18
18
|
export * as map from './map/index.js'
|
|
19
|
+
export * as length from './length/index.js'
|
|
19
20
|
export * as negate from './negate/index.js'
|
|
20
21
|
export * as notrailing from './notrailing/index.js'
|
|
21
22
|
export * as or from './or/index.js'
|
|
22
|
-
export * as populate from './populate/index.js'
|
|
23
23
|
export * as pickrandom from './pickrandom/index.js'
|
|
24
24
|
export * as print from './print/index.js'
|
|
25
25
|
export * as push from './push/index.js'
|
|
26
26
|
export * as pusheach from './pusheach/index.js'
|
|
27
|
-
export * as length from './length/index.js'
|
|
28
27
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
29
|
-
export * as removeclass from './removeclass/index.js'
|
|
30
28
|
export * as removeattribute from './removeattribute/index.js'
|
|
29
|
+
export * as removeclass from './removeclass/index.js'
|
|
31
30
|
export * as renameproperty from './renameproperty/index.js'
|
|
32
31
|
export * as replace from './replace/index.js'
|
|
33
32
|
export * as set from './set/index.js'
|
|
34
33
|
export * as select from './select/index.js'
|
|
35
|
-
export * as setproperty from './setproperty/index.js'
|
|
36
34
|
export * as setattribute from './setattribute/index.js'
|
|
37
|
-
export * as
|
|
35
|
+
export * as populate from './populate/index.js'
|
|
38
36
|
export * as sorton from './sorton/index.js'
|
|
37
|
+
export * as setproperty from './setproperty/index.js'
|
|
38
|
+
export * as spread from './spread/index.js'
|
|
39
39
|
export * as toarray from './toarray/index.js'
|
|
40
|
+
export * as split from './split/index.js'
|
|
40
41
|
export * as toboolean from './toboolean/index.js'
|
|
41
42
|
export * as toelement from './toelement/index.js'
|
|
42
43
|
export * as toggleclass from './toggleclass/index.js'
|
|
@@ -44,9 +45,8 @@ export * as tonodelist from './tonodelist/index.js'
|
|
|
44
45
|
export * as tonull from './tonull/index.js'
|
|
45
46
|
export * as tonumber from './tonumber/index.js'
|
|
46
47
|
export * as torecord from './torecord/index.js'
|
|
47
|
-
export * as toref from './toref/index.js'
|
|
48
48
|
export * as tostring from './tostring/index.js'
|
|
49
49
|
export * as totext from './totext/index.js'
|
|
50
50
|
export * as transformselected from './transformselected/index.js'
|
|
51
51
|
export * as trim from './trim/index.js'
|
|
52
|
-
export * as
|
|
52
|
+
export * as toref from './toref/index.js'
|
|
@@ -6,37 +6,38 @@ export * as at from './at/index.js'
|
|
|
6
6
|
export * as call from './call/index.js'
|
|
7
7
|
export * as clone from './clone/index.js'
|
|
8
8
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
9
|
-
export * as equals from './equals/index.js'
|
|
10
9
|
export * as getattribute from './getattribute/index.js'
|
|
10
|
+
export * as equals from './equals/index.js'
|
|
11
11
|
export * as getproperties from './getproperties/index.js'
|
|
12
12
|
export * as getproperty from './getproperty/index.js'
|
|
13
13
|
export * as hjparse from './hjparse/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'
|
|
16
|
+
export * as initialize from './initialize/index.js'
|
|
17
17
|
export * as join from './join/index.js'
|
|
18
18
|
export * as map from './map/index.js'
|
|
19
|
+
export * as length from './length/index.js'
|
|
19
20
|
export * as negate from './negate/index.js'
|
|
20
21
|
export * as notrailing from './notrailing/index.js'
|
|
21
22
|
export * as or from './or/index.js'
|
|
22
|
-
export * as populate from './populate/index.js'
|
|
23
23
|
export * as pickrandom from './pickrandom/index.js'
|
|
24
24
|
export * as print from './print/index.js'
|
|
25
25
|
export * as push from './push/index.js'
|
|
26
26
|
export * as pusheach from './pusheach/index.js'
|
|
27
|
-
export * as length from './length/index.js'
|
|
28
27
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
29
|
-
export * as removeclass from './removeclass/index.js'
|
|
30
28
|
export * as removeattribute from './removeattribute/index.js'
|
|
29
|
+
export * as removeclass from './removeclass/index.js'
|
|
31
30
|
export * as renameproperty from './renameproperty/index.js'
|
|
32
31
|
export * as replace from './replace/index.js'
|
|
33
32
|
export * as set from './set/index.js'
|
|
34
33
|
export * as select from './select/index.js'
|
|
35
|
-
export * as setproperty from './setproperty/index.js'
|
|
36
34
|
export * as setattribute from './setattribute/index.js'
|
|
37
|
-
export * as
|
|
35
|
+
export * as populate from './populate/index.js'
|
|
38
36
|
export * as sorton from './sorton/index.js'
|
|
37
|
+
export * as setproperty from './setproperty/index.js'
|
|
38
|
+
export * as spread from './spread/index.js'
|
|
39
39
|
export * as toarray from './toarray/index.js'
|
|
40
|
+
export * as split from './split/index.js'
|
|
40
41
|
export * as toboolean from './toboolean/index.js'
|
|
41
42
|
export * as toelement from './toelement/index.js'
|
|
42
43
|
export * as toggleclass from './toggleclass/index.js'
|
|
@@ -44,9 +45,8 @@ export * as tonodelist from './tonodelist/index.js'
|
|
|
44
45
|
export * as tonull from './tonull/index.js'
|
|
45
46
|
export * as tonumber from './tonumber/index.js'
|
|
46
47
|
export * as torecord from './torecord/index.js'
|
|
47
|
-
export * as toref from './toref/index.js'
|
|
48
48
|
export * as tostring from './tostring/index.js'
|
|
49
49
|
export * as totext from './totext/index.js'
|
|
50
50
|
export * as transformselected from './transformselected/index.js'
|
|
51
51
|
export * as trim from './trim/index.js'
|
|
52
|
-
export * as
|
|
52
|
+
export * as toref from './toref/index.js'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export * as any from './any/index.js'
|
|
2
2
|
export * as array from './array/index.js'
|
|
3
3
|
export * as boolean from './boolean/index.js'
|
|
4
|
+
export * as element from './element/index.js'
|
|
4
5
|
export * as get from './get/index.js'
|
|
5
|
-
export * as guess from './guess/index.js'
|
|
6
6
|
export * as nodelist from './nodelist/index.js'
|
|
7
|
+
export * as guess from './guess/index.js'
|
|
7
8
|
export * as null from './null/index.js'
|
|
8
|
-
export * as ref from './ref/index.js'
|
|
9
9
|
export * as number from './number/index.js'
|
|
10
10
|
export * as record from './record/index.js'
|
|
11
|
-
export * as
|
|
11
|
+
export * as ref from './ref/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
2
|
export * as array from './array/index.js'
|
|
3
3
|
export * as boolean from './boolean/index.js'
|
|
4
|
+
export * as element from './element/index.js'
|
|
4
5
|
export * as get from './get/index.js'
|
|
5
|
-
export * as guess from './guess/index.js'
|
|
6
6
|
export * as nodelist from './nodelist/index.js'
|
|
7
|
+
export * as guess from './guess/index.js'
|
|
7
8
|
export * as null from './null/index.js'
|
|
8
|
-
export * as ref from './ref/index.js'
|
|
9
9
|
export * as number from './number/index.js'
|
|
10
10
|
export * as record from './record/index.js'
|
|
11
|
-
export * as
|
|
11
|
+
export * as ref from './ref/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,10 +1,10 @@
|
|
|
1
|
-
export * as deepSelect from './deep-select/index.js'
|
|
2
|
-
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
3
1
|
export * as hyperJson from './hyper-json/index.js'
|
|
2
|
+
export * as deepSelect from './deep-select/index.js'
|
|
4
3
|
export * as insertNode from './insert-node/index.js'
|
|
5
4
|
export * as placeholders from './placeholders/index.js'
|
|
5
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
6
6
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
7
|
-
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
8
7
|
export * as selectorToElement from './selector-to-element/index.js'
|
|
9
8
|
export * as stringToNodes from './string-to-nodes/index.js'
|
|
10
9
|
export * as watchSelection from './watch-selection/index.js'
|
|
10
|
+
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
package/agnostic/html/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as deepSelect from './deep-select/index.js'
|
|
2
|
-
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
3
1
|
export * as hyperJson from './hyper-json/index.js'
|
|
2
|
+
export * as deepSelect from './deep-select/index.js'
|
|
4
3
|
export * as insertNode from './insert-node/index.js'
|
|
5
4
|
export * as placeholders from './placeholders/index.js'
|
|
5
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
6
6
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
7
|
-
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
8
7
|
export * as selectorToElement from './selector-to-element/index.js'
|
|
9
8
|
export * as stringToNodes from './string-to-nodes/index.js'
|
|
10
9
|
export * as watchSelection from './watch-selection/index.js'
|
|
10
|
+
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
package/agnostic/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export * as arrays from './arrays/index.js'
|
|
2
|
-
export * as colors from './colors/index.js'
|
|
3
2
|
export * as booleans from './booleans/index.js'
|
|
3
|
+
export * as colors from './colors/index.js'
|
|
4
4
|
export * as css from './css/index.js'
|
|
5
|
-
export * as html from './html/index.js'
|
|
6
5
|
export * as errors from './errors/index.js'
|
|
7
|
-
export * as
|
|
6
|
+
export * as html from './html/index.js'
|
|
8
7
|
export * as numbers from './numbers/index.js'
|
|
8
|
+
export * as misc from './misc/index.js'
|
|
9
9
|
export * as objects from './objects/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
11
|
export * as random from './random/index.js'
|
|
12
12
|
export * as regexps from './regexps/index.js'
|
|
13
13
|
export * as sanitization from './sanitization/index.js'
|
|
14
14
|
export * as strings from './strings/index.js'
|
|
15
|
-
export * as subtitles from './subtitles/index.js'
|
|
16
15
|
export * as time from './time/index.js'
|
|
16
|
+
export * as subtitles from './subtitles/index.js'
|
|
17
17
|
export * as typescript from './typescript/index.js'
|
package/agnostic/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export * as arrays from './arrays/index.js'
|
|
2
|
-
export * as colors from './colors/index.js'
|
|
3
2
|
export * as booleans from './booleans/index.js'
|
|
3
|
+
export * as colors from './colors/index.js'
|
|
4
4
|
export * as css from './css/index.js'
|
|
5
|
-
export * as html from './html/index.js'
|
|
6
5
|
export * as errors from './errors/index.js'
|
|
7
|
-
export * as
|
|
6
|
+
export * as html from './html/index.js'
|
|
8
7
|
export * as numbers from './numbers/index.js'
|
|
8
|
+
export * as misc from './misc/index.js'
|
|
9
9
|
export * as objects from './objects/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
11
|
export * as random from './random/index.js'
|
|
12
12
|
export * as regexps from './regexps/index.js'
|
|
13
13
|
export * as sanitization from './sanitization/index.js'
|
|
14
14
|
export * as strings from './strings/index.js'
|
|
15
|
-
export * as subtitles from './subtitles/index.js'
|
|
16
15
|
export * as time from './time/index.js'
|
|
16
|
+
export * as subtitles from './subtitles/index.js'
|
|
17
17
|
export * as typescript from './typescript/index.js'
|
package/agnostic/misc/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as assert from './assert/index.js'
|
|
2
2
|
export * as cast from './cast/index.js'
|
|
3
|
-
export * as connection from './connection/index.js'
|
|
4
3
|
export * as crawler from './crawler/index.js'
|
|
5
4
|
export * as crossenv from './crossenv/index.js'
|
|
6
5
|
export * as dataSize from './data-size/index.js'
|
|
7
|
-
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
6
|
export * as isNullish from './is-nullish/index.js'
|
|
9
7
|
export * as logs from './logs/index.js'
|
|
8
|
+
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
10
9
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
10
|
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
11
|
export * as outcome from './outcome/index.js'
|
|
12
|
+
export * as connection from './connection/index.js'
|
package/agnostic/misc/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as assert from './assert/index.js'
|
|
2
2
|
export * as cast from './cast/index.js'
|
|
3
|
-
export * as connection from './connection/index.js'
|
|
4
3
|
export * as crawler from './crawler/index.js'
|
|
5
4
|
export * as crossenv from './crossenv/index.js'
|
|
6
5
|
export * as dataSize from './data-size/index.js'
|
|
7
|
-
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
6
|
export * as isNullish from './is-nullish/index.js'
|
|
9
7
|
export * as logs from './logs/index.js'
|
|
8
|
+
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
10
9
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
10
|
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
11
|
export * as outcome from './outcome/index.js'
|
|
12
|
+
export * as connection from './connection/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
3
2
|
export * as clamp from './clamp/index.js'
|
|
3
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
|
-
export * as interpolate from './interpolate/index.js'
|
|
6
5
|
export * as round from './round/index.js'
|
|
6
|
+
export * as interpolate from './interpolate/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
3
2
|
export * as clamp from './clamp/index.js'
|
|
3
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
|
-
export * as interpolate from './interpolate/index.js'
|
|
6
5
|
export * as round from './round/index.js'
|
|
6
|
+
export * as interpolate from './interpolate/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
2
|
export * as enums from './enums/index.js'
|
|
3
|
-
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
3
|
export * as isObject from './is-object/index.js'
|
|
5
4
|
export * as isRecord from './is-record/index.js'
|
|
5
|
+
export * as flattenGetters from './flatten-getters/index.js'
|
|
6
6
|
export * as recordFormat from './record-format/index.js'
|
|
7
7
|
export * as recordMap from './record-map/index.js'
|
|
8
|
-
export * as sortKeys from './sort-keys/index.js'
|
|
9
8
|
export * as validation from './validation/index.js'
|
|
9
|
+
export * as sortKeys from './sort-keys/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
2
|
export * as enums from './enums/index.js'
|
|
3
|
-
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
3
|
export * as isObject from './is-object/index.js'
|
|
5
4
|
export * as isRecord from './is-record/index.js'
|
|
5
|
+
export * as flattenGetters from './flatten-getters/index.js'
|
|
6
6
|
export * as recordFormat from './record-format/index.js'
|
|
7
7
|
export * as recordMap from './record-map/index.js'
|
|
8
|
-
export * as sortKeys from './sort-keys/index.js'
|
|
9
8
|
export * as validation from './validation/index.js'
|
|
9
|
+
export * as sortKeys from './sort-keys/index.js'
|
package/agnostic/random/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * as charCodes from './char-codes/index.js'
|
|
2
1
|
export * as matches from './matches/index.js'
|
|
3
2
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as charCodes from './char-codes/index.js'
|
|
5
4
|
export * as replaceAll from './replace-all/index.js'
|
|
6
5
|
export * as splitTrim from './split-trim/index.js'
|
|
7
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
|
+
export * as parseTable from './parse-table/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * as charCodes from './char-codes/index.js'
|
|
2
1
|
export * as matches from './matches/index.js'
|
|
3
2
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as charCodes from './char-codes/index.js'
|
|
5
4
|
export * as replaceAll from './replace-all/index.js'
|
|
6
5
|
export * as splitTrim from './split-trim/index.js'
|
|
7
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
|
+
export * as parseTable from './parse-table/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
+
import type { WithClassName } from '../utils/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the GalleryAlt component. Same shape as {@link Gallery}, so the two swap.
|
|
5
|
+
*
|
|
6
|
+
* @property paddingLeft - Left padding applied to the first slot. A number is pixels.
|
|
7
|
+
* Falls back to `padding`, then `0px`.
|
|
8
|
+
* @property paddingRight - Right padding applied to the last slot. Same rules.
|
|
9
|
+
* @property padding - Shorthand for both ends, used when a side is not set.
|
|
10
|
+
* @property prevButtonContent - Content of the "previous" control. Defaults to `"prev"`.
|
|
11
|
+
* @property nextButtonContent - Content of the "next" control. Defaults to `"next"`.
|
|
12
|
+
* @property paginationContent - Content of each pagination item: a node used for all of
|
|
13
|
+
* them, a function of the page index, or undefined to show the index.
|
|
14
|
+
* @property defaultActive - Slot to scroll to at mount, in uncontrolled mode.
|
|
15
|
+
* @property active - Controlled index. When set, the active slot is this one and hand
|
|
16
|
+
* scrolling is disabled.
|
|
17
|
+
* @property noSnap - Frees the scroll from snapping to a slot.
|
|
18
|
+
* @property onPrevClicked - Fires before the gallery reacts, with the index as it was.
|
|
19
|
+
* @property onNextClicked - Fires before the gallery reacts, with the index as it was.
|
|
20
|
+
* @property onPaginationClicked - Fires before the gallery reacts, with the index as it
|
|
21
|
+
* was and the one aimed at.
|
|
22
|
+
* @property onActiveSlotChanged - Fires after the active slot changed, with the new index.
|
|
23
|
+
* @property onCanGoLeftChanged - Fires after the ability to scroll further left changed.
|
|
24
|
+
* Never on mount.
|
|
25
|
+
* @property onCanGoRightChanged - Same, to the right.
|
|
26
|
+
* @property className - Added to the root element.
|
|
27
|
+
* @property children - One slot per child.
|
|
28
|
+
*/
|
|
29
|
+
export type Props = PropsWithChildren<WithClassName<{
|
|
30
|
+
paddingLeft?: string | number;
|
|
31
|
+
paddingRight?: string | number;
|
|
32
|
+
padding?: string | number;
|
|
33
|
+
prevButtonContent?: ReactNode;
|
|
34
|
+
nextButtonContent?: ReactNode;
|
|
35
|
+
paginationContent?: ReactNode | ((page: number) => ReactNode);
|
|
36
|
+
defaultActive?: number;
|
|
37
|
+
active?: number;
|
|
38
|
+
noSnap?: boolean;
|
|
39
|
+
onPrevClicked?: (activePos: number) => void;
|
|
40
|
+
onNextClicked?: (activePos: number) => void;
|
|
41
|
+
onPaginationClicked?: (activePos: number, targetPos: number) => void;
|
|
42
|
+
onActiveSlotChanged?: (activePos: number) => void;
|
|
43
|
+
onCanGoLeftChanged?: (canGoLeft: boolean) => void;
|
|
44
|
+
onCanGoRightChanged?: (canGoRight: boolean) => void;
|
|
45
|
+
}>>;
|
|
46
|
+
/**
|
|
47
|
+
* Horizontally scrollable gallery, told apart from {@link Gallery} by how it locates the
|
|
48
|
+
* active slot.
|
|
49
|
+
*
|
|
50
|
+
* Geometry is measured **once per layout change** into a table of scroll positions, one
|
|
51
|
+
* per slot, and the boundaries between them. A scroll event then only has to place a
|
|
52
|
+
* number between two others — no element is measured while the reader scrolls.
|
|
53
|
+
*
|
|
54
|
+
* The same table is what the controls scroll to, so reading the active slot and moving
|
|
55
|
+
* to one cannot disagree, with or without snapping.
|
|
56
|
+
*
|
|
57
|
+
* ### CSS elements
|
|
58
|
+
* - `scroller`
|
|
59
|
+
* - `slot`, `slot--active`
|
|
60
|
+
* - `actions`, `prev`, `next`
|
|
61
|
+
* - `pagination`, `page`, `page--active`
|
|
62
|
+
*
|
|
63
|
+
* Root modifiers: `controlled`, `no-snap`, `measured`, `at-first`, `at-last`,
|
|
64
|
+
* `can-go-left`, `can-go-right`.
|
|
65
|
+
*
|
|
66
|
+
* @param props - Component properties.
|
|
67
|
+
* @see {@link Props}
|
|
68
|
+
* @returns A container wrapping the scroller, the two controls and the pagination.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Nothing is measured while the reader scrolls: the table is rebuilt only when a box
|
|
72
|
+
* changes size or a slot is added, watched through a `ResizeObserver`. Until the first
|
|
73
|
+
* measurement lands, the root carries no `measured` modifier and every slot position
|
|
74
|
+
* reads as `0`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const GalleryAlt: FunctionComponent<Props>;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { clss } from '../../agnostic/css/clss/index.js';
|
|
4
|
+
import { mergeClassNames, useChangeDispatch } from '../utils/index.js';
|
|
5
|
+
import { galleryAlt as publicClassName } from '../public-classnames.js';
|
|
6
|
+
import { EMPTY_GEOMETRY, measureGeometry, readActiveIndex, readReach } from './utils.js';
|
|
7
|
+
import cssModule from './styles.module.css';
|
|
8
|
+
/** Resolves one side's padding to a CSS length, falling back to the shorthand then to `0px`. */
|
|
9
|
+
function resolvePadding(side, shorthand) {
|
|
10
|
+
const value = side ?? shorthand ?? 0;
|
|
11
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Horizontally scrollable gallery, told apart from {@link Gallery} by how it locates the
|
|
15
|
+
* active slot.
|
|
16
|
+
*
|
|
17
|
+
* Geometry is measured **once per layout change** into a table of scroll positions, one
|
|
18
|
+
* per slot, and the boundaries between them. A scroll event then only has to place a
|
|
19
|
+
* number between two others — no element is measured while the reader scrolls.
|
|
20
|
+
*
|
|
21
|
+
* The same table is what the controls scroll to, so reading the active slot and moving
|
|
22
|
+
* to one cannot disagree, with or without snapping.
|
|
23
|
+
*
|
|
24
|
+
* ### CSS elements
|
|
25
|
+
* - `scroller`
|
|
26
|
+
* - `slot`, `slot--active`
|
|
27
|
+
* - `actions`, `prev`, `next`
|
|
28
|
+
* - `pagination`, `page`, `page--active`
|
|
29
|
+
*
|
|
30
|
+
* Root modifiers: `controlled`, `no-snap`, `measured`, `at-first`, `at-last`,
|
|
31
|
+
* `can-go-left`, `can-go-right`.
|
|
32
|
+
*
|
|
33
|
+
* @param props - Component properties.
|
|
34
|
+
* @see {@link Props}
|
|
35
|
+
* @returns A container wrapping the scroller, the two controls and the pagination.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Nothing is measured while the reader scrolls: the table is rebuilt only when a box
|
|
39
|
+
* changes size or a slot is added, watched through a `ResizeObserver`. Until the first
|
|
40
|
+
* measurement lands, the root carries no `measured` modifier and every slot position
|
|
41
|
+
* reads as `0`.
|
|
42
|
+
*/
|
|
43
|
+
export const GalleryAlt = ({ paddingLeft, paddingRight, padding, prevButtonContent, nextButtonContent, paginationContent, defaultActive, active, noSnap, onPrevClicked, onNextClicked, onPaginationClicked, onActiveSlotChanged, onCanGoLeftChanged, onCanGoRightChanged, children, className }) => {
|
|
44
|
+
// State & refs
|
|
45
|
+
const scrollerRef = useRef(null);
|
|
46
|
+
const geometryRef = useRef(EMPTY_GEOMETRY);
|
|
47
|
+
const [scrolledIndex, setScrolledIndex] = useState(0);
|
|
48
|
+
const [isMeasured, setIsMeasured] = useState(false);
|
|
49
|
+
const [canGoLeft, setCanGoLeft] = useState(false);
|
|
50
|
+
const [canGoRight, setCanGoRight] = useState(false);
|
|
51
|
+
const childrenCount = Children.count(children);
|
|
52
|
+
const isControlled = active !== undefined;
|
|
53
|
+
// Controlled, the prop is the answer: the class names and `data-active` say where the
|
|
54
|
+
// gallery was told to be, rather than where a smooth scroll has got to so far.
|
|
55
|
+
const activeIndex = active ?? scrolledIndex;
|
|
56
|
+
// State dispatch
|
|
57
|
+
useChangeDispatch(activeIndex, onActiveSlotChanged);
|
|
58
|
+
useChangeDispatch(canGoLeft, onCanGoLeftChanged);
|
|
59
|
+
useChangeDispatch(canGoRight, onCanGoRightChanged);
|
|
60
|
+
const readScroll = useCallback(() => {
|
|
61
|
+
const scrollerElt = scrollerRef.current;
|
|
62
|
+
if (scrollerElt === null)
|
|
63
|
+
return;
|
|
64
|
+
const { scrollLeft } = scrollerElt;
|
|
65
|
+
const geometry = geometryRef.current;
|
|
66
|
+
setScrolledIndex(readActiveIndex(geometry, scrollLeft));
|
|
67
|
+
const { canGoLeft, canGoRight } = readReach(geometry, scrollLeft);
|
|
68
|
+
setCanGoLeft(canGoLeft);
|
|
69
|
+
setCanGoRight(canGoRight);
|
|
70
|
+
}, []);
|
|
71
|
+
const measure = useCallback(() => {
|
|
72
|
+
const scrollerElt = scrollerRef.current;
|
|
73
|
+
if (scrollerElt === null)
|
|
74
|
+
return;
|
|
75
|
+
geometryRef.current = measureGeometry(scrollerElt);
|
|
76
|
+
setIsMeasured(true);
|
|
77
|
+
readScroll();
|
|
78
|
+
}, [readScroll]);
|
|
79
|
+
const scrollToSlot = useCallback((pos, smooth = true) => {
|
|
80
|
+
const scrollerElt = scrollerRef.current;
|
|
81
|
+
const offset = geometryRef.current.offsets[pos];
|
|
82
|
+
if (scrollerElt === null || offset === undefined)
|
|
83
|
+
return;
|
|
84
|
+
scrollerElt.scrollTo({ left: offset, behavior: smooth ? 'smooth' : 'instant' });
|
|
85
|
+
}, []);
|
|
86
|
+
// User actions handlers
|
|
87
|
+
const handlePrevClick = () => {
|
|
88
|
+
onPrevClicked?.(activeIndex);
|
|
89
|
+
if (isControlled)
|
|
90
|
+
return;
|
|
91
|
+
scrollToSlot(activeIndex - 1);
|
|
92
|
+
};
|
|
93
|
+
const handleNextClick = () => {
|
|
94
|
+
onNextClicked?.(activeIndex);
|
|
95
|
+
if (isControlled)
|
|
96
|
+
return;
|
|
97
|
+
scrollToSlot(activeIndex + 1);
|
|
98
|
+
};
|
|
99
|
+
const handlePaginationClick = (pos) => {
|
|
100
|
+
onPaginationClicked?.(activeIndex, pos);
|
|
101
|
+
if (isControlled)
|
|
102
|
+
return;
|
|
103
|
+
scrollToSlot(pos);
|
|
104
|
+
};
|
|
105
|
+
// Fx. dep. childrenCount - Measure, and measure again whenever a box changes size.
|
|
106
|
+
// Watching the slots and not only the scroller is what makes a late image or font
|
|
107
|
+
// land correctly, where a delay after mount could only guess.
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const scrollerElt = scrollerRef.current;
|
|
110
|
+
if (scrollerElt === null)
|
|
111
|
+
return;
|
|
112
|
+
measure();
|
|
113
|
+
const observer = new ResizeObserver(measure);
|
|
114
|
+
observer.observe(scrollerElt);
|
|
115
|
+
Array.from(scrollerElt.children).forEach(child => observer.observe(child));
|
|
116
|
+
return () => observer.disconnect();
|
|
117
|
+
}, [childrenCount, measure]);
|
|
118
|
+
// Fx. no dep. - One read per frame while scrolling, and it touches no element.
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const scrollerElt = scrollerRef.current;
|
|
121
|
+
if (scrollerElt === null)
|
|
122
|
+
return;
|
|
123
|
+
let animationFrame = null;
|
|
124
|
+
const onScroll = () => {
|
|
125
|
+
if (animationFrame !== null)
|
|
126
|
+
return;
|
|
127
|
+
animationFrame = requestAnimationFrame(() => {
|
|
128
|
+
animationFrame = null;
|
|
129
|
+
readScroll();
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
scrollerElt.addEventListener('scroll', onScroll, { passive: true });
|
|
133
|
+
return () => {
|
|
134
|
+
scrollerElt.removeEventListener('scroll', onScroll);
|
|
135
|
+
if (animationFrame !== null)
|
|
136
|
+
cancelAnimationFrame(animationFrame);
|
|
137
|
+
};
|
|
138
|
+
}, [readScroll]);
|
|
139
|
+
// Fx. no dep. - Place the gallery where it starts, once the table exists.
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
const toActivate = active ?? defaultActive;
|
|
142
|
+
if (toActivate === undefined)
|
|
143
|
+
return;
|
|
144
|
+
scrollToSlot(toActivate, false);
|
|
145
|
+
}, []);
|
|
146
|
+
// Fx. dep. active - Follow the controlled index.
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (active === undefined)
|
|
149
|
+
return;
|
|
150
|
+
scrollToSlot(active);
|
|
151
|
+
}, [active]);
|
|
152
|
+
// Rendering
|
|
153
|
+
const c = clss(publicClassName, { cssModule });
|
|
154
|
+
const rootClss = mergeClassNames(c(null, {
|
|
155
|
+
'controlled': isControlled,
|
|
156
|
+
'no-snap': noSnap === true,
|
|
157
|
+
'measured': isMeasured,
|
|
158
|
+
'at-first': activeIndex === 0,
|
|
159
|
+
'at-last': activeIndex === childrenCount - 1,
|
|
160
|
+
'can-go-left': canGoLeft,
|
|
161
|
+
'can-go-right': canGoRight
|
|
162
|
+
}), className);
|
|
163
|
+
const scrollerClss = c('scroller');
|
|
164
|
+
const actionsClss = c('actions');
|
|
165
|
+
const prevBtnClss = c('prev');
|
|
166
|
+
const nextBtnClss = c('next');
|
|
167
|
+
const paginationClss = c('pagination');
|
|
168
|
+
const dataAttributes = { 'data-active': `${activeIndex}` };
|
|
169
|
+
const actualPaddingLeft = resolvePadding(paddingLeft, padding);
|
|
170
|
+
const actualPaddingRight = resolvePadding(paddingRight, padding);
|
|
171
|
+
return _jsxs("div", { className: rootClss, ...dataAttributes, children: [_jsx("div", { className: scrollerClss, ref: scrollerRef, children: Children.map(children, (child, pos) => {
|
|
172
|
+
const slotClss = c('slot', { active: pos === activeIndex });
|
|
173
|
+
const style = {
|
|
174
|
+
'margin-left': pos === 0
|
|
175
|
+
? actualPaddingLeft
|
|
176
|
+
: undefined,
|
|
177
|
+
'margin-right': pos === childrenCount - 1
|
|
178
|
+
? actualPaddingRight
|
|
179
|
+
: undefined
|
|
180
|
+
};
|
|
181
|
+
return _jsx("div", { className: slotClss, style: { ...style }, "data-slot": pos, children: child }, pos);
|
|
182
|
+
}) }), _jsxs("div", { className: actionsClss, children: [_jsx("div", { className: prevBtnClss, onClick: handlePrevClick, children: prevButtonContent ?? 'prev' }), _jsx("div", { className: nextBtnClss, onClick: handleNextClick, children: nextButtonContent ?? 'next' })] }), _jsx("div", { className: paginationClss, children: Children.map(children, (_, pos) => {
|
|
183
|
+
const pageClss = c('page', { active: pos === activeIndex });
|
|
184
|
+
return _jsx("div", { className: pageClss, "data-page": pos, onClick: () => handlePaginationClick(pos), children: typeof paginationContent === 'function'
|
|
185
|
+
? paginationContent(pos)
|
|
186
|
+
: paginationContent ?? pos });
|
|
187
|
+
}) })] });
|
|
188
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.scroller {
|
|
2
|
+
display: flex;
|
|
3
|
+
overflow-x: auto;
|
|
4
|
+
scroll-snap-type: x mandatory;
|
|
5
|
+
scroll-behavior: smooth;
|
|
6
|
+
-webkit-overflow-scrolling: touch;
|
|
7
|
+
scrollbar-width: none;
|
|
8
|
+
-ms-overflow-style: none;
|
|
9
|
+
scrollbar-color: transparent transparent;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.scroller::-webkit-scrollbar {
|
|
13
|
+
display: none;
|
|
14
|
+
height: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.scroller::-webkit-scrollbar-track,
|
|
18
|
+
.scroller::-webkit-scrollbar-thumb {
|
|
19
|
+
background: transparent;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.root.root--controlled .scroller {
|
|
23
|
+
overflow-x: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.root.root--no-snap .scroller {
|
|
27
|
+
scroll-snap-type: unset;
|
|
28
|
+
scroll-behavior: unset;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.slot {
|
|
32
|
+
scroll-snap-align: center;
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** The layout, measured once, so that reading the active slot touches no element. */
|
|
2
|
+
export type Geometry = {
|
|
3
|
+
/** Scroll positions that bring each slot to the middle, clamped to the track. */
|
|
4
|
+
offsets: number[];
|
|
5
|
+
/** Midpoints between consecutive slot centres, in content coordinates. */
|
|
6
|
+
boundaries: number[];
|
|
7
|
+
/** Half the viewport, kept here rather than read again on every scroll. */
|
|
8
|
+
halfViewport: number;
|
|
9
|
+
/** The far end of the track. */
|
|
10
|
+
maxScroll: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const EMPTY_GEOMETRY: Geometry;
|
|
13
|
+
/**
|
|
14
|
+
* Everything the gallery needs to know about its own layout.
|
|
15
|
+
*
|
|
16
|
+
* Positions are taken against the scroller's own box rather than `offsetLeft`, which is
|
|
17
|
+
* relative to whichever ancestor happens to be positioned — so a gallery nested anywhere
|
|
18
|
+
* measures the same.
|
|
19
|
+
*
|
|
20
|
+
* **Boundaries come from slot centres, and scroll positions are clamped.** Keeping them
|
|
21
|
+
* apart is what avoids ties: two slots at the same end of the track share a scroll
|
|
22
|
+
* position, but never a centre, so every slot owns a range of its own.
|
|
23
|
+
*/
|
|
24
|
+
export declare function measureGeometry(scroller: HTMLElement): Geometry;
|
|
25
|
+
/**
|
|
26
|
+
* Which slot the middle of the viewport is nearest — numbers only, whatever the count.
|
|
27
|
+
*
|
|
28
|
+
* Same answer as walking the slots and keeping the closest centre, which is what the
|
|
29
|
+
* table was built from.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readActiveIndex(geometry: Geometry, scrollLeft: number): number;
|
|
32
|
+
/** Whether there is track left on each side, within {@link EDGE_TOLERANCE}. */
|
|
33
|
+
export declare function readReach(geometry: Geometry, scrollLeft: number): {
|
|
34
|
+
canGoLeft: boolean;
|
|
35
|
+
canGoRight: boolean;
|
|
36
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** A tolerance in px, so a sub-pixel scroll position does not read as « can still go ». */
|
|
2
|
+
const EDGE_TOLERANCE = 1;
|
|
3
|
+
export const EMPTY_GEOMETRY = {
|
|
4
|
+
offsets: [],
|
|
5
|
+
boundaries: [],
|
|
6
|
+
halfViewport: 0,
|
|
7
|
+
maxScroll: 0
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Everything the gallery needs to know about its own layout.
|
|
11
|
+
*
|
|
12
|
+
* Positions are taken against the scroller's own box rather than `offsetLeft`, which is
|
|
13
|
+
* relative to whichever ancestor happens to be positioned — so a gallery nested anywhere
|
|
14
|
+
* measures the same.
|
|
15
|
+
*
|
|
16
|
+
* **Boundaries come from slot centres, and scroll positions are clamped.** Keeping them
|
|
17
|
+
* apart is what avoids ties: two slots at the same end of the track share a scroll
|
|
18
|
+
* position, but never a centre, so every slot owns a range of its own.
|
|
19
|
+
*/
|
|
20
|
+
export function measureGeometry(scroller) {
|
|
21
|
+
const { clientWidth, scrollWidth, scrollLeft } = scroller;
|
|
22
|
+
const halfViewport = clientWidth / 2;
|
|
23
|
+
const maxScroll = Math.max(0, scrollWidth - clientWidth);
|
|
24
|
+
const scrollerLeft = scroller.getBoundingClientRect().left;
|
|
25
|
+
const centers = Array.from(scroller.children).map(child => {
|
|
26
|
+
const rect = child.getBoundingClientRect();
|
|
27
|
+
return rect.left - scrollerLeft + scrollLeft + rect.width / 2;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
offsets: centers.map(center => Math.min(Math.max(center - halfViewport, 0), maxScroll)),
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- i is in range by construction, centers[i] sits before the one being mapped
|
|
32
|
+
boundaries: centers.slice(1).map((center, i) => (centers[i] + center) / 2),
|
|
33
|
+
halfViewport,
|
|
34
|
+
maxScroll
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Which slot the middle of the viewport is nearest — numbers only, whatever the count.
|
|
39
|
+
*
|
|
40
|
+
* Same answer as walking the slots and keeping the closest centre, which is what the
|
|
41
|
+
* table was built from.
|
|
42
|
+
*/
|
|
43
|
+
export function readActiveIndex(geometry, scrollLeft) {
|
|
44
|
+
const { boundaries, halfViewport } = geometry;
|
|
45
|
+
const viewportCenter = scrollLeft + halfViewport;
|
|
46
|
+
let index = 0;
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- index is bounded by the loop condition
|
|
48
|
+
while (index < boundaries.length && viewportCenter > boundaries[index])
|
|
49
|
+
index += 1;
|
|
50
|
+
return index;
|
|
51
|
+
}
|
|
52
|
+
/** Whether there is track left on each side, within {@link EDGE_TOLERANCE}. */
|
|
53
|
+
export function readReach(geometry, scrollLeft) {
|
|
54
|
+
return {
|
|
55
|
+
canGoLeft: scrollLeft > EDGE_TOLERANCE,
|
|
56
|
+
canGoRight: scrollLeft < geometry.maxScroll - EDGE_TOLERANCE
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -109,7 +109,19 @@ export type Props = PropsWithChildren<WithClassName<{
|
|
|
109
109
|
*
|
|
110
110
|
* ### On the root
|
|
111
111
|
* `--playing`, `--at-start`, `--at-end`, `--ended`, plus `data-step`, `data-active-step`,
|
|
112
|
-
* `data-total-steps` and `data-
|
|
112
|
+
* `data-total-steps`, `data-tempo` and `data-lap`.
|
|
113
|
+
*
|
|
114
|
+
* The same five numbers are also published as custom properties —
|
|
115
|
+
* `--lm-sequencer-step`, `--lm-sequencer-active-step`, `--lm-sequencer-total-steps`,
|
|
116
|
+
* `--lm-sequencer-tempo`, `--lm-sequencer-lap` — plus `--lm-sequencer-raw-step`, the
|
|
117
|
+
* counter that keeps growing across laps (`lap × total + step`). **A data attribute
|
|
118
|
+
* selects, a custom property computes**: `attr()` cannot feed a `calc()`, so a rule that
|
|
119
|
+
* wants to turn something by a degree per step needs the property, and gets it on every
|
|
120
|
+
* descendant since custom properties inherit —
|
|
121
|
+
* `transform: rotate(calc(var(--lm-sequencer-raw-step) * 5deg))`.
|
|
122
|
+
*
|
|
123
|
+
* No `-raw` twin as `ResizeObserver` has: every one of these is a bare number, and none
|
|
124
|
+
* of them would mean anything with a unit attached.
|
|
113
125
|
*
|
|
114
126
|
* ### On each element child
|
|
115
127
|
* The `__child` element class, then three pairs, one of each always present:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Children, cloneElement,
|
|
2
|
+
import { Children, cloneElement, isValidElement, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { absoluteModulo } from '../../agnostic/numbers/absolute-modulo/index.js';
|
|
4
4
|
import { clamp } from '../../agnostic/numbers/clamp/index.js';
|
|
5
5
|
import { clss } from '../../agnostic/css/clss/index.js';
|
|
@@ -55,29 +55,6 @@ function parseSteps(raw) {
|
|
|
55
55
|
return null;
|
|
56
56
|
return steps;
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
* The children, with fragments opened.
|
|
60
|
-
*
|
|
61
|
-
* **`Children.toArray` does not go through a `<>…</>`**: a fragment is one element to it,
|
|
62
|
-
* and one that cannot be classed either — `cloneElement` on it would hand `className` to
|
|
63
|
-
* `React.Fragment`, which warns and drops it. So a consumer whose children arrive wrapped
|
|
64
|
-
* in one gets a sequence of exactly one step, stuck on position `0`.
|
|
65
|
-
*
|
|
66
|
-
* That consumer is not hypothetical: lm-link renders an article's `<nodelist>` through
|
|
67
|
-
* `lm-html`, which returns `<>{children}</>` — every sequence written in hyper-json
|
|
68
|
-
* therefore arrives wrapped. Opening them here rather than asking each consumer to
|
|
69
|
-
* flatten is the only place the fix belongs: a fragment is a grouping with no rendered
|
|
70
|
-
* element of its own, so it has no business consuming a step.
|
|
71
|
-
*/
|
|
72
|
-
function flattenChildren(nodes) {
|
|
73
|
-
return Children.toArray(nodes).flatMap((child) => {
|
|
74
|
-
if (!isValidElement(child) || child.type !== Fragment)
|
|
75
|
-
return [child];
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- a fragment's props are its children and its key, whatever else they are
|
|
77
|
-
const { children } = child.props;
|
|
78
|
-
return flattenChildren(children);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
58
|
/**
|
|
82
59
|
* Whether a child carries {@link LAST_STEP_ATTRIBUTE}.
|
|
83
60
|
*
|
|
@@ -145,7 +122,19 @@ function stepsOf(child, elementIndex) {
|
|
|
145
122
|
*
|
|
146
123
|
* ### On the root
|
|
147
124
|
* `--playing`, `--at-start`, `--at-end`, `--ended`, plus `data-step`, `data-active-step`,
|
|
148
|
-
* `data-total-steps` and `data-
|
|
125
|
+
* `data-total-steps`, `data-tempo` and `data-lap`.
|
|
126
|
+
*
|
|
127
|
+
* The same five numbers are also published as custom properties —
|
|
128
|
+
* `--lm-sequencer-step`, `--lm-sequencer-active-step`, `--lm-sequencer-total-steps`,
|
|
129
|
+
* `--lm-sequencer-tempo`, `--lm-sequencer-lap` — plus `--lm-sequencer-raw-step`, the
|
|
130
|
+
* counter that keeps growing across laps (`lap × total + step`). **A data attribute
|
|
131
|
+
* selects, a custom property computes**: `attr()` cannot feed a `calc()`, so a rule that
|
|
132
|
+
* wants to turn something by a degree per step needs the property, and gets it on every
|
|
133
|
+
* descendant since custom properties inherit —
|
|
134
|
+
* `transform: rotate(calc(var(--lm-sequencer-raw-step) * 5deg))`.
|
|
135
|
+
*
|
|
136
|
+
* No `-raw` twin as `ResizeObserver` has: every one of these is a bare number, and none
|
|
137
|
+
* of them would mean anything with a unit attached.
|
|
149
138
|
*
|
|
150
139
|
* ### On each element child
|
|
151
140
|
* The `__child` element class, then three pairs, one of each always present:
|
|
@@ -165,7 +154,7 @@ export const Sequencer = ({ totalSteps, stepMap, step, defaultStep, play, defaul
|
|
|
165
154
|
const [hasLapped, setHasLapped] = useState(0);
|
|
166
155
|
const rootRef = useRef(null);
|
|
167
156
|
// Children, split once: what takes part and what merely renders.
|
|
168
|
-
const childrenArr =
|
|
157
|
+
const childrenArr = Children.toArray(children);
|
|
169
158
|
const elements = childrenArr.filter(isValidElement);
|
|
170
159
|
// Three answers to « how long is the sequence », in decreasing order of explicitness:
|
|
171
160
|
// the prop, then the child that says the sequence ends on it, then the count of
|
|
@@ -212,6 +201,14 @@ export const Sequencer = ({ totalSteps, stepMap, step, defaultStep, play, defaul
|
|
|
212
201
|
// absolute, so setting it to a bare position on a looping sequence would count as a
|
|
213
202
|
// wrap backwards and fire `onLooped` for a move nobody made. `jump-by` is left alone
|
|
214
203
|
// on purpose — stepping past the last position really is a wrap, and says so.
|
|
204
|
+
//
|
|
205
|
+
// **The lap offset is for looping sequences only, and adding it elsewhere was a bug.**
|
|
206
|
+
// A sequence that does not loop runs its counter one past the end and leaves it there,
|
|
207
|
+
// so `lap` reads `1` from that moment on — and `jump-start` landed on `1 * stepsCount`,
|
|
208
|
+
// which is precisely the ended position it was asked to leave. The symptom: a sequence
|
|
209
|
+
// with `whenVisible='jump-start'` played once, stopped on its last step, and stayed
|
|
210
|
+
// there however many times it was scrolled past. Nothing is lost by dropping the
|
|
211
|
+
// offset here: without `loop`, there is no wrap to misread and `onLooped` never fires.
|
|
215
212
|
const jumpToPosition = (target) => {
|
|
216
213
|
if (step !== undefined || stepsCount <= 0)
|
|
217
214
|
return;
|
|
@@ -219,7 +216,7 @@ export const Sequencer = ({ totalSteps, stepMap, step, defaultStep, play, defaul
|
|
|
219
216
|
const bounded = loop === true
|
|
220
217
|
? absoluteModulo(resolved, stepsCount)
|
|
221
218
|
: clamp(resolved, 0, stepsCount - 1);
|
|
222
|
-
setInternalStep(lap * stepsCount + bounded);
|
|
219
|
+
setInternalStep(loop === true ? lap * stepsCount + bounded : bounded);
|
|
223
220
|
};
|
|
224
221
|
const jumpBy = (offset) => {
|
|
225
222
|
if (step !== undefined || stepsCount <= 0)
|
|
@@ -297,8 +294,25 @@ export const Sequencer = ({ totalSteps, stepMap, step, defaultStep, play, defaul
|
|
|
297
294
|
}
|
|
298
295
|
return positions;
|
|
299
296
|
};
|
|
297
|
+
// **The lap count is the wraps, so it is zero without `loop`.** The internal counter
|
|
298
|
+
// runs one past the end and stays there, which makes `lap` read `1` on a sequence that
|
|
299
|
+
// never wrapped at all — true of the division, false of the thing it is named after,
|
|
300
|
+
// and `onLooped` says the same by never firing without `loop`.
|
|
301
|
+
const publishedLap = loop === true ? lap : 0;
|
|
302
|
+
// Rebuilt from the published lap rather than read off `rawStep`, for that same reason:
|
|
303
|
+
// at the end of a non-looping sequence the internal counter sits one step past the last
|
|
304
|
+
// position, and a number meant to drive a transform must not overshoot the picture.
|
|
305
|
+
const rawStepProp = publishedLap * stepsCount + position;
|
|
306
|
+
const cssCustomProps = {
|
|
307
|
+
'--lm-sequencer-step': `${position}`,
|
|
308
|
+
'--lm-sequencer-active-step': `${activeStep}`,
|
|
309
|
+
'--lm-sequencer-total-steps': `${stepsCount}`,
|
|
310
|
+
'--lm-sequencer-tempo': `${tempo}`,
|
|
311
|
+
'--lm-sequencer-lap': `${publishedLap}`,
|
|
312
|
+
'--lm-sequencer-raw-step': `${rawStepProp}`
|
|
313
|
+
};
|
|
300
314
|
let elementIndex = -1;
|
|
301
|
-
return _jsx("div", { ref: rootRef, className: rootClss, "data-step": position, "data-active-step": activeStep, "data-total-steps": stepsCount, "data-tempo": tempo, children: childrenArr.map((child, childPos) => {
|
|
315
|
+
return _jsx("div", { ref: rootRef, className: rootClss, "data-step": position, "data-active-step": activeStep, "data-total-steps": stepsCount, "data-tempo": tempo, "data-lap": publishedLap, style: { ...cssCustomProps }, children: childrenArr.map((child, childPos) => {
|
|
302
316
|
if (!isValidElement(child))
|
|
303
317
|
return child;
|
|
304
318
|
elementIndex += 1;
|
package/components/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export * as button from './Button/index.js'
|
|
|
3
3
|
export * as clippable from './Clippable/index.js'
|
|
4
4
|
export * as disclaimer from './Disclaimer/index.js'
|
|
5
5
|
export * as drawer from './Drawer/index.js'
|
|
6
|
-
export * as eventListener from './EventListener/index.js'
|
|
7
6
|
export * as gallery from './Gallery/index.js'
|
|
7
|
+
export * as eventListener from './EventListener/index.js'
|
|
8
|
+
export * as galleryAlt from './GalleryAlt/index.js'
|
|
8
9
|
export * as iframe from './Iframe/index.js'
|
|
9
10
|
export * as image from './Image/index.js'
|
|
10
11
|
export * as input from './Input/index.js'
|
|
@@ -18,8 +19,8 @@ export * as resizeObserver from './ResizeObserver/index.js'
|
|
|
18
19
|
export * as scrllgngn from './Scrllgngn/index.js'
|
|
19
20
|
export * as scrollListener from './ScrollListener/index.js'
|
|
20
21
|
export * as select from './Select/index.js'
|
|
21
|
-
export * as shadowRoot from './ShadowRoot/index.js'
|
|
22
22
|
export * as sequencer from './Sequencer/index.js'
|
|
23
|
+
export * as shadowRoot from './ShadowRoot/index.js'
|
|
23
24
|
export * as subtitles from './Subtitles/index.js'
|
|
24
25
|
export * as textarea from './Textarea/index.js'
|
|
25
26
|
export * as uiModule from './UIModule/index.js'
|
package/components/index.js
CHANGED
|
@@ -3,8 +3,9 @@ export * as button from './Button/index.js'
|
|
|
3
3
|
export * as clippable from './Clippable/index.js'
|
|
4
4
|
export * as disclaimer from './Disclaimer/index.js'
|
|
5
5
|
export * as drawer from './Drawer/index.js'
|
|
6
|
-
export * as eventListener from './EventListener/index.js'
|
|
7
6
|
export * as gallery from './Gallery/index.js'
|
|
7
|
+
export * as eventListener from './EventListener/index.js'
|
|
8
|
+
export * as galleryAlt from './GalleryAlt/index.js'
|
|
8
9
|
export * as iframe from './Iframe/index.js'
|
|
9
10
|
export * as image from './Image/index.js'
|
|
10
11
|
export * as input from './Input/index.js'
|
|
@@ -18,8 +19,8 @@ export * as resizeObserver from './ResizeObserver/index.js'
|
|
|
18
19
|
export * as scrllgngn from './Scrllgngn/index.js'
|
|
19
20
|
export * as scrollListener from './ScrollListener/index.js'
|
|
20
21
|
export * as select from './Select/index.js'
|
|
21
|
-
export * as shadowRoot from './ShadowRoot/index.js'
|
|
22
22
|
export * as sequencer from './Sequencer/index.js'
|
|
23
|
+
export * as shadowRoot from './ShadowRoot/index.js'
|
|
23
24
|
export * as subtitles from './Subtitles/index.js'
|
|
24
25
|
export * as textarea from './Textarea/index.js'
|
|
25
26
|
export * as uiModule from './UIModule/index.js'
|
|
@@ -5,6 +5,7 @@ export declare const disclaimer = "lm-disclaimer";
|
|
|
5
5
|
export declare const drawer = "lm-drawer";
|
|
6
6
|
export declare const eventListener = "lm-event-listener";
|
|
7
7
|
export declare const gallery = "lm-gallery";
|
|
8
|
+
export declare const galleryAlt = "lm-gallery-alt";
|
|
8
9
|
export declare const iframe = "lm-iframe";
|
|
9
10
|
export declare const image = "lm-image";
|
|
10
11
|
export declare const input = "lm-input";
|
|
@@ -5,6 +5,7 @@ export const disclaimer = 'lm-disclaimer';
|
|
|
5
5
|
export const drawer = 'lm-drawer';
|
|
6
6
|
export const eventListener = 'lm-event-listener';
|
|
7
7
|
export const gallery = 'lm-gallery';
|
|
8
|
+
export const galleryAlt = 'lm-gallery-alt';
|
|
8
9
|
export const iframe = 'lm-iframe';
|
|
9
10
|
export const image = 'lm-image';
|
|
10
11
|
export const input = 'lm-input';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as download from './download/index.js'
|
|
2
1
|
export * as copy from './copy/index.js'
|
|
2
|
+
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
4
|
export * as move from './move/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as download from './download/index.js'
|
|
2
1
|
export * as copy from './copy/index.js'
|
|
2
|
+
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
4
|
export * as move from './move/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * as download from './download/index.js'
|
|
1
2
|
export * as copy from './copy/index.js'
|
|
2
3
|
export * as exists from './exists/index.js'
|
|
3
4
|
export * as move from './move/index.js'
|
|
4
|
-
export * as download from './download/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/ftps/file/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * as download from './download/index.js'
|
|
1
2
|
export * as copy from './copy/index.js'
|
|
2
3
|
export * as exists from './exists/index.js'
|
|
3
4
|
export * as move from './move/index.js'
|
|
4
|
-
export * as download from './download/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/images/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as create from './create/index.js'
|
|
2
|
-
export * as format from './format/index.js'
|
|
3
2
|
export * as metadata from './metadata/index.js'
|
|
3
|
+
export * as format from './format/index.js'
|
|
4
4
|
export * as transform from './transform/index.js'
|
|
5
5
|
export * as utils from './utils/index.js'
|
package/node/images/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as create from './create/index.js'
|
|
2
|
-
export * as format from './format/index.js'
|
|
3
2
|
export * as metadata from './metadata/index.js'
|
|
3
|
+
export * as format from './format/index.js'
|
|
4
4
|
export * as transform from './transform/index.js'
|
|
5
5
|
export * as utils from './utils/index.js'
|
|
@@ -7,9 +7,9 @@ export * as flip from './flip/index.js'
|
|
|
7
7
|
export * as flop from './flop/index.js'
|
|
8
8
|
export * as hue from './hue/index.js'
|
|
9
9
|
export * as level from './level/index.js'
|
|
10
|
-
export * as lighten from './lighten/index.js'
|
|
11
10
|
export * as normalize from './normalize/index.js'
|
|
12
11
|
export * as overlay from './overlay/index.js'
|
|
12
|
+
export * as lighten from './lighten/index.js'
|
|
13
13
|
export * as resize from './resize/index.js'
|
|
14
14
|
export * as rotate from './rotate/index.js'
|
|
15
15
|
export * as saturate from './saturate/index.js'
|
|
@@ -7,9 +7,9 @@ export * as flip from './flip/index.js'
|
|
|
7
7
|
export * as flop from './flop/index.js'
|
|
8
8
|
export * as hue from './hue/index.js'
|
|
9
9
|
export * as level from './level/index.js'
|
|
10
|
-
export * as lighten from './lighten/index.js'
|
|
11
10
|
export * as normalize from './normalize/index.js'
|
|
12
11
|
export * as overlay from './overlay/index.js'
|
|
12
|
+
export * as lighten from './lighten/index.js'
|
|
13
13
|
export * as resize from './resize/index.js'
|
|
14
14
|
export * as rotate from './rotate/index.js'
|
|
15
15
|
export * as saturate from './saturate/index.js'
|
package/node/process/index.d.ts
CHANGED
package/node/process/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/tools",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -1453,6 +1453,13 @@
|
|
|
1453
1453
|
"./components/Gallery/index.js": {
|
|
1454
1454
|
"import": "./components/Gallery/index.js"
|
|
1455
1455
|
},
|
|
1456
|
+
"./components/GalleryAlt": {
|
|
1457
|
+
"import": "./components/GalleryAlt/index.js",
|
|
1458
|
+
"types": "./components/GalleryAlt/index.d.ts"
|
|
1459
|
+
},
|
|
1460
|
+
"./components/GalleryAlt/index.js": {
|
|
1461
|
+
"import": "./components/GalleryAlt/index.js"
|
|
1462
|
+
},
|
|
1456
1463
|
"./components/Iframe": {
|
|
1457
1464
|
"import": "./components/Iframe/index.js",
|
|
1458
1465
|
"types": "./components/Iframe/index.d.ts"
|