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.
Files changed (65) hide show
  1. package/dist/app/AuthGuard.mjs +35 -45
  2. package/dist/app/AuthGuard.mjs.map +1 -1
  3. package/dist/app/AuthGuard.native.js +37 -47
  4. package/dist/app/AuthGuard.native.js.map +1 -1
  5. package/dist/app/handle-global-keypress.mjs +93 -98
  6. package/dist/app/handle-global-keypress.mjs.map +1 -1
  7. package/dist/app/handle-global-keypress.native.js +105 -110
  8. package/dist/app/handle-global-keypress.native.js.map +1 -1
  9. package/dist/cli-components/SearchBar.mjs +39 -37
  10. package/dist/cli-components/SearchBar.mjs.map +1 -1
  11. package/dist/cli-components/SearchBar.native.js +42 -41
  12. package/dist/cli-components/SearchBar.native.js.map +1 -1
  13. package/dist/cli-components/index.mjs +137 -135
  14. package/dist/cli-components/index.mjs.map +1 -1
  15. package/dist/cli-components/index.native.js +155 -153
  16. package/dist/cli-components/index.native.js.map +1 -1
  17. package/dist/cli.mjs +4 -2
  18. package/dist/cli.mjs.map +1 -1
  19. package/dist/cli.native.js +4 -2
  20. package/dist/cli.native.js.map +1 -1
  21. package/dist/commands/add.mjs +9 -6
  22. package/dist/commands/add.mjs.map +1 -1
  23. package/dist/commands/add.native.js +10 -7
  24. package/dist/commands/add.native.js.map +1 -1
  25. package/dist/commands/index.mjs +133 -135
  26. package/dist/commands/index.mjs.map +1 -1
  27. package/dist/commands/index.native.js +145 -147
  28. package/dist/commands/index.native.js.map +1 -1
  29. package/dist/components.mjs +1470 -1228
  30. package/dist/components.mjs.map +1 -1
  31. package/dist/components.native.js +1470 -1228
  32. package/dist/components.native.js.map +1 -1
  33. package/dist/constants.mjs +1 -0
  34. package/dist/constants.mjs.map +1 -1
  35. package/dist/constants.native.js +1 -0
  36. package/dist/constants.native.js.map +1 -1
  37. package/dist/data/AppContext.mjs +43 -43
  38. package/dist/data/AppContext.mjs.map +1 -1
  39. package/dist/data/AppContext.native.js +44 -44
  40. package/dist/data/AppContext.native.js.map +1 -1
  41. package/dist/hooks/useFetchComponent.mjs +64 -76
  42. package/dist/hooks/useFetchComponent.mjs.map +1 -1
  43. package/dist/hooks/useFetchComponent.native.js +88 -102
  44. package/dist/hooks/useFetchComponent.native.js.map +1 -1
  45. package/dist/hooks/useInstallComponent.mjs +130 -138
  46. package/dist/hooks/useInstallComponent.mjs.map +1 -1
  47. package/dist/hooks/useInstallComponent.native.js +186 -198
  48. package/dist/hooks/useInstallComponent.native.js.map +1 -1
  49. package/dist/install-direct.mjs +110 -120
  50. package/dist/install-direct.mjs.map +1 -1
  51. package/dist/install-direct.native.js +179 -195
  52. package/dist/install-direct.native.js.map +1 -1
  53. package/dist/screens/CodeAuthScreen.mjs +114 -106
  54. package/dist/screens/CodeAuthScreen.mjs.map +1 -1
  55. package/dist/screens/CodeAuthScreen.native.js +116 -108
  56. package/dist/screens/CodeAuthScreen.native.js.map +1 -1
  57. package/dist/screens/InstallConfirmScreen.mjs +91 -83
  58. package/dist/screens/InstallConfirmScreen.mjs.map +1 -1
  59. package/dist/screens/InstallConfirmScreen.native.js +99 -91
  60. package/dist/screens/InstallConfirmScreen.native.js.map +1 -1
  61. package/dist/screens/SearchScreen.mjs +9 -5
  62. package/dist/screens/SearchScreen.mjs.map +1 -1
  63. package/dist/screens/SearchScreen.native.js +11 -7
  64. package/dist/screens/SearchScreen.native.js.map +1 -1
  65. package/package.json +6 -21
