@design-edito/tools 0.5.9 → 0.5.11

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 (50) hide show
  1. package/agnostic/colors/index.d.ts +1 -1
  2. package/agnostic/colors/index.js +1 -1
  3. package/agnostic/css/index.d.ts +1 -1
  4. package/agnostic/css/index.js +1 -1
  5. package/agnostic/errors/index.d.ts +1 -1
  6. package/agnostic/errors/index.js +1 -1
  7. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +15 -15
  8. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +15 -15
  9. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +3 -3
  10. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
  11. package/agnostic/html/index.d.ts +2 -2
  12. package/agnostic/html/index.js +2 -2
  13. package/agnostic/index.d.ts +3 -3
  14. package/agnostic/index.js +3 -3
  15. package/agnostic/misc/index.d.ts +3 -3
  16. package/agnostic/misc/index.js +3 -3
  17. package/agnostic/misc/logs/index.d.ts +1 -1
  18. package/agnostic/misc/logs/index.js +1 -1
  19. package/agnostic/numbers/index.d.ts +1 -1
  20. package/agnostic/numbers/index.js +1 -1
  21. package/agnostic/objects/index.d.ts +1 -1
  22. package/agnostic/objects/index.js +1 -1
  23. package/agnostic/optim/index.d.ts +1 -1
  24. package/agnostic/optim/index.js +1 -1
  25. package/agnostic/strings/index.d.ts +1 -1
  26. package/agnostic/strings/index.js +1 -1
  27. package/agnostic/time/index.d.ts +1 -1
  28. package/agnostic/time/index.js +1 -1
  29. package/components/Lightbox/index.d.ts +109 -0
  30. package/components/Lightbox/index.js +193 -0
  31. package/components/Lightbox/store.d.ts +43 -0
  32. package/components/Lightbox/store.js +94 -0
  33. package/components/index.d.ts +1 -1
  34. package/components/index.js +1 -1
  35. package/components/public-classnames.d.ts +1 -1
  36. package/components/public-classnames.js +1 -1
  37. package/node/cloud-storage/operations/index.d.ts +1 -1
  38. package/node/cloud-storage/operations/index.js +1 -1
  39. package/node/ftps/directory/index.d.ts +1 -1
  40. package/node/ftps/directory/index.js +1 -1
  41. package/node/images/transform/operations/index.d.ts +2 -2
  42. package/node/images/transform/operations/index.js +2 -2
  43. package/node/index.d.ts +3 -3
  44. package/node/index.js +3 -3
  45. package/node/sftp/index.d.ts +1 -1
  46. package/node/sftp/index.js +1 -1
  47. package/package.json +8 -8
  48. package/components/Theatre/index.d.ts +0 -70
  49. package/components/Theatre/index.js +0 -85
  50. /package/components/{Theatre → Lightbox}/styles.module.css +0 -0
