Deno plugins (#42)

Switch from BoaJS to Deno core
This commit is contained in:
Gregory Schier
2024-06-07 10:47:41 -07:00
committed by GitHub
parent 993d4dc65d
commit 392b549646
32 changed files with 1378 additions and 5663 deletions

View File

@@ -9,7 +9,7 @@ export function FormattedError({ children }: Props) {
return (
<pre
className={classNames(
'w-full select-auto cursor-text bg-background-highlight-secondary p-3 rounded',
'font-mono text-sm w-full select-auto cursor-text bg-background-highlight-secondary p-3 rounded',
'whitespace-pre-wrap border border-fg-danger border-dashed overflow-x-auto',
)}
>

View File

@@ -7,12 +7,22 @@ import { Alert } from './Alert';
export function useAlert() {
const dialog = useDialog();
return useCallback(
({ id, title, body }: { id: string; title: DialogProps['title']; body: AlertProps['body'] }) =>
({
id,
title,
body,
size = 'sm',
}: {
id: string;
title: DialogProps['title'];
body: AlertProps['body'];
size?: DialogProps['size'];
}) =>
dialog.show({
id,
title,
hideX: true,
size: 'sm',
size,
render: ({ hide }) => Alert({ onHide: hide, body }),
}),
// eslint-disable-next-line react-hooks/exhaustive-deps

View File

@@ -2,6 +2,7 @@ import { useMutation } from '@tanstack/react-query';
import { invoke } from '@tauri-apps/api/core';
import { open } from '@tauri-apps/plugin-dialog';
import { Button } from '../components/core/Button';
import { FormattedError } from '../components/core/FormattedError';
import { VStack } from '../components/core/Stacks';
import { useDialog } from '../components/DialogContext';
import type { Environment, Folder, GrpcRequest, HttpRequest, Workspace } from '../lib/models';
@@ -77,7 +78,12 @@ export function useImportData() {
return useMutation({
onError: (err: string) => {
alert({ id: 'import-failed', title: 'Import Failed', body: err });
alert({
id: 'import-failed',
title: 'Import Failed',
size: 'md',
body: <FormattedError>{err}</FormattedError>,
});
},
mutationFn: async () => {
return new Promise<void>((resolve, reject) => {

10
src-web/plugin/runtime.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
declare global {
const YAML: {
parse: (yml: string) => unknown;
};
interface YaakContext {
foo: string;
}
}
export {};