@@ -1,52 +1,42 @@
1
1
  import { Alert } from "@inkjs/ui";
2
2
  import { Box } from "ink";
3
3
  import React from "react";
4
- import { debugLog, redact } from "../commands/index.js";
5
- import { AppContext } from "../data/AppContext.js";
6
- import { useInstallComponent } from "../hooks/useInstallComponent.js";
4
+ import { debugLog, redact } from "../commands/index.mjs";
5
+ import { AppContext } from "../data/AppContext.mjs";
6
+ import { useInstallComponent } from "../hooks/useInstallComponent.mjs";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- const AuthGuard = ({
9
- children
10
- }) => {
11
- const {
12
- error
13
- } = useInstallComponent();
14
- const {
15
- tokenStore,
16
- setAccessToken,
17
- setIsLoggedIn
18
- } = React.useContext(AppContext);
19
- React.useEffect(() => {
20
- const token = tokenStore.get("accessToken");
21
- if (token) {
22
- setAccessToken(token);
23
- setIsLoggedIn(true);
24
- debugLog("Token found, setting isLoggedIn to true");
25
- debugLog({
26
- token: redact(token)
27
- });
28
- } else {
29
- setIsLoggedIn(false);
30
- }
31
- }, []);
32
- React.useEffect(() => {
33
- debugLog({
34
- errorStatus: error?.status,
35
- useInstallComponentError: error
36
- });
37
- }, [error]);
38
- if (error && error.status !== 401) {
39
- return /* @__PURE__ */jsxs(Box, {
40
- flexDirection: "column",
41
- children: [/* @__PURE__ */jsxs(Alert, {
42
- variant: "error",
43
- children: ["Error installing component: ", JSON.stringify(error, null, 2)]
44
- }), children]
45
- });
46
- }
47
- return /* @__PURE__ */jsx(Fragment, {
48
- children
49
- });
8
+
9
+ const AuthGuard = ({ children }) => {
10
+ const { error } = useInstallComponent();
11
+ const { tokenStore, setAccessToken, setIsLoggedIn } = React.useContext(AppContext);
12
+ React.useEffect(() => {
13
+ const token = tokenStore.get("accessToken");
14
+ if (token) {
15
+ setAccessToken(token);
16
+ setIsLoggedIn(true);
17
+ debugLog("Token found, setting isLoggedIn to true");
18
+ debugLog({ token: redact(token) });
19
+ } else {
20
+ setIsLoggedIn(false);
21
+ }
22
+ }, []);
23
+ React.useEffect(() => {
24
+ debugLog({
25
+ errorStatus: error?.status,
26
+ useInstallComponentError: error
27
+ });
28
+ }, [error]);
29
+ if (error && error.status !== 401) {
30
+ return /* @__PURE__ */ jsxs(Box, {
31
+ flexDirection: "column",
32
+ children: [/* @__PURE__ */ jsxs(Alert, {
33
+ variant: "error",
34
+ children: ["Error installing component: ", JSON.stringify(error, null, 2)]
35
+ }), children]
36
+ });
37
+ }
38
+ return /* @__PURE__ */ jsx(Fragment, { children });
50
39
  };
40
+
51
41
  export { AuthGuard };
52
42
  //# sourceMappingURL=AuthGuard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["Alert","Box","React","debugLog","redact","AppContext","useInstallComponent","Fragment","jsx","jsxs","AuthGuard","children","error","tokenStore","setAccessToken","setIsLoggedIn","useContext","useEffect","token","get","errorStatus","status","useInstallComponentError","flexDirection","variant","JSON","stringify"],"sources":["../../src/app/AuthGuard.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,KAAA,QAAa;AACtB,SAASC,GAAA,QAAW;AACpB,OAAOC,KAAA,MAAW;AAClB,SAASC,QAAA,EAAUC,MAAA,QAAc;AACjC,SAASC,UAAA,QAAkB;AAC3B,SAASC,mBAAA,QAA2B;AA6B5B,SAQCC,QAAA,EAAAC,GAAA,EARDC,IAAA;AA3BD,MAAMC,SAAA,GAAYA,CAAC;EAAEC;AAAS,MAAqC;EACxE,MAAM;IAAEC;EAAM,IAAIN,mBAAA,CAAoB;EACtC,MAAM;IAAEO,UAAA;IAAYC,cAAA;IAAgBC;EAAc,IAAIb,KAAA,CAAMc,UAAA,CAAWX,UAAU;EAEjFH,KAAA,CAAMe,SAAA,CAAU,MAAM;IAEpB,MAAMC,KAAA,GAAQL,UAAA,CAAWM,GAAA,CAAI,aAAa;IAC1C,IAAID,KAAA,EAAO;MACTJ,cAAA,CAAeI,KAAK;MACpBH,aAAA,CAAc,IAAI;MAClBZ,QAAA,CAAS,yCAAyC;MAClDA,QAAA,CAAS;QAAEe,KAAA,EAAOd,MAAA,CAAOc,KAAK;MAAE,CAAC;IACnC,OAAO;MACLH,aAAA,CAAc,KAAK;IACrB;EACF,GAAG,EAAE;EAELb,KAAA,CAAMe,SAAA,CAAU,MAAM;IACpBd,QAAA,CAAS;MACPiB,WAAA,EAAaR,KAAA,EAAOS,MAAA;MACpBC,wBAAA,EAA0BV;IAC5B,CAAC;EACH,GAAG,CAACA,KAAK,CAAC;EAEV,IAAIA,KAAA,IAASA,KAAA,CAAMS,MAAA,KAAW,KAAK;IACjC,OACE,eAAAZ,IAAA,CAACR,GAAA;MAAIsB,aAAA,EAAc;MACjBZ,QAAA,kBAAAF,IAAA,CAACT,KAAA;QAAMwB,OAAA,EAAQ;QAAQb,QAAA,mCACQc,IAAA,CAAKC,SAAA,CAAUd,KAAA,EAAO,MAAM,CAAC;MAAA,CAC5D,GACCD,QAAA;IAAA,CACH;EAEJ;EAEA,OAAO,eAAAH,GAAA,CAAAD,QAAA;IAAGI;EAAA,CAAS;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"AuthGuard.js","names":[],"sources":["app/AuthGuard.js"],"sourcesContent":["import { Alert } from \"@inkjs/ui\";\nimport { Box } from \"ink\";\nimport React from \"react\";\nimport { debugLog, redact } from \"../commands/index.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { useInstallComponent } from \"../hooks/useInstallComponent.js\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst AuthGuard = ({ children }) => {\n const { error } = useInstallComponent();\n const { tokenStore, setAccessToken, setIsLoggedIn } = React.useContext(AppContext);\n React.useEffect(() => {\n const token = tokenStore.get(\"accessToken\");\n if (token) {\n setAccessToken(token);\n setIsLoggedIn(true);\n debugLog(\"Token found, setting isLoggedIn to true\");\n debugLog({ token: redact(token) });\n } else {\n setIsLoggedIn(false);\n }\n }, []);\n React.useEffect(() => {\n debugLog({\n errorStatus: error?.status,\n useInstallComponentError: error\n });\n }, [error]);\n if (error && error.status !== 401) {\n return /* @__PURE__ */ jsxs(Box, { flexDirection: \"column\", children: [\n /* @__PURE__ */ jsxs(Alert, { variant: \"error\", children: [\n \"Error installing component: \",\n JSON.stringify(error, null, 2)\n ] }),\n children\n ] });\n }\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nexport {\n AuthGuard\n};\n//# sourceMappingURL=AuthGuard.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,aAAa,EAAE,eAAe;CAClC,MAAM,EAAE,UAAU,oBAAoB;CACtC,MAAM,EAAE,YAAY,gBAAgB,kBAAkB,MAAM,WAAW,UAAU;CACjF,MAAM,gBAAgB;EACpB,MAAM,QAAQ,WAAW,IAAI,aAAa;EAC1C,IAAI,OAAO;GACT,eAAe,KAAK;GACpB,cAAc,IAAI;GAClB,SAAS,yCAAyC;GAClD,SAAS,EAAE,OAAO,OAAO,KAAK,EAAE,CAAC;EACnC,OAAO;GACL,cAAc,KAAK;EACrB;CACF,GAAG,CAAC,CAAC;CACL,MAAM,gBAAgB;EACpB,SAAS;GACP,aAAa,OAAO;GACpB,0BAA0B;EAC5B,CAAC;CACH,GAAG,CAAC,KAAK,CAAC;CACV,IAAI,SAAS,MAAM,WAAW,KAAK;EACjC,OAAuB,qBAAK,KAAK;GAAE,eAAe;GAAU,UAAU,CACpD,qBAAK,OAAO;IAAE,SAAS;IAAS,UAAU,CACxD,gCACA,KAAK,UAAU,OAAO,MAAM,CAAC,CAC/B;GAAE,CAAC,GACH,QACF;EAAE,CAAC;CACL;CACA,OAAuB,oBAAI,UAAU,EAAE,SAAS,CAAC;AACnD"}
@@ -1,53 +1,43 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Alert } from "@inkjs/ui";
3
3
  import { Box } from "ink";
