@evandu/super-pi 0.1.312 → 0.1.314
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/client/.super-pi-client-sources.json +12 -8
- package/dist/client/assets/CodeMirrorEditor-DodqscaS.js +2 -0
- package/dist/client/assets/GitDiffEditor-BA3eG1na.js +29 -0
- package/dist/client/assets/{index-12mdWLr3.js → index-B9lWq5MJ.js} +66 -59
- package/dist/client/assets/index-CtsA5apS.css +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/CodeMirrorEditor-CHzeo3AO.js +0 -2
- package/dist/client/assets/GitDiffEditor-UbWgTpJv.js +0 -29
- package/dist/client/assets/index-BcWXglOe.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-B9lWq5MJ.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CtsA5apS.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-D978o95T.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-DTIPfQj7.js","assets/dist-S5ntGzJB.js","assets/dist-Cus6_oaF.js","assets/dist-DP4hrTBF.js","assets/dist-Qjm1p8SR.js","assets/dist-BJHpSQV1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,c as n,g as r,h as i,i as a,l as o,o as s,r as c,s as l,u,v as d,y as f}from"./index-12mdWLr3.js";var p=e(f(),1);function m(e,t,n,r){return[n.EditorView.decorations.compute([`selection`,`doc`],e=>n.Decoration.set(e.selection.ranges.filter(e=>!e.empty).map(e=>n.Decoration.mark({class:`cm-workbench-selectedText`}).range(e.from,e.to)),!0)),n.ViewPlugin.define(e=>{let n=null,i,a=!1,s=e=>{n&&(e===`expanded`?(a=!a,l()):n.querySelector(`input[name="${e===`caseSensitive`?`case`:e===`wholeWord`?`word`:`re`}"]`)?.click())},c=e=>{let t=o(e);t&&(e.preventDefault(),e.stopPropagation(),s(t))},l=()=>{if(!n||!i)return;let r=t.getSearchQuery(e.state);if(n.dataset.editorSearchExpanded=String(a),i.update({caseSensitive:r.caseSensitive,wholeWord:r.wholeWord,regexp:r.regexp,expanded:a}),n.querySelector(`[data-find-error]`)?.remove(),r.search&&!r.valid){let e=document.createElement(`output`);e.dataset.findError=``,e.setAttribute(`role`,`alert`),e.textContent=`正则表达式无效`,n.append(e)}},d=()=>{let o=r.querySelector(`.cm-panel.cm-search`);if(o===n)return;if(n?.removeEventListener(`keydown`,c,!0),i?.destroy(),n=o,!n){i=void 0;return}for(let[e,t,r]of[[`next`,`↓`,`下一处`],[`prev`,`↑`,`上一处`]]){let i=n.querySelector(`button[name="${e}"]`);i&&(i.textContent=t,i.setAttribute(`aria-label`,r),i.title=r)}let d=document.createElement(`span`);d.dataset.findControls=``,n.prepend(d);let f=t.getSearchQuery(e.state);a=!1,i=u(d,{...f,expanded:a},s),n.addEventListener(`keydown`,c,!0),l()},f=new MutationObserver(d);return f.observe(r,{childList:!0,subtree:!0}),d(),{update(){l()},destroy(){f.disconnect(),n?.removeEventListener(`keydown`,c,!0),i?.destroy()}}}),e.Prec.highest(n.keymap.of([{key:`Mod-Shift-l`,run:t.selectSelectionMatches},{key:`Mod-h`,scope:`editor search-panel`,run:e=>(t.searchPanelOpen(e.state)||t.openSearchPanel(e),requestAnimationFrame(()=>{e.dom.isConnected&&r.querySelector(`[data-editor-search-options][aria-expanded="false"]`)?.click()}),!0)},...[`c`,`w`,`r`].map(e=>({key:`Alt-${e}`,run:n=>{t.searchPanelOpen(n.state)||t.openSearchPanel(n);let r=t.getSearchQuery(n.state);return n.dispatch({effects:t.setSearchQuery.of(new t.SearchQuery({...r,...e===`c`?{caseSensitive:!r.caseSensitive}:e===`w`?{wholeWord:!r.wholeWord}:{regexp:!r.regexp}}))}),!0}}))])),n.panels({topContainer:r}),n.EditorView.scrollMargins.of(()=>({top:r.querySelector(`.cm-search`)?Math.min(r.getBoundingClientRect().height+8,Math.max(0,(r.parentElement?.clientHeight??0)-32)):0})),t.highlightSelectionMatches({wholeWords:!0,minSelectionLength:1,maxMatches:1e3}),t.search({top:!0}),e.EditorState.phrases.of({Find:`查找`,Replace:`替换为`,next:`下一处`,previous:`上一处`,all:`全部选中`,"match case":`区分大小写`,regexp:`正则表达式`,"by word":`全词匹配`,replace:`替换`,"replace all":`全部替换`,close:`关闭查找`,"current match":`当前匹配`,"on line":`所在行`})]}function h(e,t,r,i,a){let o=new e.Compartment,c=()=>{let n=s();return[e.EditorState.tabSize.of(n.tabSize),r.indentUnit.of(n.indent===`tabs`?` `:` `.repeat(n.tabSize)),n.wrap?t.EditorView.lineWrapping:[],n.whitespace?[t.highlightWhitespace(),t.highlightTrailingWhitespace()]:[]]};return[e.EditorState.allowMultipleSelections.of(!0),t.rectangularSelection(),t.crosshairCursor({key:`Alt`}),e.EditorState.phrases.of({"folded code":`已折叠代码`,unfold:`展开代码`,"Fold line":`折叠代码`,"Unfold line":`展开代码`}),t.highlightActiveLineGutter(),t.highlightSpecialChars(),t.dropCursor(),r.bracketMatching(),r.indentOnInput(),r.foldGutter(),i.closeBrackets(),e.Prec.highest(t.keymap.of([...i.closeBracketsKeymap,...r.foldKeymap,{key:`Alt-z`,run:()=>(l({wrap:!s().wrap}),!0)},{key:`Mod-Shift-z`,run:a.redo},{key:`Mod-y`,run:a.redo}])),o.of(c()),t.ViewPlugin.define(e=>({destroy:n(()=>{e.dispatch({effects:o.reconfigure(c())})})}))]}var g=new Map;function ee(e){let t=g.get(e);return t&&(g.delete(e),g.set(e,t)),t}function _(e,t){g.delete(e),g.set(e,t);let n=[...g.values()].reduce((e,t)=>e+t.state.doc.length,0);for(;g.size>32||n>16777216;){let e=g.keys().next().value;n-=g.get(e).state.doc.length,g.delete(e)}}var v=d(),te=262144,y=131072;function ne(e){return e.split(`.`).pop()?.toLowerCase()??``}function b(e,t,n=!1){let r=e=>n?`var(--git-diff-${e.slice(5)}, var(${e}))`:`var(${e})`;return e.HighlightStyle.define([{tag:t.tags.keyword,color:r(`--cm-keyword`)},{tag:t.tags.string,color:r(`--cm-string`)},{tag:t.tags.number,color:r(`--cm-number`)},{tag:t.tags.comment,color:r(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:r(`--cm-function`)},{tag:t.tags.typeName,color:r(`--cm-type`)},{tag:t.tags.className,color:r(`--cm-type`)},{tag:t.tags.propertyName,color:r(`--cm-property`)},{tag:t.tags.operator,color:r(`--cm-operator`)},{tag:t.tags.variableName,color:r(`--cm-variable`)}])}function x({path:e,value:n,onChange:o,jumpToLine:s,onSave:l,workspaceId:u,cwd:d=``,blame:f,onPosition:g,onView:x,readOnly:S=!1,languageOverride:C}){let w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(null),re=(0,p.useRef)(null),D=JSON.stringify([u,d,e]),O=(0,p.useRef)(void 0),k=(0,p.useRef)(null),A=(0,p.useRef)(null),ie=(0,p.useRef)(null),j=(0,p.useRef)(null),M=(0,p.useRef)(null),N=(0,p.useRef)(null),P=(0,p.useRef)(o),F=(0,p.useRef)(l),I=(0,p.useRef)(n);I.current=n;let L=(0,p.useRef)(!1),R=(0,p.useRef)(x);R.current=x,P.current=o,F.current=l;let[z,ae]=(0,p.useState)(!1),[B,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(`0,0`),[W,oe]=(0,p.useState)(0),[G,K]=(0,p.useState)(1);(0,p.useEffect)(()=>{let i=!1,o,s,c,l,u;return(async()=>{try{let d=C??ne(e),f=r(d),[p,g,_,v,y,x,z,B,H]=await Promise.all([t(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([0,1])),t(()=>import(`./dist-DTIPfQj7.js`).then(e=>e.s),__vite__mapDeps([2,1,0])),t(()=>import(`./dist-S5ntGzJB.js`),__vite__mapDeps([3,0,1,2,4,5])),t(()=>import(`./dist-Qjm1p8SR.js`),__vite__mapDeps([6,0,1,2])),t(()=>import(`./dist-DP4hrTBF.js`).then(e=>e.d),__vite__mapDeps([5,1,0,2,4])),t(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),a().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null)),t(()=>import(`./dist-BJHpSQV1.js`).then(e=>e.r),__vite__mapDeps([7,1,0,2,5,4]))]);if(i||!w.current||!T.current)return;re.current=g.EditorView,l=y,u=x,A.current=p.Annotation.define(),ie.current=p.Transaction.addToHistory;let W=n.length<=te&&z!==null;s=new p.Compartment;let G=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),_.history(),g.keymap.of([_.indentWithTab,..._.defaultKeymap,..._.historyKeymap,...v.searchKeymap,{key:`Mod-s`,run:()=>(F.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(A.current&&e.transactions.some(e=>e.annotation(A.current)===!0))&&P.current(e.state.doc.toString()),e.selectionSet&&U(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(G.push(g.EditorView.updateListener.of(e=>{e.selectionSet&&K(e.state.selection.ranges.length),e.docChanged?L.current=!1:e.selectionSet&&(L.current=e.transactions.some(e=>e.isUserEvent(`select.search`)||e.isUserEvent(`select.pointer`)))}),m(p,v,g,T.current),h(p,g,y,H,_)),S&&G.push(p.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1),g.EditorView.contentAttributes.of({tabindex:`0`})),B&&!S&&(c=new p.Compartment,G.splice(1,0,c.of([])),G.push(B.base)),z)try{G.push(z)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),W=!1}if(W&&s&&l&&u)try{G.push(s.of(l.syntaxHighlighting(b(l,u))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),W=!1}let q=ee(D),J=q&&q.state.doc.toString()===I.current,Y=J?q.state.update({effects:p.StateEffect.reconfigure.of(G)}).state:p.EditorState.create({doc:I.current,extensions:G});if(o=new g.EditorView({state:Y,parent:w.current}),O.current=J?q.jump:void 0,K(o.state.selection.ranges.length),U(`${o.state.selection.main.from},${o.state.selection.main.to}`),J&&(o.scrollDOM.scrollTop=q.top,o.scrollDOM.scrollLeft=q.left,O.current=q.jump),i){o.destroy();return}E.current=o,R.current?.(o),ae(W),V(!0),j.current=B,M.current=c??null,N.current=null,oe(e=>e+1);let X=new MutationObserver(()=>{let e=E.current;if(e&&W&&s&&l&&u)try{e.dispatch({effects:s.reconfigure(l.syntaxHighlighting(b(l,u)))})}catch{}});k.current=X,X.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||V(!0)}})(),()=>{i=!0,k.current?.disconnect(),k.current=null,o&&_(D,{state:o.state,top:o.scrollDOM.scrollTop,left:o.scrollDOM.scrollLeft,jump:O.current}),o?.destroy(),E.current=null,R.current?.(),V(!1),w.current&&(w.current.textContent=``)}},[D,S,C]),(0,p.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.state.doc.toString();t!==n&&e.dispatch({changes:{from:0,to:t.length,insert:n},annotations:A.current?A.current.of(!0):void 0})},[n,B]),(0,p.useEffect)(()=>{let e=E.current;if(!e||!s||O.current===s.request)return;O.current=s.request;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},effects:re.current?.scrollIntoView(n,{y:`start`,yMargin:Math.round(e.scrollDOM.clientHeight/3)})}),e.focus()},[s,B]);let q=!!(f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u);(0,p.useEffect)(()=>{let t=E.current,n=j.current,r=M.current;if(!t||!n||!r)return;let i=f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u?f.response:null,a=i?c(i):null;N.current!==a&&(N.current=a,t.dispatch({effects:[n.setBlame.of(a),r.reconfigure(a?n.gutter:[])]}))},[f?.state,f?.response,f?.path,f?.workspaceId,e,u,W]);let J=E.current?.state.doc.toString()??n,Y=J.length<=y?J:J.slice(0,y),X=C??ne(e),Z=i(X),se=E.current?.state,Q=se?.selection.main.head,$=Q===void 0?void 0:se?.doc.lineAt(Q),ce=$?.number,le=Q!==void 0&&$?Q-$.from+1:void 0;return(0,p.useEffect)(()=>{let e=E.current;if(B&&e&&(!s||O.current===s.request)){let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);g?.({line:n.number,column:t-n.from+1,language:z&&Z||`纯文本`,highlight:z?X:`plain`,navigation:L.current,selections:e.state.selection.ranges.length})}},[B,ce,le,z,Z,X,g,G,s?.request]),(0,p.useEffect)(()=>()=>g?.(),[g]),(0,v.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":Y,"data-file-content-truncated":J.length>y?`1`:`0`,"data-file-selection":H,"data-editor-selection-count":G,"data-file-editor-ready":B?`1`:`0`,"data-file-blame-gutter":q?`1`:void 0,onMouseDown:e=>{e.target.closest(`.cm-panels`)||E.current?.focus()},children:[(0,v.jsx)(`div`,{className:`file-cm`,ref:w,"aria-label":`${S?`查看`:`编辑`} ${e}`}),(0,v.jsx)(`div`,{className:`workbench-editor-search`,ref:T,"data-editor-find-host":`file`}),(!B||!g)&&(0,v.jsxs)(`div`,{className:`file-editor-status`,children:[!B&&(0,v.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),B&&Q!==void 0&&$&&(0,v.jsxs)(`span`,{children:[`第 `,$.number,` 行,第 `,Q-$.from+1,` 列`]}),B&&!z&&(0,v.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),B&&z&&Z&&(0,v.jsx)(`span`,{"data-file-highlight-status":X,children:Z})]})]})}export{x as CodeMirrorEditor,m as n,h as t,b as themeHighlightStyle};
|