daisy-ui-kit 5.0.0-pre.25 → 5.0.0-pre.27

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.
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { CalendarOptions } from '../composables/use-calendar'
3
- import { computed, ref, watch } from 'vue'
3
+ import { computed, ref, useId, watch } from 'vue'
4
4
  import { useCalendar } from '../composables/use-calendar'
5
- import { randomString } from '../utils/random-string'
6
5
 
7
6
  const props = defineProps<{
8
7
  /** Bound value: Date object or ISO string or null */
@@ -37,8 +36,9 @@ const emit = defineEmits<{
37
36
  (e: 'update:inputValue', v: string | null): void
38
37
  }>()
39
38
 
40
- const popoverId = `calendar-popover-${randomString()}`
41
- const anchorName = `--calendar-anchor-${randomString()}`
39
+ const uniqueId = useId()
40
+ const popoverId = `calendar-popover-${uniqueId}`
41
+ const anchorName = `--calendar-anchor-${uniqueId}`
42
42
  const inputRef = ref<HTMLInputElement | null>(null)
43
43
  const popoverRef = ref<HTMLElement | null>(null)
44
44
 
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { Ref } from 'vue'
3
3
  import { provide, ref } from 'vue'
4
- import { randomString } from '../utils/random-string'
5
4
 
6
5
  const { size, xl, lg, md, sm, xs } = defineProps<{
7
6
  size?: string
@@ -15,16 +14,14 @@ const { size, xl, lg, md, sm, xs } = defineProps<{
15
14
  const activeItemId = ref<string | null>(null)
16
15
  const itemIds = ref<string[]>([])
17
16
 
18
- function registerItem() {
19
- const itemId = randomString()
17
+ function registerItem(itemId: string) {
20
18
  itemIds.value.push(itemId)
21
- function unregister() {
19
+ return function unregister() {
22
20
  itemIds.value = itemIds.value.filter(id => id !== itemId)
23
21
  if (activeItemId.value === itemId) {
24
22
  activeItemId.value = null
25
23
  }
26
24
  }
27
- return { id: itemId, unregister }
28
25
  }
29
26
 
30
27
  function setActiveItemId(itemId: string) {
@@ -33,7 +30,7 @@ function setActiveItemId(itemId: string) {
33
30
 
34
31
  export interface DockState {
35
32
  activeItemId: Ref<string | null>
36
- registerItem: () => { id: string; unregister: () => void }
33
+ registerItem: (itemId: string) => () => void
37
34
  setActiveItemId: (itemId: string) => void
38
35
  }
39
36
 
@@ -1,13 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import type { DockState } from './Dock.vue'
3
- import { inject, onUnmounted } from 'vue'
3
+ import { inject, onUnmounted, useId } from 'vue'
4
4
 
5
5
  const { active } = defineProps<{
6
6
  active?: boolean
7
7
  }>()
8
8
 
9
+ const itemId = useId()
9
10
  const { registerItem, setActiveItemId, activeItemId } = inject<DockState>('dockState')!
10
- const { id: itemId, unregister } = registerItem()
11
+ const unregister = registerItem(itemId)
11
12
 
12
13
  onUnmounted(() => {
13
14
  unregister()
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useId } from '#imports'
2
+ import { useId } from 'vue'
3
3
  import { useElementHover } from '@vueuse/core'
4
4
  import { onMounted, provide, ref, watch } from 'vue'
5
5
 
@@ -2,8 +2,7 @@
2
2
  import type { Ref } from 'vue'
3
3
 
4
4
  import { onClickOutside, useElementHover } from '@vueuse/core'
5
- import { onMounted, provide, ref } from 'vue'
6
- import { randomString } from '../utils/random-string'
5
+ import { onMounted, provide, ref, useId } from 'vue'
7
6
 
8
7
  // Define the MenuExpandState interface
9
8
  export interface MenuExpandState {
@@ -16,12 +15,10 @@ export interface MenuExpandState {
16
15
 
17
16
  // Props with defaults
18
17
  const {
19
- randomId = randomString(12),
20
18
  hover = false,
21
19
  delayLeave = 300,
22
20
  closeOnClickOutside = false,
23
21
  } = defineProps<{
24
- randomId?: string
25
22
  hover?: boolean
26
23
  delayLeave?: number
27
24
  closeOnClickOutside?: boolean
@@ -31,8 +28,9 @@ const {
31
28
  const isOpen = defineModel('open', { default: false, type: Boolean })
32
29
 
33
30
  // Generate IDs for accessibility and targeting
34
- const wrapperId = `expand-wrapper-${randomId}`
35
- const id = `expand-${randomId}`
31
+ const uniqueId = useId()
32
+ const wrapperId = `expand-wrapper-${uniqueId}`
33
+ const id = `expand-${uniqueId}`
36
34
 
37
35
  // Element reference for click outside detection
38
36
  const expandEl = ref()
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useId } from '#imports'
2
+ import { useId } from 'vue'
3
3
  import { useElementHover } from '@vueuse/core'
4
4
  import { computed, onMounted, provide, ref, watch } from 'vue'
5
5
 
package/nuxt.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ export interface ModuleOptions {
4
+ /**
5
+ * Prefix for all DaisyUI Kit components
6
+ * @default ''
7
+ */
8
+ prefix?: string
9
+ }
10
+
11
+ declare const module: NuxtModule<ModuleOptions>
12
+
13
+ export default module
package/nuxt.js CHANGED
@@ -1,28 +1,31 @@
1
- import { fileURLToPath } from 'node:url'
2
- import { defineNuxtModule } from '@nuxt/kit'
1
+ import { addImports, createResolver, defineNuxtModule } from '@nuxt/kit'
3
2
 
4
3
  export default defineNuxtModule({
5
4
  meta: {
6
5
  name: 'daisy-ui-kit',
7
6
  configKey: 'daisy',
7
+ compatibility: {
8
+ nuxt: '>=3.0.0',
9
+ },
8
10
  },
9
11
  defaults: {
10
12
  prefix: '',
11
13
  },
12
14
  setup(moduleOptions, nuxt) {
13
15
  const { prefix } = moduleOptions
16
+ const { resolve } = createResolver(import.meta.url)
14
17
 
15
- nuxt.hook('components:dirs', (dirs) => {
18
+ nuxt.hook('components:dirs', dirs => {
16
19
  dirs.push({
17
- path: fileURLToPath(new URL('./app/components', import.meta.url)),
20
+ path: resolve('./app/components'),
18
21
  prefix,
19
22
  })
20
23
  })
21
24
 
22
- nuxt.hook('composables:dirs', (dirs) => {
23
- dirs.push({
24
- path: fileURLToPath(new URL('./app/composables-docs', import.meta.url)),
25
- })
26
- })
25
+ addImports([
26
+ { name: 'useCalendar', from: resolve('./app/composables/use-calendar') },
27
+ { name: 'useDaisyTheme', from: resolve('./app/composables/use-daisy-theme') },
28
+ { name: 'useToast', from: resolve('./app/composables/use-toast') },
29
+ ])
27
30
  },
28
31
  })
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "daisy-ui-kit",
3
3
  "type": "module",
4
- "version": "5.0.0-pre.25",
4
+ "version": "5.0.0-pre.27",
5
5
  "packageManager": "pnpm@10.10.0",
6
6
  "author": "feathers.dev",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./nuxt.d.ts",
9
10
  "import": "./nuxt.js",
10
11
  "require": "./nuxt.js"
11
12
  },
12
13
  "./nuxt": {
14
+ "types": "./nuxt.d.ts",
13
15
  "import": "./nuxt.js",
14
16
  "require": "./nuxt.js"
15
17
  },
@@ -19,11 +21,13 @@
19
21
  },
20
22
  "main": "./nuxt.js",
21
23
  "module": "./nuxt.js",
24
+ "types": "./nuxt.d.ts",
22
25
  "files": [
23
26
  "app/components/*.vue",
24
27
  "app/composables/*",
25
28
  "app/utils/*",
26
- "nuxt.js"
29
+ "nuxt.js",
30
+ "nuxt.d.ts"
27
31
  ],
28
32
  "scripts": {
29
33
  "import-d1-dumps": "./import-d1-dumps.sh",
@@ -35,10 +39,10 @@
35
39
  "preview": "nuxt preview",
36
40
  "postinstall": "nuxt prepare",
37
41
  "publish": "git push origin --tags && git push origin",
38
- "release:pre": "npm version prerelease && npm publish --tag pre",
39
- "release:patch": "npm version patch && npm publish",
40
- "release:minor": "npm version minor && npm publish",
41
- "release:major": "npm version major && npm publish",
42
+ "release:pre": "node scripts/release.js prerelease",
43
+ "release:patch": "node scripts/release.js patch",
44
+ "release:minor": "node scripts/release.js minor",
45
+ "release:major": "node scripts/release.js major",
42
46
  "deploy": "pnpm run build && npx wrangler deploy"
43
47
  },
44
48
  "peerDependencies": {
@@ -1,19 +0,0 @@
1
- /**
2
- * Generate a random string of `length` characters
3
- *
4
- * Usage:
5
- * const myString = randomString(15); // This will give you a random string of 15 characters
6
- * @param length The length of the string to generate
7
- * @returns A random string of `length` characters
8
- */
9
- export function randomString(length: number = 10): string {
10
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
11
- let result = ''
12
-
13
- for (let i = 0; i < length; i++) {
14
- const randomIndex = Math.floor(Math.random() * characters.length)
15
- result += characters[randomIndex]
16
- }
17
-
18
- return result
19
- }