@design-edito/tools 0.5.4 → 0.5.6

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 (69) hide show
  1. package/agnostic/colors/index.d.ts +2 -2
  2. package/agnostic/colors/index.js +2 -2
  3. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +6 -6
  4. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +6 -6
  5. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +2 -2
  6. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +2 -2
  7. package/agnostic/html/index.d.ts +1 -1
  8. package/agnostic/html/index.js +1 -1
  9. package/agnostic/index.d.ts +2 -2
  10. package/agnostic/index.js +2 -2
  11. package/agnostic/misc/index.d.ts +1 -1
  12. package/agnostic/misc/index.js +1 -1
  13. package/agnostic/misc/logs/index.d.ts +1 -1
  14. package/agnostic/misc/logs/index.js +1 -1
  15. package/agnostic/numbers/index.d.ts +2 -2
  16. package/agnostic/numbers/index.js +2 -2
  17. package/agnostic/objects/index.d.ts +1 -1
  18. package/agnostic/objects/index.js +1 -1
  19. package/agnostic/strings/index.d.ts +2 -2
  20. package/agnostic/strings/index.js +2 -2
  21. package/components/Clippable/index.d.ts +6 -2
  22. package/components/Clippable/index.js +8 -4
  23. package/components/Drawer/index.d.ts +6 -0
  24. package/components/Drawer/index.js +3 -1
  25. package/components/Gallery/index.d.ts +6 -0
  26. package/components/Gallery/index.js +3 -1
  27. package/components/Paginator/index.d.ts +5 -0
  28. package/components/Paginator/index.js +2 -1
  29. package/components/Scrllgngn/index.d.ts +35 -2
  30. package/components/Scrllgngn/index.js +160 -12
  31. package/components/Scrllgngn/utils.d.ts +138 -3
  32. package/components/Scrllgngn/utils.js +197 -4
  33. package/components/ScrollListener/index.d.ts +7 -0
  34. package/components/ScrollListener/index.js +22 -2
  35. package/components/ScrollListener/utils.d.ts +8 -0
  36. package/components/ScrollListener/utils.js +11 -0
  37. package/components/Sequencer/index.d.ts +8 -0
  38. package/components/Sequencer/index.js +19 -2
  39. package/components/Theatre/index.d.ts +16 -6
  40. package/components/Theatre/index.js +15 -8
  41. package/components/index.d.ts +6 -6
  42. package/components/index.js +6 -6
  43. package/index.d.ts +1 -1
  44. package/index.js +1 -1
  45. package/node/@aws-s3/storage/directory/index.d.ts +1 -1
  46. package/node/@aws-s3/storage/directory/index.js +1 -1
  47. package/node/@aws-s3/storage/index.d.ts +1 -1
  48. package/node/@aws-s3/storage/index.js +1 -1
  49. package/node/@google-cloud/storage/directory/index.d.ts +2 -2
  50. package/node/@google-cloud/storage/directory/index.js +2 -2
  51. package/node/@google-cloud/storage/file/index.d.ts +4 -4
  52. package/node/@google-cloud/storage/file/index.js +4 -4
  53. package/node/cloud-storage/operations/index.d.ts +1 -1
  54. package/node/cloud-storage/operations/index.js +1 -1
  55. package/node/ftps/file/index.d.ts +2 -2
  56. package/node/ftps/file/index.js +2 -2
  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 +1 -1
  60. package/node/images/transform/operations/index.js +1 -1
  61. package/node/index.d.ts +1 -1
  62. package/node/index.js +1 -1
  63. package/node/process/index.d.ts +1 -1
  64. package/node/process/index.js +1 -1
  65. package/node/sftp/file/index.d.ts +1 -1
  66. package/node/sftp/file/index.js +1 -1
  67. package/node/sftp/index.d.ts +1 -1
  68. package/node/sftp/index.js +1 -1
  69. package/package.json +1 -1
@@ -4,9 +4,9 @@ export * as convert from './convert/index.js'
4
4
  export * as distance from './distance/index.js'
5
5
  export * as grayscale from './grayscale/index.js'
