reactive-vscode 0.2.0-beta.4 → 0.2.0-beta.5

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
@@ -68,6 +68,10 @@ export declare type ConfigObject<C extends object> = ShallowReactive<C & {
68
68
  * @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
69
69
  */
70
70
  $update: (key: keyof C, value: C[keyof C], configurationTarget?: Nullable<ConfigurationTarget>, overrideInLanguage?: boolean) => Promise<void>;
71
+ /**
72
+ * Set the value without updating the workspace.
73
+ */
74
+ $set: (key: keyof C, value: C[keyof C]) => void;
71
75
  }>;
72
76
 
73
77
  export declare interface ConfigRef<T> extends WritableComputedRef<T> {
@@ -77,6 +81,10 @@ export declare interface ConfigRef<T> extends WritableComputedRef<T> {
77
81
  * @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
78
82
  */
79
83
  update: (value: T, configurationTarget?: ConfigurationTarget | boolean | null, overrideInLanguage?: boolean) => Promise<void>;
84
+ /**
85
+ * Set the value without updating the workspace.
86
+ */
87
+ set: (value: T) => void;
80
88
  }
81
89
 
82
90
  export declare interface ConfigType<T> extends ObjectConstructor {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getCurrentScope as N, onScopeDispose as F, shallowRef as l, effectScope as q, computed as d, shallowReactive as L, toValue as a, watchEffect as h, watch as C, ref as x, toRaw as J, isRef as K } from "@reactive-vscode/reactivity";
2
2
  export * from "@reactive-vscode/reactivity";
3
- import { workspace as b, commands as E, window as c, debug as y, extensions as k, comments as z, env as w, EventEmitter as O, tasks as D, Uri as Y, languages as G, ColorThemeKind as V, l10n as A } from "vscode";
3
+ import { workspace as b, commands as E, window as c, debug as y, extensions as k, comments as z, env as T, EventEmitter as O, tasks as D, Uri as Y, languages as G, ColorThemeKind as V, l10n as A } from "vscode";
4
4
  function Q(e) {
5
5
  return N() ? (F(e), !0) : !1;
6
6
  }
@@ -21,46 +21,48 @@ function g(e) {
21
21
  let t;
22
22
  return () => t ?? (t = e());
23
23
  }
24
- const I = [];
24
+ const $ = [];
25
25
  function fe(e) {
26
- I.push(e);
26
+ $.push(e);
27
27
  }
28
28
  const p = l(null), R = q();
29
29
  function ve(e) {
30
30
  return {
31
- activate: (t) => (p.value = t, R.run(() => (P.map((n) => n(t)), e()))),
31
+ activate: (t) => (p.value = t, R.run(() => (I.map((n) => n(t)), e()))),
32
32
  deactivate: () => {
33
- I.map((t) => t()), R.stop();
33
+ $.map((t) => t()), R.stop();
34
34
  }
35
35
  };
36
36
  }
37
- const P = [];
38
- function $(e) {
39
- p.value ? e(p.value) : P.push(e);
37
+ const I = [];
38
+ function P(e) {
39
+ p.value ? e(p.value) : I.push(e);
40
40
  }
41
41
  function X(e, t, n) {
42
42
  const r = b.getConfiguration(e, n);
43
- function i(u, f) {
44
- const v = l(f), m = d({
45
- get: () => v.value,
46
- set: (T) => {
47
- v.value = T, r.update(u, T);
43
+ function i(u, v) {
44
+ const f = l(v), m = d({
45
+ get: () => f.value,
46
+ set: (w) => {
47
+ f.value = w, r.update(u, w);
48
48
  }
49
49
  });
50
- return m.update = async (T, H, U) => {
51
- await r.update(u, T, H, U), m.value = T;
50
+ return m.update = async (w, H, U) => {
51
+ await r.update(u, w, H, U), m.value = w;
52
+ }, m.set = (w) => {
53
+ f.value = w;
52
54
  }, m;
53
55
  }
54
56
  const o = Object.fromEntries(
55
57
  Object.keys(t).map((u) => [u, i(u, r.get(u))])
56
58
  );
57
- return $(() => {
59
+ return P(() => {
58
60
  s(b.onDidChangeConfiguration((u) => {
59
61
  if (!u.affectsConfiguration(e))
60
62
  return;
61
- const f = b.getConfiguration(e);
62
- for (const v in t)
63
- u.affectsConfiguration(`${e}.${v}`) && (o[v].value = f.get(v));
63
+ const v = b.getConfiguration(e);
64
+ for (const f in t)
65
+ u.affectsConfiguration(`${e}.${f}`) && o[f].set(v.get(f));
64
66
  }));
65
67
  }), o;
66
68
  }
@@ -68,14 +70,17 @@ function ge(e, t, n) {
68
70
  const r = X(e, t, n);
69
71
  return L({
70
72
  ...r,
71
- $update(i, o, u, f) {
72
- return r[i].update(o, u, f);
73
+ $update(i, o, u, v) {
74
+ return r[i].update(o, u, v);
75
+ },
76
+ $set(i, o) {
77
+ return r[i].set(o);
73
78
  }
74
79
  });
75
80
  }
76
81
  function he(e, t) {
77
82
  const n = l(null), r = [], i = (o) => (...u) => n.value ? n.value[o](...u) : (r.push([o, u]), null);
78
- return $(() => {
83
+ return P(() => {
79
84
  n.value = oe(e, t);
80
85
  for (const [o, u] of r)
81
86
  n.value[o](...u);
@@ -182,8 +187,8 @@ function Ee(...e) {
182
187
  function r() {
183
188
  return n() ? t.value : t.value = c.createTerminal(...e);
184
189
  }
185
- function i(f) {
186
- r().sendText(f);
190
+ function i(v) {
191
+ r().sendText(v);
187
192
  }
188
193
  function o() {
189
194
  r().show();
@@ -201,8 +206,8 @@ function Ee(...e) {
201
206
  };
202
207
  }
203
208
  const ke = g(() => {
204
- const e = l(w.shell);
205
- return s(w.onDidChangeShell((t) => {
209
+ const e = l(T.shell);
210
+ return s(T.onDidChangeShell((t) => {
206
211
  e.value = t;
207
212
  })), d(() => e.value);
208
213
  });
@@ -278,8 +283,8 @@ function Ae(e, t) {
278
283
  {
279
284
  onDidChangeFoldingRanges: n.event,
280
285
  provideFoldingRanges(i, o, u) {
281
- var f;
282
- return (f = r.value) == null ? void 0 : f.call(r, i, o, u);
286
+ var v;
287
+ return (v = r.value) == null ? void 0 : v.call(r, i, o, u);
283
288
  }
284
289
  }
285
290
  ));
@@ -297,8 +302,8 @@ const Fe = g(() => {
297
302
  const e = _();
298
303
  return d(() => e.value.kind === V.Dark || e.value.kind === V.HighContrast);
299
304
  }), Le = g(() => {
300
- const e = l(w.isTelemetryEnabled);
301
- return s(w.onDidChangeTelemetryEnabled((t) => {
305
+ const e = l(T.isTelemetryEnabled);
306
+ return s(T.onDidChangeTelemetryEnabled((t) => {
302
307
  e.value = t;
303
308
  })), d(() => e.value);
304
309
  });
@@ -306,17 +311,17 @@ function Oe(e, ...t) {
306
311
  return d(() => typeof t[0] == "object" ? A.t(a(e), J(t[0])) : A.t(a(e), ...t.map(a)));
307
312
  }
308
313
  const We = g(() => {
309
- const e = l(w.logLevel);
310
- return s(w.onDidChangeLogLevel((t) => {
314
+ const e = l(T.logLevel);
315
+ return s(T.onDidChangeLogLevel((t) => {
311
316
  e.value = t;
312
317
  })), d(() => e.value);
313
318
  });
314
319
  function ae(e, t) {
315
320
  return s(c.createOutputChannel(e, t));
316
321
  }
317
- function Ie(e) {
318
- const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), u = String(t.getMinutes()).padStart(2, "0"), f = String(t.getSeconds()).padStart(2, "0"), v = String(t.getMilliseconds()).padStart(3, "0");
319
- return `${n}-${r}-${i} ${o}:${u}:${f}.${v} [${e}] `;
322
+ function $e(e) {
323
+ const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), u = String(t.getMinutes()).padStart(2, "0"), v = String(t.getSeconds()).padStart(2, "0"), f = String(t.getMilliseconds()).padStart(3, "0");
324
+ return `${n}-${r}-${i} ${o}:${u}:${v}.${f} [${e}] `;
320
325
  }
321
326
  function oe(e, t = {}) {
322
327
  const n = t.outputChannel ?? ae(e), r = (i) => (...o) => {
@@ -356,7 +361,7 @@ function ue(e) {
356
361
  }
357
362
  });
358
363
  }
359
- function Pe(e) {
364
+ function Ie(e) {
360
365
  const t = ue(e);
361
366
  return d({
362
367
  get() {
@@ -367,7 +372,7 @@ function Pe(e) {
367
372
  }
368
373
  });
369
374
  }
370
- function $e(e) {
375
+ function Pe(e) {
371
376
  var n;
372
377
  const t = l(((n = a(e)) == null ? void 0 : n.visibleRanges) ?? []);
373
378
  return C(e, () => {
@@ -512,8 +517,8 @@ const ze = W(
512
517
  return u.treeItem;
513
518
  },
514
519
  getChildren(u) {
515
- var f;
516
- return u ? ((f = u.children) == null || f.forEach((v) => i.set(v, u)), u.children) : a(t);
520
+ var v;
521
+ return u ? ((v = u.children) == null || v.forEach((f) => i.set(f, u)), u.children) : a(t);
517
522
  },
518
523
  getParent(u) {
519
524
  return i.get(u);
@@ -562,8 +567,8 @@ const Ze = W(
562
567
  s(c.registerWebviewViewProvider(
563
568
  e,
564
569
  {
565
- resolveWebviewView(v, m) {
566
- r.value = v, i.value = m, n != null && n.onDidReceiveMessage && v.webview.onDidReceiveMessage(n.onDidReceiveMessage);
570
+ resolveWebviewView(f, m) {
571
+ r.value = f, i.value = m, n != null && n.onDidReceiveMessage && f.webview.onDidReceiveMessage(n.onDidReceiveMessage);
567
572
  }
568
573
  },
569
574
  {
@@ -579,17 +584,17 @@ const Ze = W(
579
584
  if (h(() => {
580
585
  r.value && (r.value.webview.html = `${a(t)}<!--${o.value}-->`);
581
586
  }), n != null && n.webviewOptions) {
582
- const v = n.webviewOptions;
587
+ const f = n.webviewOptions;
583
588
  h(() => {
584
- r.value && (r.value.webview.options = a(v));
589
+ r.value && (r.value.webview.options = a(f));
585
590
  });
586
591
  }
587
592
  n != null && n.title && B(r, n.title), n != null && n.badge && j(r, n.badge);
588
- function f(v) {
593
+ function v(f) {
589
594
  var m;
590
- return (m = r.value) == null ? void 0 : m.webview.postMessage(v);
595
+ return (m = r.value) == null ? void 0 : m.webview.postMessage(f);
591
596
  }
592
- return { view: r, context: i, postMessage: f, forceRefresh: u };
597
+ return { view: r, context: i, postMessage: v, forceRefresh: u };
593
598
  },
594
599
  (e) => e
595
600
  ), _e = g(() => {
@@ -607,10 +612,10 @@ const Ze = W(
607
612
  })), d(() => e.value);
608
613
  });
609
614
  export {
610
- P as activateCbs,
615
+ I as activateCbs,
611
616
  W as createKeyedComposable,
612
617
  g as createSingletonComposable,
613
- I as deactivateCbs,
618
+ $ as deactivateCbs,
614
619
  ge as defineConfigObject,
615
620
  X as defineConfigs,
616
621
  ve as defineExtension,
@@ -618,8 +623,8 @@ export {
618
623
  me as executeCommand,
619
624
  p as extensionContext,
620
625
  R as extensionScope,
621
- Ie as getDefaultLoggerPrefix,
622
- $ as onActivate,
626
+ $e as getDefaultLoggerPrefix,
627
+ P as onActivate,
623
628
  fe as onDeactivate,
624
629
  Q as tryOnScopeDispose,
625
630
  be as useAbsolutePath,
@@ -649,9 +654,9 @@ export {
649
654
  Oe as useL10nText,
650
655
  We as useLogLevel,
651
656
  oe as useLogger,
652
- Pe as useNotebookEditorSelection,
657
+ Ie as useNotebookEditorSelection,
653
658
  ue as useNotebookEditorSelections,
654
- $e as useNotebookEditorVisibleRanges,
659
+ Pe as useNotebookEditorVisibleRanges,
655
660
  Me as useOpenedTerminals,
656
661
  ae as useOutputChannel,
657
662
  je as useStatusBarItem,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactive-vscode",
3
3
  "type": "module",
4
- "version": "0.2.0-beta.4",
4
+ "version": "0.2.0-beta.5",
5
5
  "description": "Develop VSCode extension with Vue Reactivity API",
6
6
  "author": "_Kerman <kermanx@qq.com>",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@types/vscode": "^1.89.0"
38
38
  },
39
39
  "dependencies": {
40
- "@reactive-vscode/reactivity": "0.2.0-beta.4"
40
+ "@reactive-vscode/reactivity": "0.2.0-beta.5"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^20.14.2",