@withgraphite/graphite-cli 1.6.5 → 1.6.7
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/.CHANGELOG.md +13 -0
- package/build/asset-manifest.json +9 -9
- package/build/index.html +1 -1
- package/build/static/css/{274.74a3708d.chunk.css → 603.b5b455ea.chunk.css} +1 -1
- package/build/static/css/main.18f97c48.css +2 -0
- package/build/static/js/447.f60d5f2f.chunk.js +2 -0
- package/build/static/js/603.0c99f909.chunk.js +1 -0
- package/build/static/js/main.js +1 -1
- package/data/description.md +322 -0
- package/graphite.js +1 -1
- package/graphite.js.LICENSE.txt +2 -546
- package/package.json +2 -1
- package/build/static/css/main.6c222a98.css +0 -2
- package/build/static/js/274.dce911b9.chunk.js +0 -1
- package/build/static/js/697.e9243bfd.chunk.js +0 -2
- /package/build/static/js/{697.e9243bfd.chunk.js.LICENSE.txt → 447.f60d5f2f.chunk.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkGraphiteInteractive=self.webpackChunkGraphiteInteractive||[]).push([[274],{3274:function(e,n,o){o.r(n),o.d(n,{ComparisonView:function(){return Ee},lineRange:function(){return Le}});var t=o(885),r=o(184),i=(o(5297),o(1072)),a=o(88),l=o(2248),s=o.n(l),c=o(4098),d=o(32),u=o(4510),p=o(2791);function h(e){var n=e.children;return(0,r.jsx)("div",{className:"empty-state",children:(0,r.jsx)("div",{children:n})})}var f=o(6815),m=o(51),v=o(7338),g=o(1485),x=o(168),b=o(6444),y=(o(2986),o(4728)),j=o(4942),w=o(5830),S=o.n(w),C=o(763);function k(e){return e.map((function(e){return e.includes(" ")?'"'.concat(e,'"'):e})).join(", ")}function T(e){return"string"==typeof e&&/(inset\s|)([0-9.]+(\w*)\s){1,4}(rgb[a]?\(.*\)|\w+)/.test(e)}function O(e,n){return Array.isArray(e)?e.filter(n):Object.entries(e).reduce((function(e,o){var r=(0,t.Z)(o,2),i=r[0],a=r[1];if((0,C.isObject)(a)){var l=O(a,n);(0,C.isEmpty)(l)||(e[i]=l)}else n(a)&&(e[i]=a);return e}),{})}function N(e){return e.scale,function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["scale"])}var L,M,E=S().typography.normal.lineHeight,F={animation:{easeOutCubic:"cubic-bezier(0.33, 1, 0.68, 1)"},borderWidths:[0,"1px"],breakpoints:["544px","768px","1012px","1280px"],fonts:{normal:k(["-apple-system","BlinkMacSystemFont","Segoe UI","Noto Sans","Helvetica","Arial","sans-serif","Apple Color Emoji","Segoe UI Emoji"]),mono:k(["SFMono-Regular","Consolas","Liberation Mono","Menlo","Courier","monospace"])},fontSizes:["12px","14px","16px","20px","24px","32px","40px","48px"],fontWeights:{light:300,normal:400,semibold:500,bold:600},lineHeights:E,radii:["0","3px","6px","100px"],sizes:{small:"544px",medium:"768px",large:"1012px",xlarge:"1280px"},space:["0","4px","8px","16px","24px","32px","40px","48px","64px","80px","96px","112px","128px"],colorSchemes:Object.entries(S().colors).reduce((function(e,n){var o=(0,t.Z)(n,2),r=o[0],i=function(e){return{colors:O(e,(function(e){return function(e){return!(T(e)||!e.startsWith("#")&&!e.startsWith("rgb")&&!e.startsWith("hsl"))}(e)})),shadows:O(e,(function(e){return T(e)}))}}(o[1]),a=i.colors,l=i.shadows;return Object.assign(Object.assign({},e),(0,j.Z)({},r,{colors:N(a),shadows:N(l)}))}),{})},R=(y.U2,y.qC),P=y.By,B=R(y.Dh,y.$_,y.jf),I=P({whiteSpace:{property:"whiteSpace"}}),Z=R(y.cp,I),H=(R(y.Cg,y.AF),y.bK,o(9948)),D=o.n(H),_=o(4164),A="light",z="dark",W=(0,p.createContext)({setColorMode:function(){return null},setDayScheme:function(){return null},setNightScheme:function(){return null}}),U=function(e){var n,o,i,a,l,s,c,d,u=e.children,h=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["children"]),f=J(),m=f.theme,v=f.colorMode,g=f.dayScheme,x=f.nightScheme,y=null!==(o=null!==(n=h.theme)&&void 0!==n?n:m)&&void 0!==o?o:F,j=function(){var e;try{var n=null===(e=document.getElementById("__PRIMER_DATA__"))||void 0===e?void 0:e.textContent;if(n)return JSON.parse(n)}catch(e){}return{}}(),w=j.resolvedServerColorMode,S=(0,p.useRef)(w),C=(0,p.useState)(null!==(a=null!==(i=h.colorMode)&&void 0!==i?i:v)&&void 0!==a?a:"day"),k=(0,t.Z)(C,2),T=k[0],O=k[1],N=(0,p.useState)(null!==(s=null!==(l=h.dayScheme)&&void 0!==l?l:g)&&void 0!==s?s:A),L=(0,t.Z)(N,2),M=L[0],E=L[1],R=(0,p.useState)(null!==(d=null!==(c=h.nightScheme)&&void 0!==c?c:x)&&void 0!==d?d:z),P=(0,t.Z)(R,2),B=P[0],I=P[1],Z=function(){var e=(0,p.useState)(K),n=(0,t.Z)(e,2),o=n[0],r=n[1];return(0,p.useEffect)((function(){var e,n=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)");function o(e){var n=e.matches;r(n?"night":"day")}if(n){if(void 0!==n.addEventListener)return n.addEventListener("change",o),function(){n.removeEventListener("change",o)};if(void 0!==n.addListener)return n.addListener(o),function(){n.removeListener(o)}}}),[]),o}(),H=S.current||q(T,Z),U=function(e,n,o){switch(e){case"day":case"light":return n;case"dark":case"night":return o}}(H,M,B),G=(0,p.useMemo)((function(){return function(e,n){if(!e.colorSchemes)return{resolvedTheme:e,resolvedColorScheme:void 0};if(!e.colorSchemes[n]){console.error("`".concat(n,"` scheme not defined in `theme.colorSchemes`"));var o=Object.keys(e.colorSchemes)[0];return{resolvedTheme:o?D()(e,e.colorSchemes[o]):e,resolvedColorScheme:o}}return{resolvedTheme:D()(e,e.colorSchemes[n]),resolvedColorScheme:n}}(y,U)}),[y,U]),V=G.resolvedTheme,X=G.resolvedColorScheme,Y=(0,p.useMemo)((function(){return{theme:V,colorScheme:U,colorMode:T,resolvedColorMode:H,resolvedColorScheme:X,dayScheme:M,nightScheme:B,setColorMode:O,setDayScheme:E,setNightScheme:I}}),[T,U,M,B,H,X,V]);return(0,p.useEffect)((function(){var e=q(T,Z);S.current&&(S.current!==e&&window.setTimeout((function(){(0,_.flushSync)((function(){O(e)})),O(T)})),S.current=null)}),[T,Z]),(0,p.useEffect)((function(){var e,n;O(null!==(n=null!==(e=h.colorMode)&&void 0!==e?e:v)&&void 0!==n?n:"day")}),[h.colorMode,v]),(0,p.useEffect)((function(){var e,n;E(null!==(n=null!==(e=h.dayScheme)&&void 0!==e?e:g)&&void 0!==n?n:A)}),[h.dayScheme,g]),(0,p.useEffect)((function(){var e,n;I(null!==(n=null!==(e=h.nightScheme)&&void 0!==e?e:x)&&void 0!==n?n:z)}),[h.nightScheme,x]),(0,r.jsx)(W.Provider,{value:Y,children:(0,r.jsxs)(b.f6,{theme:V,children:[u,h.preventSSRMismatch?(0,r.jsx)("script",{type:"application/json",id:"__PRIMER_DATA__",dangerouslySetInnerHTML:{__html:JSON.stringify({resolvedServerColorMode:H})}}):null]})})};function J(){return(0,p.useContext)(W)}function K(){var e,n;return"undefined"!=typeof window&&(null===(n=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===n?void 0:n.matches)?"night":"day"}function q(e,n){return"auto"===e?n:e}var G=(0,b.vJ)(L||(L=(0,x.Z)(["\n * { box-sizing: border-box; }\n body { margin: 0; }\n table { border-collapse: collapse; }\n input { color-scheme: ",'; }\n\n [role="button"]:focus:not(:focus-visible):not(.focus-visible),\n [role="tabpanel"][tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),\n button:focus:not(:focus-visible):not(.focus-visible),\n summary:focus:not(:focus-visible):not(.focus-visible),\n a:focus:not(:focus-visible):not(.focus-visible) {\n outline: none;\n box-shadow: none;\n }\n\n [tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),\n details-dialog:focus:not(:focus-visible):not(.focus-visible) {\n outline: none;\n }\n'])),(function(e){return e.colorScheme})),V=b.ZP.div(M||(M=(0,x.Z)(["\n ",";\n ",";\n"])),Z,B);function X(e){var n=e.children,o=e.color,t=void 0===o?"fg.default":o,i=e.fontFamily,a=void 0===i?"normal":i,l=e.lineHeight,s=void 0===l?"default":l,c=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["children","color","fontFamily","lineHeight"]),d=J(),u=d.colorScheme,p=d.dayScheme,h=d.nightScheme;return(0,r.jsxs)(V,Object.assign({},c,{color:t,fontFamily:a,lineHeight:s,"data-portal-root":!0,"data-color-mode":(null==u?void 0:u.includes("dark"))?"dark":"light","data-light-theme":p,"data-dark-theme":h,children:[(0,r.jsx)(G,{colorScheme:(null==u?void 0:u.includes("dark"))?"dark":"light"}),n]}))}var Y,$=o(6635),Q=o(1828),ee=o(2104),ne=o(8490),oe=function(e){return(0,ne.ZP)(e.sx)},te=b.ZP.div(y.Dh,y.$_,y.cp,y.bK,y.GQ,y.eC,y.Oq,y.Cg,y.FK,y.AF,oe),re=o(2909),ie=b.ZP.span(Y||(Y=(0,x.Z)(["\n ",";\n ",";\n ",";\n"])),Z,B,oe);function ae(e){var n=e.ctx,o=e.path,t=e.diffType,i=e.open,a=e.onChangeOpen,l=void 0===t?"fg.muted":se[t],s=o.split("/");return(0,r.jsxs)(te,{className:"split-diff-view-file-header",display:"flex",alignItems:"center",bg:"accent.subtle",color:l,paddingX:2,paddingY:1,lineHeight:2,backgroundColor:"canvas.subtle",borderTopRightRadius:2,borderTopLeftRadius:2,borderBottomColor:"border.default",borderBottomStyle:"solid",borderBottomWidth:"1px",children:[a?(0,r.jsx)(te,{paddingRight:2,onClick:function(){return a(!i)},sx:{cursor:"pointer"},children:i?(0,r.jsx)(re.g8U,{size:24}):(0,r.jsx)(re.v4q,{size:24})}):null,void 0!==t&&(0,r.jsx)(m.J,{icon:ce[t]}),(0,r.jsx)(ie,{fontFamily:"mono",fontSize:12,children:s.reduce((function(e,o,t){var i=s.slice(t).join("/"),a=null==n?void 0:n.copy;return(0,r.jsxs)("span",{className:a?"file-header-copyable-path":void 0,children:[e,(0,r.jsxs)("span",{title:a?"Copy ".concat(i):void 0,onClick:a?function(){return a(i)}:void 0,className:"file-header-path-element",children:[o,t<s.length-1?"/":""]})]},t)}),(0,r.jsx)("span",{}))})]})}var le,se={Modified:"var(--scm-modified-foreground)",Added:"var(--scm-added-foreground)",Removed:"var(--scm-removed-foreground)",Renamed:"var(--scm-modified-foreground)",Copied:"var(--scm-added-foreground)"},ce={Modified:"diff-modified",Added:"diff-added",Removed:"diff-removed",Renamed:"diff-renamed",Copied:"diff-renamed"},de=o(2982),ue=o(2840),pe={small:"16px",medium:"32px",large:"64px"},he=(0,b.ZP)((function(e){var n=e.size,o=void 0===n?"medium":n,t=function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]])}return o}(e,["size"]),i=pe[o];return(0,r.jsxs)("svg",Object.assign({height:i,width:i,viewBox:"0 0 16 16",fill:"none"},t,{children:[(0,r.jsx)("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),(0,r.jsx)("path",{d:"M15 8a7.002 7.002 0 00-7-7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]}))}))(le||(le=(0,x.Z)(["\n @keyframes rotate-keyframes {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n animation: rotate-keyframes 1s linear infinite;\n\n ","\n"])),oe);function fe(e){var n,o,t=e.beforeLineNumber,i=e.before,a=e.afterLineNumber,l=e.after,s=e.rowType,c=e.path,d=e.openFileToLine;switch(s){case"remove":n="patch-remove-line",o=void 0;break;case"modify":n="patch-remove-line",o="patch-add-line";break;case"add":n=void 0,o="patch-add-line";break;case"common":n=void 0,o=void 0;break;case"expanded":n="patch-expanded",o="patch-expanded"}var u="expanded"!==s;return(0,r.jsxs)("tr",{children:[(0,r.jsx)(me,{className:n,content:i,lineNumber:t,path:c,side:"LEFT",canComment:u}),(0,r.jsx)(me,{className:o,content:l,lineNumber:a,path:c,side:"RIGHT",canComment:u,openFileToLine:d})]})}function me(e){var n=e.className,o=e.content,t=e.lineNumber,i=e.path,a=e.side,l=e.openFileToLine,s="RIGHT"===a?ve:{},c=null!=l&&null!=t,d=(null!=n?" ".concat(n,"-number"):"")+(c?" clickable":"");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(te,Object.assign({as:"td",className:"lineNumber".concat(d),"data-line-number":t,"data-path":i,"data-side":a,onClick:c?function(){return l(t)}:void 0},s,{children:t})),(0,r.jsx)("td",{className:n,children:o})]})}he.displayName="Spinner";var ve={borderLeftWidth:"1px",borderLeftStyle:"solid",borderLeftColor:"border.default"},ge=(0,p.memo)((function(e){var n,o=e.ctx,i=e.path,a=e.patch,l=e.preamble,s=(0,p.useState)(!1),c=(0,t.Z)(s,2),d=c[0],u=c[1],h=(0,p.useState)((function(){return new Set})),f=(0,t.Z)(h,2),m=f[0],v=f[1],g=(0,p.useCallback)((function(e){var n=new Set(m);n.add(e),v(n)}),[m,v]),x=null!==(n=o.translate)&&void 0!==n?n:function(e){return e},b="/dev/null"===a.newFileName,y=a.hunks,j=y.length-1,w=(0,de.Z)(null!=l?l:[]);return!b||d?y.forEach((function(e,n){if(0===n&&(1!==e.oldStart||1!==e.newStart)){var a="s0";if(m.has(a)){var l={id:o.id,start:1,numLines:e.oldStart-1};w.push((0,r.jsx)(je,{ctx:o,range:l,path:i,beforeLineStart:1,afterLineStart:1,t:x},a))}else{var s=Math.max(e.oldStart,e.newStart)-1;w.push((0,r.jsx)(ye,{numLines:s,onExpand:function(){return g(a)},t:x},a))}}if(function(e,n,o,i){var a=e.oldStart,l=e.newStart,s=function(e){var n=[],o={common:[],removed:[],added:[]};return e.forEach((function(e){var t=e.charAt(0),r=e.slice(1);" "===t?(function(e){return 0!==e.removed.length||0!==e.added.length}(o)&&(n.push(o),o={common:[],removed:[],added:[]}),o.common.push(r)):"-"===t?o.removed.push(r):"+"===t&&o.added.push(r)})),n.push(o),n}(e.lines),c=a,d=l;s.forEach((function(e){var a=e.common,l=e.removed,s=e.added;xe(a,n,"common",c,d,o,i),c+=a.length,d+=a.length;for(var u=Math.max(l.length,s.length),p=0;p<u;++p){var h=l[p],f=s[p];if(null!=h&&null!=f){var m=be(h,f),v=(0,t.Z)(m,2),g=v[0],x=v[1];o.push((0,r.jsx)(fe,{beforeLineNumber:c,before:g,afterLineNumber:d,after:x,rowType:"modify",path:n,openFileToLine:i},"".concat(c,"/").concat(d))),++c,++d}else null!=h?(o.push((0,r.jsx)(fe,{beforeLineNumber:c,before:h,afterLineNumber:null,after:null,rowType:"remove",path:n,openFileToLine:i},"".concat(c,"/"))),++c):(o.push((0,r.jsx)(fe,{beforeLineNumber:null,before:null,afterLineNumber:d,after:f,rowType:"add",path:n,openFileToLine:i},"/".concat(d))),++d)}}))}(e,i,w,o.openFileToLine),n!==j){var c=y[n+1],d="s".concat(e.oldStart);if(m.has(d)){var u=e.oldStart+e.oldLines,p=c.oldStart-u,h={id:o.id,start:u,numLines:p};w.push((0,r.jsx)(je,{ctx:o,range:h,path:i,beforeLineStart:e.oldStart+e.oldLines,afterLineStart:e.newStart+e.newLines,t:x},d))}else{var f=c.oldStart-e.oldLines-e.oldStart;w.push((0,r.jsx)(ye,{numLines:f,onExpand:function(){return g(d)},t:x},d))}}})):w.push((0,r.jsx)(we,{children:(0,r.jsxs)(te,{display:"inline-block",onClick:function(){return u(!0)},padding:1,sx:{cursor:"pointer",":hover":{bg:"accent.emphasis",color:"fg.onEmphasis"}},children:[(0,r.jsx)(re.NoM,{size:16}),(0,r.jsx)(ie,{paddingX:4,children:"Show deleted file"}),(0,r.jsx)(re.NoM,{size:16})]})},"show-deleted")),(0,r.jsxs)("table",{className:"SplitDiffView-hunk-table",children:[(0,r.jsxs)("colgroup",{children:[(0,r.jsx)("col",{width:50}),(0,r.jsx)("col",{width:"50%"}),(0,r.jsx)("col",{width:50}),(0,r.jsx)("col",{width:"50%"})]}),(0,r.jsx)("tbody",{children:w})]})}));function xe(e,n,o,t,i,a,l){var s=t,c=i;e.forEach((function(e){a.push((0,r.jsx)(fe,{beforeLineNumber:s,before:e,afterLineNumber:c,after:e,rowType:o,path:n,openFileToLine:l},"".concat(s,"/").concat(c))),++s,++c}))}function be(e,n){if(e.length+n.length>300)return[e,n];var o=(0,ue.Kx)(e,n),t=[],i=[];return o.forEach((function(e,n){var o=e.added,a=e.removed,l=e.value;o?i.push((0,r.jsx)("span",{className:"patch-add-word",children:l},n)):a?t.push((0,r.jsx)("span",{className:"patch-remove-word",children:l},n)):(t.push(l),i.push(l))})),[t,i]}function ye(e){var n=e.numLines,o=e.onExpand;if(0===n)return null;var t=1===n?"Expand 1 line":"Expand ".concat(n," lines");return(0,r.jsx)(we,{children:(0,r.jsxs)(te,{display:"inline-block",onClick:o,padding:1,sx:{cursor:"pointer",":hover":{bg:"accent.emphasis",color:"fg.onEmphasis"}},children:[(0,r.jsx)(re.NoM,{size:16}),(0,r.jsx)(ie,{paddingX:4,children:t}),(0,r.jsx)(re.NoM,{size:16})]})})}var je=(0,d.Pi)((function(e){var n=e.ctx,o=e.path,t=e.range,i=e.beforeLineStart,a=e.afterLineStart,l=n.atoms.lineRange(t).get();switch(l.state){case"fulfilled":var s=[];return xe(l.value,o,"expanded",i,a,s,n.openFileToLine),(0,r.jsx)(r.Fragment,{children:s});case"pending":return(0,r.jsx)(we,{children:(0,r.jsx)(te,{padding:1,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",children:(0,r.jsxs)(te,{display:"flex",alignItems:"center",children:[(0,r.jsx)(he,{size:"small"}),(0,r.jsx)(ie,{marginLeft:2,children:"Loading..."})]})})});case"rejected":return(0,r.jsx)(we,{children:(0,r.jsx)(te,{padding:1,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",children:(0,r.jsx)(te,{display:"flex",alignItems:"center",children:(0,r.jsxs)(ie,{children:["Error: ",l.value.message]})})})})}}));function we(e){var n=e.children;return(0,r.jsx)(te,{as:"tr",bg:"accent.subtle",color:"fg.muted",height:12,children:(0,r.jsx)(te,{as:"td",colSpan:4,className:"separator",children:n})})}function Se(e){var n,o,t,i,l=e.ctx,s=e.path,c=e.patch,d=null!==(o=null!==(n=c.newFileName)&&void 0!==n?n:c.oldFileName)&&void 0!==o?o:"/dev/null",u=ge,p=[];return c.type===a.DiffType.Added&&p.push((0,r.jsx)(Ce,{children:"This file was added"},"added")),c.type===a.DiffType.Removed&&p.push((0,r.jsx)(Ce,{children:"This file was removed"},"deleted")),c.type===a.DiffType.Renamed&&p.push((0,r.jsxs)(Ce,{children:["This file was renamed from ",null!==(t=c.oldFileName)&&void 0!==t?t:""]},"renamed")),c.type===a.DiffType.Copied&&p.push((0,r.jsxs)(Ce,{children:["This file was copied from ",null!==(i=c.oldFileName)&&void 0!==i?i:""]},"copied")),(0,r.jsxs)(te,{className:"split-diff-view",borderWidth:"1px",borderStyle:"solid",borderColor:"border.default",borderRadius:2,children:[(0,r.jsx)(ae,{ctx:l,path:d,diffType:c.type}),(0,r.jsx)(u,{ctx:l,path:s,patch:c,preamble:p})]})}function Ce(e){var n=e.children;return(0,r.jsx)(te,{as:"tr",bg:"attention.subtle",color:"fg.muted",height:12,children:(0,r.jsx)(te,{as:"td",colSpan:4,className:"separator",children:(0,r.jsx)(te,{padding:1,children:n})})})}var ke=(0,p.memo)((0,d.Pi)((function(){var e=J().theme;return(0,r.jsx)("style",{children:"\n.patch-word-begin {\n border-top-left-radius: .2em;\n border-bottom-left-radius: .2em;\n}\n\n.patch-word-end {\n border-top-right-radius: .2em;\n border-bottom-right-radius: .2em;\n}\n\n.patch-add-line {\n background-color: ".concat(null==e?void 0:e.colors.diffBlob.addition.lineBg,";\n}\n\n.patch-add-line-number {\n color: ").concat(null==e?void 0:e.colors.diffBlob.addition.numText,";\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.addition.numBg,";\n}\n\n.patch-add-word {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.addition.wordBg,";\n}\n\n.patch-remove-line {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.lineBg,";\n}\n\n.patch-remove-line-number {\n color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.numText,";\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.numBg,";\n}\n\n.patch-remove-word {\n background-color: ").concat(null==e?void 0:e.colors.diffBlob.deletion.wordBg,";\n}\n\n.patch-expanded, .patch-expanded-number {\n background-color: ").concat(null==e?void 0:e.colors.canvas.subtle,";\n}\n\n.patch-expanded-number {\n color: ").concat(null==e?void 0:e.colors.fg.subtle,";\n}\n\n.SplitDiffView-hunk-table td {\n font-family: ").concat(null==e?void 0:e.fonts.mono,"\n}\n\n.lineNumber.clickable {\n cursor: pointer;\n}\n\n.lineNumber.clickable:hover {\n text-decoration: underline;\n}\n/**\n * pl = prettylights theme\n *\n * Mapping from CSS class name to Primer color deduced from a combination of:\n * https://cdn.jsdelivr.net/npm/github-syntax-theme-generator@0.5.0/build/css/github-light.css\n * https://primer.style/react/theme-reference\n *\n * Though it is a bit confusing because github-light.css defines some classes\n * multiple times, such as .pl-s.\n */\n\n.pl-ba {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.brackethighlighterAngle,";\n}\n\n.pl-bu {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.brackethighlighterUnmatched,";\n}\n\n.pl-c {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.comment,";\n}\n\n.pl-c1 {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.constant,";\n}\n\n.pl-c2 {\n background-color: ").concat(null==e?void 0:e.colors.prettylights.syntax.carriageReturnBg,";\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.carriageReturnText,';\n}\n\n.pl-c2::before {\n content: "^M";\n}\n\n.pl-corl {\n color: ').concat(null==e?void 0:e.colors.prettylights.syntax.constantOtherReferenceLink,";\n text-decoration: underline;\n}\n\n.pl-e, .pl-en {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.entity,";\n}\n\n.pl-ent {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.entityTag,";\n}\n\n.pl-ii {\n background-color: ").concat(null==e?void 0:e.colors.prettylights.syntax.invalidIllegalBg,";\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.invalidIllegalText,";\n}\n\n.pl-k {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.keyword,";\n}\n\n.pl-s, .pl-pds {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.string,";\n}\n\n.pl-sg {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.sublimelinterGutterMark,";\n}\n\n.pl-smi {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.storageModifierImport,";\n}\n\n.pl-sr {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.stringRegexp,";\n font-weight: bold;\n}\n\n.pl-v {\n color: ").concat(null==e?void 0:e.colors.prettylights.syntax.variable,";\n}\n")})}))),Te=o(5288);function Oe(e){return(0,a.parsePatch)(e).filter((function(e){return e.hunks.length>0||null!=e.newFileName||null!=e.oldFileName}))}var Ne=(0,v.N)({genKey:function(e){switch(e.type){case a.ComparisonType.Range:throw new Error("Version comparison not supported");case a.ComparisonType.Committed:return"Committed ".concat(e.hash);case a.ComparisonType.Commit:throw new Error("Commit comparison not supported");case a.ComparisonType.HeadChanges:return"HEAD";case a.ComparisonType.StackChanges:return"STACK";case a.ComparisonType.UncommittedChanges:return"UNCOMMITTED"}},genValue:function(e){return(0,g.u)({default:{isLoading:!0,data:null},setter:function(n){n.isLoading&&Q.H.postMessage({type:"requestComparison",comparison:e})},effects:[function(n){var o=n.setSelf,t=Q.H.onMessageOfType("comparison",(function(n){var t,r;e.type===n.comparison.type&&o({isLoading:!1,data:(t=n.data.diff,r=Oe,null==t.error?{value:r(t.value)}:t)})}));return function(){return t.dispose()}}]})}}),Le=(0,v.N)({genKey:function(e){return s()(e)},genValue:function(e){return(0,c.Fl)((function(){ee.ql.get(),Q.H.postMessage(Object.assign({type:"requestComparisonContextLines"},e));var n=new Promise((function(e){var n=Q.H.onMessageOfType("comparisonContextLines",(function(o){e(o.lines),n.dispose()}))}));return(0,u.p4)(n)}))}});function Me(e){var n=Ne(e);return[n.get(),(0,p.useCallback)((function(){(0,c.z)((function(){var e=n.get();n.set(Object.assign(Object.assign({},e),{isLoading:!0}))}))}),[n])]}var Ee=(0,d.Pi)((function(e){var n=e.comparison,o=(0,$.F)(),i=Me(n),a=(0,t.Z)(i,2),l=a[0],s=a[1];return(0,p.useEffect)(s,[n,s]),(0,r.jsx)("div",{"data-testid":"comparison-view",className:"comparison-view",children:(0,r.jsxs)(U,{colorMode:"light"===o.colorScheme?"day":"night",children:[(0,r.jsx)(ke,{}),(0,r.jsxs)(X,{className:"comparison-view-base-styles",children:[(0,r.jsx)(Re,{comparison:n}),(0,r.jsx)("div",{className:"comparison-view-details",children:null==l.data?(0,r.jsx)(m.J,{icon:"loading"}):null!=l.data.error?(0,r.jsx)(f.W,{error:l.data.error,title:"Unable to load comparison"}):0===l.data.value.length?(0,r.jsx)(h,{children:"No Changes"}):l.data.value.map((function(e,o){return(0,r.jsx)(Pe,{diff:e,comparison:n},o)}))})]})]})})})),Fe=[a.ComparisonType.UncommittedChanges,a.ComparisonType.HeadChanges,a.ComparisonType.StackChanges],Re=(0,d.Pi)((function(e){var n=e.comparison,o=Me(n),l=(0,t.Z)(o,2),s=l[0],d=l[1];return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"comparison-view-header",children:[(0,r.jsxs)("span",{className:"comparison-view-header-group",children:[(0,r.jsxs)(i.Yb,{"data-testid":"comparison-view-picker",value:n.type,onChange:function(e){var n=Te._.get();Te._.set(Object.assign(Object.assign({},n),{comparison:{type:e.currentTarget.value}}))},children:[Fe.map((function(e){return(0,r.jsx)(i.nH,{value:e,children:(0,a.labelForComparison)({type:e})},e)})),Fe.includes(n.type)?null:(0,r.jsx)(i.nH,{value:n.type,children:(0,a.labelForComparison)(n)},n.type)]}),(0,r.jsx)(i.vD,{title:"Reload this comparison. Comparisons do not refresh automatically.",appearance:"secondary",onClick:d,children:(0,r.jsx)(m.J,{icon:"refresh","data-testid":"comparison-refresh-button"})}),s.isLoading?(0,r.jsx)(m.J,{icon:"loading","data-testid":"comparison-loading"}):null]}),(0,r.jsx)(i.vD,{"data-testid":"close-comparison-view-button",appearance:"icon",onClick:function(){return(0,c.z)((function(){var e=Te._.get();Te._.set(Object.assign(Object.assign({},e),{visible:!1}))}))},children:(0,r.jsx)(m.J,{icon:"x"})})]})})}));function Pe(e){var n,o,t=e.diff,i=e.comparison,a=(0,$.F)(),l=null!==(o=null!==(n=t.newFileName)&&void 0!==n?n:t.oldFileName)&&void 0!==o?o:"",s={id:{path:l,comparison:i},atoms:{lineRange:Le},copy:a.copyToClipboard,openFileToLine:Be(i)?function(e){return a.openFile(l,{line:e})}:void 0};return(0,r.jsx)("div",{className:"comparison-view-file",children:(0,r.jsx)(Se,{ctx:s,patch:t,path:l})},l)}function Be(e){switch(e.type){case a.ComparisonType.UncommittedChanges:case a.ComparisonType.HeadChanges:case a.ComparisonType.StackChanges:return!0;case a.ComparisonType.Committed:case a.ComparisonType.Commit:case a.ComparisonType.Range:return!1}}}}]);
|