6
6
  export * as invert from './invert/index.js'
7
- export * as lerp from './lerp/index.js'
8
7
  export * as luminance from './luminance/index.js'
8
+ export * as lerp from './lerp/index.js'
9
9
  export * as palette from './palette/index.js'
10
- export * as rotate from './rotate/index.js'
11
10
  export * as tidy from './tidy/index.js'
11
+ export * as rotate from './rotate/index.js'
12
12
  export * as typechecks from './typechecks/index.js'
@@ -4,9 +4,9 @@ export * as convert from './convert/index.js'
4
4
  export * as distance from './distance/index.js'
5
5
  export * as grayscale from './grayscale/index.js'
6
6
  export * as invert from './invert/index.js'
7
- export * as lerp from './lerp/index.js'
8
7
  export * as luminance from './luminance/index.js'
8
+ export * as lerp from './lerp/index.js'
9
9
  export * as palette from './palette/index.js'
10
- export * as rotate from './rotate/index.js'
11
10
  export * as tidy from './tidy/index.js'
11
+ export * as rotate from './rotate/index.js'
12
12
  export * as typechecks from './typechecks/index.js'
@@ -2,9 +2,9 @@ export * as add from './add/index.js'
2
2
  export * as addclass from './addclass/index.js'
3
3
  export * as and from './and/index.js'
4
4
  export * as append from './append/index.js'
5
+ export * as clone from './clone/index.js'
5
6
  export * as at from './at/index.js'
6
7
  export * as call from './call/index.js'
7
- export * as clone from './clone/index.js'
8
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'
@@ -12,22 +12,22 @@ 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 if from './if/index.js'
16
15
  export * as initialize from './initialize/index.js'
16
+ export * as if from './if/index.js'
17
17
  export * as join from './join/index.js'
18
+ export * as map from './map/index.js'
18
19
  export * as length from './length/index.js'
19
20
  export * as negate from './negate/index.js'
20
- export * as map from './map/index.js'
21
21
  export * as notrailing from './notrailing/index.js'
22
- export * as or from './or/index.js'
23
22
  export * as pickrandom from './pickrandom/index.js'
24
23
  export * as populate from './populate/index.js'
25
24
  export * as print from './print/index.js'
26
- export * as push from './push/index.js'
25
+ export * as or from './or/index.js'
27
26
  export * as pusheach from './pusheach/index.js'
28
27
  export * as recordtoarray from './recordtoarray/index.js'
29
28
  export * as removeattribute from './removeattribute/index.js'
30
29
  export * as removeclass from './removeclass/index.js'
30
+ export * as push from './push/index.js'
31
31
  export * as renameproperty from './renameproperty/index.js'
32
32
  export * as replace from './replace/index.js'
33
33
  export * as select from './select/index.js'
@@ -48,5 +48,5 @@ export * as torecord from './torecord/index.js'
48
48
  export * as toref from './toref/index.js'
49
49
  export * as tostring from './tostring/index.js'
50
50
  export * as totext from './totext/index.js'
51
- export * as transformselected from './transformselected/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as transformselected from './transformselected/index.js'
@@ -2,9 +2,9 @@ export * as add from './add/index.js'
2
2
  export * as addclass from './addclass/index.js'
3
3
  export * as and from './and/index.js'
4
4
  export * as append from './append/index.js'
5
+ export * as clone from './clone/index.js'
5
6
  export * as at from './at/index.js'
6
7
  export * as call from './call/index.js'
7
- export * as clone from './clone/index.js'
8
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'
@@ -12,22 +12,22 @@ 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 if from './if/index.js'
16
15
  export * as initialize from './initialize/index.js'
16
+ export * as if from './if/index.js'
17
17
  export * as join from './join/index.js'
18
+ export * as map from './map/index.js'
18
19
  export * as length from './length/index.js'
19
20
  export * as negate from './negate/index.js'
20
- export * as map from './map/index.js'
21
21
  export * as notrailing from './notrailing/index.js'
