@trendify/cli 0.1.8 → 0.1.10

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 (70) hide show
  1. package/dist/cli.entry.js +24 -0
  2. package/dist/shared/config/env.config.js +1 -1
  3. package/dist/shared/constants/app-version.constant.d.ts +1 -1
  4. package/dist/shared/constants/app-version.constant.js +1 -1
  5. package/dist/shared/services/cli-update.service.d.ts.map +1 -1
  6. package/dist/shared/services/cli-update.service.js +61 -1
  7. package/dist/version.d.ts +1 -1
  8. package/dist/version.d.ts.map +1 -1
  9. package/dist/version.js +1 -1
  10. package/package.json +1 -1
  11. package/dist/app.d.ts +0 -14
  12. package/dist/app.d.ts.map +0 -1
  13. package/dist/app.js +0 -448
  14. package/dist/cli-update-service.d.ts +0 -29
  15. package/dist/cli-update-service.d.ts.map +0 -1
  16. package/dist/cli-update-service.js +0 -206
  17. package/dist/cli.d.ts +0 -3
  18. package/dist/cli.d.ts.map +0 -1
  19. package/dist/cli.js +0 -51
  20. package/dist/config/app-paths.d.ts +0 -4
  21. package/dist/config/app-paths.d.ts.map +0 -1
  22. package/dist/config/app-paths.js +0 -5
  23. package/dist/config/env.d.ts +0 -14
  24. package/dist/config/env.d.ts.map +0 -1
  25. package/dist/config/env.js +0 -58
  26. package/dist/modules/auth/auth-service.d.ts +0 -60
  27. package/dist/modules/auth/auth-service.d.ts.map +0 -1
  28. package/dist/modules/auth/auth-service.js +0 -494
  29. package/dist/modules/auth/auth-storage.d.ts +0 -11
  30. package/dist/modules/auth/auth-storage.d.ts.map +0 -1
  31. package/dist/modules/auth/auth-storage.js +0 -65
  32. package/dist/modules/auth/auth-user.d.ts +0 -3
  33. package/dist/modules/auth/auth-user.d.ts.map +0 -1
  34. package/dist/modules/auth/auth-user.js +0 -10
  35. package/dist/modules/auth/page/login-page.d.ts +0 -12
  36. package/dist/modules/auth/page/login-page.d.ts.map +0 -1
  37. package/dist/modules/auth/page/login-page.js +0 -22
  38. package/dist/modules/discovery/components/discovery-step-header.d.ts +0 -7
  39. package/dist/modules/discovery/components/discovery-step-header.d.ts.map +0 -1
  40. package/dist/modules/discovery/components/discovery-step-header.js +0 -5
  41. package/dist/modules/discovery/page/discovery-page.d.ts +0 -11
  42. package/dist/modules/discovery/page/discovery-page.d.ts.map +0 -1
  43. package/dist/modules/discovery/page/discovery-page.js +0 -58
  44. package/dist/modules/profile/page/profile-page.d.ts +0 -12
  45. package/dist/modules/profile/page/profile-page.d.ts.map +0 -1
  46. package/dist/modules/profile/page/profile-page.js +0 -180
  47. package/dist/modules/profile/pages/profile.page.d.ts +0 -12
  48. package/dist/modules/profile/pages/profile.page.d.ts.map +0 -1
  49. package/dist/modules/profile/pages/profile.page.js +0 -180
  50. package/dist/shared/components/action-menu-page.d.ts +0 -13
  51. package/dist/shared/components/action-menu-page.d.ts.map +0 -1
  52. package/dist/shared/components/action-menu-page.js +0 -7
  53. package/dist/shared/components/radio-select.d.ts +0 -12
  54. package/dist/shared/components/radio-select.d.ts.map +0 -1
  55. package/dist/shared/components/radio-select.js +0 -16
  56. package/dist/shared/components/step-header.d.ts +0 -7
  57. package/dist/shared/components/step-header.d.ts.map +0 -1
  58. package/dist/shared/components/step-header.js +0 -5
  59. package/dist/shared/components/text-field.d.ts +0 -12
  60. package/dist/shared/components/text-field.d.ts.map +0 -1
  61. package/dist/shared/components/text-field.js +0 -6
  62. package/dist/shared/template/app-logo.d.ts +0 -2
  63. package/dist/shared/template/app-logo.d.ts.map +0 -1
  64. package/dist/shared/template/app-logo.js +0 -13
  65. package/dist/shared/template/app-menu.d.ts +0 -17
  66. package/dist/shared/template/app-menu.d.ts.map +0 -1
  67. package/dist/shared/template/app-menu.js +0 -85
  68. package/dist/shared/template/app-shell.d.ts +0 -12
  69. package/dist/shared/template/app-shell.d.ts.map +0 -1
  70. package/dist/shared/template/app-shell.js +0 -15
