@design-edito/tools 0.5.31 → 0.5.33

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 (60) hide show
  1. package/agnostic/arrays/index.d.ts +2 -2
  2. package/agnostic/arrays/index.js +2 -2
  3. package/agnostic/colors/index.d.ts +2 -2
  4. package/agnostic/colors/index.js +2 -2
  5. package/agnostic/css/index.d.ts +3 -3
  6. package/agnostic/css/index.js +3 -3
  7. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +7 -7
  8. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +7 -7
  9. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +1 -1
  10. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +1 -1
  11. package/agnostic/html/index.d.ts +3 -3
  12. package/agnostic/html/index.js +3 -3
  13. package/agnostic/index.d.ts +3 -3
  14. package/agnostic/index.js +3 -3
  15. package/agnostic/misc/crossenv/index.d.ts +1 -1
  16. package/agnostic/misc/crossenv/index.js +1 -1
  17. package/agnostic/misc/index.d.ts +3 -3
  18. package/agnostic/misc/index.js +3 -3
  19. package/agnostic/numbers/index.d.ts +2 -2
  20. package/agnostic/numbers/index.js +2 -2
  21. package/agnostic/objects/index.d.ts +1 -1
  22. package/agnostic/objects/index.js +1 -1
  23. package/agnostic/random/index.d.ts +1 -1
  24. package/agnostic/random/index.js +1 -1
  25. package/agnostic/sanitization/index.d.ts +1 -1
  26. package/agnostic/sanitization/index.js +1 -1
  27. package/agnostic/strings/index.d.ts +3 -3
  28. package/agnostic/strings/index.js +3 -3
  29. package/agnostic/time/dates/index.d.ts +1 -1
  30. package/agnostic/time/dates/index.js +1 -1
  31. package/agnostic/time/index.d.ts +2 -2
  32. package/agnostic/time/index.js +2 -2
  33. package/components/Gallery/index.d.ts +48 -44
  34. package/components/Gallery/index.js +96 -57
  35. package/components/Gallery/utils.d.ts +36 -1
  36. package/components/Gallery/utils.js +57 -15
  37. package/components/index.d.ts +1 -2
  38. package/components/index.js +1 -2
  39. package/components/public-classnames.d.ts +0 -1
  40. package/components/public-classnames.js +0 -1
  41. package/node/@google-cloud/storage/file/index.d.ts +1 -1
  42. package/node/@google-cloud/storage/file/index.js +1 -1
  43. package/node/ftps/file/index.d.ts +1 -1
  44. package/node/ftps/file/index.js +1 -1
  45. package/node/ftps/index.d.ts +1 -1
  46. package/node/ftps/index.js +1 -1
  47. package/node/images/index.d.ts +1 -1
  48. package/node/images/index.js +1 -1
  49. package/node/images/transform/operations/index.d.ts +2 -2
  50. package/node/images/transform/operations/index.js +2 -2
  51. package/node/index.d.ts +1 -1
  52. package/node/index.js +1 -1
  53. package/node/process/index.d.ts +1 -1
  54. package/node/process/index.js +1 -1
  55. package/package.json +1 -8
  56. package/components/GalleryAlt/index.d.ts +0 -76
  57. package/components/GalleryAlt/index.js +0 -188
  58. package/components/GalleryAlt/styles.module.css +0 -33
  59. package/components/GalleryAlt/utils.d.ts +0 -36
  60. package/components/GalleryAlt/utils.js +0 -58