22
- export * as or from './or/index.js'
23
22
  export * as pickrandom from './pickrandom/index.js'
24
23
  export * as populate from './populate/index.js'
25
24
  export * as print from './print/index.js'
26
- export * as push from './push/index.js'
25
+ export * as or from './or/index.js'
27
26
  export * as pusheach from './pusheach/index.js'
28
27
  export * as recordtoarray from './recordtoarray/index.js'
29
28
  export * as removeattribute from './removeattribute/index.js'
30
29
  export * as removeclass from './removeclass/index.js'
30
+ export * as push from './push/index.js'
31
31
  export * as renameproperty from './renameproperty/index.js'
32
32
  export * as replace from './replace/index.js'
33
33
  export * as select from './select/index.js'
@@ -48,5 +48,5 @@ export * as torecord from './torecord/index.js'
48
48
  export * as toref from './toref/index.js'
49
49
  export * as tostring from './tostring/index.js'
50
50
  export * as totext from './totext/index.js'
51
- export * as transformselected from './transformselected/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as transformselected from './transformselected/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as any from './any/index.js'
2
- export * as array from './array/index.js'
3
2
  export * as boolean from './boolean/index.js'
3
+ export * as array from './array/index.js'
4
4
  export * as element from './element/index.js'
5
5
  export * as get from './get/index.js'
6
6
  export * as guess from './guess/index.js'
7
7
  export * as null from './null/index.js'
8
- export * as number from './number/index.js'
9
8
  export * as nodelist from './nodelist/index.js'
9
+ export * as number from './number/index.js'
10
10
  export * as record from './record/index.js'
11
11
  export * as ref from './ref/index.js'
12
12
  export * as string from './string/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as any from './any/index.js'
2
- export * as array from './array/index.js'
3
2
  export * as boolean from './boolean/index.js'
3
+ export * as array from './array/index.js'
4
4
  export * as element from './element/index.js'
5
5
  export * as get from './get/index.js'
6
6
  export * as guess from './guess/index.js'
7
7
  export * as null from './null/index.js'
8
- export * as number from './number/index.js'
9
8
  export * as nodelist from './nodelist/index.js'
9
+ export * as number from './number/index.js'
10
10
  export * as record from './record/index.js'
11
11
  export * as ref from './ref/index.js'
12
12
  export * as string from './string/index.js'
@@ -6,5 +6,5 @@ export * as insertNode from './insert-node/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'
9
- export * as stringToNodes from './string-to-nodes/index.js'
10
9
  export * as watchSelection from './watch-selection/index.js'
10
+ export * as stringToNodes from './string-to-nodes/index.js'
@@ -6,5 +6,5 @@ export * as insertNode from './insert-node/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'
9
- export * as stringToNodes from './string-to-nodes/index.js'
10
9
  export * as watchSelection from './watch-selection/index.js'
10
+ export * as stringToNodes from './string-to-nodes/index.js'
@@ -1,6 +1,7 @@
1
1
  export * as arrays from './arrays/index.js'
2
2
  export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
+ export * as css from './css/index.js'
4
5
  export * as errors from './errors/index.js'
5
6
  export * as html from './html/index.js'
6
7
  export * as misc from './misc/index.js'
@@ -9,8 +10,7 @@ export * as objects from './objects/index.js'
9
10
  export * as optim from './optim/index.js'
10
11
  export * as random from './random/index.js'
11
12
  export * as regexps from './regexps/index.js'
12
- export * as strings from './strings/index.js'
13
13
  export * as sanitization from './sanitization/index.js'
14
+ export * as strings from './strings/index.js'
14
15
  export * as time from './time/index.js'
15
16
  export * as typescript from './typescript/index.js'
16
- export * as css from './css/index.js'
package/agnostic/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * as arrays from './arrays/index.js'
2
2
  export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
+ export * as css from './css/index.js'
4
5
  export * as errors from './errors/index.js'
5
6
  export * as html from './html/index.js'
6
7
  export * as misc from './misc/index.js'
@@ -9,8 +10,7 @@ export * as objects from './objects/index.js'
9
10
  export * as optim from './optim/index.js'
