basefn 1.9.0 → 1.9.1
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/package.json
CHANGED
|
@@ -103,16 +103,15 @@ let make = (
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
// Auto-focus input when opened
|
|
106
|
+
// Auto-focus input when opened using requestAnimationFrame for reliable timing
|
|
107
107
|
let _ = Effect.run(() => {
|
|
108
108
|
if Signal.get(isOpen) {
|
|
109
|
-
let _ =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, 16)
|
|
109
|
+
let _ = %raw(`requestAnimationFrame(() => {
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
const el = document.querySelector(".basefn-spotlight__input");
|
|
112
|
+
if (el) el.focus();
|
|
113
|
+
})
|
|
114
|
+
})`)
|
|
116
115
|
}
|
|
117
116
|
None
|
|
118
117
|
})
|
|
@@ -165,7 +164,7 @@ let make = (
|
|
|
165
164
|
if Signal.get(isOpen) {
|
|
166
165
|
[
|
|
167
166
|
<div class="basefn-spotlight-backdrop" onClick={handleBackdropClick}>
|
|
168
|
-
<div class="basefn-spotlight">
|
|
167
|
+
<div class="basefn-spotlight" onKeyDown={handleKeyDown}>
|
|
169
168
|
<div class="basefn-spotlight__input-wrapper">
|
|
170
169
|
<Basefn__Icon name={Basefn__Icon.Search} size={Basefn__Icon.Sm} />
|
|
171
170
|
<input
|
|
@@ -174,7 +173,6 @@ let make = (
|
|
|
174
173
|
placeholder
|
|
175
174
|
value={ReactiveProp.reactive(query)}
|
|
176
175
|
onInput={handleInput}
|
|
177
|
-
onKeyDown={handleKeyDown}
|
|
178
176
|
/>
|
|
179
177
|
</div>
|
|
180
178
|
<div class="basefn-spotlight__results"> {renderResults()} </div>
|
|
@@ -93,14 +93,12 @@ function Basefn__Spotlight(props) {
|
|
|
93
93
|
};
|
|
94
94
|
Xote.Effect.run(() => {
|
|
95
95
|
if (Xote.Signal.get(isOpen)) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
el.focus();
|
|
103
|
-
}, 16);
|
|
96
|
+
((requestAnimationFrame(() => {
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
const el = document.querySelector(".basefn-spotlight__input");
|
|
99
|
+
if (el) el.focus();
|
|
100
|
+
})
|
|
101
|
+
})));
|
|
104
102
|
}
|
|
105
103
|
}, undefined);
|
|
106
104
|
let renderResults = () => {
|
|
@@ -155,6 +153,7 @@ function Basefn__Spotlight(props) {
|
|
|
155
153
|
onClick: handleBackdropClick,
|
|
156
154
|
children: Xote__JSX.Elements.jsxs("div", {
|
|
157
155
|
class: "basefn-spotlight",
|
|
156
|
+
onKeyDown: handleKeyDown,
|
|
158
157
|
children: Xote__JSX.array([
|
|
159
158
|
Xote__JSX.Elements.jsxs("div", {
|
|
160
159
|
class: "basefn-spotlight__input-wrapper",
|
|
@@ -168,8 +167,7 @@ function Basefn__Spotlight(props) {
|
|
|
168
167
|
type: "text",
|
|
169
168
|
value: Xote.ReactiveProp.reactive(query),
|
|
170
169
|
placeholder: placeholder,
|
|
171
|
-
onInput: handleInput
|
|
172
|
-
onKeyDown: handleKeyDown
|
|
170
|
+
onInput: handleInput
|
|
173
171
|
})
|
|
174
172
|
])
|
|
175
173
|
}),
|