@@ -1,118 +1,159 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, useEffect, useState, useRef } from 'react';
2
+ import { Children, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { clss } from '../../agnostic/css/clss/index.js';
4
4
  import { mergeClassNames, useChangeDispatch } from '../utils/index.js';
5
5
  import { gallery as publicClassName } from '../public-classnames.js';
6
- import { forceActivateSlot } from './utils.js';
6
+ import { EMPTY_GEOMETRY, measureGeometry, readActiveIndex, readReach } from './utils.js';
7
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) {
8
+ /** Resolves one side's offset to a CSS length, falling back to the shorthand then to `0px`. */
9
+ function resolveOffset(side, shorthand) {
10
10
  const value = side ?? shorthand ?? 0;
11
11
  return typeof value === 'number' ? `${value}px` : value;
12
12
  }
13
13
  /**
14
- * Horizontally scrollable gallery component with navigation controls and pagination.
14
+ * Horizontally scrollable gallery, with navigation controls and pagination.
15
15
  *
16
- * Tracks the active slot based on scroll position and exposes state through CSS class names
17
- * and a `data-active` attribute on the root element.
16
+ * Geometry is measured **once per layout change** into a table of scroll positions, one
17
+ * per slot, and the boundaries between them. A scroll event then only has to place a
18
+ * number between two others — no element is measured while the reader scrolls.
19
+ *
20
+ * The same table is what the controls scroll to, so reading the active slot and moving
21
+ * to one cannot disagree, with or without snapping.
22
+ *
23
+ * ### CSS elements
24
+ * - `scroller`
25
+ * - `slot`, `slot--active`
26
+ * - `actions`, `prev`, `next`
27
+ * - `pagination`, `page`, `page--active`
28
+ *
29
+ * Root modifiers: `controlled`, `no-snap`, `measured`, `at-first`, `at-last`,
30
+ * `can-go-left`, `can-go-right`.
18
31
  *
19
32
  * @param props - Component properties.
20
33
  * @see {@link Props}
21
- * @returns A container element wrapping:
22
- * - A scrollable area containing each child in a slot wrapper,
23
- * - Previous/next navigation controls,
24
- * - Pagination controls allowing direct slot activation.
34
+ * @returns A container wrapping the scroller, the two controls and the pagination.
35
+ *
36
+ * @remarks
37
+ * Nothing is measured while the reader scrolls: the table is rebuilt only when a box
38
+ * changes size or a slot is added, watched through a `ResizeObserver`. Until the first
39
+ * measurement lands, the root carries no `measured` modifier and every slot position
40
+ * reads as `0`.
25
41
  */
26
- export const Gallery = ({ paddingLeft, paddingRight, padding, prevButtonContent, nextButtonContent, paginationContent, defaultActive, active, noSnap, onPrevClicked, onNextClicked, onPaginationClicked, onActiveSlotChanged, onCanGoLeftChanged, onCanGoRightChanged, children, className }) => {
42
+ export const Gallery = ({ offsetLeft, offsetRight, offset, prevButtonContent, nextButtonContent, paginationContent, defaultActive, active, noSnap, onPrevClicked, onNextClicked, onPaginationClicked, onActiveSlotChanged, onCanGoLeftChanged, onCanGoRightChanged, children, className }) => {
27
43
  // State & refs
28
44
  const scrollerRef = useRef(null);
29
- const [activeIndex, setActiveIndex] = useState(0);
45
+ const geometryRef = useRef(EMPTY_GEOMETRY);
46
+ const [scrolledIndex, setScrolledIndex] = useState(0);
47
+ const [isMeasured, setIsMeasured] = useState(false);
30
48
  const [canGoLeft, setCanGoLeft] = useState(false);
31
49
  const [canGoRight, setCanGoRight] = useState(false);
32
50
  const childrenCount = Children.count(children);
33
51
  const isControlled = active !== undefined;
52
+ // Controlled, the prop is the answer: the class names and `data-active` say where the
53
+ // gallery was told to be, rather than where a smooth scroll has got to so far.
54
+ const activeIndex = active ?? scrolledIndex;
34
55
  // State dispatch
35
56
  useChangeDispatch(activeIndex, onActiveSlotChanged);
36
57
  useChangeDispatch(canGoLeft, onCanGoLeftChanged);
37
58
  useChangeDispatch(canGoRight, onCanGoRightChanged);
59
+ const readScroll = useCallback(() => {
60
+ const scrollerElt = scrollerRef.current;
61
+ if (scrollerElt === null)
62
+ return;
63
+ const { scrollLeft } = scrollerElt;
64
+ const geometry = geometryRef.current;
65
+ setScrolledIndex(readActiveIndex(geometry, scrollLeft));
66
+ const { canGoLeft, canGoRight } = readReach(geometry, scrollLeft);
67
+ setCanGoLeft(canGoLeft);
68
+ setCanGoRight(canGoRight);
69
+ }, []);
70
+ const measure = useCallback(() => {
71
+ const scrollerElt = scrollerRef.current;
72
+ if (scrollerElt === null)
73
+ return;
74
+ geometryRef.current = measureGeometry(scrollerElt);
75
+ setIsMeasured(true);
76
+ readScroll();
77
+ }, [readScroll]);
78
+ const scrollToSlot = useCallback((pos, smooth = true) => {
79
+ const scrollerElt = scrollerRef.current;
80
+ const scrollPosition = geometryRef.current.scrollPositions[pos];
81
+ if (scrollerElt === null || scrollPosition === undefined)
82
+ return;
83
+ scrollerElt.scrollTo({ left: scrollPosition, behavior: smooth ? 'smooth' : 'instant' });
84
+ }, []);
38
85
  // User actions handlers
39
86
  const handlePrevClick = () => {
40
87
  onPrevClicked?.(activeIndex);
41
88
  if (isControlled)
42
89
  return;
43
- forceActivateSlot(scrollerRef.current, activeIndex - 1);
90
+ scrollToSlot(activeIndex - 1);
44
91
  };
45
92
  const handleNextClick = () => {
46
93
  onNextClicked?.(activeIndex);
47
94
  if (isControlled)
48
95
  return;
49
- forceActivateSlot(scrollerRef.current, activeIndex + 1);
96
+ scrollToSlot(activeIndex + 1);
50
97
  };
51
98
  const handlePaginationClick = (pos) => {
52
99
  onPaginationClicked?.(activeIndex, pos);
53
100
  if (isControlled)
54
101
  return;
55
- forceActivateSlot(scrollerRef.current, pos);
102
+ scrollToSlot(pos);
56
103
  };
57
- // Scroll position calculation
104
+ // Fx. dep. childrenCount - Measure, and measure again whenever a box changes size.
105
+ // Watching the slots and not only the scroller is what makes a late image or font
106
+ // land correctly, where a delay after mount could only guess.
107
+ useEffect(() => {
108
+ const scrollerElt = scrollerRef.current;
109
+ if (scrollerElt === null)
110
+ return;
111
+ measure();
112
+ const observer = new ResizeObserver(measure);
113
+ observer.observe(scrollerElt);
114
+ Array.from(scrollerElt.children).forEach(child => observer.observe(child));
115
+ return () => observer.disconnect();
116
+ }, [childrenCount, measure]);
117
+ // Fx. no dep. - One read per frame while scrolling, and it touches no element.
58
118
  useEffect(() => {
59
119
  const scrollerElt = scrollerRef.current;
60
120
  if (scrollerElt === null)
61
121
  return;
62
- scrollerElt.scrollBy(-1, 0);
63
122
  let animationFrame = null;
64
- const update = () => {
65
- animationFrame = null;
66
- const { scrollLeft, clientWidth, scrollWidth } = scrollerElt;
67
- const center = scrollLeft + clientWidth / 2;
68
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- scrollerElt.children (HTMLCollection) always contains Element/HTMLElement nodes
69
- const children = Array.from(scrollerElt.children);
70
- let closestIndex = 0;
71
- let closestDistance = Infinity;
72
- children.forEach((child, index) => {
73
- const childCenter = child.offsetLeft + child.offsetWidth / 2;
74
- const distance = Math.abs(center - childCenter);
75
- if (distance < closestDistance) {
76
- closestDistance = distance;
77
- closestIndex = index;
78
- }
79
- });
80
- setActiveIndex(closestIndex);
81
- setCanGoLeft(scrollLeft > 0);
82
- setCanGoRight(scrollLeft + clientWidth < scrollWidth);
83
- };
84
123
  const onScroll = () => {
85
124
  if (animationFrame !== null)
86
125
  return;
87
- animationFrame = requestAnimationFrame(update);
126
+ animationFrame = requestAnimationFrame(() => {
127
+ animationFrame = null;
128
+ readScroll();
129
+ });
88
130
  };
89
131
  scrollerElt.addEventListener('scroll', onScroll, { passive: true });
90
- update();
91
132
  return () => {
92
133
  scrollerElt.removeEventListener('scroll', onScroll);
93
134
  if (animationFrame !== null)
94
135
  cancelAnimationFrame(animationFrame);
95
136
  };
96
- }, []);
97
- // Sync scroll position to 'active' prop at mount time
137
+ }, [readScroll]);
138
+ // Fx. no dep. - Place the gallery where it starts, once the table exists.
98
139
  useEffect(() => {
99
140
  const toActivate = active ?? defaultActive;
100
141
  if (toActivate === undefined)
101
142
  return;
102
- const id = setTimeout(() => forceActivateSlot(scrollerRef.current, toActivate, false), 50);
103
- return () => clearTimeout(id);
143
+ scrollToSlot(toActivate, false);
104
144
  }, []);
105
- // Sync scroll position to 'active' prop
145
+ // Fx. dep. active - Follow the controlled index.
106
146
  useEffect(() => {
107
147
  if (active === undefined)
108
148
  return;
109
- forceActivateSlot(scrollerRef.current, active);
149
+ scrollToSlot(active);
110
150
  }, [active]);
111
151
  // Rendering
112
152
  const c = clss(publicClassName, { cssModule });
113
153
  const rootClss = mergeClassNames(c(null, {
114
- 'controlled': active !== undefined,
154
+ 'controlled': isControlled,
115
155
  'no-snap': noSnap === true,
156
+ 'measured': isMeasured,
116
157
  'at-first': activeIndex === 0,
117
158
  'at-last': activeIndex === childrenCount - 1,
118
159
  'can-go-left': canGoLeft,
@@ -124,25 +165,23 @@ export const Gallery = ({ paddingLeft, paddingRight, padding, prevButtonContent,
124
165
  const nextBtnClss = c('next');
125
166
  const paginationClss = c('pagination');
126
167
  const dataAttributes = { 'data-active': `${activeIndex}` };
127
- const actualPaddingLeft = resolvePadding(paddingLeft, padding);
128
- const actualPaddingRight = resolvePadding(paddingRight, padding);
168
+ const actualOffsetLeft = resolveOffset(offsetLeft, offset);
169
+ const actualOffsetRight = resolveOffset(offsetRight, offset);
129
170
  return _jsxs("div", { className: rootClss, ...dataAttributes, children: [_jsx("div", { className: scrollerClss, ref: scrollerRef, children: Children.map(children, (child, pos) => {
130
171
  const slotClss = c('slot', { active: pos === activeIndex });
131
172
  const style = {
132
173
  'margin-left': pos === 0
133
- ? actualPaddingLeft
174
+ ? actualOffsetLeft
134
175
  : undefined,
135
- 'margin-right': pos === Children.count(children) - 1
136
- ? actualPaddingRight
176
+ 'margin-right': pos === childrenCount - 1
177
+ ? actualOffsetRight
137
178
  : undefined
138
179
  };
139
180
  return _jsx("div", { className: slotClss, style: { ...style }, "data-slot": pos, children: child }, pos);
140
181
  }) }), _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) => {
141
182
  const pageClss = c('page', { active: pos === activeIndex });
142
- return _jsx("div", { className: pageClss, "data-page": pos, onClick: () => handlePaginationClick(pos), children: typeof paginationContent === 'string'
143
- ? paginationContent
144
- : typeof paginationContent === 'function'
145
- ? paginationContent(pos)
146
- : pos });
183
+ return _jsx("div", { className: pageClss, "data-page": pos, onClick: () => handlePaginationClick(pos), children: typeof paginationContent === 'function'
184
+ ? paginationContent(pos)
185
+ : paginationContent ?? pos });
147
186
  }) })] });
148
187
  };
@@ -1 +1,36 @@
1
- export declare const forceActivateSlot: (div: HTMLDivElement | null, targetPos: number, smooth?: boolean) => void;
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
+ scrollPositions: 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 the DOM's `offsetLeft`,
17
+ * which is relative to whichever ancestor happens to be positioned — so a gallery nested
18
+ * anywhere 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
+ };
@@ -1,16 +1,58 @@
1
- export const forceActivateSlot = (div, targetPos, smooth = true) => {
2
- if (div === null)
3
- return;
4
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- div.children (HTMLCollection) always contains Element/HTMLElement nodes
5
- const children = Array.from(div.children);
6
- if (children[targetPos] === undefined)
7
- return;
8
- const target = children[targetPos];
9
- const halfClientWidth = div.clientWidth / 2;
10
- const halfOffsetWidth = div.offsetWidth / 2;
11
- const offset = target.offsetLeft - (halfClientWidth - halfOffsetWidth);
12
- div.scrollTo({
13
- left: offset,
14
- behavior: smooth ? 'smooth' : 'instant'
15
- });
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
+ scrollPositions: [],
5
+ boundaries: [],
6
+ halfViewport: 0,
7
+ maxScroll: 0
16
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 the DOM's `offsetLeft`,
13
+ * which is relative to whichever ancestor happens to be positioned — so a gallery nested
14
+ * anywhere 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
+ scrollPositions: 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
+ }
@@ -3,9 +3,8 @@ 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 gallery from './Gallery/index.js'
7
6
  export * as eventListener from './EventListener/index.js'
