nuxt-glorious 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "glorious",
3
3
  "configKey": "glorious",
4
- "version": "1.1.4"
4
+ "version": "1.1.5"
5
5
  }
package/dist/module.mjs CHANGED
@@ -73,7 +73,6 @@ const module = defineNuxtModule({
73
73
  dir: resolver.resolve("./runtime/assets")
74
74
  });
75
75
  });
76
- addPlugin(resolver.resolve("./runtime/plugins/Modal"));
77
76
  addPlugin(resolver.resolve("./runtime/plugins/glorious-app-setting"));
78
77
  addPlugin(resolver.resolve("./runtime/plugins/Drawer"));
79
78
  addRouteMiddleware({
@@ -30,7 +30,7 @@ const props = defineProps({
30
30
  <GButton
31
31
  class="flex justify-center items-center w-6 h-6"
32
32
  size="sm"
33
- @click="$modal(`${props.id}`)"
33
+ @click="modal(`${props.id}`)"
34
34
  >
35
35
  <GIcon name="glorious-x" color="#fff" :size="10" />
36
36
  </GButton>
@@ -11,5 +11,5 @@ interface gloriousFetchOptions {
11
11
  credentials?: "same-origin" | "include";
12
12
  watch?: Array<Object>;
13
13
  }
14
- export default function (url: string, options: gloriousFetchOptions): Promise<unknown>;
14
+ export default function (url: string, options?: gloriousFetchOptions): Promise<unknown>;
15
15
  export {};
@@ -14,7 +14,7 @@ const defaultOptions = {
14
14
  body: {},
15
15
  credentials: "same-origin"
16
16
  };
17
- export default function(url, options) {
17
+ export default function(url, options = defaultOptions) {
18
18
  const moduleConfig = useRuntimeConfig();
19
19
  options = defu(moduleConfig.public.glorious.fetch, options, defaultOptions);
20
20
  const gs = GloriousStore();
@@ -0,0 +1 @@
1
+ export default function modal(key?: string, keepData?: {}): void;
@@ -0,0 +1,26 @@
1
+ import { GloriousStore } from "#imports";
2
+ export default function modal(key = "modal", keepData = {}) {
3
+ const addBlurBackground = (key2) => {
4
+ const backgroundBlur = document.createElement("div");
5
+ backgroundBlur.classList.add("bg-blur-modal");
6
+ const nuxt = document.getElementById("__nuxt");
7
+ nuxt.appendChild(backgroundBlur);
8
+ backgroundBlur.addEventListener("click", () => {
9
+ const componentId = document.getElementById(key2);
10
+ componentId.classList.replace("open", "close");
11
+ backgroundBlur.remove();
12
+ });
13
+ };
14
+ const modal2 = document.getElementById(key);
15
+ const gloriousStore = GloriousStore();
16
+ gloriousStore.keepData = keepData;
17
+ if (modal2?.classList.contains("close")) {
18
+ modal2?.classList.replace("close", "open");
19
+ modal2.style.bottom = `-${modal2.offsetHeight}px`;
20
+ addBlurBackground(key);
21
+ } else {
22
+ modal2?.classList.add("close");
23
+ const bgBlur = document.querySelector(".bg-blur-modal");
24
+ bgBlur?.remove();
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.4",
2
+ "version": "1.1.5",
3
3
  "name": "nuxt-glorious",
4
4
  "description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
5
5
  "repository": "sajadhzj/nuxt-glorious",
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,38 +0,0 @@
1
- import { defineNuxtPlugin } from "#app";
2
- import { GloriousStore } from "../stores/GloriousStore.mjs";
3
- export default defineNuxtPlugin(() => {
4
- const methods = {
5
- addBlurBackground: (key) => {
6
- const backgroundBlur = document.createElement("div");
7
- backgroundBlur.classList.add("bg-blur-modal");
8
- const nuxt = document.getElementById("__nuxt");
9
- nuxt.appendChild(backgroundBlur);
10
- backgroundBlur.addEventListener("click", () => {
11
- const componentId = document.getElementById(key);
12
- componentId.classList.replace("open", "close");
13
- backgroundBlur.remove();
14
- });
15
- },
16
- modal: {
17
- provide: (key, keepData = {}) => {
18
- const modal = document.getElementById(key);
19
- const gloriousStore = GloriousStore();
20
- gloriousStore.keepData = keepData;
21
- if (modal?.classList.contains("close")) {
22
- modal?.classList.replace("close", "open");
23
- modal.style.bottom = `-${modal.offsetHeight}px`;
24
- methods.addBlurBackground(key);
25
- } else {
26
- modal?.classList.add("close");
27
- const bgBlur = document.querySelector(".bg-blur-modal");
28
- bgBlur?.remove();
29
- }
30
- }
31
- }
32
- };
33
- return {
34
- provide: {
35
- modal: (key = "modal", keepData = {}) => methods.modal.provide(key, keepData)
36
- }
37
- };
38
- });