kenobi-js 0.1.31 → 0.1.32
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/browser/dist.js +35 -9
- package/browser/dist.js.map +2 -2
- package/browser/dist.min.js +5 -5
- package/package.json +1 -1
package/browser/dist.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Kenobi SDK v0.1.
|
|
2
|
+
* Kenobi SDK v0.1.32
|
|
3
3
|
* (c) 2025 Kenobi.ai
|
|
4
4
|
*/
|
|
5
5
|
"use strict";
|
|
@@ -1272,7 +1272,7 @@ var KenobiLib = (() => {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
return styles;
|
|
1274
1274
|
}, "getThemeStyles");
|
|
1275
|
-
var CueCardContent = /* @__PURE__ */ __name(({ config, isOpen, setIsOpen }) => {
|
|
1275
|
+
var CueCardContent = /* @__PURE__ */ __name(({ config, isOpen, skipFocus, setIsOpen }) => {
|
|
1276
1276
|
const isInline = config.mountMode === "inline";
|
|
1277
1277
|
const containerRef = A2(null);
|
|
1278
1278
|
const launcherRef = A2(null);
|
|
@@ -1357,19 +1357,40 @@ var KenobiLib = (() => {
|
|
|
1357
1357
|
y2(() => {
|
|
1358
1358
|
previousModeRef.current = mode;
|
|
1359
1359
|
}, [mode]);
|
|
1360
|
+
const skipFocusRef = A2(false);
|
|
1361
|
+
if (skipFocus) {
|
|
1362
|
+
skipFocusRef.current = true;
|
|
1363
|
+
}
|
|
1360
1364
|
y2(() => {
|
|
1361
1365
|
if (isOpen) {
|
|
1362
1366
|
if (hasHadSuccessRef.current && formRef.current) {
|
|
1363
1367
|
formRef.current.reset();
|
|
1364
1368
|
}
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1369
|
+
const shouldSkipFocus = skipFocusRef.current;
|
|
1370
|
+
skipFocusRef.current = false;
|
|
1371
|
+
if (!shouldSkipFocus) {
|
|
1372
|
+
const focusTimer = setTimeout(() => {
|
|
1373
|
+
if (firstInputRef.current) {
|
|
1374
|
+
firstInputRef.current.focus();
|
|
1375
|
+
}
|
|
1376
|
+
}, 100);
|
|
1377
|
+
return () => clearTimeout(focusTimer);
|
|
1378
|
+
}
|
|
1371
1379
|
}
|
|
1372
1380
|
}, [isOpen]);
|
|
1381
|
+
const prevIsOpenForExpandRef = A2(isOpen);
|
|
1382
|
+
y2(() => {
|
|
1383
|
+
const wasOpen = prevIsOpenForExpandRef.current;
|
|
1384
|
+
prevIsOpenForExpandRef.current = isOpen;
|
|
1385
|
+
if (!wasOpen && isOpen && mode === "launcher") {
|
|
1386
|
+
setMode("card");
|
|
1387
|
+
}
|
|
1388
|
+
}, [isOpen, mode]);
|
|
1389
|
+
y2(() => {
|
|
1390
|
+
if (config.status === "starting") {
|
|
1391
|
+
setIsOpen(false);
|
|
1392
|
+
}
|
|
1393
|
+
}, [config.status, setIsOpen]);
|
|
1373
1394
|
if (!isInline) {
|
|
1374
1395
|
useEnterExitAnimation(containerRef, !!config.isVisible && mode === "card", {
|
|
1375
1396
|
direction: config.direction || "top-to-bottom",
|
|
@@ -1838,6 +1859,7 @@ var KenobiLib = (() => {
|
|
|
1838
1859
|
__publicField(this, "shadow");
|
|
1839
1860
|
__publicField(this, "config");
|
|
1840
1861
|
__publicField(this, "isOpen", false);
|
|
1862
|
+
__publicField(this, "skipFocus", false);
|
|
1841
1863
|
__publicField(this, "mountTarget", null);
|
|
1842
1864
|
this.config = {
|
|
1843
1865
|
position: "top-center",
|
|
@@ -1920,18 +1942,22 @@ var KenobiLib = (() => {
|
|
|
1920
1942
|
setTheme(theme) {
|
|
1921
1943
|
this.update({ theme });
|
|
1922
1944
|
}
|
|
1923
|
-
openForm() {
|
|
1945
|
+
openForm(skipFocus) {
|
|
1924
1946
|
this.isOpen = true;
|
|
1947
|
+
this.skipFocus = skipFocus ?? false;
|
|
1925
1948
|
this.render();
|
|
1926
1949
|
}
|
|
1927
1950
|
render() {
|
|
1928
1951
|
const mountPoint = this.shadow.lastElementChild;
|
|
1952
|
+
const skipFocusOnce = this.skipFocus;
|
|
1953
|
+
this.skipFocus = false;
|
|
1929
1954
|
G(
|
|
1930
1955
|
/* @__PURE__ */ u3(
|
|
1931
1956
|
CueCardContent,
|
|
1932
1957
|
{
|
|
1933
1958
|
config: this.config,
|
|
1934
1959
|
isOpen: this.isOpen,
|
|
1960
|
+
skipFocus: skipFocusOnce,
|
|
1935
1961
|
setIsOpen: (val) => {
|
|
1936
1962
|
this.isOpen = val;
|
|
1937
1963
|
this.config.onOpenChange?.(val);
|