reactive-vscode 0.2.10 → 0.2.13

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 _Kerman <https://github.com/KermanX>
3
+ Copyright (c) 2024 _Kerman <https://github.com/kermanx>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -23,7 +23,7 @@ Currently, most of the VSCode APIs are covered, and this project has been used i
23
23
 
24
24
  The [documentation](https://kermanx.github.io/reactive-vscode/) is complete, and the [VueUse integration](https://kermanx.github.io/reactive-vscode/guide/vueuse.html) is also available.
25
25
 
26
- However, the project is still in its 0.x and may have minor API changes. If you encounter any problems, please feel free to [open an issue](https://github.com/KermanX/reactive-vscode/issues/new).
26
+ However, the project is still in its 0.x and may have minor API changes. If you encounter any problems, please feel free to [open an issue](https://github.com/kermanx/reactive-vscode/issues/new).
27
27
 
28
28
  ### Counter Example
29
29
 
@@ -85,11 +85,11 @@ export function activate(extensionContext: ExtensionContext) {
85
85
 
86
86
  ### License
87
87
 
88
- [MIT](./LICENSE) License © 2024-PRESENT [_Kerman](https://github.com/KermanX)
88
+ [MIT](./LICENSE) License © 2024-PRESENT [_Kerman](https://github.com/kermanx)
89
89
 
90
- Source code in [the `./packages/reactivity` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/reactivity) is ported from [`@vue/runtime-core`](https://github.com/vuejs/core/blob/main/packages/runtime-core). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
90
+ Source code in [the `./packages/reactivity` directory](https://github.com/kermanx/reactive-vscode/blob/main/packages/reactivity) is ported from [`@vue/runtime-core`](https://github.com/vuejs/core/blob/main/packages/runtime-core). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
91
91
 
92
- Source code in [the `./packages/mock` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/core/src/mock) references the implementation of [`VSCode`](https://github.com/microsoft/vscode). Licensed under a [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
92
+ Source code in [the `./packages/mock` directory](https://github.com/kermanx/reactive-vscode/blob/main/packages/core/src/mock) references the implementation of [`VSCode`](https://github.com/microsoft/vscode). Licensed under a [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
93
93
 
94
94
  The logo <img src="https://kermanx.github.io/reactive-vscode/logo.svg" width="14"> is modified from [Vue Reactivity Artworks](https://github.com/vue-reactivity/art). Licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
95
95
 
@@ -104,6 +104,6 @@ Part of the docs website is ported from [VueUse](https://github.com/vueuse/vueus
104
104
  [bundle-src]: https://img.shields.io/bundlephobia/minzip/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669&label=minzip
105
105
  [bundle-href]: https://bundlephobia.com/result?p=reactive-vscode
106
106
  [license-src]: https://img.shields.io/github/license/KermanX/reactive-vscode.svg?style=flat&colorA=080f12&colorB=1fa669
107
- [license-href]: https://github.com/KermanX/reactive-vscode/blob/main/LICENSE
107
+ [license-href]: https://github.com/kermanx/reactive-vscode/blob/main/LICENSE
108
108
  [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
109
109
  [jsdocs-href]: https://www.jsdocs.io/package/reactive-vscode
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@reactive-vscode/reactivity"),s=require("vscode");function F(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function R(e,t){const o=new Map;return(...a)=>{const i=t(...a);let c=o.get(i);return c?c.refCount++:(c={data:e(...a),refCount:1},o.set(i,c)),F(()=>{--c.refCount===0&&o.delete(i)}),c.data}}function g(e){let t;return()=>t!==void 0?t:t=n.effectScope(!0).run(e)}const k=[];function Y(e){k.push(e)}const C=n.shallowRef(null),T=n.effectScope();function G(e){return{activate:t=>(C.value=t,T.run(()=>(y.map(o=>o(t)),e(t)))),deactivate:()=>{k.map(t=>t()),T.stop()}}}const y=[];function A(e){C.value?e(C.value):y.push(e)}function L(e,t,o){const a=!e,i=s.workspace.getConfiguration(a?void 0:e,o);function c(r,d){const w=n.shallowRef(d),h=n.computed({get:()=>w.value,set:f=>{w.value=f,i.update(r,f)}});return h.update=async(f,v,m)=>{await i.update(r,f,v,m),h.value=f},h.set=f=>{w.value=f},h}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{l(s.workspace.onDidChangeConfiguration(a?r=>{const d=s.workspace.getConfiguration();for(const w in t)r.affectsConfiguration(w)&&u[w].set(d.get(w))}:r=>{if(!r.affectsConfiguration(e))return;const d=s.workspace.getConfiguration(e);for(const w in t)r.affectsConfiguration(`${e}.${w}`)&&u[w].set(d.get(w))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c=n.shallowReactive({$update(u,r,d,w){return a[u].update(r,d,w)},$set(u,r){return a[u].set(r)}});for(const u in t){const r=u.split(".");let d="",w=i,h=c;for(const v of r.slice(0,-1)){d=d?`${d}.${v}`:v;const m=w=w[v]||(w[v]={});if(h[v])h=h[v];else{const I=n.shallowReactive({});Object.defineProperty(h,v,{enumerable:!0,get(){return I},set(z){function W(S,x,p){if(S)for(const D in S)W(S[D],x?`${x}.${D}`:D,p==null?void 0:p[D]);else a[x].value=p}W(m,d,z)}}),h=I}}const f=r[r.length-1];w[f]=null,Object.defineProperty(h,f,{enumerable:!0,get(){return a[u].value},set(v){a[u].value=v}})}return c}function X(e,t){const o=n.shallowRef(null),a=[],i=c=>(...u)=>o.value?o.value[c](...u):(a.push([c,u]),null);return A(()=>{o.value=K(e,t);for(const[c,u]of a)o.value[c](...u)}),{logger:o,outputChannel:n.computed(()=>{var c;return(c=o.value)==null?void 0:c.outputChannel}),info:i("info"),warn:i("warn"),error:i("error"),append:i("append"),appendLine:i("appendLine"),replace:i("replace"),clear:i("clear"),show:i("show"),hide:i("hide")}}function Z(e,...t){return s.commands.executeCommand(e,...t)}function _(e,t=!1){const o=C.value;if(!o&&!t)throw new Error("Cannot get absolute path because the extension is not activated yet");return o==null?void 0:o.asAbsolutePath(e)}function ee(e,t=!1){return n.computed(()=>_(n.toValue(e),t))}function l(e){return(n.getCurrentScope()??T).cleanups.push(e.dispose.bind(e)),e}const N=g(()=>{const e=n.shallowRef(s.window.activeColorTheme);return l(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),te=g(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return l(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),$=g(()=>{const e=n.shallowRef(s.window.activeTextEditor);return l(s.window.onDidChangeActiveTextEditor(t=>{e.value=t})),e});function M(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.getText());return n.watchEffect(()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.getText()}),l(s.workspace.onDidChangeTextDocument(a=>{a.document===n.toValue(e)&&(t.value=a.document.getText())})),t}function j(e,t,o,a={}){const{updateOn:i=["effect","documentChanged"]}=a,c="key"in t?t:l(s.window.createTextEditorDecorationType(t)),u=async()=>{const d=n.toValue(e);d&&d.setDecorations(c,typeof o=="function"?await o(d):n.toValue(o))},r=i.includes("documentChanged")?M(()=>{var d;return(d=n.toValue(e))==null?void 0:d.document}):null;return i.includes("effect")?n.watchEffect(async()=>{r==null||r.value,await u()}):r&&n.watch(r,u),{update:u}}function ne(e,t){const o=$();j(o,e,t)}const oe=g(()=>{const e=n.shallowRef(s.window.activeNotebookEditor);return l(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),ae=g(()=>{const e=n.shallowRef(s.window.activeTerminal);return l(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),ie=g(()=>{const e=n.shallowRef(s.extensions.all);return l(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function B(e,t){l(s.commands.registerCommand(e,t))}function se(e){for(const[t,o]of Object.entries(e))o&&B(t,o)}function ue(e,t){return l(s.comments.createCommentController(e,t))}function O(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.state);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.state}),l(s.window.onDidChangeTerminalState(a=>{a===n.toValue(e)&&(t.value=a.state)})),n.computed(()=>t.value)}function ce(...e){const t=n.ref(null);function o(){return!!t.value&&t.value.exitStatus==null}function a(){return o()?t.value:t.value=s.window.createTerminal(...e)}function i(r){a().sendText(r)}function c(){a().show()}function u(){o()&&(t.value.sendText(""),t.value.dispose(),t.value=null)}return n.onScopeDispose(u),{terminal:t,getIsActive:o,show:c,sendText:i,close:u,state:O(t)}}const re=g(()=>{const e=n.shallowRef(s.env.shell);return l(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const o=(a,i,c)=>{l(e(a,i,c))};return t==null||t.forEach(a=>o(a)),o}function V(e,t=[]){const o=Array.isArray(e)?e:t??[],a=l(Array.isArray(e)||e==null?new s.EventEmitter:e),i=b(a.event,o);for(const c of o)i(c);return{event:a.event,fire:a.fire.bind(a),addListener:i}}async function le(e){const t=C.value.secrets,o=n.ref(await t.get(e));return o.set=async a=>{o.value=a,await t.store(e,a)},o.remove=async()=>{o.value=void 0,await t.delete(e)},l(t.onDidChange(async a=>{a.key===e&&(o.value=await t.get(e))})),n.watch(o,a=>{a===void 0?t.delete(e):t.store(e,a)}),o}function de(e){return n.computed(()=>s.tasks.fetchTasks(n.toValue(e)))}function fe(e){return n.computed(()=>s.Uri.file(n.toValue(e)))}function we(e,t){const o=new s.EventEmitter,a=n.shallowRef();n.watchEffect(()=>{a.value&&o.fire(),a.value=n.toValue(t)}),l(s.languages.registerFoldingRangeProvider(e,{onDidChangeFoldingRanges:o.event,provideFoldingRanges(i,c,u){var r;return(r=a.value)==null?void 0:r.call(a,i,c,u)}}))}function ve(e,t,o,a){const i=n.shallowReactive(new Map),c=V(),u=V(),r=V(),d=n.computed(()=>{const f=n.toValue(e);return Array.isArray(f)?f:f instanceof Set?Array.from(f):[f]});function w(){const f=d.value;for(const[v,m]of i)f.includes(v)||(m.dispose(),i.delete(v));for(const v of f)if(!i.has(v)){const m=s.workspace.createFileSystemWatcher(v,n.toValue(t)||!1,n.toValue(o)||!1,n.toValue(a)||!1);m.onDidCreate(c.fire),m.onDidChange(u.fire),m.onDidDelete(r.fire),i.set(v,m)}}function h(){for(const f of i.values())f.dispose();i.clear()}return w(),n.watch(d,w),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{h(),w()}),n.onScopeDispose(h),{watchers:i,onDidCreate:c.event,onDidChange:u.event,onDidDelete:r.event}}const he=g(()=>{const e=N();return n.computed(()=>e.value.kind===s.ColorThemeKind.Dark||e.value.kind===s.ColorThemeKind.HighContrast)}),ge=g(()=>{const e=n.shallowRef(s.env.isTelemetryEnabled);return l(s.env.onDidChangeTelemetryEnabled(t=>{e.value=t})),n.computed(()=>e.value)});function me(e,...t){return n.computed(()=>typeof t[0]=="object"?s.l10n.t(n.toValue(e),n.toRaw(t[0])):s.l10n.t(n.toValue(e),...t.map(n.toValue)))}function H(e,t){return l(s.window.createOutputChannel(e,t))}function be(e){const t=new Date,o=String(t.getFullYear()).padStart(4,"0"),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),c=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),r=String(t.getSeconds()).padStart(2,"0"),d=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${d} [${e}] `}function K(e,t={}){const o=t.outputChannel??H(e),a=i=>(...c)=>{var u;o.appendLine((((u=t.getPrefix)==null?void 0:u.call(t,i))??"")+c.join(" "))};return{outputChannel:o,createLoggerFunc:a,info:a("INFO"),warn:a("WARN"),error:a("ERROR"),append:o.append.bind(o),appendLine:o.appendLine.bind(o),replace:o.replace.bind(o),clear:o.clear.bind(o),show:o.show.bind(o),hide:o.hide.bind(o)}}const Ce=g(()=>{const e=n.shallowRef(s.env.logLevel);return l(s.env.onDidChangeLogLevel(t=>{e.value=t})),n.computed(()=>e.value)});function q(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.selections)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.selections)??[]}),l(s.window.onDidChangeNotebookEditorSelection(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.selections)})),n.computed({get(){return t.value},set(a){t.value=a;const i=n.toValue(e);i&&(i.selections=a)}})}function Ve(e){const t=q(e);return n.computed({get(){return t.value[0]},set(o){t.value=t.value.toSpliced(0,1,o)}})}function pe(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),l(s.window.onDidChangeNotebookEditorVisibleRanges(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}const De=g(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return l(s.window.onDidOpenTerminal(t)),l(s.window.onDidCloseTerminal(t)),e});function Te(e={}){const t=l(s.window.createQuickPick()),o=b(t.onDidChangeActive),a=b(t.onDidChangeSelection),i=b(t.onDidAccept),c=b(t.onDidHide),u=b(t.onDidTriggerButton),r=b(t.onDidChangeValue);["items","buttons","title","step","totalSteps","enabled","busy","ignoreFocusOut","placeholder","canSelectMany","matchOnDescription","matchOnDetail","keepScrollPosition"].forEach(f=>{e[f]&&n.watchEffect(()=>t[f]=n.toValue(e[f]))}),e.value&&(t.value=e.value);const d=n.shallowRef(t.value);r(f=>d.value=f),e.activeItems&&(t.activeItems=e.activeItems);const w=n.shallowRef(t.activeItems);o(f=>w.value=f),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return a(f=>h.value=f),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:d,activeItems:w,selectedItems:h}}function Ee(e){const t=l(e.id?s.window.createStatusBarItem(e.id,e.alignment,e.priority):s.window.createStatusBarItem(e.alignment,e.priority));function o(a){const i=e[a];i!=null&&n.watchEffect(()=>t[a]=n.toValue(i))}return["name","text","tooltip","color","backgroundColor","command","accessibilityInformation"].forEach(o),t}const Se=g(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return l(s.tasks.onDidStartTask(t)),l(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function xe(...e){const t=l(s.window.createTerminal(...e));return{terminal:t,get name(){return t.name},get processId(){return t.processId},get creationOptions(){return t.creationOptions},get exitStatus(){return t.exitStatus},get shellIntegration(){return t.shellIntegration},sendText:t.sendText.bind(t),show:t.show.bind(t),hide:t.hide.bind(t),state:O(t)}}function Q(e,t){l(s.commands.registerTextEditorCommand(e,t))}function Re(e){for(const[t,o]of Object.entries(e))Q(t,o)}function U(e,t){var a;const o=n.shallowRef(((a=n.toValue(e))==null?void 0:a.selections)??[]);return n.watch(e,()=>{var i;o.value=((i=n.toValue(e))==null?void 0:i.selections)??[]}),l(s.window.onDidChangeTextEditorSelection(i=>{const c=n.toValue(e),u=n.toValue(t);i.textEditor===c&&(!u||u.includes(i.kind))&&(o.value=i.selections)})),n.computed({get(){return o.value},set(i){o.value=i;const c=n.toValue(e);c&&(c.selections=i)}})}function ke(e,t){const o=U(e,t);return n.computed({get(){return o.value[0]},set(a){o.value=o.value.toSpliced(0,1,a)}})}function ye(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.viewColumn);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.viewColumn}),l(s.window.onDidChangeTextEditorViewColumn(a=>{a.textEditor===n.toValue(e)&&(t.value=a.viewColumn)})),n.computed(()=>t.value)}function Ae(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),l(s.window.onDidChangeTextEditorVisibleRanges(a=>{a.textEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}function P(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.badge=n.toValue(t))})}function E(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.title=n.toValue(t))})}const Oe=R((e,t,o)=>{const a=V();n.watch(t,()=>a.fire()),o!=null&&o.watchSource&&n.watch(o.watchSource,()=>a.fire());const i=new WeakMap,c=l(s.window.createTreeView(e,{...o,treeDataProvider:{...o,onDidChangeTreeData:a.event,getTreeItem(u){return u.treeItem},getChildren(u){var r;return u?((r=u.children)==null||r.forEach(d=>i.set(d,u)),u.children):n.toValue(t)},getParent(u){return i.get(u)}}}));return o!=null&&o.title&&E(c,o.title),o!=null&&o.badge&&P(c,o.badge),c},e=>e);function Pe(e){var a;const t=n.ref((a=n.toValue(e))==null?void 0:a.visible);function o(){var i;t.value=(i=n.toValue(e))==null?void 0:i.visible}return n.watchEffect(i=>{const c=n.toValue(e);if(c){const u=c.onDidChangeVisibility(o);i(()=>u.dispose())}}),n.watchEffect(o),n.computed(()=>!!t.value)}const Ie=g(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return l(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),We=g(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return l(s.window.onDidChangeVisibleTextEditors(t=>{e.value=t})),e});function Fe(e,t,o=!0){const a=n.isRef(t)?t:typeof t=="function"?n.computed(t):n.ref(t);return n.watchEffect(()=>{n.toValue(o)&&s.commands.executeCommand("setContext",e,a.value)}),a}function Le(e,t,o,a,i){const c=n.shallowRef(),u=l(s.window.createWebviewPanel(e,n.toValue(t),a,{enableFindWidget:i==null?void 0:i.enableFindWidget,retainContextWhenHidden:i==null?void 0:i.retainContextWhenHidden,...n.toValue(i==null?void 0:i.webviewOptions)}));i!=null&&i.onDidReceiveMessage&&u.webview.onDidReceiveMessage(i.onDidReceiveMessage);const r=n.ref(0);function d(){r.value++}if(n.watchEffect(()=>{u.webview.html=`${n.toValue(o)}<!--${r.value}-->`}),i!=null&&i.webviewOptions){const v=i.webviewOptions;n.watchEffect(()=>{u.webview.options=n.toValue(v)})}E(u,t);function w(v){return u.webview.postMessage(v)}const h=n.ref(u.active),f=n.ref(u.visible);return l(u.onDidChangeViewState(()=>{h.value=u.active,f.value=u.visible})),{panel:u,context:c,active:h,visible:f,postMessage:w,forceRefresh:d}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();l(s.window.registerWebviewViewProvider(e,{resolveWebviewView(d,w){a.value=d,i.value=w,o!=null&&o.onDidReceiveMessage&&d.webview.onDidReceiveMessage(o.onDidReceiveMessage)}},{webviewOptions:{retainContextWhenHidden:o==null?void 0:o.retainContextWhenHidden}}));const c=n.ref(0);function u(){c.value++}if(n.watchEffect(()=>{a.value&&(a.value.webview.html=`${n.toValue(t)}<!--${c.value}-->`)}),o!=null&&o.webviewOptions){const d=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(d))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&P(a,o.badge);function r(d){var w;return(w=a.value)==null?void 0:w.webview.postMessage(d)}return{view:a,context:i,postMessage:r,forceRefresh:u}},e=>e),$e=g(()=>{const e=n.shallowRef(s.window.state);return l(s.window.onDidChangeWindowState(t=>{e.value=t})),{focused:n.computed(()=>e.value.focused),active:n.computed(()=>e.value.active)}}),Me=g(()=>{const e=n.shallowRef(s.workspace.workspaceFolders);return l(s.workspace.onDidChangeWorkspaceFolders(()=>{e.value=s.workspace.workspaceFolders})),n.computed(()=>e.value)});exports.activateCbs=y;exports.createKeyedComposable=R;exports.createSingletonComposable=g;exports.deactivateCbs=k;exports.defineConfigObject=J;exports.defineConfigs=L;exports.defineExtension=G;exports.defineLogger=X;exports.executeCommand=Z;exports.extensionContext=C;exports.extensionScope=T;exports.getDefaultLoggerPrefix=be;exports.onActivate=A;exports.onDeactivate=Y;exports.tryOnScopeDispose=F;exports.useAbsolutePath=ee;exports.useActiveColorTheme=N;exports.useActiveDebugSession=te;exports.useActiveEditorDecorations=ne;exports.useActiveNotebookEditor=oe;exports.useActiveTerminal=ae;exports.useActiveTextEditor=$;exports.useAllExtensions=ie;exports.useCommand=B;exports.useCommands=se;exports.useCommentController=ue;exports.useControlledTerminal=ce;exports.useDefaultShell=re;exports.useDisposable=l;exports.useDocumentText=M;exports.useEditorDecorations=j;exports.useEvent=b;exports.useEventEmitter=V;exports.useExtensionSecret=le;exports.useFetchTasks=de;exports.useFileUri=fe;exports.useFoldingRangeProvider=we;exports.useFsWatcher=ve;exports.useIsDarkTheme=he;exports.useIsTelemetryEnabled=ge;exports.useL10nText=me;exports.useLogLevel=Ce;exports.useLogger=K;exports.useNotebookEditorSelection=Ve;exports.useNotebookEditorSelections=q;exports.useNotebookEditorVisibleRanges=pe;exports.useOpenedTerminals=De;exports.useOutputChannel=H;exports.useQuickPick=Te;exports.useStatusBarItem=Ee;exports.useTaskExecutions=Se;exports.useTerminal=xe;exports.useTerminalState=O;exports.useTextEditorCommand=Q;exports.useTextEditorCommands=Re;exports.useTextEditorSelection=ke;exports.useTextEditorSelections=U;exports.useTextEditorViewColumn=ye;exports.useTextEditorVisibleRanges=Ae;exports.useTreeView=Oe;exports.useViewBadge=P;exports.useViewTitle=E;exports.useViewVisibility=Pe;exports.useVisibleNotebookEditors=Ie;exports.useVisibleTextEditors=We;exports.useVscodeContext=Fe;exports.useWebviewPanel=Le;exports.useWebviewView=Ne;exports.useWindowState=$e;exports.useWorkspaceFolders=Me;Object.keys(n).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@reactive-vscode/reactivity"),s=require("vscode");function F(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function R(e,t){const o=new Map;return(...a)=>{const i=t(...a);let c=o.get(i);return c?c.refCount++:(c={data:e(...a),refCount:1},o.set(i,c)),F(()=>{--c.refCount===0&&o.delete(i)}),c.data}}function g(e){let t;return()=>t!==void 0?t:t=n.effectScope(!0).run(e)}const k=[];function Y(e){k.push(e)}const C=n.shallowRef(null),D=n.effectScope();function G(e){return{activate:t=>(C.value=t,D.run(()=>(y.map(o=>o(t)),e(t)))),deactivate:()=>{k.map(t=>t()),D.stop()}}}const y=[];function A(e){C.value?e(C.value):y.push(e)}function L(e,t,o){const a=!e,i=s.workspace.getConfiguration(a?void 0:e,o);function c(r,l){const f=n.shallowRef(l),h=n.computed({get:()=>f.value,set:w=>{f.value=w,i.update(r,w)}});return h.update=async(w,v,m)=>{await i.update(r,w,v,m),h.value=w},h.set=w=>{f.value=w},h}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{d(s.workspace.onDidChangeConfiguration(a?r=>{const l=s.workspace.getConfiguration();for(const f in t)r.affectsConfiguration(f)&&u[f].set(l.get(f))}:r=>{if(!r.affectsConfiguration(e))return;const l=s.workspace.getConfiguration(e);for(const f in t)r.affectsConfiguration(`${e}.${f}`)&&u[f].set(l.get(f))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c=n.shallowReactive({$update(u,r,l,f){return a[u].update(r,l,f)},$set(u,r){return a[u].set(r)}});for(const u in t){const r=u.split(".");let l="",f=i,h=c;for(const v of r.slice(0,-1)){l=l?`${l}.${v}`:v;const m=f=f[v]||(f[v]={});if(h[v])h=h[v];else{const O=n.shallowReactive({});Object.defineProperty(h,v,{enumerable:!0,get(){return O},set(z){function W(S,x,p){if(S)for(const T in S)W(S[T],x?`${x}.${T}`:T,p==null?void 0:p[T]);else a[x].value=p}W(m,l,z)}}),h=O}}const w=r[r.length-1];f[w]=null,Object.defineProperty(h,w,{enumerable:!0,get(){return a[u].value},set(v){a[u].value=v}})}return c}function X(e,t){const o=n.shallowRef(null),a=[],i=c=>(...u)=>o.value?o.value[c](...u):(a.push([c,u]),null);return A(()=>{o.value=K(e,t);for(const[c,u]of a)o.value[c](...u)}),{logger:o,outputChannel:n.computed(()=>{var c;return(c=o.value)==null?void 0:c.outputChannel}),info:i("info"),warn:i("warn"),error:i("error"),append:i("append"),appendLine:i("appendLine"),replace:i("replace"),clear:i("clear"),show:i("show"),hide:i("hide")}}function Z(e,...t){return s.commands.executeCommand(e,...t)}function _(e,t=!1){const o=C.value;if(!o&&!t)throw new Error("Cannot get absolute path because the extension is not activated yet");return o==null?void 0:o.asAbsolutePath(e)}function ee(e,t=!1){return n.computed(()=>_(n.toValue(e),t))}function d(e){return(n.getCurrentScope()??D).cleanups.push(e.dispose.bind(e)),e}const N=g(()=>{const e=n.shallowRef(s.window.activeColorTheme);return d(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),te=g(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return d(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),$=g(()=>{const e=n.shallowRef(s.window.activeTextEditor);return d(s.window.onDidChangeActiveTextEditor(t=>{e.value=t})),e});function M(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.getText());return n.watchEffect(()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.getText()}),d(s.workspace.onDidChangeTextDocument(a=>{a.document===n.toValue(e)&&(t.value=a.document.getText())})),t}function j(e,t,o,a={}){const{updateOn:i=["effect","documentChanged"]}=a,c=n.computed(l=>{l==null||l.dispose();const f=n.toValue(t);return"key"in f?f:d(s.window.createTextEditorDecorationType(f))}),u=async()=>{const l=n.toValue(e);l&&l.setDecorations(c.value,typeof o=="function"?await o(l):n.toValue(o))},r=i.includes("documentChanged")?M(()=>{var l;return(l=n.toValue(e))==null?void 0:l.document}):null;return i.includes("effect")?n.watchEffect(async()=>{r==null||r.value,await u()}):r&&n.watch(r,u),{update:u}}function ne(e,t){const o=$();j(o,e,t)}const oe=g(()=>{const e=n.shallowRef(s.window.activeNotebookEditor);return d(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),ae=g(()=>{const e=n.shallowRef(s.window.activeTerminal);return d(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),ie=g(()=>{const e=n.shallowRef(s.extensions.all);return d(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function B(e,t){d(s.commands.registerCommand(e,t))}function se(e){for(const[t,o]of Object.entries(e))o&&B(t,o)}function ue(e,t){return d(s.comments.createCommentController(e,t))}function P(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.state);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.state}),d(s.window.onDidChangeTerminalState(a=>{a===n.toValue(e)&&(t.value=a.state)})),n.computed(()=>t.value)}function ce(...e){const t=n.ref(null);function o(){return!!t.value&&t.value.exitStatus==null}function a(){return o()?t.value:t.value=s.window.createTerminal(...e)}function i(r){a().sendText(r)}function c(){a().show()}function u(){o()&&(t.value.sendText(""),t.value.dispose(),t.value=null)}return n.onScopeDispose(u),{terminal:t,getIsActive:o,show:c,sendText:i,close:u,state:P(t)}}const re=g(()=>{const e=n.shallowRef(s.env.shell);return d(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const o=(a,i,c)=>{d(e(a,i,c))};return t==null||t.forEach(a=>o(a)),o}function V(e,t=[]){const o=Array.isArray(e)?e:t??[],a=d(Array.isArray(e)||e==null?new s.EventEmitter:e),i=b(a.event,o);for(const c of o)i(c);return{event:a.event,fire:a.fire.bind(a),addListener:i}}async function le(e){const t=C.value.secrets,o=n.ref(await t.get(e));return o.set=async a=>{o.value=a,await t.store(e,a)},o.remove=async()=>{o.value=void 0,await t.delete(e)},d(t.onDidChange(async a=>{a.key===e&&(o.value=await t.get(e))})),n.watch(o,a=>{a===void 0?t.delete(e):t.store(e,a)}),o}function de(e){return n.computed(()=>s.tasks.fetchTasks(n.toValue(e)))}function fe(e){return n.computed(()=>s.Uri.file(n.toValue(e)))}function we(e,t){const o=new s.EventEmitter,a=n.shallowRef();n.watchEffect(()=>{a.value&&o.fire(),a.value=n.toValue(t)}),d(s.languages.registerFoldingRangeProvider(e,{onDidChangeFoldingRanges:o.event,provideFoldingRanges(i,c,u){var r;return(r=a.value)==null?void 0:r.call(a,i,c,u)}}))}function ve(e,t,o,a){const i=n.shallowReactive(new Map),c=V(),u=V(),r=V(),l=n.computed(()=>{const w=n.toValue(e);return Array.isArray(w)?w:w instanceof Set?Array.from(w):[w]});function f(){const w=l.value;for(const[v,m]of i)w.includes(v)||(m.dispose(),i.delete(v));for(const v of w)if(!i.has(v)){const m=s.workspace.createFileSystemWatcher(v,n.toValue(t)||!1,n.toValue(o)||!1,n.toValue(a)||!1);m.onDidCreate(c.fire),m.onDidChange(u.fire),m.onDidDelete(r.fire),i.set(v,m)}}function h(){for(const w of i.values())w.dispose();i.clear()}return f(),n.watch(l,f),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{h(),f()}),n.onScopeDispose(h),{watchers:i,onDidCreate:c.event,onDidChange:u.event,onDidDelete:r.event}}const he=g(()=>{const e=N();return n.computed(()=>e.value.kind===s.ColorThemeKind.Dark||e.value.kind===s.ColorThemeKind.HighContrast)}),ge=g(()=>{const e=n.shallowRef(s.env.isTelemetryEnabled);return d(s.env.onDidChangeTelemetryEnabled(t=>{e.value=t})),n.computed(()=>e.value)});function me(e,...t){return n.computed(()=>typeof t[0]=="object"?s.l10n.t(n.toValue(e),n.toRaw(t[0])):s.l10n.t(n.toValue(e),...t.map(n.toValue)))}function H(e,t){return d(s.window.createOutputChannel(e,t))}function be(e){const t=new Date,o=String(t.getFullYear()).padStart(4,"0"),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),c=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),r=String(t.getSeconds()).padStart(2,"0"),l=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${l} [${e}] `}function K(e,t={}){const o=t.outputChannel??H(e),a=i=>(...c)=>{var u;o.appendLine((((u=t.getPrefix)==null?void 0:u.call(t,i))??"")+c.join(" "))};return{outputChannel:o,createLoggerFunc:a,info:a("INFO"),warn:a("WARN"),error:a("ERROR"),append:o.append.bind(o),appendLine:o.appendLine.bind(o),replace:o.replace.bind(o),clear:o.clear.bind(o),show:o.show.bind(o),hide:o.hide.bind(o)}}const Ce=g(()=>{const e=n.shallowRef(s.env.logLevel);return d(s.env.onDidChangeLogLevel(t=>{e.value=t})),n.computed(()=>e.value)});function q(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.selections)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.selections)??[]}),d(s.window.onDidChangeNotebookEditorSelection(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.selections)})),n.computed({get(){return t.value},set(a){t.value=a;const i=n.toValue(e);i&&(i.selections=a)}})}function Ve(e){const t=q(e);return n.computed({get(){return t.value[0]},set(o){t.value=t.value.toSpliced(0,1,o)}})}function pe(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),d(s.window.onDidChangeNotebookEditorVisibleRanges(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}const Te=g(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return d(s.window.onDidOpenTerminal(t)),d(s.window.onDidCloseTerminal(t)),e});function De(e={}){const t=d(s.window.createQuickPick()),o=b(t.onDidChangeActive),a=b(t.onDidChangeSelection),i=b(t.onDidAccept),c=b(t.onDidHide),u=b(t.onDidTriggerButton),r=b(t.onDidChangeValue);["items","buttons","title","step","totalSteps","enabled","busy","ignoreFocusOut","placeholder","canSelectMany","matchOnDescription","matchOnDetail","keepScrollPosition"].forEach(w=>{e[w]&&n.watchEffect(()=>t[w]=n.toValue(e[w]))}),e.value&&(t.value=e.value);const l=n.shallowRef(t.value);r(w=>l.value=w),e.activeItems&&(t.activeItems=e.activeItems);const f=n.shallowRef(t.activeItems);o(w=>f.value=w),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return a(w=>h.value=w),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:l,activeItems:f,selectedItems:h}}function Ee(e){const t=d(e.id?s.window.createStatusBarItem(e.id,e.alignment,e.priority):s.window.createStatusBarItem(e.alignment,e.priority));function o(a){const i=e[a];i!=null&&n.watchEffect(()=>t[a]=n.toValue(i))}return["name","text","tooltip","color","backgroundColor","command","accessibilityInformation"].forEach(o),e.visible!=null&&n.watchEffect(()=>{n.toValue(e.visible)?t.show():t.hide()}),t}const Se=g(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return d(s.tasks.onDidStartTask(t)),d(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function xe(...e){const t=d(s.window.createTerminal(...e));return{terminal:t,get name(){return t.name},get processId(){return t.processId},get creationOptions(){return t.creationOptions},get exitStatus(){return t.exitStatus},get shellIntegration(){return t.shellIntegration},sendText:t.sendText.bind(t),show:t.show.bind(t),hide:t.hide.bind(t),state:P(t)}}function Q(e,t){d(s.commands.registerTextEditorCommand(e,t))}function Re(e){for(const[t,o]of Object.entries(e))Q(t,o)}function U(e,t){var a;const o=n.shallowRef(((a=n.toValue(e))==null?void 0:a.selections)??[]);return n.watch(e,()=>{var i;o.value=((i=n.toValue(e))==null?void 0:i.selections)??[]}),d(s.window.onDidChangeTextEditorSelection(i=>{const c=n.toValue(e),u=n.toValue(t);i.textEditor===c&&(!u||u.includes(i.kind))&&(o.value=i.selections)})),n.computed({get(){return o.value},set(i){o.value=i;const c=n.toValue(e);c&&(c.selections=i)}})}function ke(e,t){const o=U(e,t);return n.computed({get(){return o.value[0]},set(a){o.value=o.value.toSpliced(0,1,a)}})}function ye(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.viewColumn);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.viewColumn}),d(s.window.onDidChangeTextEditorViewColumn(a=>{a.textEditor===n.toValue(e)&&(t.value=a.viewColumn)})),n.computed(()=>t.value)}function Ae(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),d(s.window.onDidChangeTextEditorVisibleRanges(a=>{a.textEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}function I(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.badge=n.toValue(t))})}function E(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.title=n.toValue(t))})}const Pe=R((e,t,o)=>{const a=V();n.watch(t,()=>a.fire()),o!=null&&o.watchSource&&n.watch(o.watchSource,()=>a.fire());const i=new WeakMap,c=d(s.window.createTreeView(e,{...o,treeDataProvider:{...o,onDidChangeTreeData:a.event,getTreeItem(u){return u.treeItem},getChildren(u){var r;return u?((r=u.children)==null||r.forEach(l=>i.set(l,u)),u.children):n.toValue(t)},getParent(u){return i.get(u)}}}));return o!=null&&o.title&&E(c,o.title),o!=null&&o.badge&&I(c,o.badge),c},e=>e);function Ie(e){var a;const t=n.ref((a=n.toValue(e))==null?void 0:a.visible);function o(){var i;t.value=(i=n.toValue(e))==null?void 0:i.visible}return n.watchEffect(i=>{const c=n.toValue(e);if(c){const u=c.onDidChangeVisibility(o);i(()=>u.dispose())}}),n.watchEffect(o),n.computed(()=>!!t.value)}const Oe=g(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return d(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),We=g(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return d(s.window.onDidChangeVisibleTextEditors(t=>{e.value=t})),e});function Fe(e,t,o=!0){const a=n.isRef(t)?t:typeof t=="function"?n.computed(t):n.ref(t);return n.watchEffect(()=>{n.toValue(o)&&s.commands.executeCommand("setContext",e,a.value)}),a}function Le(e,t,o,a,i){const c=n.shallowRef(),u=d(s.window.createWebviewPanel(e,n.toValue(t),a,{enableFindWidget:i==null?void 0:i.enableFindWidget,retainContextWhenHidden:i==null?void 0:i.retainContextWhenHidden,...n.toValue(i==null?void 0:i.webviewOptions)}));i!=null&&i.onDidReceiveMessage&&u.webview.onDidReceiveMessage(i.onDidReceiveMessage);const r=n.ref(0);function l(){r.value++}if(n.watchEffect(()=>{u.webview.html=`${n.toValue(o)}<!--${r.value}-->`}),i!=null&&i.webviewOptions){const v=i.webviewOptions;n.watchEffect(()=>{u.webview.options=n.toValue(v)})}E(u,t);function f(v){return u.webview.postMessage(v)}const h=n.ref(u.active),w=n.ref(u.visible);return d(u.onDidChangeViewState(()=>{h.value=u.active,w.value=u.visible})),{panel:u,context:c,active:h,visible:w,postMessage:f,forceRefresh:l}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();d(s.window.registerWebviewViewProvider(e,{resolveWebviewView(l,f){a.value=l,i.value=f,o!=null&&o.onDidReceiveMessage&&l.webview.onDidReceiveMessage(o.onDidReceiveMessage)}},{webviewOptions:{retainContextWhenHidden:o==null?void 0:o.retainContextWhenHidden}}));const c=n.ref(0);function u(){c.value++}if(n.watchEffect(()=>{a.value&&(a.value.webview.html=`${n.toValue(t)}<!--${c.value}-->`)}),o!=null&&o.webviewOptions){const l=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(l))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&I(a,o.badge);function r(l){var f;return(f=a.value)==null?void 0:f.webview.postMessage(l)}return{view:a,context:i,postMessage:r,forceRefresh:u}},e=>e),$e=g(()=>{const e=n.shallowRef(s.window.state);return d(s.window.onDidChangeWindowState(t=>{e.value=t})),{focused:n.computed(()=>e.value.focused),active:n.computed(()=>e.value.active)}}),Me=g(()=>{const e=n.shallowRef(s.workspace.workspaceFolders);return d(s.workspace.onDidChangeWorkspaceFolders(()=>{e.value=s.workspace.workspaceFolders})),n.computed(()=>e.value)});exports.activateCbs=y;exports.createKeyedComposable=R;exports.createSingletonComposable=g;exports.deactivateCbs=k;exports.defineConfigObject=J;exports.defineConfigs=L;exports.defineExtension=G;exports.defineLogger=X;exports.executeCommand=Z;exports.extensionContext=C;exports.extensionScope=D;exports.getDefaultLoggerPrefix=be;exports.onActivate=A;exports.onDeactivate=Y;exports.tryOnScopeDispose=F;exports.useAbsolutePath=ee;exports.useActiveColorTheme=N;exports.useActiveDebugSession=te;exports.useActiveEditorDecorations=ne;exports.useActiveNotebookEditor=oe;exports.useActiveTerminal=ae;exports.useActiveTextEditor=$;exports.useAllExtensions=ie;exports.useCommand=B;exports.useCommands=se;exports.useCommentController=ue;exports.useControlledTerminal=ce;exports.useDefaultShell=re;exports.useDisposable=d;exports.useDocumentText=M;exports.useEditorDecorations=j;exports.useEvent=b;exports.useEventEmitter=V;exports.useExtensionSecret=le;exports.useFetchTasks=de;exports.useFileUri=fe;exports.useFoldingRangeProvider=we;exports.useFsWatcher=ve;exports.useIsDarkTheme=he;exports.useIsTelemetryEnabled=ge;exports.useL10nText=me;exports.useLogLevel=Ce;exports.useLogger=K;exports.useNotebookEditorSelection=Ve;exports.useNotebookEditorSelections=q;exports.useNotebookEditorVisibleRanges=pe;exports.useOpenedTerminals=Te;exports.useOutputChannel=H;exports.useQuickPick=De;exports.useStatusBarItem=Ee;exports.useTaskExecutions=Se;exports.useTerminal=xe;exports.useTerminalState=P;exports.useTextEditorCommand=Q;exports.useTextEditorCommands=Re;exports.useTextEditorSelection=ke;exports.useTextEditorSelections=U;exports.useTextEditorViewColumn=ye;exports.useTextEditorVisibleRanges=Ae;exports.useTreeView=Pe;exports.useViewBadge=I;exports.useViewTitle=E;exports.useViewVisibility=Ie;exports.useVisibleNotebookEditors=Oe;exports.useVisibleTextEditors=We;exports.useVscodeContext=Fe;exports.useWebviewPanel=Le;exports.useWebviewView=Ne;exports.useWindowState=$e;exports.useWorkspaceFolders=Me;Object.keys(n).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
package/dist/index.d.ts CHANGED
@@ -361,7 +361,7 @@ export declare const useActiveDebugSession: () => ComputedRef<DebugSession | und
361
361
  *
362
362
  * @category editor
363
363
  */
364
- export declare function useActiveEditorDecorations(decorationTypeOrOptions: TextEditorDecorationType | DecorationRenderOptions, rangesOrOptions: MaybeRefOrGetter<readonly Range[] | readonly DecorationOptions[]>): void;
364
+ export declare function useActiveEditorDecorations(decorationTypeOrOptions: MaybeRefOrGetter<TextEditorDecorationType | DecorationRenderOptions>, rangesOrOptions: MaybeRefOrGetter<readonly Range[] | readonly DecorationOptions[]>): void;
365
365
 
366
366
  /**
367
367
  * @reactive `window.activeNotebookEditor`
@@ -449,7 +449,7 @@ export declare function useDocumentText(doc: MaybeRefOrGetter<TextDocument | und
449
449
  *
450
450
  * @category editor
451
451
  */
452
- export declare function useEditorDecorations(editor: MaybeRefOrGetter<Nullable<TextEditor>>, decorationTypeOrOptions: TextEditorDecorationType | DecorationRenderOptions, decorations: MaybeRef<readonly Range[] | readonly DecorationOptions[]> | ((editor: TextEditor) => Awaitable<readonly Range[] | readonly DecorationOptions[]>), options?: UseEditorDecorationsOptions): {
452
+ export declare function useEditorDecorations(editor: MaybeRefOrGetter<Nullable<TextEditor>>, decorationTypeOrOptions: MaybeRefOrGetter<TextEditorDecorationType | DecorationRenderOptions>, decorations: MaybeRef<readonly Range[] | readonly DecorationOptions[]> | ((editor: TextEditor) => Awaitable<readonly Range[] | readonly DecorationOptions[]>), options?: UseEditorDecorationsOptions): {
453
453
  /**
454
454
  * Manually trigger the decoration update.
455
455
  */
@@ -655,6 +655,7 @@ export declare interface UseStatusBarItemOptions {
655
655
  backgroundColor?: MaybeRefOrGetter<StatusBarItem['backgroundColor']>;
656
656
  command?: MaybeRefOrGetter<StatusBarItem['command']>;
657
657
  accessibilityInformation?: MaybeRefOrGetter<StatusBarItem['accessibilityInformation']>;
658
+ visible?: MaybeRefOrGetter<boolean>;
658
659
  }
659
660
 
660
661
  /**
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getCurrentScope as K, onScopeDispose as F, effectScope as Q, shallowRef as g, computed as h, shallowReactive as $, toValue as s, watchEffect as C, watch as D, ref as x, toRaw as ee, isRef as te } from "@reactive-vscode/reactivity";
2
2
  export * from "@reactive-vscode/reactivity";
3
- import { workspace as S, commands as I, window as f, debug as H, extensions as O, comments as ne, env as p, EventEmitter as U, tasks as k, Uri as ie, languages as ae, ColorThemeKind as B, l10n as z } from "vscode";
3
+ import { workspace as S, commands as I, window as v, debug as H, extensions as O, comments as ne, env as p, EventEmitter as U, tasks as k, Uri as ie, languages as ae, ColorThemeKind as B, l10n as z } from "vscode";
4
4
  function re(e) {
5
5
  return K() ? (F(e), !0) : !1;
6
6
  }
@@ -40,42 +40,42 @@ function J(e) {
40
40
  }
41
41
  function se(e, t, n) {
42
42
  const i = !e, a = S.getConfiguration(i ? void 0 : e, n);
43
- function u(c, l) {
44
- const v = g(l), b = h({
45
- get: () => v.value,
46
- set: (d) => {
47
- v.value = d, a.update(c, d);
43
+ function u(c, o) {
44
+ const d = g(o), b = h({
45
+ get: () => d.value,
46
+ set: (f) => {
47
+ d.value = f, a.update(c, f);
48
48
  }
49
49
  });
50
- return b.update = async (d, m, T) => {
51
- await a.update(c, d, m, T), b.value = d;
52
- }, b.set = (d) => {
53
- v.value = d;
50
+ return b.update = async (f, m, T) => {
51
+ await a.update(c, f, m, T), b.value = f;
52
+ }, b.set = (f) => {
53
+ d.value = f;
54
54
  }, b;
55
55
  }
56
56
  const r = Object.fromEntries(
57
57
  Object.keys(t).map((c) => [c, u(c, a.get(c))])
58
58
  );
59
59
  return J(() => {
60
- o(S.onDidChangeConfiguration(
60
+ l(S.onDidChangeConfiguration(
61
61
  i ? (c) => {
62
- const l = S.getConfiguration();
63
- for (const v in t)
64
- c.affectsConfiguration(v) && r[v].set(l.get(v));
62
+ const o = S.getConfiguration();
63
+ for (const d in t)
64
+ c.affectsConfiguration(d) && r[d].set(o.get(d));
65
65
  } : (c) => {
66
66
  if (!c.affectsConfiguration(e))
67
67
  return;
68
- const l = S.getConfiguration(e);
69
- for (const v in t)
70
- c.affectsConfiguration(`${e}.${v}`) && r[v].set(l.get(v));
68
+ const o = S.getConfiguration(e);
69
+ for (const d in t)
70
+ c.affectsConfiguration(`${e}.${d}`) && r[d].set(o.get(d));
71
71
  }
72
72
  ));
73
73
  }), r;
74
74
  }
75
75
  function Se(e, t, n) {
76
76
  const i = se(e, t, n), a = {}, u = $({
77
- $update(r, c, l, v) {
78
- return i[r].update(c, l, v);
77
+ $update(r, c, o, d) {
78
+ return i[r].update(c, o, d);
79
79
  },
80
80
  $set(r, c) {
81
81
  return i[r].set(c);
@@ -83,10 +83,10 @@ function Se(e, t, n) {
83
83
  });
84
84
  for (const r in t) {
85
85
  const c = r.split(".");
86
- let l = "", v = a, b = u;
86
+ let o = "", d = a, b = u;
87
87
  for (const m of c.slice(0, -1)) {
88
- l = l ? `${l}.${m}` : m;
89
- const T = v = v[m] || (v[m] = {});
88
+ o = o ? `${o}.${m}` : m;
89
+ const T = d = d[m] || (d[m] = {});
90
90
  if (b[m])
91
91
  b = b[m];
92
92
  else {
@@ -99,18 +99,18 @@ function Se(e, t, n) {
99
99
  set(_) {
100
100
  function j(P, W, y) {
101
101
  if (P)
102
- for (const A in P)
103
- j(P[A], W ? `${W}.${A}` : A, y == null ? void 0 : y[A]);
102
+ for (const V in P)
103
+ j(P[V], W ? `${W}.${V}` : V, y == null ? void 0 : y[V]);
104
104
  else
105
105
  i[W].value = y;
106
106
  }
107
- j(T, l, _);
107
+ j(T, o, _);
108
108
  }
109
109
  }), b = N;
110
110
  }
111
111
  }
112
- const d = c[c.length - 1];
113
- v[d] = null, Object.defineProperty(b, d, {
112
+ const f = c[c.length - 1];
113
+ d[f] = null, Object.defineProperty(b, f, {
114
114
  enumerable: !0,
115
115
  get() {
116
116
  return i[r].value;
@@ -157,22 +157,22 @@ function ue(e, t = !1) {
157
157
  function pe(e, t = !1) {
158
158
  return h(() => ue(s(e), t));
159
159
  }
160
- function o(e) {
160
+ function l(e) {
161
161
  return (K() ?? M).cleanups.push(e.dispose.bind(e)), e;
162
162
  }
163
163
  const ce = w(() => {
164
- const e = g(f.activeColorTheme);
165
- return o(f.onDidChangeActiveColorTheme((t) => {
164
+ const e = g(v.activeColorTheme);
165
+ return l(v.onDidChangeActiveColorTheme((t) => {
166
166
  e.value = t;
167
167
  })), e;
168
168
  }), ke = w(() => {
169
169
  const e = g(H.activeDebugSession);
170
- return o(H.onDidChangeActiveDebugSession((t) => {
170
+ return l(H.onDidChangeActiveDebugSession((t) => {
171
171
  e.value = t;
172
172
  })), h(() => e.value);
173
173
  }), oe = w(() => {
174
- const e = g(f.activeTextEditor);
175
- return o(f.onDidChangeActiveTextEditor((t) => {
174
+ const e = g(v.activeTextEditor);
175
+ return l(v.onDidChangeActiveTextEditor((t) => {
176
176
  e.value = t;
177
177
  })), e;
178
178
  });
@@ -182,22 +182,28 @@ function le(e) {
182
182
  return C(() => {
183
183
  var i;
184
184
  t.value = (i = s(e)) == null ? void 0 : i.getText();
185
- }), o(S.onDidChangeTextDocument((i) => {
185
+ }), l(S.onDidChangeTextDocument((i) => {
186
186
  i.document === s(e) && (t.value = i.document.getText());
187
187
  })), t;
188
188
  }
189
189
  function de(e, t, n, i = {}) {
190
190
  const {
191
191
  updateOn: a = ["effect", "documentChanged"]
192
- } = i, u = "key" in t ? t : o(f.createTextEditorDecorationType(t)), r = async () => {
193
- const l = s(e);
194
- l && l.setDecorations(
195
- u,
196
- typeof n == "function" ? await n(l) : s(n)
192
+ } = i, u = h(
193
+ (o) => {
194
+ o == null || o.dispose();
195
+ const d = s(t);
196
+ return "key" in d ? d : l(v.createTextEditorDecorationType(d));
197
+ }
198
+ ), r = async () => {
199
+ const o = s(e);
200
+ o && o.setDecorations(
201
+ u.value,
202
+ typeof n == "function" ? await n(o) : s(n)
197
203
  );
198
204
  }, c = a.includes("documentChanged") ? le(() => {
199
- var l;
200
- return (l = s(e)) == null ? void 0 : l.document;
205
+ var o;
206
+ return (o = s(e)) == null ? void 0 : o.document;
201
207
  }) : null;
202
208
  return a.includes("effect") ? C(async () => {
203
209
  c == null || c.value, await r();
@@ -213,30 +219,30 @@ function Re(e, t) {
213
219
  de(n, e, t);
214
220
  }
215
221
  const ye = w(() => {
216
- const e = g(f.activeNotebookEditor);
217
- return o(f.onDidChangeActiveNotebookEditor((t) => {
222
+ const e = g(v.activeNotebookEditor);
223
+ return l(v.onDidChangeActiveNotebookEditor((t) => {
218
224
  e.value = t;
219
225
  })), e;
220
- }), Ae = w(() => {
221
- const e = g(f.activeTerminal);
222
- return o(f.onDidChangeActiveTerminal((t) => {
226
+ }), Ve = w(() => {
227
+ const e = g(v.activeTerminal);
228
+ return l(v.onDidChangeActiveTerminal((t) => {
223
229
  e.value = t;
224
230
  })), e;
225
- }), Ve = w(() => {
231
+ }), Ae = w(() => {
226
232
  const e = g(O.all);
227
- return o(O.onDidChange(() => {
233
+ return l(O.onDidChange(() => {
228
234
  e.value = O.all;
229
235
  })), h(() => e.value);
230
236
  });
231
237
  function fe(e, t) {
232
- o(I.registerCommand(e, t));
238
+ l(I.registerCommand(e, t));
233
239
  }
234
240
  function Ie(e) {
235
241
  for (const [t, n] of Object.entries(e))
236
242
  n && fe(t, n);
237
243
  }
238
244
  function Pe(e, t) {
239
- return o(ne.createCommentController(e, t));
245
+ return l(ne.createCommentController(e, t));
240
246
  }
241
247
  function X(e) {
242
248
  var n;
@@ -244,7 +250,7 @@ function X(e) {
244
250
  return D(e, () => {
245
251
  var i;
246
252
  t.value = (i = s(e)) == null ? void 0 : i.state;
247
- }), o(f.onDidChangeTerminalState((i) => {
253
+ }), l(v.onDidChangeTerminalState((i) => {
248
254
  i === s(e) && (t.value = i.state);
249
255
  })), h(() => t.value);
250
256
  }
@@ -254,7 +260,7 @@ function We(...e) {
254
260
  return !!t.value && t.value.exitStatus == null;
255
261
  }
256
262
  function i() {
257
- return n() ? t.value : t.value = f.createTerminal(...e);
263
+ return n() ? t.value : t.value = v.createTerminal(...e);
258
264
  }
259
265
  function a(c) {
260
266
  i().sendText(c);
@@ -276,18 +282,18 @@ function We(...e) {
276
282
  }
277
283
  const Oe = w(() => {
278
284
  const e = g(p.shell);
279
- return o(p.onDidChangeShell((t) => {
285
+ return l(p.onDidChangeShell((t) => {
280
286
  e.value = t;
281
287
  })), h(() => e.value);
282
288
  });
283
289
  function E(e, t) {
284
290
  const n = (i, a, u) => {
285
- o(e(i, a, u));
291
+ l(e(i, a, u));
286
292
  };
287
293
  return t == null || t.forEach((i) => n(i)), n;
288
294
  }
289
- function V(e, t = []) {
290
- const n = Array.isArray(e) ? e : t ?? [], i = o(Array.isArray(e) || e == null ? new U() : e), a = E(i.event, n);
295
+ function A(e, t = []) {
296
+ const n = Array.isArray(e) ? e : t ?? [], i = l(Array.isArray(e) || e == null ? new U() : e), a = E(i.event, n);
291
297
  for (const u of n)
292
298
  a(u);
293
299
  return {
@@ -302,7 +308,7 @@ async function $e(e) {
302
308
  n.value = i, await t.store(e, i);
303
309
  }, n.remove = async () => {
304
310
  n.value = void 0, await t.delete(e);
305
- }, o(t.onDidChange(async (i) => {
311
+ }, l(t.onDidChange(async (i) => {
306
312
  i.key === e && (n.value = await t.get(e));
307
313
  })), D(n, (i) => {
308
314
  i === void 0 ? t.delete(e) : t.store(e, i);
@@ -318,7 +324,7 @@ function Le(e, t) {
318
324
  const n = new U(), i = g();
319
325
  C(() => {
320
326
  i.value && n.fire(), i.value = s(t);
321
- }), o(ae.registerFoldingRangeProvider(
327
+ }), l(ae.registerFoldingRangeProvider(
322
328
  e,
323
329
  {
324
330
  onDidChangeFoldingRanges: n.event,
@@ -330,15 +336,15 @@ function Le(e, t) {
330
336
  ));
331
337
  }
332
338
  function Ne(e, t, n, i) {
333
- const a = $(/* @__PURE__ */ new Map()), u = V(), r = V(), c = V(), l = h(() => {
334
- const d = s(e);
335
- return Array.isArray(d) ? d : d instanceof Set ? Array.from(d) : [d];
339
+ const a = $(/* @__PURE__ */ new Map()), u = A(), r = A(), c = A(), o = h(() => {
340
+ const f = s(e);
341
+ return Array.isArray(f) ? f : f instanceof Set ? Array.from(f) : [f];
336
342
  });
337
- function v() {
338
- const d = l.value;
343
+ function d() {
344
+ const f = o.value;
339
345
  for (const [m, T] of a)
340
- d.includes(m) || (T.dispose(), a.delete(m));
341
- for (const m of d)
346
+ f.includes(m) || (T.dispose(), a.delete(m));
347
+ for (const m of f)
342
348
  if (!a.has(m)) {
343
349
  const T = S.createFileSystemWatcher(
344
350
  m,
@@ -350,18 +356,18 @@ function Ne(e, t, n, i) {
350
356
  }
351
357
  }
352
358
  function b() {
353
- for (const d of a.values())
354
- d.dispose();
359
+ for (const f of a.values())
360
+ f.dispose();
355
361
  a.clear();
356
362
  }
357
- return v(), D(l, v), D(
363
+ return d(), D(o, d), D(
358
364
  () => [
359
365
  s(t),
360
366
  s(n),
361
367
  s(i)
362
368
  ],
363
369
  () => {
364
- b(), v();
370
+ b(), d();
365
371
  }
366
372
  ), F(b), {
367
373
  watchers: a,
@@ -375,7 +381,7 @@ const je = w(() => {
375
381
  return h(() => e.value.kind === B.Dark || e.value.kind === B.HighContrast);
376
382
  }), He = w(() => {
377
383
  const e = g(p.isTelemetryEnabled);
378
- return o(p.onDidChangeTelemetryEnabled((t) => {
384
+ return l(p.onDidChangeTelemetryEnabled((t) => {
379
385
  e.value = t;
380
386
  })), h(() => e.value);
381
387
  });
@@ -383,11 +389,11 @@ function Be(e, ...t) {
383
389
  return h(() => typeof t[0] == "object" ? z.t(s(e), ee(t[0])) : z.t(s(e), ...t.map(s)));
384
390
  }
385
391
  function ve(e, t) {
386
- return o(f.createOutputChannel(e, t));
392
+ return l(v.createOutputChannel(e, t));
387
393
  }
388
394
  function ze(e) {
389
- const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), i = String(t.getMonth() + 1).padStart(2, "0"), a = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), c = String(t.getSeconds()).padStart(2, "0"), l = String(t.getMilliseconds()).padStart(3, "0");
390
- return `${n}-${i}-${a} ${u}:${r}:${c}.${l} [${e}] `;
395
+ const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), i = String(t.getMonth() + 1).padStart(2, "0"), a = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), c = String(t.getSeconds()).padStart(2, "0"), o = String(t.getMilliseconds()).padStart(3, "0");
396
+ return `${n}-${i}-${a} ${u}:${r}:${c}.${o} [${e}] `;
391
397
  }
392
398
  function ge(e, t = {}) {
393
399
  const n = t.outputChannel ?? ve(e), i = (a) => (...u) => {
@@ -410,7 +416,7 @@ function ge(e, t = {}) {
410
416
  }
411
417
  const Ke = w(() => {
412
418
  const e = g(p.logLevel);
413
- return o(p.onDidChangeLogLevel((t) => {
419
+ return l(p.onDidChangeLogLevel((t) => {
414
420
  e.value = t;
415
421
  })), h(() => e.value);
416
422
  });
@@ -420,7 +426,7 @@ function he(e) {
420
426
  return D(e, () => {
421
427
  var i;
422
428
  t.value = ((i = s(e)) == null ? void 0 : i.selections) ?? [];
423
- }), o(f.onDidChangeNotebookEditorSelection((i) => {
429
+ }), l(v.onDidChangeNotebookEditorSelection((i) => {
424
430
  i.notebookEditor === s(e) && (t.value = i.selections);
425
431
  })), h({
426
432
  get() {
@@ -450,19 +456,19 @@ function Ue(e) {
450
456
  return D(e, () => {
451
457
  var i;
452
458
  t.value = ((i = s(e)) == null ? void 0 : i.visibleRanges) ?? [];
453
- }), o(f.onDidChangeNotebookEditorVisibleRanges((i) => {
459
+ }), l(v.onDidChangeNotebookEditorVisibleRanges((i) => {
454
460
  i.notebookEditor === s(e) && (t.value = i.visibleRanges);
455
461
  })), h(() => t.value);
456
462
  }
457
463
  const qe = w(() => {
458
- const e = g(f.terminals);
464
+ const e = g(v.terminals);
459
465
  function t() {
460
- e.value = f.terminals;
466
+ e.value = v.terminals;
461
467
  }
462
- return o(f.onDidOpenTerminal(t)), o(f.onDidCloseTerminal(t)), e;
468
+ return l(v.onDidOpenTerminal(t)), l(v.onDidCloseTerminal(t)), e;
463
469
  });
464
470
  function Ye(e = {}) {
465
- const t = o(f.createQuickPick()), n = E(t.onDidChangeActive), i = E(t.onDidChangeSelection), a = E(t.onDidAccept), u = E(t.onDidHide), r = E(t.onDidTriggerButton), c = E(t.onDidChangeValue);
471
+ const t = l(v.createQuickPick()), n = E(t.onDidChangeActive), i = E(t.onDidChangeSelection), a = E(t.onDidAccept), u = E(t.onDidHide), r = E(t.onDidTriggerButton), c = E(t.onDidChangeValue);
466
472
  [
467
473
  "items",
468
474
  "buttons",
@@ -477,15 +483,15 @@ function Ye(e = {}) {
477
483
  "matchOnDescription",
478
484
  "matchOnDetail",
479
485
  "keepScrollPosition"
480
- ].forEach((d) => {
481
- e[d] && C(() => t[d] = s(e[d]));
486
+ ].forEach((f) => {
487
+ e[f] && C(() => t[f] = s(e[f]));
482
488
  }), e.value && (t.value = e.value);
483
- const l = g(t.value);
484
- c((d) => l.value = d), e.activeItems && (t.activeItems = e.activeItems);
485
- const v = g(t.activeItems);
486
- n((d) => v.value = d), e.selectedItems && (t.selectedItems = e.selectedItems);
489
+ const o = g(t.value);
490
+ c((f) => o.value = f), e.activeItems && (t.activeItems = e.activeItems);
491
+ const d = g(t.activeItems);
492
+ n((f) => d.value = f), e.selectedItems && (t.selectedItems = e.selectedItems);
487
493
  const b = g(t.selectedItems);
488
- return i((d) => b.value = d), {
494
+ return i((f) => b.value = f), {
489
495
  ...t,
490
496
  onDidChangeActive: n,
491
497
  onDidChangeSelection: i,
@@ -493,13 +499,13 @@ function Ye(e = {}) {
493
499
  onDidHide: u,
494
500
  onDidTriggerButton: r,
495
501
  onDidChangeValue: c,
496
- value: l,
497
- activeItems: v,
502
+ value: o,
503
+ activeItems: d,
498
504
  selectedItems: b
499
505
  };
500
506
  }
501
507
  function Ge(e) {
502
- const t = o(e.id ? f.createStatusBarItem(e.id, e.alignment, e.priority) : f.createStatusBarItem(e.alignment, e.priority));
508
+ const t = l(e.id ? v.createStatusBarItem(e.id, e.alignment, e.priority) : v.createStatusBarItem(e.alignment, e.priority));
503
509
  function n(i) {
504
510
  const a = e[i];
505
511
  a != null && C(() => t[i] = s(a));
@@ -512,17 +518,19 @@ function Ge(e) {
512
518
  "backgroundColor",
513
519
  "command",
514
520
  "accessibilityInformation"
515
- ].forEach(n), t;
521
+ ].forEach(n), e.visible != null && C(() => {
522
+ s(e.visible) ? t.show() : t.hide();
523
+ }), t;
516
524
  }
517
525
  const Je = w(() => {
518
526
  const e = g(k.taskExecutions);
519
527
  function t() {
520
528
  e.value = k.taskExecutions;
521
529
  }
522
- return o(k.onDidStartTask(t)), o(k.onDidEndTask(t)), h(() => e.value);
530
+ return l(k.onDidStartTask(t)), l(k.onDidEndTask(t)), h(() => e.value);
523
531
  });
524
532
  function Xe(...e) {
525
- const t = o(f.createTerminal(...e));
533
+ const t = l(v.createTerminal(...e));
526
534
  return {
527
535
  terminal: t,
528
536
  get name() {
@@ -547,7 +555,7 @@ function Xe(...e) {
547
555
  };
548
556
  }
549
557
  function me(e, t) {
550
- o(I.registerTextEditorCommand(e, t));
558
+ l(I.registerTextEditorCommand(e, t));
551
559
  }
552
560
  function Ze(e) {
553
561
  for (const [t, n] of Object.entries(e))
@@ -559,7 +567,7 @@ function be(e, t) {
559
567
  return D(e, () => {
560
568
  var a;
561
569
  n.value = ((a = s(e)) == null ? void 0 : a.selections) ?? [];
562
- }), o(f.onDidChangeTextEditorSelection((a) => {
570
+ }), l(v.onDidChangeTextEditorSelection((a) => {
563
571
  const u = s(e), r = s(t);
564
572
  a.textEditor === u && (!r || r.includes(a.kind)) && (n.value = a.selections);
565
573
  })), h({
@@ -590,7 +598,7 @@ function et(e) {
590
598
  return D(e, () => {
591
599
  var i;
592
600
  t.value = (i = s(e)) == null ? void 0 : i.viewColumn;
593
- }), o(f.onDidChangeTextEditorViewColumn((i) => {
601
+ }), l(v.onDidChangeTextEditorViewColumn((i) => {
594
602
  i.textEditor === s(e) && (t.value = i.viewColumn);
595
603
  })), h(() => t.value);
596
604
  }
@@ -600,7 +608,7 @@ function tt(e) {
600
608
  return D(e, () => {
601
609
  var i;
602
610
  t.value = ((i = s(e)) == null ? void 0 : i.visibleRanges) ?? [];
603
- }), o(f.onDidChangeTextEditorVisibleRanges((i) => {
611
+ }), l(v.onDidChangeTextEditorVisibleRanges((i) => {
604
612
  i.textEditor === s(e) && (t.value = i.visibleRanges);
605
613
  })), h(() => t.value);
606
614
  }
@@ -618,9 +626,9 @@ function L(e, t) {
618
626
  }
619
627
  const nt = q(
620
628
  (e, t, n) => {
621
- const i = V();
629
+ const i = A();
622
630
  D(t, () => i.fire()), n != null && n.watchSource && D(n.watchSource, () => i.fire());
623
- const a = /* @__PURE__ */ new WeakMap(), u = o(f.createTreeView(e, {
631
+ const a = /* @__PURE__ */ new WeakMap(), u = l(v.createTreeView(e, {
624
632
  ...n,
625
633
  treeDataProvider: {
626
634
  ...n,
@@ -630,7 +638,7 @@ const nt = q(
630
638
  },
631
639
  getChildren(r) {
632
640
  var c;
633
- return r ? ((c = r.children) == null || c.forEach((l) => a.set(l, r)), r.children) : s(t);
641
+ return r ? ((c = r.children) == null || c.forEach((o) => a.set(o, r)), r.children) : s(t);
634
642
  },
635
643
  getParent(r) {
636
644
  return a.get(r);
@@ -657,13 +665,13 @@ function it(e) {
657
665
  }), C(n), h(() => !!t.value);
658
666
  }
659
667
  const at = w(() => {
660
- const e = g(f.visibleNotebookEditors);
661
- return o(f.onDidChangeVisibleNotebookEditors((t) => {
668
+ const e = g(v.visibleNotebookEditors);
669
+ return l(v.onDidChangeVisibleNotebookEditors((t) => {
662
670
  e.value = t;
663
671
  })), e;
664
672
  }), rt = w(() => {
665
- const e = g(f.visibleTextEditors);
666
- return o(f.onDidChangeVisibleTextEditors((t) => {
673
+ const e = g(v.visibleTextEditors);
674
+ return l(v.onDidChangeVisibleTextEditors((t) => {
667
675
  e.value = t;
668
676
  })), e;
669
677
  });
@@ -674,7 +682,7 @@ function st(e, t, n = !0) {
674
682
  }), i;
675
683
  }
676
684
  function ut(e, t, n, i, a) {
677
- const u = g(), r = o(f.createWebviewPanel(
685
+ const u = g(), r = l(v.createWebviewPanel(
678
686
  e,
679
687
  s(t),
680
688
  i,
@@ -686,7 +694,7 @@ function ut(e, t, n, i, a) {
686
694
  ));
687
695
  a != null && a.onDidReceiveMessage && r.webview.onDidReceiveMessage(a.onDidReceiveMessage);
688
696
  const c = x(0);
689
- function l() {
697
+ function o() {
690
698
  c.value++;
691
699
  }
692
700
  if (C(() => {
@@ -698,22 +706,22 @@ function ut(e, t, n, i, a) {
698
706
  });
699
707
  }
700
708
  L(r, t);
701
- function v(m) {
709
+ function d(m) {
702
710
  return r.webview.postMessage(m);
703
711
  }
704
- const b = x(r.active), d = x(r.visible);
705
- return o(r.onDidChangeViewState(() => {
706
- b.value = r.active, d.value = r.visible;
707
- })), { panel: r, context: u, active: b, visible: d, postMessage: v, forceRefresh: l };
712
+ const b = x(r.active), f = x(r.visible);
713
+ return l(r.onDidChangeViewState(() => {
714
+ b.value = r.active, f.value = r.visible;
715
+ })), { panel: r, context: u, active: b, visible: f, postMessage: d, forceRefresh: o };
708
716
  }
709
717
  const ct = q(
710
718
  (e, t, n) => {
711
719
  const i = g(), a = g();
712
- o(f.registerWebviewViewProvider(
720
+ l(v.registerWebviewViewProvider(
713
721
  e,
714
722
  {
715
- resolveWebviewView(l, v) {
716
- i.value = l, a.value = v, n != null && n.onDidReceiveMessage && l.webview.onDidReceiveMessage(n.onDidReceiveMessage);
723
+ resolveWebviewView(o, d) {
724
+ i.value = o, a.value = d, n != null && n.onDidReceiveMessage && o.webview.onDidReceiveMessage(n.onDidReceiveMessage);
717
725
  }
718
726
  },
719
727
  {
@@ -729,22 +737,22 @@ const ct = q(
729
737
  if (C(() => {
730
738
  i.value && (i.value.webview.html = `${s(t)}<!--${u.value}-->`);
731
739
  }), n != null && n.webviewOptions) {
732
- const l = n.webviewOptions;
740
+ const o = n.webviewOptions;
733
741
  C(() => {
734
- i.value && (i.value.webview.options = s(l));
742
+ i.value && (i.value.webview.options = s(o));
735
743
  });
736
744
  }
737
745
  n != null && n.title && L(i, n.title), n != null && n.badge && Z(i, n.badge);
738
- function c(l) {
739
- var v;
740
- return (v = i.value) == null ? void 0 : v.webview.postMessage(l);
746
+ function c(o) {
747
+ var d;
748
+ return (d = i.value) == null ? void 0 : d.webview.postMessage(o);
741
749
  }
742
750
  return { view: i, context: a, postMessage: c, forceRefresh: r };
743
751
  },
744
752
  (e) => e
745
753
  ), ot = w(() => {
746
- const e = g(f.state);
747
- return o(f.onDidChangeWindowState((t) => {
754
+ const e = g(v.state);
755
+ return l(v.onDidChangeWindowState((t) => {
748
756
  e.value = t;
749
757
  })), {
750
758
  focused: h(() => e.value.focused),
@@ -752,7 +760,7 @@ const ct = q(
752
760
  };
753
761
  }), lt = w(() => {
754
762
  const e = g(S.workspaceFolders);
755
- return o(S.onDidChangeWorkspaceFolders(() => {
763
+ return l(S.onDidChangeWorkspaceFolders(() => {
756
764
  e.value = S.workspaceFolders;
757
765
  })), h(() => e.value);
758
766
  });
@@ -777,19 +785,19 @@ export {
777
785
  ke as useActiveDebugSession,
778
786
  Re as useActiveEditorDecorations,
779
787
  ye as useActiveNotebookEditor,
780
- Ae as useActiveTerminal,
788
+ Ve as useActiveTerminal,
781
789
  oe as useActiveTextEditor,
782
- Ve as useAllExtensions,
790
+ Ae as useAllExtensions,
783
791
  fe as useCommand,
784
792
  Ie as useCommands,
785
793
  Pe as useCommentController,
786
794
  We as useControlledTerminal,
787
795
  Oe as useDefaultShell,
788
- o as useDisposable,
796
+ l as useDisposable,
789
797
  le as useDocumentText,
790
798
  de as useEditorDecorations,
791
799
  E as useEvent,
792
- V as useEventEmitter,
800
+ A as useEventEmitter,
793
801
  $e as useExtensionSecret,
794
802
  Me as useFetchTasks,
795
803
  Fe as useFileUri,
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "reactive-vscode",
3
3
  "type": "module",
4
- "version": "0.2.10",
4
+ "version": "0.2.13",
5
5
  "description": "Develop VSCode extension with Vue Reactivity API",
6
6
  "author": "_Kerman <kermanx@qq.com>",
7
7
  "license": "MIT",
8
- "homepage": "https://github.com/KermanX/reactive-vscode#readme",
8
+ "homepage": "https://github.com/kermanx/reactive-vscode#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/KermanX/reactive-vscode.git"
11
+ "url": "git+https://github.com/kermanx/reactive-vscode.git"
12
12
  },
13
- "bugs": "https://github.com/KermanX/reactive-vscode/issues",
13
+ "bugs": "https://github.com/kermanx/reactive-vscode/issues",
14
14
  "keywords": [
15
15
  "vscode",
16
16
  "extension",
@@ -38,7 +38,7 @@
38
38
  "@types/vscode": "^1.89.0"
39
39
  },
40
40
  "dependencies": {
41
- "@reactive-vscode/reactivity": "0.2.10"
41
+ "@reactive-vscode/reactivity": "0.2.13"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^20.17.16",