@design-edito/tools 0.5.16 → 0.5.18

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.
Files changed (63) hide show
  1. package/agnostic/colors/index.d.ts +4 -4
  2. package/agnostic/colors/index.js +4 -4
  3. package/agnostic/css/index.d.ts +1 -1
  4. package/agnostic/css/index.js +1 -1
  5. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +10 -10
  6. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +10 -10
  7. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +6 -6
  8. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +6 -6
  9. package/agnostic/html/index.d.ts +2 -2
  10. package/agnostic/html/index.js +2 -2
  11. package/agnostic/index.d.ts +5 -5
  12. package/agnostic/index.js +5 -5
  13. package/agnostic/misc/index.d.ts +5 -5
  14. package/agnostic/misc/index.js +5 -5
  15. package/agnostic/numbers/index.d.ts +2 -2
  16. package/agnostic/numbers/index.js +2 -2
  17. package/agnostic/objects/index.d.ts +2 -2
  18. package/agnostic/objects/index.js +2 -2
  19. package/agnostic/sanitization/index.d.ts +1 -1
  20. package/agnostic/sanitization/index.js +1 -1
  21. package/agnostic/subtitles/index.d.ts +1 -1
  22. package/agnostic/subtitles/index.js +1 -1
  23. package/agnostic/time/index.d.ts +2 -2
  24. package/agnostic/time/index.js +2 -2
  25. package/components/Image/index.d.ts +6 -0
  26. package/components/Image/index.js +3 -18
  27. package/components/IntersectionObserver/index.d.ts +28 -3
  28. package/components/IntersectionObserver/index.js +51 -20
  29. package/components/Video/index.controlled.d.ts +6 -22
  30. package/components/Video/index.controlled.js +28 -42
  31. package/components/Video/index.d.ts +28 -39
  32. package/components/Video/index.js +90 -92
  33. package/components/Video/types.d.ts +26 -0
  34. package/components/Video/types.js +1 -0
  35. package/components/Video/utils.d.ts +38 -1
  36. package/components/Video/utils.js +23 -4
  37. package/components/index.d.ts +5 -5
  38. package/components/index.js +5 -5
  39. package/components/public-classnames.d.ts +0 -1
  40. package/components/public-classnames.js +0 -1
  41. package/components/utils/index.d.ts +21 -0
  42. package/components/utils/index.js +40 -0
  43. package/components/utils/viewport-behaviours/index.d.ts +54 -0
  44. package/components/utils/viewport-behaviours/index.js +163 -0
  45. package/components/utils/viewport-behaviours/types.d.ts +109 -0
  46. package/components/utils/viewport-behaviours/types.js +14 -0
  47. package/components/utils/viewport-behaviours/utils.d.ts +26 -0
  48. package/components/utils/viewport-behaviours/utils.js +55 -0
  49. package/node/@aws-s3/storage/file/index.d.ts +2 -2
  50. package/node/@aws-s3/storage/file/index.js +2 -2
  51. package/node/@google-cloud/storage/file/index.d.ts +2 -2
  52. package/node/@google-cloud/storage/file/index.js +2 -2
  53. package/node/cloud-storage/operations/index.d.ts +1 -1
  54. package/node/cloud-storage/operations/index.js +1 -1
  55. package/node/files/index.d.ts +1 -1
  56. package/node/files/index.js +1 -1
  57. package/node/images/index.d.ts +1 -1
  58. package/node/images/index.js +1 -1
  59. package/node/images/transform/operations/index.d.ts +5 -5
  60. package/node/images/transform/operations/index.js +5 -5
  61. package/node/process/index.d.ts +1 -1
  62. package/node/process/index.js +1 -1
  63. package/package.json +16 -1
@@ -1,12 +1,12 @@
1
- export * as convert from './convert/index.js'
1
+ export * as channels from './channels/index.js'
2
2
  export * as contrast from './contrast/index.js'
