@saasmakers/ui 2.0.42 → 2.0.43

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.
@@ -0,0 +1,44 @@
1
+ // Always-mounted hidden input used to open the mobile keyboard within the user
2
+ // gesture, before any async work (network create) breaks user activation.
3
+ // Kept at module scope so every consumer shares the same singleton input.
4
+ let warmupInput: HTMLInputElement | undefined
5
+
6
+ export default function useKeyboardWarmup() {
7
+ const { isDesktopBrowser } = useDevice()
8
+
9
+ function ensureWarmupInput() {
10
+ if (!import.meta.client || warmupInput) {
11
+ return
12
+ }
13
+
14
+ const input = document.createElement('input')
15
+
16
+ input.type = 'text'
17
+ input.tabIndex = -1
18
+
19
+ input.setAttribute('aria-hidden', 'true')
20
+
21
+ input.style.cssText = 'position:fixed;top:0;left:0;height:1px;width:1px;opacity:0;pointer-events:none;'
22
+
23
+ document.body.appendChild(input)
24
+
25
+ warmupInput = input
26
+ }
27
+
28
+ // Must run synchronously inside a user gesture. Focusing a real text input
29
+ // raises the on-screen keyboard; a later text-to-text focus move (to the
30
+ // profile name field) keeps it open without needing a fresh gesture.
31
+ function focusWarmupInput() {
32
+ if (isDesktopBrowser.value) {
33
+ return
34
+ }
35
+
36
+ ensureWarmupInput()
37
+ warmupInput?.focus()
38
+ }
39
+
40
+ return {
41
+ ensureWarmupInput,
42
+ focusWarmupInput,
43
+ }
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "2.0.42",
3
+ "version": "2.0.43",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",