4
4
  import React from "react";
5
- import { debugLog, redact } from "../commands/index.js";
6
- import { AppContext } from "../data/AppContext.js";
7
- import { useInstallComponent } from "../hooks/useInstallComponent.js";
8
- var AuthGuard = function (param) {
9
- var {
10
- children
11
- } = param;
12
- var {
13
- error
14
- } = useInstallComponent();
15
- var {
16
- tokenStore,
17
- setAccessToken,
18
- setIsLoggedIn
19
- } = React.useContext(AppContext);
20
- React.useEffect(function () {
21
- var token = tokenStore.get("accessToken");
22
- if (token) {
23
- setAccessToken(token);
24
- setIsLoggedIn(true);
25
- debugLog("Token found, setting isLoggedIn to true");
26
- debugLog({
27
- token: redact(token)
28
- });
29
- } else {
30
- setIsLoggedIn(false);
31
- }
32
- }, []);
33
- React.useEffect(function () {
34
- debugLog({
35
- errorStatus: error === null || error === void 0 ? void 0 : error.status,
36
- useInstallComponentError: error
37
- });
38
- }, [error]);
39
- if (error && error.status !== 401) {
40
- return /* @__PURE__ */_jsxs(Box, {
41
- flexDirection: "column",
42
- children: [/* @__PURE__ */_jsxs(Alert, {
43
- variant: "error",
44
- children: ["Error installing component: ", JSON.stringify(error, null, 2)]
45
- }), children]
46
- });
47
- }
48
- return /* @__PURE__ */_jsx(_Fragment, {
49
- children
50
- });
5
+ import { debugLog, redact } from "../commands/index.native.js";
6
+ import { AppContext } from "../data/AppContext.native.js";
7
+ import { useInstallComponent } from "../hooks/useInstallComponent.native.js";
8
+
9
+ var AuthGuard = function(param) {
10
+ var { children } = param;
11
+ var { error } = useInstallComponent();
12
+ var { tokenStore, setAccessToken, setIsLoggedIn } = React.useContext(AppContext);
13
+ React.useEffect(function() {
14
+ var token = tokenStore.get("accessToken");
15
+ if (token) {
16
+ setAccessToken(token);
17
+ setIsLoggedIn(true);
18
+ debugLog("Token found, setting isLoggedIn to true");
19
+ debugLog({ token: redact(token) });
20
+ } else {
21
+ setIsLoggedIn(false);
22
+ }
23
+ }, []);
24
+ React.useEffect(function() {
25
+ debugLog({
26
+ errorStatus: error === null || error === void 0 ? void 0 : error.status,
27
+ useInstallComponentError: error
28
+ });
29
+ }, [error]);
30
+ if (error && error.status !== 401) {
31
+ return /* @__PURE__ */ jsxs(Box, {
32
+ flexDirection: "column",
33
+ children: [/* @__PURE__ */ jsxs(Alert, {
34
+ variant: "error",
35
+ children: ["Error installing component: ", JSON.stringify(error, null, 2)]
36
+ }), children]
37
+ });
38
+ }
39
+ return /* @__PURE__ */ jsx(Fragment, { children });
51
40
  };
41
+
52
42
  export { AuthGuard };
53
43
  //# sourceMappingURL=AuthGuard.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Alert","Box","React","debugLog","redact","AppContext","useInstallComponent","AuthGuard","param","children","error","tokenStore","setAccessToken","setIsLoggedIn","useContext","useEffect","token","get","errorStatus","status","useInstallComponentError","flexDirection","variant"],"sources":["../../src/app/AuthGuard.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,EAAaC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AACtB,SAASC,KAAA,QAAW;AACpB,SAAOC,GAAA,QAAW;AAClB,OAAAC,KAAS,aAAU;AACnB,SAASC,QAAA,EAAAC,MAAA,QAAkB;AAC3B,SAASC,UAAA,+BAA2B;AA6B5B,SAQCC,mBARD;AA3BD,IAAAC,SAAM,YAAAA,CAAeC,KAAS;EACnC;IAAMC;EAAQ,IAAID,KAAA;EAClB;IAAME;EAAE,IAAAJ,mBAAY,CAAgB;EAEpC;IAAMK,UAAU;IAAAC,cAAM;IAAAC;EAAA,IAAAX,KAAA,CAAAY,UAAA,CAAAT,UAAA;EAEpBH,KAAA,CAAAa,SAAM,CAAQ,YAAW;IACzB,IAAIC,KAAA,GAAOL,UAAA,CAAAM,GAAA;IACT,IAAAD,KAAA;MACAJ,cAAc,CAAAI,KAAI;MAClBH,aAAS;MACTV,QAAA,CAAS,yCAAwB;MACnCA,QAAO;QACLa,KAAA,EAAAZ,MAAc,CAAAY,KAAK;MACrB;IACF,CAAG,MAAE;MAELH,aAAgB,MAAM;IACpB;EAAS,KACP;EAAoBX,KACpB,CAAAa,SAAA;IACFZ,QAAC;MACCe,WAAM,EAAAR,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAAS,MAAA;MAENC,wBAAe,EAAWV;IAC5B;EAEI,IAAuBA,KAAA;EACqC,IAAAA,KAC5D,IAAAA,KAAA,CAAAS,MAAA;IAAA,OACC,eAAAtB,KAAA,CAAAI,GAAA;MAAAoB,aACH;MAEJZ,QAAA,GAEA,eAAOZ,KAAA,CAAAG,KAAA;QACTsB,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"AuthGuard.native.js","names":["_Fragment"],"sources":["app/AuthGuard.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Alert } from \"@inkjs/ui\";\nimport { Box } from \"ink\";\nimport React from \"react\";\nimport { debugLog, redact } from \"../commands/index.js\";\nimport { AppContext } from \"../data/AppContext.js\";\nimport { useInstallComponent } from \"../hooks/useInstallComponent.js\";\nvar AuthGuard = function(param) {\n var { children } = param;\n var { error } = useInstallComponent();\n var { tokenStore, setAccessToken, setIsLoggedIn } = React.useContext(AppContext);\n React.useEffect(function() {\n var token = tokenStore.get(\"accessToken\");\n if (token) {\n setAccessToken(token);\n setIsLoggedIn(true);\n debugLog(\"Token found, setting isLoggedIn to true\");\n debugLog({\n token: redact(token)\n });\n } else {\n setIsLoggedIn(false);\n }\n }, []);\n React.useEffect(function() {\n debugLog({\n errorStatus: error === null || error === void 0 ? void 0 : error.status,\n useInstallComponentError: error\n });\n }, [\n error\n ]);\n if (error && error.status !== 401) {\n return /* @__PURE__ */ _jsxs(Box, {\n flexDirection: \"column\",\n children: [\n /* @__PURE__ */ _jsxs(Alert, {\n variant: \"error\",\n children: [\n \"Error installing component: \",\n JSON.stringify(error, null, 2)\n ]\n }),\n children\n ]\n });\n }\n return /* @__PURE__ */ _jsx(_Fragment, {\n children\n });\n};\nexport {\n AuthGuard\n};\n//# sourceMappingURL=AuthGuard.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,YAAY,SAAS,OAAO;CAC9B,IAAI,EAAE,aAAa;CACnB,IAAI,EAAE,UAAU,oBAAoB;CACpC,IAAI,EAAE,YAAY,gBAAgB,kBAAkB,MAAM,WAAW,UAAU;CAC/E,MAAM,UAAU,WAAW;EACzB,IAAI,QAAQ,WAAW,IAAI,aAAa;EACxC,IAAI,OAAO;GACT,eAAe,KAAK;GACpB,cAAc,IAAI;GAClB,SAAS,yCAAyC;GAClD,SAAS,EACP,OAAO,OAAO,KAAK,EACrB,CAAC;EACH,OAAO;GACL,cAAc,KAAK;EACrB;CACF,GAAG,CAAC,CAAC;CACL,MAAM,UAAU,WAAW;EACzB,SAAS;GACP,aAAa,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;GACjE,0BAA0B;EAC5B,CAAC;CACH,GAAG,CACD,KACF,CAAC;CACD,IAAI,SAAS,MAAM,WAAW,KAAK;EACjC,OAAuB,qBAAM,KAAK;GAChC,eAAe;GACf,UAAU,CACQ,qBAAM,OAAO;IAC3B,SAAS;IACT,UAAU,CACR,gCACA,KAAK,UAAU,OAAO,MAAM,CAAC,CAC/B;GACF,CAAC,GACD,QACF;EACF,CAAC;CACH;CACA,OAAuB,oBAAKA,UAAW,EACrC,SACF,CAAC;AACH"}
@@ -1,105 +1,100 @@
1
1
  import open from "open";
2
- import { debugLog } from "../commands/index.js";
2
+ import { debugLog } from "../commands/index.mjs";
3
+
3
4
  const apiBase = process.env.API_BASE || "https://tamagui.dev";
4
5
  const ACCESS_TOKEN_URL = `${apiBase}/account`;
5
6
  const handleGlobalKeyPress = (key, modifier, appContext, navigate, location) => {
6
- const {
7
- selectedResultIndex,
8
- setSelectedResultIndex,
9
- setInstallState,
10
- searchResults,
11
- setCopyingToClipboard,
12
- setConfirmationPending
13
- } = appContext;
14
- debugLog({
15
- modifier,
16
- key
17
- });
18
- if (modifier.ctrl && key === "d") {
19
- appContext.tokenStore.clear();
20
- appContext.setAccessToken(null);
21
- appContext.setIsLoggedIn(false);
22
- console.warn("Cleared Auth Token");
23
- return navigate("/");
24
- }
25
- if (key === "c" && appContext.installState.shouldOpenBrowser) {
26
- setCopyingToClipboard(true);
27
- return;
28
- }
29
- if (location.pathname.includes("/install-confirm")) {
30
- if (key === "y") {
31
- setConfirmationPending(false);
32
- navigate("/search");
33
- return;
34
- }
35
- if (key === "n") {
36
- setConfirmationPending(true);
37
- navigate("/search");
38
- setSelectedResultIndex(-1);
39
- setInstallState(prev => ({
40
- ...prev,
41
- componentToInstall: null,
42
- installingComponent: null
43
- }));
44
- return;
45
- }
46
- return;
47
- }
48
- if (modifier.escape && location.pathname.includes("/auth")) {
49
- return navigate("/search");
50
- }
51
- if (modifier.escape && appContext.installState.isTokenInstalled) {
52
- appContext.setInstallState(prev => ({
53
- ...prev,
54
- installingComponent: null,
55
- isTokenInstalled: false
56
- }));
57
- return navigate("/search");
58
- }
59
- if (modifier.escape && appContext.installState.installingComponent !== null && !appContext.installState.installingComponent?.isOSS) {
60
- appContext.setInstallState(prev => ({
61
- ...prev,
62
- installingComponent: null,
63
- shouldOpenBrowser: false
64
- }));
65
- return;
66
- }
67
- if (modifier.escape) {
68
- if (location.pathname.includes("/install-confirm")) {
69
- navigate("/search");
70
- return;
71
- }
72
- appContext.exitApp();
73
- return;
74
- }
75
- if (appContext.installState.installingComponent && (modifier.upArrow || modifier.downArrow)) return;
76
- if (modifier.ctrl && modifier.return && !appContext.installState.installingComponent?.isOSS && appContext.installState.shouldOpenBrowser && location.pathname.includes("/auth")) {
77
- return open(ACCESS_TOKEN_URL);
78
- }
79
- if (modifier.upArrow) {
80
- selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);
81
- return;
82
- }
83
- if (modifier.downArrow) {
84
- selectedResultIndex < appContext.searchResults.length - 1 && setSelectedResultIndex(selectedResultIndex + 1);
85
- return;
86
- }
87
- if (modifier.return) {
88
- if (location.pathname.includes("/search")) {
89
- setInstallState(prev => ({
90
- ...prev,
91
- installingComponent: searchResults[selectedResultIndex]?.item
92
- }));
93
- const fileName = searchResults?.[selectedResultIndex]?.item.fileName;
94
- if (!fileName) {
95
- console.error("No component found");
96
- return;
97
- }
98
- debugLog("Installing component", searchResults[selectedResultIndex]?.item);
99
- navigate(`/install-confirm/${fileName}`);
100
- return;
101
- }
102
- }
7
+ const { selectedResultIndex, setSelectedResultIndex, setInstallState, searchResults, setCopyingToClipboard, setConfirmationPending } = appContext;
8
+ debugLog({
9
+ modifier,
10
+ key
11
+ });
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
+ if (key === "c" && appContext.installState.shouldOpenBrowser) {
20
+ setCopyingToClipboard(true);
21
+ return;
22
+ }
23
+ if (location.pathname.includes("/install-confirm")) {
24
+ if (key === "y") {
25
+ setConfirmationPending(false);
26
+ navigate("/search");
27
+ return;
28
+ }
29
+ if (key === "n") {
30
+ setConfirmationPending(true);
31
+ navigate("/search");
32
+ setSelectedResultIndex(-1);
33
+ setInstallState((prev) => ({
34
+ ...prev,
35
+ componentToInstall: null,
36
+ installingComponent: null
37
+ }));
38
+ return;
39
+ }
40
+ return;
41
+ }
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
+ if (modifier.escape) {
62
+ if (location.pathname.includes("/install-confirm")) {
63
+ navigate("/search");
64
+ return;
65
+ }
66
+ appContext.exitApp();
67
+ return;
68
+ }
69
+ 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
+ if (modifier.upArrow) {
74
+ selectedResultIndex > -1 && setSelectedResultIndex(selectedResultIndex - 1);
75
+ return;
76
+ }
77
+ if (modifier.downArrow) {
78
+ selectedResultIndex < appContext.searchResults.length - 1 && setSelectedResultIndex(selectedResultIndex + 1);
79
+ return;
80
+ }
81
+ if (modifier.return) {
82
+ if (location.pathname.includes("/search")) {
83
+ setInstallState((prev) => ({
84
+ ...prev,
85
+ installingComponent: searchResults[selectedResultIndex]?.item
86
+ }));
87
+ const fileName = searchResults?.[selectedResultIndex]?.item.fileName;
88
+ if (!fileName) {
89
+ console.error("No component found");
90
+ return;
91
+ }
92
+ debugLog("Installing component", searchResults[selectedResultIndex]?.item);
93
+ navigate(`/install-confirm/${fileName}`);
94
+ return;
95
+ }
96
+ }
103
97
  };