@@ -0,0 +1,193 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
3
+ import { clss } from '../../agnostic/css/clss/index.js';
4
+ import { isNotNullish } from '../../agnostic/misc/is-nullish/index.js';
5
+ import { mergeClassNames, useChangeDispatch } from '../utils/index.js';
6
+ import { lightbox as publicClassName } from '../public-classnames.js';
7
+ import { close as closeLightbox, getState, membersOf, open as openLightbox, register, soloGroupOf, step, subscribe, unregister } from './store.js';
8
+ import cssModule from './styles.module.css';
9
+ /**
10
+ * Lightbox component. Holds content in a box that a stylesheet lifts over the page
11
+ * when opened.
12
+ *
13
+ * ### CSS modifiers
14
+ * - `on` - this member is open.
15
+ * - `off` - it is not.
16
+ * - `grouped` - it belongs to a group it did not invent, so navigation is possible.
17
+ *
18
+ * ### CSS elements
19
+ * - `placeholder` - holds the content's last measured size while it is out of flow.
20
+ * - `backdrop` - the box the content always lives in; a stylesheet takes it out of
21
+ * flow and over the page while the root carries `--on`.
22
+ * - `content` - wraps the content inside the backdrop.
23
+ * - `open-btn`, `close-btn`, `prev-btn`, `next-btn`
24
+ *
25
+ * @param props - Component properties.
26
+ * @see {@link Props}
27
+ * @returns A root `<div>` holding a placeholder, the backdrop the content lives in,
28
+ * and the controls.
29
+ *
30
+ * @remarks
31
+ * - **The content never moves.** It stays in the same box, at the same place in the
32
+ * React tree, open or closed; only the box's positioning changes, and that is a
33
+ * stylesheet's business. Nothing is unmounted, so a playing video keeps playing at
34
+ * its timecode. Rendering `children` in two branches - one in place, one on a stage
35
+ * - would mount a fresh instance on every flip, React reconciling by position.
36
+ * - **Nothing leaves the component's own subtree.** No portal, no `document.body`: a
37
+ * component has no business writing outside the scope it was handed.
38
+ * - **A placeholder keeps the layout still.** Its size is the content's last measured
39
+ * one, read while closed; without it the article would collapse around the hole left
40
+ * once the backdrop goes out of flow.
41
+ * - **[WIP]** A `position: fixed` backdrop is trapped by the first ancestor carrying a
42
+ * `transform`, a `filter` or a `contain`, which becomes its containing block. Inside
43
+ * a slot, that ancestor is the consumer's own to avoid.
44
+ * - **Groups are held outside React**, in `./store.ts`: a consumer may render each
45
+ * component in a root of its own, in which case members of a group share no tree
46
+ * and a context could not reach from one to the other.
47
+ * - Every member holds its own backdrop; only the open one is lifted over the page.
48
+ * Navigating a group therefore lowers one and lifts another, and neither one's
49
+ * content is touched.
50
+ * - This component ships **no appearance**: covering the page, the backdrop and the
51
+ * buttons are the consumer stylesheet's business. Without one, the content is moved
52
+ * to the end of the document and nothing looks like a lightbox.
53
+ */
54
+ export const Lightbox = ({ group, closeBtnContent, openBtnContent, prevBtnContent, nextBtnContent, isOn: isOnProp, defaultIsOn = false, exitOnEscape, exitOnBgClick, navOnArrowKeys, onOpenButtonClicked, onCloseButtonClicked, onPrevButtonClicked, onNextButtonClicked, onBackgroundClicked, onEscapePressed, onPrevArrowPressed, onNextArrowPressed, onIsOnChanged, children, className }) => {
55
+ // State & refs
56
+ const id = useId();
57
+ const rootRef = useRef(null);
58
+ const backdropRef = useRef(null);
59
+ const sizeRef = useRef(null);
60
+ const [hasAppliedDefault, setHasAppliedDefault] = useState(false);
61
+ const isControlled = isOnProp !== undefined;
62
+ const declaredGroups = group === undefined
63
+ ? []
64
+ : (Array.isArray(group) ? group : [group]);
65
+ const isGrouped = declaredGroups.length > 0;
66
+ // A member without a group still needs one to be opened through: its own.
67
+ const groups = isGrouped ? declaredGroups : [soloGroupOf(id)];
68
+ // `groups` is never empty: a member without a declared group gets its own.
69
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
+ const ownGroup = groups[0];
71
+ const groupsKey = groups.join(' ');
72
+ const storeState = useSyncExternalStore(subscribe, getState, getState);
73
+ const isOn = isOnProp ?? (storeState.openMemberId === id);
74
+ const openGroup = storeState.openGroup;
75
+ const siblingsCount = isOn && openGroup !== null ? membersOf(openGroup).length : 0;
76
+ // Fx. dep. id, groupsKey - Joins the shared registry, which is what lets another
77
+ // member reach this one. `getElement` rather than the element itself: the registry
78
+ // reads it when it needs to order the group, and never holds it.
79
+ useEffect(() => {
80
+ register({ id, groups, getElement: () => rootRef.current });
81
+ return () => unregister(id);
82
+ }, [id, groupsKey]);
83
+ // Keeps the last size the content had in place, so the placeholder can hold it once
84
+ // the content is gone. Measured while closed only, on render rather than through a
85
+ // standing observer: the content of a lightbox rarely resizes, and one observer per
86
+ // image on a page is a cost with no return.
87
+ useLayoutEffect(() => {
88
+ if (isOn)
89
+ return;
90
+ const root = rootRef.current;
91
+ if (root === null)
92
+ return;
93
+ const { width, height } = root.getBoundingClientRect();
94
+ if (width === 0 && height === 0)
95
+ return;
96
+ sizeRef.current = { width, height };
97
+ });
98
+ // State dispatch
99
+ useChangeDispatch(isOn, onIsOnChanged);
100
+ // User action handlers
101
+ const requestOpen = useCallback(() => {
102
+ if (isControlled)
103
+ return;
104
+ openLightbox(ownGroup, id);
105
+ }, [isControlled, ownGroup, id]);
106
+ const requestClose = useCallback(() => {
107
+ if (isControlled)
108
+ return;
109
+ closeLightbox();
110
+ }, [isControlled]);
111
+ const handleOpenButtonClick = () => {
112
+ onOpenButtonClicked?.(isOn);
113
+ requestOpen();
114
+ };
115
+ const handleCloseButtonClick = () => {
116
+ onCloseButtonClicked?.(isOn);
117
+ requestClose();
118
+ };
119
+ const handlePrevButtonClick = () => {
120
+ onPrevButtonClicked?.(isOn);
121
+ step(-1);
122
+ };
123
+ const handleNextButtonClick = () => {
124
+ onNextButtonClicked?.(isOn);
125
+ step(1);
126
+ };
127
+ const handleBackdropClick = e => {
128
+ if (exitOnBgClick !== true)
129
+ return;
130
+ if (e.target !== backdropRef.current)
131
+ return;
132
+ onBackgroundClicked?.(isOn);
133
+ requestClose();
134
+ };
135
+ // Fx. dep. exitOnEscape, isOn, requestClose, onEscapePressed - Escape closes the
136
+ // lightbox. Listens only while open, so a page of closed lightboxes holds no
137
+ // listener.
138
+ useEffect(() => {
139
+ if (exitOnEscape !== true || !isOn)
140
+ return;
141
+ const handleKeyDown = (e) => {
142
+ if (e.key !== 'Escape')
143
+ return;
144
+ onEscapePressed?.(isOn);
145
+ requestClose();
146
+ };
147
+ window.addEventListener('keydown', handleKeyDown);
148
+ return () => window.removeEventListener('keydown', handleKeyDown);
149
+ }, [exitOnEscape, isOn, requestClose, onEscapePressed]);
150
+ // Fx. dep. navOnArrowKeys, isOn, siblingsCount, onPrevArrowPressed,
151
+ // onNextArrowPressed - The arrow keys walk the open group. Bound only while the
152
+ // lightbox is open and the group holds someone else, so the keys stay the page's the
153
+ // rest of the time.
154
+ useEffect(() => {
155
+ if (navOnArrowKeys !== true || !isOn || siblingsCount < 2)
156
+ return;
157
+ const handleKeyDown = (e) => {
158
+ if (e.key === 'ArrowLeft') {
159
+ onPrevArrowPressed?.(isOn);
160
+ step(-1);
161
+ }
162
+ else if (e.key === 'ArrowRight') {
163
+ onNextArrowPressed?.(isOn);
164
+ step(1);
165
+ }
166
+ };
167
+ window.addEventListener('keydown', handleKeyDown);
168
+ return () => window.removeEventListener('keydown', handleKeyDown);
169
+ }, [navOnArrowKeys, isOn, siblingsCount, onPrevArrowPressed, onNextArrowPressed]);
170
+ // Fx. dep. hasAppliedDefault, isControlled, defaultIsOn, ownGroup, id - An
171
+ // uncontrolled lightbox asked to start open says so once, and never again: the
172
+ // registry owns the state from then on.
173
+ useEffect(() => {
174
+ if (hasAppliedDefault || isControlled || !defaultIsOn)
175
+ return;
176
+ setHasAppliedDefault(true);
177
+ openLightbox(ownGroup, id);
178
+ }, [hasAppliedDefault, isControlled, defaultIsOn, ownGroup, id]);
179
+ // Rendering
180
+ const c = clss(publicClassName, { cssModule });
181
+ const rootClss = mergeClassNames(c(null, {
182
+ on: isOn,
183
+ off: !isOn,
184
+ grouped: isGrouped
185
+ }), className);
186
+ const size = sizeRef.current;
187
+ // Every child keeps its position in the tree whatever the state: the placeholder and
188
+ // the backdrop are always rendered, and the buttons come after the content rather
189
+ // than around it. React reconciles by position, so moving `children` from one branch
190
+ // to another would unmount and remount them - the very thing this component exists
191
+ // to avoid.
192
+ return _jsxs("div", { className: rootClss, ref: rootRef, children: [_jsx("div", { className: c('placeholder'), style: isOn && size !== null ? { width: size.width, height: size.height } : undefined }), _jsxs("div", { className: c('backdrop'), onClick: handleBackdropClick, ref: backdropRef, children: [_jsx("div", { className: c('content'), children: children }), isOn && _jsxs(_Fragment, { children: [_jsx("button", { type: 'button', className: c('close-btn'), onClick: handleCloseButtonClick, children: closeBtnContent }), siblingsCount > 1 && _jsxs(_Fragment, { children: [_jsx("button", { type: 'button', className: c('prev-btn'), onClick: handlePrevButtonClick, children: prevBtnContent }), _jsx("button", { type: 'button', className: c('next-btn'), onClick: handleNextButtonClick, children: nextBtnContent })] })] })] }), !isOn && isNotNullish(openBtnContent) && _jsx("button", { type: 'button', className: c('open-btn'), onClick: handleOpenButtonClick, children: openBtnContent })] });
193
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The registry of lightbox groups, shared by every {@link Lightbox} on the page.
3
+ *
4
+ * Deliberately outside React. lm-link renders each component in its **own React
5
+ * root** — `renderInTarget` calls `createRoot` per component — so two `<lm-image>`
6
+ * in the same article never share a tree, and a context could not reach from one to
7
+ * the other. A module-level store can.
8
+ *
9
+ * Members are kept unordered here; the order that matters is the **document's**, and
10
+ * it is read from the DOM when a group opens. React's mount order is not it.
11
+ */
12
+ /** What a member hands the store so the group can find and place it. */
13
+ export type LightboxMember = {
14
+ id: string;
15
+ groups: string[];
16
+ /** The member's anchor in the page, for ordering. `null` before it mounts. */
17
+ getElement: () => HTMLElement | null;
18
+ };
19
+ export type LightboxState = {
20
+ /** The group currently open, `null` when nothing is. */
21
+ openGroup: string | null;
22
+ /** The member currently shown. */
23
+ openMemberId: string | null;
24
+ };
25
+ export declare function subscribe(listener: () => void): () => void;
26
+ export declare function getState(): LightboxState;
27
+ /** A member's own group, when it declared none: it is a group of one. */
28
+ export declare function soloGroupOf(id: string): string;
29
+ export declare function register(member: LightboxMember): void;
30
+ export declare function unregister(id: string): void;
31
+ /**
32
+ * The members of a group, in **document order**.
33
+ *
34
+ * `compareDocumentPosition` rather than mount order: React mounts a tree in its own
35
+ * order, and lm-link mounts each component in a root of its own, so nothing
36
+ * guarantees the two match. Only runs when a group opens or navigates, over a
37
+ * handful of members.
38
+ */
39
+ export declare function membersOf(group: string): LightboxMember[];
40
+ export declare function open(group: string, memberId: string): void;
41
+ export declare function close(): void;
42
+ /** Moves to another member of the open group by `offset`, clamped at both ends. */
43
+ export declare function step(offset: number): void;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The registry of lightbox groups, shared by every {@link Lightbox} on the page.
3
+ *
4
+ * Deliberately outside React. lm-link renders each component in its **own React
5
+ * root** — `renderInTarget` calls `createRoot` per component — so two `<lm-image>`
6
+ * in the same article never share a tree, and a context could not reach from one to
7
+ * the other. A module-level store can.
8
+ *
9
+ * Members are kept unordered here; the order that matters is the **document's**, and
10
+ * it is read from the DOM when a group opens. React's mount order is not it.
11
+ */
12
+ const members = new Map();
13
+ const listeners = new Set();
14
+ let state = {
15
+ openGroup: null,
16
+ openMemberId: null
17
+ };
18
+ function emit() {
19
+ for (const listener of listeners)
20
+ listener();
21
+ }
22
+ function setState(next) {
23
+ if (next.openGroup === state.openGroup
24
+ && next.openMemberId === state.openMemberId)
25
+ return;
26
+ state = next;
27
+ emit();
28
+ }
29
+ export function subscribe(listener) {
30
+ listeners.add(listener);
31
+ return () => { listeners.delete(listener); };
32
+ }
33
+ export function getState() {
34
+ return state;
35
+ }
36
+ /** A member's own group, when it declared none: it is a group of one. */
37
+ export function soloGroupOf(id) {
38
+ return `solo:${id}`;
39
+ }
40
+ export function register(member) {
41
+ members.set(member.id, member);
42
+ emit();
43
+ }
44
+ export function unregister(id) {
45
+ members.delete(id);
46
+ // A member leaving while it is the one shown would strand the group on nothing.
47
+ if (state.openMemberId === id)
48
+ setState({ openGroup: null, openMemberId: null });
49
+ else
50
+ emit();
51
+ }
52
+ /**
53
+ * The members of a group, in **document order**.
54
+ *
55
+ * `compareDocumentPosition` rather than mount order: React mounts a tree in its own
56
+ * order, and lm-link mounts each component in a root of its own, so nothing
57
+ * guarantees the two match. Only runs when a group opens or navigates, over a
58
+ * handful of members.
59
+ */
60
+ export function membersOf(group) {
61
+ const found = [...members.values()].filter(member => member.groups.includes(group));
62
+ return found.sort((a, b) => {
63
+ const aElt = a.getElement();
64
+ const bElt = b.getElement();
65
+ if (aElt === null || bElt === null)
66
+ return 0;
67
+ const position = aElt.compareDocumentPosition(bElt);
68
+ if ((position & Node.DOCUMENT_POSITION_FOLLOWING) !== 0)
69
+ return -1;
70
+ if ((position & Node.DOCUMENT_POSITION_PRECEDING) !== 0)
71
+ return 1;
72
+ return 0;
73
+ });
74
+ }
75
+ export function open(group, memberId) {
76
+ setState({ openGroup: group, openMemberId: memberId });
77
+ }
78
+ export function close() {
79
+ setState({ openGroup: null, openMemberId: null });
80
+ }
81
+ /** Moves to another member of the open group by `offset`, clamped at both ends. */
82
+ export function step(offset) {
83
+ const { openGroup, openMemberId } = state;
84
+ if (openGroup === null || openMemberId === null)
85
+ return;
86
+ const ordered = membersOf(openGroup);
87
+ const current = ordered.findIndex(member => member.id === openMemberId);
88
+ if (current === -1)
89
+ return;
90
+ const target = ordered[Math.min(ordered.length - 1, Math.max(0, current + offset))];
91
+ if (target === undefined)
92
+ return;
93
+ setState({ openGroup, openMemberId: target.id });
94
+ }
@@ -10,6 +10,7 @@ export * as image from './Image/index.js'
10
10
  export * as input from './Input/index.js'
11
11
  export * as intersectionObserver from './IntersectionObserver/index.js'
12
12
  export * as jsonEditor from './JsonEditor/index.js'
13
+ export * as lightbox from './Lightbox/index.js'
13
14
  export * as listLoader from './ListLoader/index.js'
14
15
  export * as overlayer from './Overlayer/index.js'
15
16
  export * as paginator from './Paginator/index.js'
@@ -21,7 +22,6 @@ export * as sequencer from './Sequencer/index.js'
21
22
  export * as shadowRoot from './ShadowRoot/index.js'
22
23
  export * as subtitles from './Subtitles/index.js'
23
24
  export * as textarea from './Textarea/index.js'
24
- export * as theatre from './Theatre/index.js'
25
25
  export * as uiModule from './UIModule/index.js'
26
26
  export * as video from './Video/index.js'
27
27
  export * as wipAudioQuote from './_WIP_AudioQuote/index.js'
@@ -10,6 +10,7 @@ export * as image from './Image/index.js'
10
10
  export * as input from './Input/index.js'
11
11
  export * as intersectionObserver from './IntersectionObserver/index.js'
12
12
  export * as jsonEditor from './JsonEditor/index.js'
13
+ export * as lightbox from './Lightbox/index.js'
13
14
  export * as listLoader from './ListLoader/index.js'
14
15
  export * as overlayer from './Overlayer/index.js'
15
16
  export * as paginator from './Paginator/index.js'
@@ -21,7 +22,6 @@ export * as sequencer from './Sequencer/index.js'
21
22
  export * as shadowRoot from './ShadowRoot/index.js'
22
23
  export * as subtitles from './Subtitles/index.js'
23
24
  export * as textarea from './Textarea/index.js'
24
- export * as theatre from './Theatre/index.js'
25
25
  export * as uiModule from './UIModule/index.js'
26
26
  export * as video from './Video/index.js'
27
27
  export * as wipAudioQuote from './_WIP_AudioQuote/index.js'
@@ -10,6 +10,7 @@ export declare const image = "lm-image";
10
10
  export declare const input = "lm-input";
11
11
  export declare const intersectionObserver = "lm-intersection-observer";
12
12
  export declare const jsonEditor = "lm-json-editor";
13
+ export declare const lightbox = "lm-lightbox";
13
14
  export declare const listLoader = "lm-list-loader";
14
15
  export declare const overlayer = "lm-overlayer";
15
16
  export declare const paginator = "lm-paginator";
@@ -21,7 +22,6 @@ export declare const sequencer = "lm-sequencer";
21
22
  export declare const shadowRoot = "lm-shadow-root";
22
23
  export declare const subtitles = "lm-subtitles";
23
24
  export declare const textarea = "lm-textarea";
24
- export declare const theatre = "lm-theatre";
25
25
  export declare const uiModule = "lm-ui-module";
26
26
  export declare const video = "lm-video";
27
27
  export declare const videoWrapper = "lm-video-wrapper";
@@ -10,6 +10,7 @@ export const image = 'lm-image';
10
10
  export const input = 'lm-input';
11
11
  export const intersectionObserver = 'lm-intersection-observer';
12
12
  export const jsonEditor = 'lm-json-editor';
13
+ export const lightbox = 'lm-lightbox';
13
14
  export const listLoader = 'lm-list-loader';
14
15
  export const overlayer = 'lm-overlayer';
15
16
  export const paginator = 'lm-paginator';
@@ -21,7 +22,6 @@ export const sequencer = 'lm-sequencer';
21
22
  export const shadowRoot = 'lm-shadow-root';
22
23
  export const subtitles = 'lm-subtitles';
23
24
  export const textarea = 'lm-textarea';
24
- export const theatre = 'lm-theatre';
25
25
  export const uiModule = 'lm-ui-module';
26
26
  export const video = 'lm-video';
27
27
  export const videoWrapper = 'lm-video-wrapper';
@@ -4,8 +4,8 @@ export * as copyFile from './copy-file/index.js'
4
4
  export * as existsFile from './exists-file/index.js'
5
5
  export * as listDir from './list-dir/index.js'
6
6
  export * as moveDir from './move-dir/index.js'
7
- export * as removeDir from './remove-dir/index.js'
8
7
  export * as moveFile from './move-file/index.js'
8
+ export * as removeDir from './remove-dir/index.js'
9
9
  export * as removeFile from './remove-file/index.js'
10
10
  export * as statFile from './stat-file/index.js'
11
11
  export * as uploadFile from './upload-file/index.js'
@@ -4,8 +4,8 @@ export * as copyFile from './copy-file/index.js'
4
4
  export * as existsFile from './exists-file/index.js'
5
5
  export * as listDir from './list-dir/index.js'
6
6
  export * as moveDir from './move-dir/index.js'
7
- export * as removeDir from './remove-dir/index.js'
8
7
  export * as moveFile from './move-file/index.js'
8
+ export * as removeDir from './remove-dir/index.js'
9
9
  export * as removeFile from './remove-file/index.js'
10
10
  export * as statFile from './stat-file/index.js'
11
11
  export * as uploadFile from './upload-file/index.js'
@@ -1,4 +1,4 @@
1
1
  export * as copyDir from './copy-dir/index.js'
2
2
  export * as list from './list/index.js'
3
- export * as moveDir from './move-dir/index.js'
4
3
  export * as removeDir from './remove-dir/index.js'
4
+ export * as moveDir from './move-dir/index.js'
@@ -1,4 +1,4 @@
1
1
  export * as copyDir from './copy-dir/index.js'
2
2
  export * as list from './list/index.js'
3
- export * as moveDir from './move-dir/index.js'
4
3
  export * as removeDir from './remove-dir/index.js'
4
+ export * as moveDir from './move-dir/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as blur from './blur/index.js'
2
- export * as extend from './extend/index.js'
3
2
  export * as brighten from './brighten/index.js'
3
+ export * as extend from './extend/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
- export * as level from './level/index.js'
9
8
  export * as hue from './hue/index.js'
9
+ export * as level from './level/index.js'
10
10
  export * as lighten from './lighten/index.js'
11
11
  export * as normalize from './normalize/index.js'
12
12
  export * as overlay from './overlay/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as blur from './blur/index.js'
2
- export * as extend from './extend/index.js'
3
2
  export * as brighten from './brighten/index.js'
3
+ export * as extend from './extend/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
- export * as level from './level/index.js'
9
8
  export * as hue from './hue/index.js'
9
+ export * as level from './level/index.js'
10
10
  export * as lighten from './lighten/index.js'
11
11
  export * as normalize from './normalize/index.js'
12
12
  export * as overlay from './overlay/index.js'
package/node/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export * as awsS3 from './@aws-s3/index.js'
2
- export * as express from './@express/index.js'
3
2
  export * as designEdito from './@design-edito/index.js'
3
+ export * as express from './@express/index.js'
4
4
  export * as googleCloud from './@google-cloud/index.js'
5
- export * as cloudStorage from './cloud-storage/index.js'
6
5
  export * as encryption from './encryption/index.js'
7
6
  export * as files from './files/index.js'
8
7
  export * as ftps from './ftps/index.js'
9
- export * as process from './process/index.js'
8
+ export * as cloudStorage from './cloud-storage/index.js'
10
9
  export * as images from './images/index.js'
10
+ export * as process from './process/index.js'
11
11
  export * as sftp from './sftp/index.js'
package/node/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  export * as awsS3 from './@aws-s3/index.js'
2
- export * as express from './@express/index.js'
3
2
  export * as designEdito from './@design-edito/index.js'
3
+ export * as express from './@express/index.js'
4
4
  export * as googleCloud from './@google-cloud/index.js'
5
- export * as cloudStorage from './cloud-storage/index.js'
6
5
  export * as encryption from './encryption/index.js'
7
6
  export * as files from './files/index.js'
8
7
  export * as ftps from './ftps/index.js'
9
- export * as process from './process/index.js'
8
+ export * as cloudStorage from './cloud-storage/index.js'
10
9
  export * as images from './images/index.js'
10
+ export * as process from './process/index.js'
11
11
  export * as sftp from './sftp/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'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -1495,6 +1495,13 @@
1495
1495
  "import": "./components/JsonEditor/types.js",
1496
1496
  "types": "./components/JsonEditor/types.d.ts"
1497
1497
  },