10
11
  export * as random from './random/index.js'
11
12
  export * as regexps from './regexps/index.js'
12
- export * as strings from './strings/index.js'
13
13
  export * as sanitization from './sanitization/index.js'
14
+ export * as strings from './strings/index.js'
14
15
  export * as time from './time/index.js'
15
16
  export * as typescript from './typescript/index.js'
16
- export * as css from './css/index.js'
@@ -1,11 +1,11 @@
1
1
  export * as assert from './assert/index.js'
2
- export * as cast from './cast/index.js'
3
2
  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
6
  export * as isConstructorFunction from './is-constructor-function/index.js'
8
7
  export * as isNullish from './is-nullish/index.js'
8
+ export * as cast from './cast/index.js'
9
9
  export * as logs from './logs/index.js'
10
10
  export * as loremIpsum from './lorem-ipsum/index.js'
11
11
  export * as normalizeExtension from './normalize-extension/index.js'
@@ -1,11 +1,11 @@
1
1
  export * as assert from './assert/index.js'
2
- export * as cast from './cast/index.js'
3
2
  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
6
  export * as isConstructorFunction from './is-constructor-function/index.js'
8
7
  export * as isNullish from './is-nullish/index.js'
8
+ export * as cast from './cast/index.js'
9
9
  export * as logs from './logs/index.js'
10
10
  export * as loremIpsum from './lorem-ipsum/index.js'
11
11
  export * as normalizeExtension from './normalize-extension/index.js'
@@ -1,3 +1,3 @@
1
+ export * as logger from './logger/index.js'
1
2
  export * as makeTextBlock from './make-text-block/index.js'
2
3
  export * as styles from './styles/index.js'
3
- export * as logger from './logger/index.js'
@@ -1,3 +1,3 @@
1
+ export * as logger from './logger/index.js'
1
2
  export * as makeTextBlock from './make-text-block/index.js'
2
3
  export * as styles from './styles/index.js'
3
- export * as logger from './logger/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'
4
- export * as interpolate from './interpolate/index.js'
3
+ export * as approximateRational from './approximate-rational/index.js'
5
4
  export * as geometricProgressions from './geometric-progressions/index.js'
5
+ export * as interpolate from './interpolate/index.js'
6
6
  export * as round from './round/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as absoluteModulo from './absolute-modulo/index.js'
2
- export * as approximateRational from './approximate-rational/index.js'
3
2
  export * as clamp from './clamp/index.js'
4
- export * as interpolate from './interpolate/index.js'
3
+ export * as approximateRational from './approximate-rational/index.js'
5
4
  export * as geometricProgressions from './geometric-progressions/index.js'
5
+ export * as interpolate from './interpolate/index.js'
6
6
  export * as round from './round/index.js'
@@ -1,8 +1,8 @@
1
1
  export * as deepGetProperty from './deep-get-property/index.js'
2
2
  export * as enums from './enums/index.js'
3
3
  export * as flattenGetters from './flatten-getters/index.js'
4
- export * as isObject from './is-object/index.js'
5
4
  export * as isRecord from './is-record/index.js'
5
+ export * as isObject from './is-object/index.js'
6
6
  export * as recordFormat from './record-format/index.js'
7
7
  export * as recordMap from './record-map/index.js'
8
8
  export * as sortKeys from './sort-keys/index.js'
@@ -1,8 +1,8 @@
1
1
  export * as deepGetProperty from './deep-get-property/index.js'
2
2
  export * as enums from './enums/index.js'
3
3
  export * as flattenGetters from './flatten-getters/index.js'
4
- export * as isObject from './is-object/index.js'
5
4
  export * as isRecord from './is-record/index.js'
5
+ export * as isObject from './is-object/index.js'
6
6
  export * as recordFormat from './record-format/index.js'
7
7
  export * as recordMap from './record-map/index.js'
8
8
  export * as sortKeys from './sort-keys/index.js'
@@ -1,8 +1,8 @@
1
- export * as matches from './matches/index.js'
2
1
  export * as charCodes from './char-codes/index.js'