8
- export * as galleryAlt from './GalleryAlt/index.js'
7
+ export * as gallery from './Gallery/index.js'
9
8
  export * as iframe from './Iframe/index.js'
10
9
  export * as image from './Image/index.js'
11
10
  export * as input from './Input/index.js'
@@ -3,9 +3,8 @@ 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 gallery from './Gallery/index.js'
7
6
  export * as eventListener from './EventListener/index.js'
8
- export * as galleryAlt from './GalleryAlt/index.js'
7
+ export * as gallery from './Gallery/index.js'
9
8
  export * as iframe from './Iframe/index.js'
10
9
  export * as image from './Image/index.js'
11
10
  export * as input from './Input/index.js'
@@ -5,7 +5,6 @@ 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";
9
8
  export declare const iframe = "lm-iframe";
10
9
  export declare const image = "lm-image";
11
10
  export declare const input = "lm-input";
@@ -5,7 +5,6 @@ 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';
9
8
  export const iframe = 'lm-iframe';
10
9
  export const image = 'lm-image';
11
10
  export const input = 'lm-input';
@@ -2,8 +2,8 @@ export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
4
  export * as generateSignedUrl from './generate-signed-url/index.js'
5
- export * as getMetadata from './get-metadata/index.js'
6
5
  export * as getPermissions from './get-permissions/index.js'
