@tb-dev/vue 2.2.1 → 3.0.1

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,3 +1,18 @@
1
- import { WatchSource } from 'vue';
2
- export declare function log<T>(source: WatchSource<T>): import('vue').WatchHandle;
3
- export declare function warn<T>(source: WatchSource<T>): import('vue').WatchHandle;
1
+ import { MaybeNilRef } from '../../types';
2
+ export declare const console: {
3
+ readonly assert: typeof assert;
4
+ readonly debug: typeof debug;
5
+ readonly error: typeof error;
6
+ readonly info: typeof info;
7
+ readonly log: typeof log;
8
+ readonly trace: typeof trace;
9
+ readonly warn: typeof warn;
10
+ };
11
+ declare function assert(cond: MaybeNilRef<boolean>, message: string): import('vue').WatchStopHandle;
12
+ declare function debug<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
13
+ declare function error<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
14
+ declare function info<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
15
+ declare function log<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
16
+ declare function trace<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
17
+ declare function warn<T>(source: MaybeNilRef<T>): import('vue').WatchStopHandle;
18
+ export {};
package/dist/index.js CHANGED
@@ -1,14 +1,40 @@
1
- import { watch, inject as inject$1, ref, readonly, computed, effectScope, toValue, toRef } from 'vue';
1
+ import { toRef, inject as inject$1, ref, readonly, computed, effectScope, toValue } from 'vue';
2
+ import { watchImmediate, useAsyncState, useLocalStorage, tryOnScopeDispose, onKeyStroke, useSessionStorage, computedAsync, useWindowSize, useElementSize as useElementSize$1 } from '@vueuse/core';
3
+ export { useWindowSize } from '@vueuse/core';
2
4
  import { Mutex } from 'es-toolkit';
3
5
  import { unwrap, isNil } from '@tb-dev/utils';
4
- import { useAsyncState, useLocalStorage, tryOnScopeDispose, onKeyStroke, useSessionStorage, computedAsync, useWindowSize, useElementSize as useElementSize$1 } from '@vueuse/core';
5
- export { useWindowSize } from '@vueuse/core';
6
6
 
7
+ const console = {
8
+ assert,
9
+ debug,
10
+ error,
11
+ info,
12
+ log,
13
+ trace,
14
+ warn
15
+ };
16
+ function assert(cond, message) {
17
+ return watchImmediate(toRef(cond), (value) => {
18
+ globalThis.console.assert(value ?? false, message);
19
+ });
20
+ }
21
+ function debug(source) {
22
+ return watchImmediate(toRef(source), (value) => globalThis.console.debug(value));
23
+ }
24
+ function error(source) {
25
+ return watchImmediate(toRef(source), (value) => globalThis.console.error(value));
26
+ }
27
+ function info(source) {
28
+ return watchImmediate(toRef(source), (value) => globalThis.console.info(value));
29
+ }
7
30
  function log(source) {
8
- return watch(source, (value) => console.log(value));
31
+ return watchImmediate(toRef(source), (value) => globalThis.console.log(value));
32
+ }
33
+ function trace(source) {
34
+ return watchImmediate(toRef(source), (value) => globalThis.console.trace(value));
9
35
  }
10
36
  function warn(source) {
11
- return watch(source, (value) => console.warn(value));
37
+ return watchImmediate(toRef(source), (value) => globalThis.console.warn(value));
12
38
  }
13
39
 
14
40
  function create$1() {
@@ -284,4 +310,4 @@ function maybe(value, fn) {
284
310
  return isNil(_value) ? null : fn(_value);
285
311
  }
286
312
 
287
- export { asyncComputed, asyncRef, getCurrentApp, getErrorHandler, handleError, inject, localRef, log, maybe, onAltKeyDown, onCtrlKeyDown, onCtrlShiftKeyDown, onKeyDown, onShiftKeyDown, provide, runWithContext, sessionRef, setCurrentApp, setErrorHandler, tryGetCurrentApp, tryInject, tryInjectOrElse, trySetCurrentApp, useElementSize, useHeight, useHeightDiff, useMutex, useWidth, useWidthDiff, useWindowHeight, useWindowWidth, warn };
313
+ export { asyncComputed, asyncRef, console, getCurrentApp, getErrorHandler, handleError, inject, localRef, maybe, onAltKeyDown, onCtrlKeyDown, onCtrlShiftKeyDown, onKeyDown, onShiftKeyDown, provide, runWithContext, sessionRef, setCurrentApp, setErrorHandler, tryGetCurrentApp, tryInject, tryInjectOrElse, trySetCurrentApp, useElementSize, useHeight, useHeightDiff, useMutex, useWidth, useWidthDiff, useWindowHeight, useWindowWidth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/vue",
3
- "version": "2.2.1",
3
+ "version": "3.0.1",
4
4
  "description": "Vue utilities",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,18 +25,18 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@tb-dev/utils": "^7.0.8",
28
- "@vueuse/core": "^13.5.0",
29
- "es-toolkit": "^1.39.7",
28
+ "@vueuse/core": "^13.6.0",
29
+ "es-toolkit": "^1.39.8",
30
30
  "vue": "^3.5.18"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@tb-dev/eslint-config": "^8.0.3",
34
34
  "@types/node": "^24.1.0",
35
- "eslint": "^9.31.0",
35
+ "eslint": "^9.32.0",
36
36
  "prettier": "^3.6.2",
37
37
  "tslib": "^2.8.1",
38
- "typedoc": "^0.28.7",
39
- "typedoc-plugin-mdn-links": "^5.0.5",
38
+ "typedoc": "^0.28.8",
39
+ "typedoc-plugin-mdn-links": "^5.0.6",
40
40
  "typescript": "~5.8.3",
41
41
  "vite": "^7.0.6",
42
42
  "vite-plugin-dts": "^4.5.4"