Skip to content

Commit f4f03bb

Browse files
authored
🔥 Improve plugins loaders (#5697)
- [x] Remove duplicated names - [x] Improve the way to load plugins and extensions - [x] Auto loading new plugins - [x] Convert to typescript - [x] Delete unused directive
1 parent 47f8474 commit f4f03bb

23 files changed

+93
-64
lines changed

argilla-frontend/nuxt.config.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,7 @@ const config: NuxtConfig = {
5656
css: ["~assets/scss/base/base.scss"],
5757

5858
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
59-
plugins: [
60-
{ src: "~/plugins/logo" },
61-
62-
{ src: "~/plugins/directives" },
63-
64-
{ src: "~/plugins/di" },
65-
66-
{ src: "~/plugins/language" },
67-
68-
{ src: "~/plugins/plugins/axios.ts" },
69-
{ src: "~/plugins/plugins/axios-cache.ts" },
70-
{ src: "~/plugins/plugins/svg-icon.js" },
71-
{ src: "~/plugins/plugins/click-outside.js" },
72-
{ src: "~/plugins/plugins/toast.ts" },
73-
{ src: "~/plugins/plugins/copy-to-clipboard.js" },
74-
{ src: "~/plugins/plugins/filters.js" },
75-
{ src: "~/plugins/plugins/vue-draggable.js" },
76-
{ src: "~/plugins/plugins/platform.ts" },
77-
{ src: "~/plugins/plugins/language.ts" },
78-
{ src: "~/plugins/plugins/color-schema" },
79-
{ src: "~/plugins/plugins/color-generator.ts" },
80-
],
59+
plugins: [{ src: "~/plugins" }],
8160

8261
// Auto import components (https://go.nuxtjs.dev/config-components)
8362
components: [

argilla-frontend/plugins/di/index.ts renamed to argilla-frontend/plugins/di/di.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
import { Context } from "@nuxt/types";
1919
import { loadDependencyContainer } from "@/v1/di";
2020

21-
export default (instance: Context) => {
22-
loadDependencyContainer(instance);
21+
export default (context: Context) => {
22+
loadDependencyContainer(context);
2323
};

argilla-frontend/plugins/directives/badge.directive.js renamed to argilla-frontend/plugins/directives/badge.directive.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
// style for button to open formular
21
import Vue from "vue";
32

4-
//NOTE - to use this directive, add to your html element where to put a badge :
3+
// NOTE - to use this directive, add to your html element where to put a badge :
54
// v-badge="{showBadge: true, verticalPosition: 'top', horizontalPosition: 'right'}"
65
// => showBadge (Boolean) to show or not the badge : true or false
76
// => verticalPosition (String) vertical position : 'top' or 'bottom'
87
// => horizontalPosition (String) horizontal position : 'right' or 'left'
98
// => size (String) height and size of the badge: '10px
109

1110
Vue.directive("badge", {
12-
bind: (element, binding) => {
11+
bind: (
12+
element,
13+
binding: {
14+
value: {
15+
showBadge: boolean;
16+
verticalPosition: string;
17+
horizontalPosition: string;
18+
backgroundColor: string;
19+
borderColor: string;
20+
size: string;
21+
};
22+
}
23+
) => {
1324
const { showBadge } = binding.value;
1425
if (showBadge) {
1526
const {

argilla-frontend/plugins/directives/circle.directive.js renamed to argilla-frontend/plugins/directives/circle.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Vue from "vue";
2+
23
Vue.directive("circle", {
34
bind: (element, binding) => {
45
let circleDiameter = "0px";

argilla-frontend/plugins/directives/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

argilla-frontend/plugins/directives/optional-field.directive.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

argilla-frontend/plugins/directives/required-field.directive.js renamed to argilla-frontend/plugins/directives/required-field.directive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import Vue from "vue";
22

33
// NOTE - to use this directive, add to your html text element where to put a asterisk :
44
// v-required-field="{ show: true, color: 'blue'}"
5-
// => color (String) the color of the asterisk : black by default
5+
// => color (String) the color of the asterisk : black by default
66

77
Vue.directive("required-field", {
8-
bind(element, binding) {
8+
bind(element, binding: { value: { show: boolean; color: string } }) {
99
const span = document.createElement("span");
1010
span.textContent = " *";
1111
span.style.color = binding.value.color;

0 commit comments

Comments
 (0)