98
+
104
99
  export { handleGlobalKeyPress };
105
100
  //# sourceMappingURL=handle-global-keypress.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["open","debugLog","apiBase","process","env","API_BASE","ACCESS_TOKEN_URL","handleGlobalKeyPress","key","modifier","appContext","navigate","location","selectedResultIndex","setSelectedResultIndex","setInstallState","searchResults","setCopyingToClipboard","setConfirmationPending","ctrl","tokenStore","clear","setAccessToken","setIsLoggedIn","console","warn","installState","shouldOpenBrowser","pathname","includes","prev","componentToInstall","installingComponent","escape","isTokenInstalled","isOSS","exitApp","upArrow","downArrow","return","length","item","fileName","error"],"sources":["../../src/app/handle-global-keypress.ts"],"sourcesContent":[null],"mappings":"AACA,OAAOA,IAAA,MAAU;AACjB,SAASC,QAAA,QAAgB;AAIzB,MAAMC,OAAA,GAAUC,OAAA,CAAQC,GAAA,CAAIC,QAAA,IAAY;AACxC,MAAMC,gBAAA,GAAmB,GAAGJ,OAAO;AAE5B,MAAMK,oBAAA,GAAuBA,CAClCC,GAAA,EACAC,QAAA,EACAC,UAAA,EACAC,QAAA,EACAC,QAAA,KACG;EACH,MAAM;IACJC,mBAAA;IACAC,sBAAA;IACAC,eAAA;IACAC,aAAA;IACAC,qBAAA;IACAC;EACF,IAAIR,UAAA;EAEJT,QAAA,CAAS;IACPQ,QAAA;IACAD;EACF,CAAC;EAED,IAAIC,QAAA,CAASU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AG4B;MAC3D,EAAE;MAEF,MAAMC,QAAA,GAAW1B,aAAA,GAAgBH,mBAAmB,GAAG4B,IAAA,CAAKC,QAAA;MAE5D,IAAI,CAACA,QAAA,EAAU;QACblB,OAAA,CAAQmB,KAAA,CAAM,oBAAoB;QAClC;MACF;MAEA1C,QAAA,CAAS,wBAAwBe,aAAA,CAAcH,mBAAmB,GAAG4B,IAAI;MACzE9B,QAAA,CAAS,oBAAoB+B,QAAQ,EAAE;MACvC;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"handle-global-keypress.js","names":[],"sources":["app/handle-global-keypress.js"],"sourcesContent":["import open from \"open\";\nimport { debugLog } from \"../commands/index.js\";\nconst apiBase = process.env.API_BASE || \"https://tamagui.dev\";\nconst ACCESS_TOKEN_URL = `${apiBase}/account`;\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 (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((prev) => ({\n ...prev,\n componentToInstall: null,\n installingComponent: null\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((prev) => ({\n ...prev,\n installingComponent: null,\n isTokenInstalled: false\n }));\n return navigate(\"/search\");\n }\n if (modifier.escape && appContext.installState.installingComponent !== null && !appContext.installState.installingComponent?.isOSS) {\n appContext.setInstallState((prev) => ({\n ...prev,\n installingComponent: null,\n shouldOpenBrowser: false\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.ctrl && modifier.return && !appContext.installState.installingComponent?.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 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":";;;;AAEA,MAAM,UAAU,QAAQ,IAAI,YAAY;AACxC,MAAM,mBAAmB,GAAG,QAAQ;AACpC,MAAM,wBAAwB,KAAK,UAAU,YAAY,UAAU,aAAa;CAC9E,MAAM,EACJ,qBACA,wBACA,iBACA,eACA,uBACA,2BACE;CACJ,SAAS;EACP;EACA;CACF,CAAC;CACD,IAAI,SAAS,QAAQ,QAAQ,KAAK;EAChC,WAAW,WAAW,MAAM;EAC5B,WAAW,eAAe,IAAI;EAC9B,WAAW,cAAc,KAAK;EAC9B,QAAQ,KAAK,oBAAoB;EACjC,OAAO,SAAS,G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