@@ -1,85 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useInput } from 'ink';
3
- import { TextField } from '../components/text-field.js';
4
- import { useMemo, useState } from 'react';
5
- function normalize(text) {
6
- return text
7
- .normalize('NFD')
8
- .replace(/\p{Diacritic}/gu, '')
9
- .toLowerCase()
10
- .trim();
11
- }
12
- function scoreItem(item, query) {
13
- const normalizedCommand = normalize(item.comando);
14
- const normalizedAliases = item.aliases.map(normalize);
15
- const normalizedText = [item.titulo, item.descricao, ...item.palavrasChave].map(normalize);
16
- if (normalizedCommand === query || normalizedAliases.includes(query)) {
17
- return 100;
18
- }
19
- if (normalizedCommand.startsWith(query) || normalizedAliases.some((alias) => alias.startsWith(query))) {
20
- return 80;
21
- }
22
- if (normalizedCommand.includes(query) ||
23
- normalizedAliases.some((alias) => alias.includes(query)) ||
24
- normalizedText.some((text) => text.includes(query))) {
25
- return 50;
26
- }
27
- return 0;
28
- }
29
- function truncate(text, maxLength) {
30
- if (text.length <= maxLength) {
31
- return text;
32
- }
33
- return `${text.slice(0, maxLength - 1)}…`;
34
- }
35
- function filterItems(items, query) {
36
- const normalizedQuery = normalize(query);
37
- if (!normalizedQuery) {
38
- return [...items];
39
- }
40
- return [...items]
41
- .map((item) => ({ item, score: scoreItem(item, normalizedQuery) }))
42
- .filter(({ score }) => score > 0)
43
- .sort((left, right) => right.score - left.score)
44
- .map(({ item }) => item);
45
- }
46
- export function AppMenu({ initialInput, items, onInputChange, onSelect }) {
47
- const [inputValue, setInputValue] = useState(initialInput);
48
- const [selectedIndex, setSelectedIndex] = useState(0);
49
- const menuOpen = inputValue.startsWith('/');
50
- const query = menuOpen ? inputValue.slice(1) : '';
51
- const filteredItems = useMemo(() => filterItems(items, query), [items, query]);
52
- const selectedItem = filteredItems[selectedIndex] ?? filteredItems[0];
53
- useInput((input, key) => {
54
- if (key.escape) {
55
- setInputValue('');
56
- setSelectedIndex(0);
57
- onInputChange?.('');
58
- return;
59
- }
60
- if (!menuOpen || filteredItems.length === 0) {
61
- return;
62
- }
63
- if (key.upArrow) {
64
- setSelectedIndex((current) => (current === 0 ? filteredItems.length - 1 : current - 1));
65
- return;
66
- }
67
- if (key.downArrow) {
68
- setSelectedIndex((current) => (current === filteredItems.length - 1 ? 0 : current + 1));
69
- }
70
- });
71
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(TextField, { placeholder: "Digite / para abrir o menu", value: inputValue, onChange: (value) => {
72
- setInputValue(value);
73
- setSelectedIndex(0);
74
- onInputChange?.(value);
75
- }, onSubmit: () => {
76
- if (menuOpen && selectedItem) {
77
- onSelect(selectedItem);
78
- }
79
- } }), menuOpen ? (_jsx(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, width: 72, marginTop: 1, children: filteredItems.length > 0 ? (filteredItems.map((item, index) => {
80
- const selected = item.id === selectedItem?.id && index === selectedIndex;
81
- const title = truncate(item.titulo, 18).padEnd(18, ' ');
82
- const description = truncate(item.descricao, 42);
83
- return (_jsxs(Box, { children: [_jsxs(Text, { color: selected ? 'greenBright' : 'white', children: [selected ? '› ' : ' ', title] }), _jsxs(Text, { dimColor: true, children: [" ", description] })] }, item.id));
84
- })) : (_jsx(Text, { dimColor: true, children: "Nenhum comando encontrado." })) })) : null] }));
85
- }
@@ -1,12 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- type AppShellProps = {
3
- readonly appVersion: string;
4
- readonly children: ReactNode;
5
- readonly notification?: string | null;
6
- readonly notificationTone?: 'error' | 'info' | 'success';
7
- readonly subtitle: string;
8
- readonly title: string;
9
- };
10
- export declare function AppShell({ appVersion, children, notification, notificationTone, subtitle, title, }: AppShellProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
12
- //# sourceMappingURL=app-shell.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/shared/template/app-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAcF,wBAAgB,QAAQ,CAAC,EACvB,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,gBAA4B,EAC5B,QAAQ,EACR,KAAK,GACN,EAAE,aAAa,2CAef"}
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AppLogo } from './app-logo.js';
3
- import { Box, Text } from 'ink';
4
- function getNotificationColor(tone) {
5
- if (tone === 'error') {
6
- return 'redBright';
7
- }
8
- if (tone === 'info') {
9
- return 'cyanBright';
10
- }
11
- return 'greenBright';
12
- }
13
- export function AppShell({ appVersion, children, notification, notificationTone = 'success', subtitle, title, }) {
14
- return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsx(AppLogo, {}), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { color: "cyanBright", children: ["CLI v", appVersion] }), _jsx(Text, { children: title }), _jsx(Text, { dimColor: true, children: subtitle }), notification ? _jsx(Text, { color: getNotificationColor(notificationTone), children: notification }) : null] }), children] }));
15
- }