attio 0.0.1-experimental.20240724.2 → 0.0.1-experimental.20240729
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/lib/commands/build.js +5 -5
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +65 -76
- package/lib/commands/dev.js.map +1 -1
- package/lib/components/BuildError.d.ts +1 -9
- package/lib/components/BuildError.d.ts.map +1 -1
- package/lib/components/BuildError.js +35 -50
- package/lib/components/BuildError.js.map +1 -1
- package/lib/components/ScrollBox.d.ts +4 -0
- package/lib/components/ScrollBox.d.ts.map +1 -0
- package/lib/components/ScrollBox.js +88 -0
- package/lib/components/ScrollBox.js.map +1 -0
- package/lib/components/ScrollBox.store.d.ts +15 -0
- package/lib/components/ScrollBox.store.d.ts.map +1 -0
- package/lib/components/ScrollBox.store.js +37 -0
- package/lib/components/ScrollBox.store.js.map +1 -0
- package/lib/components/ScrollBox.util.d.ts +4 -0
- package/lib/components/ScrollBox.util.d.ts.map +1 -0
- package/lib/components/ScrollBox.util.js +28 -0
- package/lib/components/ScrollBox.util.js.map +1 -0
- package/lib/components/TypeScriptErrors.d.ts +1 -8
- package/lib/components/TypeScriptErrors.d.ts.map +1 -1
- package/lib/components/TypeScriptErrors.js +7 -15
- package/lib/components/TypeScriptErrors.js.map +1 -1
- package/lib/hooks/useFullScreen.d.ts.map +1 -1
- package/lib/hooks/useFullScreen.js +13 -7
- package/lib/hooks/useFullScreen.js.map +1 -1
- package/lib/hooks/useTerminalTitle.d.ts +2 -0
- package/lib/hooks/useTerminalTitle.d.ts.map +1 -0
- package/lib/hooks/useTerminalTitle.js +12 -0
- package/lib/hooks/useTerminalTitle.js.map +1 -0
- package/package.json +3 -1
package/lib/commands/build.js
CHANGED
|
@@ -2,9 +2,9 @@ import { useMachine } from "@xstate/react";
|
|
|
2
2
|
import { Box, Text, useStdin } from "ink";
|
|
3
3
|
import Spinner from "ink-spinner";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { renderBuildErrors } from "../components/BuildError.js";
|
|
6
6
|
import { Logo } from "../components/Logo.js";
|
|
7
|
-
import {
|
|
7
|
+
import { renderTypeScriptErrors } from "../components/TypeScriptErrors.js";
|
|
8
8
|
import { buildMachine } from "../machines/build-machine.js";
|
|
9
9
|
export const description = "Build your Attio extension locally";
|
|
10
10
|
export default function Build() {
|
|
@@ -29,9 +29,9 @@ export default function Build() {
|
|
|
29
29
|
snapshot.matches("Success") && (React.createElement(Box, { flexDirection: "column" },
|
|
30
30
|
React.createElement(Box, null,
|
|
31
31
|
React.createElement(Text, null, "\u2705 Built!")))),
|
|
32
|
-
snapshot.matches("Errored") && (React.createElement(Box,
|
|
33
|
-
jsError &&
|
|
34
|
-
tsErrors &&
|
|
32
|
+
snapshot.matches("Errored") && (React.createElement(Box, { flexDirection: "column", gap: 1 },
|
|
33
|
+
jsError && renderBuildErrors(jsError),
|
|
34
|
+
tsErrors && renderTypeScriptErrors(tsErrors),
|
|
35
35
|
!jsError && !tsErrors && (React.createElement(Box, null,
|
|
36
36
|
React.createElement(Text, null, "Unknown error")))))));
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AACxC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA;AACvC,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AACxC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EA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BAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG,CACpB,CACJ,CACL,CACJ,CACT;QACA,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAC5B,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;YACvB,oBAAC,GAAG;gBACA,oBAAC,IAAI,wBAAgB,CACnB,CACJ,CACT;QACA,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAC5B,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC;YAC7B,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC;YACrC,QAAQ,IAAI,sBAAsB,CAAC,QAAQ,CAAC;YAC5C,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,CACtB,oBAAC,GAAG;gBACA,oBAAC,IAAI,wBAAqB,CACxB,CACT,CACC,CACT,CACC,CACT,CAAA;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAUrB,eAAO,MAAM,WAAW,iCAAiC,CAAA;AAIzD,eAAO,MAAM,OAAO;;;;;;EAIlB,CAAA;AAEF,UAAU,KAAK;IACX,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;CACnC;AAID,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,EAAC,OAAO,EAAE,EAAC,KAAK,EAAC,EAAC,EAAE,KAAK,qBA6GpD"}
|
package/lib/commands/dev.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { useMachine } from "@xstate/react";
|
|
2
|
-
import {
|
|
3
|
-
import { Box, Text } from "ink";
|
|
4
|
-
import Spinner from "ink-spinner";
|
|
2
|
+
import { format } from "date-fns";
|
|
3
|
+
import { Box, Text, useApp, useInput } from "ink";
|
|
5
4
|
import { option } from "pastel";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import { z } from "zod";
|
|
8
|
-
import {
|
|
7
|
+
import { renderBuildErrors } from "../components/BuildError.js";
|
|
9
8
|
import { InitialInstructions } from "../components/InitialInstructions.js";
|
|
10
|
-
import {
|
|
9
|
+
import { ScrollBox } from "../components/ScrollBox.js";
|
|
10
|
+
import { renderTypeScriptErrors } from "../components/TypeScriptErrors.js";
|
|
11
11
|
import { useFullScreen } from "../hooks/useFullScreen.js";
|
|
12
|
+
import { useTerminalTitle } from "../hooks/useTerminalTitle.js";
|
|
12
13
|
import { devMachine } from "../machines/dev-machine.js";
|
|
13
14
|
export const description = "Develop your Attio extension";
|
|
14
|
-
const
|
|
15
|
-
const [now, setNow] = React.useState(new Date());
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
const interval = setInterval(() => setNow(new Date()), ms);
|
|
18
|
-
return () => clearInterval(interval);
|
|
19
|
-
}, [ms]);
|
|
20
|
-
return now;
|
|
21
|
-
};
|
|
15
|
+
const PrettyDate = ({ date }) => React.createElement(Text, null, format(date, "yyyy-MM-dd HH:mm:ss"));
|
|
22
16
|
export const options = z.object({
|
|
23
17
|
debug: z
|
|
24
18
|
.boolean()
|
|
@@ -26,83 +20,78 @@ export const options = z.object({
|
|
|
26
20
|
});
|
|
27
21
|
export default function Dev({ options: { debug } }) {
|
|
28
22
|
const [snapshot] = useMachine(devMachine);
|
|
29
|
-
const
|
|
23
|
+
const { exit } = useApp();
|
|
30
24
|
const fullScreen = useFullScreen();
|
|
25
|
+
const appId = snapshot.context.devVersion?.app_id;
|
|
26
|
+
useTerminalTitle(appId ? `attio dev – ${appId}` : `attio dev`);
|
|
31
27
|
const jsError = snapshot.children.javascript?.getSnapshot().context.error;
|
|
32
28
|
const jsTime = snapshot.children.javascript?.getSnapshot().context.time;
|
|
33
29
|
const tsErrors = snapshot.children.typescript?.getSnapshot().context.errors;
|
|
34
30
|
const tsTime = snapshot.children.typescript?.getSnapshot().context.time;
|
|
31
|
+
const hasErrors = Boolean(jsError || tsErrors);
|
|
35
32
|
const isNoConfig = snapshot.matches("No Config");
|
|
36
33
|
React.useEffect(() => {
|
|
37
34
|
if (isNoConfig) {
|
|
38
35
|
setTimeout(() => {
|
|
39
|
-
|
|
36
|
+
exit(new Error("No config found"));
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
}, [isNoConfig]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
React.createElement(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
formatDistanceStrict(snapshot.context.lastSuccessfulJavaScriptBuild, now, {
|
|
71
|
-
addSuffix: true,
|
|
72
|
-
}),
|
|
73
|
-
"."))),
|
|
74
|
-
jsError && jsTime && (React.createElement(Box, { flexDirection: "column" },
|
|
75
|
-
React.createElement(Box, null,
|
|
39
|
+
}, [exit, isNoConfig]);
|
|
40
|
+
useInput((input) => {
|
|
41
|
+
if (input === "q") {
|
|
42
|
+
exit();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return (React.createElement(Box, { flexDirection: "column", ...fullScreen },
|
|
46
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
47
|
+
debug && (React.createElement(Box, { flexDirection: "column", paddingX: 1, borderStyle: "round" },
|
|
48
|
+
React.createElement(Box, null,
|
|
49
|
+
React.createElement(Text, null,
|
|
50
|
+
"State: ",
|
|
51
|
+
JSON.stringify(snapshot.value))),
|
|
52
|
+
snapshot.context.devVersion?.app_id && (React.createElement(Box, null,
|
|
53
|
+
React.createElement(Text, null,
|
|
54
|
+
"App ID: ",
|
|
55
|
+
snapshot.context.devVersion?.app_id))),
|
|
56
|
+
snapshot.context.devVersion?.app_dev_version_id && (React.createElement(Box, null,
|
|
57
|
+
React.createElement(Text, null,
|
|
58
|
+
"App Dev Version ID:",
|
|
59
|
+
" ",
|
|
60
|
+
snapshot.context.devVersion?.app_dev_version_id))),
|
|
61
|
+
snapshot.context.lastPing && (React.createElement(Box, null,
|
|
62
|
+
React.createElement(Text, null,
|
|
63
|
+
"Last ping at ",
|
|
64
|
+
React.createElement(PrettyDate, { date: snapshot.context.lastPing }),
|
|
65
|
+
"."))))),
|
|
66
|
+
snapshot.context.lastSuccessfulJavaScriptBuild && (React.createElement(Box, null,
|
|
76
67
|
React.createElement(Text, null,
|
|
77
|
-
"\
|
|
68
|
+
"\u2705 Last successful build was at",
|
|
78
69
|
" ",
|
|
79
|
-
|
|
80
|
-
".")),
|
|
81
|
-
React.createElement(Box, null,
|
|
82
|
-
React.createElement(BuildError, { error: jsError })))),
|
|
83
|
-
tsErrors && tsTime && (React.createElement(Box, { flexDirection: "column" },
|
|
84
|
-
React.createElement(Box, null,
|
|
70
|
+
React.createElement(PrettyDate, { date: snapshot.context.lastSuccessfulJavaScriptBuild }),
|
|
71
|
+
"."))),
|
|
72
|
+
jsError && jsTime && (React.createElement(Box, null,
|
|
85
73
|
React.createElement(Text, null,
|
|
86
|
-
"\u274C Last failed
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
React.createElement(Box, null,
|
|
91
|
-
React.createElement(TypeScriptErrors, { errors: tsErrors })))),
|
|
92
|
-
snapshot.matches("No Config") && (React.createElement(InitialInstructions, { reason: snapshot.context.configError })),
|
|
93
|
-
snapshot.matches("Watching") && (React.createElement(Box, null,
|
|
94
|
-
React.createElement(Text, null, "\uD83D\uDC40 Watching for changes... "),
|
|
95
|
-
React.createElement(Text, { color: "green" },
|
|
96
|
-
React.createElement(Spinner, { type: "dots" })))),
|
|
97
|
-
snapshot.matches({ Watching: { JavaScript: "Uploading" } }) && (React.createElement(Box, null,
|
|
98
|
-
React.createElement(Text, null, "\u267B\uFE0F Uploading bundles... "),
|
|
99
|
-
React.createElement(Text, { color: "green" },
|
|
100
|
-
React.createElement(Spinner, { type: "dots" })))),
|
|
101
|
-
snapshot.matches({ Watching: { JavaScript: "Upload Error" } }) && (React.createElement(Box, { flexDirection: "column" },
|
|
102
|
-
React.createElement(Box, null,
|
|
103
|
-
React.createElement(Text, { color: "redBright" }, "\u274C Upload Error"),
|
|
74
|
+
"\u274C Last failed build was at ",
|
|
75
|
+
React.createElement(PrettyDate, { date: jsTime }),
|
|
76
|
+
"."))),
|
|
77
|
+
tsErrors && tsTime && (React.createElement(Box, null,
|
|
104
78
|
React.createElement(Text, null,
|
|
105
|
-
"\
|
|
106
|
-
|
|
79
|
+
"\u274C Last failed TypeScript check was at ",
|
|
80
|
+
React.createElement(PrettyDate, { date: tsTime }),
|
|
81
|
+
"."))),
|
|
82
|
+
snapshot.matches("No Config") && (React.createElement(InitialInstructions, { reason: snapshot.context.configError })),
|
|
83
|
+
snapshot.matches("Watching") && (React.createElement(Box, null,
|
|
84
|
+
React.createElement(Text, null, "\uD83D\uDC40 Watching for changes... "))),
|
|
85
|
+
snapshot.matches({ Watching: { JavaScript: "Uploading" } }) && (React.createElement(Box, null,
|
|
86
|
+
React.createElement(Text, null, "\u267B\uFE0F Uploading bundles... "))),
|
|
87
|
+
snapshot.matches({ Watching: { JavaScript: "Upload Error" } }) && (React.createElement(Box, { flexDirection: "column" },
|
|
88
|
+
React.createElement(Box, null,
|
|
89
|
+
React.createElement(Text, { color: "redBright" }, "\u274C Upload Error"),
|
|
90
|
+
React.createElement(Text, null,
|
|
91
|
+
"\u2013 ",
|
|
92
|
+
snapshot.context.uploadError?.message))))),
|
|
93
|
+
hasErrors && (React.createElement(ScrollBox, { borderStyle: "round", padding: 1 },
|
|
94
|
+
jsError && renderBuildErrors(jsError),
|
|
95
|
+
tsErrors && renderTypeScriptErrors(tsErrors)))));
|
|
107
96
|
}
|
|
108
97
|
//# sourceMappingURL=dev.js.map
|
package/lib/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AACxC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAErD,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAA;AAEzD,MAAM,UAAU,GAAG,CAAC,EAAC,IAAI,E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,CACpD,CACJ,CACT,CACC;QACL,SAAS,IAAI,CACV,oBAAC,SAAS,IAAC,WAAW,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC;YACpC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC;YACrC,QAAQ,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CACrC,CACf,CACC,CACT,CAAA;AACL,CAAC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BuildError } from "../build.js";
|
|
3
|
-
export declare function
|
|
4
|
-
message: BuildError["errors"][number];
|
|
5
|
-
level: "error" | "warning";
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
interface BuildErrorProps {
|
|
8
|
-
error: BuildError;
|
|
9
|
-
}
|
|
10
|
-
export declare function BuildError({ error: { errors, warnings } }: BuildErrorProps): React.JSX.Element;
|
|
11
|
-
export {};
|
|
3
|
+
export declare function renderBuildErrors({ errors, warnings }: BuildError): React.JSX.Element[];
|
|
12
4
|
//# sourceMappingURL=BuildError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildError.d.ts","sourceRoot":"","sources":["../../src/components/BuildError.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"BuildError.d.ts","sourceRoot":"","sources":["../../src/components/BuildError.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAgDtC,wBAAgB,iBAAiB,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAE,UAAU,uBAS/D"}
|
|
@@ -1,56 +1,41 @@
|
|
|
1
1
|
import { Box, Text } from "ink";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
React.createElement(
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const Error = React.forwardRef(({ message, level }, ref) => (React.createElement(Box, { flexDirection: "column", ref: ref },
|
|
4
|
+
React.createElement(Box, null,
|
|
5
|
+
React.createElement(Text, { color: level === "error" ? "red" : "yellow" },
|
|
6
|
+
level === "error" ? "❌" : "⚠️",
|
|
7
|
+
" ",
|
|
8
|
+
React.createElement(Text, { backgroundColor: level === "error" ? "red" : "yellow", color: "white" },
|
|
8
9
|
" ",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
level === "error" ? "ERROR" : "WARNING",
|
|
11
|
+
" ")),
|
|
12
|
+
React.createElement(Text, { bold: true }, message.text)),
|
|
13
|
+
React.createElement(Box, { paddingTop: 1, flexDirection: "column" },
|
|
14
|
+
React.createElement(Box, { marginLeft: 4 },
|
|
15
|
+
React.createElement(Text, null,
|
|
16
|
+
message.location.file,
|
|
17
|
+
":",
|
|
18
|
+
message.location.line,
|
|
19
|
+
":",
|
|
20
|
+
message.location.column)),
|
|
21
|
+
React.createElement(Box, { marginLeft: 4, marginTop: 1 },
|
|
22
|
+
React.createElement(Box, { flexDirection: "column", marginRight: 1 },
|
|
23
|
+
React.createElement(Text, null, message.location.line)),
|
|
24
|
+
React.createElement(Box, { flexDirection: "column" },
|
|
16
25
|
React.createElement(Text, null,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
message.location.column
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
React.createElement(Box, { paddingLeft: message.location.column +
|
|
32
|
-
message.location.lineText.trim().length -
|
|
33
|
-
message.location.lineText.length +
|
|
34
|
-
1 },
|
|
35
|
-
React.createElement(Text, { color: "greenBright" }, "^"))))))));
|
|
36
|
-
}
|
|
37
|
-
export function BuildError({ error: { errors, warnings } }) {
|
|
38
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
39
|
-
errors.length > 0 && (React.createElement(Box, { flexDirection: "column" },
|
|
40
|
-
React.createElement(Text, { color: "red" },
|
|
41
|
-
errors.length,
|
|
42
|
-
" ERROR",
|
|
43
|
-
errors.length === 1 ? "" : "S",
|
|
44
|
-
":"),
|
|
45
|
-
errors.map((error, index) => (React.createElement(Box, { key: index, marginY: 1 },
|
|
46
|
-
React.createElement(Error, { message: error, level: "error" })))))),
|
|
47
|
-
warnings.length > 0 && (React.createElement(Box, { flexDirection: "column" },
|
|
48
|
-
React.createElement(Text, { color: "red" },
|
|
49
|
-
warnings.length,
|
|
50
|
-
" WARNING",
|
|
51
|
-
warnings.length === 1 ? "" : "S",
|
|
52
|
-
":"),
|
|
53
|
-
warnings.map((warning, index) => (React.createElement(Box, { key: index, marginY: 1 },
|
|
54
|
-
React.createElement(Error, { message: warning, level: "warning" }))))))));
|
|
26
|
+
"| ",
|
|
27
|
+
message.location.lineText.trim()),
|
|
28
|
+
React.createElement(Box, null,
|
|
29
|
+
React.createElement(Text, null, "|"),
|
|
30
|
+
React.createElement(Box, { paddingLeft: message.location.column +
|
|
31
|
+
message.location.lineText.trim().length -
|
|
32
|
+
message.location.lineText.length +
|
|
33
|
+
1 },
|
|
34
|
+
React.createElement(Text, { color: "greenBright" }, "^")))))))));
|
|
35
|
+
export function renderBuildErrors({ errors, warnings }) {
|
|
36
|
+
return [
|
|
37
|
+
...errors.map((error, index) => (React.createElement(Error, { key: `BuildError-${index}`, message: error, level: "error" }))),
|
|
38
|
+
...warnings.map((error, index) => (React.createElement(Error, { key: `BuildError-${index}`, message: error, level: "warning" }))),
|
|
39
|
+
];
|
|
55
40
|
}
|
|
56
41
|
//# sourceMappingURL=BuildError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildError.js","sourceRoot":"","sources":["../../src/components/BuildError.tsx"],"names":[],"mappings":"AAAA,OAAO,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version":3,"file":"ScrollBox.d.ts","sourceRoot":"","sources":["../../src/components/ScrollBox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAiC,MAAM,KAAK,CAAA;AACvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAezB,eAAO,MAAM,SAAS,oDACI,MAAM,wBAAwB,CAAC,UAAU,CAAC,uBAwGnE,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useSelector } from "@xstate/react";
|
|
2
|
+
import { Box, Text, measureElement, useInput } from "ink";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useFullScreen } from "../hooks/useFullScreen.js";
|
|
5
|
+
import { useScrollBoxStore } from "./ScrollBox.store.js";
|
|
6
|
+
import { calculateChildRange } from "./ScrollBox.util.js";
|
|
7
|
+
const GAP = 1;
|
|
8
|
+
export const ScrollBox = React.memo(({ padding, ...props }) => {
|
|
9
|
+
const { height: screenHeight, width } = useFullScreen();
|
|
10
|
+
const [top, setTop] = React.useState(0);
|
|
11
|
+
const height = Number(screenHeight) - top;
|
|
12
|
+
const availableHeight = height - (props.borderStyle ? 2 : 0) - (padding ?? 0) * 2;
|
|
13
|
+
const children = React.useMemo(() => React.Children.toArray(props.children).filter((element) => Boolean(element) && React.isValidElement(element)), [props.children]);
|
|
14
|
+
const store = useScrollBoxStore(children.length, availableHeight, Number(width ?? ""));
|
|
15
|
+
const boxRef = React.useCallback((element) => setTop(element?.yogaNode?.getComputedTop() ?? 0), []);
|
|
16
|
+
const heights = useSelector(store, (state) => state.context.heights);
|
|
17
|
+
const offset = useSelector(store, (state) => state.context.offset);
|
|
18
|
+
const allMeasured = heights.length === children.length;
|
|
19
|
+
const haveOverflow = allMeasured && heights.reduce((a, b) => a + b, 0) > availableHeight;
|
|
20
|
+
const childRange = calculateChildRange(heights, offset, availableHeight);
|
|
21
|
+
const itemsShown = childRange[1] - childRange[0];
|
|
22
|
+
const hiddenAbove = offset;
|
|
23
|
+
const hiddenBelow = children.length - (offset + itemsShown);
|
|
24
|
+
useInput((input, key) => {
|
|
25
|
+
if (input === "j" || key.downArrow) {
|
|
26
|
+
if (key.meta) {
|
|
27
|
+
store.send({ type: "Page Down" });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
store.send({ type: "Down" });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (input === "k" || key.upArrow) {
|
|
34
|
+
if (key.meta) {
|
|
35
|
+
store.send({ type: "Page Up" });
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
store.send({ type: "Up" });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (input === " " || (input === "d" && key.ctrl)) {
|
|
42
|
+
store.send({ type: "Page Down" });
|
|
43
|
+
}
|
|
44
|
+
else if (input === "b" || (input === "u" && key.ctrl)) {
|
|
45
|
+
store.send({ type: "Page Up" });
|
|
46
|
+
}
|
|
47
|
+
else if (input === "G") {
|
|
48
|
+
store.send({ type: "Bottom" });
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return (React.createElement(Box, { ...props, height: height, ref: boxRef, flexDirection: "column" },
|
|
52
|
+
haveOverflow && (React.createElement(Box, { flexDirection: "column", alignItems: "center", marginBottom: -1 }, hiddenAbove > 0 ? (React.createElement(Text, null,
|
|
53
|
+
"+ ",
|
|
54
|
+
hiddenAbove,
|
|
55
|
+
" item",
|
|
56
|
+
hiddenAbove === 1 ? "" : "s",
|
|
57
|
+
" ... press \u2191 to scroll",
|
|
58
|
+
" ")) : (React.createElement(Text, null, " ")))),
|
|
59
|
+
React.createElement(Box, { flexDirection: "column", gap: GAP, flexGrow: 1, padding: padding }, allMeasured
|
|
60
|
+
? children.map((child, index) => index >= childRange[0] && index < childRange[1]
|
|
61
|
+
? React.cloneElement(child, {
|
|
62
|
+
ref: (element) => {
|
|
63
|
+
const height = element
|
|
64
|
+
? measureElement(element).height + GAP
|
|
65
|
+
: 0;
|
|
66
|
+
if (!height)
|
|
67
|
+
return;
|
|
68
|
+
store.send({ type: "Item Measured", index, height });
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
: null)
|
|
72
|
+
:
|
|
73
|
+
React.cloneElement(children[heights.length], {
|
|
74
|
+
ref: (element) => {
|
|
75
|
+
const height = element ? measureElement(element).height + GAP : 0;
|
|
76
|
+
if (!height)
|
|
77
|
+
return;
|
|
78
|
+
store.send({ type: "Item Measured", index: heights.length, height });
|
|
79
|
+
},
|
|
80
|
+
})),
|
|
81
|
+
haveOverflow && (React.createElement(Box, { flexDirection: "column", alignItems: "center", marginTop: -1 }, hiddenBelow > 0 ? (React.createElement(Text, null,
|
|
82
|
+
"+ ",
|
|
83
|
+
hiddenBelow,
|
|
84
|
+
" item",
|
|
85
|
+
hiddenBelow === 1 ? "" : "s",
|
|
86
|
+
" ... press \u2193 to scroll")) : (React.createElement(Text, null, " "))))));
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=ScrollBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollBox.js","sourceRoot":"","sources":["../../src/components/ScrollBox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA;AACvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAA;AAGvD,MAAM,GAAG,GAAG,CAAC,CAAA;AAQb,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAC/B,CAAC,EAAC,OAAO,EAAE,GAAG,KAAK,EAA6C,EAAE,EAAE;IAChE,MAAM,EAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAA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function useScrollBoxStore(numChildren: number, availableHeight: number, width: number): import("@xstate/store").Store<{
|
|
2
|
+
offset: number;
|
|
3
|
+
heights: number[];
|
|
4
|
+
}, import("@xstate/store").ExtractEventsFromPayloadMap<{
|
|
5
|
+
Down: unknown;
|
|
6
|
+
Up: unknown;
|
|
7
|
+
"Page Down": unknown;
|
|
8
|
+
"Page Up": unknown;
|
|
9
|
+
Bottom: unknown;
|
|
10
|
+
"Item Measured": {
|
|
11
|
+
index: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=ScrollBox.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollBox.store.d.ts","sourceRoot":"","sources":["../../src/components/ScrollBox.store.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;eAyCzB,MAAM;gBAAU,MAAM;;IAQzF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createStoreWithProducer } from "@xstate/store";
|
|
2
|
+
import { produce } from "immer";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { calculateChildRange, calculateLastPageOffset, calculatePreviousPageOffset, } from "./ScrollBox.util.js";
|
|
5
|
+
const initial = {
|
|
6
|
+
offset: 0,
|
|
7
|
+
heights: [],
|
|
8
|
+
};
|
|
9
|
+
export function useScrollBoxStore(numChildren, availableHeight, width) {
|
|
10
|
+
return React.useMemo(() => createStoreWithProducer(produce, initial, {
|
|
11
|
+
"Down": (context) => {
|
|
12
|
+
const [, end] = calculateChildRange(context.heights, context.offset, availableHeight);
|
|
13
|
+
if (end < numChildren) {
|
|
14
|
+
context.offset = Math.min(context.offset + 1, numChildren - 1);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"Up": (context) => {
|
|
18
|
+
context.offset = Math.max(context.offset - 1, 0);
|
|
19
|
+
},
|
|
20
|
+
"Page Down": (context) => {
|
|
21
|
+
const [, end] = calculateChildRange(context.heights, context.offset, availableHeight);
|
|
22
|
+
if (end < numChildren - 1) {
|
|
23
|
+
context.offset = end;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"Page Up": (context) => {
|
|
27
|
+
context.offset = calculatePreviousPageOffset(context.heights, context.offset, availableHeight);
|
|
28
|
+
},
|
|
29
|
+
"Bottom": (context) => {
|
|
30
|
+
context.offset = calculateLastPageOffset(context.heights, context.offset, availableHeight);
|
|
31
|
+
},
|
|
32
|
+
"Item Measured": (context, { index, height }) => {
|
|
33
|
+
context.heights[index] = height;
|
|
34
|
+
},
|
|
35
|
+
}), [availableHeight, numChildren, width]);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ScrollBox.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollBox.store.js","sourceRoot":"","sources":["../../src/components/ScrollBox.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACH,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAA;AAE5B,MAAM,OAAO,GAAG;IACZ,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,EAAmB;CAC/B,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,eAAuB,EAAE,KAAa;IACzF,OAAO,KAAK,CAAC,OAAO,CAChB,GAAG,EAAE,CACD,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE;QACtC,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAC/B,OAAO,CAAC,OAAO,EACf,OAAO,CAAC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,4 @@
|
|
|
1
|
+
export declare function calculateChildRange(heights: Array<number>, offset: number, availableHeight: number): [number, number];
|
|
2
|
+
export declare function calculatePreviousPageOffset(heights: Array<number>, offset: number, availableHeight: number): number;
|
|
3
|
+
export declare function calculateLastPageOffset(heights: Array<number>, offset: number, availableHeight: number): number;
|
|
4
|
+
//# sourceMappingURL=ScrollBox.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollBox.util.d.ts","sourceRoot":"","sources":["../../src/components/ScrollBox.util.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACxB,CAAC,MAAM,EAAE,MAAM,CAAC,CAQlB;AAMD,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACxB,MAAM,CAQR;AAMD,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EACtB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACxB,MAAM,CAQR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function calculateChildRange(heights, offset, availableHeight) {
|
|
2
|
+
let heightUsed = 0;
|
|
3
|
+
for (let index = offset; index < heights.length; index++) {
|
|
4
|
+
heightUsed += heights[index];
|
|
5
|
+
if (heightUsed > availableHeight)
|
|
6
|
+
return [offset, Math.max(index, 1)];
|
|
7
|
+
}
|
|
8
|
+
return [offset, heights.length];
|
|
9
|
+
}
|
|
10
|
+
export function calculatePreviousPageOffset(heights, offset, availableHeight) {
|
|
11
|
+
let heightUsed = 0;
|
|
12
|
+
for (let index = offset - 1; index > 0; index--) {
|
|
13
|
+
heightUsed += heights[index];
|
|
14
|
+
if (heightUsed > availableHeight)
|
|
15
|
+
return index + 1;
|
|
16
|
+
}
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
export function calculateLastPageOffset(heights, offset, availableHeight) {
|
|
20
|
+
let heightUsed = 0;
|
|
21
|
+
for (let index = heights.length - 1; index > 0; index--) {
|
|
22
|
+
heightUsed += heights[index];
|
|
23
|
+
if (heightUsed > availableHeight)
|
|
24
|
+
return index + 1;
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ScrollBox.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollBox.util.js","sourceRoot":"","sources":["../../src/components/ScrollBox.util.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,mBAAmB,CAC/B,OAAsB,EACtB,MAAc,EACd,eAAuB;IAEvB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,KAAK,IAAI,KAAK,GAAG,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;QAC5B,IAAI,UAAU,GAAG,eAAe;YAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;AACnC,CAAC;AAMD,MAAM,UAAU,2BAA2B,CACvC,OAAsB,EACtB,MAAc,EACd,eAAuB;IAEvB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,KAAK,IAAI,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QAC9C,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;QAC5B,IAAI,UAAU,GAAG,eAAe;YAAE,OAAO,KAAK,GAAG,CAAC,CAAA;IACtD,CAAC;IAED,OAAO,CAAC,CAAA;AACZ,CAAC;AAMD,MAAM,UAAU,uBAAuB,CACnC,OAAsB,EACtB,MAAc,EACd,eAAuB;IAEvB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACtD,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;QAC5B,IAAI,UAAU,GAAG,eAAe;YAAE,OAAO,KAAK,GAAG,CAAC,CAAA;IACtD,CAAC;IAED,OAAO,CAAC,CAAA;AACZ,CAAC"}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type TypeScriptError } from "../util/typescript.js";
|
|
3
|
-
export declare function
|
|
4
|
-
error: TypeScriptError;
|
|
5
|
-
}): React.JSX.Element;
|
|
6
|
-
interface TypeScriptErrorsProps {
|
|
7
|
-
errors: Array<TypeScriptError>;
|
|
8
|
-
}
|
|
9
|
-
export declare function TypeScriptErrors({ errors }: TypeScriptErrorsProps): React.JSX.Element;
|
|
10
|
-
export {};
|
|
3
|
+
export declare function renderTypeScriptErrors(errors: Array<TypeScriptError>): React.JSX.Element[];
|
|
11
4
|
//# sourceMappingURL=TypeScriptErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeScriptErrors.d.ts","sourceRoot":"","sources":["../../src/components/TypeScriptErrors.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"TypeScriptErrors.d.ts","sourceRoot":"","sources":["../../src/components/TypeScriptErrors.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,uBAAuB,CAAA;AAgD1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,uBAEpE"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Box, Text } from "ink";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
4
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
3
|
+
const Error = React.forwardRef(({ error }, ref) => {
|
|
4
|
+
return (React.createElement(Box, { flexDirection: "column", ref: ref },
|
|
5
5
|
React.createElement(Box, null,
|
|
6
6
|
React.createElement(Text, { color: "red" },
|
|
7
|
-
"\u274C",
|
|
8
|
-
" ",
|
|
9
7
|
React.createElement(Text, { backgroundColor: "red", color: "white" },
|
|
10
8
|
" ",
|
|
11
9
|
"TYPESCRIPT ERROR",
|
|
12
|
-
" ")
|
|
10
|
+
" "),
|
|
11
|
+
" "),
|
|
13
12
|
React.createElement(Text, { bold: true }, error.text)),
|
|
14
13
|
error.location && (React.createElement(Box, { paddingTop: 1, flexDirection: "column" },
|
|
15
14
|
React.createElement(Box, { marginLeft: 4 },
|
|
@@ -33,15 +32,8 @@ export function Error({ error }) {
|
|
|
33
32
|
error.location.lineText.length +
|
|
34
33
|
1 },
|
|
35
34
|
React.createElement(Text, { color: "greenBright" }, "^")))))))));
|
|
36
|
-
}
|
|
37
|
-
export function
|
|
38
|
-
return
|
|
39
|
-
React.createElement(Text, { color: "red" },
|
|
40
|
-
errors.length,
|
|
41
|
-
" ERROR",
|
|
42
|
-
errors.length === 1 ? "" : "S",
|
|
43
|
-
":"),
|
|
44
|
-
errors.map((error, index) => (React.createElement(Box, { key: index, marginY: 1 },
|
|
45
|
-
React.createElement(Error, { error: error }))))))));
|
|
35
|
+
});
|
|
36
|
+
export function renderTypeScriptErrors(errors) {
|
|
37
|
+
return errors.map((error, index) => React.createElement(Error, { key: `TypeScriptError-${index}`, error: error }));
|
|
46
38
|
}
|
|
47
39
|
//# sourceMappingURL=TypeScriptErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeScriptErrors.js","sourceRoot":"","sources":["../../src/components/TypeScriptErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,
|
|
1
|
+
{"version":3,"file":"TypeScriptErrors.js","sourceRoot":"","sources":["../../src/components/TypeScriptErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAgC,CAAC,EAAC,KAAK,EAAC,EAAE,GAAG,EAAE,EAAE;IAC3E,OAAO,CACH,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,GAAG;QAChC,oBAAC,GAAG;YACA,oBAAC,IAAI,IAAC,KAAK,EAAC,KAAK;gBACb,oBAAC,IAAI,IAAC,eAAe,EAAC,KAAK,EAAC,KAAK,EAAC,OAAO;oBACpC,GAAG;;oBACa,GAAG,CACjB;gBAAC,GAAG,CACR;YACP,oBAAC,IAAI,IAAC,IAAI,UAAE,KAAK,CAAC,IAAI,CAAQ,CAC5B;QACL,KAAK,CAAC,QAAQ,IAAI,CACf,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ;YACtC,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBACd,oBAAC,IAAI;oBACA,KAAK,CAAC,QAAQ,CAAC,IAAI;;oBAAG,KAAK,CAAC,QAAQ,CAAC,IAAI;;oBAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAClE,CACL;YACN,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;gBAC5B,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAE,CAAC;oBACtC,oBAAC,IAAI,QAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAQ,CAChC;gBACN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;oBACvB,oBAAC,IAAI;;wBAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAQ;oBAC/C,oBAAC,GAAG;wBACA,oBAAC,IAAI,YAAS;wBACd,oBAAC,GAAG,IACA,WAAW,EACP,KAAK,CAAC,QAAQ,CAAC,SAAS;gCACxB,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM;gCACrC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM;gCAC9B,CAAC;4BAGL,oBAAC,IAAI,IAAC,KAAK,EAAC,aAAa,QAAS,CAChC,CACJ,CACJ,CACJ,CACJ,CACT,CACC,CACT,CAAA;AACL,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,sBAAsB,CAAC,MAA8B;IACjE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,oBAAC,KAAK,IAAC,GAAG,EAAE,mBAAmB,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;AACjG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFullScreen.d.ts","sourceRoot":"","sources":["../../src/hooks/useFullScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"useFullScreen.d.ts","sourceRoot":"","sources":["../../src/hooks/useFullScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAY,MAAM,KAAK,CAAA;AAGvC,eAAO,MAAM,aAAa,QAAO,KAAK,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAuBjE,CAAA"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { useStdout } from "ink";
|
|
1
2
|
import React from "react";
|
|
2
3
|
export const useFullScreen = () => {
|
|
3
|
-
const
|
|
4
|
-
const [
|
|
4
|
+
const { stdout } = useStdout();
|
|
5
|
+
const [columns, setColumns] = React.useState(stdout.columns);
|
|
6
|
+
const [rows, setRows] = React.useState(stdout.rows);
|
|
5
7
|
React.useEffect(() => {
|
|
6
8
|
const handleResize = () => {
|
|
7
|
-
setColumns(
|
|
8
|
-
setRows(
|
|
9
|
+
setColumns(stdout.columns);
|
|
10
|
+
setRows(stdout.rows);
|
|
9
11
|
};
|
|
10
|
-
|
|
12
|
+
stdout.addListener("resize", handleResize);
|
|
13
|
+
stdout.write("\x1b[?1049h");
|
|
14
|
+
process.on("beforeExit", () => {
|
|
15
|
+
stdout.write("\x1b[?1049l");
|
|
16
|
+
});
|
|
11
17
|
return () => {
|
|
12
|
-
|
|
18
|
+
stdout.removeListener("resize", handleResize);
|
|
13
19
|
};
|
|
14
20
|
}, []);
|
|
15
|
-
return { width: columns, height: rows
|
|
21
|
+
return { width: columns, height: rows };
|
|
16
22
|
};
|
|
17
23
|
//# sourceMappingURL=useFullScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFullScreen.js","sourceRoot":"","sources":["../../src/hooks/useFullScreen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFullScreen.js","sourceRoot":"","sources":["../../src/hooks/useFullScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,SAAS,EAAC,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,CAAC,MAAM,aAAa,GAAG,GAAuC,EAAE;IAClE,MAAM,EAAC,MAAM,EAAC,GAAG,SAAS,EAAE,CAAA;IAC5B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC5D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACnD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,MAAM,YAAY,GAAG,GAAG,EAAE;YACtB,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC1B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC,CAAA;QACD,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAE1C,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC3B,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QACjD,CAAC,CAAA;IAEL,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAC,CAAA;AACzC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTerminalTitle.d.ts","sourceRoot":"","sources":["../../src/hooks/useTerminalTitle.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAQpD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export function useTerminalTitle(title) {
|
|
3
|
+
React.useEffect(() => {
|
|
4
|
+
if (process.platform === "win32") {
|
|
5
|
+
process.title = title;
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
process.stdout.write(`\x1B]2;${title}\x1B\x5C`);
|
|
9
|
+
}
|
|
10
|
+
}, [title]);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=useTerminalTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTerminalTitle.js","sourceRoot":"","sources":["../../src/hooks/useTerminalTitle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACzB,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,CAAA;QACnD,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attio",
|
|
3
|
-
"version": "0.0.1-experimental.
|
|
3
|
+
"version": "0.0.1-experimental.20240729",
|
|
4
4
|
"bin": "lib/attio.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
|
38
38
|
"@swc/core": "^1.3.58",
|
|
39
39
|
"@xstate/react": "4.1.1",
|
|
40
|
+
"@xstate/store": "1.0.0",
|
|
40
41
|
"chokidar": "^3.6.0",
|
|
41
42
|
"date-fns": "^2.21.1",
|
|
42
43
|
"dotenv": "^16.4.5",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"eslint": "^8.56.0",
|
|
45
46
|
"figures": "^6.1.0",
|
|
46
47
|
"glob": "10.3.16",
|
|
48
|
+
"immer": "^5.0.0",
|
|
47
49
|
"ini": "^4.1.3",
|
|
48
50
|
"ink": "^5.0.1",
|
|
49
51
|
"ink-big-text": "^2.0.0",
|