reactive-vscode 0.2.0-beta.1 → 0.2.0-beta.3

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/dist/index.d.ts CHANGED
@@ -1,18 +1,16 @@
1
1
  /// <reference types="vscode" />
2
2
 
3
- import { Awaited as Awaited_2 } from '@vue/shared';
4
3
  import { ColorTheme } from 'vscode';
5
4
  import { CommentController } from 'vscode';
6
- import { ComputedRef } from '@vue/reactivity';
5
+ import { ComputedRef } from '@reactive-vscode/reactivity';
7
6
  import { ConfigurationScope } from 'vscode';
8
7
  import { ConfigurationTarget } from 'vscode';
9
- import { DebuggerOptions } from '@vue/reactivity';
10
8
  import { DebugSession } from 'vscode';
11
9
  import { DecorationOptions } from 'vscode';
12
10
  import { DecorationRenderOptions } from 'vscode';
13
11
  import { Disposable as Disposable_2 } from 'vscode';
14
12
  import { DocumentSelector } from 'vscode';
15
- import { EffectScope } from '@vue/reactivity';
13
+ import { EffectScope } from '@reactive-vscode/reactivity';
16
14
  import { Event as Event_2 } from 'vscode';
17
15
  import { EventEmitter } from 'vscode';
18
16
  import { Extension } from 'vscode';
@@ -21,16 +19,16 @@ import { ExtensionTerminalOptions } from 'vscode';
21
19
  import { FoldingRangeProvider } from 'vscode';
22
20
  import { GlobPattern } from 'vscode';
23
21
  import { LogLevel } from 'vscode';
24
- import { MaybeRef } from '@vue/reactivity';
25
- import { MaybeRefOrGetter } from '@vue/reactivity';
22
+ import { MaybeRef } from '@reactive-vscode/reactivity';
23
+ import { MaybeRefOrGetter } from '@reactive-vscode/reactivity';
26
24
  import { NotebookEditor } from 'vscode';
27
25
  import { NotebookRange } from 'vscode';
28
26
  import { OutputChannel } from 'vscode';
29
27
  import { Range } from 'vscode';
30
- import { Ref } from '@vue/reactivity';
28
+ import { Ref } from '@reactive-vscode/reactivity';
31
29
  import { Selection } from 'vscode';
32
- import { ShallowReactive } from '@vue/reactivity';
33
- import { ShallowRef } from '@vue/reactivity';
30
+ import { ShallowReactive } from '@reactive-vscode/reactivity';
31
+ import { ShallowRef } from '@reactive-vscode/reactivity';
34
32
  import { StatusBarAlignment } from 'vscode';
35
33
  import { StatusBarItem } from 'vscode';
36
34
  import { Task } from 'vscode';
@@ -51,10 +49,11 @@ import { TreeViewOptions } from 'vscode';
51
49
  import { Uri } from 'vscode';
52
50
  import { ViewBadge } from 'vscode';
53
51
  import { ViewColumn } from 'vscode';
52
+ import { WatchSource } from '@reactive-vscode/reactivity';
54
53
  import { WebviewOptions } from 'vscode';
55
54
  import { WebviewView } from 'vscode';
56
55
  import { WorkspaceFolder } from 'vscode';
57
- import { WritableComputedRef } from '@vue/reactivity';
56
+ import { WritableComputedRef } from '@reactive-vscode/reactivity';
58
57
 
59
58
  /* Excluded from this release type: activateCbs */
60
59
 
@@ -94,8 +93,6 @@ export declare function createSingletonComposable<T>(fn: () => T): () => T;
94
93
 
95
94
  /* Excluded from this release type: deactivateCbs */
96
95
 
