Skip to content

Commit

Permalink
Type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
MatijaNovosel committed Aug 19, 2024
1 parent 5b72c85 commit 533c964
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 6 deletions.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@mdi/font": "^7.4.47",
"@supabase/supabase-js": "^2.41.1",
"@types/markdown-it": "^14.1.2",
"@vee-validate/i18n": "^4.12.6",
"@vee-validate/rules": "^4.12.6",
"@vueuse/core": "^10.9.0",
Expand Down
7 changes: 3 additions & 4 deletions src/components/memoEntry/MemoEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ const i18n = useI18n();
const { alert } = useNotifications();
const {
files,
open: openImageDialog,
reset: resetFileDialog,
onChange: onFileDialogChange
Expand Down Expand Up @@ -379,9 +378,9 @@ const interactionDisabled = computed(() => props.disabled || props.readonly || s
onFileDialogChange(async (files) => {
if (files) {
for (const file of files) {
if (file.size < MAX_FILE_SIZE) {
(state.files as File[]).push(file);
for (let i = 0; i < files.length; i++) {
if (files[i].size < MAX_FILE_SIZE) {
(state.files as File[]).push(files[i]);
} else {
alert({
text: "File too big! (Max 10MB)",
Expand Down
2 changes: 1 addition & 1 deletion src/views/Resources.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const extensions = computed(() => {
});
const groupedFiles = computed<Record<string, MemoFileDetailed[]>>(() => {
const groups = {};
const groups: Record<string, MemoFileDetailed[]> = {};
const extensions = new Set(state.files.map((f) => getExtensionFromFileName(f.name)));
for (const extension of extensions) {
Expand Down
59 changes: 59 additions & 0 deletions src/vue-smooth-dnd.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
declare module "vue3-smooth-dnd" {
import Vue from "vue";

type Payload = any;

interface DropResult {
removedIndex: number;
addedIndex: number;
payload: Payload;
element: Element;
}

interface DragEvent {
isSource: boolean;
payload: Payload;
willAcceptDrop: boolean;
}

interface NodeDescription {
value: string;
props: Vue.VNodeData;
}

interface ContainerProps {
orientation?: string;
behaviour?: string;
tag?: string | NodeDescription;
groupName?: string;
lockAxis?: string;
dragHandleSelector?: string;
nonDragAreaSelector?: string;
dragBeginDelay?: number;
animationDuration?: number;
autoScrollEnabled?: boolean;
dragClass?: string;
dropClass?: string;
removeOnDropOut?: boolean;
getChildPayload?: (index: number) => Payload;
shouldAnimateDrop?: (sourceContainerOptions: ContainerProps, payload: Payload) => boolean;
shouldAcceptDrop?: (sourceContainerOptions: ContainerProps, payload: Payload) => boolean;
getGhostParent: () => Element;
onDragStart?: (dragEvent: DragEvent) => void;
onDragEnd?: (dragEvent: DragEvent) => void;
onDrop?: (dropResult: DropResult) => void;
onDragEnter?: () => void;
onDragLeave?: () => void;
onDropReady?: (dropResult: DropResult) => void;
}

class Container extends Vue {
props: ContainerProps;
}

class Draggable extends Vue {
props: {
tag?: string | NodeDescription;
};
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"jsx": "preserve",
"lib": ["DOM", "ESNext"],
"lib": ["DOM", "ESNext", "dom.iterable"],
"baseUrl": ".",
"module": "ESNext",
"moduleResolution": "bundler",
Expand Down

0 comments on commit 533c964

Please sign in to comment.