secret-sequence-react 1.0.1 → 1.1.0
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/README.md +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,6 +193,7 @@ Declarative JSX wrapper over the `useSecretSequence` hook.
|
|
|
193
193
|
| `enableTouch` | `boolean` | `true` | Enable swipe gesture detection |
|
|
194
194
|
| `ignoreInputs` | `boolean` | `true` | Ignore key events when focus is on input-like elements |
|
|
195
195
|
| `touchOptions` | `TouchConfig` | — | Advanced touch configuration |
|
|
196
|
+
| `target` | `EventTarget` | `window` | Element to attach listeners to (e.g. a scoped container) |
|
|
196
197
|
|
|
197
198
|
---
|
|
198
199
|
|
package/dist/index.d.mts
CHANGED
|
@@ -18,6 +18,8 @@ interface UseSecretSequenceOptions {
|
|
|
18
18
|
ignoreInputs?: boolean;
|
|
19
19
|
/** Configuración de sensibilidad para gestos táctiles */
|
|
20
20
|
touchOptions?: TouchConfig;
|
|
21
|
+
/** Elemento al que adjuntar los listeners. Default: `window` */
|
|
22
|
+
target?: EventTarget;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Valor retornado por el hook useSecretSequence.
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface UseSecretSequenceOptions {
|
|
|
18
18
|
ignoreInputs?: boolean;
|
|
19
19
|
/** Configuración de sensibilidad para gestos táctiles */
|
|
20
20
|
touchOptions?: TouchConfig;
|
|
21
|
+
/** Elemento al que adjuntar los listeners. Default: `window` */
|
|
22
|
+
target?: EventTarget;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Valor retornado por el hook useSecretSequence.
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,8 @@ function useSecretSequence(options) {
|
|
|
43
43
|
enabled = true,
|
|
44
44
|
enableTouch = true,
|
|
45
45
|
ignoreInputs = true,
|
|
46
|
-
touchOptions
|
|
46
|
+
touchOptions,
|
|
47
|
+
target
|
|
47
48
|
} = options;
|
|
48
49
|
const [progress, setProgress] = (0, import_react.useState)({});
|
|
49
50
|
const engineRef = (0, import_react.useRef)(null);
|
|
@@ -80,6 +81,7 @@ function useSecretSequence(options) {
|
|
|
80
81
|
enableTouch,
|
|
81
82
|
ignoreInputs,
|
|
82
83
|
touchOptions: touchOptionsRef.current,
|
|
84
|
+
target,
|
|
83
85
|
onProgress: syncProgress
|
|
84
86
|
};
|
|
85
87
|
const engine = new import_secret_sequence_core.SecretSequenceEngine(engineOptions);
|
|
@@ -90,7 +92,7 @@ function useSecretSequence(options) {
|
|
|
90
92
|
engine.destroy();
|
|
91
93
|
engineRef.current = null;
|
|
92
94
|
};
|
|
93
|
-
}, [timeout, enabled, enableTouch, ignoreInputs, syncProgress]);
|
|
95
|
+
}, [timeout, enabled, enableTouch, ignoreInputs, target, syncProgress]);
|
|
94
96
|
(0, import_react.useEffect)(() => {
|
|
95
97
|
if (!engineRef.current) return;
|
|
96
98
|
engineRef.current.setOptions({
|
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,8 @@ function useSecretSequence(options) {
|
|
|
18
18
|
enabled = true,
|
|
19
19
|
enableTouch = true,
|
|
20
20
|
ignoreInputs = true,
|
|
21
|
-
touchOptions
|
|
21
|
+
touchOptions,
|
|
22
|
+
target
|
|
22
23
|
} = options;
|
|
23
24
|
const [progress, setProgress] = useState({});
|
|
24
25
|
const engineRef = useRef(null);
|
|
@@ -55,6 +56,7 @@ function useSecretSequence(options) {
|
|
|
55
56
|
enableTouch,
|
|
56
57
|
ignoreInputs,
|
|
57
58
|
touchOptions: touchOptionsRef.current,
|
|
59
|
+
target,
|
|
58
60
|
onProgress: syncProgress
|
|
59
61
|
};
|
|
60
62
|
const engine = new SecretSequenceEngine(engineOptions);
|
|
@@ -65,7 +67,7 @@ function useSecretSequence(options) {
|
|
|
65
67
|
engine.destroy();
|
|
66
68
|
engineRef.current = null;
|
|
67
69
|
};
|
|
68
|
-
}, [timeout, enabled, enableTouch, ignoreInputs, syncProgress]);
|
|
70
|
+
}, [timeout, enabled, enableTouch, ignoreInputs, target, syncProgress]);
|
|
69
71
|
useEffect(() => {
|
|
70
72
|
if (!engineRef.current) return;
|
|
71
73
|
engineRef.current.setOptions({
|
package/package.json
CHANGED