Compare commits

...

6 Commits

Author SHA1 Message Date
Benjamin Canac
1ecd7cefde chore(release): 1.2.7 2023-04-04 13:36:43 +02:00
Benjamin Canac
aafdfdb59c fix(useTimer): remaining after pause 2023-04-04 13:36:24 +02:00
Benjamin Canac
453ff6ca20 chore(release): 1.2.6 2023-04-04 11:26:00 +02:00
Benjamin Canac
55832b6b99 docs: ts ignore 2023-04-04 11:25:33 +02:00
Benjamin Canac
6b93bbe5cd chore(release): 1.2.5 2023-04-04 11:17:30 +02:00
Benjamin Canac
1402553145 chore(deps): bump 2023-04-04 11:17:14 +02:00
5 changed files with 905 additions and 637 deletions

View File

@@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.2.7](https://github.com/nuxtlabs/ui/compare/v1.2.6...v1.2.7) (2023-04-04)
### Bug Fixes
* **useTimer:** remaining after pause ([aafdfdb](https://github.com/nuxtlabs/ui/commit/aafdfdb59c365c542f93703dd52b4306ac935040))
### [1.2.6](https://github.com/nuxtlabs/ui/compare/v1.2.5...v1.2.6) (2023-04-04)
### [1.2.5](https://github.com/nuxtlabs/ui/compare/v1.2.4...v1.2.5) (2023-04-04)
### [1.2.4](https://github.com/nuxtlabs/ui/compare/v1.2.3...v1.2.4) (2023-04-04)
### [1.2.3](https://github.com/nuxtlabs/ui/compare/v1.2.2...v1.2.3) (2023-03-22)

View File

@@ -10,6 +10,7 @@ export default defineNuxtConfig({
}
}
},
// @ts-ignore
modules: [
// @ts-ignore
nuxtUI

View File

@@ -1,6 +1,6 @@
{
"name": "@nuxthq/ui",
"version": "1.2.4",
"version": "1.2.7",
"repository": "https://github.com/nuxtlabs/ui",
"license": "MIT",
"exports": {
@@ -28,13 +28,13 @@
"@egoist/tailwindcss-icons": "^1.0.7",
"@headlessui/vue": "1.7.10",
"@iconify-json/heroicons": "^1.1.10",
"@nuxt/kit": "^3.3.1",
"@nuxt/kit": "^3.3.3",
"@nuxtjs/color-mode": "^3.2.0",
"@nuxtjs/tailwindcss": "^6.6.0",
"@popperjs/core": "^2.11.6",
"@nuxtjs/tailwindcss": "^6.6.5",
"@popperjs/core": "^2.11.7",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.2",
"@tailwindcss/line-clamp": "^0.4.4",
"@tailwindcss/typography": "^0.5.9",
"@vueuse/core": "^9.13.0",
"@vueuse/integrations": "^9.13.0",
@@ -42,18 +42,18 @@
"defu": "^6.1.2",
"fuse.js": "^6.6.2",
"lodash-es": "^4.17.21",
"tailwindcss": "^3.2.7"
"tailwindcss": "^3.3.1"
},
"devDependencies": {
"@iconify-json/mdi": "^1.1.50",
"@nuxt/module-builder": "^0.2.1",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@types/lodash-es": "^4.17.7",
"@types/node": "^18.15.3",
"eslint": "^8.36.0",
"nuxt": "^3.3.1",
"@types/node": "^18.15.11",
"eslint": "^8.37.0",
"nuxt": "^3.3.3",
"standard-version": "^9.5.0",
"unbuild": "^1.1.2",
"unbuild": "^1.2.0",
"vue-tsc": "^1.2.0"
}
}

View File

@@ -2,16 +2,16 @@ import { ref, computed } from 'vue-demi'
import { useTimestamp } from '@vueuse/core'
import type { UseTimestampOptions } from '@vueuse/core'
export function useTimer (cb: (...args: unknown[]) => any, interval: number, options: UseTimestampOptions<true> = { controls: true }) {
export function useTimer (cb: (...args: unknown[]) => any, interval: number, options?: UseTimestampOptions<true>) {
let timer: number | null = null
const timestamp = useTimestamp(options)
const { pause: tPause, resume: tResume, timestamp } = useTimestamp({ ...(options || {}), controls: true })
const startTime = ref<number | null>(null)
const remaining = computed(() => {
if (!startTime.value) {
return
return 0
}
return interval - (timestamp.timestamp.value - startTime.value)
return interval - (timestamp.value - startTime.value)
})
function set (...args: unknown[]) {
@@ -38,18 +38,18 @@ export function useTimer (cb: (...args: unknown[]) => any, interval: number, opt
function stop () {
clear()
timestamp.pause()
tPause()
}
function pause () {
clear()
timestamp.pause()
tPause()
}
function resume () {
startTime.value = (startTime.value || 0) + (Date.now() - timestamp.timestamp.value)
timestamp.resume()
set()
tResume()
startTime.value = (startTime.value || 0) + (Date.now() - timestamp.value)
}
start()

1494
yarn.lock

File diff suppressed because it is too large Load Diff