6
+ export * as getMetadata from './get-metadata/index.js'
7
7
  export * as move from './move/index.js'
8
8
  export * as remove from './remove/index.js'
9
9
  export * as revokeSignedUrls from './revoke-signed-urls/index.js'
@@ -2,8 +2,8 @@ export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
4
  export * as generateSignedUrl from './generate-signed-url/index.js'
5
- export * as getMetadata from './get-metadata/index.js'
6
5
  export * as getPermissions from './get-permissions/index.js'
6
+ export * as getMetadata from './get-metadata/index.js'
7
7
  export * as move from './move/index.js'
8
8
  export * as remove from './remove/index.js'
9
9
  export * as revokeSignedUrls from './revoke-signed-urls/index.js'
@@ -1,6 +1,6 @@
1
- export * as download from './download/index.js'
2
1
  export * as copy from './copy/index.js'
3
2
  export * as exists from './exists/index.js'
3
+ export * as download from './download/index.js'
4
4
  export * as move from './move/index.js'
5
5
  export * as remove from './remove/index.js'
6
6
  export * as stat from './stat/index.js'
@@ -1,6 +1,6 @@
1
- export * as download from './download/index.js'
2
1
  export * as copy from './copy/index.js'
3
2
  export * as exists from './exists/index.js'
3
+ export * as download from './download/index.js'
4
4
  export * as move from './move/index.js'
