@nice2dev/ui 1.4.21 → 1.4.23
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 +79 -0
- package/dist/NiceCodeEditor-CBgbzwjx.cjs +297 -0
- package/dist/{NiceMention-DhaTUqvR.cjs → NiceMention-D330ovOt.cjs} +1 -1
- package/dist/{NicePivotGrid-BshofJh1.cjs → NicePivotGrid-B5Fgi5E_.cjs} +1 -1
- package/dist/charts/NiceAdvancedCharts.mjs +657 -613
- package/dist/charts/NiceBarGauge.mjs +100 -65
- package/dist/charts/NiceBullet.mjs +103 -98
- package/dist/charts/NiceChart.mjs +269 -266
- package/dist/charts/NiceCircularGauge.mjs +99 -70
- package/dist/charts/NiceLinearGauge.mjs +168 -119
- package/dist/charts/NicePieChart.mjs +94 -49
- package/dist/charts/NicePolarChart.mjs +2 -2
- package/dist/charts-C9B548D2.cjs +924 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +24 -2
- package/dist/{core-lazy-DirbU7jp.cjs → core-lazy-B54FdghB.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/editors/rich/NiceCodeEditor.mjs +525 -504
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.d.ts +29 -2
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +8 -0
- package/dist/style.css +1 -1
- package/dist/tools/NiceGitManager.mjs +5 -0
- package/dist/workflow/NiceTaskInbox.mjs +14 -12
- package/package.json +4 -4
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +0 -289
- package/dist/charts-C3Q3r8Yz.cjs +0 -918
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# [1.0.27] — 2026-06-07
|
|
2
2
|
|
|
3
|
+
## 1.4.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d2046c5: Charts A (round 44, 1.4.23): legends, gaps and gauges.
|
|
8
|
+
|
|
9
|
+
- **NicePieChart:**
|
|
10
|
+
- new `legendPlacement`: `right` (default, a column), `left`, `top` (under the title) or `bottom`;
|
|
11
|
+
- the plot takes the room left by the title and the legend;
|
|
12
|
+
- new `splitSize` sets the see-through gaps between slices (default 2, 0 for none). The gaps are cut
|
|
13
|
+
with a mask, so no slice's outline covers its neighbour any more.
|
|
14
|
+
- **NiceChart:** new `legendPlacement` (default `bottom`, as before).
|
|
15
|
+
- **NiceDrillDownChart:**
|
|
16
|
+
- drills on the documented `drillDownId` (only `metadata.childLevelId` worked before);
|
|
17
|
+
- drillable slices show a zoom cursor;
|
|
18
|
+
- `showBackButton` always shows the button, disabled at the top level;
|
|
19
|
+
- the pie fits above the legend, with see-through gaps and outlined labels.
|
|
20
|
+
- **NiceCircularGauge:**
|
|
21
|
+
- empty `color` and `trackColor` follow the theme;
|
|
22
|
+
- the arc, needle and texts scale with the size;
|
|
23
|
+
- it scales down in a narrow container.
|
|
24
|
+
- **NiceLinearGauge:**
|
|
25
|
+
- a vertical gauge runs along the longer side, with its own scale;
|
|
26
|
+
- new `showValueLabel`. **Changed default:** the value text is now hidden unless you set it; the
|
|
27
|
+
pointer shows the value as a tooltip;
|
|
28
|
+
- new `labelPlacement`: `bottom`, `top` or `left`.
|
|
29
|
+
- **NiceBarGauge:**
|
|
30
|
+
- the centre labels fit inside the innermost ring and line up as name | value, with a halo;
|
|
31
|
+
- the SVG scales down in a narrow container.
|
|
32
|
+
- **NiceBullet:**
|
|
33
|
+
- the value text is optically centred;
|
|
34
|
+
- the SVG scales down in a narrow container.
|
|
35
|
+
- **NicePolarChart:** the title sits lower.
|
|
36
|
+
- **NiceFunnel:** the label halo is thinner.
|
|
37
|
+
- **Exports:** new `NiceChartLegendPlacement` type.
|
|
38
|
+
|
|
39
|
+
- @nice2dev/i18n@1.4.23
|
|
40
|
+
- @nice2dev/ui-core@1.4.23
|
|
41
|
+
|
|
42
|
+
## 1.4.22
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 4a84396: Controls B (round 44, 1.4.22): editors, tools and media.
|
|
47
|
+
|
|
48
|
+
- **Built-in icons** (`NiceIcon` without a resolver):
|
|
49
|
+
- `refresh` takes NtdRefresh's shape: two arcs with solid heads, replacing the old corner glyph;
|
|
50
|
+
- `grip` is six dots;
|
|
51
|
+
- `indent` and `outdent` are text lines with a solid arrow head;
|
|
52
|
+
- built-ins can now have filled parts.
|
|
53
|
+
- **NiceCaptcha, NicePasswordGenerator:** the refresh button draws the refresh icon, not a CSS ring.
|
|
54
|
+
The captcha button has no frame.
|
|
55
|
+
- **NiceTaskInbox:** the refresh button is a frameless icon button.
|
|
56
|
+
- **NiceGitManager** fills its container, so the width no longer jumps between tabs.
|
|
57
|
+
- **NiceCodeDiffEditor:**
|
|
58
|
+
- it no longer scrolls past the last line;
|
|
59
|
+
- the line-number gutter is narrow, and the +/- markers have a gap before the code;
|
|
60
|
+
- new `options` passes Monaco settings through.
|
|
61
|
+
- **NiceCodeEditor:** the matching bracket pair gets a tinted box, and the bracket-pair guide line is
|
|
62
|
+
gone.
|
|
63
|
+
- **NiceChatWindow:** the hover actions sit centred beside the bubble.
|
|
64
|
+
- **NiceWorkflowInstanceMonitor:** the process name and the instance id are on two lines.
|
|
65
|
+
- **NiceDataExportCenter:**
|
|
66
|
+
- columns move up and down;
|
|
67
|
+
- a column takes its own header name (new `ExportField.header`);
|
|
68
|
+
- export configurations are saved under a name, picked from a list and deleted from the same bar.
|
|
69
|
+
- **NiceGenericPlayer:**
|
|
70
|
+
- dropped audio and video files join the playlist (`allowFileDrop`, `onFilesAdded`), and video
|
|
71
|
+
files play in the stage (new `'video'` source kind);
|
|
72
|
+
- a Playlist button shows and hides the list (`showPlaylist`);
|
|
73
|
+
- `showProControls` hides the shuffle, repeat, speed and A-B row.
|
|
74
|
+
- **NicePianoRoll:**
|
|
75
|
+
- new `snapToGrid` (on by default) snaps a new note to the grid;
|
|
76
|
+
- new `gridDivisions`, `noteLength` and `readOnly`.
|
|
77
|
+
|
|
78
|
+
- Updated dependencies [4a84396]
|
|
79
|
+
- @nice2dev/ui-core@1.4.22
|
|
80
|
+
- @nice2dev/i18n@1.4.22
|
|
81
|
+
|
|
3
82
|
## 1.4.21
|
|
4
83
|
|
|
5
84
|
### Patch Changes
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("@nice2dev/ui-core"),o=require("react"),fe=require("./injectStyleOnce-DeWaxcdf.cjs"),Ke=[{target:".nice-code-editor-wrap",titleKey:"tutorial.codeEditor.intro.title",title:"Code editor",contentKey:"tutorial.codeEditor.intro.content",content:"Edit code with syntax highlighting, IntelliSense and the toolbar. Ctrl+S saves; the status bar shows the cursor position and any problems.",placement:"auto"}];let ee=null,ne=null;const Ye="0.45.0",Me=`https://cdn.jsdelivr.net/npm/monaco-editor@${Ye}/min`,me=`${Me}/vs`,Ne=15e3;function Se(){const i=window;if(i.MonacoEnvironment?.getWorkerUrl)return;const a=`self.MonacoEnvironment={baseUrl:'${Me}/'};importScripts('${me}/base/worker/workerMain.js');`,d=URL.createObjectURL(new Blob([a],{type:"text/javascript"}));i.MonacoEnvironment={getWorkerUrl:()=>d}}function ce(i){if(i!=="auto")return i;if(typeof document>"u")return"vs";const a=document.documentElement.dataset.theme;return a==="dark"?"vs-dark":a==="light"?"vs":window.matchMedia?.("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}const Ee="nice-auto";let te;function Je(i){if(!i||typeof document>"u"||(te===void 0&&(te=document.createElement("canvas").getContext("2d")),!te))return null;const a="#010203";te.fillStyle=a,te.fillStyle=i;const d=String(te.fillStyle);if(d===a&&i.trim().toLowerCase()!==a)return null;if(d.startsWith("#"))return d;const r=d.match(/rgba?\(([^)]+)\)/);if(!r)return null;const[m,C,w,f=1]=r[1].split(",").map(c=>parseFloat(c)),b=c=>Math.max(0,Math.min(255,Math.round(c))).toString(16).padStart(2,"0");return`#${b(m)}${b(C)}${b(w)}${f<1?b(f*255):""}`}function Qe(i){const a=parseInt(i.slice(1,3),16),d=parseInt(i.slice(3,5),16),r=parseInt(i.slice(5,7),16);return(.299*a+.587*d+.114*r)/255}function ae(i,a,d){if(a!=="auto"||!d||typeof getComputedStyle>"u")return ce(a);const r=getComputedStyle(d),m=(...T)=>{for(const I of T){const g=Je(r.getPropertyValue(I).trim());if(g)return g}return null},C=m("--nice-bg-primary","--bg-primary"),w=m("--nice-text-primary","--text-primary");if(!C||!w)return ce(a);const f=m("--nice-bg-secondary","--bg-secondary")??C,b=m("--nice-text-secondary","--text-secondary")??w,c=m("--nice-color-primary","--primary")??w,V=m("--nice-border-color","--border-color")??b,L=c.slice(0,7);return i.editor.defineTheme(Ee,{base:Qe(C)<.5?"vs-dark":"vs",inherit:!0,rules:[],colors:{"editor.background":C,"editor.foreground":w,"editorLineNumber.foreground":b,"editorLineNumber.activeForeground":w,"editorCursor.foreground":L,"editor.selectionBackground":`${L}40`,"editor.inactiveSelectionBackground":`${L}26`,"editor.lineHighlightBackground":f,"editor.lineHighlightBorder":f,"editorWidget.background":f,"editorWidget.border":V,"editorSuggestWidget.background":f,"editorSuggestWidget.border":V,"minimap.background":C}}),Ee}function Re(i,a){const d=new MutationObserver(a),r={attributes:!0,attributeFilter:["data-theme","class","style"]};d.observe(document.documentElement,r);const m=i?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");m&&m!==document.documentElement&&d.observe(m,r);const C=window.matchMedia?.("(prefers-color-scheme: dark)");return C?.addEventListener?.("change",a),()=>{d.disconnect(),C?.removeEventListener?.("change",a)}}function Ze(i){if(!i)return"";try{return JSON.stringify([i.url,i.language,i.initOptions??null])}catch{return JSON.stringify([i.url,i.language])}}function Le(){return ne?Promise.resolve(ne):ee||(ee=new Promise((i,a)=>{if(window.monaco){Se(),ne=window.monaco,i(ne);return}let d=!1;const r=window.setTimeout(()=>{d||(d=!0,ee=null,a(new Error(`Monaco editor failed to load within ${Ne}ms`)))},Ne),m=document.createElement("script");m.src=`${me}/loader.min.js`,m.async=!0,m.onload=()=>{const C=window.require;C.config({paths:{vs:me}}),Se(),C(["vs/editor/editor.main"],w=>{d||(d=!0,window.clearTimeout(r),ne=w,i(w))})},m.onerror=()=>{d||(d=!0,window.clearTimeout(r),ee=null,a(new Error("Failed to load Monaco Editor loader script")))},document.head.appendChild(m)}),ee)}function Te(i){o.useEffect(()=>{const a=i.current;if(!a)return;const d=h.createTabEscape(),r=m=>{d(m)&&m.stopPropagation()};return a.addEventListener("keydown",r,!0),()=>a.removeEventListener("keydown",r,!0)},[i])}const Ge=o.forwardRef(function(a,d){const{t:r}=h.useNiceTranslation();fe.injectStyleOnce(ge,be);const{value:m,defaultValue:C,onChange:w,language:f="plaintext",theme:b="auto",options:c={},height:V=400,width:L="100%",markers:T=[],decorations:I=[],completionProvider:g,onMount:D,onCursorPositionChange:S,onSelectionChange:W,onSave:$,loading:Q,disabled:E=!1,showToolbar:U=!1,showStatusBar:Z=!1,editorSize:O="standard",className:q,"data-testid":G,lsp:P,extraLibs:j,tutorial:M}=a,[_,F,K]=h.useControllableState({value:m,defaultValue:C,fallbackValue:"",onChange:w,componentName:"NiceCodeEditor"}),B=o.useRef(F);B.current=F;const k=o.useRef(_);k.current=_;const x=o.useRef(!1),u=o.useRef(null);Te(u);const n=o.useRef(null),N=o.useRef(null),Y=o.useRef([]),z=o.useRef(null),[R,X]=o.useState(!0),[re,Oe]=o.useState(null),[he,Ie]=o.useState({lineNumber:1,column:1}),[ke,Pe]=o.useState(""),[de,Ae]=o.useState(c.wordWrap==="on"),ie=o.useMemo(()=>({automaticLayout:!0,readOnly:E||c.readOnly,minimap:{enabled:c.minimap??!0},lineNumbers:c.lineNumbers??"on",wordWrap:c.wordWrap??"off",tabSize:c.tabSize??2,insertSpaces:c.insertSpaces??!0,fontSize:c.fontSize??14,fontFamily:c.fontFamily??"'Fira Code', 'Consolas', 'Monaco', monospace",fontLigatures:c.fontLigatures??!0,cursorStyle:c.cursorStyle??"line",cursorBlinking:c.cursorBlinking??"blink",autoClosingBrackets:c.autoClosingBrackets??"languageDefined",autoClosingQuotes:c.autoClosingQuotes??"languageDefined",formatOnPaste:c.formatOnPaste??!1,formatOnType:c.formatOnType??!1,renderWhitespace:c.renderWhitespace??"selection",renderControlCharacters:c.renderControlCharacters??!1,scrollBeyondLastLine:c.scrollBeyondLastLine??!0,smoothScrolling:c.smoothScrolling??!0,folding:c.folding??!0,showFoldingControls:c.showFoldingControls??"mouseover","bracketPairColorization.enabled":c.bracketPairColorization??!0,matchBrackets:"always",guides:c.guides??{bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveBracketPair:!1,indentation:!0,highlightActiveIndentation:!0},stickyScroll:{enabled:c.stickyScroll??!1},quickSuggestions:c.quickSuggestions??!0,suggestOnTriggerCharacters:c.suggestOnTriggerCharacters??!0,acceptSuggestionOnEnter:c.acceptSuggestionOnEnter??"on",inlayHints:{enabled:c.inlayHints?"on":"off"}}),[c,E]),oe=o.useRef({onCursorPositionChange:S,onSelectionChange:W,onSave:$,onMount:D});oe.current={onCursorPositionChange:S,onSelectionChange:W,onSave:$,onMount:D};const ye=o.useRef({language:f,theme:b,editorOptions:ie});ye.current={language:f,theme:b,editorOptions:ie};const xe=o.useRef(P);xe.current=P;const De=Ze(P),ve=o.useRef(r);ve.current=r,o.useEffect(()=>{if(!u.current)return;let e=!0;const l=xe.current;return Le().then(async s=>{if(!e||!u.current)return;N.current=s;const y=ye.current,v=s.editor.create(u.current,{value:k.current,language:y.language,theme:ce(y.theme),...y.editorOptions});if(n.current=v,X(!1),v.onDidChangeModelContent(()=>{x.current||B.current(v.getValue())}),v.onDidChangeCursorPosition(p=>{Ie({lineNumber:p.position.lineNumber,column:p.position.column}),oe.current.onCursorPositionChange?.({lineNumber:p.position.lineNumber,column:p.position.column})}),v.onDidChangeCursorSelection(p=>{const A=p.selection,J=v.getModel()?.getValueInRange(A)??"";Pe(J),oe.current.onSelectionChange?.({startLineNumber:A.startLineNumber,startColumn:A.startColumn,endLineNumber:A.endLineNumber,endColumn:A.endColumn})}),v.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KeyS,()=>{oe.current.onSave?.(v.getValue())}),l&&typeof window<"u")try{await se("https://cdn.jsdelivr.net/npm/vscode-ws-jsonrpc@1.0.2/lib/browser/index.min.js"),await se("https://cdn.jsdelivr.net/npm/monaco-languageclient@0.15.0/lib/monaco-languageclient.min.js");const p=window,A=p.ReconnectingWebSocket,{MonacoLanguageClient:J,CloseAction:Ve,ErrorAction:$e,createConnection:Ce}=p.monacoLanguageClient||{};if(J&&Ce){const Fe=l.url,Be=l.language,we=new A(Fe),He=new p.VSCodeWebSocketMessageReader(we),Ue=new p.VSCodeWebSocketMessageWriter(we),qe=Ce(He,Ue),_e=new J({name:"LSP Client",clientOptions:{documentSelector:[Be],initializationOptions:l.initOptions,errorHandler:{error:()=>$e.Continue,closed:()=>Ve.Restart}},connectionProvider:{get:()=>Promise.resolve(qe)}});_e.start(),n.current.__lspClient=_e}}catch(p){console.warn("LSP bridge failed to load:",p)}oe.current.onMount?.(v,s)}).catch(s=>{e&&(Oe(s.message??ve.current("codeEditor.failedToLoadEditor","Failed to load editor")),X(!1))}),()=>{if(e=!1,n.current?.dispose(),z.current?.dispose(),n.current&&n.current.__lspClient)try{n.current.__lspClient.stop()}catch{}}},[De]),o.useEffect(()=>{const e=n.current;if(!K||!e||_===e.getValue())return;const l=e.getPosition();x.current=!0;try{e.setValue(_)}finally{x.current=!1}l&&e.setPosition(l)},[_,K]),o.useEffect(()=>{const e=n.current,l=N.current;if(e&&l){const s=e.getModel();s&&l.editor.setModelLanguage(s,f)}},[f]),o.useEffect(()=>{const e=N.current;if(!e||R||!j||j.length===0||f!=="javascript"&&f!=="typescript")return;const l=e.languages?.typescript;if(!l)return;const s=[];try{j.forEach((y,v)=>{const p=y.filePath??`inmemory://model/nice-extralib-${v}.d.ts`,A=l.typescriptDefaults?.addExtraLib(y.content,p);A&&s.push(A);const J=l.javascriptDefaults?.addExtraLib(y.content,p);J&&s.push(J)})}catch(y){console.warn("Failed to register extraLibs:",y)}return()=>{s.forEach(y=>{try{y.dispose()}catch{}})}},[j,f,R]),o.useEffect(()=>{const e=N.current;if(e&&(e.editor.setTheme(ae(e,b,u.current)),!(b!=="auto"||typeof document>"u")))return Re(u.current,()=>{const l=N.current;l?.editor.setTheme(ae(l,"auto",u.current))})},[b,R]),o.useEffect(()=>{const e=n.current;e&&e.updateOptions(ie)},[ie]),o.useEffect(()=>{const e=n.current,l=N.current;if(e&&l){const s=e.getModel();if(s){const y=T.map(v=>({startLineNumber:v.startLineNumber,startColumn:v.startColumn,endLineNumber:v.endLineNumber,endColumn:v.endColumn,message:v.message,severity:v.severity}));l.editor.setModelMarkers(s,"owner",y)}}},[T]),o.useEffect(()=>{const e=n.current;if(e&&I.length>0){const l=I.map(s=>({range:{startLineNumber:s.range.startLineNumber,startColumn:s.range.startColumn,endLineNumber:s.range.endLineNumber,endColumn:s.range.endColumn},options:{className:s.className,glyphMarginClassName:s.glyphMarginClassName,hoverMessage:s.hoverMessage?{value:s.hoverMessage}:void 0,isWholeLine:s.isWholeLine}}));Y.current=e.deltaDecorations(Y.current,l)}},[I]),o.useEffect(()=>{const e=N.current;if(!e||!g)return;z.current?.dispose();const l={text:0,method:1,function:2,constructor:3,field:4,variable:5,class:6,interface:7,module:8,property:9,keyword:13,snippet:14,color:15,file:16,reference:17,folder:18};return z.current=e.languages.registerCompletionItemProvider(f,{provideCompletionItems:async(s,y)=>({suggestions:(await g(s,y)).map(p=>({label:p.label,kind:l[p.kind]??0,insertText:p.insertText,insertTextRules:p.insertTextRules==="insertAsSnippet"?4:void 0,documentation:p.documentation,detail:p.detail,range:{startLineNumber:y.lineNumber,startColumn:y.column,endLineNumber:y.lineNumber,endColumn:y.column}}))})}),()=>{z.current?.dispose()}},[f,g]),o.useImperativeHandle(d,()=>({getEditor:()=>n.current,getMonaco:()=>N.current,focus:()=>n.current?.focus(),getValue:()=>n.current?.getValue()??"",setValue:e=>n.current?.setValue(e),getSelection:()=>{const e=n.current;if(!e)return"";const l=e.getSelection();return l?e.getModel()?.getValueInRange(l)??"":""},insertText:e=>{const l=n.current;if(!l)return;const s=l.getSelection();s&&l.executeEdits("",[{range:s,text:e}])},formatDocument:()=>{n.current?.getAction("editor.action.formatDocument")?.run()},goToLine:(e,l=1)=>{const s=n.current;s&&(s.setPosition({lineNumber:e,column:l}),s.revealLineInCenter(e),s.focus())},findReplace:()=>{n.current?.getAction("editor.action.startFindReplaceAction")?.run()},undo:()=>{n.current?.trigger("keyboard","undo",null)},redo:()=>{n.current?.trigger("keyboard","redo",null)},getCursorPosition:()=>{const e=n.current?.getPosition();return{lineNumber:e?.lineNumber??1,column:e?.column??1}},setMarkers:e=>{const l=n.current,s=N.current;if(l&&s){const y=l.getModel();if(y){const v=e.map(p=>({startLineNumber:p.startLineNumber,startColumn:p.startColumn,endLineNumber:p.endLineNumber,endColumn:p.endColumn,message:p.message,severity:p.severity}));s.editor.setModelMarkers(y,"owner",v)}}}}),[]);const H=o.useMemo(()=>({format:()=>n.current?.getAction("editor.action.formatDocument")?.run(),undo:()=>n.current?.trigger("keyboard","undo",null),redo:()=>n.current?.trigger("keyboard","redo",null),find:()=>n.current?.getAction("editor.action.startFindReplaceAction")?.run(),toggleWordWrap:()=>{const e=!de;Ae(e),n.current?.updateOptions({wordWrap:e?"on":"off"})},toggleMinimap:()=>{const e=n.current?.getOption?.(N.current?.editor?.EditorOption?.minimap);n.current?.updateOptions({minimap:{enabled:!e?.enabled}})},foldAll:()=>n.current?.getAction("editor.foldAll")?.run(),unfoldAll:()=>n.current?.getAction("editor.unfoldAll")?.run()}),[de]),We=_.split(`
|
|
2
|
+
`).length,ze=_.length;return t.jsxs("div",{className:`nice-code-editor-wrap nice-editor--${O} ${q??""}`,style:{height:V,width:L,display:"flex",flexDirection:"column",position:"relative"},"data-testid":G,children:[t.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:t.jsx(h.NiceTutorialButton,{steps:h.resolveTutorial(M,Ke)})}),re&&t.jsxs("div",{className:"nice-code-editor__error",style:{position:"absolute",inset:0,zIndex:2,background:"var(--nice-bg-primary, #fff)"},children:[t.jsxs("span",{children:[t.jsx(h.NiceIcon,{name:"warning",size:16})," ",re]}),t.jsx("textarea",{value:_,onChange:e=>F(e.target.value),readOnly:E||c.readOnly,style:{width:"100%",height:"100%",fontFamily:"monospace"}})]}),R&&!re&&t.jsx("div",{className:"nice-code-editor__loader-overlay",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--nice-bg-primary, #fff)"},children:Q??t.jsx("div",{className:"nice-code-editor__loader",children:r("codeEditor.loadingEditor","Loading editor...")})}),U&&t.jsxs("div",{className:"nice-code-editor__toolbar",children:[t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.undo,title:r("codeEditor.undoCtrlZ","Undo (Ctrl+Z)"),"aria-label":r("codeEditor.undo","Undo"),children:t.jsx(h.NiceIcon,{name:"reply",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.redo,title:r("codeEditor.redoCtrlY","Redo (Ctrl+Y)"),"aria-label":r("codeEditor.redo","Redo"),children:t.jsx(h.NiceIcon,{name:"forward",size:16})}),t.jsx("span",{className:"nice-code-editor__toolbar-sep"}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.format,title:r("codeEditor.formatShiftAltF","Format (Shift+Alt+F)"),"aria-label":r("codeEditor.format","Format"),children:t.jsx(h.NiceIcon,{name:"type",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.find,title:r("codeEditor.findReplaceCtrlH","Find & Replace (Ctrl+H)"),"aria-label":r("codeEditor.findReplace","Find & Replace"),children:t.jsx(h.NiceIcon,{name:"search",size:16})}),t.jsx("span",{className:"nice-code-editor__toolbar-sep"}),t.jsx("button",{className:`nice-code-editor__toolbar-btn${de?" nice-code-editor__toolbar-btn--active":""}`,onClick:H.toggleWordWrap,title:r("codeEditor.toggleWordWrap","Toggle Word Wrap"),"aria-label":r("codeEditor.toggleWordWrap","Toggle Word Wrap"),children:t.jsx(h.NiceIcon,{name:"align-left",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.toggleMinimap,title:r("codeEditor.toggleMinimap","Toggle Minimap"),"aria-label":r("codeEditor.toggleMinimap","Toggle Minimap"),children:t.jsx(h.NiceIcon,{name:"columns",size:16})}),t.jsx("span",{className:"nice-code-editor__toolbar-sep"}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.foldAll,title:r("codeEditor.foldAll","Fold All"),"aria-label":r("codeEditor.foldAll","Fold All"),children:t.jsx(h.NiceIcon,{name:"collapse",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:H.unfoldAll,title:r("codeEditor.unfoldAll","Unfold All"),"aria-label":r("codeEditor.unfoldAll","Unfold All"),children:t.jsx(h.NiceIcon,{name:"expand",size:16})})]}),t.jsx("div",{ref:u,className:"nice-code-editor",style:{flex:1,minHeight:0}}),Z&&t.jsxs("div",{className:"nice-code-editor__statusbar",children:[t.jsx("span",{children:r("codeEditor.lnCol","Ln {lineNumber}, Col {column}").replace("{lineNumber}",String(he.lineNumber)).replace("{column}",String(he.column))}),ke.length>0&&t.jsx("span",{children:r("codeEditor.selected","({selectionText} selected)").replace("{selectionText}",String(ke.length))}),t.jsx("span",{className:"nice-code-editor__statusbar-spacer"}),t.jsx("span",{children:r("codeEditor.linesChars","{lineCount} lines · {charCount} chars").replace("{lineCount}",String(We)).replace("{charCount}",String(ze))}),t.jsx("span",{className:"nice-code-editor__statusbar-lang",children:f}),T.length>0&&t.jsxs("span",{className:"nice-code-editor__statusbar-markers",children:[t.jsx(h.NiceIcon,{name:"warning",size:14})," ",T.length]})]})]})});function Xe(i){const{t:a}=h.useNiceTranslation();fe.injectStyleOnce(ge,be);const{original:d,defaultOriginal:r,modified:m,defaultModified:C,language:w="plaintext",theme:f="auto",height:b=400,width:c="100%",inline:V=!1,renderSideBySide:L=!0,originalEditable:T=!1,modifiedEditable:I=!1,onOriginalChange:g,onModifiedChange:D,loading:S,options:W,className:$,"data-testid":Q}=i,[E,U,Z]=h.useControllableState({value:d,defaultValue:r,fallbackValue:"",onChange:g,componentName:"NiceCodeDiffEditor.original"}),[O,q,G]=h.useControllableState({value:m,defaultValue:C,fallbackValue:"",onChange:D,componentName:"NiceCodeDiffEditor.modified"}),P=o.useRef({currentOriginal:E,currentModified:O,setOriginal:U,setModified:q});P.current={currentOriginal:E,currentModified:O,setOriginal:U,setModified:q};const j=o.useRef(!1),M=o.useRef(null);Te(M);const _=o.useRef(null),F=o.useRef(null),[K,B]=o.useState(!0),[k,x]=o.useState(null);return o.useEffect(()=>{if(!M.current)return;let u=!0;return Le().then(n=>{if(!u||!M.current)return;F.current=n;const{currentOriginal:N,currentModified:Y}=P.current,z=n.editor.createModel(N,w),R=n.editor.createModel(Y,w),X=n.editor.createDiffEditor(M.current,{automaticLayout:!0,theme:ce(f),renderSideBySide:!V&&L,originalEditable:T,readOnly:!I,scrollBeyondLastLine:!1,lineNumbersMinChars:3,glyphMargin:!1,folding:!1,lineDecorationsWidth:14,minimap:{enabled:!1},...W});X.setModel({original:z,modified:R}),_.current=X,B(!1),T&&z.onDidChangeContent(()=>{j.current||P.current.setOriginal(z.getValue())}),I&&R.onDidChangeContent(()=>{j.current||P.current.setModified(R.getValue())})}).catch(n=>{u&&(x(n.message??a("codeEditor.failedToLoadDiffEditor","Failed to load diff editor")),B(!1))}),()=>{u=!1,_.current?.dispose()}},[a]),o.useEffect(()=>{const u=_.current?.getModel();if(u){j.current=!0;try{Z&&u.original.getValue()!==E&&u.original.setValue(E),G&&u.modified.getValue()!==O&&u.modified.setValue(O)}finally{j.current=!1}}},[E,O,Z,G]),o.useEffect(()=>{const u=F.current;if(u&&(u.editor.setTheme(ae(u,f,M.current)),!(f!=="auto"||typeof document>"u")))return Re(M.current,()=>{const n=F.current;n?.editor.setTheme(ae(n,"auto",M.current))})},[f,K]),k?t.jsx("div",{className:`nice-code-diff-editor nice-code-diff-editor--error ${$??""}`,style:{height:b,width:c},"data-testid":Q,children:t.jsx("div",{className:"nice-code-editor__error",children:t.jsxs("span",{children:[t.jsx(h.NiceIcon,{name:"warning",size:16})," ",k]})})}):t.jsxs("div",{className:`nice-code-diff-editor ${$??""}`,style:{height:b,width:c,position:"relative"},"data-testid":Q,children:[t.jsx("div",{ref:M,style:{position:"absolute",inset:0}}),K&&t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--nice-bg-primary, #fff)",zIndex:2},children:S??t.jsx("div",{className:"nice-code-editor__loader",children:a("codeEditor.loadingDiffEditor","Loading diff editor...")})})]})}const et="1.29.0",je=`https://cdn.jsdelivr.net/npm/prismjs@${et}`;let le=null;const pe={javascript:"javascript",typescript:"typescript",json:"json",html:"markup",css:"css",scss:"scss",less:"less",markdown:"markdown",xml:"markup",yaml:"yaml",sql:"sql",python:"python",csharp:"csharp",java:"java",cpp:"cpp",c:"c",go:"go",rust:"rust",php:"php",ruby:"ruby",shell:"bash",powershell:"powershell",plaintext:"plain"};function se(i){return new Promise((a,d)=>{if(document.querySelector(`script[data-prism-src="${i}"]`)){a();return}const r=document.createElement("script");r.src=i,r.async=!0,r.dataset.prismSrc=i,r.onload=()=>a(),r.onerror=()=>d(new Error(`Failed to load ${i}`)),document.head.appendChild(r)})}function tt(i){if(typeof window>"u")return Promise.resolve(null);const a=window,d=pe[i]??"plain",r=async()=>{if(d!=="plain"&&!a.Prism?.languages?.[d])try{await se(`${je}/components/prism-${d}.min.js`)}catch{}};return a.Prism?.languages?r().then(()=>a.Prism):(le||(le=(async()=>(window.Prism={manual:!0},await se(`${je}/prism.min.js`),window.Prism))()),le.then(async()=>(await r(),window.Prism)))}function ue(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function rt(i){fe.injectStyleOnce(ge,be);const{value:a,defaultValue:d,onChange:r,language:m="plaintext",height:C=300,width:w="100%",readOnly:f=!1,tabSize:b=2,lineNumbers:c=!0,placeholder:V,theme:L="auto",className:T,"data-testid":I}=i,[g,D]=h.useControllableState({value:a,defaultValue:d,fallbackValue:"",onChange:r,componentName:"NiceSimpleCodeEditor"}),S=o.useRef(null),W=o.useRef(null),$=o.useRef(null),{t:Q}=h.useNiceTranslation(),E=o.useId(),[U]=o.useState(h.createTabEscape),[Z,O]=o.useState(()=>ue(g)),q=o.useRef(null),[G]=o.useState(()=>({get current(){return q.current?.parentElement??null}})),P=h.useThemeIsDark(G),j=L==="auto"?P?"dark":"light":L;o.useEffect(()=>{let k=!0;return tt(m).then(x=>{if(!k)return;const u=pe[m]??"plain";if(x?.languages?.[u])try{const n=x.highlight(g,x.languages[u],u);O(n);return}catch{}O(ue(g))}).catch(()=>{k&&O(ue(g))}),()=>{k=!1}},[g,m]);const M=o.useCallback(()=>{if(!W.current||!S.current)return;W.current.scrollTop=S.current.scrollTop,W.current.scrollLeft=S.current.scrollLeft;const k=$.current;if(k){const x=S.current.offsetHeight-S.current.clientHeight;k.style.paddingBottom=`calc(var(--nice-space-2, 8px) + ${x}px)`,k.scrollTop=S.current.scrollTop}},[]),_=o.useCallback(k=>{if(!U(k)&&k.key==="Tab"&&!f){k.preventDefault();const x=k.currentTarget,u=x.selectionStart,n=x.selectionEnd,N=" ".repeat(b);if(k.shiftKey){const R=g.substring(0,u).lastIndexOf(`
|
|
3
|
+
`)+1;if((g.substring(R,u).match(/^(\s*)/)?.[1]??"").length>=b){const re=g.substring(0,R)+g.substring(R+b);D(re),setTimeout(()=>{x.selectionStart=x.selectionEnd=u-b},0)}}else{const Y=g.substring(0,u)+N+g.substring(n);D(Y),setTimeout(()=>{x.selectionStart=x.selectionEnd=u+b},0)}}},[g,D,b,U,f]),K=g.split(`
|
|
4
|
+
`).length,B=pe[m]??"plain";return t.jsxs("div",{ref:q,className:`nice-simple-code-editor nice-simple-code-editor--${j}${L==="auto"?" nice-simple-code-editor--auto":""} ${T??""}`,style:{height:C,width:w},"data-testid":I,"data-language":m,"data-theme":j,children:[c&&t.jsx("div",{ref:$,className:"nice-simple-code-editor__line-numbers",children:Array.from({length:K},(k,x)=>t.jsx("div",{className:"nice-simple-code-editor__line-number",children:x+1},x))}),t.jsxs("div",{className:"nice-simple-code-editor__editor-area",children:[t.jsx("pre",{ref:W,"aria-hidden":"true",className:`nice-simple-code-editor__highlight language-${B}`,children:t.jsx("code",{className:`language-${B}`,dangerouslySetInnerHTML:{__html:Z+(g.endsWith(`
|
|
5
|
+
`)?`
|
|
6
|
+
`:"")}})}),t.jsx("textarea",{ref:S,className:"nice-simple-code-editor__textarea",value:g,onChange:k=>D(k.target.value),onKeyDown:_,onScroll:M,readOnly:f,placeholder:V,spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-describedby":f?void 0:E}),!f&&t.jsx("span",{id:E,className:"nice-sr-only",children:Q("input.tabEscapeHint","Tab indents. To leave the editor, press Escape, then Tab.")})]})]})}const ge="nice-code-editor-styles",be=`
|
|
7
|
+
.nice-code-editor,
|
|
8
|
+
.nice-code-diff-editor {
|
|
9
|
+
border: 1px solid var(--nice-border, #e0e0e0);
|
|
10
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.nice-code-editor--loading,
|
|
15
|
+
.nice-code-editor--error,
|
|
16
|
+
.nice-code-diff-editor--loading {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
background: var(--nice-bg-tertiary, #f5f5f5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.nice-code-editor__loader {
|
|
24
|
+
color: var(--nice-text-secondary, #666);
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* the matching bracket pair: a tinted box with a firm edge instead of Monaco's faint outline */
|
|
29
|
+
.nice-code-editor .monaco-editor .bracket-match {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
background: color-mix(in srgb, var(--nice-color-primary, #6366f1) 24%, transparent);
|
|
32
|
+
border: 1px solid color-mix(in srgb, var(--nice-color-primary, #6366f1) 75%, transparent);
|
|
33
|
+
border-radius: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nice-code-editor__error {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
padding: var(--nice-space-2, 8px);
|
|
42
|
+
gap: var(--nice-space-2, 8px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.nice-code-editor__error span {
|
|
46
|
+
color: var(--nice-error, #d32f2f);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Simple code editor */
|
|
50
|
+
.nice-simple-code-editor {
|
|
51
|
+
display: flex;
|
|
52
|
+
border: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
|
|
53
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
line-height: 1.5;
|
|
58
|
+
background: var(--nice-bg-primary, var(--nice-bg-surface, #fff));
|
|
59
|
+
color: var(--nice-text-primary, var(--nice-text-primary, #333));
|
|
60
|
+
}
|
|
61
|
+
.nice-simple-code-editor--dark {
|
|
62
|
+
background: var(--nice-bg, #1e1e1e);
|
|
63
|
+
color: var(--nice-text, #d4d4d4);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.nice-simple-code-editor__line-numbers {
|
|
67
|
+
padding: var(--nice-space-2, 8px) 0;
|
|
68
|
+
background: var(--nice-bg-secondary, var(--nice-bg-tertiary, #f5f5f5));
|
|
69
|
+
border-right: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
|
|
70
|
+
user-select: none;
|
|
71
|
+
text-align: right;
|
|
72
|
+
color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
}
|
|
75
|
+
.nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
|
|
76
|
+
background: var(--nice-bg-secondary, #252526);
|
|
77
|
+
border-right-color: var(--nice-border, #3c3c3c);
|
|
78
|
+
color: var(--nice-text-muted, #858585);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nice-simple-code-editor__line-number {
|
|
82
|
+
padding: 0 var(--nice-space-3, 12px);
|
|
83
|
+
min-width: 40px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.nice-simple-code-editor__editor-area {
|
|
87
|
+
position: relative;
|
|
88
|
+
flex: 1;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.nice-simple-code-editor__highlight,
|
|
93
|
+
.nice-simple-code-editor__textarea {
|
|
94
|
+
position: absolute;
|
|
95
|
+
inset: 0;
|
|
96
|
+
margin: 0;
|
|
97
|
+
padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
|
|
98
|
+
border: 0;
|
|
99
|
+
font: inherit;
|
|
100
|
+
line-height: inherit;
|
|
101
|
+
white-space: pre;
|
|
102
|
+
overflow: auto;
|
|
103
|
+
tab-size: 2;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.nice-simple-code-editor__highlight {
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
background: transparent;
|
|
109
|
+
color: inherit;
|
|
110
|
+
}
|
|
111
|
+
.nice-simple-code-editor__highlight code {
|
|
112
|
+
font: inherit;
|
|
113
|
+
background: transparent;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.nice-simple-code-editor__textarea {
|
|
117
|
+
background: transparent;
|
|
118
|
+
color: transparent;
|
|
119
|
+
caret-color: var(--nice-text-primary, var(--nice-text-primary, #333));
|
|
120
|
+
resize: none;
|
|
121
|
+
outline: none;
|
|
122
|
+
-webkit-text-fill-color: transparent;
|
|
123
|
+
}
|
|
124
|
+
.nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
|
|
125
|
+
caret-color: var(--nice-text, #d4d4d4);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nice-simple-code-editor__textarea::placeholder {
|
|
129
|
+
color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
130
|
+
-webkit-text-fill-color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
131
|
+
}
|
|
132
|
+
.nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
|
|
133
|
+
color: var(--nice-text-muted, #858585);
|
|
134
|
+
-webkit-text-fill-color: var(--nice-text-muted, #858585);
|
|
135
|
+
}
|
|
136
|
+
/* theme="auto": the page's theme colours in both light and dark (R43) — the --dark rules above
|
|
137
|
+
are for an explicit theme="dark" on a light page */
|
|
138
|
+
.nice-simple-code-editor--auto.nice-simple-code-editor--dark {
|
|
139
|
+
background: var(--nice-bg-primary);
|
|
140
|
+
color: var(--nice-text-primary);
|
|
141
|
+
}
|
|
142
|
+
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
|
|
143
|
+
background: var(--nice-bg-secondary);
|
|
144
|
+
border-right-color: var(--nice-border-color);
|
|
145
|
+
color: var(--nice-text-secondary);
|
|
146
|
+
}
|
|
147
|
+
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
|
|
148
|
+
caret-color: var(--nice-text-primary);
|
|
149
|
+
}
|
|
150
|
+
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
|
|
151
|
+
color: var(--nice-text-secondary);
|
|
152
|
+
-webkit-text-fill-color: var(--nice-text-secondary);
|
|
153
|
+
}
|
|
154
|
+
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .token.punctuation {
|
|
155
|
+
color: var(--nice-text-primary);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Prism token colors — light */
|
|
159
|
+
.nice-simple-code-editor .token.comment,
|
|
160
|
+
.nice-simple-code-editor .token.prolog,
|
|
161
|
+
.nice-simple-code-editor .token.doctype,
|
|
162
|
+
.nice-simple-code-editor .token.cdata { color: #6a737d; font-style: italic; }
|
|
163
|
+
.nice-simple-code-editor .token.punctuation { color: #586069; }
|
|
164
|
+
.nice-simple-code-editor .token.property,
|
|
165
|
+
.nice-simple-code-editor .token.tag,
|
|
166
|
+
.nice-simple-code-editor .token.boolean,
|
|
167
|
+
.nice-simple-code-editor .token.number,
|
|
168
|
+
.nice-simple-code-editor .token.constant,
|
|
169
|
+
.nice-simple-code-editor .token.symbol,
|
|
170
|
+
.nice-simple-code-editor .token.deleted { color: #005cc5; }
|
|
171
|
+
.nice-simple-code-editor .token.selector,
|
|
172
|
+
.nice-simple-code-editor .token.attr-name,
|
|
173
|
+
.nice-simple-code-editor .token.string,
|
|
174
|
+
.nice-simple-code-editor .token.char,
|
|
175
|
+
.nice-simple-code-editor .token.builtin,
|
|
176
|
+
.nice-simple-code-editor .token.inserted { color: #032f62; }
|
|
177
|
+
.nice-simple-code-editor .token.operator,
|
|
178
|
+
.nice-simple-code-editor .token.entity,
|
|
179
|
+
.nice-simple-code-editor .token.url,
|
|
180
|
+
.nice-simple-code-editor .token.variable { color: var(--nice-danger, #d73a49); }
|
|
181
|
+
.nice-simple-code-editor .token.atrule,
|
|
182
|
+
.nice-simple-code-editor .token.attr-value,
|
|
183
|
+
.nice-simple-code-editor .token.keyword { color: var(--nice-danger, #d73a49); font-weight: 600; }
|
|
184
|
+
.nice-simple-code-editor .token.function,
|
|
185
|
+
.nice-simple-code-editor .token.class-name { color: #6f42c1; }
|
|
186
|
+
.nice-simple-code-editor .token.regex,
|
|
187
|
+
.nice-simple-code-editor .token.important { color: #e36209; }
|
|
188
|
+
|
|
189
|
+
/* Prism token colors — dark */
|
|
190
|
+
.nice-simple-code-editor--dark .token.comment,
|
|
191
|
+
.nice-simple-code-editor--dark .token.prolog,
|
|
192
|
+
.nice-simple-code-editor--dark .token.doctype,
|
|
193
|
+
.nice-simple-code-editor--dark .token.cdata { color: var(--nice-success, #6a9955); font-style: italic; }
|
|
194
|
+
.nice-simple-code-editor--dark .token.punctuation { color: var(--nice-text, #d4d4d4); }
|
|
195
|
+
.nice-simple-code-editor--dark .token.property,
|
|
196
|
+
.nice-simple-code-editor--dark .token.tag,
|
|
197
|
+
.nice-simple-code-editor--dark .token.boolean,
|
|
198
|
+
.nice-simple-code-editor--dark .token.number,
|
|
199
|
+
.nice-simple-code-editor--dark .token.constant,
|
|
200
|
+
.nice-simple-code-editor--dark .token.symbol,
|
|
201
|
+
.nice-simple-code-editor--dark .token.deleted { color: var(--nice-success-light, #b5cea8); }
|
|
202
|
+
.nice-simple-code-editor--dark .token.selector,
|
|
203
|
+
.nice-simple-code-editor--dark .token.attr-name,
|
|
204
|
+
.nice-simple-code-editor--dark .token.string,
|
|
205
|
+
.nice-simple-code-editor--dark .token.char,
|
|
206
|
+
.nice-simple-code-editor--dark .token.builtin,
|
|
207
|
+
.nice-simple-code-editor--dark .token.inserted { color: var(--nice-warning, #ce9178); }
|
|
208
|
+
.nice-simple-code-editor--dark .token.operator,
|
|
209
|
+
.nice-simple-code-editor--dark .token.entity,
|
|
210
|
+
.nice-simple-code-editor--dark .token.url,
|
|
211
|
+
.nice-simple-code-editor--dark .token.variable { color: var(--nice-primary, #569cd6); }
|
|
212
|
+
.nice-simple-code-editor--dark .token.atrule,
|
|
213
|
+
.nice-simple-code-editor--dark .token.attr-value,
|
|
214
|
+
.nice-simple-code-editor--dark .token.keyword { color: #c586c0; font-weight: 600; }
|
|
215
|
+
.nice-simple-code-editor--dark .token.function,
|
|
216
|
+
.nice-simple-code-editor--dark .token.class-name { color: #dcdcaa; }
|
|
217
|
+
.nice-simple-code-editor--dark .token.regex,
|
|
218
|
+
.nice-simple-code-editor--dark .token.important { color: #d7ba7d; }
|
|
219
|
+
|
|
220
|
+
/* Toolbar */
|
|
221
|
+
.nice-code-editor-wrap {
|
|
222
|
+
border: 1px solid var(--nice-border, #e0e0e0);
|
|
223
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
}
|
|
226
|
+
.nice-code-editor-wrap .nice-code-editor {
|
|
227
|
+
border: none;
|
|
228
|
+
border-radius: 0;
|
|
229
|
+
}
|
|
230
|
+
/* The editing surface draws no outline: while it has focus, the frame shows the ring
|
|
231
|
+
(TODO_1.3.0 I4). */
|
|
232
|
+
.nice-code-editor-wrap:has(.nice-code-editor:focus-within),
|
|
233
|
+
.nice-code-diff-editor:focus-within,
|
|
234
|
+
.nice-simple-code-editor:focus-within {
|
|
235
|
+
border-color: var(--nice-color-primary, #3b82f6);
|
|
236
|
+
box-shadow: var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6));
|
|
237
|
+
}
|
|
238
|
+
.nice-code-editor__toolbar {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
gap: var(--nice-space-0-5, 2px);
|
|
242
|
+
padding: var(--nice-space-0-75, 3px) var(--nice-space-1-5, 6px);
|
|
243
|
+
background: var(--nice-bg-tertiary, #f5f5f5);
|
|
244
|
+
border-bottom: 1px solid var(--nice-border, #e0e0e0);
|
|
245
|
+
}
|
|
246
|
+
.nice-code-editor__toolbar-btn {
|
|
247
|
+
display: inline-flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
width: 26px;
|
|
251
|
+
height: 26px;
|
|
252
|
+
border: none;
|
|
253
|
+
border-radius: var(--nice-radius-sm, 3px);
|
|
254
|
+
background: transparent;
|
|
255
|
+
color: var(--nice-text-secondary, #666);
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
font-size: 14px;
|
|
258
|
+
transition: background 0.15s, color 0.15s;
|
|
259
|
+
}
|
|
260
|
+
.nice-code-editor__toolbar-btn:hover {
|
|
261
|
+
background: var(--nice-hover-bg, #e0e0e0);
|
|
262
|
+
color: var(--nice-text-primary, #333);
|
|
263
|
+
}
|
|
264
|
+
.nice-code-editor__toolbar-btn--active {
|
|
265
|
+
background: var(--nice-accent, #1976d2);
|
|
266
|
+
color: var(--nice-text-on-primary, #FFF);
|
|
267
|
+
}
|
|
268
|
+
.nice-code-editor__toolbar-sep {
|
|
269
|
+
width: 1px;
|
|
270
|
+
height: 18px;
|
|
271
|
+
background: var(--nice-border, #e0e0e0);
|
|
272
|
+
margin: 0 var(--nice-space-1, 4px);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Status bar */
|
|
276
|
+
.nice-code-editor__statusbar {
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
gap: var(--nice-space-3, 12px);
|
|
280
|
+
padding: var(--nice-space-0-5, 2px) var(--nice-space-2-5, 10px);
|
|
281
|
+
background: var(--nice-bg-tertiary, #f5f5f5);
|
|
282
|
+
border-top: 1px solid var(--nice-border, #e0e0e0);
|
|
283
|
+
font-size: 12px;
|
|
284
|
+
color: var(--nice-text-secondary, #666);
|
|
285
|
+
user-select: none;
|
|
286
|
+
}
|
|
287
|
+
.nice-code-editor__statusbar-spacer { flex: 1; }
|
|
288
|
+
.nice-code-editor__statusbar-lang {
|
|
289
|
+
text-transform: uppercase;
|
|
290
|
+
font-weight: 600;
|
|
291
|
+
font-size: 11px;
|
|
292
|
+
}
|
|
293
|
+
.nice-code-editor__statusbar-markers {
|
|
294
|
+
color: var(--nice-warning, #f39c12);
|
|
295
|
+
font-weight: 600;
|
|
296
|
+
}
|
|
297
|
+
`;exports.NiceCodeDiffEditor=Xe;exports.NiceCodeEditor=Ge;exports.NiceSimpleCodeEditor=rt;
|