From ec1483519edd4bb165759d8f8c6fd53e403e4244 Mon Sep 17 00:00:00 2001 From: "aslan.gama" Date: Wed, 29 Jul 2026 14:34:01 -0300 Subject: [PATCH 1/2] docs(core): Update copyright year and README --- LICENSE | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 36764ad..f0f0f7f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Aslan Gama +Copyright (c) 2026 Aslan Gama Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 2894aad..84cafe4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-

6 Dropzone support for Nuxt 3

+

6 Dropzone support for Nuxt

From 9560d1e868daa77fb0d55ac71406aa59dc6a3e57 Mon Sep 17 00:00:00 2001 From: "aslan.gama" Date: Wed, 29 Jul 2026 14:53:21 -0300 Subject: [PATCH 2/2] refactor(core): Update project configuration and dependencies Refactor project setup by updating .gitignore and .prettierignore. Update dependencies in pnpm-lock.yaml and package.json. Adjust TypeScript configurations and update README.md badges. Refactor imports in Dropzone.vue and update utility tests. --- .gitignore | 67 +++- .prettierignore | 31 +- README.md | 64 ++- eslint.config.js | 82 ++-- package.json | 1 + pnpm-lock.yaml | 10 + src/module.ts | 38 +- src/runtime/Dropzone.vue | 142 ++++--- src/runtime/common/Sets.vue | 48 +-- src/runtime/common/Single.vue | 51 +-- src/runtime/common/index.ts | 8 +- src/runtime/index.ts | 6 +- src/runtime/utils.ts | 84 ++-- test/dropzone.test.ts | 714 +++++++++++++++++----------------- test/module.test.ts | 10 +- test/utils.test.ts | 236 +++++------ tsconfig.json | 2 +- vitest.config.ts | 48 +-- 18 files changed, 876 insertions(+), 766 deletions(-) diff --git a/.gitignore b/.gitignore index 55f26dd..af24526 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,62 @@ +# Dependencies node_modules -*.iml -.idea -*.log* +.pnpm-store + +# Build outputs +dist +.output .nuxt -.vscode -.DS_STORE +.nitro + +# Lock files (library uses pnpm) +package-lock.json +yarn.lock +yarn-error.log + +# Testing coverage -dist +.nyc_output + +# TypeScript +*.tsbuildinfo + +# Documentation _book -temp tsdoc-metadata.json -yarn.lock -yarn-error.log -.output + +# Logs +*.log* +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# OS files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Editor files +.vscode/* +!.vscode/extensions.json +.idea +*.iml +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Temporary files +temp +tmp +*.tmp + +# Environment +.env +.env.local +.env.*.local diff --git a/.prettierignore b/.prettierignore index c6e6863..1fa70af 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,36 @@ +# Dependencies node_modules +pnpm-lock.yaml +package-lock.json +yarn.lock + +# Build outputs dist .nuxt .output .nitro + +# Testing coverage -playground \ No newline at end of file + +# Development +playground + +# IDE +.idea +.vscode + +# System +.DS_Store +*.log + +# Git +.git +.github + +# Documentation +CHANGELOG.md +LICENSE + +# Config +.nuxtrc \ No newline at end of file diff --git a/README.md b/README.md index 84cafe4..3de1d70 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@

6 Dropzone support for Nuxt