3
+ export * as convert from './convert/index.js'
3
4
  export * as distance from './distance/index.js'
4
5
  export * as grayscale from './grayscale/index.js'
5
- export * as invert from './invert/index.js'
6
6
  export * as lerp from './lerp/index.js'
7
- export * as palette from './palette/index.js'
8
7
  export * as luminance from './luminance/index.js'
8
+ export * as palette from './palette/index.js'
9
9
  export * as rotate from './rotate/index.js'
10
10
  export * as tidy from './tidy/index.js'
11
11
  export * as typechecks from './typechecks/index.js'
12
- export * as channels from './channels/index.js'
12
+ export * as invert from './invert/index.js'
@@ -1,12 +1,12 @@
1
- export * as convert from './convert/index.js'
1
+ export * as channels from './channels/index.js'
2
2
  export * as contrast from './contrast/index.js'
3
+ export * as convert from './convert/index.js'
3
4
  export * as distance from './distance/index.js'
4
5
  export * as grayscale from './grayscale/index.js'
5
- export * as invert from './invert/index.js'
6
6
  export * as lerp from './lerp/index.js'
7
- export * as palette from './palette/index.js'
8
7
  export * as luminance from './luminance/index.js'
8
+ export * as palette from './palette/index.js'
9
9
  export * as rotate from './rotate/index.js'
10
10
  export * as tidy from './tidy/index.js'
11
11
  export * as typechecks from './typechecks/index.js'
12
- export * as channels from './channels/index.js'
12
+ export * as invert from './invert/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as bem from './bem/index.js'
2
- export * as generateNiceColor from './generate-nice-color/index.js'
3
2
  export * as clss from './clss/index.js'
3
+ export * as generateNiceColor from './generate-nice-color/index.js'
4
4
  export * as isValidCssClassName from './is-valid-css-class-name/index.js'
5
5
  export * as scale from './scale/index.js'
6
6
  export * as stylesSet from './styles-set/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as bem from './bem/index.js'
2
- export * as generateNiceColor from './generate-nice-color/index.js'
3
2
  export * as clss from './clss/index.js'
3
+ export * as generateNiceColor from './generate-nice-color/index.js'
4
4
  export * as isValidCssClassName from './is-valid-css-class-name/index.js'
5
5
  export * as scale from './scale/index.js'
6
6
  export * as stylesSet from './styles-set/index.js'
@@ -1,52 +1,52 @@
1
+ export * as add from './add/index.js'
1
2
  export * as addclass from './addclass/index.js'
2
3
  export * as and from './and/index.js'
3
4
  export * as append from './append/index.js'
4
5
  export * as at from './at/index.js'
5
- export * as add from './add/index.js'
6
6
  export * as call from './call/index.js'
7
- export * as deleteproperties from './deleteproperties/index.js'
8
7
  export * as clone from './clone/index.js'
8
+ export * as deleteproperties from './deleteproperties/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
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'
17
16
  export * as join from './join/index.js'
17
+ export * as initialize from './initialize/index.js'
18
18
  export * as length from './length/index.js'
19
19
  export * as map from './map/index.js'
20
20
  export * as negate from './negate/index.js'
21
- export * as or from './or/index.js'
22
21
  export * as notrailing from './notrailing/index.js'
22
+ export * as or from './or/index.js'
23
23
  export * as pickrandom from './pickrandom/index.js'
24
- export * as populate from './populate/index.js'
25
24
  export * as print from './print/index.js'
25
+ export * as populate from './populate/index.js'
26
26
  export * as push from './push/index.js'
27
27
  export * as pusheach from './pusheach/index.js'
28
28
  export * as recordtoarray from './recordtoarray/index.js'
29
29
  export * as removeattribute from './removeattribute/index.js'
30
30
  export * as removeclass from './removeclass/index.js'
31
- export * as renameproperty from './renameproperty/index.js'
32
31
  export * as replace from './replace/index.js'
