Skip to content

Commit

Permalink
Pkg - Up deps, fix ts7056 typegen warn
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Dec 26, 2023
1 parent 092370f commit e4342aa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/luxon": "^3.3.7",
"@types/node": "^20.10.5",
"lightningcss": "^1.22.1",
"nuxt": "^3.8.2"
"nuxt": "^3.9.0"
},
"dependencies": {
"floating-vue": "2.0.0-beta.24",
Expand Down
28 changes: 18 additions & 10 deletions packages/notivue/core/createStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, shallowRef, computed, triggerRef, toRefs, reactive, nextTick } from 'vue'
import { ref, shallowRef, computed, triggerRef, toRefs, reactive, nextTick, ToRefs, Ref } from 'vue'

import { mergeDeep, mergeNotificationOptions as mergeOptions } from './utils'
import { getSlotContext } from '@/Notivue/utils'
Expand All @@ -17,9 +17,12 @@ import type {
ElementsSlice,
TimeoutsSlice,
AnimationsSlice,
NotivueConfigRequired,
} from 'notivue'

export function createConfig(userConfig: NotivueConfig) {
export function createConfig(
userConfig: NotivueConfig
): ToRefs<NotivueConfigRequired & { isTopAlign: boolean }> {
const reactiveConfig = toRefs(reactive(mergeDeep(DEFAULT_CONFIG, userConfig)))

return {
Expand Down Expand Up @@ -106,21 +109,26 @@ export function createItems(config: ConfigSlice, queue: QueueSlice) {
}
}

export function createElements() {
type RootAttrs = Partial<{ class: string; onAnimationend: () => void }>

export function createElements(): {
root: Ref<HTMLElement | null>
rootAttrs: Ref<Partial<{ class: string; onAnimationend: () => void }>>
setRootAttrs: (newAttrs: Partial<{ class: string; onAnimationend: () => void }>) => void
items: Ref<HTMLElement[]>
getSortedItems: () => HTMLElement[]
containers: Ref<HTMLElement[]>
} {
return {
root: ref<HTMLElement | null>(null),
rootAttrs: shallowRef<RootAttrs>({}),
setRootAttrs(newAttrs: RootAttrs) {
root: ref(null),
rootAttrs: shallowRef({}),
setRootAttrs(newAttrs) {
this.rootAttrs.value = newAttrs
},
items: ref<HTMLElement[]>([]),
items: ref([]),
getSortedItems() {
// This is a bit dirty, but it's better than cloning and reversing the array on every repositioning
return this.items.value.sort((a, b) => +b.dataset.notivueId! - +a.dataset.notivueId!)
},
containers: ref<HTMLElement[]>([]),
containers: ref([]),
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/notivue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"watch": "rm -rf dist && concurrently \"vite build --watch\" \"pnpm build:css --watch\""
},
"devDependencies": {
"@nuxt/kit": "^3.8.2",
"@nuxt/schema": "^3.8.2",
"@nuxt/kit": "^3.9.0",
"@nuxt/schema": "^3.9.0",
"@types/node": "^20.10.5",
"@vitejs/plugin-vue": "4.4.0",
"concurrently": "^8.2.2",
Expand Down

0 comments on commit e4342aa

Please sign in to comment.