97
- declare function defaultGetPrefix(type: string): string;
98
-
99
96
  /**
100
97
  * Define configurations of an extension. See `vscode::workspace.getConfiguration`.
101
98
  *
@@ -113,6 +110,40 @@ export declare function defineExtension(setup: () => void): {
113
110
  deactivate: () => void;
114
111
  };
115
112
 
113
+ /**
114
+ * Define a logger which is usable before activation.
115
+ *
116
+ * @category view
117
+ */
118
+ export declare function defineLogger(name: string, options?: UseLoggerOptions): {
119
+ logger: ShallowRef< {
120
+ outputChannel: OutputChannel;
121
+ createLoggerFunc: (type: string) => (...message: any[]) => void;
122
+ info: (...message: any[]) => void;
123
+ warn: (...message: any[]) => void;
124
+ error: (...message: any[]) => void;
125
+ append: (value: string) => void;
126
+ appendLine: (value: string) => void;
127
+ replace: (value: string) => void;
128
+ clear: () => void;
129
+ show: {
130
+ (preserveFocus?: boolean | undefined): void;
131
+ (column?: ViewColumn | undefined, preserveFocus?: boolean | undefined): void;
132
+ };
133
+ hide: () => void;
134
+ } | null>;
135
+ outputChannel: ComputedRef<OutputChannel | undefined>;
136
+ info: (...args: any[]) => void | null;
137
+ warn: (...args: any[]) => void | null;
138
+ error: (...args: any[]) => void | null;
139
+ append: (value: string) => void | null;
140
+ appendLine: (value: string) => void | null;
141
+ replace: (value: string) => void | null;
142
+ clear: () => void | null;
143
+ show: (column?: ViewColumn | undefined, preserveFocus?: boolean | undefined) => void | null;
144
+ hide: () => void | null;
145
+ };
146
+
116
147
  /**
117
148
  * Execute a command, with type checking. See `vscode::commands.executeCommand`.
118
149
  *
@@ -124,30 +155,10 @@ export declare const extensionContext: ShallowRef<ExtensionContext | null>;
124
155
 
125
156
  /* Excluded from this release type: extensionScope */
126
157
 
127
- declare type MapSources<T, Immediate> = {
128
- [K in keyof T]: T[K] extends WatchSource<infer V>
129
- ? Immediate extends true
130
- ? V | undefined
131
- : V
132
- : T[K] extends object
133
- ? Immediate extends true
134
- ? T[K] | undefined
135
- : T[K]
136
- : never
137
- }
158
+ export declare function getDefaultLoggerPrefix(type: string): string;
138
159
 
139
160
  export declare type MaybeNullableRefOrGetter<T> = T | Ref<Nullable<T>> | (() => Nullable<T>);
140
161
 
141
- declare type MultiWatchSources = (WatchSource<unknown> | object)[]
142
-
143
- export declare function nextTick<T = void, R = void>(
144
- this: T,
145
- fn?: (this: T) => R,
146
- ): Promise<Awaited_2<R>> {
147
- const p = currentFlushPromise || resolvedPromise
148
- return fn ? p.then(this ? fn.bind(this) : fn) : p
149
- }
150
-
151
162
  export declare type Nullable<T> = T | null | undefined;
152
163
 
153
164
  /**
@@ -159,8 +170,6 @@ export declare function onActivate(fn: OnActivateCb): void;
159
170
 
160
171
  declare type OnActivateCb = (context: ExtensionContext) => void;
161
172
 
162
- declare type OnCleanup = (cleanupFn: () => void) => void
163
-
164
173
  /**
165
174
  * Registers a callback to be called when the extension is deactivated.
166
175
  *
@@ -390,7 +399,7 @@ export declare function useL10nText(message: MaybeRefOrGetter<string>, args: Rec
390
399
  *
391
400
  * @category view
392
401
  */
