conzo 0.0.2 → 0.0.4
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/README.md +9 -0
- package/package.json +6 -5
- package/dist/AppLauncher.d.ts +0 -2
- package/dist/AppLauncher.js +0 -5
- package/dist/ApplicationsCacheContext.d.ts +0 -8
- package/dist/ApplicationsCacheContext.js +0 -14
- package/dist/Bookstack.d.ts +0 -1
- package/dist/Bookstack.js +0 -4
- package/dist/ChatGPT.d.ts +0 -2
- package/dist/ChatGPT.js +0 -5
- package/dist/ConfirmStatus.d.ts +0 -4
- package/dist/ConfirmStatus.js +0 -19
- package/dist/GoogleChrome.d.ts +0 -11
- package/dist/GoogleChrome.js +0 -34
- package/dist/ReloadInstalledApplications.d.ts +0 -1
- package/dist/ReloadInstalledApplications.js +0 -12
- package/dist/Script.d.ts +0 -8
- package/dist/Script.js +0 -17
- package/dist/Search.d.ts +0 -8
- package/dist/Search.js +0 -109
- package/dist/SelectBox.d.ts +0 -7
- package/dist/SelectBox.js +0 -41
- package/dist/UI.d.ts +0 -8
- package/dist/UI.js +0 -17
- package/dist/ViewContext.d.ts +0 -13
- package/dist/ViewContext.js +0 -17
- package/dist/WebinarGeek.d.ts +0 -2
- package/dist/WebinarGeek.js +0 -14
- package/dist/Webinars.d.ts +0 -2
- package/dist/Webinars.js +0 -15
- package/dist/Wizard.d.ts +0 -7
- package/dist/Wizard.js +0 -18
- package/dist/YouTube.d.ts +0 -2
- package/dist/YouTube.js +0 -5
- package/dist/app.d.ts +0 -2
- package/dist/app.js +0 -40
- package/dist/apps/ApplicationsCacheContext.d.ts +0 -8
- package/dist/apps/ApplicationsCacheContext.js +0 -14
- package/dist/apps/RefreshApps.d.ts +0 -1
- package/dist/apps/RefreshApps.js +0 -13
- package/dist/apps/ReloadInstalledApplications.d.ts +0 -1
- package/dist/apps/ReloadInstalledApplications.js +0 -12
- package/dist/backup.d.ts +0 -2
- package/dist/backup.js +0 -5
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -57
- package/dist/config/ConfigContext.d.ts +0 -11
- package/dist/config/ConfigContext.js +0 -12
- package/dist/config/ConfigNotFound.d.ts +0 -2
- package/dist/config/ConfigNotFound.js +0 -11
- package/dist/config/parseAndValidate.d.ts +0 -2
- package/dist/config/parseAndValidate.js +0 -18
- package/dist/config/types.d.ts +0 -14
- package/dist/config/types.js +0 -1
- package/dist/config/validator.d.ts +0 -1
- package/dist/config/validator.js +0 -3
- package/dist/debugging/helpers.d.ts +0 -1
- package/dist/debugging/helpers.js +0 -9
- package/dist/debugging/useDebugger.d.ts +0 -5
- package/dist/debugging/useDebugger.js +0 -11
- package/dist/debugging/useExitAppRightAway.d.ts +0 -1
- package/dist/debugging/useExitAppRightAway.js +0 -9
- package/dist/helpers/tryCatch.d.ts +0 -9
- package/dist/helpers/tryCatch.js +0 -11
- package/dist/helpers.d.ts +0 -1
- package/dist/helpers.js +0 -9
- package/dist/items/items.d.ts +0 -2
- package/dist/items/items.js +0 -42
- package/dist/items/my-items.EXAMPLE.d.ts +0 -1
- package/dist/items/my-items.EXAMPLE.js +0 -1
- package/dist/items/my-items.d.ts +0 -6
- package/dist/items/my-items.js +0 -62
- package/dist/items/types.d.ts +0 -14
- package/dist/items/types.js +0 -1
- package/dist/items.d.ts +0 -15
- package/dist/items.js +0 -94
- package/dist/nmbrs.d.ts +0 -1
- package/dist/nmbrs.js +0 -4
- package/dist/passbolt.d.ts +0 -1
- package/dist/passbolt.js +0 -4
- package/dist/private/my-apps.d.ts +0 -1
- package/dist/private/my-apps.js +0 -35
- package/dist/private/my-chrome-profiles.EXAMPLE.d.ts +0 -4
- package/dist/private/my-chrome-profiles.EXAMPLE.js +0 -12
- package/dist/private/my-chrome-profiles.d.ts +0 -4
- package/dist/private/my-chrome-profiles.js +0 -5
- package/dist/private/my-items.EXAMPLE.d.ts +0 -6
- package/dist/private/my-items.EXAMPLE.js +0 -47
- package/dist/private/my-items.d.ts +0 -5
- package/dist/private/my-items.js +0 -68
- package/dist/private/my-secrets.d.ts +0 -5
- package/dist/private/my-secrets.js +0 -6
- package/dist/wireguard-vpn.d.ts +0 -1
- package/dist/wireguard-vpn.js +0 -10
- package/readme.md +0 -18
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Conzo
|
|
2
|
+
|
|
3
|
+
Conzo is a text-based productivity app for macOS that brings the power of automation to your fingertips.
|
|
4
|
+
|
|
5
|
+
Acting as both an app launcher and a versatile scripting tool, Conzo lets you add custom scripts—with or without UI elements—to execute tasks and streamline workflows with a single keystroke.
|
|
6
|
+
|
|
7
|
+
Inspired by tools like ScriptKit and Raycast, Conzo is designed to make any task quickly accessible, enhancing productivity in a way that’s both flexible and fast.
|
|
8
|
+
|
|
9
|
+
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conzo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"bin": "dist/
|
|
5
|
+
"bin": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=16"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsc"
|
|
12
|
-
"dev": "tsc --watch"
|
|
11
|
+
"build": "rm -rf dist && tsc && tsc-alias && cp package.json README.md ./dist"
|
|
13
12
|
},
|
|
14
13
|
"files": [
|
|
15
14
|
"dist"
|
|
@@ -18,7 +17,8 @@
|
|
|
18
17
|
"ink": "^5.0.1",
|
|
19
18
|
"ink-text-input": "^6.0.0",
|
|
20
19
|
"meow": "^13.2.0",
|
|
21
|
-
"react": "^18.3.1"
|
|
20
|
+
"react": "^18.3.1",
|
|
21
|
+
"react-error-boundary": "^4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@sindresorhus/tsconfig": "^6.0.0",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"prettier": "^3.3.3",
|
|
30
30
|
"react-devtools-core": "^4.28.5",
|
|
31
31
|
"ts-node": "^10.9.2",
|
|
32
|
+
"tsc-alias": "^1.8.10",
|
|
32
33
|
"typescript": "^5.6.3"
|
|
33
34
|
}
|
|
34
35
|
}
|
package/dist/AppLauncher.d.ts
DELETED
package/dist/AppLauncher.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type ApplicationsCacheContextType = {
|
|
3
|
-
needsRefresh: boolean;
|
|
4
|
-
setNeedsRefresh: (needsRefresh: boolean) => void;
|
|
5
|
-
};
|
|
6
|
-
declare function ApplicationsCacheProvider({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
7
|
-
declare function useApplicationsCache(): ApplicationsCacheContextType;
|
|
8
|
-
export { ApplicationsCacheProvider, useApplicationsCache };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const ApplicationsCache = React.createContext(null);
|
|
3
|
-
function ApplicationsCacheProvider({ children }) {
|
|
4
|
-
const [needsRefresh, setNeedsRefresh] = React.useState(false);
|
|
5
|
-
const value = { needsRefresh, setNeedsRefresh };
|
|
6
|
-
return (React.createElement(ApplicationsCache.Provider, { value: value }, children));
|
|
7
|
-
}
|
|
8
|
-
function useApplicationsCache() {
|
|
9
|
-
const context = React.useContext(ApplicationsCache);
|
|
10
|
-
if (!context)
|
|
11
|
-
throw new Error('useApplicationsCache must be used within a ApplicationsCacheProvider');
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
export { ApplicationsCacheProvider, useApplicationsCache };
|
package/dist/Bookstack.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const bookstack: () => void;
|
package/dist/Bookstack.js
DELETED
package/dist/ChatGPT.d.ts
DELETED
package/dist/ChatGPT.js
DELETED
package/dist/ConfirmStatus.d.ts
DELETED
package/dist/ConfirmStatus.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import childProcess from 'child_process';
|
|
4
|
-
import { tryCatch } from './helpers/tryCatch.js';
|
|
5
|
-
export const ConfirmStatus = ({ command }) => {
|
|
6
|
-
const [status, setStatus] = useState('Loading...');
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const { error } = tryCatch(() => childProcess.execSync(command).toString());
|
|
9
|
-
if (error) {
|
|
10
|
-
setStatus({ type: 'Failed', error: error.message });
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
setStatus('Done!');
|
|
14
|
-
}
|
|
15
|
-
}, [command]);
|
|
16
|
-
return (React.createElement(Box, null,
|
|
17
|
-
React.createElement(Text, null, typeof status === 'string' ? status : status.type),
|
|
18
|
-
typeof status === 'object' && React.createElement(Text, { color: "red" }, status.error)));
|
|
19
|
-
};
|
package/dist/GoogleChrome.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { googleChromeProfiles as profiles } from './private/my-secrets.js';
|
|
3
|
-
type Account = keyof typeof profiles;
|
|
4
|
-
export declare const openChrome: (account: Account, url?: string) => void;
|
|
5
|
-
export declare const OpenChrome: ({ url }: {
|
|
6
|
-
url?: string;
|
|
7
|
-
}) => React.JSX.Element;
|
|
8
|
-
export declare const GoogleChrome: ({ url }: {
|
|
9
|
-
url?: string;
|
|
10
|
-
}) => React.JSX.Element;
|
|
11
|
-
export {};
|
package/dist/GoogleChrome.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { SelectBox } from './SelectBox.js';
|
|
4
|
-
import childProcess from 'node:child_process';
|
|
5
|
-
import { googleChromeProfiles as profiles } from './private/my-secrets.js';
|
|
6
|
-
import { useView } from './ViewContext.js';
|
|
7
|
-
const accounts = Object.keys(profiles);
|
|
8
|
-
const isAccount = (account) => {
|
|
9
|
-
return account in profiles;
|
|
10
|
-
};
|
|
11
|
-
export const openChrome = (account, url) => {
|
|
12
|
-
childProcess.spawn('open', [
|
|
13
|
-
'-na',
|
|
14
|
-
'Google Chrome',
|
|
15
|
-
'--args',
|
|
16
|
-
'--profile-directory=' + profiles[account],
|
|
17
|
-
...(url ? [url] : []),
|
|
18
|
-
]);
|
|
19
|
-
};
|
|
20
|
-
export const OpenChrome = ({ url }) => {
|
|
21
|
-
const { goToView } = useView();
|
|
22
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
23
|
-
React.createElement(Text, null, "Select your account"),
|
|
24
|
-
React.createElement(SelectBox, { items: accounts, onSelect: (account) => {
|
|
25
|
-
if (!isAccount(account))
|
|
26
|
-
return;
|
|
27
|
-
openChrome(account, url);
|
|
28
|
-
goToView('search');
|
|
29
|
-
} })));
|
|
30
|
-
};
|
|
31
|
-
export const GoogleChrome = ({ url }) => {
|
|
32
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
33
|
-
React.createElement(OpenChrome, { url: url })));
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReloadInstalledApplications: () => null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useApplicationsCache } from './ApplicationsCacheContext.js';
|
|
3
|
-
import { useView } from './ViewContext.js';
|
|
4
|
-
export const ReloadInstalledApplications = () => {
|
|
5
|
-
const { setNeedsRefresh } = useApplicationsCache();
|
|
6
|
-
const { goToView } = useView();
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setNeedsRefresh(true);
|
|
9
|
-
goToView('search');
|
|
10
|
-
}, []);
|
|
11
|
-
return null;
|
|
12
|
-
};
|
package/dist/Script.d.ts
DELETED
package/dist/Script.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
export const Script = ({ item, exit }) => {
|
|
4
|
-
useInput((_, key) => {
|
|
5
|
-
if (key.escape) {
|
|
6
|
-
exit();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
const { component: Component, name } = item;
|
|
10
|
-
return (React.createElement(React.Fragment, null,
|
|
11
|
-
React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "green" },
|
|
12
|
-
React.createElement(Box, { marginBottom: 1 },
|
|
13
|
-
React.createElement(Text, { color: "green" }, name)),
|
|
14
|
-
React.createElement(Component, null)),
|
|
15
|
-
React.createElement(Box, { borderStyle: "round", borderColor: "grey" },
|
|
16
|
-
React.createElement(Text, null, "ESC = back"))));
|
|
17
|
-
};
|
package/dist/Search.d.ts
DELETED
package/dist/Search.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import TextInput from 'ink-text-input';
|
|
3
|
-
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import { getItems } from './items/items.js';
|
|
5
|
-
import { useApplicationsCache } from './apps/ApplicationsCacheContext.js';
|
|
6
|
-
const MAX_VISIBLE_RESULTS = 10;
|
|
7
|
-
const initialState = {
|
|
8
|
-
allItems: [],
|
|
9
|
-
filteredResults: [],
|
|
10
|
-
selectedItem: null,
|
|
11
|
-
visibleStartIndex: 0,
|
|
12
|
-
};
|
|
13
|
-
const resultsReducer = (state, action) => {
|
|
14
|
-
switch (action.type) {
|
|
15
|
-
case 'INIT_ITEMS': {
|
|
16
|
-
const allItems = action.payload;
|
|
17
|
-
return {
|
|
18
|
-
...state,
|
|
19
|
-
allItems,
|
|
20
|
-
filteredResults: allItems,
|
|
21
|
-
selectedItem: allItems[0] ?? null,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
case 'FILTER_RESULTS': {
|
|
25
|
-
const query = action.query.toLowerCase();
|
|
26
|
-
const visibleStartIndex = 0;
|
|
27
|
-
if (query === '') {
|
|
28
|
-
const filteredResults = state.allItems;
|
|
29
|
-
return {
|
|
30
|
-
...state,
|
|
31
|
-
filteredResults,
|
|
32
|
-
visibleStartIndex,
|
|
33
|
-
selectedItem: filteredResults[visibleStartIndex] ?? null,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const filteredResults = state.allItems.filter((result) => result.name.toLowerCase().includes(query.toLowerCase()));
|
|
37
|
-
return {
|
|
38
|
-
...state,
|
|
39
|
-
filteredResults,
|
|
40
|
-
visibleStartIndex,
|
|
41
|
-
selectedItem: filteredResults[visibleStartIndex] ?? null,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
case 'SELECT_RESULT': {
|
|
45
|
-
if (state.filteredResults.length === 0 || state.selectedItem === null) {
|
|
46
|
-
return state;
|
|
47
|
-
}
|
|
48
|
-
const selectedIndex = state.filteredResults
|
|
49
|
-
.map((r) => r.name)
|
|
50
|
-
.indexOf(state.selectedItem.name);
|
|
51
|
-
let newSelectedIndex = action.which === 'previous'
|
|
52
|
-
? (selectedIndex - 1 + state.filteredResults.length) %
|
|
53
|
-
state.filteredResults.length
|
|
54
|
-
: (selectedIndex + 1) % state.filteredResults.length;
|
|
55
|
-
const newSelectedName = state.filteredResults[newSelectedIndex] ?? null;
|
|
56
|
-
const start = Math.max(0, newSelectedIndex - MAX_VISIBLE_RESULTS + 1);
|
|
57
|
-
return {
|
|
58
|
-
...state,
|
|
59
|
-
selectedItem: newSelectedName,
|
|
60
|
-
visibleStartIndex: start,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
default:
|
|
64
|
-
return state;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
export const Search = ({ width, choose }) => {
|
|
68
|
-
const [query, setQuery] = React.useState('');
|
|
69
|
-
const [{ filteredResults, visibleStartIndex, selectedItem }, dispatch] = React.useReducer(resultsReducer, initialState);
|
|
70
|
-
const { needsRefresh, setNeedsRefresh } = useApplicationsCache();
|
|
71
|
-
React.useEffect(() => {
|
|
72
|
-
const fetchItems = async () => {
|
|
73
|
-
const items = await getItems(needsRefresh);
|
|
74
|
-
dispatch({ type: 'INIT_ITEMS', payload: items });
|
|
75
|
-
};
|
|
76
|
-
fetchItems();
|
|
77
|
-
if (needsRefresh)
|
|
78
|
-
setNeedsRefresh(false);
|
|
79
|
-
}, [needsRefresh]);
|
|
80
|
-
useInput((_, key) => {
|
|
81
|
-
if (key.upArrow)
|
|
82
|
-
dispatch({ type: 'SELECT_RESULT', which: 'previous' });
|
|
83
|
-
if (key.downArrow)
|
|
84
|
-
dispatch({ type: 'SELECT_RESULT', which: 'next' });
|
|
85
|
-
});
|
|
86
|
-
const filter = (query) => {
|
|
87
|
-
setQuery(query);
|
|
88
|
-
dispatch({ type: 'FILTER_RESULTS', query });
|
|
89
|
-
};
|
|
90
|
-
return (React.createElement(React.Fragment, null,
|
|
91
|
-
React.createElement(Box, { borderStyle: "round", borderColor: "green" },
|
|
92
|
-
React.createElement(TextInput, { value: query, onChange: filter, showCursor: true, placeholder: "Search...", onSubmit: () => {
|
|
93
|
-
if (selectedItem)
|
|
94
|
-
choose(selectedItem);
|
|
95
|
-
} })),
|
|
96
|
-
React.createElement(Text, null, filteredResults.length === 0 && 'No items...'),
|
|
97
|
-
React.createElement(Box, { borderStyle: filteredResults.length > 0 ? 'round' : undefined, borderColor: filteredResults.length > 0 ? 'grey' : undefined, flexDirection: "column" }, filteredResults
|
|
98
|
-
.slice(visibleStartIndex, visibleStartIndex + MAX_VISIBLE_RESULTS)
|
|
99
|
-
.map((item) => {
|
|
100
|
-
const selected = selectedItem?.name === item.name;
|
|
101
|
-
// 5 is an arbitrary number of some spaces around the item name, and some built-in padding.
|
|
102
|
-
let name = ` ${item.name}${' '.repeat(width > 0 ? width - 5 - item.name.length : 0)}`;
|
|
103
|
-
if (item.type === 'wizard')
|
|
104
|
-
name = name.slice(0, -2) + '> ';
|
|
105
|
-
return (React.createElement(Box, { key: item.name },
|
|
106
|
-
React.createElement(Text, { backgroundColor: selected ? 'green' : undefined, bold: selected },
|
|
107
|
-
React.createElement(Text, null, name))));
|
|
108
|
-
}))));
|
|
109
|
-
};
|
package/dist/SelectBox.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const SelectBox: ({ items, maxVisibleResults, onChange, onSelect, }: {
|
|
3
|
-
items: string[];
|
|
4
|
-
maxVisibleResults?: number;
|
|
5
|
-
onChange?: (item: string) => void;
|
|
6
|
-
onSelect: (item: string) => void;
|
|
7
|
-
}) => React.JSX.Element | null;
|
package/dist/SelectBox.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Box, Text, useInput } from 'ink';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
const noop = () => { };
|
|
4
|
-
export const SelectBox = ({ items, maxVisibleResults = 10, onChange = noop, onSelect, }) => {
|
|
5
|
-
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
6
|
-
const [startIndex, setStartIndex] = React.useState(0);
|
|
7
|
-
const select = (which) => {
|
|
8
|
-
let newSelectedIndex = which === 'previous'
|
|
9
|
-
? (selectedIndex - 1 + items.length) % items.length
|
|
10
|
-
: (selectedIndex + 1) % items.length;
|
|
11
|
-
setSelectedIndex(newSelectedIndex);
|
|
12
|
-
setStartIndex(Math.max(0, newSelectedIndex - maxVisibleResults + 1));
|
|
13
|
-
return newSelectedIndex;
|
|
14
|
-
};
|
|
15
|
-
useInput((_, key) => {
|
|
16
|
-
if (items.length === 0 || !items[selectedIndex])
|
|
17
|
-
return;
|
|
18
|
-
if (key.return) {
|
|
19
|
-
onSelect(items[selectedIndex]);
|
|
20
|
-
}
|
|
21
|
-
if (key.upArrow) {
|
|
22
|
-
const newSelectedIndex = select('previous');
|
|
23
|
-
if (items[newSelectedIndex])
|
|
24
|
-
onChange(items[newSelectedIndex]);
|
|
25
|
-
}
|
|
26
|
-
if (key.downArrow) {
|
|
27
|
-
const newSelectedIndex = select('next');
|
|
28
|
-
if (items[newSelectedIndex])
|
|
29
|
-
onChange(items[newSelectedIndex]);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
if (items.length === 0)
|
|
33
|
-
return null;
|
|
34
|
-
// 4 is some padding, and spaces at the beginning and end of the item
|
|
35
|
-
const width = items.reduce((max, item) => Math.max(max, item.length), 0) + 4;
|
|
36
|
-
return (React.createElement(Box, { borderStyle: "round", borderColor: "grey", flexDirection: "column", width: width }, items.slice(startIndex, startIndex + maxVisibleResults).map((item) => {
|
|
37
|
-
const selected = item === items[selectedIndex];
|
|
38
|
-
return (React.createElement(Box, { key: item },
|
|
39
|
-
React.createElement(Text, { backgroundColor: selected ? 'green' : undefined, bold: selected }, ` ${item} `)));
|
|
40
|
-
})));
|
|
41
|
-
};
|
package/dist/UI.d.ts
DELETED
package/dist/UI.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
export const UI = ({ item, exit }) => {
|
|
4
|
-
useInput((_, key) => {
|
|
5
|
-
if (key.escape) {
|
|
6
|
-
exit();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
const { component: Component, name } = item;
|
|
10
|
-
return (React.createElement(React.Fragment, null,
|
|
11
|
-
React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "green" },
|
|
12
|
-
React.createElement(Box, { marginBottom: 1 },
|
|
13
|
-
React.createElement(Text, { color: "green" }, name)),
|
|
14
|
-
React.createElement(Component, null)),
|
|
15
|
-
React.createElement(Box, { borderStyle: "round", borderColor: "grey" },
|
|
16
|
-
React.createElement(Text, null, "ESC = back"))));
|
|
17
|
-
};
|
package/dist/ViewContext.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WizardItem } from './items/types.js';
|
|
3
|
-
type View = 'search' | {
|
|
4
|
-
type: 'wizard';
|
|
5
|
-
item: WizardItem;
|
|
6
|
-
};
|
|
7
|
-
type ViewContextType = {
|
|
8
|
-
view: View;
|
|
9
|
-
goToView: (view: View) => void;
|
|
10
|
-
};
|
|
11
|
-
declare function ViewProvider({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
12
|
-
declare function useView(): ViewContextType;
|
|
13
|
-
export { ViewProvider, useView };
|
package/dist/ViewContext.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const ViewContext = React.createContext(null);
|
|
3
|
-
function ViewProvider({ children }) {
|
|
4
|
-
const [view, setView] = React.useState('search');
|
|
5
|
-
const goToView = (view) => {
|
|
6
|
-
setView(view);
|
|
7
|
-
};
|
|
8
|
-
const value = { view, goToView };
|
|
9
|
-
return React.createElement(ViewContext.Provider, { value: value }, children);
|
|
10
|
-
}
|
|
11
|
-
function useView() {
|
|
12
|
-
const context = React.useContext(ViewContext);
|
|
13
|
-
if (!context)
|
|
14
|
-
throw new Error('useView must be used within a ViewProvider');
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
17
|
-
export { ViewProvider, useView };
|
package/dist/WebinarGeek.d.ts
DELETED
package/dist/WebinarGeek.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { SelectBox } from './SelectBox.js';
|
|
4
|
-
const environments = [
|
|
5
|
-
'Localhost',
|
|
6
|
-
'Staging',
|
|
7
|
-
'Vixy @ Staging',
|
|
8
|
-
'Bouwe @ production',
|
|
9
|
-
];
|
|
10
|
-
export const WebinarGeek = () => (React.createElement(Box, { flexDirection: "column" },
|
|
11
|
-
React.createElement(Text, null, "Select your account"),
|
|
12
|
-
React.createElement(SelectBox, { items: environments, onSelect: (environment) => {
|
|
13
|
-
console.log({ environment });
|
|
14
|
-
} })));
|
package/dist/Webinars.d.ts
DELETED
package/dist/Webinars.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { SelectBox } from './SelectBox.js';
|
|
4
|
-
//TODO any sensitive information should be in the my-secrets.ts file
|
|
5
|
-
const environments = [
|
|
6
|
-
'Localhost',
|
|
7
|
-
'Staging',
|
|
8
|
-
'HLS @ Staging',
|
|
9
|
-
'Bouwe @ Production',
|
|
10
|
-
];
|
|
11
|
-
export const Webinars = () => (React.createElement(Box, { flexDirection: "column" },
|
|
12
|
-
React.createElement(Text, null, "Select your account"),
|
|
13
|
-
React.createElement(SelectBox, { items: environments, onSelect: (environment) => {
|
|
14
|
-
console.log({ environment });
|
|
15
|
-
} })));
|
package/dist/Wizard.d.ts
DELETED
package/dist/Wizard.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import { useView } from './ViewContext.js';
|
|
4
|
-
export const Wizard = ({ item }) => {
|
|
5
|
-
const { goToView } = useView();
|
|
6
|
-
useInput((_, key) => {
|
|
7
|
-
if (key.escape)
|
|
8
|
-
goToView('search');
|
|
9
|
-
});
|
|
10
|
-
const { component: Component, name } = item;
|
|
11
|
-
return (React.createElement(React.Fragment, null,
|
|
12
|
-
React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "green" },
|
|
13
|
-
React.createElement(Box, { marginBottom: 1 },
|
|
14
|
-
React.createElement(Text, { color: "green" }, name)),
|
|
15
|
-
React.createElement(Component, null)),
|
|
16
|
-
React.createElement(Box, { borderStyle: "round", borderColor: "grey" },
|
|
17
|
-
React.createElement(Text, null, "ESC = back"))));
|
|
18
|
-
};
|
package/dist/YouTube.d.ts
DELETED
package/dist/YouTube.js
DELETED
package/dist/app.d.ts
DELETED
package/dist/app.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, measureElement } from 'ink';
|
|
3
|
-
import { Search } from './Search.js';
|
|
4
|
-
import { Wizard } from './Wizard.js';
|
|
5
|
-
import childProcess from 'node:child_process';
|
|
6
|
-
import { useView } from './ViewContext.js';
|
|
7
|
-
export default function App() {
|
|
8
|
-
const { view, goToView } = useView();
|
|
9
|
-
const [searchKey, setSearchKey] = React.useState(0);
|
|
10
|
-
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
11
|
-
const containerRef = React.useRef(null);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
if (!containerRef.current)
|
|
14
|
-
return;
|
|
15
|
-
const { width } = measureElement(containerRef.current);
|
|
16
|
-
setContainerWidth(width);
|
|
17
|
-
}, []);
|
|
18
|
-
const renderSearch = () => {
|
|
19
|
-
// The searchKey is used to force a re-render of the Search component
|
|
20
|
-
setSearchKey((prev) => prev + 1);
|
|
21
|
-
goToView('search');
|
|
22
|
-
};
|
|
23
|
-
const choose = (item) => {
|
|
24
|
-
if (item.type === 'wizard') {
|
|
25
|
-
goToView({ type: 'wizard', item: item });
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (item.type === 'app') {
|
|
29
|
-
childProcess.spawn('open', ['-a', item.name]);
|
|
30
|
-
renderSearch();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (item.type === 'command') {
|
|
34
|
-
item.command();
|
|
35
|
-
renderSearch();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "grey", width: "100%", ref: containerRef }, view === 'search' ? (React.createElement(Search, { key: searchKey, width: containerWidth, choose: choose })) : (React.createElement(Wizard, { item: view.item }))));
|
|
40
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type ApplicationsCacheContextType = {
|
|
3
|
-
needsRefresh: boolean;
|
|
4
|
-
setNeedsRefresh: (needsRefresh: boolean) => void;
|
|
5
|
-
};
|
|
6
|
-
declare function ApplicationsCacheProvider({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
7
|
-
declare function useApplicationsCache(): ApplicationsCacheContextType;
|
|
8
|
-
export { ApplicationsCacheProvider, useApplicationsCache };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const ApplicationsCache = React.createContext(null);
|
|
3
|
-
function ApplicationsCacheProvider({ children }) {
|
|
4
|
-
const [needsRefresh, setNeedsRefresh] = React.useState(false);
|
|
5
|
-
const value = { needsRefresh, setNeedsRefresh };
|
|
6
|
-
return (React.createElement(ApplicationsCache.Provider, { value: value }, children));
|
|
7
|
-
}
|
|
8
|
-
function useApplicationsCache() {
|
|
9
|
-
const context = React.useContext(ApplicationsCache);
|
|
10
|
-
if (!context)
|
|
11
|
-
throw new Error('useApplicationsCache must be used within a ApplicationsCacheProvider');
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
export { ApplicationsCacheProvider, useApplicationsCache };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RefreshApps: () => null;
|
package/dist/apps/RefreshApps.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useApplicationsCache } from './ApplicationsCacheContext.js';
|
|
3
|
-
import { useView } from '../ViewContext.js';
|
|
4
|
-
// Indicates to the app cache that it needs to refresh the apps.
|
|
5
|
-
export const RefreshApps = () => {
|
|
6
|
-
const { setNeedsRefresh } = useApplicationsCache();
|
|
7
|
-
const { goToView } = useView();
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
setNeedsRefresh(true);
|
|
10
|
-
goToView('search');
|
|
11
|
-
}, []);
|
|
12
|
-
return null;
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReloadInstalledApplications: () => null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useApplicationsCache } from './ApplicationsCacheContext.js';
|
|
3
|
-
import { useView } from '../ViewContext.js';
|
|
4
|
-
export const ReloadInstalledApplications = () => {
|
|
5
|
-
const { setNeedsRefresh } = useApplicationsCache();
|
|
6
|
-
const { goToView } = useView();
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setNeedsRefresh(true);
|
|
9
|
-
goToView('search');
|
|
10
|
-
}, []);
|
|
11
|
-
return null;
|
|
12
|
-
};
|
package/dist/backup.d.ts
DELETED