@anweb/nuxt-ancore 1.15.10 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "AnCore",
3
3
  "configKey": "ancore",
4
- "version": "1.15.10",
4
+ "version": "1.16.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -0,0 +1,43 @@
1
+ <script setup>
2
+ import { v4 } from "uuid";
3
+ import { computed, onMounted, ref, useTemplateRef } from "vue";
4
+ import { onClickOutside } from "@vueuse/core";
5
+ const props = defineProps({
6
+ area: { type: String, required: false }
7
+ });
8
+ const id = ref();
9
+ const state = ref(false);
10
+ const refTarget = useTemplateRef("refTarget");
11
+ const toggle = (value) => {
12
+ state.value = value !== void 0 ? value : !state.value;
13
+ };
14
+ const close = () => {
15
+ toggle(false);
16
+ };
17
+ const area = computed(() => {
18
+ return props.area || "bottom span-right";
19
+ });
20
+ const name = computed(() => {
21
+ return id.value ? `--an-dropdown-${id.value}` : "";
22
+ });
23
+ onMounted(() => {
24
+ id.value = v4();
25
+ });
26
+ onClickOutside(refTarget, close);
27
+ </script>
28
+
29
+ <template>
30
+ <div ref="refTarget" class="an-dropdown__button">
31
+ <slot name="button" :toggle="toggle" />
32
+
33
+ <teleport to="body">
34
+ <div v-show="state" class="an-dropdown__menu">
35
+ <slot name="menu" :close="close" />
36
+ </div>
37
+ </teleport>
38
+ </div>
39
+ </template>
40
+
41
+ <style scoped>
42
+ .an-dropdown__button{anchor-name:v-bind(name)}.an-dropdown__menu{position:fixed;position-anchor:v-bind(name);position-area:v-bind(area);position-try-fallbacks:top span-right,bottom span-left,top span-left;z-index:1000}
43
+ </style>
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -14,7 +14,7 @@ declare module 'nuxt/schema' {
14
14
  interface PublicRuntimeConfig {
15
15
  i18n?: InitOptions<unknown> & {
16
16
  cookie?: string
17
- resources?: Record<string, { translation: string | any }>
17
+ resources?: Record<string, { translation: any }>
18
18
  }
19
19
  }
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anweb/nuxt-ancore",
3
- "version": "1.15.10",
3
+ "version": "1.16.0",
4
4
  "description": "AnCore Nuxt module",
5
5
  "repository": "https://github.com/ANLTD/ancore",
6
6
  "license": "MIT",