kenobi-js 0.1.31 → 0.1.33
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 +33 -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,35 @@ 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]);
|
|
1373
1389
|
if (!isInline) {
|
|
1374
1390
|
useEnterExitAnimation(containerRef, !!config.isVisible && mode === "card", {
|
|
1375
1391
|
direction: config.direction || "top-to-bottom",
|
|
@@ -1838,6 +1854,7 @@ var KenobiLib = (() => {
|
|
|
1838
1854
|
__publicField(this, "shadow");
|
|
1839
1855
|
__publicField(this, "config");
|
|
1840
1856
|
__publicField(this, "isOpen", false);
|
|
1857
|
+
__publicField(this, "skipFocus", false);
|
|
1841
1858
|
__publicField(this, "mountTarget", null);
|
|
1842
1859
|
this.config = {
|
|
1843
1860
|
position: "top-center",
|
|
@@ -1913,6 +1930,9 @@ var KenobiLib = (() => {
|
|
|
1913
1930
|
this.host.remove();
|
|
1914
1931
|
}
|
|
1915
1932
|
update(newState) {
|
|
1933
|
+
if (newState.status === "starting" && this.config.status !== "starting") {
|
|
1934
|
+
this.isOpen = false;
|
|
1935
|
+
}
|
|
1916
1936
|
this.config = { ...this.config, ...newState };
|
|
1917
1937
|
this.applyHostStyles();
|
|
1918
1938
|
this.render();
|
|
@@ -1920,18 +1940,22 @@ var KenobiLib = (() => {
|
|
|
1920
1940
|
setTheme(theme) {
|
|
1921
1941
|
this.update({ theme });
|
|
1922
1942
|
}
|
|
1923
|
-
openForm() {
|
|
1943
|
+
openForm(skipFocus) {
|
|
1924
1944
|
this.isOpen = true;
|
|
1945
|
+
this.skipFocus = skipFocus ?? false;
|
|
1925
1946
|
this.render();
|
|
1926
1947
|
}
|
|
1927
1948
|
render() {
|
|
1928
1949
|
const mountPoint = this.shadow.lastElementChild;
|
|
1950
|
+
const skipFocusOnce = this.skipFocus;
|
|
1951
|
+
this.skipFocus = false;
|
|
1929
1952
|
G(
|
|
1930
1953
|
/* @__PURE__ */ u3(
|
|
1931
1954
|
CueCardContent,
|
|
1932
1955
|
{
|
|
1933
1956
|
config: this.config,
|
|
1934
1957
|
isOpen: this.isOpen,
|
|
1958
|
+
skipFocus: skipFocusOnce,
|
|
1935
1959
|
setIsOpen: (val) => {
|
|
1936
1960
|
this.isOpen = val;
|
|
1937
1961
|
this.config.onOpenChange?.(val);
|