-
[![npm version](https://img.shields.io/npm/v/six-dropzone/latest.svg?style=flat-square&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/six-dropzone) @@ -14,7 +13,6 @@ [Demo online](https://codesandbox.io/p/devbox/jgrd5q) - --- #### Table of Content @@ -24,9 +22,9 @@ - [Installation](#installation) - [Usage](#usage) - [API](#api) - * [Props](#props) - * [Events](#events) - * [Slots](#slots) + - [Props](#props) + - [Events](#events) + - [Slots](#slots) ## Features @@ -46,9 +44,9 @@ npx nuxi@latest module add six-dropzone ### Config -***nuxt.config.js*** +_**nuxt.config.js**_ -``` js +```js { modules: [ 'six-dropzone', @@ -60,28 +58,27 @@ npx nuxi@latest module add six-dropzone ## Usage ```html - ``` @@ -90,17 +87,17 @@ npx nuxi@latest module add six-dropzone ### Props | Name | Type | Default Value | Description | -|------------------|-------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ---------------- | ----------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `dropMounted` | `String` | `undefined` | The image URL. | | `label` | `String` | `Select File` | Sets the button text | | `error-messages` | `String/String[]` | `[]` | Puts the input in an error state and passes through custom error messages. Will be combined with any validations that occur from the rules prop. This field will not trigger validation. | | `accept` | `String/String[]` | `" "` | Defines the types of files that are allowed. You can pass a single string (e.g., 'image/*') or an array of strings (e.g., ['image/png', 'image/jpeg']). | -| `multiple` | `Boolean` | `false` | Allows uploading multiple files if set to true. | +| `multiple` | `Boolean` | `false` | Allows uploading multiple files if set to true. | ### Events -| Name | Type | Description | -|---------------------|----------|-----------------------------------------------------------| +| Name | Type | Description | +| ------------------- | -------- | --------------------------------------------------------- | | `drop` | `[File]` | drop value of the component. | | `change` | `[File]` | value of the component. | | `update:modelValue` | `[File]` | Event that is emitted when the component’s model changes. | @@ -109,8 +106,8 @@ npx nuxi@latest module add six-dropzone ### Slots -| Name | Description | -|-----------|-----------------------| +| Name | Description | +| --------- | --------------------- | | `Default` | The default Vue slot. | | `Icon` | change or close icons | @@ -118,9 +115,6 @@ npx nuxi@latest module add six-dropzone Released under [MIT](/LICENSE) by [@4slan](https://github.com/4sllan). - [license]: https://img.shields.io/github/license/4sllan/six-dropzone?style=flat-square&colorA=18181B&colorB=28CF8D - [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js - [nuxt-href]: https://nuxt.com diff --git a/eslint.config.js b/eslint.config.js index 6471052..184698d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,49 +1,49 @@ -import { createConfigForNuxt } from '@nuxt/eslint-config/flat' +import { createConfigForNuxt } from '@nuxt/eslint-config/flat'; export default createConfigForNuxt({ features: { tooling: true, typescript: true }, }) - .override('nuxt/javascript', { - rules: { - curly: ['error', 'all'], - 'no-console': ['warn', { allow: ['warn', 'error'] }], - 'prefer-const': ['error'], - }, - }) - // --- BLOCO PARA VUE --- - .override('nuxt/vue/rules', { - rules: { - 'vue/html-self-closing': ['error', { + .override('nuxt/javascript', { + rules: { + curly: ['error', 'all'], + 'no-console': ['warn', { allow: ['warn', 'error'] }], + 'prefer-const': ['error'], + }, + }) + // --- BLOCO PARA VUE --- + .override('nuxt/vue/rules', { + rules: { + 'vue/html-self-closing': [ + 'error', + { html: { - void: 'always', // Exige /> em tags como ,
, - normal: 'always', // Exige /> em tags vazias como
- component: 'always' // Exige /> em componentes + void: 'always', // Exige /> em tags como ,
, + normal: 'always', // Exige /> em tags vazias como
+ component: 'always', // Exige /> em componentes }, svg: 'always', - math: 'always' - }], - 'vue/multi-word-component-names': 'off', // desativa erro de nome de componente - 'vue/attributes-order': 'off', // ignora aviso de ordem de atributos - } - }) - // ------------------------------------ - .override('nuxt/typescript/rules', { - rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/consistent-type-imports': 'off', // ignora erro de imports só como type - }, - }) - .append({ - files: [ - 'src/runtime/**/*.ts', - 'src/module.ts', + math: 'always', + }, ], - rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-explicit-any': 'off', - 'unicorn/prefer-node-protocol': 'off', - 'unicorn/prefer-number-properties': 'off', - 'curly': 'off', - }, - }) \ No newline at end of file + 'vue/multi-word-component-names': 'off', // desativa erro de nome de componente + 'vue/attributes-order': 'off', // ignora aviso de ordem de atributos + }, + }) + // ------------------------------------ + .override('nuxt/typescript/rules', { + rules: { + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/consistent-type-imports': 'off', // ignora erro de imports só como type + }, + }) + .append({ + files: ['src/runtime/**/*.ts', 'src/module.ts'], + rules: { + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'unicorn/prefer-node-protocol': 'off', + 'unicorn/prefer-number-properties': 'off', + curly: 'off', + }, + }); diff --git a/package.json b/package.json index 05cee42..e299549 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "eslint": "^10.5.0", "happy-dom": "^20.10.4", "playwright-core": "^1.61.0", + "prettier": "^3.9.6", "typescript": "^6.0.3", "vitest": "^4.1.9", "vue": "^3.5.38", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9034134..355c044 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,6 +51,9 @@ importers: playwright-core: specifier: ^1.61.0 version: 1.62.0 + prettier: + specifier: ^3.9.6 + version: 3.9.6 typescript: specifier: ^6.0.3 version: 6.0.3 @@ -3931,6 +3934,11 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier@3.9.6: + resolution: {integrity: sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==} + engines: {node: '>=14'} + hasBin: true + pretty-bytes@7.1.1: resolution: {integrity: sha512-X+vn9z8nOFZQlxOLmfJ0iKDdMD7jYTsTW12OAlCpdoE3Igik6L37pugIZi+N3usuyp5McfgKPWi12q3zvHLeGQ==} engines: {node: '>=20'} @@ -9192,6 +9200,8 @@ snapshots: prelude-ls@1.2.1: {} + prettier@3.9.6: {} + pretty-bytes@7.1.1: {} process-nextick-args@2.0.1: {} diff --git a/src/module.ts b/src/module.ts index 86e4c92..3813010 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,27 +1,27 @@ import { createResolver, defineNuxtModule, addComponent } from '@nuxt/kit'; +import type { Nuxt } from '@nuxt/schema'; -// eslint-disable-next-line @typescript-eslint/no-empty-object-type -interface ModuleOptions {} +type ModuleOptions = Record; -const PACKAGE_NAME: string = 'Six-dropzone'; +const PACKAGE_NAME = 'Six-dropzone'; export default defineNuxtModule({ - meta: { - name: PACKAGE_NAME, - configKey: 'SixDropzone', - compatibility: { - nuxt: '^4.0.0', - }, + meta: { + name: PACKAGE_NAME, + configKey: 'SixDropzone', + compatibility: { + nuxt: '^4.0.0', }, - setup(_: ModuleOptions, nuxt) { - const { resolve } = createResolver(import.meta.url); + }, + setup(_: ModuleOptions, nuxt: Nuxt) { + const { resolve } = createResolver(import.meta.url); - addComponent({ - name: 'six-dropzone', - filePath: resolve('./runtime/Dropzone.vue'), - pascalName: 'SixDropzone', - global: true, - mode: 'all', - }); - }, + addComponent({ + name: 'six-dropzone', + filePath: resolve('./runtime/Dropzone.vue'), + pascalName: 'SixDropzone', + global: true, + mode: 'all', + }); + }, }); diff --git a/src/runtime/Dropzone.vue b/src/runtime/Dropzone.vue index 43dd25e..487bcf3 100644 --- a/src/runtime/Dropzone.vue +++ b/src/runtime/Dropzone.vue @@ -1,37 +1,35 @@