srcdev-nuxt-components 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -10,6 +10,12 @@ Althought this repo is public and feel free to do what you wish with it, this ha
10
10
  npm install --save nuxt-compnents
11
11
  ```
12
12
 
13
+ ## Additional reuired packages
14
+
15
+ ```bash
16
+ npm install --save @oddbird/css-anchor-positioning
17
+ ```
18
+
13
19
  Then add the dependency to their `extends` in `nuxt.config`:
14
20
 
15
21
  ```ts
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div>
3
+ <button :popovertarget class="popover-trigger">
4
+ <slot name="trigger"></slot>
5
+ </button>
6
+
7
+ <dialog popover :id="popovertarget">
8
+ <slot name="popoverCotent"></slot>
9
+ </dialog>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ const props = defineProps({
15
+ popovertarget: {
16
+ type: String,
17
+ required: true,
18
+ },
19
+ });
20
+
21
+ const anchorName = `--anchor-${useId()}`;
22
+ </script>
23
+
24
+ <style lang="css">
25
+ @layer popover-setup {
26
+ .popover-trigger {
27
+ anchor-name: v-bind(anchorName);
28
+ }
29
+
30
+ dialog {
31
+ display: none;
32
+ position: absolute;
33
+ position-anchor: v-bind(anchorName);
34
+ margin: 0;
35
+ inset: auto;
36
+ bottom: anchor(bottom);
37
+ left: anchor(right);
38
+ opacity: 0;
39
+ transition: opacity 200ms, display 200ms, overlay 200ms;
40
+ transition-behavior: allow-discrete;
41
+
42
+ position-try-fallbacks: --left;
43
+
44
+ &:popover-open {
45
+ display: block;
46
+ opacity: 1;
47
+
48
+ @starting-style {
49
+ display: block;
50
+ opacity: 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ @position-try --left {
56
+ inset: auto;
57
+ top: anchor(bottom);
58
+ right: anchor(right);
59
+ }
60
+ }
61
+ </style>
package/nuxt.config.ts CHANGED
@@ -1,11 +1,21 @@
1
1
  // https://nuxt.com/docs/api/configuration/nuxt-config
2
2
  export default defineNuxtConfig({
3
3
  devtools: { enabled: true },
4
+ app: {
5
+ head: {
6
+ htmlAttrs: {
7
+ lang: 'en',
8
+ },
9
+ titleTemplate: '%s - Nuxt Components Layer',
10
+ meta: [{ charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }],
11
+ },
12
+ },
4
13
  components: [
5
14
  {
6
15
  path: './components',
7
16
  pathPrefix: false,
8
17
  },
9
18
  ],
19
+ plugins: ['~/plugins/css-anchor-positioning.ts'],
10
20
  compatibilityDate: '2024-07-13',
11
21
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -19,16 +19,18 @@
19
19
  "assets/",
20
20
  "components/",
21
21
  "composables/",
22
+ "plugins/",
22
23
  "types/"
23
24
  ],
24
25
  "devDependencies": {
25
- "@nuxt/eslint-config": "0.6.1",
26
- "eslint": "9.14.0",
26
+ "@nuxt/eslint-config": "0.7.1",
27
+ "eslint": "9.15.0",
28
+ "nuxt": "3.14.1592",
27
29
  "release-it": "17.10.0",
28
30
  "typescript": "5.6.3"
29
31
  },
30
32
  "dependencies": {
31
- "nuxt": "3.14.159"
33
+ "@oddbird/css-anchor-positioning": "0.4.0"
32
34
  },
33
35
  "release-it": {
34
36
  "$schema": "https://unpkg.com/release-it/schema/release-it.json",
@@ -0,0 +1,11 @@
1
+ import polyfill from '@oddbird/css-anchor-positioning/fn';
2
+
3
+ export default defineNuxtPlugin(() => {
4
+ if (import.meta.client && !('anchorName' in document.documentElement.style)) {
5
+ polyfill({
6
+ elements: undefined,
7
+ excludeInlineStyles: false,
8
+ useAnimationFrame: false,
9
+ });
10
+ }
11
+ });