2
+ export * as matches from './matches/index.js'
3
3
  export * as normalizeIndent from './normalize-indent/index.js'
4
4
  export * as parseTable from './parse-table/index.js'
5
- 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'
8
7
  export * as trim from './trim/index.js'
8
+ export * as replaceAll from './replace-all/index.js'
@@ -1,8 +1,8 @@
1
- export * as matches from './matches/index.js'
2
1
  export * as charCodes from './char-codes/index.js'
2
+ export * as matches from './matches/index.js'
3
3
  export * as normalizeIndent from './normalize-indent/index.js'
4
4
  export * as parseTable from './parse-table/index.js'
5
- 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'
8
7
  export * as trim from './trim/index.js'
8
+ export * as replaceAll from './replace-all/index.js'
@@ -10,6 +10,8 @@ import type { WithClassName } from '../utils/types.js';
10
10
  * clipboard content is resolved, with the container's raw HTML.
11
11
  * @property onClipped - Called once content has been written to the clipboard.
12
12
  * Not called when the write fails.
13
+ * @property onCopyFailed - Called when the clipboard write throws, with the
14
+ * error. When set, the error is no longer logged to the console.
13
15
  * @property className - Additional class name(s) applied to the root element.
14
16
  * @property children - Content rendered inside the copyable container.
15
17
  */
@@ -17,6 +19,7 @@ export type Props = PropsWithChildren<WithClassName<{
17
19
  toClip?: string | ((curr: string | undefined) => string | undefined);
18
20
  onCopyClicked?: (e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, rawContent: string | undefined) => void;
19
21
  onClipped?: (content: string) => void;
22
+ onCopyFailed?: (error: unknown) => void;
20
23
  }>>;
21
24
  /**
22
25
  * Clipboard-enabled container. Renders arbitrary content alongside a copy
@@ -34,7 +37,8 @@ export type Props = PropsWithChildren<WithClassName<{
34
37
  * @returns A copy-enabled content container.
35
38
  *
36
39
  * @remarks
37
- * A failed clipboard write is logged and leaves the component untouched:
38
- * neither `onClipped` nor the `clipped` modifier fires.
40
+ * A failed clipboard write fires `onCopyFailed` (or is logged when that prop is
41
+ * unset) and leaves the component untouched: neither `onClipped` nor the
42
+ * `clipped` modifier fires.
39
43
  */
40
44
  export declare const Clippable: FunctionComponent<Props>;
@@ -22,10 +22,11 @@ const clippedModifierDurationMs = 3000;
22
22
  * @returns A copy-enabled content container.
23
23
  *
24
24
  * @remarks
25
- * A failed clipboard write is logged and leaves the component untouched:
26
- * neither `onClipped` nor the `clipped` modifier fires.
25
+ * A failed clipboard write fires `onCopyFailed` (or is logged when that prop is
26
+ * unset) and leaves the component untouched: neither `onClipped` nor the
27
+ * `clipped` modifier fires.
27
28
  */