32
+ export * as renameproperty from './renameproperty/index.js'
33
33
  export * as select from './select/index.js'
34
- export * as setproperty from './setproperty/index.js'
35
- export * as setattribute from './setattribute/index.js'
36
34
  export * as set from './set/index.js'
35
+ export * as setattribute from './setattribute/index.js'
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'
39
39
  export * as spread from './spread/index.js'
40
40
  export * as toarray from './toarray/index.js'
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'
43
44
  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
- export * as toboolean from './toboolean/index.js'
47
47
  export * as torecord from './torecord/index.js'
48
48
  export * as tostring from './tostring/index.js'
49
- export * as toref from './toref/index.js'
50
49
  export * as totext from './totext/index.js'
51
50
  export * as transformselected from './transformselected/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as toref from './toref/index.js'
@@ -1,52 +1,52 @@
1
+ export * as add from './add/index.js'
1
2
  export * as addclass from './addclass/index.js'
2
3
  export * as and from './and/index.js'
3
4
  export * as append from './append/index.js'
4
5
  export * as at from './at/index.js'
5
- export * as add from './add/index.js'
6
6
  export * as call from './call/index.js'
7
- export * as deleteproperties from './deleteproperties/index.js'
8
7
  export * as clone from './clone/index.js'
8
+ export * as deleteproperties from './deleteproperties/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
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'
17
16
  export * as join from './join/index.js'
17
+ export * as initialize from './initialize/index.js'
18
18
  export * as length from './length/index.js'
19
19
  export * as map from './map/index.js'
20
20
  export * as negate from './negate/index.js'
21
- export * as or from './or/index.js'
22
21
  export * as notrailing from './notrailing/index.js'
22
+ export * as or from './or/index.js'
23
23
  export * as pickrandom from './pickrandom/index.js'
24
- export * as populate from './populate/index.js'
25
24
  export * as print from './print/index.js'
25
+ export * as populate from './populate/index.js'
26
26
  export * as push from './push/index.js'
27
27
  export * as pusheach from './pusheach/index.js'
28
28
  export * as recordtoarray from './recordtoarray/index.js'
29
29
  export * as removeattribute from './removeattribute/index.js'
30
30
  export * as removeclass from './removeclass/index.js'
31
- export * as renameproperty from './renameproperty/index.js'
32
31
  export * as replace from './replace/index.js'
32
+ export * as renameproperty from './renameproperty/index.js'
33
33
  export * as select from './select/index.js'
34
- export * as setproperty from './setproperty/index.js'
35
- export * as setattribute from './setattribute/index.js'
36
34
  export * as set from './set/index.js'
35
+ export * as setattribute from './setattribute/index.js'
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'
39
39
  export * as spread from './spread/index.js'
40
40
  export * as toarray from './toarray/index.js'
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'
43
44
  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
- export * as toboolean from './toboolean/index.js'
47
47
  export * as torecord from './torecord/index.js'
48
48
  export * as tostring from './tostring/index.js'
49
- export * as toref from './toref/index.js'
50
49
  export * as totext from './totext/index.js'
51
50
  export * as transformselected from './transformselected/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as toref from './toref/index.js'
@@ -1,13 +1,13 @@
1
- export * as array from './array/index.js'
2
1
  export * as any from './any/index.js'
2
+ export * as array from './array/index.js'
3
3
  export * as boolean from './boolean/index.js'
4
- export * as get from './get/index.js'
5
4
  export * as element from './element/index.js'
6
- export * as guess from './guess/index.js'
5
+ export * as get from './get/index.js'
7
6
  export * as nodelist from './nodelist/index.js'
8
- export * as record from './record/index.js'
9
7
  export * as null from './null/index.js'
10
- export * as ref from './ref/index.js'
8
+ export * as number from './number/index.js'
9
+ export * as guess from './guess/index.js'
10
+ export * as record from './record/index.js'
11
11
  export * as string from './string/index.js'