5
5
  export * as remove from './remove/index.js'
6
6
  export * as stat from './stat/index.js'
@@ -1,2 +1,2 @@
1
- export * as directory from './directory/index.js'
2
1
  export * as file from './file/index.js'
2
+ export * as directory from './directory/index.js'
@@ -1,2 +1,2 @@
1
- export * as directory from './directory/index.js'
2
1
  export * as file from './file/index.js'
2
+ export * as directory from './directory/index.js'
@@ -1,5 +1,5 @@
1
1
  export * as create from './create/index.js'
2
- export * as metadata from './metadata/index.js'
3
2
  export * as format from './format/index.js'
3
+ export * as metadata from './metadata/index.js'
4
4
  export * as transform from './transform/index.js'
5
5
  export * as utils from './utils/index.js'
@@ -1,5 +1,5 @@
1
1
  export * as create from './create/index.js'
2
- export * as metadata from './metadata/index.js'
3
2
  export * as format from './format/index.js'
3
+ export * as metadata from './metadata/index.js'
4
4
  export * as transform from './transform/index.js'
5
5
  export * as utils from './utils/index.js'
@@ -1,15 +1,15 @@
1
1
  export * as blur from './blur/index.js'
2
- export * as brighten from './brighten/index.js'
3
2
  export * as extend from './extend/index.js'
