@design-edito/tools 0.5.9 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agnostic/arrays/index.d.ts +2 -2
- package/agnostic/arrays/index.js +2 -2
- package/agnostic/colors/index.d.ts +3 -3
- package/agnostic/colors/index.js +3 -3
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +19 -19
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +19 -19
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +3 -3
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
- package/agnostic/html/index.d.ts +1 -1
- package/agnostic/html/index.js +1 -1
- package/agnostic/index.d.ts +2 -2
- package/agnostic/index.js +2 -2
- package/agnostic/misc/index.d.ts +1 -1
- package/agnostic/misc/index.js +1 -1
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/objects/index.d.ts +1 -1
- package/agnostic/objects/index.js +1 -1
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/subtitles/index.d.ts +1 -1
- package/agnostic/subtitles/index.js +1 -1
- package/agnostic/time/index.d.ts +1 -1
- package/agnostic/time/index.js +1 -1
- package/components/Lightbox/index.d.ts +106 -0
- package/components/Lightbox/index.js +191 -0
- package/components/Lightbox/store.d.ts +43 -0
- package/components/Lightbox/store.js +94 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/public-classnames.d.ts +1 -1
- package/components/public-classnames.js +1 -1
- package/node/@google-cloud/storage/directory/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.js +1 -1
- package/node/@google-cloud/storage/file/index.d.ts +3 -3
- package/node/@google-cloud/storage/file/index.js +3 -3
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/index.d.ts +2 -2
- package/node/cloud-storage/operations/index.js +2 -2
- package/node/images/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +3 -3
- package/node/images/transform/operations/index.js +3 -3
- package/node/index.d.ts +2 -2
- package/node/index.js +2 -2
- package/node/sftp/directory/index.d.ts +1 -1
- package/node/sftp/directory/index.js +1 -1
- package/node/sftp/file/index.d.ts +1 -1
- package/node/sftp/file/index.js +1 -1
- package/package.json +8 -8
- package/components/Theatre/index.d.ts +0 -70
- package/components/Theatre/index.js +0 -85
- /package/components/{Theatre → Lightbox}/styles.module.css +0 -0
|
@@ -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>;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState, useRef } from 'react';
|
|
3
|
-
import { clss } from '../../agnostic/css/clss/index.js';
|
|
4
|
-
import { mergeClassNames, useChangeDispatch } from '../utils/index.js';
|
|
5
|
-
import { theatre as publicClassName } from '../public-classnames.js';
|
|
6
|
-
import cssModule from './styles.module.css';
|
|
7
|
-
/**
|
|
8
|
-
* Theatre mode component. Wraps content in a toggleable fullscreen-like "stage"
|
|
9
|
-
* overlay.
|
|
10
|
-
*
|
|
11
|
-
* ### CSS modifiers
|
|
12
|
-
* - `on` — theatre mode is active.
|
|
13
|
-
* - `off` — theatre mode is inactive.
|
|
14
|
-
*
|
|
15
|
-
* ### CSS elements
|
|
16
|
-
* - `stage` — holds the duplicated `children`, mounted only when `isOn`.
|
|
17
|
-
* - `open-btn`
|
|
18
|
-
* - `close-btn`
|
|
19
|
-
*
|
|
20
|
-
* @param props - Component properties.
|
|
21
|
-
* @see {@link Props}
|
|
22
|
-
* @returns A root `<div>` containing the children in their original position,
|
|
23
|
-
* a stage overlay with the duplicated children when active, and both toggles.
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* - In controlled mode (`isOn` defined), the state is fully driven by the
|
|
27
|
-
* parent and internal state is never updated.
|
|
28
|
-
* - The four toggle-source handlers fire in both modes — a controlled parent
|
|
29
|
-
* needs them to know a toggle was requested at all.
|
|
30
|
-
* - `onIsOnChanged` fires in both modes too, and never on mount.
|
|
31
|
-
*/
|
|
32
|
-
export const Theatre = ({ closeBtnContent, openBtnContent, isOn: isOnProp, defaultIsOn = false, exitOnEscape, exitOnBgClick, onOpenButtonClicked, onCloseButtonClicked, onBackgroundClicked, onEscapePressed, onIsOnChanged, children, className }) => {
|
|
33
|
-
// State & refs
|
|
34
|
-
const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);
|
|
35
|
-
const stageRef = useRef(null);
|
|
36
|
-
const isControlled = isOnProp !== undefined;
|
|
37
|
-
const isOn = isOnProp ?? internalIsOn;
|
|
38
|
-
// State dispatch
|
|
39
|
-
useChangeDispatch(isOn, onIsOnChanged);
|
|
40
|
-
// User action handlers
|
|
41
|
-
const requestToggle = (targetIsOn) => {
|
|
42
|
-
if (isControlled)
|
|
43
|
-
return;
|
|
44
|
-
setInternalIsOn(targetIsOn);
|
|
45
|
-
};
|
|
46
|
-
const handleOpenButtonClick = () => {
|
|
47
|
-
onOpenButtonClicked?.(isOn);
|
|
48
|
-
requestToggle(true);
|
|
49
|
-
};
|
|
50
|
-
const handleCloseButtonClick = () => {
|
|
51
|
-
onCloseButtonClicked?.(isOn);
|
|
52
|
-
requestToggle(false);
|
|
53
|
-
};
|
|
54
|
-
const handleStageBgClick = e => {
|
|
55
|
-
if (exitOnBgClick !== true)
|
|
56
|
-
return;
|
|
57
|
-
if (e.target !== stageRef.current)
|
|
58
|
-
return;
|
|
59
|
-
onBackgroundClicked?.(isOn);
|
|
60
|
-
requestToggle(false);
|
|
61
|
-
};
|
|
62
|
-
// Fx. dep. `exitOnEscape`, `isOn` - close the stage on the Escape key
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (exitOnEscape !== true || !isOn)
|
|
65
|
-
return;
|
|
66
|
-
const handleKeyDown = (e) => {
|
|
67
|
-
if (e.key !== 'Escape')
|
|
68
|
-
return;
|
|
69
|
-
onEscapePressed?.(isOn);
|
|
70
|
-
requestToggle(false);
|
|
71
|
-
};
|
|
72
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
73
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
74
|
-
}, [exitOnEscape, isOn, isControlled, onEscapePressed]);
|
|
75
|
-
// Rendering
|
|
76
|
-
const c = clss(publicClassName, { cssModule });
|
|
77
|
-
const rootClss = mergeClassNames(c(null, {
|
|
78
|
-
'on': isOn,
|
|
79
|
-
'off': !isOn
|
|
80
|
-
}), className);
|
|
81
|
-
const stageClss = c('stage');
|
|
82
|
-
const openBtnClss = c('open-btn');
|
|
83
|
-
const closeBtnClss = c('close-btn');
|
|
84
|
-
return _jsxs("div", { className: rootClss, children: [children, _jsx("div", { className: stageClss, onClick: handleStageBgClick, ref: stageRef, children: isOn && children }), _jsx("div", { className: closeBtnClss, onClick: handleCloseButtonClick, children: closeBtnContent }), _jsx("div", { className: openBtnClss, onClick: handleOpenButtonClick, children: openBtnContent })] });
|
|
85
|
-
};
|
|
File without changes
|