393
- export declare function useLogger(name: string, getPrefix?: typeof defaultGetPrefix): {
402
+ export declare function useLogger(name: string, options?: UseLoggerOptions): {
394
403
  outputChannel: OutputChannel;
395
404
  createLoggerFunc: (type: string) => (...message: any[]) => void;
396
405
  info: (...message: any[]) => void;
@@ -407,6 +416,11 @@ export declare function useLogger(name: string, getPrefix?: typeof defaultGetPre
407
416
  hide: () => void;
408
417
  };
409
418
 
419
+ export declare interface UseLoggerOptions {
420
+ outputChannel?: OutputChannel;
421
+ getPrefix?: ((type: string) => string) | null;
422
+ }
423
+
410
424
  /**
411
425
  * @reactive `env.logLevel`
412
426
  */
@@ -632,94 +646,6 @@ declare type ViewWithTitle = Pick<TreeView<unknown> | WebviewView, 'title'>;
632
646
 
633
647
  declare type ViewWithVisibility = Pick<TreeView<unknown> | WebviewView, 'visible' | 'onDidChangeVisibility'>;
634
648
 
635
- export declare function watch<T, Immediate extends Readonly<boolean> = false>(
636
- source: WatchSource<T>,
637
- cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,
638
- options?: WatchOptions<Immediate>,
639
- ): WatchStopHandle
640
-
641
- export declare function watch<
642
- T extends MultiWatchSources,
643
- Immediate extends Readonly<boolean> = false,
644
- >(
645
- sources: [...T],
646
- cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>,
647
- options?: WatchOptions<Immediate>,
648
- ): WatchStopHandle
649
-
650
- export declare function watch<
651
- T extends Readonly<MultiWatchSources>,
652
- Immediate extends Readonly<boolean> = false,
653
- >(
654
- source: T,
655
- cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>,
656
- options?: WatchOptions<Immediate>,
657
- ): WatchStopHandle
658
-
659
- export declare function watch<
660
- T extends object,
661
- Immediate extends Readonly<boolean> = false,
662
- >(
663
- source: T,
664
- cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,
665
- options?: WatchOptions<Immediate>,
666
- ): WatchStopHandle
667
-
668
- export declare function watch<T = any, Immediate extends Readonly<boolean> = false>(
669
- source: T | WatchSource<T>,
670
- cb: any,
671
- options?: WatchOptions<Immediate>,
672
- ): WatchStopHandle {
673
- if (__DEV__ && !isFunction(cb)) {
674
- warn(
675
- `\`watch(fn, options?)\` signature has been moved to a separate API. ` +
676
- `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
677
- `supports \`watch(source, cb, options?) signature.`,
678
- )
679
- }
680
- return doWatch(source as any, cb, options)
681
- }
682
-
683
- export declare type WatchCallback<V = any, OV = any> = (
684
- value: V,
685
- oldValue: OV,
686
- onCleanup: OnCleanup,
687
- ) => any
688
-
689
- export declare type WatchEffect = (onCleanup: OnCleanup) => void
690
-
691
- export declare function watchEffect(
692
- effect: WatchEffect,
693
- options?: WatchOptionsBase,
694
- ): WatchStopHandle {
695
- return doWatch(effect, null, options)
696
- }
697
-
698
- export declare interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
699
- immediate?: Immediate
700
- deep?: boolean
701
- once?: boolean
702
- }
703
-
704
- export declare interface WatchOptionsBase extends DebuggerOptions {
705
- flush?: 'pre' | 'post' | 'sync'
706
- }
707
-
708
- export declare type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T)
709
-
710
- export declare type WatchStopHandle = () => void
711
-
712
- export declare function watchSyncEffect(
713
- effect: WatchEffect,
714
- options?: DebuggerOptions,
715
- ) {
716
- return doWatch(
717
- effect,
718
- null,
719
- __DEV__ ? extend({}, options as any, { flush: 'sync' }) : { flush: 'sync' },
720
- )
721
- }
722
-
723
649
  declare interface WebviewRegisterOptions {
724
650
  retainContextWhenHidden?: boolean;
725
651
  onDidReceiveMessage?: (message: any) => void;
@@ -729,6 +655,6 @@ declare interface WebviewRegisterOptions {
729
655
  }
730
656
 
731
657
 
732
- export * from "@vue/reactivity";
658
+ export * from "@reactive-vscode/reactivity";
733
659
 
734
660
  export { }