1498
+ "./components/Lightbox": {
1499
+ "import": "./components/Lightbox/index.js",
1500
+ "types": "./components/Lightbox/index.d.ts"
1501
+ },
1502
+ "./components/Lightbox/index.js": {
1503
+ "import": "./components/Lightbox/index.js"
1504
+ },
1498
1505
  "./components/ListLoader": {
1499
1506
  "import": "./components/ListLoader/index.js",
1500
1507
  "types": "./components/ListLoader/index.d.ts"
@@ -1572,13 +1579,6 @@
1572
1579
  "./components/Textarea/index.js": {
1573
1580
  "import": "./components/Textarea/index.js"
1574
1581
  },
1575
- "./components/Theatre": {
1576
- "import": "./components/Theatre/index.js",
1577
- "types": "./components/Theatre/index.d.ts"
1578
- },
1579
- "./components/Theatre/index.js": {
1580
- "import": "./components/Theatre/index.js"
1581
- },
1582
1582
  "./components/UIModule": {
1583
1583
  "import": "./components/UIModule/index.js",
1584
1584
  "types": "./components/UIModule/index.d.ts"
@@ -1,70 +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 {@link Theatre} component.
5
- *
6
- * @property closeBtnContent - Content rendered inside the close/exit button.
7
- * @property openBtnContent - Content rendered inside the open/enter button.
8
- * @property isOn - Controlled theatre mode state. When defined, the component
9
- * behaves as a controlled component and internal state is never updated.
10
- * @property defaultIsOn - Initial theatre mode state in uncontrolled mode.
11
- * Ignored when `isOn` is provided. Defaults to `false`.
12
- * @property exitOnEscape - When `true`, pressing `Escape` while the stage is
13
- * open counts as a toggle.
14
- * @property exitOnBgClick - When `true`, clicking the stage background — and
15
- * not its content — counts as a toggle.
16
- * @property onOpenButtonClicked - Called when the open button is clicked, before
17
- * the theatre reacts, with the state as it was.
18
- * @property onCloseButtonClicked - Called when the close button is clicked,
19
- * before the theatre reacts, with the state as it was.
20
- * @property onBackgroundClicked - Called when the stage background is clicked
21
- * (only while `exitOnBgClick` is `true`), before the theatre reacts, with the
22
- * state as it was.
23
- * @property onEscapePressed - Called when `Escape` is pressed while the stage is
24
- * open (only while `exitOnEscape` is `true`), before the theatre reacts, with
25
- * the state as it was.
26
- * @property onIsOnChanged - Called after the theatre mode changed, with the new
27
- * value.
28
- * @property className - Optional additional class name(s) applied to the root element.
29
- * @property children - Content rendered both in the default slot and, when
30
- * theatre mode is active, duplicated inside the stage element.
31
- */
32
- export type Props = PropsWithChildren<WithClassName<{
33
- closeBtnContent?: ReactNode;
34
- openBtnContent?: ReactNode;
35
- isOn?: boolean;
36
- defaultIsOn?: boolean;
37
- exitOnEscape?: boolean;
38
- exitOnBgClick?: boolean;
39
- onOpenButtonClicked?: (isOn: boolean) => void;
40
- onCloseButtonClicked?: (isOn: boolean) => void;
41
- onBackgroundClicked?: (isOn: boolean) => void;
42
- onEscapePressed?: (isOn: boolean) => void;
43
- onIsOnChanged?: (isOn: boolean) => void;
44
- }>>;
45
- /**
46
- * Theatre mode component. Wraps content in a toggleable fullscreen-like "stage"
47
- * overlay.
48
- *
49
- * ### CSS modifiers
50
- * - `on` — theatre mode is active.
51
- * - `off` — theatre mode is inactive.
52
- *
53
- * ### CSS elements
54
- * - `stage` — holds the duplicated `children`, mounted only when `isOn`.
55
- * - `open-btn`
56
- * - `close-btn`
57
- *
58
- * @param props - Component properties.
59
- * @see {@link Props}
60
- * @returns A root `<div>` containing the children in their original position,
61
- * a stage overlay with the duplicated children when active, and both toggles.
62
- *
63
- * @remarks
64
- * - In controlled mode (`isOn` defined), the state is fully driven by the
65
- * parent and internal state is never updated.
66
- * - The four toggle-source handlers fire in both modes — a controlled parent
67
- * needs them to know a toggle was requested at all.
68
- * - `onIsOnChanged` fires in both modes too, and never on mount.
69
- */
70
- export declare const Theatre: FunctionComponent<Props>;