28
- export const Clippable = ({ className, children, toClip, onCopyClicked, onClipped }) => {
29
+ export const Clippable = ({ className, children, toClip, onCopyClicked, onClipped, onCopyFailed }) => {
29
30
  // State & refs
30
31
  const [hasBeenRecentlyClipped, setHasBeenRecentlyClipped] = useState(false);
31
32
  const contentRef = useRef(null);
@@ -50,8 +51,11 @@ export const Clippable = ({ className, children, toClip, onCopyClicked, onClippe
50
51
  ]);
51
52
  }
52
53
  catch (err) {
54
+ if (onCopyFailed !== undefined)
55
+ onCopyFailed(err);
53
56
  // eslint-disable-next-line no-console
54
- console.error(err);
57
+ else
58
+ console.error(err);
55
59
  return;
56
60
  }
57
61
  onClipped?.(html);
@@ -15,6 +15,8 @@ import type { WithClassName } from '../utils/types.js';
15
15
  * drawer reacts, with the open state as it was.
16
16
  * @property onIsOpenedChanged - Called after the open state changed, with the
17
17
  * new value.
18
+ * @property onContentResized - Called after the measured content size changed,
19
+ * with the new width and height in pixels. Never on mount.
18
20
  * @property className - Additional class name(s) applied to the root element.
19
21
  * @property children - Drawer content.
20
22
  */
@@ -26,6 +28,10 @@ export type Props = PropsWithChildren<WithClassName<{
26
28
  onOpenerClicked?: (isOpened: boolean) => void;
27
29
  onCloserClicked?: (isOpened: boolean) => void;
28
30
  onIsOpenedChanged?: (isOpened: boolean) => void;
31
+ onContentResized?: (dimensions: {
32
+ width: number;
33
+ height: number;
34
+ }) => void;
29
35
  }>>;
30
36
  /**
31
37
  * Drawer component supporting controlled and uncontrolled usage.
@@ -40,7 +40,7 @@ import cssModule from './styles.module.css';
40
40
  * parent needs them to know a click happened at all.
41
41
  * - `onIsOpenedChanged` fires in both modes too, and never on mount.
42
42
  */
43
- export const Drawer = ({ openerContent, closerContent, defaultIsOpened = false, isOpened: isOpenedProp, onOpenerClicked, onCloserClicked, onIsOpenedChanged, className, children }) => {
43
+ export const Drawer = ({ openerContent, closerContent, defaultIsOpened = false, isOpened: isOpenedProp, onOpenerClicked, onCloserClicked, onIsOpenedChanged, onContentResized, className, children }) => {
44
44
  // State
45
45
  const [internalIsOpened, setInternalIsOpened] = useState(defaultIsOpened);
46
46
  const [contentDimensions, setContentDimensions] = useState();
@@ -48,6 +48,8 @@ export const Drawer = ({ openerContent, closerContent, defaultIsOpened = false,
48
48
  const isOpened = isOpenedProp ?? internalIsOpened;
49
49
  // State dispatch
50
50
  useChangeDispatch(isOpened, onIsOpenedChanged);
51
+ useChangeDispatch(contentDimensions, dimensions => { if (dimensions !== undefined)
52
+ onContentResized?.(dimensions); }, (a, b) => a?.width === b?.width && a?.height === b?.height);
51
53
  // User action handlers
52
54
  const handleOpenerClick = () => {
53
55
  onOpenerClicked?.(isOpened);
@@ -31,6 +31,10 @@ import type { WithClassName } from '../utils/types.js';
31
31
  * before the gallery reacts, with the active index as it was and the target index.
32
32
  * @property onActiveSlotChanged - Called after the active slot changed, with
33
33
  * the new index.
34
+ * @property onCanGoLeftChanged - Called after the ability to scroll further left
35
+ * changed, with the new value. Never on mount.
36
+ * @property onCanGoRightChanged - Called after the ability to scroll further
37
+ * right changed, with the new value. Never on mount.
34
38
  * @property className - Optional additional class name(s) applied to the root element.
35
39
  * @property children - Elements rendered as gallery slots. Each child is wrapped in a slot container.
36
40
  */
@@ -48,6 +52,8 @@ export type Props = PropsWithChildren<WithClassName<{
48
52
  onNextClicked?: (activePos: number) => void;
49
53
  onPaginationClicked?: (activePos: number, targetPos: number) => void;
50
54
  onActiveSlotChanged?: (activePos: number) => void;
55
+ onCanGoLeftChanged?: (canGoLeft: boolean) => void;
56
+ onCanGoRightChanged?: (canGoRight: boolean) => void;
51
57
  }>>;
52
58
  /**
53
59
  * Horizontally scrollable gallery component with navigation controls and pagination.
@@ -23,7 +23,7 @@ function resolvePadding(side, shorthand) {
23
23
  * - Previous/next navigation controls,
24
24
  * - Pagination controls allowing direct slot activation.
25
25
  */
26
- export const Gallery = ({ paddingLeft, paddingRight, padding, prevButtonContent, nextButtonContent, paginationContent, defaultActive, active, noSnap, onPrevClicked, onNextClicked, onPaginationClicked, onActiveSlotChanged, children, className }) => {
26
+ export const Gallery = ({ paddingLeft, paddingRight, padding, prevButtonContent, nextButtonContent, paginationContent, defaultActive, active, noSnap, onPrevClicked, onNextClicked, onPaginationClicked, onActiveSlotChanged, onCanGoLeftChanged, onCanGoRightChanged, children, className }) => {
27
27
  // State & refs
28
28
  const scrollerRef = useRef(null);
29
29
  const [activeIndex, setActiveIndex] = useState(0);
@@ -33,6 +33,8 @@ export const Gallery = ({ paddingLeft, paddingRight, padding, prevButtonContent,
33
33
  const isControlled = active !== undefined;
34
34
  // State dispatch
35
35
  useChangeDispatch(activeIndex, onActiveSlotChanged);
36
+ useChangeDispatch(canGoLeft, onCanGoLeftChanged);
37
+ useChangeDispatch(canGoRight, onCanGoRightChanged);
36
38
  // User actions handlers
37
39
  const handlePrevClick = () => {
38
40
  onPrevClicked?.(activeIndex);
@@ -32,6 +32,10 @@ type DirectionState = 'forwards' | 'backwards' | null;
32
32
  * trigger it again.
33
33
  * @property onPagesChanged - Called after any page's {@link PageState} changed,
34
34
  * with a flat array of every page's state, ordered by position.
35
+ * @property onPageElementsChanged - Called with the page slot elements, in order,
36
+ * whenever the observed set changes. Unlike the other handlers it *does* fire on
37
+ * mount: the elements don't exist before it, so their appearance is the change.
38
+ * Lets a parent measure the pages without reaching into this component's DOM.
35
39
  * @property className - Optional additional class name(s) applied to the root element.
36
40
  * @property children - Each direct child is treated as an individual page slot.
37
41
  */
@@ -39,6 +43,7 @@ export type Props = PropsWithChildren<WithClassName<{
39
43
  thresholdOffsetPercent?: number;
40
44
  onDirectionChanged?: (direction: DirectionState) => void;
41
45
  onPagesChanged?: (pages: PageState[]) => void;
46
+ onPageElementsChanged?: (pageElements: HTMLElement[]) => void;
42
47
  }>>;
43
48
  /**
44
49
  * A scroll-driven pagination component that tracks which child page is currently
@@ -27,7 +27,7 @@ import cssModule from './styles.module.css';
27
27
  * - `currCount` on each {@link PageState} increments each time a page transitions
28
28
  * into the `'curr'` position, making it useful as a re-entry counter.
29
29
  */
30
- export const Paginator = ({ thresholdOffsetPercent, onDirectionChanged, onPagesChanged, className, children }) => {
30
+ export const Paginator = ({ thresholdOffsetPercent, onDirectionChanged, onPagesChanged, onPageElementsChanged, className, children }) => {
31
31
  // State, refs, effects
32
32
  const [pagesState, setPagesState] = useState(new Map());
33
33
  const [directionState, setDirectionState] = useState(null);
@@ -67,6 +67,7 @@ export const Paginator = ({ thresholdOffsetPercent, onDirectionChanged, onPagesC
67
67
  if (pagesRef.current === null)
68
68
  return;
69
69
  const pages = Array.from(pagesRef.current.children);
70
+ onPageElementsChanged?.(pages.filter(page => page instanceof HTMLElement));
70
71
  const observerRootMargin = `-${thresholdOffsetPercent ?? 0}%`
71
72
  + ' 0px'
72
73
  + ` -${100 - (thresholdOffsetPercent ?? 0)}%`
@@ -1,17 +1,20 @@
1
1
  import { type PropsWithChildren, type FunctionComponent } from 'react';
2
2
  import type { WithClassName } from '../utils/types.js';
3
+ import { type TrackedBlockContext } from './utils.js';
3
4
  /**
4
5
  * Common properties shared by all block types.
5
6
  *
6
7
  * @property id - Optional stable identifier for the block. Used to consolidate
7
8
  * blocks with the same id across multiple pages into a single sticky block
8
9
  * displayed across those pages.
9
- * @property trackScroll - Whether scroll tracking is enabled for this block.
10
+ * @property onScrolled - Called with this block's {@link TrackedBlockContext} on
11
+ * every frame the scroll moved it, while it is displayed. Declaring it is what
12
+ * turns tracking on for the block — nothing is measured for a block without it.
10
13
  * @property children - Content rendered inside the block.
11
14
  */
12
15
  export type PropsCommonBlock = PropsWithChildren<{
13
16
  id?: string;
14
- trackScroll?: boolean;
17
+ onScrolled?: (context: TrackedBlockContext) => void;
15
18
  }>;
16
19
  /**
17
20
  * A block that scrolls with the page content.
@@ -74,6 +77,8 @@ export type PropsPage = {
74
77
  * @property onPageChanged - Called once the current page has changed, never on
75
78
  * mount. Receives the zero-based index of the new current page and the
76
79
  * corresponding page definition, if available.
80
+ * @property onContentVisibilityChanged - Called after the scrolling content
81
+ * area entered or left the viewport, with the new value. Never on mount.
77
82
  * @property className - Optional additional class name(s) applied to the root
78
83
  * element.
79
84
  */
@@ -83,6 +88,7 @@ export type Props = WithClassName<{
83
88
  stickyBlocksLazyLoadDistance?: number;
84
89
  forceStickBlocks?: 'before' | 'after' | 'both' | 'none';
85
90
  onPageChanged?: (currentPagePos: number, pageData?: PropsPage) => void;
91
+ onContentVisibilityChanged?: (isVisible: boolean) => void;
86
92
  }>;
87
93
  /**
88
94
  * Scrollytelling engine component. Orchestrates layered sticky blocks (`back`
@@ -126,10 +132,37 @@ export type Props = WithClassName<{
126
132
  * - An inline `z-index` derived from the block's position in the sorted stack
127
133
  * (overridden by {@link PropsStickyBlock.zIndex} if provided).
128
134
  *
135
+ * ### Scroll block elements
136
+ * Each scroll block sits in its own wrapper, whatever it does — a block that isn't
137
+ * tracked still gets one, so the DOM keeps the same shape either way.
138
+ *
139
+ * ### Tracked block elements
140
+ * A block declaring {@link PropsCommonBlock.onScrolled} also carries its
141
+ * {@link TrackedBlockContext} on its wrapper, for scrollytelling driven in CSS
142
+ * alone. Written straight to the element on the frames they change, so they never
143
+ * re-render the sequence.
144
+ *
145
+ * Progressions, as unitless `0`–`1` ratios:
146
+ * - `--lm-scrllgngn-block-current-page-progression-ratio`
147
+ * - `--lm-scrllgngn-block-display-zone-progression-ratio`
148
+ * - `--lm-scrllgngn-block-contiguous-display-zone-progression-ratio`
149
+ *
150
+ * Position, which only moves with the page:
151
+ * - `data-current-page`
152
+ * - `data-display-zone` — comma-separated page positions.
153
+ * - `data-index-of-current-page-in-display-zone`
154
+ * - `data-contiguous-display-zone`
155
+ * - `data-index-of-current-page-in-contiguous-display-zone`
156
+ *
129
157
  * @param props - Component properties.
130
158
  * @see {@link Props}
131
159
  * @returns A div wrapping the full scrollytelling structure: top-bound sentinel,
132
160
  * back-blocks layer, front-blocks layer, paginated scrolling content, and
133
161
  * bottom-bound sentinel.
162
+ *
163
+ * @remarks
164
+ * Tracking costs nothing until a block asks for it: with no `onScrolled` anywhere,
165
+ * the component never joins the shared scroll listener. Once it does, each frame
166
+ * measures only the pages the displayed tracked blocks span, not the whole sequence.
134
167
  */
135
168
  export declare const Scrllgngn: FunctionComponent<Props>;