3
+ export * as brighten from './brighten/index.js'
4
4
  export * as extract from './extract/index.js'
5
5
  export * as flatten from './flatten/index.js'
6
6
  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'
10
11
  export * as normalize from './normalize/index.js'
11
12
  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'
@@ -1,15 +1,15 @@
1
1
  export * as blur from './blur/index.js'
2
- export * as brighten from './brighten/index.js'
3
2
  export * as extend from './extend/index.js'
3
+ export * as brighten from './brighten/index.js'
4
4
  export * as extract from './extract/index.js'
5
5
  export * as flatten from './flatten/index.js'
6
6
  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'
10
11
  export * as normalize from './normalize/index.js'
11
12
  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/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * as awsS3 from './@aws-s3/index.js'
2
2
  export * as designEdito from './@design-edito/index.js'
3
3
  export * as express from './@express/index.js'
4
- export * as googleCloud from './@google-cloud/index.js'
5
4
  export * as cloudStorage from './cloud-storage/index.js'
5
+ export * as googleCloud from './@google-cloud/index.js'
6
6
  export * as encryption from './encryption/index.js'
7
7
  export * as files from './files/index.js'
8
8
  export * as ftps from './ftps/index.js'
package/node/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * as awsS3 from './@aws-s3/index.js'
2
2
  export * as designEdito from './@design-edito/index.js'
3
3
  export * as express from './@express/index.js'
4
- export * as googleCloud from './@google-cloud/index.js'
5
4
  export * as cloudStorage from './cloud-storage/index.js'
5
+ export * as googleCloud from './@google-cloud/index.js'
6
6
  export * as encryption from './encryption/index.js'
7
7
  export * as files from './files/index.js'
8
8
  export * as ftps from './ftps/index.js'
@@ -1,3 +1,3 @@
1
1
  export * as onExit from './on-exit/index.js'
2
- export * as spawner from './spawner/index.js'
3
2
  export * as promptContinue from './prompt-continue/index.js'
3
+ export * as spawner from './spawner/index.js'
@@ -1,3 +1,3 @@
1
1
  export * as onExit from './on-exit/index.js'
2
- export * as spawner from './spawner/index.js'
3
2
  export * as promptContinue from './prompt-continue/index.js'
3
+ export * as spawner from './spawner/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.5.31",
3
+ "version": "0.5.33",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -1453,13 +1453,6 @@
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
- },
1463
1456
  "./components/Iframe": {
1464
1457
  "import": "./components/Iframe/index.js",
1465
1458
  "types": "./components/Iframe/index.d.ts"
@@ -1,76 +0,0 @@
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>;