reactive-vscode 0.2.7-beta.1 → 0.2.8

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/README.md CHANGED
@@ -17,12 +17,13 @@
17
17
 
18
18
  Currently, most of the VSCode APIs are covered, and this project has been used in:
19
19
 
20
+ - [Vue - Official <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/Vue.volar.svg)</sub></sub>](https://github.com/vuejs/language-tools)
20
21
  - [Slidev for VSCode <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.slidev.svg)</sub></sub>](https://github.com/slidevjs/slidev/tree/main/packages/vscode)
21
22
  - [Iconify IntelliSense <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.iconify.svg)</sub></sub>](https://github.com/antfu/vscode-iconify)
22
23
 
23
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.
24
25
 
25
- However, the project is still in beta 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).
26
27
 
27
28
  ### Counter Example
28
29
 
@@ -90,7 +91,7 @@ Source code in [the `./packages/reactivity` directory](https://github.com/Kerman
90
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
93
 
93
- The logo <img src="https://kermanx.github.io/reactive-vscode/logo.svg" width="14"> is modified from [Vue Reactity 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/).
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/).
94
95
 
95
96
  Part of the docs website is ported from [VueUse](https://github.com/vueuse/vueuse). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
96
97
 
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={$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={};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),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]})});
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { getCurrentScope as z, onScopeDispose as M, effectScope as K, shallowRef as g, computed as h, toValue as s, watchEffect as C, watch as D, ref as x, shallowReactive as _, toRaw as ee, isRef as te } from "@reactive-vscode/reactivity";
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 j, extensions as O, comments as ne, env as p, EventEmitter as Q, tasks as k, Uri as ie, languages as ae, ColorThemeKind as H, l10n as B } from "vscode";
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";
4
4
  function re(e) {
5
- return z() ? (M(e), !0) : !1;
5
+ return K() ? (F(e), !0) : !1;
6
6
  }
