bento-get 3.0.0-beta.924.1 → 3.0.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/dist/app/handle-global-keypress.mjs +0 -32
- package/dist/app/handle-global-keypress.mjs.map +1 -1
- package/dist/app/handle-global-keypress.native.js +0 -37
- package/dist/app/handle-global-keypress.native.js.map +1 -1
- package/dist/cli-components/SearchBar.mjs +1 -1
- package/dist/cli-components/SearchBar.mjs.map +1 -1
- package/dist/cli-components/SearchBar.native.js +1 -2
- package/dist/cli-components/SearchBar.native.js.map +1 -1
- package/dist/cli-components/index.mjs +1 -11
- package/dist/cli-components/index.mjs.map +1 -1
- package/dist/cli-components/index.native.js +1 -9
- package/dist/cli-components/index.native.js.map +1 -1
- package/dist/commands/index.mjs +8 -60
- package/dist/commands/index.mjs.map +1 -1
- package/dist/commands/index.native.js +8 -64
- package/dist/commands/index.native.js.map +1 -1
- package/dist/components.mjs +1 -23
- package/dist/components.mjs.map +1 -1
- package/dist/components.native.js +1 -23
- package/dist/components.native.js.map +1 -1
- package/dist/data/AppContext.mjs +0 -16
- package/dist/data/AppContext.mjs.map +1 -1
- package/dist/data/AppContext.native.js +0 -16
- package/dist/data/AppContext.native.js.map +1 -1
- package/dist/hooks/useFetchComponent.mjs +13 -30
- package/dist/hooks/useFetchComponent.mjs.map +1 -1
- package/dist/hooks/useFetchComponent.native.js +15 -32
- package/dist/hooks/useFetchComponent.native.js.map +1 -1
- package/dist/install-direct.mjs +10 -30
- package/dist/install-direct.mjs.map +1 -1
- package/dist/install-direct.native.js +12 -32
- package/dist/install-direct.native.js.map +1 -1
- package/package.json +4 -6
- package/readme.md +1 -1
- package/dist/app/AuthGuard.mjs +0 -42
- package/dist/app/AuthGuard.mjs.map +0 -1
- package/dist/app/AuthGuard.native.js +0 -43
- package/dist/app/AuthGuard.native.js.map +0 -1
- package/dist/constants.mjs +0 -6
- package/dist/constants.mjs.map +0 -1
- package/dist/constants.native.js +0 -6
- package/dist/constants.native.js.map +0 -1
- package/dist/screens/CodeAuthScreen.mjs +0 -127
- package/dist/screens/CodeAuthScreen.mjs.map +0 -1
- package/dist/screens/CodeAuthScreen.native.js +0 -127
- package/dist/screens/CodeAuthScreen.native.js.map +0 -1
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import open from "open";
|
|
2
1
|
import { debugLog } from "../commands/index.mjs";
|
|
3
2
|
|
|
4
|
-
const apiBase = process.env.API_BASE || "https://tamagui.dev";
|
|
5
|
-
const ACCESS_TOKEN_URL = `${apiBase}/account`;
|
|
6
3
|
const handleGlobalKeyPress = (key, modifier, appContext, navigate, location) => {
|
|
7
4
|
const { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;
|
|
8
5
|
debugLog({
|
|
9
6
|
modifier,
|
|
10
7
|
key
|
|
11
8
|
});
|
|
12
|
-
if (modifier.ctrl && key === "d") {
|
|
13
|
-
appContext.tokenStore.clear();
|
|
14
|
-
appContext.setAccessToken(null);
|
|
15
|
-
appContext.setIsLoggedIn(false);
|
|
16
|
-
console.warn("Cleared Auth Token");
|
|
17
|
-
return navigate("/");
|
|
18
|
-
}
|
|
19
9
|
if (key === "c" && appContext.installState.shouldOpenBrowser) {
|
|
20
10
|
setCopyingToClipboard(true);
|
|
21
11
|
return;
|
|
@@ -39,25 +29,6 @@ const handleGlobalKeyPress = (key, modifier, appContext, navigate, location) =>
|
|
|
39
29
|
}
|
|
40
30
|
return;
|
|
41
31
|
}
|
|
42
|
-
if (modifier.escape && location.pathname.includes("/auth")) {
|
|
43
|
-
return navigate("/search");
|
|
44
|
-
}
|
|
45
|
-
if (modifier.escape && appContext.installState.isTokenInstalled) {
|
|
46
|
-
appContext.setInstallState((prev) => ({
|
|
47
|
-
...prev,
|
|
48
|
-
installingComponent: null,
|
|
49
|
-
isTokenInstalled: false
|
|
50
|
-
}));
|
|
51
|
-
return navigate("/search");
|
|
52
|
-
}
|
|
53
|
-
if (modifier.escape && appContext.installState.installingComponent !== null && !appContext.installState.installingComponent?.isOSS) {
|
|
54
|
-
appContext.setInstallState((prev) => ({
|
|
55
|
-
...prev,
|
|
56
|
-
installingComponent: null,
|
|
57
|
-
shouldOpenBrowser: false
|
|
58
|
-
}));
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
32
|
if (modifier.escape) {
|
|
62
33
|
if (location.pathname.includes("/install-confirm")) {
|
|
63
34
|
navigate("/search");
|
|
@@ -67,9 +38,6 @@ const handleGlobalKeyPress = (key, modifier, appContext, navigate, location) =>
|
|
|
67
38
|
return;
|
|
68
39
|
}
|
|
69
40
|
if (appContext.installState.installingComponent && (modifier.upArrow || modifier.downArrow)) return;
|
|
70
|
-
if (modifier.ctrl && modifier.return && !appContext.installState.installingComponent?.isOSS && appContext.installState.shouldOpenBrowser && location.pathname.includes("/auth")) {
|
|
71
|
-
return open(ACCESS_TOKEN_URL);
|
|
72
|
-
}
|
|
73
41
|
if (modifier.upArrow) {
|
|
74
42
|
selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);
|
|
75
43
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-global-keypress.js","names":[],"sources":["app/handle-global-keypress.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"handle-global-keypress.js","names":[],"sources":["app/handle-global-keypress.js"],"sourcesContent":["import { debugLog } from \"../commands/index.js\";\nconst handleGlobalKeyPress = (key, modifier, appContext, navigate, location) => {\n const {\n selectedResultIndex,\n setSelectedResultIndex,\n setInstallState,\n searchResults,\n setCopyingToClipboard,\n setConfirmationPending\n } = appContext;\n debugLog({\n modifier,\n key\n });\n if (key === \"c\" && appContext.installState.shouldOpenBrowser) {\n setCopyingToClipboard(true);\n return;\n }\n if (location.pathname.includes(\"/install-confirm\")) {\n if (key === \"y\") {\n setConfirmationPending(false);\n navigate(\"/search\");\n return;\n }\n if (key === \"n\") {\n setConfirmationPending(true);\n navigate(\"/search\");\n setSelectedResultIndex(-1);\n setInstallState((prev) => ({\n ...prev,\n componentToInstall: null,\n installingComponent: null\n }));\n return;\n }\n return;\n }\n if (modifier.escape) {\n if (location.pathname.includes(\"/install-confirm\")) {\n navigate(\"/search\");\n return;\n }\n appContext.exitApp();\n return;\n }\n if (appContext.installState.installingComponent && (modifier.upArrow || modifier.downArrow))\n return;\n if (modifier.upArrow) {\n selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);\n return;\n }\n if (modifier.downArrow) {\n selectedResultIndex < appContext.searchResults.length - 1 && setSelectedResultIndex(selectedResultIndex + 1);\n return;\n }\n if (modifier.return) {\n if (location.pathname.includes(\"/search\")) {\n setInstallState((prev) => ({\n ...prev,\n installingComponent: searchResults[selectedResultIndex]?.item\n }));\n const fileName = searchResults?.[selectedResultIndex]?.item.fileName;\n if (!fileName) {\n console.error(\"No component found\");\n return;\n }\n debugLog(\"Installing component\", searchResults[selectedResultIndex]?.item);\n navigate(`/install-confirm/${fileName}`);\n return;\n }\n }\n};\nexport {\n handleGlobalKeyPress\n};\n//# sourceMappingURL=handle-global-keypress.js.map\n"],"mappings":";;;AACA,MAAM,wBAAwB,KAAK,UAAU,YAAY,UAAU,aAAa;CAC9E,MAAM,EACJ,qBACA,wBACA,iBACA,eACA,uBACA,2BACE;CACJ,SAAS;EACP;EACA;CACF,CAAC;CACD,IAAI,QAAQ,OAAO,WAAW,aAAa,mBAAmB;EAC5D,sBAAsB,IAAI;EAC1B;CACF;CACA,IAAI,SAAS,SAAS,SAAS,kBAAkB,GAAG;EAClD,IAAI,QAAQ,KAAK;GACf,uBAAuB,KAAK;GAC5B,SAAS,SAAS;GAClB;EACF;EACA,IAAI,QAAQ,KAAK;GACf,uBAAuB,IAAI;GAC3B,SAAS,SAAS;GAClB,uBAAuB,CAAC,CAAC;GACzB,iBAAiB,UAAU;IACzB,GAAG;IACH,oBAAoB;IACpB,qBAAqB;GACvB,EAAE;GACF;EACF;EACA;CACF;CACA,IAAI,SAAS,QAAQ;EACnB,IAAI,SAAS,SAAS,SAAS,kBAAkB,GAAG;GAClD,SAAS,SAAS;GAClB;EACF;EACA,WAAW,QAAQ;EACnB;CACF;CACA,IAAI,WAAW,aAAa,wBAAwB,SAAS,WAAW,SAAS,YAC/E;CACF,IAAI,SAAS,SAAS;EACpB,sBAAsB,CAAC,KAAK,uBAAuB,sBAAsB,CAAC;EAC1E;CACF;CACA,IAAI,SAAS,WAAW;EACtB,sBAAsB,WAAW,cAAc,SAAS,KAAK,uBAAuB,sBAAsB,CAAC;EAC3G;CACF;CACA,IAAI,SAAS,QAAQ;EACnB,IAAI,SAAS,SAAS,SAAS,SAAS,GAAG;GACzC,iBAAiB,UAAU;IACzB,GAAG;IACH,qBAAqB,cAAc,oBAAoB,EAAE;GAC3D,EAAE;GACF,MAAM,WAAW,gBAAgB,oBAAoB,EAAE,KAAK;GAC5D,IAAI,CAAC,UAAU;IACb,QAAQ,MAAM,oBAAoB;IAClC;GACF;GACA,SAAS,wBAAwB,cAAc,oBAAoB,EAAE,IAAI;GACzE,SAAS,oBAAoB,UAAU;GACvC;EACF;CACF;AACF"}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import open from "open";
|
|
2
1
|
import { debugLog } from "../commands/index.native.js";
|
|
3
2
|
|
|
4
|
-
var apiBase = process.env.API_BASE || "https://tamagui.dev";
|
|
5
|
-
var ACCESS_TOKEN_URL = `${apiBase}/account`;
|
|
6
3
|
var handleGlobalKeyPress = function(key, modifier, appContext, navigate, location) {
|
|
7
|
-
var _appContext_installState_installingComponent, _appContext_installState_installingComponent1;
|
|
8
4
|
var { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;
|
|
9
5
|
debugLog({
|
|
10
6
|
modifier,
|
|
11
7
|
key
|
|
12
8
|
});
|
|
13
|
-
if (modifier.ctrl && key === "d") {
|
|
14
|
-
appContext.tokenStore.clear();
|
|
15
|
-
appContext.setAccessToken(null);
|
|
16
|
-
appContext.setIsLoggedIn(false);
|
|
17
|
-
console.warn("Cleared Auth Token");
|
|
18
|
-
return navigate("/");
|
|
19
|
-
}
|
|
20
9
|
if (key === "c" && appContext.installState.shouldOpenBrowser) {
|
|
21
10
|
setCopyingToClipboard(true);
|
|
22
11
|
return;
|
|
@@ -42,29 +31,6 @@ var handleGlobalKeyPress = function(key, modifier, appContext, navigate, locatio
|
|
|
42
31
|
}
|
|
43
32
|
return;
|
|
44
33
|
}
|
|
45
|
-
if (modifier.escape && location.pathname.includes("/auth")) {
|
|
46
|
-
return navigate("/search");
|
|
47
|
-
}
|
|
48
|
-
if (modifier.escape && appContext.installState.isTokenInstalled) {
|
|
49
|
-
appContext.setInstallState(function(prev) {
|
|
50
|
-
return {
|
|
51
|
-
...prev,
|
|
52
|
-
installingComponent: null,
|
|
53
|
-
isTokenInstalled: false
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
return navigate("/search");
|
|
57
|
-
}
|
|
58
|
-
if (modifier.escape && appContext.installState.installingComponent !== null && !((_appContext_installState_installingComponent = appContext.installState.installingComponent) === null || _appContext_installState_installingComponent === void 0 ? void 0 : _appContext_installState_installingComponent.isOSS)) {
|
|
59
|
-
appContext.setInstallState(function(prev) {
|
|
60
|
-
return {
|
|
61
|
-
...prev,
|
|
62
|
-
installingComponent: null,
|
|
63
|
-
shouldOpenBrowser: false
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
34
|
if (modifier.escape) {
|
|
69
35
|
if (location.pathname.includes("/install-confirm")) {
|
|
70
36
|
navigate("/search");
|
|
@@ -74,9 +40,6 @@ var handleGlobalKeyPress = function(key, modifier, appContext, navigate, locatio
|
|
|
74
40
|
return;
|
|
75
41
|
}
|
|
76
42
|
if (appContext.installState.installingComponent && (modifier.upArrow || modifier.downArrow)) return;
|
|
77
|
-
if (modifier.ctrl && modifier.return && !((_appContext_installState_installingComponent1 = appContext.installState.installingComponent) === null || _appContext_installState_installingComponent1 === void 0 ? void 0 : _appContext_installState_installingComponent1.isOSS) && appContext.installState.shouldOpenBrowser && location.pathname.includes("/auth")) {
|
|
78
|
-
return open(ACCESS_TOKEN_URL);
|
|
79
|
-
}
|
|
80
43
|
if (modifier.upArrow) {
|
|
81
44
|
selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);
|
|
82
45
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-global-keypress.native.js","names":[],"sources":["app/handle-global-keypress.native.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"handle-global-keypress.native.js","names":[],"sources":["app/handle-global-keypress.native.js"],"sourcesContent":["import { debugLog } from \"../commands/index.js\";\nvar handleGlobalKeyPress = function(key, modifier, appContext, navigate, location) {\n var { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;\n debugLog({\n modifier,\n key\n });\n if (key === \"c\" && appContext.installState.shouldOpenBrowser) {\n setCopyingToClipboard(true);\n return;\n }\n if (location.pathname.includes(\"/install-confirm\")) {\n if (key === \"y\") {\n setConfirmationPending(false);\n navigate(\"/search\");\n return;\n }\n if (key === \"n\") {\n setConfirmationPending(true);\n navigate(\"/search\");\n setSelectedResultIndex(-1);\n setInstallState(function(prev) {\n return {\n ...prev,\n componentToInstall: null,\n installingComponent: null\n };\n });\n return;\n }\n return;\n }\n if (modifier.escape) {\n if (location.pathname.includes(\"/install-confirm\")) {\n navigate(\"/search\");\n return;\n }\n appContext.exitApp();\n return;\n }\n if (appContext.installState.installingComponent && (modifier.upArrow || modifier.downArrow)) return;\n if (modifier.upArrow) {\n selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);\n return;\n }\n if (modifier.downArrow) {\n selectedResultIndex < appContext.searchResults.length - 1 && setSelectedResultIndex(selectedResultIndex + 1);\n return;\n }\n if (modifier.return) {\n if (location.pathname.includes(\"/search\")) {\n var _searchResults_selectedResultIndex, _searchResults_selectedResultIndex1;\n setInstallState(function(prev) {\n var _searchResults_selectedResultIndex2;\n return {\n ...prev,\n installingComponent: (_searchResults_selectedResultIndex2 = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex2 === void 0 ? void 0 : _searchResults_selectedResultIndex2.item\n };\n });\n var fileName = searchResults === null || searchResults === void 0 ? void 0 : (_searchResults_selectedResultIndex = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex === void 0 ? void 0 : _searchResults_selectedResultIndex.item.fileName;\n if (!fileName) {\n console.error(\"No component found\");\n return;\n }\n debugLog(\"Installing component\", (_searchResults_selectedResultIndex1 = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex1 === void 0 ? void 0 : _searchResults_selectedResultIndex1.item);\n navigate(`/install-confirm/${fileName}`);\n return;\n }\n }\n};\nexport {\n handleGlobalKeyPress\n};\n//# sourceMappingURL=handle-global-keypress.js.map\n"],"mappings":";;;AACA,IAAI,uBAAuB,SAAS,KAAK,UAAU,YAAY,UAAU,UAAU;CACjF,IAAI,EAAE,qBAAqB,wBAAwB,iBAAiB,eAAe,uBAAuB,2BAA2B;CACrI,SAAS;EACP;EACA;CACF,CAAC;CACD,IAAI,QAAQ,OAAO,WAAW,aAAa,mBAAmB;EAC5D,sBAAsB,IAAI;EAC1B;CACF;CACA,IAAI,SAAS,SAAS,SAAS,kBAAkB,GAAG;EAClD,IAAI,QAAQ,KAAK;GACf,uBAAuB,KAAK;GAC5B,SAAS,SAAS;GAClB;EACF;EACA,IAAI,QAAQ,KAAK;GACf,uBAAuB,IAAI;GAC3B,SAAS,SAAS;GAClB,uBAAuB,CAAC,CAAC;GACzB,gBAAgB,SAAS,MAAM;IAC7B,OAAO;KACL,GAAG;KACH,oBAAoB;KACpB,qBAAqB;IACvB;GACF,CAAC;GACD;EACF;EACA;CACF;CACA,IAAI,SAAS,QAAQ;EACnB,IAAI,SAAS,SAAS,SAAS,kBAAkB,GAAG;GAClD,SAAS,SAAS;GAClB;EACF;EACA,WAAW,QAAQ;EACnB;CACF;CACA,IAAI,WAAW,aAAa,wBAAwB,SAAS,WAAW,SAAS,YAAY;CAC7F,IAAI,SAAS,SAAS;EACpB,sBAAsB,CAAC,KAAK,uBAAuB,sBAAsB,CAAC;EAC1E;CACF;CACA,IAAI,SAAS,WAAW;EACtB,sBAAsB,WAAW,cAAc,SAAS,KAAK,uBAAuB,sBAAsB,CAAC;EAC3G;CACF;CACA,IAAI,SAAS,QAAQ;EACnB,IAAI,SAAS,SAAS,SAAS,SAAS,GAAG;GACzC,IAAI,oCAAoC;GACxC,gBAAgB,SAAS,MAAM;IAC7B,IAAI;IACJ,OAAO;KACL,GAAG;KACH,sBAAsB,sCAAsC,cAAc,0BAA0B,QAAQ,wCAAwC,KAAK,IAAI,KAAK,IAAI,oCAAoC;IAC5M;GACF,CAAC;GACD,IAAI,WAAW,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,KAAK,KAAK,qCAAqC,cAAc,0BAA0B,QAAQ,uCAAuC,KAAK,IAAI,KAAK,IAAI,mCAAmC,KAAK;GACpQ,IAAI,CAAC,UAAU;IACb,QAAQ,MAAM,oBAAoB;IAClC;GACF;GACA,SAAS,yBAAyB,sCAAsC,cAAc,0BAA0B,QAAQ,wCAAwC,KAAK,IAAI,KAAK,IAAI,oCAAoC,IAAI;GAC1N,SAAS,oBAAoB,UAAU;GACvC;EACF;CACF;AACF"}
|
|
@@ -24,7 +24,7 @@ const SearchBar = () => {
|
|
|
24
24
|
}, [location.pathname]);
|
|
25
25
|
const handleInputChange = (value) => {
|
|
26
26
|
if (location.pathname !== "/search") return;
|
|
27
|
-
if (appContext.installState.installingComponent
|
|
27
|
+
if (appContext.installState.installingComponent) return;
|
|
28
28
|
appContext.setSearchInput(value);
|
|
29
29
|
const results = performSearch(value);
|
|
30
30
|
appContext.setSearchResults(results);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","names":[],"sources":["cli-components/SearchBar.js"],"sourcesContent":["import Fuse from \"fuse.js\";\nimport { Box, Text } from \"ink\";\nimport TextInput from \"ink-text-input\";\nimport React from \"react\";\nimport { useLocation } from \"react-router-dom\";\nimport { ResultsCounter } from \"../cli-components/index.js\";\nimport { componentsList } from \"../components.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SearchBar = () => {\n const location = useLocation();\n const appContext = React.useContext(AppContext);\n const performSearch = (query) => {\n const fuse = new Fuse(componentsList, {\n keys: [\"name\", \"category\", \"categorySection\"]\n });\n return fuse.search(query);\n };\n React.useEffect(() => {\n appContext.setSearchInput(\"\");\n }, [location.pathname]);\n const handleInputChange = (value) => {\n if (location.pathname !== \"/search\") return;\n if (appContext.installState.installingComponent
|
|
1
|
+
{"version":3,"file":"SearchBar.js","names":[],"sources":["cli-components/SearchBar.js"],"sourcesContent":["import Fuse from \"fuse.js\";\nimport { Box, Text } from \"ink\";\nimport TextInput from \"ink-text-input\";\nimport React from \"react\";\nimport { useLocation } from \"react-router-dom\";\nimport { ResultsCounter } from \"../cli-components/index.js\";\nimport { componentsList } from \"../components.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SearchBar = () => {\n const location = useLocation();\n const appContext = React.useContext(AppContext);\n const performSearch = (query) => {\n const fuse = new Fuse(componentsList, {\n keys: [\"name\", \"category\", \"categorySection\"]\n });\n return fuse.search(query);\n };\n React.useEffect(() => {\n appContext.setSearchInput(\"\");\n }, [location.pathname]);\n const handleInputChange = (value) => {\n if (location.pathname !== \"/search\") return;\n if (appContext.installState.installingComponent) return;\n appContext.setSearchInput(value);\n const results = performSearch(value);\n appContext.setSearchResults(results);\n appContext.setSelectedResultIndex(-1);\n };\n return /* @__PURE__ */ jsxs(Box, { marginX: 1, justifyContent: \"space-between\", children: [\n /* @__PURE__ */ jsxs(Box, { children: [\n /* @__PURE__ */ jsx(Text, { bold: true, children: \"Search: \" }),\n /* @__PURE__ */ jsx(\n TextInput,\n {\n focus: true,\n value: appContext.searchInput,\n onChange: handleInputChange,\n marginRight: \"auto\"\n }\n )\n ] }),\n /* @__PURE__ */ jsx(ResultsCounter, {})\n ] });\n};\nexport {\n SearchBar\n};\n//# sourceMappingURL=SearchBar.js.map\n"],"mappings":";;;;;;;;;;;AASA,MAAM,kBAAkB;CACtB,MAAM,WAAW,YAAY;CAC7B,MAAM,aAAa,MAAM,WAAW,UAAU;CAC9C,MAAM,iBAAiB,UAAU;EAC/B,MAAM,OAAO,IAAI,KAAK,gBAAgB,EACpC,MAAM;GAAC;GAAQ;GAAY;EAAiB,EAC9C,CAAC;EACD,OAAO,KAAK,OAAO,KAAK;CAC1B;CACA,MAAM,gBAAgB;EACpB,WAAW,eAAe,EAAE;CAC9B,GAAG,CAAC,SAAS,QAAQ,CAAC;CACtB,MAAM,qBAAqB,UAAU;EACnC,IAAI,SAAS,aAAa,WAAW;EACrC,IAAI,WAAW,aAAa,qBAAqB;EACjD,WAAW,eAAe,KAAK;EAC/B,MAAM,UAAU,cAAc,KAAK;EACnC,WAAW,iBAAiB,OAAO;EACnC,WAAW,uBAAuB,CAAC,CAAC;CACtC;CACA,OAAuB,qBAAK,KAAK;EAAE,SAAS;EAAG,gBAAgB;EAAiB,UAAU,CACxE,qBAAK,KAAK,EAAE,UAAU,CACpB,oBAAI,MAAM;GAAE,MAAM;GAAM,UAAU;EAAW,CAAC,GAC9C,oBACd,WACA;GACE,OAAO;GACP,OAAO,WAAW;GAClB,UAAU;GACV,aAAa;EACf,CACF,CACF,EAAE,CAAC,GACa,oBAAI,gBAAgB,CAAC,CAAC,CACxC;CAAE,CAAC;AACL"}
|
|
@@ -23,9 +23,8 @@ var SearchBar = function() {
|
|
|
23
23
|
appContext.setSearchInput("");
|
|
24
24
|
}, [location.pathname]);
|
|
25
25
|
var handleInputChange = function(value) {
|
|
26
|
-
var _appContext_installState_installingComponent;
|
|
27
26
|
if (location.pathname !== "/search") return;
|
|
28
|
-
if (
|
|
27
|
+
if (appContext.installState.installingComponent) return;
|
|
29
28
|
appContext.setSearchInput(value);
|
|
30
29
|
var results = performSearch(value);
|
|
31
30
|
appContext.setSearchResults(results);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.native.js","names":[],"sources":["cli-components/SearchBar.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport Fuse from \"fuse.js\";\nimport { Box, Text } from \"ink\";\nimport TextInput from \"ink-text-input\";\nimport React from \"react\";\nimport { useLocation } from \"react-router-dom\";\nimport { ResultsCounter } from \"../cli-components/index.js\";\nimport { componentsList } from \"../components.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nvar SearchBar = function() {\n var location = useLocation();\n var appContext = React.useContext(AppContext);\n var performSearch = function(query) {\n var fuse = new Fuse(componentsList, {\n keys: [\n \"name\",\n \"category\",\n \"categorySection\"\n ]\n });\n return fuse.search(query);\n };\n React.useEffect(function() {\n appContext.setSearchInput(\"\");\n }, [\n location.pathname\n ]);\n var handleInputChange = function(value) {\n
|
|
1
|
+
{"version":3,"file":"SearchBar.native.js","names":[],"sources":["cli-components/SearchBar.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport Fuse from \"fuse.js\";\nimport { Box, Text } from \"ink\";\nimport TextInput from \"ink-text-input\";\nimport React from \"react\";\nimport { useLocation } from \"react-router-dom\";\nimport { ResultsCounter } from \"../cli-components/index.js\";\nimport { componentsList } from \"../components.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nvar SearchBar = function() {\n var location = useLocation();\n var appContext = React.useContext(AppContext);\n var performSearch = function(query) {\n var fuse = new Fuse(componentsList, {\n keys: [\n \"name\",\n \"category\",\n \"categorySection\"\n ]\n });\n return fuse.search(query);\n };\n React.useEffect(function() {\n appContext.setSearchInput(\"\");\n }, [\n location.pathname\n ]);\n var handleInputChange = function(value) {\n if (location.pathname !== \"/search\") return;\n if (appContext.installState.installingComponent) return;\n appContext.setSearchInput(value);\n var results = performSearch(value);\n appContext.setSearchResults(results);\n appContext.setSelectedResultIndex(-1);\n };\n return /* @__PURE__ */ _jsxs(Box, {\n marginX: 1,\n justifyContent: \"space-between\",\n children: [\n /* @__PURE__ */ _jsxs(Box, {\n children: [\n /* @__PURE__ */ _jsx(Text, {\n bold: true,\n children: \"Search: \"\n }),\n /* @__PURE__ */ _jsx(TextInput, {\n focus: true,\n value: appContext.searchInput,\n onChange: handleInputChange,\n // @ts-ignore\n marginRight: \"auto\"\n })\n ]\n }),\n /* @__PURE__ */ _jsx(ResultsCounter, {})\n ]\n });\n};\nexport {\n SearchBar\n};\n//# sourceMappingURL=SearchBar.js.map\n"],"mappings":";;;;;;;;;;;AASA,IAAI,YAAY,WAAW;CACzB,IAAI,WAAW,YAAY;CAC3B,IAAI,aAAa,MAAM,WAAW,UAAU;CAC5C,IAAI,gBAAgB,SAAS,OAAO;EAClC,IAAI,OAAO,IAAI,KAAK,gBAAgB,EAClC,MAAM;GACJ;GACA;GACA;EACF,EACF,CAAC;EACD,OAAO,KAAK,OAAO,KAAK;CAC1B;CACA,MAAM,UAAU,WAAW;EACzB,WAAW,eAAe,EAAE;CAC9B,GAAG,CACD,SAAS,QACX,CAAC;CACD,IAAI,oBAAoB,SAAS,OAAO;EACtC,IAAI,SAAS,aAAa,WAAW;EACrC,IAAI,WAAW,aAAa,qBAAqB;EACjD,WAAW,eAAe,KAAK;EAC/B,IAAI,UAAU,cAAc,KAAK;EACjC,WAAW,iBAAiB,OAAO;EACnC,WAAW,uBAAuB,CAAC,CAAC;CACtC;CACA,OAAuB,qBAAM,KAAK;EAChC,SAAS;EACT,gBAAgB;EAChB,UAAU,CACQ,qBAAM,KAAK,EACzB,UAAU,CACQ,oBAAK,MAAM;GACzB,MAAM;GACN,UAAU;EACZ,CAAC,GACe,oBAAK,WAAW;GAC9B,OAAO;GACP,OAAO,WAAW;GAClB,UAAU;GAEV,aAAa;EACf,CAAC,CACH,EACF,CAAC,GACe,oBAAK,gBAAgB,CAAC,CAAC,CACzC;CACF,CAAC;AACH"}
|
|
@@ -100,17 +100,7 @@ const CategorySectionBadge = ({ item }) => {
|
|
|
100
100
|
})
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
-
const ComponentAccessType = ({ item }) =>
|
|
104
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
105
|
-
marginLeft: 1,
|
|
106
|
-
gap: 1,
|
|
107
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
108
|
-
color: "black",
|
|
109
|
-
backgroundColor: item?.isOSS ? "green" : "blue",
|
|
110
|
-
children: item?.isOSS ? "FREE" : "PRO"
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
};
|
|
103
|
+
const ComponentAccessType = ({ item }) => null;
|
|
114
104
|
const ResultsCounter = () => {
|
|
115
105
|
const appContext = React.useContext(AppContext);
|
|
116
106
|
const resultCount = appContext.searchResults.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["cli-components/index.js"],"sourcesContent":["import { Alert, Badge, Spinner } from \"@inkjs/ui\";\nimport { Box, Spacer, Text } from \"ink\";\nimport React from \"react\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst ResultsContainer = () => {\n const appContext = React.useContext(AppContext);\n return /* @__PURE__ */ jsxs(\n Box,\n {\n flexDirection: \"column\",\n display: appContext.searchResults.length ? \"flex\" : \"none\",\n children: [\n /* @__PURE__ */ jsx(Box, { flexDirection: \"column\", borderStyle: \"round\", paddingX: 1, gap: 1, children: appContext.searchResults.slice(0, 5).map((result, i) => /* @__PURE__ */ jsx(\n ResultCard,\n {\n result,\n isSelected: appContext.selectedResultIndex === i\n },\n result.item.fileName\n )) }),\n /* @__PURE__ */ jsx(Footer, {})\n ]\n }\n );\n};\nconst Footer = () => {\n return /* @__PURE__ */ jsx(Box, { flexDirection: \"row\", justifyContent: \"flex-end\", marginRight: 1, children: /* @__PURE__ */ jsxs(Text, { children: [\n /* @__PURE__ */ jsx(Text, { underline: true, children: \"ESC\" }),\n \" to exit\"\n ] }) });\n};\nconst InstalledBadge = ({ item }) => {\n const appContext = React.useContext(AppContext);\n const isComponentInstalled = appContext.installState?.installedComponents?.map((component) => component.fileName).includes(item.fileName);\n if (!appContext.installState?.installedComponents) return null;\n return isComponentInstalled && /* @__PURE__ */ jsx(Box, { marginLeft: 1, children: /* @__PURE__ */ jsx(Badge, { color: \"green\", children: \"Installed\" }) });\n};\nconst ResultCard = ({\n result,\n isSelected\n}) => {\n const appContext = React.useContext(AppContext);\n return /* @__PURE__ */ jsxs(Box, { flexDirection: \"row\", minWidth: \"100%\", children: [\n /* @__PURE__ */ jsxs(Box, { flexDirection: \"row\", children: [\n /* @__PURE__ */ jsx(Text, { bold: true, color: \"gray\", children: (() => {\n switch (true) {\n case (appContext.installState.installingComponent && isSelected):\n return \"\";\n case Boolean(appContext.installState.installingComponent):\n return \" \";\n case isSelected:\n return \"\\u276F \";\n default:\n return \" \";\n }\n })() }),\n appContext.installState.installingComponent && isSelected && /* @__PURE__ */ jsx(InstallingSpinnerLabel, {}),\n /* @__PURE__ */ jsx(Text, { bold: true, color: isSelected ? \"white\" : \"black\", children: result.item?.name }),\n /* @__PURE__ */ jsx(InstalledBadge, { item: result.item })\n ] }),\n /* @__PURE__ */ jsx(Spacer, {}),\n /* @__PURE__ */ jsx(ComponentAccessType, { item: result.item }),\n /* @__PURE__ */ jsx(CategorySectionBadge, { item: result.item })\n ] });\n};\nconst CategorySectionBadge = ({ item }) => {\n const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1);\n return /* @__PURE__ */ jsx(Box, { marginLeft: 1, gap: 1, children: /* @__PURE__ */ jsxs(Text, { color: \"black\", backgroundColor: \"white\", children: [\n \" \",\n capitalizeFirstLetter(item?.category),\n \" \",\n \">\",\n \" \",\n capitalizeFirstLetter(item?.categorySection),\n \" \"\n ] }) });\n};\nconst ComponentAccessType = ({ item }) =>
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["cli-components/index.js"],"sourcesContent":["import { Alert, Badge, Spinner } from \"@inkjs/ui\";\nimport { Box, Spacer, Text } from \"ink\";\nimport React from \"react\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst ResultsContainer = () => {\n const appContext = React.useContext(AppContext);\n return /* @__PURE__ */ jsxs(\n Box,\n {\n flexDirection: \"column\",\n display: appContext.searchResults.length ? \"flex\" : \"none\",\n children: [\n /* @__PURE__ */ jsx(Box, { flexDirection: \"column\", borderStyle: \"round\", paddingX: 1, gap: 1, children: appContext.searchResults.slice(0, 5).map((result, i) => /* @__PURE__ */ jsx(\n ResultCard,\n {\n result,\n isSelected: appContext.selectedResultIndex === i\n },\n result.item.fileName\n )) }),\n /* @__PURE__ */ jsx(Footer, {})\n ]\n }\n );\n};\nconst Footer = () => {\n return /* @__PURE__ */ jsx(Box, { flexDirection: \"row\", justifyContent: \"flex-end\", marginRight: 1, children: /* @__PURE__ */ jsxs(Text, { children: [\n /* @__PURE__ */ jsx(Text, { underline: true, children: \"ESC\" }),\n \" to exit\"\n ] }) });\n};\nconst InstalledBadge = ({ item }) => {\n const appContext = React.useContext(AppContext);\n const isComponentInstalled = appContext.installState?.installedComponents?.map((component) => component.fileName).includes(item.fileName);\n if (!appContext.installState?.installedComponents) return null;\n return isComponentInstalled && /* @__PURE__ */ jsx(Box, { marginLeft: 1, children: /* @__PURE__ */ jsx(Badge, { color: \"green\", children: \"Installed\" }) });\n};\nconst ResultCard = ({\n result,\n isSelected\n}) => {\n const appContext = React.useContext(AppContext);\n return /* @__PURE__ */ jsxs(Box, { flexDirection: \"row\", minWidth: \"100%\", children: [\n /* @__PURE__ */ jsxs(Box, { flexDirection: \"row\", children: [\n /* @__PURE__ */ jsx(Text, { bold: true, color: \"gray\", children: (() => {\n switch (true) {\n case (appContext.installState.installingComponent && isSelected):\n return \"\";\n case Boolean(appContext.installState.installingComponent):\n return \" \";\n case isSelected:\n return \"\\u276F \";\n default:\n return \" \";\n }\n })() }),\n appContext.installState.installingComponent && isSelected && /* @__PURE__ */ jsx(InstallingSpinnerLabel, {}),\n /* @__PURE__ */ jsx(Text, { bold: true, color: isSelected ? \"white\" : \"black\", children: result.item?.name }),\n /* @__PURE__ */ jsx(InstalledBadge, { item: result.item })\n ] }),\n /* @__PURE__ */ jsx(Spacer, {}),\n /* @__PURE__ */ jsx(ComponentAccessType, { item: result.item }),\n /* @__PURE__ */ jsx(CategorySectionBadge, { item: result.item })\n ] });\n};\nconst CategorySectionBadge = ({ item }) => {\n const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1);\n return /* @__PURE__ */ jsx(Box, { marginLeft: 1, gap: 1, children: /* @__PURE__ */ jsxs(Text, { color: \"black\", backgroundColor: \"white\", children: [\n \" \",\n capitalizeFirstLetter(item?.category),\n \" \",\n \">\",\n \" \",\n capitalizeFirstLetter(item?.categorySection),\n \" \"\n ] }) });\n};\nconst ComponentAccessType = ({ item }) => null;\nconst ResultsCounter = () => {\n const appContext = React.useContext(AppContext);\n const resultCount = appContext.searchResults.length;\n return /* @__PURE__ */ jsx(Box, { children: !!resultCount && /* @__PURE__ */ jsxs(Text, { bold: true, color: \"gray\", children: [\n resultCount,\n \" result\",\n resultCount > 1 ? \"s\" : \"\"\n ] }) });\n};\nconst InstallingSpinnerLabel = () => {\n const appContext = React.useContext(AppContext);\n return /* @__PURE__ */ jsx(Box, { children: appContext.installState.installingComponent ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Spinner, { label: \"Installing \" }) }) : /* @__PURE__ */ jsx(Box, { marginRight: 2 }) });\n};\nconst UsageBanner = () => {\n return /* @__PURE__ */ jsxs(Alert, { variant: \"info\", children: [\n \"Search any component by category, section or name. \",\n /* @__PURE__ */ jsx(Text, { underline: true, children: \"Up\" }),\n \" and\",\n \" \",\n /* @__PURE__ */ jsx(Text, { underline: true, children: \"down\" }),\n \" arrows to select. \",\n /* @__PURE__ */ jsx(Text, { underline: true, children: \"Enter\" }),\n \" to install.\"\n ] });\n};\nexport {\n CategorySectionBadge,\n ComponentAccessType,\n Footer,\n InstalledBadge,\n InstallingSpinnerLabel,\n ResultCard,\n ResultsContainer,\n ResultsCounter,\n UsageBanner\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;AAKA,MAAM,yBAAyB;CAC7B,MAAM,aAAa,MAAM,WAAW,UAAU;CAC9C,OAAuB,qBACrB,KACA;EACE,eAAe;EACf,SAAS,WAAW,cAAc,SAAS,SAAS;EACpD,UAAU,CACQ,oBAAI,KAAK;GAAE,eAAe;GAAU,aAAa;GAAS,UAAU;GAAG,KAAK;GAAG,UAAU,WAAW,cAAc,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,MAAsB,oBAC/K,YACA;IACE;IACA,YAAY,WAAW,wBAAwB;GACjD,GACA,OAAO,KAAK,QACd,CAAC;EAAE,CAAC,GACY,oBAAI,QAAQ,CAAC,CAAC,CAChC;CACF,CACF;AACF;AACA,MAAM,eAAe;CACnB,OAAuB,oBAAI,KAAK;EAAE,eAAe;EAAO,gBAAgB;EAAY,aAAa;EAAG,UAA0B,qBAAK,MAAM,EAAE,UAAU,CACnI,oBAAI,MAAM;GAAE,WAAW;GAAM,UAAU;EAAM,CAAC,GAC9D,UACF,EAAE,CAAC;CAAE,CAAC;AACR;AACA,MAAM,kBAAkB,EAAE,WAAW;CACnC,MAAM,aAAa,MAAM,WAAW,UAAU;CAC9C,MAAM,uBAAuB,WAAW,cAAc,qBAAqB,KAAK,cAAc,UAAU,QAAQ,CAAC,CAAC,SAAS,KAAK,QAAQ;CACxI,IAAI,CAAC,WAAW,cAAc,qBAAqB,OAAO;CAC1D,OAAO,wBAAwC,oBAAI,KAAK;EAAE,YAAY;EAAG,UAA0B,oBAAI,OAAO;GAAE,OAAO;GAAS,UAAU;EAAY,CA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AC3B,MAAM,aAAa,MAAM,WAAW,UAAU;CAC9C,MAAM,cAAc,WAAW,cAAc;CAC7C,OAAuB,oBAAI,KAAK,EAAE,UAAU,CAAC,CAAC,eAA+B,qBAAK,MAAM;EAAE,MAAM;EAAM,OAAO;EAAQ,UAAU;GAC7H;GACA;GACA,cAAc,IAAI,MAAM;EAC1B;CAAE,CAAC,EAAE,CAAC;AACR;AACA,MAAM,+BAA+B;CACnC,MAAM,aAAa,MAAM,WAAW,UAAU;CAC9C,OAAuB,oBAAI,KAAK,EAAE,UAAU,WAAW,aAAa,sBAAsC,oBAAI,KAAK,EAAE,UAA0B,oBAAI,SAAS,EAAE,OAAO,cAAc,CAAC,EAAE,CAAC,IAAoB,oBAAI,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAC3O;AACA,MAAM,oBAAoB;CACxB,OAAuB,qBAAK,OAAO;EAAE,SAAS;EAAQ,UAAU;GAC9D;GACgB,oBAAI,MAAM;IAAE,WAAW;IAAM,UAAU;GAAK,CAAC;GAC7D;GACA;GACgB,oBAAI,MAAM;IAAE,WAAW;IAAM,UAAU;GAAO,CAAC;GAC/D;GACgB,oBAAI,MAAM;IAAE,WAAW;IAAM,UAAU;GAAQ,CAAC;GAChE;EACF;CAAE,CAAC;AACL"}
|
|
@@ -113,15 +113,7 @@ var CategorySectionBadge = function(param) {
|
|
|
113
113
|
};
|
|
114
114
|
var ComponentAccessType = function(param) {
|
|
115
115
|
var { item } = param;
|
|
116
|
-
return
|
|
117
|
-
marginLeft: 1,
|
|
118
|
-
gap: 1,
|
|
119
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
120
|
-
color: "black",
|
|
121
|
-
backgroundColor: (item === null || item === void 0 ? void 0 : item.isOSS) ? "green" : "blue",
|
|
122
|
-
children: (item === null || item === void 0 ? void 0 : item.isOSS) ? "FREE" : "PRO"
|
|
123
|
-
})
|
|
124
|
-
});
|
|
116
|
+
return null;
|
|
125
117
|
};
|
|
126
118
|
var ResultsCounter = function() {
|
|
127
119
|
var appContext = React.useContext(AppContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["cli-components/index.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Alert, Badge, Spinner } from \"@inkjs/ui\";\nimport { Box, Spacer, Text } from \"ink\";\nimport React from \"react\";\nimport { AppContext } from \"../data/AppContext.js\";\nvar ResultsContainer = function() {\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"column\",\n display: appContext.searchResults.length ? \"flex\" : \"none\",\n children: [\n /* @__PURE__ */ _jsx(Box, {\n flexDirection: \"column\",\n borderStyle: \"round\",\n paddingX: 1,\n gap: 1,\n children: appContext.searchResults.slice(0, 5).map(function(result, i) {\n return /* @__PURE__ */ _jsx(ResultCard, {\n result,\n isSelected: appContext.selectedResultIndex === i\n }, result.item.fileName);\n })\n }),\n /* @__PURE__ */ _jsx(Footer, {})\n ]\n });\n};\nvar Footer = function() {\n return /* @__PURE__ */ _jsx(Box, {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n marginRight: 1,\n children: /* @__PURE__ */ _jsxs(Text, {\n children: [\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"ESC\"\n }),\n \" to exit\"\n ]\n })\n });\n};\nvar InstalledBadge = function(param) {\n var { item } = param;\n var _appContext_installState_installedComponents, _appContext_installState, _appContext_installState1;\n var appContext = React.useContext(AppContext);\n var isComponentInstalled = (_appContext_installState = appContext.installState) === null || _appContext_installState === void 0 ? void 0 : (_appContext_installState_installedComponents = _appContext_installState.installedComponents) === null || _appContext_installState_installedComponents === void 0 ? void 0 : _appContext_installState_installedComponents.map(function(component) {\n return component.fileName;\n }).includes(item.fileName);\n if (!((_appContext_installState1 = appContext.installState) === null || _appContext_installState1 === void 0 ? void 0 : _appContext_installState1.installedComponents)) return null;\n return isComponentInstalled && /* @__PURE__ */ _jsx(Box, {\n marginLeft: 1,\n children: /* @__PURE__ */ _jsx(Badge, {\n color: \"green\",\n children: \"Installed\"\n })\n });\n};\nvar ResultCard = function(param) {\n var { result, isSelected } = param;\n var _result_item;\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"row\",\n minWidth: \"100%\",\n children: [\n /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"row\",\n children: [\n /* @__PURE__ */ _jsx(Text, {\n bold: true,\n color: \"gray\",\n children: (function() {\n switch (true) {\n case (appContext.installState.installingComponent && isSelected):\n return \"\";\n case Boolean(appContext.installState.installingComponent):\n return \" \";\n case isSelected:\n return \"\\u276F \";\n default:\n return \" \";\n }\n })()\n }),\n appContext.installState.installingComponent && isSelected && /* @__PURE__ */ _jsx(InstallingSpinnerLabel, {}),\n /* @__PURE__ */ _jsx(Text, {\n bold: true,\n color: isSelected ? \"white\" : \"black\",\n children: (_result_item = result.item) === null || _result_item === void 0 ? void 0 : _result_item.name\n }),\n /* @__PURE__ */ _jsx(InstalledBadge, {\n item: result.item\n })\n ]\n }),\n /* @__PURE__ */ _jsx(Spacer, {}),\n /* @__PURE__ */ _jsx(ComponentAccessType, {\n item: result.item\n }),\n /* @__PURE__ */ _jsx(CategorySectionBadge, {\n item: result.item\n })\n ]\n });\n};\nvar CategorySectionBadge = function(param) {\n var { item } = param;\n var capitalizeFirstLetter = function(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n return /* @__PURE__ */ _jsx(Box, {\n marginLeft: 1,\n gap: 1,\n children: /* @__PURE__ */ _jsxs(Text, {\n color: \"black\",\n backgroundColor: \"white\",\n children: [\n \" \",\n capitalizeFirstLetter(item === null || item === void 0 ? void 0 : item.category),\n \" \",\n \">\",\n \" \",\n capitalizeFirstLetter(item === null || item === void 0 ? void 0 : item.categorySection),\n \" \"\n ]\n })\n });\n};\nvar ComponentAccessType = function(param) {\n var { item } = param;\n return /* @__PURE__ */ _jsx(Box, {\n marginLeft: 1,\n gap: 1,\n children: /* @__PURE__ */ _jsx(Text, {\n color: \"black\",\n backgroundColor: (item === null || item === void 0 ? void 0 : item.isOSS) ? \"green\" : \"blue\",\n children: (item === null || item === void 0 ? void 0 : item.isOSS) ? \"FREE\" : \"PRO\"\n })\n });\n};\nvar ResultsCounter = function() {\n var appContext = React.useContext(AppContext);\n var resultCount = appContext.searchResults.length;\n return /* @__PURE__ */ _jsx(Box, {\n children: !!resultCount && /* @__PURE__ */ _jsxs(Text, {\n bold: true,\n color: \"gray\",\n children: [\n resultCount,\n \" result\",\n resultCount > 1 ? \"s\" : \"\"\n ]\n })\n });\n};\nvar InstallingSpinnerLabel = function() {\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsx(Box, {\n children: appContext.installState.installingComponent ? /* @__PURE__ */ _jsx(Box, {\n children: /* @__PURE__ */ _jsx(Spinner, {\n label: \"Installing \"\n })\n }) : /* @__PURE__ */ _jsx(Box, {\n marginRight: 2\n })\n });\n};\nvar UsageBanner = function() {\n return /* @__PURE__ */ _jsxs(Alert, {\n variant: \"info\",\n children: [\n \"Search any component by category, section or name. \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"Up\"\n }),\n \" and\",\n \" \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"down\"\n }),\n \" arrows to select. \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"Enter\"\n }),\n \" to install.\"\n ]\n });\n};\nexport {\n CategorySectionBadge,\n ComponentAccessType,\n Footer,\n InstalledBadge,\n InstallingSpinnerLabel,\n ResultCard,\n ResultsContainer,\n ResultsCounter,\n UsageBanner\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,mBAAmB,WAAW;CAChC,IAAI,aAAa,MAAM,WAAW,UAAU;CAC5C,OAAuB,qBAAM,KAAK;EAChC,eAAe;EACf,SAAS,WAAW,cAAc,SAAS,SAAS;EACpD,UAAU,CACQ,oBAAK,KA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AAS,OAAO;CACxC,IAAI,EAAE,SAAS;CACf,OAAuB,oBAAK,KAAK;EAC/B,YAAY;EACZ,KAAK;EACL,UAA0B,oBAAK,MAAM;GACnC,OAAO;GACP,kBAAkB,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,SAAS,UAAU;GACtF,WAAW,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,SAAS,SAAS;EAChF,CAAC;CACH,CAAC;AACH;AACA,IAAI,iBAAiB,WAAW;CAC9B,IAAI,aAAa,MAAM,WAAW,UAAU;CAC5C,IAAI,cAAc,WAAW,cAAc;CAC3C,OAAuB,oBAAK,KAAK,EAC/B,UAAU,CAAC,CAAC,eAA+B,qBAAM,MAAM;EACrD,MAAM;EACN,OAAO;EACP,UAAU;GACR;GACA;GACA,cAAc,IAAI,MAAM;EAC1B;CACF,CAAC,EACH,CAAC;AACH;AACA,IAAI,yBAAyB,WAAW;CACtC,IAAI,aAAa,MAAM,WAAW,UAAU;CAC5C,OAAuB,oBAAK,KAAK,EAC/B,UAAU,WAAW,aAAa,sBAAsC,oBAAK,KAAK,EAChF,UAA0B,oBAAK,SAAS,EACtC,OAAO,cACT,CAAC,EACH,CAAC,IAAoB,oBAAK,KAAK,EAC7B,aAAa,EACf,CAAC,EACH,CAAC;AACH;AACA,IAAI,cAAc,WAAW;CAC3B,OAAuB,qBAAM,OAAO;EAClC,SAAS;EACT,UAAU;GACR;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;GACA;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;EACF;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cli-components/index.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Alert, Badge, Spinner } from \"@inkjs/ui\";\nimport { Box, Spacer, Text } from \"ink\";\nimport React from \"react\";\nimport { AppContext } from \"../data/AppContext.js\";\nvar ResultsContainer = function() {\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"column\",\n display: appContext.searchResults.length ? \"flex\" : \"none\",\n children: [\n /* @__PURE__ */ _jsx(Box, {\n flexDirection: \"column\",\n borderStyle: \"round\",\n paddingX: 1,\n gap: 1,\n children: appContext.searchResults.slice(0, 5).map(function(result, i) {\n return /* @__PURE__ */ _jsx(ResultCard, {\n result,\n isSelected: appContext.selectedResultIndex === i\n }, result.item.fileName);\n })\n }),\n /* @__PURE__ */ _jsx(Footer, {})\n ]\n });\n};\nvar Footer = function() {\n return /* @__PURE__ */ _jsx(Box, {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n marginRight: 1,\n children: /* @__PURE__ */ _jsxs(Text, {\n children: [\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"ESC\"\n }),\n \" to exit\"\n ]\n })\n });\n};\nvar InstalledBadge = function(param) {\n var { item } = param;\n var _appContext_installState_installedComponents, _appContext_installState, _appContext_installState1;\n var appContext = React.useContext(AppContext);\n var isComponentInstalled = (_appContext_installState = appContext.installState) === null || _appContext_installState === void 0 ? void 0 : (_appContext_installState_installedComponents = _appContext_installState.installedComponents) === null || _appContext_installState_installedComponents === void 0 ? void 0 : _appContext_installState_installedComponents.map(function(component) {\n return component.fileName;\n }).includes(item.fileName);\n if (!((_appContext_installState1 = appContext.installState) === null || _appContext_installState1 === void 0 ? void 0 : _appContext_installState1.installedComponents)) return null;\n return isComponentInstalled && /* @__PURE__ */ _jsx(Box, {\n marginLeft: 1,\n children: /* @__PURE__ */ _jsx(Badge, {\n color: \"green\",\n children: \"Installed\"\n })\n });\n};\nvar ResultCard = function(param) {\n var { result, isSelected } = param;\n var _result_item;\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"row\",\n minWidth: \"100%\",\n children: [\n /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"row\",\n children: [\n /* @__PURE__ */ _jsx(Text, {\n bold: true,\n color: \"gray\",\n children: (function() {\n switch (true) {\n case (appContext.installState.installingComponent && isSelected):\n return \"\";\n case Boolean(appContext.installState.installingComponent):\n return \" \";\n case isSelected:\n return \"\\u276F \";\n default:\n return \" \";\n }\n })()\n }),\n appContext.installState.installingComponent && isSelected && /* @__PURE__ */ _jsx(InstallingSpinnerLabel, {}),\n /* @__PURE__ */ _jsx(Text, {\n bold: true,\n color: isSelected ? \"white\" : \"black\",\n children: (_result_item = result.item) === null || _result_item === void 0 ? void 0 : _result_item.name\n }),\n /* @__PURE__ */ _jsx(InstalledBadge, {\n item: result.item\n })\n ]\n }),\n /* @__PURE__ */ _jsx(Spacer, {}),\n /* @__PURE__ */ _jsx(ComponentAccessType, {\n item: result.item\n }),\n /* @__PURE__ */ _jsx(CategorySectionBadge, {\n item: result.item\n })\n ]\n });\n};\nvar CategorySectionBadge = function(param) {\n var { item } = param;\n var capitalizeFirstLetter = function(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n return /* @__PURE__ */ _jsx(Box, {\n marginLeft: 1,\n gap: 1,\n children: /* @__PURE__ */ _jsxs(Text, {\n color: \"black\",\n backgroundColor: \"white\",\n children: [\n \" \",\n capitalizeFirstLetter(item === null || item === void 0 ? void 0 : item.category),\n \" \",\n \">\",\n \" \",\n capitalizeFirstLetter(item === null || item === void 0 ? void 0 : item.categorySection),\n \" \"\n ]\n })\n });\n};\nvar ComponentAccessType = function(param) {\n var { item } = param;\n return null;\n};\nvar ResultsCounter = function() {\n var appContext = React.useContext(AppContext);\n var resultCount = appContext.searchResults.length;\n return /* @__PURE__ */ _jsx(Box, {\n children: !!resultCount && /* @__PURE__ */ _jsxs(Text, {\n bold: true,\n color: \"gray\",\n children: [\n resultCount,\n \" result\",\n resultCount > 1 ? \"s\" : \"\"\n ]\n })\n });\n};\nvar InstallingSpinnerLabel = function() {\n var appContext = React.useContext(AppContext);\n return /* @__PURE__ */ _jsx(Box, {\n children: appContext.installState.installingComponent ? /* @__PURE__ */ _jsx(Box, {\n children: /* @__PURE__ */ _jsx(Spinner, {\n label: \"Installing \"\n })\n }) : /* @__PURE__ */ _jsx(Box, {\n marginRight: 2\n })\n });\n};\nvar UsageBanner = function() {\n return /* @__PURE__ */ _jsxs(Alert, {\n variant: \"info\",\n children: [\n \"Search any component by category, section or name. \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"Up\"\n }),\n \" and\",\n \" \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"down\"\n }),\n \" arrows to select. \",\n /* @__PURE__ */ _jsx(Text, {\n underline: true,\n children: \"Enter\"\n }),\n \" to install.\"\n ]\n });\n};\nexport {\n CategorySectionBadge,\n ComponentAccessType,\n Footer,\n InstalledBadge,\n InstallingSpinnerLabel,\n ResultCard,\n ResultsContainer,\n ResultsCounter,\n UsageBanner\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,mBAAmB,WAAW;CAChC,IAAI,aAAa,MAAM,WAAW,UAAU;CAC5C,OAAuB,qBAAM,KAAK;EAChC,eAAe;EACf,SAAS,WAAW,cAAc,SAAS,SAAS;EACpD,UAAU,CACQ,oBAAK,KAAK;GACxB,eAAe;GACf,aAAa;GACb,UAAU;GACV,KAAK;GACL,UAAU,WAAW,cAAc,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,SAAS,QAAQ,GAAG;IACrE,OAAuB,oBAAK,YAAY;KACtC;KACA,YAAY,WAAW,wBAAwB;IACjD,GAAG,OAAO,KAAK,QAAQ;GACzB,CAAC;EACH,CAAC,GACe,oBAAK,QAAQ,CAAC,CAAC,CACjC;CACF,CAAC;AACH;AACA,IAAI,SAAS,WAAW;CACtB,OAAuB,oBAAK,KAAK;EAC/B,eAAe;EACf,gBAAgB;EAChB,aAAa;EACb,UAA0B,qBAA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AAK,KAAK,EAC/B,UAAU,WAAW,aAAa,sBAAsC,oBAAK,KAAK,EAChF,UAA0B,oBAAK,SAAS,EACtC,OAAO,cACT,CAAC,EACH,CAAC,IAAoB,oBAAK,KAAK,EAC7B,aAAa,EACf,CAAC,EACH,CAAC;AACH;AACA,IAAI,cAAc,WAAW;CAC3B,OAAuB,qBAAM,OAAO;EAClC,SAAS;EACT,UAAU;GACR;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;GACA;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;GACgB,oBAAK,MAAM;IACzB,WAAW;IACX,UAAU;GACZ,CAAC;GACD;EACF;CACF,CAAC;AACH"}
|
package/dist/commands/index.mjs
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Box, Text, useApp, useInput } from "ink";
|
|
3
|
-
import { MemoryRouter, Navigate, Route, Routes, useLocation, useNavigate
|
|
4
|
-
import { AuthGuard } from "../app/AuthGuard.mjs";
|
|
3
|
+
import { MemoryRouter, Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom";
|
|
5
4
|
import { AppContext } from "../data/AppContext.mjs";
|
|
6
|
-
import { CodeAuthScreen } from "../screens/CodeAuthScreen.mjs";
|
|
7
5
|
import { InstallConfirmScreen } from "../screens/InstallConfirmScreen.mjs";
|
|
8
6
|
import { SearchScreen } from "../screens/SearchScreen.mjs";
|
|
9
|
-
import Conf from "conf";
|
|
10
7
|
import { handleGlobalKeyPress } from "../app/handle-global-keypress.mjs";
|
|
11
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
9
|
|
|
13
10
|
const debugLog = (...args) => {
|
|
14
11
|
if (process.env.DEBUG === "true") console.log(...args);
|
|
15
12
|
};
|
|
16
|
-
const redact = (s) => typeof s === "string" && s.length > 8 ? `${s.slice(0, 6)}\u2026(${s.length} chars)` : "<redacted>";
|
|
17
13
|
function BentoGet() {
|
|
18
14
|
const navigate = useNavigate();
|
|
19
15
|
const location = useLocation();
|
|
20
|
-
const tokenStore = new Conf({ projectName: "bento-cli/v2" });
|
|
21
|
-
const [isLoggedIn, setIsLoggedIn] = React.useState(false);
|
|
22
16
|
const [searchResults, setSearchResults] = React.useState([]);
|
|
23
17
|
const [selectedResultIndex, setSelectedResultIndex] = React.useState(-1);
|
|
24
18
|
const [searchInput, setSearchInput] = React.useState("");
|
|
@@ -36,12 +30,10 @@ function BentoGet() {
|
|
|
36
30
|
installingComponent: null,
|
|
37
31
|
installedComponents: [],
|
|
38
32
|
shouldOpenBrowser: false,
|
|
39
|
-
isTokenInstalled: false,
|
|
40
33
|
componentToInstall: null
|
|
41
34
|
});
|
|
42
35
|
const [isCopyingToClipboard, setCopyingToClipboard] = React.useState(false);
|
|
43
36
|
const { exit } = useApp();
|
|
44
|
-
const [accessToken, setAccessToken] = React.useState(null);
|
|
45
37
|
const appContextValues = React.useMemo(() => ({
|
|
46
38
|
isCopyingToClipboard,
|
|
47
39
|
setCopyingToClipboard,
|
|
@@ -56,13 +48,8 @@ function BentoGet() {
|
|
|
56
48
|
installState,
|
|
57
49
|
confirmationPending,
|
|
58
50
|
setConfirmationPending,
|
|
59
|
-
isLoggedIn,
|
|
60
|
-
setIsLoggedIn,
|
|
61
|
-
accessToken,
|
|
62
|
-
setAccessToken,
|
|
63
51
|
fetchState,
|
|
64
|
-
setFetchState
|
|
65
|
-
tokenStore
|
|
52
|
+
setFetchState
|
|
66
53
|
}), [
|
|
67
54
|
isCopyingToClipboard,
|
|
68
55
|
searchResults,
|
|
@@ -70,25 +57,12 @@ function BentoGet() {
|
|
|
70
57
|
searchInput,
|
|
71
58
|
installState,
|
|
72
59
|
confirmationPending,
|
|
73
|
-
|
|
74
|
-
fetchState,
|
|
75
|
-
tokenStore
|
|
60
|
+
fetchState
|
|
76
61
|
]);
|
|
77
62
|
useInput((input, key) => handleGlobalKeyPress(input, key, appContextValues, navigate, location));
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
const token = tokenStore.get("accessToken");
|
|
80
|
-
if (token) {
|
|
81
|
-
setAccessToken(token);
|
|
82
|
-
setIsLoggedIn(true);
|
|
83
|
-
debugLog("Token found, setting isLoggedIn to true");
|
|
84
|
-
debugLog({ token: redact(token) });
|
|
85
|
-
} else {
|
|
86
|
-
setIsLoggedIn(false);
|
|
87
|
-
}
|
|
88
|
-
}, []);
|
|
89
63
|
return /* @__PURE__ */ jsxs(AppContext.Provider, {
|
|
90
64
|
value: appContextValues,
|
|
91
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ jsxs(Routes, { children: [
|
|
92
66
|
/* @__PURE__ */ jsx(Route, {
|
|
93
67
|
path: "/",
|
|
94
68
|
element: /* @__PURE__ */ jsx(Navigate, {
|
|
@@ -100,47 +74,21 @@ function BentoGet() {
|
|
|
100
74
|
path: "/search",
|
|
101
75
|
element: /* @__PURE__ */ jsx(SearchScreen, {})
|
|
102
76
|
}),
|
|
103
|
-
/* @__PURE__ */ jsx(Route, {
|
|
104
|
-
path: "/auth/:fileName",
|
|
105
|
-
element: /* @__PURE__ */ jsx(CodeAuthScreen, {})
|
|
106
|
-
}),
|
|
107
77
|
/* @__PURE__ */ jsx(Route, {
|
|
108
78
|
path: "/install-confirm/:fileName",
|
|
109
|
-
element: /* @__PURE__ */ jsx(
|
|
79
|
+
element: /* @__PURE__ */ jsx(InstallConfirmScreen, {})
|
|
110
80
|
})
|
|
111
|
-
] })
|
|
81
|
+
] }), process.env.DEBUG && /* @__PURE__ */ jsx(Box, {
|
|
112
82
|
borderStyle: "round",
|
|
113
83
|
borderColor: "",
|
|
114
84
|
padding: 1,
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ jsxs(Text, { children: ["Current Route: ", location.pathname] }),
|
|
117
|
-
/* @__PURE__ */ jsx(Text, {
|
|
118
|
-
color: "magenta",
|
|
119
|
-
children: " | "
|
|
120
|
-
}),
|
|
121
|
-
/* @__PURE__ */ jsx(Text, {
|
|
122
|
-
color: isLoggedIn ? "green" : "red",
|
|
123
|
-
children: isLoggedIn ? "Logged In" : "Logged Out"
|
|
124
|
-
})
|
|
125
|
-
]
|
|
85
|
+
children: /* @__PURE__ */ jsxs(Text, { children: ["Current Route: ", location.pathname] })
|
|
126
86
|
})]
|
|
127
87
|
});
|
|
128
88
|
}
|
|
129
89
|
function App() {
|
|
130
90
|
return /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsx(BentoGet, {}) });
|
|
131
91
|
}
|
|
132
|
-
const ProtectedRoute = ({ component: Component }) => {
|
|
133
|
-
const { fileName } = useParams();
|
|
134
|
-
const { isLoggedIn, installState } = React.useContext(AppContext);
|
|
135
|
-
const isOSS = installState.installingComponent?.isOSS;
|
|
136
|
-
if (isOSS || isLoggedIn) {
|
|
137
|
-
return /* @__PURE__ */ jsx(Component, {});
|
|
138
|
-
}
|
|
139
|
-
return /* @__PURE__ */ jsx(Navigate, {
|
|
140
|
-
to: `/auth/${fileName}`,
|
|
141
|
-
replace: true
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
92
|
|
|
145
|
-
export { debugLog, App as default
|
|
93
|
+
export { debugLog, App as default };
|
|
146
94
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["commands/index.js"],"sourcesContent":["import React from \"react\";\nimport { Box, useApp, useInput, Text } from \"ink\";\nimport {\n MemoryRouter,\n Navigate,\n Route,\n Routes,\n useLocation,\n useNavigate
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["commands/index.js"],"sourcesContent":["import React from \"react\";\nimport { Box, useApp, useInput, Text } from \"ink\";\nimport {\n MemoryRouter,\n Navigate,\n Route,\n Routes,\n useLocation,\n useNavigate\n} from \"react-router-dom\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { InstallConfirmScreen } from \"../screens/InstallConfirmScreen.js\";\nimport { SearchScreen } from \"../screens/SearchScreen.js\";\nimport { handleGlobalKeyPress } from \"../app/handle-global-keypress.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst debugLog = (...args) => {\n if (process.env.DEBUG === \"true\") console.log(...args);\n};\nfunction BentoGet() {\n const navigate = useNavigate();\n const location = useLocation();\n const [searchResults, setSearchResults] = React.useState([]);\n const [selectedResultIndex, setSelectedResultIndex] = React.useState(-1);\n const [searchInput, setSearchInput] = React.useState(\"\");\n const [confirmationPending, setConfirmationPending] = React.useState(true);\n const [fetchState, setFetchState] = React.useState({\n status: \"idle\",\n isLoading: false,\n isSuccess: false,\n isError: false,\n data: null,\n error: void 0,\n statusCode: void 0\n });\n const [installState, setInstallState] = React.useState({\n installingComponent: null,\n installedComponents: [],\n shouldOpenBrowser: false,\n componentToInstall: null\n });\n const [isCopyingToClipboard, setCopyingToClipboard] = React.useState(false);\n const { exit } = useApp();\n const appContextValues = React.useMemo(\n () => ({\n isCopyingToClipboard,\n setCopyingToClipboard,\n exitApp: exit,\n searchResults,\n setSearchResults,\n selectedResultIndex,\n setSelectedResultIndex,\n searchInput,\n setSearchInput,\n setInstallState,\n installState,\n confirmationPending,\n setConfirmationPending,\n fetchState,\n setFetchState\n }),\n [\n isCopyingToClipboard,\n searchResults,\n selectedResultIndex,\n searchInput,\n installState,\n confirmationPending,\n fetchState\n ]\n );\n useInput(\n (input, key) => handleGlobalKeyPress(input, key, appContextValues, navigate, location)\n );\n return /* @__PURE__ */ jsxs(AppContext.Provider, { value: appContextValues, children: [\n /* @__PURE__ */ jsxs(Routes, { children: [\n /* @__PURE__ */ jsx(Route, { path: \"/\", element: /* @__PURE__ */ jsx(Navigate, { to: \"/search\", replace: true }) }),\n /* @__PURE__ */ jsx(Route, { path: \"/search\", element: /* @__PURE__ */ jsx(SearchScreen, {}) }),\n /* @__PURE__ */ jsx(Route, { path: \"/install-confirm/:fileName\", element: /* @__PURE__ */ jsx(InstallConfirmScreen, {}) })\n ] }),\n process.env.DEBUG && /* @__PURE__ */ jsx(Box, { borderStyle: \"round\", borderColor: \"\", padding: 1, children: /* @__PURE__ */ jsxs(Text, { children: [\n \"Current Route: \",\n location.pathname\n ] }) })\n ] });\n}\nfunction App() {\n return /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsx(BentoGet, {}) });\n}\nexport {\n debugLog,\n App as default\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;AAeA,MAAM,YAAY,GAAG,SAAS;CAC5B,IAAI,QAAQ,IAAI,UAAU,QAAQ,QAAQ,IAAI,GAAG,IAAI;AACvD;AACA,SAAS,WAAW;CAClB,MAAM,WAAW,YAAY;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,CAAC,CAAC;CAC3D,MAAM,CAAC,qBAAqB,0BAA0B,MAAM,SAAS,CAAC,CAAC;CACvE,MAAM,CAAC,aAAa,kBAAkB,MAAM,SAAS,EAAE;CACvD,MAAM,CAAC,qBAAqB,0BAA0B,MAAM,SAAS,IAAI;CACzE,MAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS;EACjD,QAAQ;EACR,WAAW;EACX,WAAW;EACX,SAAS;EACT,MAAM;EACN,OAAO,KAAK;EACZ,YAAY,KAAK;CACnB,CAAC;CACD,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS;EACrD,qBAAqB;EACrB,qBAAqB,CAAC;EACtB,mBAAmB;EACnB,oBAAoB;CACtB,CAAC;CACD,MAAM,CAAC,sBAAsB,yBAAyB,MAAM,SAAS,KAAK;CAC1E,MAAM,EAAE,SAAS,OAAO;CACxB,MAAM,mBAAmB,MAAM,eACtB;EACL;EACA;EACA,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,UACG,OAAO,QAAQ,qBAAqB,OAAO,KAAK,kBAAkB,UAAU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