12
12
  export * as text from './text/index.js'
13
- export * as number from './number/index.js'
13
+ export * as ref from './ref/index.js'
@@ -1,13 +1,13 @@
1
- export * as array from './array/index.js'
2
1
  export * as any from './any/index.js'
2
+ export * as array from './array/index.js'
3
3
  export * as boolean from './boolean/index.js'
4
- export * as get from './get/index.js'
5
4
  export * as element from './element/index.js'
6
- export * as guess from './guess/index.js'
5
+ export * as get from './get/index.js'
7
6
  export * as nodelist from './nodelist/index.js'
8
- export * as record from './record/index.js'
9
7
  export * as null from './null/index.js'
10
- export * as ref from './ref/index.js'
8
+ export * as number from './number/index.js'
9
+ export * as guess from './guess/index.js'
10
+ export * as record from './record/index.js'
11
11
  export * as string from './string/index.js'
12
12
  export * as text from './text/index.js'
13
- export * as number from './number/index.js'
13
+ export * as ref from './ref/index.js'
@@ -1,8 +1,8 @@
1
+ export * as deepSelect from './deep-select/index.js'
1
2
  export * as getNodeAncestors from './get-node-ancestors/index.js'
2
- export * as getPositionInsideParent from './get-position-inside-parent/index.js'
3
3
  export * as hyperJson from './hyper-json/index.js'
4
+ export * as getPositionInsideParent from './get-position-inside-parent/index.js'
4
5
  export * as insertNode from './insert-node/index.js'
5
- export * as deepSelect from './deep-select/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'
@@ -1,8 +1,8 @@
1
+ export * as deepSelect from './deep-select/index.js'
1
2
  export * as getNodeAncestors from './get-node-ancestors/index.js'
2
- export * as getPositionInsideParent from './get-position-inside-parent/index.js'
3
3
  export * as hyperJson from './hyper-json/index.js'
4
+ export * as getPositionInsideParent from './get-position-inside-parent/index.js'
4
5
  export * as insertNode from './insert-node/index.js'
5
- export * as deepSelect from './deep-select/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'
@@ -1,17 +1,17 @@
1
+ export * as arrays from './arrays/index.js'
1
2
  export * as booleans from './booleans/index.js'
2
3
  export * as colors from './colors/index.js'
3
- export * as css from './css/index.js'
4
4
  export * as errors from './errors/index.js'
5
- export * as arrays from './arrays/index.js'
6
5
  export * as html from './html/index.js'
6
+ export * as css from './css/index.js'
7
7
  export * as misc from './misc/index.js'
8
8
  export * as numbers from './numbers/index.js'
9
- export * as objects from './objects/index.js'
10
9
  export * as optim from './optim/index.js'
10
+ export * as objects from './objects/index.js'
11
11
  export * as random from './random/index.js'
12
- export * as regexps from './regexps/index.js'
13
12
  export * as sanitization from './sanitization/index.js'
14
13
  export * as strings from './strings/index.js'
15
- export * as time from './time/index.js'
14
+ export * as regexps from './regexps/index.js'
16
15
  export * as subtitles from './subtitles/index.js'
16
+ export * as time from './time/index.js'
17
17
  export * as typescript from './typescript/index.js'
package/agnostic/index.js CHANGED
@@ -1,17 +1,17 @@
1
+ export * as arrays from './arrays/index.js'
1
2
  export * as booleans from './booleans/index.js'
2
3
  export * as colors from './colors/index.js'
3
- export * as css from './css/index.js'
4
4
  export * as errors from './errors/index.js'
5
- export * as arrays from './arrays/index.js'
6
5
  export * as html from './html/index.js'
6
+ export * as css from './css/index.js'
7
7
  export * as misc from './misc/index.js'
8
8
  export * as numbers from './numbers/index.js'
