@eworkbase/plugin-git-diff 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin.mjs +2 -2
- package/dist/ui/index.html +1 -1
- package/dist/ui/main.js +2 -2
- package/package.json +11 -11
package/dist/plugin.mjs
CHANGED
|
@@ -7595,12 +7595,12 @@ function lineRestoration(content, line) {
|
|
|
7595
7595
|
/** Workspace changes are plugin-owned; writes reuse the host's project mutation lease. */
|
|
7596
7596
|
var plugin_default = definePlugin({
|
|
7597
7597
|
id: "git-diff",
|
|
7598
|
-
title: "
|
|
7598
|
+
title: "代码变更",
|
|
7599
7599
|
setup(context, hooks) {
|
|
7600
7600
|
const service = createChangesService(context);
|
|
7601
7601
|
hooks.registerView({
|
|
7602
7602
|
id: "workspace",
|
|
7603
|
-
title: "
|
|
7603
|
+
title: "代码变更",
|
|
7604
7604
|
slot: "workspace.tab",
|
|
7605
7605
|
entry: "dist/ui/index.html",
|
|
7606
7606
|
layout: PluginViewLayout.Fill,
|
package/dist/ui/index.html
CHANGED
package/dist/ui/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=class extends Error{code;constructor(e,t){super(t),this.name=`PenpalError`,this.code=e}},d=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof u?e.code:void 0}),f=({name:e,message:t,stack:n,penpalCode:r})=>{let i=r?new u(r,t):Error(t);return i.name=e,i.stack=n,i},p=class{value;transferables;constructor(e,t){this.value=e,this.transferables=t?.transferables}},m=`penpal`,h=e=>typeof e==`object`&&!!e,g=e=>typeof e==`function`,_=e=>h(e)&&e.namespace===m,v=e=>e.type===`SYN`,y=e=>e.type===`ACK1`,b=e=>e.type===`ACK2`,x=e=>e.type===`CALL`,S=e=>e.type===`REPLY`,C=e=>e.type===`DESTROY`,w=(e,t=[])=>{let n=[];for(let r of Object.keys(e)){let i=e[r];g(i)?n.push([...t,r]):h(i)&&n.push(...w(i,[...t,r]))}return n},T=(e,t)=>{let n=e.reduce((e,t)=>h(e)?e[t]:void 0,t);return g(n)?n:void 0},E=e=>e.join(`.`),D=(e,t,n)=>({namespace:m,channel:e,type:`REPLY`,callId:t,isError:!0,...n instanceof Error?{value:d(n),isSerializedErrorInstance:!0}:{value:n}}),O=(e,t,n,r)=>{let i=!1,a=async a=>{if(i||!x(a))return;r?.(`Received ${E(a.methodPath)}() call`,a);let{methodPath:o,args:s,id:c}=a,l,d;try{let e=T(o,t);if(!e)throw new u(`METHOD_NOT_FOUND`,`Method \`${E(o)}\` is not found.`);let r=await e(...s);r instanceof p&&(d=r.transferables,r=await r.value),l={namespace:m,channel:n,type:`REPLY`,callId:c,value:r}}catch(e){l=D(n,c,e)}if(!i)try{r?.(`Sending ${E(o)}() reply`,l),e.sendMessage(l,d)}catch(t){throw t.name===`DataCloneError`&&(l=D(n,c,t),r?.(`Sending ${E(o)}() reply`,l),e.sendMessage(l)),t}};return e.addMessageHandler(a),()=>{i=!0,e.removeMessageHandler(a)}},k=crypto.randomUUID?.bind(crypto)??(()=>[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)),A=class{transferables;timeout;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},j=new Set([`apply`,`call`,`bind`]),M=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,i){if(i!==`then`)return n.length&&j.has(i)?Reflect.get(r,i):M(e,t,[...n,i])},apply(t,r,i){return e(n,i)}}),N=e=>new u(`CONNECTION_DESTROYED`,`Method call ${E(e)}() failed due to destroyed connection`),P=(e,t,n)=>{let r=!1,i=new Map,a=e=>{if(!S(e))return;let{callId:t,value:r,isError:a,isSerializedErrorInstance:o}=e,s=i.get(t);s&&(i.delete(t),n?.(`Received ${E(s.methodPath)}() call`,e),a?s.reject(o?f(r):r):s.resolve(r))};return e.addMessageHandler(a),{remoteProxy:M((a,o)=>{if(r)throw N(a);let s=k(),c=o[o.length-1],l=c instanceof A,{timeout:d,transferables:f}=l?c:{},p=l?o.slice(0,-1):o;return new Promise((r,o)=>{let c=d===void 0?void 0:window.setTimeout(()=>{i.delete(s),o(new u(`METHOD_CALL_TIMEOUT`,`Method call ${E(a)}() timed out after ${d}ms`))},d);i.set(s,{methodPath:a,resolve:r,reject:o,timeoutId:c});try{let r={namespace:m,channel:t,type:`CALL`,id:s,methodPath:a,args:p};n?.(`Sending ${E(a)}() call`,r),e.sendMessage(r,f)}catch(e){o(new u(`TRANSMISSION_FAILED`,e.message))}})},n),destroy:()=>{r=!0,e.removeMessageHandler(a);for(let{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(N(e));i.clear()}}},ee=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},te=`deprecated-penpal`,ne=e=>h(e)&&`penpal`in e,re=e=>e.split(`.`),ie=e=>e.join(`.`),F=e=>{try{return JSON.stringify(e)}catch{return String(e)}},ae=e=>new u(`TRANSMISSION_FAILED`,`Unexpected message to translate: ${F(e)}`),oe=e=>{if(e.penpal===`syn`)return{namespace:m,channel:void 0,type:`SYN`,participantId:te};if(e.penpal===`ack`)return{namespace:m,channel:void 0,type:`ACK2`};if(e.penpal===`call`)return{namespace:m,channel:void 0,type:`CALL`,id:e.id,methodPath:re(e.methodName),args:e.args};if(e.penpal===`reply`)return e.resolution===`fulfilled`?{namespace:m,channel:void 0,type:`REPLY`,callId:e.id,value:e.returnValue}:{namespace:m,channel:void 0,type:`REPLY`,callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw ae(e)},se=e=>{if(y(e))return{penpal:`synAck`,methodNames:e.methodPaths.map(ie)};if(x(e))return{penpal:`call`,id:e.id,methodName:ie(e.methodPath),args:e.args};if(S(e))return e.isError?{penpal:`reply`,id:e.callId,resolution:`rejected`,...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:`reply`,id:e.callId,resolution:`fulfilled`,returnValue:e.value};throw ae(e)},ce=({messenger:e,methods:t,timeout:n,channel:r,log:i})=>{let a=k(),o,s=[],c=!1,l=w(t),{promise:d,resolve:f,reject:p}=ee(),h=n===void 0?void 0:setTimeout(()=>{p(new u(`CONNECTION_TIMEOUT`,`Connection timed out after ${n}ms`))},n),g=()=>{for(let e of s)e()},_=()=>{if(c)return;s.push(O(e,t,r,i));let{remoteProxy:n,destroy:a}=P(e,r,i);s.push(a),clearTimeout(h),c=!0,f({remoteProxy:n,destroy:g})},x=()=>{let t={namespace:m,type:`SYN`,channel:r,participantId:a};i?.(`Sending handshake SYN`,t);try{e.sendMessage(t)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message))}},S=t=>{if(i?.(`Received handshake SYN`,t),t.participantId===o&&o!==te||(o=t.participantId,x(),!(a>o||o===te)))return;let n={namespace:m,channel:r,type:`ACK1`,methodPaths:l};i?.(`Sending handshake ACK1`,n);try{e.sendMessage(n)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message));return}},C=t=>{i?.(`Received handshake ACK1`,t);let n={namespace:m,channel:r,type:`ACK2`};i?.(`Sending handshake ACK2`,n);try{e.sendMessage(n)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message));return}_()},T=e=>{i?.(`Received handshake ACK2`,e),_()},E=e=>{v(e)&&S(e),y(e)&&C(e),b(e)&&T(e)};return e.addMessageHandler(E),s.push(()=>e.removeMessageHandler(E)),x(),d},le=e=>{let t=!1,n;return(...r)=>(t||(t=!0,n=e(...r)),n)},ue=new WeakSet,de=({messenger:e,methods:t={},timeout:n,channel:r,log:i})=>{if(!e)throw new u(`INVALID_ARGUMENT`,`messenger must be defined`);if(ue.has(e))throw new u(`INVALID_ARGUMENT`,`A messenger can only be used for a single connection`);ue.add(e);let a=[e.destroy],o=le(t=>{if(t){let t={namespace:m,channel:r,type:`DESTROY`};try{e.sendMessage(t)}catch{}}for(let e of a)e();i?.(`Connection destroyed`)}),s=e=>_(e)&&e.channel===r;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:s}),e.addMessageHandler(e=>{C(e)&&o(!1)});let{remoteProxy:c,destroy:l}=await ce({messenger:e,methods:t,timeout:n,channel:r,log:i});return a.push(l),c}catch(e){throw o(!0),e}})(),destroy:()=>{o(!0)}}},fe=class{#e;#t;#n;#r;#i;#a=new Set;#o;#s=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new u(`INVALID_ARGUMENT`,`remoteWindow must be defined`);this.#e=e,this.#t=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#n=e,this.#r=t,window.addEventListener(`message`,this.#d)};sendMessage=(e,t)=>{if(v(e)){let n=this.#l(e);this.#e.postMessage(e,{targetOrigin:n,transfer:t});return}if(y(e)||this.#s){let n=this.#s?se(e):e,r=this.#l(e);this.#e.postMessage(n,{targetOrigin:r,transfer:t});return}if(b(e)){let{port1:n,port2:r}=new MessageChannel;this.#o=n,n.addEventListener(`message`,this.#f),n.start();let i=[r,...t||[]],a=this.#l(e);this.#e.postMessage(e,{targetOrigin:a,transfer:i});return}if(this.#o){this.#o.postMessage(e,{transfer:t});return}throw new u(`TRANSMISSION_FAILED`,`Cannot send message because the MessagePort is not connected`)};addMessageHandler=e=>{this.#a.add(e)};removeMessageHandler=e=>{this.#a.delete(e)};destroy=()=>{window.removeEventListener(`message`,this.#d),this.#u(),this.#a.clear()};#c=e=>this.#t.some(t=>t instanceof RegExp?t.test(e):t===e||t===`*`);#l=e=>{if(v(e))return`*`;if(!this.#i)throw new u(`TRANSMISSION_FAILED`,`Cannot send message because the remote origin is not established`);return this.#i===`null`&&this.#t.includes(`*`)?`*`:this.#i};#u=()=>{this.#o?.removeEventListener(`message`,this.#f),this.#o?.close(),this.#o=void 0};#d=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#e){if(ne(r)){this.#n?.(`Please upgrade the child window to the latest version of Penpal.`),this.#s=!0;try{r=oe(r)}catch(e){this.#n?.(`Failed to translate deprecated message: ${e.message}`);return}}if(this.#r?.(r)){if(!this.#c(t)){this.#n?.(`Received a message from origin \`${t}\` which did not match allowed origins \`[${this.#t.join(`, `)}]\``);return}if(v(r)&&(this.#u(),this.#i=t),b(r)&&!this.#s){if(this.#o=n[0],!this.#o){this.#n?.(`Ignoring ACK2 because it did not include a MessagePort`);return}this.#o.addEventListener(`message`,this.#f),this.#o.start()}for(let e of this.#a)e(r)}}};#f=({data:e})=>{if(this.#r?.(e))for(let t of this.#a)t(e)}};function pe(e,t){let n=e?.onInit,r=t?.connectToHost,i=t?.targetWindow;if(typeof n!=`function`)throw TypeError(`defineWorkbasePluginUi requires an onInit callback.`);if(!i||typeof r!=`function`)throw TypeError(`Plugin UI transport is unavailable.`);let a={fatalReportPromise:null,isInitialized:!1,contentHeight:null,recoverableHostErrors:new WeakSet},o=new Set,s=r({executionChanged:async e=>{a.isInitialized&&[...o].forEach(t=>t(e))},initialize:async e=>{Ce(e),a.isInitialized=!0,await n(e),await ye(i),await Se(c,{targetWindow:i,state:a})}}),c=s.promise,l=me(c,a);return _e({connection:s,state:a,targetWindow:i}),ge(l,{targetWindow:i,subscribe:async e=>{let t=t=>e(t);o.add(t);try{await l(`command.subscribe`,{enabled:!0})}catch(e){throw o.delete(t),e}return async()=>{o.delete(t)&&!o.size&&await l(`command.subscribe`,{enabled:!1})}}})}function me(e,t){return async(n,r)=>{if(!t.isInitialized)throw Error(`Plugin UI is not initialized.`);let i=await(await e).call(n,r);if(De(i)&&i.ok===!0)return i.result;let a=he(i);throw t.recoverableHostErrors.add(a),a}}function he(e){let t=De(e)&&De(e.error)?e.error:null,n=typeof t?.message==`string`?t.message:`Host action failed.`,r=typeof t?.code==`string`?t.code:`host_error`;return Object.assign(Error(n),{code:r})}function ge(e,{targetWindow:t,subscribe:n}){let r=Object.freeze({subscribe:n,reply:t=>e(`command.reply`,{executionId:t}),clear:t=>e(`command.clear`,t===void 0?{}:{executionId:t}),start:(n,r,i={})=>e(`command.start`,{commandId:n,input:r,executionId:i.executionId??t.crypto.randomUUID()}),query:t=>e(`command.query`,{executionId:t??null}),cancel:t=>e(`command.cancel`,{executionId:t}),execute:(n,r,i={})=>e(`command.execute`,{commandId:n,executionId:i.executionId??t.crypto.randomUUID(),input:r})}),i=Object.freeze({resolve:(t,n)=>e(`status.resolve`,{input:n,statusId:t})}),a=Object.freeze({call:(t,n)=>e(`view.call`,{input:n,method:t})});return Object.freeze({dismiss:()=>e(`interaction.dismiss`,{}),respond:t=>e(`interaction.respond`,{value:t}),closeOutput:t=>e(`output.close`,{id:t}),commands:r,desktop:Object.freeze({open:t=>e(`desktop.open`,t)}),navigate:(t,{replace:n=!1}={})=>e(`navigate`,{replace:n,to:t}),openOutput:t=>e(`output.open`,t),selectFiles:(t={})=>e(`file.select`,t),showPrompt:t=>e(`dialog.prompt`,t),showToast:t=>e(`toast.show`,t),status:i,updateOutput:t=>e(`output.update`,t),view:a})}function _e({connection:e,state:t,targetWindow:n}){let r=null,i=n=>{(n.error||n.message!==`ResizeObserver loop completed with undelivered notifications.`&&n.message!==`ResizeObserver loop limit exceeded`)&&be(e.promise,t,n.error??n.message)},a=n=>{n.reason instanceof Error&&t.recoverableHostErrors.has(n.reason)||be(e.promise,t,n.reason)},o=new n.ResizeObserver(()=>{r===null&&(r=n.requestAnimationFrame(()=>{r=null,t.isInitialized&&Se(e.promise,{targetWindow:n,state:t})}))}),s=()=>{n.removeEventListener(`error`,i,!0),n.removeEventListener(`unhandledrejection`,a),n.removeEventListener(`beforeunload`,s),o.disconnect(),r!==null&&n.cancelAnimationFrame(r),e.destroy(),t.fatalReportPromise=null,t.isInitialized=!1};ve(e.promise),o.observe(n.document.body??n.document.documentElement),n.addEventListener(`error`,i,!0),n.addEventListener(`unhandledrejection`,a),n.addEventListener(`beforeunload`,s,{once:!0})}async function ve(e){try{await e}catch{}}async function ye(e){await new Promise(t=>{e.requestAnimationFrame(()=>{e.requestAnimationFrame(()=>t())})})}async function be(e,t,n){t.fatalReportPromise||=xe(e,Oe(n).slice(0,1e3)),await t.fatalReportPromise}async function xe(e,t){try{await(await e).reportFatal(t)}catch{}}async function Se(e,{targetWindow:t,state:n}){let r=t.document.body??t.document.documentElement,i=Math.max(r.offsetHeight,r.scrollHeight);if(Number.isFinite(i))try{let t=await e,r=Math.min(Math.max(Math.ceil(i),1),1e4);if(!n.isInitialized||n.contentHeight===r)return;n.contentHeight=r,await t.reportContentHeight(r)}catch{}}function Ce(e){if(!we(e))throw TypeError(`Plugin UI initialization payload is invalid.`)}function we(e){return De(e)?Te(e.project)&&Te(e.workspace)&&Ee(e.view):!1}function Te(e){return De(e)&&typeof e.id==`string`&&e.id.length>0}function Ee(e){return Te(e)&&De(e)&&typeof e.pluginId==`string`&&e.pluginId.length>0&&typeof e.title==`string`&&e.title.length>0}function De(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Oe(e){return e instanceof Error?e.message:typeof e==`string`&&e.trim().length>0?e:`Plugin UI failed.`}let ke=function(e){return e.Editor=`editor`,e.Terminal=`terminal`,e.Folder=`folder`,e.Chatgpt=`chatgpt`,e}({});function Ae(e){let t=window;return pe(e,{connectToHost:e=>je(t,e),targetWindow:t})}function je(e,t){let n=de({channel:`workbase-plugin-ui-v1`,messenger:new fe({allowedOrigins:Me(e),remoteWindow:e.parent}),methods:t});return{destroy:n.destroy,promise:n.promise}}function Me(e){let t=new URL(e.location.href).searchParams.get(`__workbaseHostOrigin`);return t&&t!==`null`?[t]:[`*`]}function Ne(){Object.assign(window,{__webpack_nonce__:Pe()})}function Pe(){return document.querySelector(`meta[name="workbase-style-nonce"]`)?.content??``}const Fe={black:`#342f28`,primaryColor:`workbase`,primaryShade:4,autoContrast:!0,defaultRadius:`md`,radius:{xs:`0.25rem`,sm:`0.25rem`,md:`0.375rem`,lg:`0.5rem`,xl:`0.75rem`},fontFamily:`Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,fontSizes:{xs:`0.75rem`,sm:`0.875rem`,md:`0.875rem`,lg:`1rem`,xl:`1.25rem`},colors:{workbase:[`#fffde8`,`#fff7bf`,`#ffef94`,`#ffe76a`,`#ffde39`,`#ffca00`,`#d5a900`,`#aa8200`,`#805f00`,`#502e00`],gray:[`#faf9f5`,`#f3f2ed`,`#e2dfd6`,`#c9c4b8`,`#aaa49a`,`#756f66`,`#6c675f`,`#514b41`,`#342f28`,`#211d17`],red:[`#fff4ef`,`#f8ebe7`,`#f7b49a`,`#dc7756`,`#b9360a`,`#a52f09`,`#902908`,`#772207`,`#601b06`,`#491505`],teal:[`#eef9f7`,`#eaf5f4`,`#a2d8d0`,`#51aca2`,`#087c75`,`#076e68`,`#06615b`,`#05514c`,`#04423e`,`#033330`],orange:[`#fff7e9`,`#f5eee6`,`#e9c98b`,`#c4913d`,`#9a5600`,`#894d00`,`#784300`,`#643800`,`#522e00`,`#3f2300`],blue:[`#f0f7ff`,`#ebf3fc`,`#a6ccfa`,`#599be9`,`#0969da`,`#085ec2`,`#0752aa`,`#06458e`,`#053974`,`#042b59`]},components:{Badge:{defaultProps:{radius:`md`},classNames:Le},Button:{defaultProps:{size:`sm`},classNames:Ie},ActionIcon:{classNames:Ie},Accordion:{defaultProps:{chevronSize:14}},Modal:{defaultProps:{radius:`xl`}}},headings:{fontWeight:`600`},respectReducedMotion:!0};function Ie(e,{color:t}){return{root:!t||t===`workbase`?`workbase-brand-control`:void 0}}function Le(e,t){let{color:n,variant:r}=t;return r===`light`&&n&&[`teal`,`orange`,`red`,`blue`,`gray`].includes(n)?{root:`workbase-status-badge workbase-status-${n}`}:Ie(e,t)}function Re(e){return Object.keys(e)}function ze(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Be(e,t){let n={...e},r=t;return ze(e)&&ze(t)&&Object.keys(t).forEach(t=>{ze(r[t])&&t in e?n[t]=Be(n[t],r[t]):n[t]=r[t]}),n}function Ve(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function He(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function Ue(e){let t=He(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function We(e){return e===`0rem`?`0rem`:`calc(${e} * var(--mantine-scale))`}function Ge(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r===`0`)return`0${e}`;if(typeof r==`number`){let n=`${r/16}${e}`;return t?We(n):n}if(typeof r==`string`){if(r===``||r.startsWith(`calc(`)||r.startsWith(`clamp(`)||r.includes(`rgba(`))return r;if(r.includes(`,`))return r.split(`,`).map(e=>n(e)).join(`,`);if(r.includes(` `))return r.split(` `).map(e=>n(e)).join(` `);let i=r.replace(`px`,``);if(!Number.isNaN(Number(i))){let n=`${Number(i)/16}${e}`;return t?We(n):n}}return r}return n}const I=Ge(`rem`,{shouldScale:!0}),Ke=Ge(`em`);function qe(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function Je(e){if(typeof e==`number`)return!0;if(typeof e==`string`){if(e.startsWith(`calc(`)||e.startsWith(`var(`)||e.includes(` `)&&e.trim()!==``)return!0;let t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(e=>t.test(e))}return!1}
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=class extends Error{code;constructor(e,t){super(t),this.name=`PenpalError`,this.code=e}},d=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof u?e.code:void 0}),f=({name:e,message:t,stack:n,penpalCode:r})=>{let i=r?new u(r,t):Error(t);return i.name=e,i.stack=n,i},p=class{value;transferables;constructor(e,t){this.value=e,this.transferables=t?.transferables}},m=`penpal`,h=e=>typeof e==`object`&&!!e,g=e=>typeof e==`function`,_=e=>h(e)&&e.namespace===m,v=e=>e.type===`SYN`,y=e=>e.type===`ACK1`,b=e=>e.type===`ACK2`,x=e=>e.type===`CALL`,S=e=>e.type===`REPLY`,C=e=>e.type===`DESTROY`,w=(e,t=[])=>{let n=[];for(let r of Object.keys(e)){let i=e[r];g(i)?n.push([...t,r]):h(i)&&n.push(...w(i,[...t,r]))}return n},T=(e,t)=>{let n=e.reduce((e,t)=>h(e)?e[t]:void 0,t);return g(n)?n:void 0},E=e=>e.join(`.`),D=(e,t,n)=>({namespace:m,channel:e,type:`REPLY`,callId:t,isError:!0,...n instanceof Error?{value:d(n),isSerializedErrorInstance:!0}:{value:n}}),O=(e,t,n,r)=>{let i=!1,a=async a=>{if(i||!x(a))return;r?.(`Received ${E(a.methodPath)}() call`,a);let{methodPath:o,args:s,id:c}=a,l,d;try{let e=T(o,t);if(!e)throw new u(`METHOD_NOT_FOUND`,`Method \`${E(o)}\` is not found.`);let r=await e(...s);r instanceof p&&(d=r.transferables,r=await r.value),l={namespace:m,channel:n,type:`REPLY`,callId:c,value:r}}catch(e){l=D(n,c,e)}if(!i)try{r?.(`Sending ${E(o)}() reply`,l),e.sendMessage(l,d)}catch(t){throw t.name===`DataCloneError`&&(l=D(n,c,t),r?.(`Sending ${E(o)}() reply`,l),e.sendMessage(l)),t}};return e.addMessageHandler(a),()=>{i=!0,e.removeMessageHandler(a)}},k=crypto.randomUUID?.bind(crypto)??(()=>[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)),A=class{transferables;timeout;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},j=new Set([`apply`,`call`,`bind`]),M=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,i){if(i!==`then`)return n.length&&j.has(i)?Reflect.get(r,i):M(e,t,[...n,i])},apply(t,r,i){return e(n,i)}}),N=e=>new u(`CONNECTION_DESTROYED`,`Method call ${E(e)}() failed due to destroyed connection`),P=(e,t,n)=>{let r=!1,i=new Map,a=e=>{if(!S(e))return;let{callId:t,value:r,isError:a,isSerializedErrorInstance:o}=e,s=i.get(t);s&&(i.delete(t),n?.(`Received ${E(s.methodPath)}() call`,e),a?s.reject(o?f(r):r):s.resolve(r))};return e.addMessageHandler(a),{remoteProxy:M((a,o)=>{if(r)throw N(a);let s=k(),c=o[o.length-1],l=c instanceof A,{timeout:d,transferables:f}=l?c:{},p=l?o.slice(0,-1):o;return new Promise((r,o)=>{let c=d===void 0?void 0:window.setTimeout(()=>{i.delete(s),o(new u(`METHOD_CALL_TIMEOUT`,`Method call ${E(a)}() timed out after ${d}ms`))},d);i.set(s,{methodPath:a,resolve:r,reject:o,timeoutId:c});try{let r={namespace:m,channel:t,type:`CALL`,id:s,methodPath:a,args:p};n?.(`Sending ${E(a)}() call`,r),e.sendMessage(r,f)}catch(e){o(new u(`TRANSMISSION_FAILED`,e.message))}})},n),destroy:()=>{r=!0,e.removeMessageHandler(a);for(let{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(N(e));i.clear()}}},ee=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},te=`deprecated-penpal`,ne=e=>h(e)&&`penpal`in e,re=e=>e.split(`.`),ie=e=>e.join(`.`),F=e=>{try{return JSON.stringify(e)}catch{return String(e)}},ae=e=>new u(`TRANSMISSION_FAILED`,`Unexpected message to translate: ${F(e)}`),oe=e=>{if(e.penpal===`syn`)return{namespace:m,channel:void 0,type:`SYN`,participantId:te};if(e.penpal===`ack`)return{namespace:m,channel:void 0,type:`ACK2`};if(e.penpal===`call`)return{namespace:m,channel:void 0,type:`CALL`,id:e.id,methodPath:re(e.methodName),args:e.args};if(e.penpal===`reply`)return e.resolution===`fulfilled`?{namespace:m,channel:void 0,type:`REPLY`,callId:e.id,value:e.returnValue}:{namespace:m,channel:void 0,type:`REPLY`,callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw ae(e)},se=e=>{if(y(e))return{penpal:`synAck`,methodNames:e.methodPaths.map(ie)};if(x(e))return{penpal:`call`,id:e.id,methodName:ie(e.methodPath),args:e.args};if(S(e))return e.isError?{penpal:`reply`,id:e.callId,resolution:`rejected`,...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:`reply`,id:e.callId,resolution:`fulfilled`,returnValue:e.value};throw ae(e)},ce=({messenger:e,methods:t,timeout:n,channel:r,log:i})=>{let a=k(),o,s=[],c=!1,l=w(t),{promise:d,resolve:f,reject:p}=ee(),h=n===void 0?void 0:setTimeout(()=>{p(new u(`CONNECTION_TIMEOUT`,`Connection timed out after ${n}ms`))},n),g=()=>{for(let e of s)e()},_=()=>{if(c)return;s.push(O(e,t,r,i));let{remoteProxy:n,destroy:a}=P(e,r,i);s.push(a),clearTimeout(h),c=!0,f({remoteProxy:n,destroy:g})},x=()=>{let t={namespace:m,type:`SYN`,channel:r,participantId:a};i?.(`Sending handshake SYN`,t);try{e.sendMessage(t)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message))}},S=t=>{if(i?.(`Received handshake SYN`,t),t.participantId===o&&o!==te||(o=t.participantId,x(),!(a>o||o===te)))return;let n={namespace:m,channel:r,type:`ACK1`,methodPaths:l};i?.(`Sending handshake ACK1`,n);try{e.sendMessage(n)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message));return}},C=t=>{i?.(`Received handshake ACK1`,t);let n={namespace:m,channel:r,type:`ACK2`};i?.(`Sending handshake ACK2`,n);try{e.sendMessage(n)}catch(e){p(new u(`TRANSMISSION_FAILED`,e.message));return}_()},T=e=>{i?.(`Received handshake ACK2`,e),_()},E=e=>{v(e)&&S(e),y(e)&&C(e),b(e)&&T(e)};return e.addMessageHandler(E),s.push(()=>e.removeMessageHandler(E)),x(),d},le=e=>{let t=!1,n;return(...r)=>(t||(t=!0,n=e(...r)),n)},ue=new WeakSet,de=({messenger:e,methods:t={},timeout:n,channel:r,log:i})=>{if(!e)throw new u(`INVALID_ARGUMENT`,`messenger must be defined`);if(ue.has(e))throw new u(`INVALID_ARGUMENT`,`A messenger can only be used for a single connection`);ue.add(e);let a=[e.destroy],o=le(t=>{if(t){let t={namespace:m,channel:r,type:`DESTROY`};try{e.sendMessage(t)}catch{}}for(let e of a)e();i?.(`Connection destroyed`)}),s=e=>_(e)&&e.channel===r;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:s}),e.addMessageHandler(e=>{C(e)&&o(!1)});let{remoteProxy:c,destroy:l}=await ce({messenger:e,methods:t,timeout:n,channel:r,log:i});return a.push(l),c}catch(e){throw o(!0),e}})(),destroy:()=>{o(!0)}}},fe=class{#e;#t;#n;#r;#i;#a=new Set;#o;#s=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new u(`INVALID_ARGUMENT`,`remoteWindow must be defined`);this.#e=e,this.#t=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#n=e,this.#r=t,window.addEventListener(`message`,this.#d)};sendMessage=(e,t)=>{if(v(e)){let n=this.#l(e);this.#e.postMessage(e,{targetOrigin:n,transfer:t});return}if(y(e)||this.#s){let n=this.#s?se(e):e,r=this.#l(e);this.#e.postMessage(n,{targetOrigin:r,transfer:t});return}if(b(e)){let{port1:n,port2:r}=new MessageChannel;this.#o=n,n.addEventListener(`message`,this.#f),n.start();let i=[r,...t||[]],a=this.#l(e);this.#e.postMessage(e,{targetOrigin:a,transfer:i});return}if(this.#o){this.#o.postMessage(e,{transfer:t});return}throw new u(`TRANSMISSION_FAILED`,`Cannot send message because the MessagePort is not connected`)};addMessageHandler=e=>{this.#a.add(e)};removeMessageHandler=e=>{this.#a.delete(e)};destroy=()=>{window.removeEventListener(`message`,this.#d),this.#u(),this.#a.clear()};#c=e=>this.#t.some(t=>t instanceof RegExp?t.test(e):t===e||t===`*`);#l=e=>{if(v(e))return`*`;if(!this.#i)throw new u(`TRANSMISSION_FAILED`,`Cannot send message because the remote origin is not established`);return this.#i===`null`&&this.#t.includes(`*`)?`*`:this.#i};#u=()=>{this.#o?.removeEventListener(`message`,this.#f),this.#o?.close(),this.#o=void 0};#d=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#e){if(ne(r)){this.#n?.(`Please upgrade the child window to the latest version of Penpal.`),this.#s=!0;try{r=oe(r)}catch(e){this.#n?.(`Failed to translate deprecated message: ${e.message}`);return}}if(this.#r?.(r)){if(!this.#c(t)){this.#n?.(`Received a message from origin \`${t}\` which did not match allowed origins \`[${this.#t.join(`, `)}]\``);return}if(v(r)&&(this.#u(),this.#i=t),b(r)&&!this.#s){if(this.#o=n[0],!this.#o){this.#n?.(`Ignoring ACK2 because it did not include a MessagePort`);return}this.#o.addEventListener(`message`,this.#f),this.#o.start()}for(let e of this.#a)e(r)}}};#f=({data:e})=>{if(this.#r?.(e))for(let t of this.#a)t(e)}};function pe(e,t){let n=e?.onInit,r=t?.connectToHost,i=t?.targetWindow;if(typeof n!=`function`)throw TypeError(`defineWorkbasePluginUi requires an onInit callback.`);if(!i||typeof r!=`function`)throw TypeError(`Plugin UI transport is unavailable.`);let a={fatalReportPromise:null,isInitialized:!1,contentHeight:null,recoverableHostErrors:new WeakSet},o=new Set,s=r({executionChanged:async e=>{a.isInitialized&&[...o].forEach(t=>t(e))},initialize:async e=>{Ce(e),a.isInitialized=!0,await n(e),await ye(i),await Se(c,{targetWindow:i,state:a})}}),c=s.promise,l=me(c,a);return _e({connection:s,state:a,targetWindow:i}),ge(l,{targetWindow:i,subscribe:async e=>{let t=t=>e(t);o.add(t);try{await l(`command.subscribe`,{enabled:!0})}catch(e){throw o.delete(t),e}return async()=>{o.delete(t)&&!o.size&&await l(`command.subscribe`,{enabled:!1})}}})}function me(e,t){return async(n,r)=>{if(!t.isInitialized)throw Error(`Plugin UI is not initialized.`);let i=await(await e).call(n,r);if(De(i)&&i.ok===!0)return i.result;let a=he(i);throw t.recoverableHostErrors.add(a),a}}function he(e){let t=De(e)&&De(e.error)?e.error:null,n=typeof t?.message==`string`?t.message:`Host action failed.`,r=typeof t?.code==`string`?t.code:`host_error`;return Object.assign(Error(n),{code:r})}function ge(e,{targetWindow:t,subscribe:n}){let r=Object.freeze({subscribe:n,reply:t=>e(`command.reply`,{executionId:t}),clear:t=>e(`command.clear`,t===void 0?{}:{executionId:t}),start:(n,r,i={})=>e(`command.start`,{commandId:n,input:r,executionId:i.executionId??t.crypto.randomUUID()}),query:t=>e(`command.query`,{executionId:t??null}),cancel:t=>e(`command.cancel`,{executionId:t}),execute:(n,r,i={})=>e(`command.execute`,{commandId:n,executionId:i.executionId??t.crypto.randomUUID(),input:r})}),i=Object.freeze({resolve:(t,n)=>e(`status.resolve`,{input:n,statusId:t})}),a=Object.freeze({call:(t,n)=>e(`view.call`,{input:n,method:t})});return Object.freeze({dismiss:()=>e(`interaction.dismiss`,{}),respond:t=>e(`interaction.respond`,{value:t}),closeOutput:t=>e(`output.close`,{id:t}),commands:r,desktop:Object.freeze({open:t=>e(`desktop.open`,t)}),navigate:(t,{replace:n=!1}={})=>e(`navigate`,{replace:n,to:t}),openOutput:t=>e(`output.open`,t),selectFiles:(t={})=>e(`file.select`,t),showPrompt:t=>e(`dialog.prompt`,t),showToast:t=>e(`toast.show`,t),status:i,updateOutput:t=>e(`output.update`,t),view:a})}function _e({connection:e,state:t,targetWindow:n}){let r=null,i=n=>{(n.error||n.message!==`ResizeObserver loop completed with undelivered notifications.`&&n.message!==`ResizeObserver loop limit exceeded`)&&be(e.promise,t,n.error??n.message)},a=n=>{n.reason instanceof Error&&t.recoverableHostErrors.has(n.reason)||be(e.promise,t,n.reason)},o=new n.ResizeObserver(()=>{r===null&&(r=n.requestAnimationFrame(()=>{r=null,t.isInitialized&&Se(e.promise,{targetWindow:n,state:t})}))}),s=()=>{n.removeEventListener(`error`,i,!0),n.removeEventListener(`unhandledrejection`,a),n.removeEventListener(`beforeunload`,s),o.disconnect(),r!==null&&n.cancelAnimationFrame(r),e.destroy(),t.fatalReportPromise=null,t.isInitialized=!1};ve(e.promise),o.observe(n.document.body??n.document.documentElement),n.addEventListener(`error`,i,!0),n.addEventListener(`unhandledrejection`,a),n.addEventListener(`beforeunload`,s,{once:!0})}async function ve(e){try{await e}catch{}}async function ye(e){await new Promise(t=>{e.requestAnimationFrame(()=>{e.requestAnimationFrame(()=>t())})})}async function be(e,t,n){t.fatalReportPromise||=xe(e,Oe(n).slice(0,1e3)),await t.fatalReportPromise}async function xe(e,t){try{await(await e).reportFatal(t)}catch{}}async function Se(e,{targetWindow:t,state:n}){let r=t.document.body??t.document.documentElement,i=Math.max(r.offsetHeight,r.scrollHeight);if(Number.isFinite(i))try{let t=await e,r=Math.min(Math.max(Math.ceil(i),1),1e4);if(!n.isInitialized||n.contentHeight===r)return;n.contentHeight=r,await t.reportContentHeight(r)}catch{}}function Ce(e){if(!we(e))throw TypeError(`Plugin UI initialization payload is invalid.`)}function we(e){return De(e)?Te(e.project)&&Te(e.workspace)&&Ee(e.view):!1}function Te(e){return De(e)&&typeof e.id==`string`&&e.id.length>0}function Ee(e){return Te(e)&&De(e)&&typeof e.pluginId==`string`&&e.pluginId.length>0&&typeof e.title==`string`&&e.title.length>0}function De(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Oe(e){return e instanceof Error?e.message:typeof e==`string`&&e.trim().length>0?e:`Plugin UI failed.`}let ke=function(e){return e.Editor=`editor`,e.Terminal=`terminal`,e.Folder=`folder`,e.Chatgpt=`chatgpt`,e}({});function Ae(e){let t=window;return pe(e,{connectToHost:e=>je(t,e),targetWindow:t})}function je(e,t){let n=de({channel:`workbase-plugin-ui-v1`,messenger:new fe({allowedOrigins:Me(e),remoteWindow:e.parent}),methods:t});return{destroy:n.destroy,promise:n.promise}}function Me(e){let t=new URL(e.location.href).searchParams.get(`__workbaseHostOrigin`);return t&&t!==`null`?[t]:[`*`]}function Ne(){document.documentElement.setAttribute(`autocapitalize`,`none`),Object.assign(window,{__webpack_nonce__:Pe()})}function Pe(){return document.querySelector(`meta[name="workbase-style-nonce"]`)?.content??``}const Fe={black:`#342f28`,primaryColor:`workbase`,primaryShade:4,autoContrast:!0,defaultRadius:`md`,radius:{xs:`0.25rem`,sm:`0.25rem`,md:`0.375rem`,lg:`0.5rem`,xl:`0.75rem`},fontFamily:`Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,fontSizes:{xs:`0.75rem`,sm:`0.875rem`,md:`0.875rem`,lg:`1rem`,xl:`1.25rem`},colors:{workbase:[`#fffde8`,`#fff7bf`,`#ffef94`,`#ffe76a`,`#ffde39`,`#ffca00`,`#d5a900`,`#aa8200`,`#805f00`,`#502e00`],gray:[`#faf9f5`,`#f3f2ed`,`#e2dfd6`,`#c9c4b8`,`#aaa49a`,`#756f66`,`#6c675f`,`#514b41`,`#342f28`,`#211d17`],red:[`#fff4ef`,`#f8ebe7`,`#f7b49a`,`#dc7756`,`#b9360a`,`#a52f09`,`#902908`,`#772207`,`#601b06`,`#491505`],teal:[`#eef9f7`,`#eaf5f4`,`#a2d8d0`,`#51aca2`,`#087c75`,`#076e68`,`#06615b`,`#05514c`,`#04423e`,`#033330`],orange:[`#fff7e9`,`#f5eee6`,`#e9c98b`,`#c4913d`,`#9a5600`,`#894d00`,`#784300`,`#643800`,`#522e00`,`#3f2300`],blue:[`#f0f7ff`,`#ebf3fc`,`#a6ccfa`,`#599be9`,`#0969da`,`#085ec2`,`#0752aa`,`#06458e`,`#053974`,`#042b59`]},components:{Input:{defaultProps:{autoCapitalize:`none`}},Textarea:{defaultProps:{autoCapitalize:`none`}},Badge:{defaultProps:{radius:`md`},classNames:Le},Button:{defaultProps:{size:`sm`},classNames:Ie},ActionIcon:{classNames:Ie},Accordion:{defaultProps:{chevronSize:14}},Modal:{defaultProps:{radius:`xl`}}},headings:{fontWeight:`600`},respectReducedMotion:!0};function Ie(e,{color:t}){return{root:!t||t===`workbase`?`workbase-brand-control`:void 0}}function Le(e,t){let{color:n,variant:r}=t;return r===`light`&&n&&[`teal`,`orange`,`red`,`blue`,`gray`].includes(n)?{root:`workbase-status-badge workbase-status-${n}`}:Ie(e,t)}function Re(e){return Object.keys(e)}function ze(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Be(e,t){let n={...e},r=t;return ze(e)&&ze(t)&&Object.keys(t).forEach(t=>{ze(r[t])&&t in e?n[t]=Be(n[t],r[t]):n[t]=r[t]}),n}function Ve(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function He(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function Ue(e){let t=He(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function We(e){return e===`0rem`?`0rem`:`calc(${e} * var(--mantine-scale))`}function Ge(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r===`0`)return`0${e}`;if(typeof r==`number`){let n=`${r/16}${e}`;return t?We(n):n}if(typeof r==`string`){if(r===``||r.startsWith(`calc(`)||r.startsWith(`clamp(`)||r.includes(`rgba(`))return r;if(r.includes(`,`))return r.split(`,`).map(e=>n(e)).join(`,`);if(r.includes(` `))return r.split(` `).map(e=>n(e)).join(` `);let i=r.replace(`px`,``);if(!Number.isNaN(Number(i))){let n=`${Number(i)/16}${e}`;return t?We(n):n}}return r}return n}const I=Ge(`rem`,{shouldScale:!0}),Ke=Ge(`em`);function qe(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function Je(e){if(typeof e==`number`)return!0;if(typeof e==`string`){if(e.startsWith(`calc(`)||e.startsWith(`var(`)||e.includes(` `)&&e.trim()!==``)return!0;let t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(e=>t.test(e))}return!1}
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.js
|
|
@@ -1765,4 +1765,4 @@ XID_Start XIDS`.split(/\s/).map(e=>[lg(e),e])),n_=new Map([[`s`,Vg(383)],[Vg(383
|
|
|
1765
1765
|
right: auto;
|
|
1766
1766
|
}
|
|
1767
1767
|
`);let a=r.join(`
|
|
1768
|
-
`);n.textContent!==a&&(n.textContent=a)}const iD=(0,L.memo)(function({file:e,repository:t,content:n,isUnified:r,mode:i,isBusy:a,onRestoreLine:o}){if(!n)return null;if(n.before===null&&n.after===``)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:`新增空文件`}),(0,R.jsx)(`p`,{children:`当前文件中还没有文本内容。`})]});if(n.before===``&&n.after===null)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:`空文件已删除`}),(0,R.jsx)(`p`,{children:`最近一次提交中的此文件没有文本内容。`})]});if(n.before===n.after)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:n.message||`文本内容没有变化`}),(0,R.jsx)(`p`,{children:e.hasStagedDifference?`已暂存内容与当前文件不同,可切换上方内容来源查看。`:`此项可能涉及文件名称、类型或权限变化。`}),e.oldMode!==e.newMode&&(0,R.jsxs)(`code`,{children:[e.oldMode||`无`,` → `,e.newMode||`无`]})]});let s=i===`working`&&!a&&!t.error&&!t.restoreBlocked&&!e.restoreBlocked&&!n.message&&[e.oldMode,e.newMode].every(e=>!e||e===`000000`||e===`100644`||e===`100755`);return(0,R.jsxs)(R.Fragment,{children:[n.message&&(0,R.jsx)(`p`,{className:$.contentNote,children:n.message}),(0,R.jsx)(tD,{before:n.before,after:n.after,path:e.path,oldPath:e.oldPath,version:`${t.version}:${i}`,isUnified:r,canRestoreLine:s,onRestoreLine:o})]})});function aD(e){return new Map([[`added`,`新增`],[`modified`,`修改`],[`deleted`,`删除`],[`renamed`,`重命名`],[`type-changed`,`类型`],[`index-only`,`暂存不同`]]).get(e)??`修改`}const oD=(0,L.memo)(function({file:e,repository:t,isActive:n,isSelected:r,isDisabled:i,onFocus:a,onToggle:o}){let s=(0,L.useCallback)(()=>a({repositoryId:t.id,fileId:e.id}),[a,t.id,e.id]),c=(0,L.useCallback)(()=>o({repositoryId:t.id,fileId:e.id}),[o,t.id,e.id]),l=e.path.split(`/`),u=l.pop();return(0,R.jsxs)(`div`,{className:$.fileRow,"data-active":n,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!r,onChange:c,disabled:i,"aria-label":`选择还原 ${e.path}`,title:e.restoreBlocked}),(0,R.jsxs)(`button`,{onClick:s,"aria-current":n?`true`:void 0,title:e.path,children:[(0,R.jsxs)(`div`,{className:$.fileName,children:[(0,R.jsx)(`span`,{children:u}),(0,R.jsx)(`small`,{"data-kind":e.kind,children:aD(e.kind)})]}),(0,R.jsxs)(`div`,{className:$.fileMeta,children:[(0,R.jsx)(`span`,{children:l.join(`/`)||`仓库根目录`}),(0,R.jsxs)(`span`,{className:$.counts,children:[e.additions!==null&&(0,R.jsxs)(`b`,{children:[`+`,e.additions]}),e.deletions!==null&&(0,R.jsxs)(`em`,{children:[`−`,e.deletions]})]})]})]})]})}),sD=(0,L.memo)(function({repository:e,query:t,selectedCount:n,children:r}){let i=(0,L.useRef)(null),a=(0,L.useRef)(e.files.length>0||!!e.error||!!e.restoreBlocked);return(0,L.useEffect)(()=>{(t.trim()||e.error)&&i.current&&(i.current.open=!0)},[t,e.error]),(0,R.jsxs)(`details`,{ref:i,className:$.repository,open:a.current,children:[(0,R.jsxs)(`summary`,{className:$.repositoryHeading,children:[(0,R.jsx)(Ps,{size:14,className:$.disclosureIcon}),(0,R.jsx)(zs,{size:15}),(0,R.jsx)(`strong`,{children:e.label}),n>0&&(0,R.jsxs)(`span`,{className:$.repositorySelection,children:[`已选 `,n]}),(0,R.jsx)(`span`,{className:$.repositoryCount,children:e.files.length})]}),r]})});function cD(e){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(`working`),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(null),O=(0,L.useRef)(null),k=(0,L.useRef)(!0),A=(0,L.useRef)(new Map),j=t.find(e=>e.id===s?.repositoryId),M=j?.files.find(e=>e.id===s?.fileId),N=y||x!==null||T!==null,P=(0,L.useCallback)(async t=>{if(!M||!j||N)return;let n=M.kind===`deleted`||M.newMode===`000000`;if(t===ke.Editor&&n)return;let r=M.path.split(`/`).slice(0,-1).join(`/`)||`.`,i=n?r:M.path;E(t),o(``);try{await e.desktop.open({target:t,repositoryId:j.id,path:i})}catch(e){k.current&&o(lD(e))}finally{k.current&&E(null)}},[M,j,e,N]),ee=(0,L.useCallback)(async()=>{if(O.current||D.current)return;i(!0),o(``);async function t(){try{let t=await e.view.call(`list`,{});if(!k.current)return;n(e=>t.map(t=>{let n=e.find(e=>e.id===t.id);return t.error&&n?{...n,error:t.error}:t})),c(e=>{if(e&&t.some(t=>t.id===e.repositoryId&&(t.error||t.files.some(t=>t.id===e.fileId))))return e;let n=t.find(e=>e.files.length);return n?{repositoryId:n.id,fileId:n.files[0].id}:null})}catch(e){k.current&&o(lD(e))}finally{O.current=null,k.current&&i(!1)}}O.current=t(),await O.current},[e]);return(0,L.useEffect)(()=>{k.current=!0,ee();let e=()=>{document.visibilityState===`visible`&&ee()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{k.current=!1,window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[ee]),(0,L.useEffect)(()=>{if(!j||!M){m(null);return}let{id:t,version:n}=j,r=M.id,i=JSON.stringify([t,n,r,d]),a=A.current.get(i),o=!0;if(m(a??null),g(!a),a)return;async function s(){try{let a=await e.view.call(`content`,{repositoryId:t,version:n,fileId:r,mode:d});(a.before!==null||a.after!==null)&&A.current.set(i,a),A.current.size>8&&A.current.delete(A.current.keys().next().value),o&&m(a)}catch(e){o&&m({before:null,after:null,message:lD(e)})}finally{o&&g(!1)}}return s(),()=>{o=!1}},[e,j,M,d]),{repositories:t,isLoading:r,error:a,focus:s,focusFile:(0,L.useCallback)(e=>{c(e),f(`working`)},[]),selection:l,toggleFile:(0,L.useCallback)(e=>{v(null),w(null),u(t=>{if(!t||t.repositoryId!==e.repositoryId)return{repositoryId:e.repositoryId,ids:[e.fileId]};let n=t.ids.includes(e.fileId)?t.ids.filter(t=>t!==e.fileId):[...t.ids,e.fileId];return n.length?{...t,ids:n}:null})},[]),clearSelection:(0,L.useCallback)(()=>{u(null),v(null)},[]),mode:d,setMode:f,content:p,isReading:h,activeRepository:j,activeFile:M,refresh:ee,preview:_,closePreview:(0,L.useCallback)(()=>{x||v(null)},[x]),planRestore:(0,L.useCallback)(async()=>{let n=t.find(e=>e.id===l?.repositoryId);if(l&&n&&!n.error){b(!0),o(``);try{v(await e.view.call(`previewRestore`,{repositoryId:n.id,version:n.version,fileIds:l.ids}))}catch(e){o(lD(e))}finally{b(!1)}}},[e,t,l]),planLineRestore:(0,L.useCallback)(async t=>{if(j&&M&&!j.error&&!N&&d===`working`){b(!0),o(``),w(null);try{v(await e.view.call(`previewLineRestore`,{repositoryId:j.id,version:j.version,fileId:M.id,...t}))}catch(e){o(lD(e))}finally{b(!1)}}},[e,j,M,N,d]),restore:(0,L.useCallback)(async()=>{if(!_||x)return;let t=crypto.randomUUID();D.current=t,S(t),o(``);try{let{value:r}=await e.commands.execute(`restoreFiles`,{planId:_.planId},{executionId:t});w(r),n(e=>e.map(e=>e.id===r.repository.id?r.repository:e));for(let e of A.current.keys())JSON.parse(e)[0]===r.repository.id&&A.current.delete(e);_.line||u(null),v(null)}catch(e){o(lD(e)),v(null)}finally{D.current=null,S(null)}},[e,_,x]),cancelRestore:(0,L.useCallback)(async()=>{if(x)try{await e.commands.cancel(x)}catch(e){o(lD(e))}},[e,x]),isBusy:N,isPlanning:y,executionId:x,result:C,openingTarget:T,openDesktop:P}}function lD(e){return e instanceof Error?e.message:String(e)}const uD={content:$.confirmModal,header:$.confirmHeader,title:$.confirmTitle,overlay:$.confirmOverlay},dD=(0,L.memo)(function({host:e}){let t=cD(e),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(!1),o=ut(`(max-width: 700px)`),s=o||i,[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),{activeFile:d,activeRepository:f,content:p,selection:m}=t,h=t.repositories.reduce((e,t)=>e+t.files.length,0),g=t.repositories.some(e=>!!e.error),_=(0,L.useMemo)(()=>t.repositories.map(e=>({...e,files:e.files.filter(e=>`${e.path}\n${e.oldPath??``}`.toLocaleLowerCase().includes(n.toLocaleLowerCase()))})),[t.repositories,n]),v=_.reduce((e,t)=>e+t.files.length,0),y=t.repositories.find(e=>e.id===m?.repositoryId),b=m?.ids.filter(e=>!_.find(e=>e.id===m.repositoryId)?.files.some(t=>t.id===e)).length??0,x=(0,L.useCallback)(e=>r(e.currentTarget.value),[]),S=(0,L.useCallback)(e=>{t.focusFile(e),l(!0)},[t.focusFile]),C=(0,L.useCallback)(()=>l(!1),[]),w=(0,L.useCallback)(()=>a(!1),[]),T=(0,L.useCallback)(()=>a(!0),[]),E=(0,L.useCallback)(()=>t.setMode(`working`),[t.setMode]),D=(0,L.useCallback)(()=>t.setMode(`staged`),[t.setMode]),O=(0,L.useCallback)(e=>{let n=e.currentTarget.dataset.target;t.openDesktop(n)},[t.openDesktop]),k=(0,L.useCallback)(()=>{u.current?.querySelectorAll(`:scope > details`).forEach(e=>{e.open=!0})},[]),A=(0,L.useCallback)(()=>{u.current?.querySelectorAll(`:scope > details`).forEach(e=>{e.open=!1})},[]);return(0,R.jsxs)(`main`,{className:$.app,children:[(0,R.jsxs)(`header`,{className:$.header,children:[(0,R.jsxs)(`div`,{className:$.heading,children:[(0,R.jsx)(`h1`,{children:`本地更改`}),(0,R.jsxs)(`span`,{children:[h,` 个未提交文件`]})]}),(0,R.jsxs)(`div`,{className:$.headerActions,children:[(0,R.jsx)(`span`,{className:$.refreshStatus,role:`status`,children:t.isLoading?`正在检查…`:`包含已暂存、未暂存和新增文件`}),(0,R.jsx)(es,{variant:`default`,size:`xs`,leftSection:(0,R.jsx)(Vs,{size:14}),onClick:t.refresh,disabled:t.isBusy||t.isLoading,children:`刷新`})]})]}),t.error&&(0,R.jsxs)(`div`,{role:`alert`,className:$.error,children:[t.error,(0,R.jsx)(`button`,{onClick:t.refresh,disabled:t.isBusy,children:`重新检查`})]}),t.result&&(0,R.jsxs)(`div`,{role:`status`,className:$.result,children:[t.result.results.every(e=>e.success)?(0,R.jsx)(Ns,{size:16}):(0,R.jsx)(Us,{size:16}),(0,R.jsxs)(`div`,{children:[t.result.results.filter(e=>e.success).length,` `,t.result.isLineRestore?`行已还原,暂存内容保留`:`个文件已还原`,t.result.results.filter(e=>!e.success).map(e=>(0,R.jsxs)(`p`,{children:[e.path,` `,e.message]},e.path))]})]}),(0,R.jsxs)(`div`,{className:$.workspace,"data-reader-open":c,children:[(0,R.jsxs)(`aside`,{className:$.sidebar,"aria-label":`变更文件`,children:[(0,R.jsxs)(`div`,{className:$.navigationToolbar,children:[(0,R.jsxs)(`label`,{className:$.search,children:[(0,R.jsx)(Hs,{size:14}),(0,R.jsx)(`input`,{value:n,onChange:x,placeholder:`查找文件…`,"aria-label":`查找变更文件`})]}),(0,R.jsx)(`button`,{className:$.navigationAction,"aria-label":`展开全部仓库`,title:`展开全部仓库`,onClick:k,disabled:!t.repositories.length,children:(0,R.jsx)(Is,{size:15})}),(0,R.jsx)(`button`,{className:$.navigationAction,"aria-label":`折叠全部仓库`,title:`折叠全部仓库`,onClick:A,disabled:!t.repositories.length,children:(0,R.jsx)(Fs,{size:15})})]}),(0,R.jsxs)(`div`,{ref:u,className:$.fileList,children:[t.isLoading&&!t.repositories.length&&(0,R.jsx)(`div`,{className:$.listMessage,role:`status`,children:`正在读取仓库变更…`}),_.map(e=>(0,R.jsxs)(sD,{repository:e,query:n,selectedCount:m?.repositoryId===e.id?m.ids.length:0,children:[e.error&&(0,R.jsxs)(`p`,{className:$.repositoryError,role:`alert`,children:[e.error,(0,R.jsx)(`br`,{}),`上次内容仅供阅读,请刷新后重试。`]}),e.restoreBlocked&&(0,R.jsx)(`p`,{className:$.repositoryError,children:e.restoreBlocked}),e.files.map(n=>(0,R.jsx)(oD,{file:n,repository:e,isActive:t.focus?.repositoryId===e.id&&t.focus.fileId===n.id,isSelected:m?.repositoryId===e.id&&m.ids.includes(n.id),isDisabled:t.isBusy||!!e.error||!!e.restoreBlocked||!!n.restoreBlocked||!!m&&m.repositoryId!==e.id,onFocus:S,onToggle:t.toggleFile},n.id)),!e.files.length&&!e.error&&(0,R.jsx)(`p`,{className:$.listMessage,children:n?`没有匹配的文件`:`没有未提交的更改`})]},e.id)),!t.isLoading&&!t.repositories.length&&(0,R.jsx)(`p`,{className:$.listMessage,children:`此工作区没有可查看的仓库。`}),n&&!v&&h>0&&(0,R.jsx)(`p`,{className:$.listMessage,children:`试试文件名或路径的一部分。`})]}),(0,R.jsx)(`footer`,{className:$.sidebarFooter,children:m?`已选 ${m.ids.length} 个文件${b?` · ${b} 个被筛选隐藏`:``}`:`点击阅读 · 勾选还原`})]}),(0,R.jsxs)(`section`,{className:$.reader,"aria-label":`文件差异`,children:[!d&&(0,R.jsxs)(`button`,{className:$.mobileBack,onClick:C,children:[(0,R.jsx)(js,{size:17}),`返回文件列表`]}),d&&f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:$.fileHeader,children:[(0,R.jsx)(`button`,{className:$.mobileBack,"aria-label":`返回文件列表`,onClick:C,children:(0,R.jsx)(js,{size:17})}),(0,R.jsx)(Rs,{size:18,className:$.fileIcon}),(0,R.jsxs)(`div`,{className:$.fileTitle,children:[(0,R.jsx)(`strong`,{children:d.path}),d.oldPath&&(0,R.jsxs)(`span`,{children:[d.oldPath,(0,R.jsx)(Ms,{size:12}),d.path]})]}),(0,R.jsx)(`span`,{className:$.kind,children:aD(d.kind)}),(0,R.jsxs)(`div`,{className:$.fileActions,children:[(0,R.jsx)(es,{size:`xs`,variant:`subtle`,leftSection:(0,R.jsx)(Ls,{size:14}),"data-target":ke.Editor,onClick:O,loading:t.openingTarget===ke.Editor,disabled:t.isBusy||d.kind===`deleted`||d.newMode===`000000`,title:`在默认编辑器中打开当前文件`,children:`编辑器`}),(0,R.jsx)(es,{size:`xs`,variant:`subtle`,"data-target":ke.Folder,onClick:O,loading:t.openingTarget===ke.Folder,disabled:t.isBusy,"aria-label":`在文件夹中显示`,title:`在文件夹中显示`,children:(0,R.jsx)(Bs,{size:15})})]})]}),(0,R.jsxs)(`div`,{className:$.readerToolbar,children:[(0,R.jsxs)(`details`,{className:$.baseline,children:[(0,R.jsxs)(`summary`,{children:[f.label,` · 最近一次提交`]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:`只查看本地未提交的更改`}),(0,R.jsx)(`p`,{children:`以此仓库最近一次提交为基准。已提交的内容不会列为更改;还原所选文件也会回到此版本。`}),(0,R.jsx)(`code`,{children:f.baseline}),(0,R.jsxs)(`p`,{children:[`检查于 `,new Date(f.checkedAt).toLocaleTimeString()]})]})]}),(0,R.jsxs)(`div`,{className:$.toolbarControls,children:[d.hasStagedDifference&&(0,R.jsxs)(`div`,{className:$.segment,"aria-label":`内容来源`,children:[(0,R.jsx)(`button`,{"aria-pressed":t.mode===`working`,onClick:E,children:`当前文件`}),(0,R.jsx)(`button`,{"aria-pressed":t.mode===`staged`,onClick:D,children:`已暂存`})]}),!o&&(0,R.jsxs)(`div`,{className:$.segment,"aria-label":`差异布局`,children:[(0,R.jsx)(`button`,{"aria-pressed":!s,onClick:w,children:`并排`}),(0,R.jsx)(`button`,{"aria-pressed":s,onClick:T,children:`统一`})]})]})]}),(0,R.jsxs)(`div`,{className:$.columnLabels,"data-unified":s,children:[(0,R.jsx)(`span`,{children:`最近一次提交`}),(0,R.jsx)(`span`,{children:t.mode===`working`?`当前文件`:`已暂存内容`})]}),(0,R.jsx)(`div`,{className:$.diffBody,children:t.isReading?(0,R.jsx)(`div`,{className:$.empty,role:`status`,children:`正在读取文件…`}):(0,R.jsx)(iD,{file:d,repository:f,content:p,isUnified:s,mode:t.mode,isBusy:t.isBusy,onRestoreLine:t.planLineRestore})})]}):(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(`div`,{className:$.emptyIcon,children:h||g?(0,R.jsx)(Rs,{size:28}):(0,R.jsx)(Ns,{size:28})}),(0,R.jsx)(`h2`,{children:t.isLoading&&!t.repositories.length?`正在读取工作区…`:h||g?`选择仓库查看本地更改`:`没有未提交的更改`}),(0,R.jsx)(`p`,{children:g?`部分仓库未能读取,请查看左侧提示并刷新重试。`:`已提交的内容不会出现在这里。`})]})]})]}),m&&(0,R.jsxs)(`footer`,{className:$.selectionBar,children:[(0,R.jsxs)(`div`,{className:$.selectionSummary,children:[(0,R.jsxs)(`strong`,{children:[`已选 `,m.ids.length,` 个文件`]}),(0,R.jsxs)(`span`,{children:[y?.label,b>0&&` · 含 ${b} 个隐藏项`]})]}),(0,R.jsxs)(`div`,{className:$.selectionActions,children:[(0,R.jsx)(es,{size:`xs`,variant:`default`,onClick:t.clearSelection,disabled:t.isBusy,children:`取消选择`}),(0,R.jsx)(es,{size:`xs`,color:`red`,leftSection:(0,R.jsx)(Us,{size:14}),onClick:t.planRestore,loading:t.isPlanning,disabled:!!y?.error||t.isBusy,children:`还原所选…`})]})]}),(0,R.jsx)(gs,{opened:!!t.preview,onClose:t.closePreview,title:t.preview?.line?`还原此行?`:`还原选中文件?`,centered:!0,size:`sm`,classNames:uD,closeOnClickOutside:!t.executionId,closeOnEscape:!t.executionId,withCloseButton:!t.executionId,children:t.preview&&(0,R.jsxs)(`div`,{className:$.confirmation,children:[t.preview.line?(0,R.jsx)(`p`,{children:`此行恢复到最近一次提交,暂存内容保留。`}):(0,R.jsx)(`p`,{children:`所选文件及暂存内容恢复到最近一次提交,新增文件会删除。这些本地修改将丢失,提交历史保留。`}),(0,R.jsx)(`ul`,{className:$.confirmFiles,children:t.preview.files.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`span`,{children:e.path}),(0,R.jsx)(`em`,{children:t.preview?.line?`${t.preview.line.side===`additions`?`当前`:`原始`}第 ${t.preview.line.lineNumber} 行`:e.action})]},e.path))}),t.preview.line&&(0,R.jsxs)(`details`,{className:$.linePreview,children:[(0,R.jsx)(`summary`,{children:`查看还原内容`}),(0,R.jsx)(`span`,{children:`当前内容`}),(0,R.jsx)(`pre`,{children:t.preview.line.current??`(此行已删除)`}),(0,R.jsx)(`span`,{children:`还原后`}),(0,R.jsx)(`pre`,{children:t.preview.line.restored??`(删除此新增行)`})]}),!t.preview.line&&b>0&&(0,R.jsxs)(`p`,{className:$.confirmNote,children:[`包含 `,b,` 个被筛选隐藏的文件。`]}),(0,R.jsxs)(`div`,{className:$.confirmActions,children:[t.executionId?(0,R.jsx)(es,{size:`xs`,variant:`default`,onClick:t.cancelRestore,children:`停止后续还原`}):(0,R.jsx)(es,{size:`xs`,variant:`default`,"data-autofocus":!0,onClick:t.closePreview,children:`取消`}),(0,R.jsx)(es,{size:`xs`,variant:`light`,color:`red`,onClick:t.restore,loading:!!t.executionId,children:t.preview.line?`还原此行`:`还原 ${m?.ids.length} 个文件`})]})]})})]})}),fD=document.querySelector(`#root`);if(!fD)throw Error(`变更视图挂载节点不存在。`);Ne(),eD();const pD=(0,QE.createRoot)(fD),mD=Ae({onInit(e){pD.render((0,R.jsx)(Jn,{theme:Fe,getStyleNonce:Pe,forceColorScheme:`light`,children:(0,R.jsx)(dD,{host:mD},`${e.project.id}:${e.workspace.id}`)}))}});export{s as t};
|
|
1768
|
+
`);n.textContent!==a&&(n.textContent=a)}const iD=(0,L.memo)(function({file:e,repository:t,content:n,isUnified:r,mode:i,isBusy:a,onRestoreLine:o}){if(!n)return null;if(n.before===null&&n.after===``)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:`新增空文件`}),(0,R.jsx)(`p`,{children:`当前文件中还没有文本内容。`})]});if(n.before===``&&n.after===null)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:`空文件已删除`}),(0,R.jsx)(`p`,{children:`最近一次提交中的此文件没有文本内容。`})]});if(n.before===n.after)return(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(Rs,{size:25}),(0,R.jsx)(`h2`,{children:n.message||`文本内容没有变化`}),(0,R.jsx)(`p`,{children:e.hasStagedDifference?`已暂存内容与当前文件不同,可切换上方内容来源查看。`:`此项可能涉及文件名称、类型或权限变化。`}),e.oldMode!==e.newMode&&(0,R.jsxs)(`code`,{children:[e.oldMode||`无`,` → `,e.newMode||`无`]})]});let s=i===`working`&&!a&&!t.error&&!t.restoreBlocked&&!e.restoreBlocked&&!n.message&&[e.oldMode,e.newMode].every(e=>!e||e===`000000`||e===`100644`||e===`100755`);return(0,R.jsxs)(R.Fragment,{children:[n.message&&(0,R.jsx)(`p`,{className:$.contentNote,children:n.message}),(0,R.jsx)(tD,{before:n.before,after:n.after,path:e.path,oldPath:e.oldPath,version:`${t.version}:${i}`,isUnified:r,canRestoreLine:s,onRestoreLine:o})]})});function aD(e){return new Map([[`added`,`新增`],[`modified`,`修改`],[`deleted`,`删除`],[`renamed`,`重命名`],[`type-changed`,`类型`],[`index-only`,`暂存不同`]]).get(e)??`修改`}const oD=(0,L.memo)(function({file:e,repository:t,isActive:n,isSelected:r,isDisabled:i,onFocus:a,onToggle:o}){let s=(0,L.useCallback)(()=>a({repositoryId:t.id,fileId:e.id}),[a,t.id,e.id]),c=(0,L.useCallback)(()=>o({repositoryId:t.id,fileId:e.id}),[o,t.id,e.id]),l=e.path.split(`/`),u=l.pop();return(0,R.jsxs)(`div`,{className:$.fileRow,"data-active":n,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!r,onChange:c,disabled:i,"aria-label":`选择还原 ${e.path}`,title:e.restoreBlocked}),(0,R.jsxs)(`button`,{onClick:s,"aria-current":n?`true`:void 0,title:e.path,children:[(0,R.jsxs)(`div`,{className:$.fileName,children:[(0,R.jsx)(`span`,{children:u}),(0,R.jsx)(`small`,{"data-kind":e.kind,children:aD(e.kind)})]}),(0,R.jsxs)(`div`,{className:$.fileMeta,children:[(0,R.jsx)(`span`,{children:l.join(`/`)||`仓库根目录`}),(0,R.jsxs)(`span`,{className:$.counts,children:[e.additions!==null&&(0,R.jsxs)(`b`,{children:[`+`,e.additions]}),e.deletions!==null&&(0,R.jsxs)(`em`,{children:[`−`,e.deletions]})]})]})]})]})}),sD=(0,L.memo)(function({repository:e,query:t,selectedCount:n,children:r}){let i=(0,L.useRef)(null),a=(0,L.useRef)(e.files.length>0||!!e.error||!!e.restoreBlocked);return(0,L.useEffect)(()=>{(t.trim()||e.error)&&i.current&&(i.current.open=!0)},[t,e.error]),(0,R.jsxs)(`details`,{ref:i,className:$.repository,open:a.current,children:[(0,R.jsxs)(`summary`,{className:$.repositoryHeading,children:[(0,R.jsx)(Ps,{size:14,className:$.disclosureIcon}),(0,R.jsx)(zs,{size:15}),(0,R.jsx)(`strong`,{children:e.label}),n>0&&(0,R.jsxs)(`span`,{className:$.repositorySelection,children:[`已选 `,n]}),(0,R.jsx)(`span`,{className:$.repositoryCount,children:e.files.length})]}),r]})});function cD(e){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(`working`),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(null),O=(0,L.useRef)(null),k=(0,L.useRef)(!0),A=(0,L.useRef)(new Map),j=t.find(e=>e.id===s?.repositoryId),M=j?.files.find(e=>e.id===s?.fileId),N=y||x!==null||T!==null,P=(0,L.useCallback)(async t=>{if(!M||!j||N)return;let n=M.kind===`deleted`||M.newMode===`000000`;if(t===ke.Editor&&n)return;let r=M.path.split(`/`).slice(0,-1).join(`/`)||`.`,i=n?r:M.path;E(t),o(``);try{await e.desktop.open({target:t,repositoryId:j.id,path:i})}catch(e){k.current&&o(lD(e))}finally{k.current&&E(null)}},[M,j,e,N]),ee=(0,L.useCallback)(async()=>{if(O.current||D.current)return;i(!0),o(``);async function t(){try{let t=await e.view.call(`list`,{});if(!k.current)return;n(e=>t.map(t=>{let n=e.find(e=>e.id===t.id);return t.error&&n?{...n,error:t.error}:t})),c(e=>{if(e&&t.some(t=>t.id===e.repositoryId&&(t.error||t.files.some(t=>t.id===e.fileId))))return e;let n=t.find(e=>e.files.length);return n?{repositoryId:n.id,fileId:n.files[0].id}:null})}catch(e){k.current&&o(lD(e))}finally{O.current=null,k.current&&i(!1)}}O.current=t(),await O.current},[e]);return(0,L.useEffect)(()=>{k.current=!0,ee();let e=()=>{document.visibilityState===`visible`&&ee()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{k.current=!1,window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[ee]),(0,L.useEffect)(()=>{if(!j||!M){m(null);return}let{id:t,version:n}=j,r=M.id,i=JSON.stringify([t,n,r,d]),a=A.current.get(i),o=!0;if(m(a??null),g(!a),a)return;async function s(){try{let a=await e.view.call(`content`,{repositoryId:t,version:n,fileId:r,mode:d});(a.before!==null||a.after!==null)&&A.current.set(i,a),A.current.size>8&&A.current.delete(A.current.keys().next().value),o&&m(a)}catch(e){o&&m({before:null,after:null,message:lD(e)})}finally{o&&g(!1)}}return s(),()=>{o=!1}},[e,j,M,d]),{repositories:t,isLoading:r,error:a,focus:s,focusFile:(0,L.useCallback)(e=>{c(e),f(`working`)},[]),selection:l,toggleFile:(0,L.useCallback)(e=>{v(null),w(null),u(t=>{if(!t||t.repositoryId!==e.repositoryId)return{repositoryId:e.repositoryId,ids:[e.fileId]};let n=t.ids.includes(e.fileId)?t.ids.filter(t=>t!==e.fileId):[...t.ids,e.fileId];return n.length?{...t,ids:n}:null})},[]),clearSelection:(0,L.useCallback)(()=>{u(null),v(null)},[]),mode:d,setMode:f,content:p,isReading:h,activeRepository:j,activeFile:M,refresh:ee,preview:_,closePreview:(0,L.useCallback)(()=>{x||v(null)},[x]),planRestore:(0,L.useCallback)(async()=>{let n=t.find(e=>e.id===l?.repositoryId);if(l&&n&&!n.error){b(!0),o(``);try{v(await e.view.call(`previewRestore`,{repositoryId:n.id,version:n.version,fileIds:l.ids}))}catch(e){o(lD(e))}finally{b(!1)}}},[e,t,l]),planLineRestore:(0,L.useCallback)(async t=>{if(j&&M&&!j.error&&!N&&d===`working`){b(!0),o(``),w(null);try{v(await e.view.call(`previewLineRestore`,{repositoryId:j.id,version:j.version,fileId:M.id,...t}))}catch(e){o(lD(e))}finally{b(!1)}}},[e,j,M,N,d]),restore:(0,L.useCallback)(async()=>{if(!_||x)return;let t=crypto.randomUUID();D.current=t,S(t),o(``);try{let{value:r}=await e.commands.execute(`restoreFiles`,{planId:_.planId},{executionId:t});w(r),n(e=>e.map(e=>e.id===r.repository.id?r.repository:e));for(let e of A.current.keys())JSON.parse(e)[0]===r.repository.id&&A.current.delete(e);_.line||u(null),v(null)}catch(e){o(lD(e)),v(null)}finally{D.current=null,S(null)}},[e,_,x]),cancelRestore:(0,L.useCallback)(async()=>{if(x)try{await e.commands.cancel(x)}catch(e){o(lD(e))}},[e,x]),isBusy:N,isPlanning:y,executionId:x,result:C,openingTarget:T,openDesktop:P}}function lD(e){return e instanceof Error?e.message:String(e)}const uD={content:$.confirmModal,header:$.confirmHeader,title:$.confirmTitle,overlay:$.confirmOverlay},dD=(0,L.memo)(function({host:e}){let t=cD(e),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(!1),o=ut(`(max-width: 700px)`),s=o||i,[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),{activeFile:d,activeRepository:f,content:p,selection:m}=t,h=t.repositories.reduce((e,t)=>e+t.files.length,0),g=t.repositories.some(e=>!!e.error),_=(0,L.useMemo)(()=>t.repositories.map(e=>({...e,files:e.files.filter(e=>`${e.path}\n${e.oldPath??``}`.toLocaleLowerCase().includes(n.toLocaleLowerCase()))})),[t.repositories,n]),v=_.reduce((e,t)=>e+t.files.length,0),y=t.repositories.find(e=>e.id===m?.repositoryId),b=m?.ids.filter(e=>!_.find(e=>e.id===m.repositoryId)?.files.some(t=>t.id===e)).length??0,x=(0,L.useCallback)(e=>r(e.currentTarget.value),[]),S=(0,L.useCallback)(e=>{t.focusFile(e),l(!0)},[t.focusFile]),C=(0,L.useCallback)(()=>l(!1),[]),w=(0,L.useCallback)(()=>a(!1),[]),T=(0,L.useCallback)(()=>a(!0),[]),E=(0,L.useCallback)(()=>t.setMode(`working`),[t.setMode]),D=(0,L.useCallback)(()=>t.setMode(`staged`),[t.setMode]),O=(0,L.useCallback)(e=>{let n=e.currentTarget.dataset.target;t.openDesktop(n)},[t.openDesktop]),k=(0,L.useCallback)(()=>{u.current?.querySelectorAll(`:scope > details`).forEach(e=>{e.open=!0})},[]),A=(0,L.useCallback)(()=>{u.current?.querySelectorAll(`:scope > details`).forEach(e=>{e.open=!1})},[]);return(0,R.jsxs)(`main`,{className:$.app,children:[(0,R.jsxs)(`header`,{className:$.header,children:[(0,R.jsxs)(`div`,{className:$.heading,children:[(0,R.jsx)(`h1`,{children:`本地更改`}),(0,R.jsxs)(`span`,{children:[h,` 个未提交文件`]})]}),(0,R.jsxs)(`div`,{className:$.headerActions,children:[(0,R.jsx)(`span`,{className:$.refreshStatus,role:`status`,children:t.isLoading?`正在检查…`:`包含已暂存、未暂存和新增文件`}),(0,R.jsx)(es,{variant:`default`,size:`xs`,leftSection:(0,R.jsx)(Vs,{size:14}),onClick:t.refresh,disabled:t.isBusy||t.isLoading,children:`刷新`})]})]}),t.error&&(0,R.jsxs)(`div`,{role:`alert`,className:$.error,children:[t.error,(0,R.jsx)(`button`,{onClick:t.refresh,disabled:t.isBusy,children:`重新检查`})]}),t.result&&(0,R.jsxs)(`div`,{role:`status`,className:$.result,children:[t.result.results.every(e=>e.success)?(0,R.jsx)(Ns,{size:16}):(0,R.jsx)(Us,{size:16}),(0,R.jsxs)(`div`,{children:[t.result.results.filter(e=>e.success).length,` `,t.result.isLineRestore?`行已还原,暂存内容保留`:`个文件已还原`,t.result.results.filter(e=>!e.success).map(e=>(0,R.jsxs)(`p`,{children:[e.path,` `,e.message]},e.path))]})]}),(0,R.jsxs)(`div`,{className:$.workspace,"data-reader-open":c,children:[(0,R.jsxs)(`aside`,{className:$.sidebar,"aria-label":`变更文件`,children:[(0,R.jsxs)(`div`,{className:$.navigationToolbar,children:[(0,R.jsxs)(`label`,{className:$.search,children:[(0,R.jsx)(Hs,{size:14}),(0,R.jsx)(`input`,{autoCapitalize:`none`,value:n,onChange:x,placeholder:`查找文件…`,"aria-label":`查找变更文件`})]}),(0,R.jsx)(`button`,{className:$.navigationAction,"aria-label":`展开全部仓库`,title:`展开全部仓库`,onClick:k,disabled:!t.repositories.length,children:(0,R.jsx)(Is,{size:15})}),(0,R.jsx)(`button`,{className:$.navigationAction,"aria-label":`折叠全部仓库`,title:`折叠全部仓库`,onClick:A,disabled:!t.repositories.length,children:(0,R.jsx)(Fs,{size:15})})]}),(0,R.jsxs)(`div`,{ref:u,className:$.fileList,children:[t.isLoading&&!t.repositories.length&&(0,R.jsx)(`div`,{className:$.listMessage,role:`status`,children:`正在读取仓库变更…`}),_.map(e=>(0,R.jsxs)(sD,{repository:e,query:n,selectedCount:m?.repositoryId===e.id?m.ids.length:0,children:[e.error&&(0,R.jsxs)(`p`,{className:$.repositoryError,role:`alert`,children:[e.error,(0,R.jsx)(`br`,{}),`上次内容仅供阅读,请刷新后重试。`]}),e.restoreBlocked&&(0,R.jsx)(`p`,{className:$.repositoryError,children:e.restoreBlocked}),e.files.map(n=>(0,R.jsx)(oD,{file:n,repository:e,isActive:t.focus?.repositoryId===e.id&&t.focus.fileId===n.id,isSelected:m?.repositoryId===e.id&&m.ids.includes(n.id),isDisabled:t.isBusy||!!e.error||!!e.restoreBlocked||!!n.restoreBlocked||!!m&&m.repositoryId!==e.id,onFocus:S,onToggle:t.toggleFile},n.id)),!e.files.length&&!e.error&&(0,R.jsx)(`p`,{className:$.listMessage,children:n?`没有匹配的文件`:`没有未提交的更改`})]},e.id)),!t.isLoading&&!t.repositories.length&&(0,R.jsx)(`p`,{className:$.listMessage,children:`此工作区没有可查看的仓库。`}),n&&!v&&h>0&&(0,R.jsx)(`p`,{className:$.listMessage,children:`试试文件名或路径的一部分。`})]}),(0,R.jsx)(`footer`,{className:$.sidebarFooter,children:m?`已选 ${m.ids.length} 个文件${b?` · ${b} 个被筛选隐藏`:``}`:`点击阅读 · 勾选还原`})]}),(0,R.jsxs)(`section`,{className:$.reader,"aria-label":`文件差异`,children:[!d&&(0,R.jsxs)(`button`,{className:$.mobileBack,onClick:C,children:[(0,R.jsx)(js,{size:17}),`返回文件列表`]}),d&&f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:$.fileHeader,children:[(0,R.jsx)(`button`,{className:$.mobileBack,"aria-label":`返回文件列表`,onClick:C,children:(0,R.jsx)(js,{size:17})}),(0,R.jsx)(Rs,{size:18,className:$.fileIcon}),(0,R.jsxs)(`div`,{className:$.fileTitle,children:[(0,R.jsx)(`strong`,{children:d.path}),d.oldPath&&(0,R.jsxs)(`span`,{children:[d.oldPath,(0,R.jsx)(Ms,{size:12}),d.path]})]}),(0,R.jsx)(`span`,{className:$.kind,children:aD(d.kind)}),(0,R.jsxs)(`div`,{className:$.fileActions,children:[(0,R.jsx)(es,{size:`xs`,variant:`subtle`,leftSection:(0,R.jsx)(Ls,{size:14}),"data-target":ke.Editor,onClick:O,loading:t.openingTarget===ke.Editor,disabled:t.isBusy||d.kind===`deleted`||d.newMode===`000000`,title:`在默认编辑器中打开当前文件`,children:`编辑器`}),(0,R.jsx)(es,{size:`xs`,variant:`subtle`,"data-target":ke.Folder,onClick:O,loading:t.openingTarget===ke.Folder,disabled:t.isBusy,"aria-label":`在文件夹中显示`,title:`在文件夹中显示`,children:(0,R.jsx)(Bs,{size:15})})]})]}),(0,R.jsxs)(`div`,{className:$.readerToolbar,children:[(0,R.jsxs)(`details`,{className:$.baseline,children:[(0,R.jsxs)(`summary`,{children:[f.label,` · 最近一次提交`]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:`只查看本地未提交的更改`}),(0,R.jsx)(`p`,{children:`以此仓库最近一次提交为基准。已提交的内容不会列为更改;还原所选文件也会回到此版本。`}),(0,R.jsx)(`code`,{children:f.baseline}),(0,R.jsxs)(`p`,{children:[`检查于 `,new Date(f.checkedAt).toLocaleTimeString()]})]})]}),(0,R.jsxs)(`div`,{className:$.toolbarControls,children:[d.hasStagedDifference&&(0,R.jsxs)(`div`,{className:$.segment,"aria-label":`内容来源`,children:[(0,R.jsx)(`button`,{"aria-pressed":t.mode===`working`,onClick:E,children:`当前文件`}),(0,R.jsx)(`button`,{"aria-pressed":t.mode===`staged`,onClick:D,children:`已暂存`})]}),!o&&(0,R.jsxs)(`div`,{className:$.segment,"aria-label":`差异布局`,children:[(0,R.jsx)(`button`,{"aria-pressed":!s,onClick:w,children:`并排`}),(0,R.jsx)(`button`,{"aria-pressed":s,onClick:T,children:`统一`})]})]})]}),(0,R.jsxs)(`div`,{className:$.columnLabels,"data-unified":s,children:[(0,R.jsx)(`span`,{children:`最近一次提交`}),(0,R.jsx)(`span`,{children:t.mode===`working`?`当前文件`:`已暂存内容`})]}),(0,R.jsx)(`div`,{className:$.diffBody,children:t.isReading?(0,R.jsx)(`div`,{className:$.empty,role:`status`,children:`正在读取文件…`}):(0,R.jsx)(iD,{file:d,repository:f,content:p,isUnified:s,mode:t.mode,isBusy:t.isBusy,onRestoreLine:t.planLineRestore})})]}):(0,R.jsxs)(`div`,{className:$.empty,children:[(0,R.jsx)(`div`,{className:$.emptyIcon,children:h||g?(0,R.jsx)(Rs,{size:28}):(0,R.jsx)(Ns,{size:28})}),(0,R.jsx)(`h2`,{children:t.isLoading&&!t.repositories.length?`正在读取工作区…`:h||g?`选择仓库查看本地更改`:`没有未提交的更改`}),(0,R.jsx)(`p`,{children:g?`部分仓库未能读取,请查看左侧提示并刷新重试。`:`已提交的内容不会出现在这里。`})]})]})]}),m&&(0,R.jsxs)(`footer`,{className:$.selectionBar,children:[(0,R.jsxs)(`div`,{className:$.selectionSummary,children:[(0,R.jsxs)(`strong`,{children:[`已选 `,m.ids.length,` 个文件`]}),(0,R.jsxs)(`span`,{children:[y?.label,b>0&&` · 含 ${b} 个隐藏项`]})]}),(0,R.jsxs)(`div`,{className:$.selectionActions,children:[(0,R.jsx)(es,{size:`xs`,variant:`default`,onClick:t.clearSelection,disabled:t.isBusy,children:`取消选择`}),(0,R.jsx)(es,{size:`xs`,color:`red`,leftSection:(0,R.jsx)(Us,{size:14}),onClick:t.planRestore,loading:t.isPlanning,disabled:!!y?.error||t.isBusy,children:`还原所选…`})]})]}),(0,R.jsx)(gs,{opened:!!t.preview,onClose:t.closePreview,title:t.preview?.line?`还原此行?`:`还原选中文件?`,centered:!0,size:`sm`,classNames:uD,closeOnClickOutside:!t.executionId,closeOnEscape:!t.executionId,withCloseButton:!t.executionId,children:t.preview&&(0,R.jsxs)(`div`,{className:$.confirmation,children:[t.preview.line?(0,R.jsx)(`p`,{children:`此行恢复到最近一次提交,暂存内容保留。`}):(0,R.jsx)(`p`,{children:`所选文件及暂存内容恢复到最近一次提交,新增文件会删除。这些本地修改将丢失,提交历史保留。`}),(0,R.jsx)(`ul`,{className:$.confirmFiles,children:t.preview.files.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`span`,{children:e.path}),(0,R.jsx)(`em`,{children:t.preview?.line?`${t.preview.line.side===`additions`?`当前`:`原始`}第 ${t.preview.line.lineNumber} 行`:e.action})]},e.path))}),t.preview.line&&(0,R.jsxs)(`details`,{className:$.linePreview,children:[(0,R.jsx)(`summary`,{children:`查看还原内容`}),(0,R.jsx)(`span`,{children:`当前内容`}),(0,R.jsx)(`pre`,{children:t.preview.line.current??`(此行已删除)`}),(0,R.jsx)(`span`,{children:`还原后`}),(0,R.jsx)(`pre`,{children:t.preview.line.restored??`(删除此新增行)`})]}),!t.preview.line&&b>0&&(0,R.jsxs)(`p`,{className:$.confirmNote,children:[`包含 `,b,` 个被筛选隐藏的文件。`]}),(0,R.jsxs)(`div`,{className:$.confirmActions,children:[t.executionId?(0,R.jsx)(es,{size:`xs`,variant:`default`,onClick:t.cancelRestore,children:`停止后续还原`}):(0,R.jsx)(es,{size:`xs`,variant:`default`,"data-autofocus":!0,onClick:t.closePreview,children:`取消`}),(0,R.jsx)(es,{size:`xs`,variant:`light`,color:`red`,onClick:t.restore,loading:!!t.executionId,children:t.preview.line?`还原此行`:`还原 ${m?.ids.length} 个文件`})]})]})})]})}),fD=document.querySelector(`#root`);if(!fD)throw Error(`变更视图挂载节点不存在。`);Ne(),eD();const pD=(0,QE.createRoot)(fD),mD=Ae({onInit(e){pD.render((0,R.jsx)(Jn,{theme:Fe,getStyleNonce:Pe,forceColorScheme:`light`,children:(0,R.jsx)(dD,{host:mD},`${e.project.id}:${e.workspace.id}`)}))}});export{s as t};
|
package/package.json
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eworkbase/plugin-git-diff",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workbase": {
|
|
6
6
|
"id": "git-diff",
|
|
7
|
-
"title": "
|
|
7
|
+
"title": "代码变更",
|
|
8
8
|
"description": "查看各仓库本地未提交的更改,支持单行及选中文件还原。",
|
|
9
9
|
"apiVersion": 2,
|
|
10
10
|
"workbaseVersion": "^0.6.9"
|
|
11
11
|
},
|
|
12
12
|
"exports": "./dist/plugin.mjs",
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsdown",
|
|
15
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.ui.json --noEmit",
|
|
16
|
-
"pack:local": "pnpm build && pnpm pack"
|
|
17
|
-
},
|
|
18
13
|
"engines": {
|
|
19
14
|
"node": ">=22"
|
|
20
15
|
},
|
|
21
16
|
"devDependencies": {
|
|
22
|
-
"@eworkbase/sdk": "workspace:*",
|
|
23
17
|
"@mantine/core": "^9.6.1",
|
|
24
18
|
"@mantine/hooks": "^9.6.1",
|
|
25
19
|
"@tsdown/css": "0.23.0",
|
|
@@ -31,7 +25,8 @@
|
|
|
31
25
|
"tsdown": "0.23.0",
|
|
32
26
|
"typescript": "^5.8.3",
|
|
33
27
|
"@pierre/diffs": "1.4.3",
|
|
34
|
-
"lucide-react": "^1.21.0"
|
|
28
|
+
"lucide-react": "^1.21.0",
|
|
29
|
+
"@eworkbase/sdk": "0.3.5"
|
|
35
30
|
},
|
|
36
31
|
"publishConfig": {
|
|
37
32
|
"access": "public"
|
|
@@ -39,5 +34,10 @@
|
|
|
39
34
|
"files": [
|
|
40
35
|
"dist"
|
|
41
36
|
],
|
|
42
|
-
"description": "查看各仓库本地未提交的更改,支持单行及选中文件还原。"
|
|
43
|
-
|
|
37
|
+
"description": "查看各仓库本地未提交的更改,支持单行及选中文件还原。",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.ui.json --noEmit",
|
|
41
|
+
"pack:local": "pnpm build && pnpm pack"
|
|
42
|
+
}
|
|
43
|
+
}
|