7
- function U(e, t) {
7
+ function q(e, t) {
8
8
  const n = /* @__PURE__ */ new Map();
9
9
  return (...i) => {
10
10
  const a = t(...i);
@@ -19,24 +19,24 @@ function U(e, t) {
19
19
  }
20
20
  function w(e) {
21
21
  let t;
22
- return () => t !== void 0 ? t : t = K(!0).run(e);
22
+ return () => t !== void 0 ? t : t = Q(!0).run(e);
23
23
  }
24
- const q = [];
24
+ const Y = [];
25
25
  function De(e) {
26
- q.push(e);
26
+ Y.push(e);
27
27
  }
28
- const R = g(null), $ = K();
28
+ const R = g(null), M = Q();
29
29
  function Te(e) {
30
30
  return {
31
- activate: (t) => (R.value = t, $.run(() => (Y.map((n) => n(t)), e(t)))),
31
+ activate: (t) => (R.value = t, M.run(() => (G.map((n) => n(t)), e(t)))),
32
32
  deactivate: () => {
33
- q.map((t) => t()), $.stop();
33
+ Y.map((t) => t()), M.stop();
34
34
  }
35
35
  };
36
36
  }
37
- const Y = [];
38
- function G(e) {
39
- R.value ? e(R.value) : Y.push(e);
37
+ const G = [];
38
+ function J(e) {
39
+ R.value ? e(R.value) : G.push(e);
40
40
  }
41
41
  function se(e, t, n) {
42
42
  const i = !e, a = S.getConfiguration(i ? void 0 : e, n);
@@ -56,7 +56,7 @@ function se(e, t, n) {
56
56
  const r = Object.fromEntries(
57
57
  Object.keys(t).map((c) => [c, u(c, a.get(c))])
58
58
  );
59
- return G(() => {
59
+ return J(() => {
60
60
  o(S.onDidChangeConfiguration(
61
61
  i ? (c) => {
62
62
  const l = S.getConfiguration();
@@ -73,14 +73,14 @@ function se(e, t, n) {
73
73
  }), r;
74
74
  }
75
75
  function Se(e, t, n) {
76
- const i = se(e, t, n), a = {}, u = {
76
+ const i = se(e, t, n), a = {}, u = $({
77
77
  $update(r, c, l, v) {
78
78
  return i[r].update(c, l, v);
79
79
  },
80
80
  $set(r, c) {
81
81
  return i[r].set(c);
82
82
  }
83
- };
83
+ });
84
84
  for (const r in t) {
85
85
  const c = r.split(".");
86
86
  let l = "", v = a, b = u;
@@ -90,23 +90,23 @@ function Se(e, t, n) {
90
90
  if (b[m])
91
91
  b = b[m];
92
92
  else {
93
- const L = {};
93
+ const N = $({});
94
94
  Object.defineProperty(b, m, {
95
95
  enumerable: !0,
96
96
  get() {
97
- return L;
97
+ return N;
98
98
  },
99
- set(Z) {
100
- function N(P, W, y) {
99
+ set(_) {
100
+ function j(P, W, y) {
101
101
  if (P)
102
102
  for (const A in P)
103
- N(P[A], W ? `${W}.${A}` : A, y == null ? void 0 : y[A]);
103
+ j(P[A], W ? `${W}.${A}` : A, y == null ? void 0 : y[A]);
104
104
  else
105
105
  i[W].value = y;
106
106
  }
107
- N(T, l, Z);
107
+ j(T, l, _);
108
108
  }
109
- }), b = L;
109
+ }), b = N;
110
110
  }
111
111
  }
112
112
  const d = c[c.length - 1];
@@ -124,7 +124,7 @@ function Se(e, t, n) {
124
124
  }
125
125
  function xe(e, t) {
126
126
  const n = g(null), i = [], a = (u) => (...r) => n.value ? n.value[u](...r) : (i.push([u, r]), null);
127
- return G(() => {
127
+ return J(() => {
128
128
  n.value = ge(e, t);
129
129
  for (const [u, r] of i)
130
130
  n.value[u](...r);
@@ -158,7 +158,7 @@ function pe(e, t = !1) {
158
158
  return h(() => ue(s(e), t));
159
159
  }
160
160
  function o(e) {
161
- return (z() ?? $).cleanups.push(e.dispose.bind(e)), e;
161
+ return (K() ?? M).cleanups.push(e.dispose.bind(e)), e;
162
162
  }
163
163
  const ce = w(() => {
164
164
  const e = g(f.activeColorTheme);
@@ -166,8 +166,8 @@ const ce = w(() => {
166
166
  e.value = t;
167
167
  })), e;
168
168
  }), ke = w(() => {
169
- const e = g(j.activeDebugSession);
170
- return o(j.onDidChangeActiveDebugSession((t) => {
169
+ const e = g(H.activeDebugSession);
170
+ return o(H.onDidChangeActiveDebugSession((t) => {
171
171
  e.value = t;
172
172
  })), h(() => e.value);
173
173
  }), oe = w(() => {
@@ -238,7 +238,7 @@ function Ie(e) {
238
238
  function Pe(e, t) {
239
239
  return o(ne.createCommentController(e, t));
240
240
  }
241
- function J(e) {
241
+ function X(e) {
242
242
  var n;
243
243
  const t = g((n = s(e)) == null ? void 0 : n.state);
244
244
  return D(e, () => {
@@ -265,13 +265,13 @@ function We(...e) {
265
265
  function r() {
266
266
  n() && (t.value.sendText(""), t.value.dispose(), t.value = null);
267
267
  }
268
- return M(r), {
268
+ return F(r), {
269
269
  terminal: t,
270
270
  getIsActive: n,
271
271
  show: u,
272
272
  sendText: a,
273
273
  close: r,
274
- state: J(t)
274
+ state: X(t)
275
275
  };
276
276
  }
277
277
  const Oe = w(() => {
@@ -287,7 +287,7 @@ function E(e, t) {
287
287
  return t == null || t.forEach((i) => n(i)), n;
288
288
  }
289
289
  function V(e, t = []) {
290
- const n = Array.isArray(e) ? e : t ?? [], i = o(Array.isArray(e) || e == null ? new Q() : e), a = E(i.event, n);
290
+ const n = Array.isArray(e) ? e : t ?? [], i = o(Array.isArray(e) || e == null ? new U() : e), a = E(i.event, n);
291
291
  for (const u of n)
292
292
  a(u);
293
293
  return {
@@ -315,7 +315,7 @@ function Fe(e) {
315
315
  return h(() => ie.file(s(e)));
316
316
  }
317
317
  function Le(e, t) {
318
- const n = new Q(), i = g();
318
+ const n = new U(), i = g();
319
319
  C(() => {
320
320
  i.value && n.fire(), i.value = s(t);
321
321
  }), o(ae.registerFoldingRangeProvider(
@@ -330,7 +330,7 @@ function Le(e, t) {
330
330
  ));
331
331
  }
332
332
  function Ne(e, t, n, i) {
333
- const a = _(/* @__PURE__ */ new Map()), u = V(), r = V(), c = V(), l = h(() => {
333
+ const a = $(/* @__PURE__ */ new Map()), u = V(), r = V(), c = V(), l = h(() => {
334
334
  const d = s(e);
335
335
  return Array.isArray(d) ? d : d instanceof Set ? Array.from(d) : [d];
336
336
  });
@@ -363,7 +363,7 @@ function Ne(e, t, n, i) {
363
363
  () => {
364
364
  b(), v();
365
365
  }
366
- ), M(b), {
366
+ ), F(b), {
367
367
  watchers: a,
368
368
  onDidCreate: u.event,
369
369
  onDidChange: r.event,
@@ -372,7 +372,7 @@ function Ne(e, t, n, i) {
372
372
  }
373
373
  const je = w(() => {
374
374
  const e = ce();
375
- return h(() => e.value.kind === H.Dark || e.value.kind === H.HighContrast);
375
+ return h(() => e.value.kind === B.Dark || e.value.kind === B.HighContrast);
376
376
  }), He = w(() => {
377
377
  const e = g(p.isTelemetryEnabled);
378
378
  return o(p.onDidChangeTelemetryEnabled((t) => {
@@ -380,7 +380,7 @@ const je = w(() => {
380
380
  })), h(() => e.value);
381
381
  });
382
382
  function Be(e, ...t) {
383
- return h(() => typeof t[0] == "object" ? B.t(s(e), ee(t[0])) : B.t(s(e), ...t.map(s)));
383
+ return h(() => typeof t[0] == "object" ? z.t(s(e), ee(t[0])) : z.t(s(e), ...t.map(s)));
384
384
  }
385
385
  function ve(e, t) {
386
386
  return o(f.createOutputChannel(e, t));
@@ -543,7 +543,7 @@ function Xe(...e) {
543
543
  sendText: t.sendText.bind(t),
544
544
  show: t.show.bind(t),
545
545
  hide: t.hide.bind(t),
546
- state: J(t)
546
+ state: X(t)
547
547
  };
548
548
  }
549
549
  function me(e, t) {
@@ -604,19 +604,19 @@ function tt(e) {
604
604
  i.textEditor === s(e) && (t.value = i.visibleRanges);
605
605
  })), h(() => t.value);
606
606
  }
607
- function X(e, t) {
607
+ function Z(e, t) {
608
608
  C(() => {
609
609
  const n = s(e);
610
610
  n && (n.badge = s(t));
611
611
  });
612
612
  }
613
- function F(e, t) {
613
+ function L(e, t) {
614
614
  C(() => {
615
615
  const n = s(e);
616
616
  n && (n.title = s(t));
617
617
  });
618
618
  }
619
- const nt = U(
619
+ const nt = q(
620
620
  (e, t, n) => {
621
621
  const i = V();
622
622
  D(t, () => i.fire()), n != null && n.watchSource && D(n.watchSource, () => i.fire());
@@ -637,7 +637,7 @@ const nt = U(
637
637
  }
638
638
  }
639
639
  }));
640
- return n != null && n.title && F(u, n.title), n != null && n.badge && X(u, n.badge), u;
640
+ return n != null && n.title && L(u, n.title), n != null && n.badge && Z(u, n.badge), u;
641
641
  },
642
642
  (e) => e
643
643
  );
@@ -697,7 +697,7 @@ function ut(e, t, n, i, a) {
697
697
  r.webview.options = s(m);
698
698
  });
699
699
  }
700
- F(r, t);
700
+ L(r, t);
701
701
  function v(m) {
702
702
  return r.webview.postMessage(m);
703
703
  }
@@ -706,7 +706,7 @@ function ut(e, t, n, i, a) {
706
706
  b.value = r.active, d.value = r.visible;
707
707
  })), { panel: r, context: u, active: b, visible: d, postMessage: v, forceRefresh: l };
708
708
  }
709
- const ct = U(
709
+ const ct = q(
710
710
  (e, t, n) => {
711
711
  const i = g(), a = g();
712
712
  o(f.registerWebviewViewProvider(
@@ -734,7 +734,7 @@ const ct = U(
734
734
  i.value && (i.value.webview.options = s(l));
735
735
  });
736
736
  }
737
- n != null && n.title && F(i, n.title), n != null && n.badge && X(i, n.badge);
737
+ n != null && n.title && L(i, n.title), n != null && n.badge && Z(i, n.badge);
738
738
  function c(l) {
739
739
  var v;
740
740
  return (v = i.value) == null ? void 0 : v.webview.postMessage(l);
@@ -757,19 +757,19 @@ const ct = U(
757
757
  })), h(() => e.value);
758
758
  });
759
759
  export {
760
- Y as activateCbs,
761
- U as createKeyedComposable,
760
+ G as activateCbs,
761
+ q as createKeyedComposable,
762
762
  w as createSingletonComposable,
763
- q as deactivateCbs,
763
+ Y as deactivateCbs,
764
764
  Se as defineConfigObject,
765
765
  se as defineConfigs,
766
766
  Te as defineExtension,
767
767
  xe as defineLogger,
768
768
  Ee as executeCommand,
769
769
  R as extensionContext,
770
- $ as extensionScope,
770
+ M as extensionScope,
771
771
  ze as getDefaultLoggerPrefix,
772
- G as onActivate,
772
+ J as onActivate,
773
773
  De as onDeactivate,
774
774
  re as tryOnScopeDispose,
775
775
  pe as useAbsolutePath,
@@ -809,7 +809,7 @@ export {
809
809
  Ge as useStatusBarItem,
810
810
  Je as useTaskExecutions,
811
811
  Xe as useTerminal,
812
- J as useTerminalState,
812
+ X as useTerminalState,
813
813
  me as useTextEditorCommand,
814
814
  Ze as useTextEditorCommands,
815
815
  _e as useTextEditorSelection,
@@ -817,8 +817,8 @@ export {
817
817
  et as useTextEditorViewColumn,
818
818
  tt as useTextEditorVisibleRanges,
819
819
  nt as useTreeView,
820
- X as useViewBadge,
821
- F as useViewTitle,
820
+ Z as useViewBadge,
821
+ L as useViewTitle,
822
822
  it as useViewVisibility,
823
823
  at as useVisibleNotebookEditors,
824
824
  rt as useVisibleTextEditors,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactive-vscode",
3
3
  "type": "module",
4
- "version": "0.2.7-beta.1",
4
+ "version": "0.2.8",
5
5
  "description": "Develop VSCode extension with Vue Reactivity API",
6
6
  "author": "_Kerman <kermanx@qq.com>",
7
7
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "@types/vscode": "^1.89.0"
39
39
  },
40
40
  "dependencies": {
41
- "@reactive-vscode/reactivity": "0.2.7-beta.1"
41
+ "@reactive-vscode/reactivity": "0.2.8"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^20.17.0",