9
- export * as objects from './objects/index.js'
10
9
  export * as optim from './optim/index.js'
10
+ export * as objects from './objects/index.js'
11
11
  export * as random from './random/index.js'
12
- export * as regexps from './regexps/index.js'
13
12
  export * as sanitization from './sanitization/index.js'
14
13
  export * as strings from './strings/index.js'
15
- export * as time from './time/index.js'
14
+ export * as regexps from './regexps/index.js'
16
15
  export * as subtitles from './subtitles/index.js'
16
+ export * as time from './time/index.js'
17
17
  export * as typescript from './typescript/index.js'
@@ -1,12 +1,12 @@
1
- export * as assert from './assert/index.js'
2
1
  export * as cast from './cast/index.js'
2
+ export * as assert from './assert/index.js'
3
3
  export * as crawler from './crawler/index.js'
4
- export * as dataSize from './data-size/index.js'
5
4
  export * as connection from './connection/index.js'
5
+ export * as crossenv from './crossenv/index.js'
6
+ export * as dataSize from './data-size/index.js'
7
+ export * as isNullish from './is-nullish/index.js'
6
8
  export * as isConstructorFunction from './is-constructor-function/index.js'
7
9
  export * as logs from './logs/index.js'
8
10
  export * as loremIpsum from './lorem-ipsum/index.js'
9
- export * as crossenv from './crossenv/index.js'
10
- export * as outcome from './outcome/index.js'
11
- export * as isNullish from './is-nullish/index.js'
12
11
  export * as normalizeExtension from './normalize-extension/index.js'
12
+ export * as outcome from './outcome/index.js'
@@ -1,12 +1,12 @@
1
- export * as assert from './assert/index.js'
2
1
  export * as cast from './cast/index.js'
2
+ export * as assert from './assert/index.js'
3
3
  export * as crawler from './crawler/index.js'
4
- export * as dataSize from './data-size/index.js'
5
4
  export * as connection from './connection/index.js'
5
+ export * as crossenv from './crossenv/index.js'
6
+ export * as dataSize from './data-size/index.js'
7
+ export * as isNullish from './is-nullish/index.js'
6
8
  export * as isConstructorFunction from './is-constructor-function/index.js'
7
9
  export * as logs from './logs/index.js'
8
10
  export * as loremIpsum from './lorem-ipsum/index.js'
9
- export * as crossenv from './crossenv/index.js'
10
- export * as outcome from './outcome/index.js'
11
- export * as isNullish from './is-nullish/index.js'
12
11
  export * as normalizeExtension from './normalize-extension/index.js'
12
+ export * as outcome from './outcome/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
+ export * as enums from './enums/index.js'
2
3
  export * as flattenGetters from './flatten-getters/index.js'
3
4
  export * as isObject from './is-object/index.js'
4
5
  export * as isRecord from './is-record/index.js'
5
6
  export * as recordFormat from './record-format/index.js'
6
- export * as recordMap from './record-map/index.js'
7
- export * as enums from './enums/index.js'
8
7
  export * as sortKeys from './sort-keys/index.js'
8
+ export * as recordMap from './record-map/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'
2
3
  export * as flattenGetters from './flatten-getters/index.js'
3
4
  export * as isObject from './is-object/index.js'
4
5
  export * as isRecord from './is-record/index.js'
5
6
  export * as recordFormat from './record-format/index.js'
6
- export * as recordMap from './record-map/index.js'
7
- export * as enums from './enums/index.js'
8
7
  export * as sortKeys from './sort-keys/index.js'
8
+ export * as recordMap from './record-map/index.js'
9
9
  export * as validation from './validation/index.js'
@@ -1,4 +1,4 @@
1
1
  export * as fileName from './file-name/index.js'
2
- export * as html from './html/index.js'
3
2
  export * as path from './path/index.js'
4
3
  export * as userInput from './user-input/index.js'
