bento-get 2.7.7 → 3.0.0-beta.643.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/dist/app/AuthGuard.mjs +35 -45
- package/dist/app/AuthGuard.mjs.map +1 -1
- package/dist/app/AuthGuard.native.js +37 -47
- package/dist/app/AuthGuard.native.js.map +1 -1
- package/dist/app/handle-global-keypress.mjs +93 -98
- package/dist/app/handle-global-keypress.mjs.map +1 -1
- package/dist/app/handle-global-keypress.native.js +105 -110
- package/dist/app/handle-global-keypress.native.js.map +1 -1
- package/dist/cli-components/SearchBar.mjs +39 -37
- package/dist/cli-components/SearchBar.mjs.map +1 -1
- package/dist/cli-components/SearchBar.native.js +42 -41
- package/dist/cli-components/SearchBar.native.js.map +1 -1
- package/dist/cli-components/index.mjs +137 -135
- package/dist/cli-components/index.mjs.map +1 -1
- package/dist/cli-components/index.native.js +155 -153
- package/dist/cli-components/index.native.js.map +1 -1
- package/dist/cli.mjs +4 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/cli.native.js +4 -2
- package/dist/cli.native.js.map +1 -1
- package/dist/commands/add.mjs +9 -6
- package/dist/commands/add.mjs.map +1 -1
- package/dist/commands/add.native.js +10 -7
- package/dist/commands/add.native.js.map +1 -1
- package/dist/commands/index.mjs +133 -135
- package/dist/commands/index.mjs.map +1 -1
- package/dist/commands/index.native.js +145 -147
- package/dist/commands/index.native.js.map +1 -1
- package/dist/components.mjs +1470 -1228
- package/dist/components.mjs.map +1 -1
- package/dist/components.native.js +1470 -1228
- package/dist/components.native.js.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/constants.native.js +1 -0
- package/dist/constants.native.js.map +1 -1
- package/dist/data/AppContext.mjs +43 -43
- package/dist/data/AppContext.mjs.map +1 -1
- package/dist/data/AppContext.native.js +44 -44
- package/dist/data/AppContext.native.js.map +1 -1
- package/dist/hooks/useFetchComponent.mjs +64 -76
- package/dist/hooks/useFetchComponent.mjs.map +1 -1
- package/dist/hooks/useFetchComponent.native.js +88 -102
- package/dist/hooks/useFetchComponent.native.js.map +1 -1
- package/dist/hooks/useInstallComponent.mjs +130 -138
- package/dist/hooks/useInstallComponent.mjs.map +1 -1
- package/dist/hooks/useInstallComponent.native.js +186 -198
- package/dist/hooks/useInstallComponent.native.js.map +1 -1
- package/dist/install-direct.mjs +110 -120
- package/dist/install-direct.mjs.map +1 -1
- package/dist/install-direct.native.js +179 -195
- package/dist/install-direct.native.js.map +1 -1
- package/dist/screens/CodeAuthScreen.mjs +114 -106
- package/dist/screens/CodeAuthScreen.mjs.map +1 -1
- package/dist/screens/CodeAuthScreen.native.js +116 -108
- package/dist/screens/CodeAuthScreen.native.js.map +1 -1
- package/dist/screens/InstallConfirmScreen.mjs +91 -83
- package/dist/screens/InstallConfirmScreen.mjs.map +1 -1
- package/dist/screens/InstallConfirmScreen.native.js +99 -91
- package/dist/screens/InstallConfirmScreen.native.js.map +1 -1
- package/dist/screens/SearchScreen.mjs +9 -5
- package/dist/screens/SearchScreen.mjs.map +1 -1
- package/dist/screens/SearchScreen.native.js +11 -7
- package/dist/screens/SearchScreen.native.js.map +1 -1
- package/package.json +6 -21
|
@@ -1,116 +1,111 @@
|
|
|
1
1
|
import open from "open";
|
|
2
|
-
import { debugLog } from "../commands/index.js";
|
|
2
|
+
import { debugLog } from "../commands/index.native.js";
|
|
3
|
+
|
|
3
4
|
var apiBase = process.env.API_BASE || "https://tamagui.dev";
|
|
4
5
|
var ACCESS_TOKEN_URL = `${apiBase}/account`;
|
|
5
|
-
var handleGlobalKeyPress = function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
debugLog("Installing component", (_searchResults_selectedResultIndex1 = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex1 === void 0 ? void 0 : _searchResults_selectedResultIndex1.item);
|
|
110
|
-
navigate(`/install-confirm/${fileName}`);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
6
|
+
var handleGlobalKeyPress = function(key, modifier, appContext, navigate, location) {
|
|
7
|
+
var _appContext_installState_installingComponent, _appContext_installState_installingComponent1;
|
|
8
|
+
var { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;
|
|
9
|
+
debugLog({
|
|
10
|
+
modifier,
|
|
11
|
+
key
|
|
12
|
+
});
|
|
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
|
+
if (key === "c" && appContext.installState.shouldOpenBrowser) {
|
|
21
|
+
setCopyingToClipboard(true);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (location.pathname.includes("/install-confirm")) {
|
|
25
|
+
if (key === "y") {
|
|
26
|
+
setConfirmationPending(false);
|
|
27
|
+
navigate("/search");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (key === "n") {
|
|
31
|
+
setConfirmationPending(true);
|
|
32
|
+
navigate("/search");
|
|
33
|
+
setSelectedResultIndex(-1);
|
|
34
|
+
setInstallState(function(prev) {
|
|
35
|
+
return {
|
|
36
|
+
...prev,
|
|
37
|
+
componentToInstall: null,
|
|
38
|
+
installingComponent: null
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
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
|
+
if (modifier.escape) {
|
|
69
|
+
if (location.pathname.includes("/install-confirm")) {
|
|
70
|
+
navigate("/search");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
appContext.exitApp();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
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
|
+
if (modifier.upArrow) {
|
|
81
|
+
selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (modifier.downArrow) {
|
|
85
|
+
selectedResultIndex < appContext.searchResults.length - 1 && setSelectedResultIndex(selectedResultIndex + 1);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (modifier.return) {
|
|
89
|
+
if (location.pathname.includes("/search")) {
|
|
90
|
+
var _searchResults_selectedResultIndex, _searchResults_selectedResultIndex1;
|
|
91
|
+
setInstallState(function(prev) {
|
|
92
|
+
var _searchResults_selectedResultIndex2;
|
|
93
|
+
return {
|
|
94
|
+
...prev,
|
|
95
|
+
installingComponent: (_searchResults_selectedResultIndex2 = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex2 === void 0 ? void 0 : _searchResults_selectedResultIndex2.item
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
var fileName = searchResults === null || searchResults === void 0 ? void 0 : (_searchResults_selectedResultIndex = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex === void 0 ? void 0 : _searchResults_selectedResultIndex.item.fileName;
|
|
99
|
+
if (!fileName) {
|
|
100
|
+
console.error("No component found");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
debugLog("Installing component", (_searchResults_selectedResultIndex1 = searchResults[selectedResultIndex]) === null || _searchResults_selectedResultIndex1 === void 0 ? void 0 : _searchResults_selectedResultIndex1.item);
|
|
104
|
+
navigate(`/install-confirm/${fileName}`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
114
108
|
};
|
|
109
|
+
|
|
115
110
|
export { handleGlobalKeyPress };
|
|
116
111
|
//# sourceMappingURL=handle-global-keypress.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"handle-global-keypress.native.js","names":[],"sources":["app/handle-global-keypress.native.js"],"sourcesContent":["import open from \"open\";\nimport { debugLog } from \"../commands/index.js\";\nvar apiBase = process.env.API_BASE || \"https://tamagui.dev\";\nvar ACCESS_TOKEN_URL = `${apiBase}/account`;\nvar handleGlobalKeyPress = function(key, modifier, appContext, navigate, location) {\n var _appContext_installState_installingComponent, _appContext_installState_installingComponent1;\n var { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;\n debugLog({\n modifier,\n key\n });\n if (modifier.ctrl && key === \"d\") {\n appContext.tokenStore.clear();\n appContext.setAccessToken(null);\n appContext.setIsLoggedIn(false);\n console.warn(\"Cleared Auth Token\");\n return navigate(\"/\");\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 && location.pathname.includes(\"/auth\")) {\n return navigate(\"/search\");\n }\n if (modifier.escape && appContext.installState.isTokenInstalled) {\n appContext.setInstallState(function(prev) {\n return {\n ...prev,\n installingComponent: null,\n isTokenInstalled: false\n };\n });\n return navigate(\"/search\");\n }\n 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)) {\n appContext.setInstallState(function(prev) {\n return {\n ...prev,\n installingComponent: null,\n shouldOpenBrowser: false\n };\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.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\")) {\n return open(ACCESS_TOKEN_URL);\n }\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":"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"}
|
|
@@ -3,45 +3,47 @@ import { Box, Text } from "ink";
|
|
|
3
3
|
import TextInput from "ink-text-input";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { useLocation } from "react-router-dom";
|
|
6
|
-
import { ResultsCounter } from "../cli-components/index.
|
|
7
|
-
import { componentsList } from "../components.
|
|
8
|
-
import { AppContext } from "../data/AppContext.
|
|
6
|
+
import { ResultsCounter } from "../cli-components/index.mjs";
|
|
7
|
+
import { componentsList } from "../components.mjs";
|
|
8
|
+
import { AppContext } from "../data/AppContext.mjs";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
10
11
|
const SearchBar = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
12
|
+
const location = useLocation();
|
|
13
|
+
const appContext = React.useContext(AppContext);
|
|
14
|
+
const performSearch = (query) => {
|
|
15
|
+
const fuse = new Fuse(componentsList, { keys: [
|
|
16
|
+
"name",
|
|
17
|
+
"category",
|
|
18
|
+
"categorySection"
|
|
19
|
+
] });
|
|
20
|
+
return fuse.search(query);
|
|
21
|
+
};
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
appContext.setSearchInput("");
|
|
24
|
+
}, [location.pathname]);
|
|
25
|
+
const handleInputChange = (value) => {
|
|
26
|
+
if (location.pathname !== "/search") return;
|
|
27
|
+
if (appContext.installState.installingComponent?.isOSS) return;
|
|
28
|
+
appContext.setSearchInput(value);
|
|
29
|
+
const results = performSearch(value);
|
|
30
|
+
appContext.setSearchResults(results);
|
|
31
|
+
appContext.setSelectedResultIndex(-1);
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
34
|
+
marginX: 1,
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
children: [/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
37
|
+
bold: true,
|
|
38
|
+
children: "Search: "
|
|
39
|
+
}), /* @__PURE__ */ jsx(TextInput, {
|
|
40
|
+
focus: true,
|
|
41
|
+
value: appContext.searchInput,
|
|
42
|
+
onChange: handleInputChange,
|
|
43
|
+
marginRight: "auto"
|
|
44
|
+
})] }), /* @__PURE__ */ jsx(ResultsCounter, {})]
|
|
45
|
+
});
|
|
45
46
|
};
|
|
47
|
+
|
|
46
48
|
export { SearchBar };
|
|
47
49
|
//# sourceMappingURL=SearchBar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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?.isOSS) 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,OAAO;EACxD,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"}
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Fuse from "fuse.js";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
4
|
import TextInput from "ink-text-input";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { useLocation } from "react-router-dom";
|
|
7
|
-
import { ResultsCounter } from "../cli-components/index.js";
|
|
8
|
-
import { componentsList } from "../components.js";
|
|
9
|
-
import { AppContext } from "../data/AppContext.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
7
|
+
import { ResultsCounter } from "../cli-components/index.native.js";
|
|
8
|
+
import { componentsList } from "../components.native.js";
|
|
9
|
+
import { AppContext } from "../data/AppContext.native.js";
|
|
10
|
+
|
|
11
|
+
var SearchBar = function() {
|
|
12
|
+
var location = useLocation();
|
|
13
|
+
var appContext = React.useContext(AppContext);
|
|
14
|
+
var performSearch = function(query) {
|
|
15
|
+
var fuse = new Fuse(componentsList, { keys: [
|
|
16
|
+
"name",
|
|
17
|
+
"category",
|
|
18
|
+
"categorySection"
|
|
19
|
+
] });
|
|
20
|
+
return fuse.search(query);
|
|
21
|
+
};
|
|
22
|
+
React.useEffect(function() {
|
|
23
|
+
appContext.setSearchInput("");
|
|
24
|
+
}, [location.pathname]);
|
|
25
|
+
var handleInputChange = function(value) {
|
|
26
|
+
var _appContext_installState_installingComponent;
|
|
27
|
+
if (location.pathname !== "/search") return;
|
|
28
|
+
if ((_appContext_installState_installingComponent = appContext.installState.installingComponent) === null || _appContext_installState_installingComponent === void 0 ? void 0 : _appContext_installState_installingComponent.isOSS) return;
|
|
29
|
+
appContext.setSearchInput(value);
|
|
30
|
+
var results = performSearch(value);
|
|
31
|
+
appContext.setSearchResults(results);
|
|
32
|
+
appContext.setSelectedResultIndex(-1);
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
35
|
+
marginX: 1,
|
|
36
|
+
justifyContent: "space-between",
|
|
37
|
+
children: [/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
|
|
38
|
+
bold: true,
|
|
39
|
+
children: "Search: "
|
|
40
|
+
}), /* @__PURE__ */ jsx(TextInput, {
|
|
41
|
+
focus: true,
|
|
42
|
+
value: appContext.searchInput,
|
|
43
|
+
onChange: handleInputChange,
|
|
44
|
+
marginRight: "auto"
|
|
45
|
+
})] }), /* @__PURE__ */ jsx(ResultsCounter, {})]
|
|
46
|
+
});
|
|
47
47
|
};
|
|
48
|
+
|
|
48
49
|
export { SearchBar };
|
|
49
50
|
//# sourceMappingURL=SearchBar.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 var _appContext_installState_installingComponent;\n if (location.pathname !== \"/search\") return;\n if ((_appContext_installState_installingComponent = appContext.installState.installingComponent) === null || _appContext_installState_installingComponent === void 0 ? void 0 : _appContext_installState_installingComponent.isOSS) 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;EACJ,IAAI,SAAS,aAAa,WAAW;EACrC,KAAK,+CAA+C,WAAW,aAAa,yBAAyB,QAAQ,iDAAiD,KAAK,IAAI,KAAK,IAAI,6CAA6C,OAAO;EACpO,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"}
|