4
+ export * as html from './html/index.js'
@@ -1,4 +1,4 @@
1
1
  export * as fileName from './file-name/index.js'
2
- export * as html from './html/index.js'
3
2
  export * as path from './path/index.js'
4
3
  export * as userInput from './user-input/index.js'
4
+ export * as html from './html/index.js'
@@ -1,2 +1,2 @@
1
- export * as parseSrt from './parse-srt/index.js'
2
1
  export * as srtTimecodeToMs from './srt-timecode-to-ms/index.js'
2
+ export * as parseSrt from './parse-srt/index.js'
@@ -1,2 +1,2 @@
1
- export * as parseSrt from './parse-srt/index.js'
2
1
  export * as srtTimecodeToMs from './srt-timecode-to-ms/index.js'
2
+ export * as parseSrt from './parse-srt/index.js'
@@ -1,5 +1,5 @@
1
- export * as dates from './dates/index.js'
2
- export * as duration from './duration/index.js'
3
1
  export * as timeout from './timeout/index.js'
4
2
  export * as transitions from './transitions/index.js'
5
3
  export * as wait from './wait/index.js'
4
+ export * as dates from './dates/index.js'
5
+ export * as duration from './duration/index.js'
@@ -1,5 +1,5 @@
1
- export * as dates from './dates/index.js'
2
- export * as duration from './duration/index.js'
3
1
  export * as timeout from './timeout/index.js'
4
2
  export * as transitions from './transitions/index.js'
5
3
  export * as wait from './wait/index.js'
4
+ export * as dates from './dates/index.js'
5
+ export * as duration from './duration/index.js'
@@ -7,6 +7,12 @@ import type { WithClassName } from '../utils/types.js';
7
7
  * @property type - MIME type hint for the source (e.g. `'image/webp'`).
8
8
  * @property media - Media condition under which this source is selected (e.g. `'(max-width: 768px)'`).
9
9
  * @property sizes - Sizes attribute forwarded to the `<source>` element.
10
+ *
11
+ * **A picture source is not a video source.** `Video` keeps a shape of its own: a
12
+ * `<source>` inside a `<video>` carries `src` and nothing else useful, where this one
13
+ * carries `srcSet`, `media` and `sizes`, and neither element accepts the other's
14
+ * attributes. What the two do share is how a list of them is read — see
15
+ * `parseSourceList` in `components/utils`, whose `stringKey` is exactly that difference.
10
16
  */
11
17
  type SourceData = {
12
18
  srcSet?: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { clss } from '../../agnostic/css/clss/index.js';
4
- import { mergeClassNames } from '../utils/index.js';
4
+ import { mergeClassNames, parseSourceList } from '../utils/index.js';
5
5
  import { image as publicClassName } from '../public-classnames.js';
6
6
  import cssModule from './styles.module.css';
7
7
  /**
@@ -19,27 +19,12 @@ import cssModule from './styles.module.css';
19
19
  */
20
20
  export const Image = ({ sources, className, ...intrinsicImgAttributes }) => {
21
21
  // State
22
- const parsedSources = useMemo(() => {
23
- if (sources === undefined)
24
- return [];
25
- if (typeof sources === 'string')
26
- return [{ srcSet: sources }];
27
- if (Array.isArray(sources)) {
28
- if (sources.length === 0)
29
- return [];
30
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- first element sampled just above; array is expected to be homogeneous
31
- if (typeof sources[0] === 'string')
32
- return sources.map(srcSet => ({ srcSet }));
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- first element was checked not to be a string just above; array is expected to be homogeneous
34
- return sources;
35
- }
36
- return [];
37
- }, [sources]);
22
+ const parsedSources = useMemo(() => parseSourceList(sources, 'srcSet'), [sources]);
38
23
  // Rendering
39
24
  const c = clss(publicClassName, { cssModule });
40
25
  const rootClss = mergeClassNames(c(), className);
41
26
  const pictureClss = c('picture');
42
27
  const imgClss = c('image');
43
- const pictureContent = _jsxs("picture", { className: pictureClss, children: [parsedSources.map((source, index) => _jsx("source", { srcSet: typeof source === 'string' ? source : source.srcSet, type: typeof source === 'string' ? undefined : source.type, media: typeof source === 'string' ? undefined : source.media, sizes: typeof source === 'string' ? undefined : source.sizes }, index)), _jsx("img", { className: imgClss, ...intrinsicImgAttributes })] });
28
+ const pictureContent = _jsxs("picture", { className: pictureClss, children: [parsedSources.map((source, index) => _jsx("source", { srcSet: source.srcSet, type: source.type, media: source.media, sizes: source.sizes }, index)), _jsx("img", { className: imgClss, ...intrinsicImgAttributes })] });
44
29
  return _jsx("figure", { className: rootClss, children: pictureContent });
45
30
  };
@@ -1,4 +1,4 @@
1
- import { type PropsWithChildren, type FunctionComponent } from 'react';
1
+ import { type PropsWithChildren, type FunctionComponent, type RefObject } from 'react';
2
2
  import type { WithClassName } from '../utils/types.js';
3
3
  /** Alias for the native IntersectionObserver interface. */
4
4
  export type IO = IntersectionObserver;
@@ -40,18 +40,43 @@ export type Props = PropsWithChildren<WithClassName<{
40
40
  observer: IO;
41
41
  }) => void;
42
42
  } & ObserverOptions>>;
43
+ /**
44
+ * Observes an element a caller already renders, rather than one wrapped in a div of
45
+ * our own.
46
+ *
47
+ * This is the whole of the behaviour; {@link IntersectionObserverComponent} is this
48
+ * hook plus a div to hang it on. Reach for the hook when the element to watch is
49
+ * already in the tree — a component's own root, typically — and for the component
50
+ * when there is nothing to watch yet and a box has to be created.
51
+ *
52
+ * @param targetRef - The element to observe. Nothing happens until it is attached.
53
+ * @param options - See {@link ObserverOptions}.
54
+ * @param onIntersected - Called on every intersection change.
55
+ * @param enabled - `false` skips the observer entirely, for a caller whose need for
56
+ * it depends on its own props. A hook cannot be called conditionally; this is how
57
+ * the condition is expressed.
58
+ *
59
+ * @returns The latest {@link IntersectionObserverEntry}, or `null` before the first.
60
+ *
61
+ * @remarks
62
+ * - Automatically creates and disconnects the {@link IntersectionObserver} instance.
63
+ * - Re-observes the element shortly after mount to handle late layout changes.
64
+ */
65
+ export declare function useIntersectionObserver(targetRef: RefObject<Element | null>, { root, rootMargin, threshold }: ObserverOptions, onIntersected?: Props['onIntersected'], enabled?: boolean): IOE | null;
43
66
  /**
44
67
  * Component that observes its root element using the IntersectionObserver API
45
68
  * and notifies consumers about visibility changes.
46
69
  *
70
+ * A div and {@link useIntersectionObserver}, and nothing else. A component that
71
+ * already renders the element it wants watched should use the hook and keep its own
72
+ * root, rather than gain a wrapper it has no other use for.
73
+ *
47
74
  * @param props - Component properties.
48
75
  * @see {@link Props}
49
76
  *
50
77
  * @returns A div element wrapping `children`, observed for intersection changes.
51
78
  *
52
79
  * @remarks
53
- * - Automatically creates and disconnects the {@link IntersectionObserver} instance.
54
- * - Re-observes the element shortly after mount to handle late layout changes.
55
80
  * - Adds an `is-intersecting` modifier class when the element is intersecting.
56
81
  */
57
82
  export declare const IntersectionObserverComponent: FunctionComponent<Props>;