@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
|
@@ -65,6 +65,11 @@ const Oi = {
|
|
|
65
65
|
|
|
66
66
|
display: flex;
|
|
67
67
|
flex-direction: column;
|
|
68
|
+
/* 1.4.22 ("Kontrolka zmienia szerokość jak przechodzę po tabsach"): it fills its container instead of
|
|
69
|
+
shrinking to whatever the current tab holds. */
|
|
70
|
+
width: 100%;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
box-sizing: border-box;
|
|
68
73
|
background: var(--nice-git-bg);
|
|
69
74
|
border: 1px solid var(--nice-git-border);
|
|
70
75
|
border-radius: var(--nice-git-radius);
|
|
@@ -16,8 +16,8 @@ function J(i, u) {
|
|
|
16
16
|
const l = new Date(u).getTime() - Date.now(), c = new Intl.RelativeTimeFormat(i, { numeric: "auto", style: "short" }), b = Math.round(l / 6e4);
|
|
17
17
|
if (Math.abs(b) < 60)
|
|
18
18
|
return c.format(b, "minute");
|
|
19
|
-
const
|
|
20
|
-
return Math.abs(
|
|
19
|
+
const h = Math.round(l / 36e5);
|
|
20
|
+
return Math.abs(h) < 24 ? c.format(h, "hour") : c.format(Math.round(l / 864e5), "day");
|
|
21
21
|
}
|
|
22
22
|
function V(i, u) {
|
|
23
23
|
switch (u) {
|
|
@@ -42,21 +42,21 @@ const z = {
|
|
|
42
42
|
onTaskSelect: l,
|
|
43
43
|
onTaskClaim: c,
|
|
44
44
|
currentUserId: b,
|
|
45
|
-
showFilters:
|
|
45
|
+
showFilters: h = !0,
|
|
46
46
|
showSearch: L = !0,
|
|
47
47
|
emptyMessage: F,
|
|
48
48
|
groupByProcess: I = !1,
|
|
49
49
|
refreshInterval: x = 0,
|
|
50
50
|
onRefresh: d,
|
|
51
|
-
className:
|
|
52
|
-
style:
|
|
51
|
+
className: R,
|
|
52
|
+
style: P,
|
|
53
53
|
"data-testid": j
|
|
54
54
|
}) => {
|
|
55
55
|
const D = $(null);
|
|
56
56
|
S(D, { orientation: "horizontal", wrap: !0, activateOnMove: !0 });
|
|
57
57
|
const C = $(null);
|
|
58
58
|
S(C, { orientation: "vertical", typeahead: !0, pageSize: 10 });
|
|
59
|
-
const { t: r, lang: A } = U(), [X, Y] = g({}), [
|
|
59
|
+
const { t: r, lang: A } = U(), [X, Y] = g({}), [w, E] = g(""), [m, K] = g("all");
|
|
60
60
|
q.useEffect(() => {
|
|
61
61
|
if (x > 0 && d) {
|
|
62
62
|
const e = setInterval(d, x);
|
|
@@ -65,8 +65,8 @@ const z = {
|
|
|
65
65
|
}, [x, d]);
|
|
66
66
|
const f = y(() => {
|
|
67
67
|
let e = [...i];
|
|
68
|
-
if (m !== "all" && (e = e.filter((t) => t.status === m)),
|
|
69
|
-
const t =
|
|
68
|
+
if (m !== "all" && (e = e.filter((t) => t.status === m)), w.trim()) {
|
|
69
|
+
const t = w.toLowerCase();
|
|
70
70
|
e = e.filter(
|
|
71
71
|
(a) => a.name.toLowerCase().includes(t) || a.processName.toLowerCase().includes(t) || a.description?.toLowerCase().includes(t)
|
|
72
72
|
);
|
|
@@ -83,7 +83,7 @@ const z = {
|
|
|
83
83
|
};
|
|
84
84
|
return o[t.priority] !== o[a.priority] ? o[t.priority] - o[a.priority] : t.dueDate && a.dueDate ? new Date(t.dueDate).getTime() - new Date(a.dueDate).getTime() : 0;
|
|
85
85
|
}), e;
|
|
86
|
-
}, [i, m,
|
|
86
|
+
}, [i, m, w]), T = y(() => {
|
|
87
87
|
if (!I)
|
|
88
88
|
return null;
|
|
89
89
|
const e = {};
|
|
@@ -174,7 +174,7 @@ const z = {
|
|
|
174
174
|
]
|
|
175
175
|
}
|
|
176
176
|
);
|
|
177
|
-
return /* @__PURE__ */ s("div", { className: `nice-task-inbox ${
|
|
177
|
+
return /* @__PURE__ */ s("div", { className: `nice-task-inbox ${R ?? ""}`, style: P, "data-testid": j, children: [
|
|
178
178
|
/* @__PURE__ */ s("div", { className: "nice-task-inbox__header", children: [
|
|
179
179
|
/* @__PURE__ */ s("h2", { className: "nice-task-inbox__title", children: [
|
|
180
180
|
r("workflow.taskInbox.title", "My tasks"),
|
|
@@ -184,13 +184,15 @@ const z = {
|
|
|
184
184
|
"button",
|
|
185
185
|
{
|
|
186
186
|
type: "button",
|
|
187
|
+
className: "nice-task-inbox__refresh",
|
|
187
188
|
onClick: d,
|
|
188
189
|
"aria-label": r("workflow.taskInbox.refresh", "Refresh"),
|
|
190
|
+
title: r("workflow.taskInbox.refresh", "Refresh"),
|
|
189
191
|
children: /* @__PURE__ */ n(_, { name: "refresh", size: 16 })
|
|
190
192
|
}
|
|
191
193
|
)
|
|
192
194
|
] }),
|
|
193
|
-
|
|
195
|
+
h && /* @__PURE__ */ s("div", { className: "nice-task-inbox__filters", ref: D, role: "tablist", children: [
|
|
194
196
|
p("all", r("workflow.taskInbox.filter.all", "All")),
|
|
195
197
|
p("pending", r("workflow.taskInbox.filter.pending", "Pending")),
|
|
196
198
|
p("claimed", r("workflow.taskInbox.filter.claimed", "Claimed")),
|
|
@@ -201,7 +203,7 @@ const z = {
|
|
|
201
203
|
{
|
|
202
204
|
type: "search",
|
|
203
205
|
placeholder: r("workflow.taskInbox.searchPlaceholder", "Search tasks..."),
|
|
204
|
-
value:
|
|
206
|
+
value: w,
|
|
205
207
|
onChange: (e) => E(e.target.value),
|
|
206
208
|
"aria-label": r("workflow.taskInbox.search", "Search tasks")
|
|
207
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.23",
|
|
4
4
|
"description": "Nice2Dev UI — Universal, themeable, i18n-ready React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"react-dom": ">=17.0.0"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@nice2dev/i18n": "^1.4.
|
|
101
|
-
"@nice2dev/ui-core": "^1.4.
|
|
100
|
+
"@nice2dev/i18n": "^1.4.23",
|
|
101
|
+
"@nice2dev/ui-core": "^1.4.23",
|
|
102
102
|
"country-flag-icons": "^1.6.20"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@nice2dev/testing": "^1.4.
|
|
105
|
+
"@nice2dev/testing": "^1.4.23",
|
|
106
106
|
"@playwright/test": "^1.62.1",
|
|
107
107
|
"@testing-library/dom": "^10.4.1",
|
|
108
108
|
"@testing-library/jest-dom": "^7.0.1",
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("@nice2dev/ui-core"),n=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 X=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 o=window;if(o.MonacoEnvironment?.getWorkerUrl)return;const c=`self.MonacoEnvironment={baseUrl:'${Me}/'};importScripts('${me}/base/worker/workerMain.js');`,d=URL.createObjectURL(new Blob([c],{type:"text/javascript"}));o.MonacoEnvironment={getWorkerUrl:()=>d}}function ie(o){if(o!=="auto")return o;if(typeof document>"u")return"vs";const c=document.documentElement.dataset.theme;return c==="dark"?"vs-dark":c==="light"?"vs":window.matchMedia?.("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}const Ee="nice-auto";let ee;function Je(o){if(!o||typeof document>"u"||(ee===void 0&&(ee=document.createElement("canvas").getContext("2d")),!ee))return null;const c="#010203";ee.fillStyle=c,ee.fillStyle=o;const d=String(ee.fillStyle);if(d===c&&o.trim().toLowerCase()!==c)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(i=>parseFloat(i)),h=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${h(m)}${h(C)}${h(w)}${f<1?h(f*255):""}`}function Qe(o){const c=parseInt(o.slice(1,3),16),d=parseInt(o.slice(3,5),16),r=parseInt(o.slice(5,7),16);return(.299*c+.587*d+.114*r)/255}function ce(o,c,d){if(c!=="auto"||!d||typeof getComputedStyle>"u")return ie(c);const r=getComputedStyle(d),m=(...M)=>{for(const L of M){const b=Je(r.getPropertyValue(L).trim());if(b)return b}return null},C=m("--nice-bg-primary","--bg-primary"),w=m("--nice-text-primary","--text-primary");if(!C||!w)return ie(c);const f=m("--nice-bg-secondary","--bg-secondary")??C,h=m("--nice-text-secondary","--text-secondary")??w,i=m("--nice-color-primary","--primary")??w,$=m("--nice-border-color","--border-color")??h,j=i.slice(0,7);return o.editor.defineTheme(Ee,{base:Qe(C)<.5?"vs-dark":"vs",inherit:!0,rules:[],colors:{"editor.background":C,"editor.foreground":w,"editorLineNumber.foreground":h,"editorLineNumber.activeForeground":w,"editorCursor.foreground":j,"editor.selectionBackground":`${j}40`,"editor.inactiveSelectionBackground":`${j}26`,"editor.lineHighlightBackground":f,"editor.lineHighlightBorder":f,"editorWidget.background":f,"editorWidget.border":$,"editorSuggestWidget.background":f,"editorSuggestWidget.border":$,"minimap.background":C}}),Ee}function Re(o,c){const d=new MutationObserver(c),r={attributes:!0,attributeFilter:["data-theme","class","style"]};d.observe(document.documentElement,r);const m=o?.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",c),()=>{d.disconnect(),C?.removeEventListener?.("change",c)}}function Ze(o){if(!o)return"";try{return JSON.stringify([o.url,o.language,o.initOptions??null])}catch{return JSON.stringify([o.url,o.language])}}function Le(){return ne?Promise.resolve(ne):X||(X=new Promise((o,c)=>{if(window.monaco){Se(),ne=window.monaco,o(ne);return}let d=!1;const r=window.setTimeout(()=>{d||(d=!0,X=null,c(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,o(w))})},m.onerror=()=>{d||(d=!0,window.clearTimeout(r),X=null,c(new Error("Failed to load Monaco Editor loader script")))},document.head.appendChild(m)}),X)}function Te(o){n.useEffect(()=>{const c=o.current;if(!c)return;const d=k.createTabEscape(),r=m=>{d(m)&&m.stopPropagation()};return c.addEventListener("keydown",r,!0),()=>c.removeEventListener("keydown",r,!0)},[o])}const Ge=n.forwardRef(function(c,d){const{t:r}=k.useNiceTranslation();fe.injectStyleOnce(ge,be);const{value:m,defaultValue:C,onChange:w,language:f="plaintext",theme:h="auto",options:i={},height:$=400,width:j="100%",markers:M=[],decorations:L=[],completionProvider:b,onMount:P,onCursorPositionChange:E,onSelectionChange:T,onSave:F,loading:A,disabled:D=!1,showToolbar:K=!1,showStatusBar:W=!1,editorSize:H="standard",className:Y,"data-testid":B,lsp:O,extraLibs:_,tutorial:J}=c,[N,Q,Z]=k.useControllableState({value:m,defaultValue:C,fallbackValue:"",onChange:w,componentName:"NiceCodeEditor"}),U=n.useRef(Q);U.current=Q;const v=n.useRef(N);v.current=N;const u=n.useRef(!1),g=n.useRef(null);Te(g);const s=n.useRef(null),S=n.useRef(null),z=n.useRef([]),V=n.useRef(null),[R,se]=n.useState(!0),[te,Oe]=n.useState(null),[he,Ie]=n.useState({lineNumber:1,column:1}),[ke,Pe]=n.useState(""),[de,Ae]=n.useState(i.wordWrap==="on"),oe=n.useMemo(()=>({automaticLayout:!0,readOnly:D||i.readOnly,minimap:{enabled:i.minimap??!0},lineNumbers:i.lineNumbers??"on",wordWrap:i.wordWrap??"off",tabSize:i.tabSize??2,insertSpaces:i.insertSpaces??!0,fontSize:i.fontSize??14,fontFamily:i.fontFamily??"'Fira Code', 'Consolas', 'Monaco', monospace",fontLigatures:i.fontLigatures??!0,cursorStyle:i.cursorStyle??"line",cursorBlinking:i.cursorBlinking??"blink",autoClosingBrackets:i.autoClosingBrackets??"languageDefined",autoClosingQuotes:i.autoClosingQuotes??"languageDefined",formatOnPaste:i.formatOnPaste??!1,formatOnType:i.formatOnType??!1,renderWhitespace:i.renderWhitespace??"selection",renderControlCharacters:i.renderControlCharacters??!1,scrollBeyondLastLine:i.scrollBeyondLastLine??!0,smoothScrolling:i.smoothScrolling??!0,folding:i.folding??!0,showFoldingControls:i.showFoldingControls??"mouseover","bracketPairColorization.enabled":i.bracketPairColorization??!0,guides:i.guides??{bracketPairs:!0,indentation:!0,highlightActiveIndentation:!0},stickyScroll:{enabled:i.stickyScroll??!1},quickSuggestions:i.quickSuggestions??!0,suggestOnTriggerCharacters:i.suggestOnTriggerCharacters??!0,acceptSuggestionOnEnter:i.acceptSuggestionOnEnter??"on",inlayHints:{enabled:i.inlayHints?"on":"off"}}),[i,D]),re=n.useRef({onCursorPositionChange:E,onSelectionChange:T,onSave:F,onMount:P});re.current={onCursorPositionChange:E,onSelectionChange:T,onSave:F,onMount:P};const ye=n.useRef({language:f,theme:h,editorOptions:oe});ye.current={language:f,theme:h,editorOptions:oe};const ve=n.useRef(O);ve.current=O;const De=Ze(O),xe=n.useRef(r);xe.current=r,n.useEffect(()=>{if(!g.current)return;let e=!0;const l=ve.current;return Le().then(async a=>{if(!e||!g.current)return;S.current=a;const y=ye.current,x=a.editor.create(g.current,{value:v.current,language:y.language,theme:ie(y.theme),...y.editorOptions});if(s.current=x,se(!1),x.onDidChangeModelContent(()=>{u.current||U.current(x.getValue())}),x.onDidChangeCursorPosition(p=>{Ie({lineNumber:p.position.lineNumber,column:p.position.column}),re.current.onCursorPositionChange?.({lineNumber:p.position.lineNumber,column:p.position.column})}),x.onDidChangeCursorSelection(p=>{const I=p.selection,G=x.getModel()?.getValueInRange(I)??"";Pe(G),re.current.onSelectionChange?.({startLineNumber:I.startLineNumber,startColumn:I.startColumn,endLineNumber:I.endLineNumber,endColumn:I.endColumn})}),x.addCommand(a.KeyMod.CtrlCmd|a.KeyCode.KeyS,()=>{re.current.onSave?.(x.getValue())}),l&&typeof window<"u")try{await ae("https://cdn.jsdelivr.net/npm/vscode-ws-jsonrpc@1.0.2/lib/browser/index.min.js"),await ae("https://cdn.jsdelivr.net/npm/monaco-languageclient@0.15.0/lib/monaco-languageclient.min.js");const p=window,I=p.ReconnectingWebSocket,{MonacoLanguageClient:G,CloseAction:Ve,ErrorAction:$e,createConnection:Ce}=p.monacoLanguageClient||{};if(G&&Ce){const Fe=l.url,He=l.language,we=new I(Fe),Be=new p.VSCodeWebSocketMessageReader(we),Ue=new p.VSCodeWebSocketMessageWriter(we),qe=Ce(Be,Ue),_e=new G({name:"LSP Client",clientOptions:{documentSelector:[He],initializationOptions:l.initOptions,errorHandler:{error:()=>$e.Continue,closed:()=>Ve.Restart}},connectionProvider:{get:()=>Promise.resolve(qe)}});_e.start(),s.current.__lspClient=_e}}catch(p){console.warn("LSP bridge failed to load:",p)}re.current.onMount?.(x,a)}).catch(a=>{e&&(Oe(a.message??xe.current("codeEditor.failedToLoadEditor","Failed to load editor")),se(!1))}),()=>{if(e=!1,s.current?.dispose(),V.current?.dispose(),s.current&&s.current.__lspClient)try{s.current.__lspClient.stop()}catch{}}},[De]),n.useEffect(()=>{const e=s.current;if(!Z||!e||N===e.getValue())return;const l=e.getPosition();u.current=!0;try{e.setValue(N)}finally{u.current=!1}l&&e.setPosition(l)},[N,Z]),n.useEffect(()=>{const e=s.current,l=S.current;if(e&&l){const a=e.getModel();a&&l.editor.setModelLanguage(a,f)}},[f]),n.useEffect(()=>{const e=S.current;if(!e||R||!_||_.length===0||f!=="javascript"&&f!=="typescript")return;const l=e.languages?.typescript;if(!l)return;const a=[];try{_.forEach((y,x)=>{const p=y.filePath??`inmemory://model/nice-extralib-${x}.d.ts`,I=l.typescriptDefaults?.addExtraLib(y.content,p);I&&a.push(I);const G=l.javascriptDefaults?.addExtraLib(y.content,p);G&&a.push(G)})}catch(y){console.warn("Failed to register extraLibs:",y)}return()=>{a.forEach(y=>{try{y.dispose()}catch{}})}},[_,f,R]),n.useEffect(()=>{const e=S.current;if(e&&(e.editor.setTheme(ce(e,h,g.current)),!(h!=="auto"||typeof document>"u")))return Re(g.current,()=>{const l=S.current;l?.editor.setTheme(ce(l,"auto",g.current))})},[h,R]),n.useEffect(()=>{const e=s.current;e&&e.updateOptions(oe)},[oe]),n.useEffect(()=>{const e=s.current,l=S.current;if(e&&l){const a=e.getModel();if(a){const y=M.map(x=>({startLineNumber:x.startLineNumber,startColumn:x.startColumn,endLineNumber:x.endLineNumber,endColumn:x.endColumn,message:x.message,severity:x.severity}));l.editor.setModelMarkers(a,"owner",y)}}},[M]),n.useEffect(()=>{const e=s.current;if(e&&L.length>0){const l=L.map(a=>({range:{startLineNumber:a.range.startLineNumber,startColumn:a.range.startColumn,endLineNumber:a.range.endLineNumber,endColumn:a.range.endColumn},options:{className:a.className,glyphMarginClassName:a.glyphMarginClassName,hoverMessage:a.hoverMessage?{value:a.hoverMessage}:void 0,isWholeLine:a.isWholeLine}}));z.current=e.deltaDecorations(z.current,l)}},[L]),n.useEffect(()=>{const e=S.current;if(!e||!b)return;V.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 V.current=e.languages.registerCompletionItemProvider(f,{provideCompletionItems:async(a,y)=>({suggestions:(await b(a,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}}))})}),()=>{V.current?.dispose()}},[f,b]),n.useImperativeHandle(d,()=>({getEditor:()=>s.current,getMonaco:()=>S.current,focus:()=>s.current?.focus(),getValue:()=>s.current?.getValue()??"",setValue:e=>s.current?.setValue(e),getSelection:()=>{const e=s.current;if(!e)return"";const l=e.getSelection();return l?e.getModel()?.getValueInRange(l)??"":""},insertText:e=>{const l=s.current;if(!l)return;const a=l.getSelection();a&&l.executeEdits("",[{range:a,text:e}])},formatDocument:()=>{s.current?.getAction("editor.action.formatDocument")?.run()},goToLine:(e,l=1)=>{const a=s.current;a&&(a.setPosition({lineNumber:e,column:l}),a.revealLineInCenter(e),a.focus())},findReplace:()=>{s.current?.getAction("editor.action.startFindReplaceAction")?.run()},undo:()=>{s.current?.trigger("keyboard","undo",null)},redo:()=>{s.current?.trigger("keyboard","redo",null)},getCursorPosition:()=>{const e=s.current?.getPosition();return{lineNumber:e?.lineNumber??1,column:e?.column??1}},setMarkers:e=>{const l=s.current,a=S.current;if(l&&a){const y=l.getModel();if(y){const x=e.map(p=>({startLineNumber:p.startLineNumber,startColumn:p.startColumn,endLineNumber:p.endLineNumber,endColumn:p.endColumn,message:p.message,severity:p.severity}));a.editor.setModelMarkers(y,"owner",x)}}}}),[]);const q=n.useMemo(()=>({format:()=>s.current?.getAction("editor.action.formatDocument")?.run(),undo:()=>s.current?.trigger("keyboard","undo",null),redo:()=>s.current?.trigger("keyboard","redo",null),find:()=>s.current?.getAction("editor.action.startFindReplaceAction")?.run(),toggleWordWrap:()=>{const e=!de;Ae(e),s.current?.updateOptions({wordWrap:e?"on":"off"})},toggleMinimap:()=>{const e=s.current?.getOption?.(S.current?.editor?.EditorOption?.minimap);s.current?.updateOptions({minimap:{enabled:!e?.enabled}})},foldAll:()=>s.current?.getAction("editor.foldAll")?.run(),unfoldAll:()=>s.current?.getAction("editor.unfoldAll")?.run()}),[de]),We=N.split(`
|
|
2
|
-
`).length,ze=N.length;return t.jsxs("div",{className:`nice-code-editor-wrap nice-editor--${H} ${Y??""}`,style:{height:$,width:j,display:"flex",flexDirection:"column",position:"relative"},"data-testid":B,children:[t.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:t.jsx(k.NiceTutorialButton,{steps:k.resolveTutorial(J,Ke)})}),te&&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(k.NiceIcon,{name:"warning",size:16})," ",te]}),t.jsx("textarea",{value:N,onChange:e=>Q(e.target.value),readOnly:D||i.readOnly,style:{width:"100%",height:"100%",fontFamily:"monospace"}})]}),R&&!te&&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:A??t.jsx("div",{className:"nice-code-editor__loader",children:r("codeEditor.loadingEditor","Loading editor...")})}),K&&t.jsxs("div",{className:"nice-code-editor__toolbar",children:[t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.undo,title:r("codeEditor.undoCtrlZ","Undo (Ctrl+Z)"),"aria-label":r("codeEditor.undo","Undo"),children:t.jsx(k.NiceIcon,{name:"reply",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.redo,title:r("codeEditor.redoCtrlY","Redo (Ctrl+Y)"),"aria-label":r("codeEditor.redo","Redo"),children:t.jsx(k.NiceIcon,{name:"forward",size:16})}),t.jsx("span",{className:"nice-code-editor__toolbar-sep"}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.format,title:r("codeEditor.formatShiftAltF","Format (Shift+Alt+F)"),"aria-label":r("codeEditor.format","Format"),children:t.jsx(k.NiceIcon,{name:"type",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.find,title:r("codeEditor.findReplaceCtrlH","Find & Replace (Ctrl+H)"),"aria-label":r("codeEditor.findReplace","Find & Replace"),children:t.jsx(k.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:q.toggleWordWrap,title:r("codeEditor.toggleWordWrap","Toggle Word Wrap"),"aria-label":r("codeEditor.toggleWordWrap","Toggle Word Wrap"),children:t.jsx(k.NiceIcon,{name:"align-left",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.toggleMinimap,title:r("codeEditor.toggleMinimap","Toggle Minimap"),"aria-label":r("codeEditor.toggleMinimap","Toggle Minimap"),children:t.jsx(k.NiceIcon,{name:"columns",size:16})}),t.jsx("span",{className:"nice-code-editor__toolbar-sep"}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.foldAll,title:r("codeEditor.foldAll","Fold All"),"aria-label":r("codeEditor.foldAll","Fold All"),children:t.jsx(k.NiceIcon,{name:"collapse",size:16})}),t.jsx("button",{className:"nice-code-editor__toolbar-btn",onClick:q.unfoldAll,title:r("codeEditor.unfoldAll","Unfold All"),"aria-label":r("codeEditor.unfoldAll","Unfold All"),children:t.jsx(k.NiceIcon,{name:"expand",size:16})})]}),t.jsx("div",{ref:g,className:"nice-code-editor",style:{flex:1,minHeight:0}}),W&&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}),M.length>0&&t.jsxs("span",{className:"nice-code-editor__statusbar-markers",children:[t.jsx(k.NiceIcon,{name:"warning",size:14})," ",M.length]})]})]})});function Xe(o){const{t:c}=k.useNiceTranslation();fe.injectStyleOnce(ge,be);const{original:d,defaultOriginal:r,modified:m,defaultModified:C,language:w="plaintext",theme:f="auto",height:h=400,width:i="100%",inline:$=!1,renderSideBySide:j=!0,originalEditable:M=!1,modifiedEditable:L=!1,onOriginalChange:b,onModifiedChange:P,loading:E,className:T,"data-testid":F}=o,[A,D,K]=k.useControllableState({value:d,defaultValue:r,fallbackValue:"",onChange:b,componentName:"NiceCodeDiffEditor.original"}),[W,H,Y]=k.useControllableState({value:m,defaultValue:C,fallbackValue:"",onChange:P,componentName:"NiceCodeDiffEditor.modified"}),B=n.useRef({currentOriginal:A,currentModified:W,setOriginal:D,setModified:H});B.current={currentOriginal:A,currentModified:W,setOriginal:D,setModified:H};const O=n.useRef(!1),_=n.useRef(null);Te(_);const J=n.useRef(null),N=n.useRef(null),[Q,Z]=n.useState(!0),[U,v]=n.useState(null);return n.useEffect(()=>{if(!_.current)return;let u=!0;return Le().then(g=>{if(!u||!_.current)return;N.current=g;const{currentOriginal:s,currentModified:S}=B.current,z=g.editor.createModel(s,w),V=g.editor.createModel(S,w),R=g.editor.createDiffEditor(_.current,{automaticLayout:!0,theme:ie(f),renderSideBySide:!$&&j,originalEditable:M,readOnly:!L});R.setModel({original:z,modified:V}),J.current=R,Z(!1),M&&z.onDidChangeContent(()=>{O.current||B.current.setOriginal(z.getValue())}),L&&V.onDidChangeContent(()=>{O.current||B.current.setModified(V.getValue())})}).catch(g=>{u&&(v(g.message??c("codeEditor.failedToLoadDiffEditor","Failed to load diff editor")),Z(!1))}),()=>{u=!1,J.current?.dispose()}},[c]),n.useEffect(()=>{const u=J.current?.getModel();if(u){O.current=!0;try{K&&u.original.getValue()!==A&&u.original.setValue(A),Y&&u.modified.getValue()!==W&&u.modified.setValue(W)}finally{O.current=!1}}},[A,W,K,Y]),n.useEffect(()=>{const u=N.current;if(u&&(u.editor.setTheme(ce(u,f,_.current)),!(f!=="auto"||typeof document>"u")))return Re(_.current,()=>{const g=N.current;g?.editor.setTheme(ce(g,"auto",_.current))})},[f,Q]),U?t.jsx("div",{className:`nice-code-diff-editor nice-code-diff-editor--error ${T??""}`,style:{height:h,width:i},"data-testid":F,children:t.jsx("div",{className:"nice-code-editor__error",children:t.jsxs("span",{children:[t.jsx(k.NiceIcon,{name:"warning",size:16})," ",U]})})}):t.jsxs("div",{className:`nice-code-diff-editor ${T??""}`,style:{height:h,width:i,position:"relative"},"data-testid":F,children:[t.jsx("div",{ref:_,style:{position:"absolute",inset:0}}),Q&&t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--nice-bg-primary, #fff)",zIndex:2},children:E??t.jsx("div",{className:"nice-code-editor__loader",children:c("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 ae(o){return new Promise((c,d)=>{if(document.querySelector(`script[data-prism-src="${o}"]`)){c();return}const r=document.createElement("script");r.src=o,r.async=!0,r.dataset.prismSrc=o,r.onload=()=>c(),r.onerror=()=>d(new Error(`Failed to load ${o}`)),document.head.appendChild(r)})}function tt(o){if(typeof window>"u")return Promise.resolve(null);const c=window,d=pe[o]??"plain",r=async()=>{if(d!=="plain"&&!c.Prism?.languages?.[d])try{await ae(`${je}/components/prism-${d}.min.js`)}catch{}};return c.Prism?.languages?r().then(()=>c.Prism):(le||(le=(async()=>(window.Prism={manual:!0},await ae(`${je}/prism.min.js`),window.Prism))()),le.then(async()=>(await r(),window.Prism)))}function ue(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function rt(o){fe.injectStyleOnce(ge,be);const{value:c,defaultValue:d,onChange:r,language:m="plaintext",height:C=300,width:w="100%",readOnly:f=!1,tabSize:h=2,lineNumbers:i=!0,placeholder:$,theme:j="auto",className:M,"data-testid":L}=o,[b,P]=k.useControllableState({value:c,defaultValue:d,fallbackValue:"",onChange:r,componentName:"NiceSimpleCodeEditor"}),E=n.useRef(null),T=n.useRef(null),F=n.useRef(null),{t:A}=k.useNiceTranslation(),D=n.useId(),[K]=n.useState(k.createTabEscape),[W,H]=n.useState(()=>ue(b)),Y=n.useRef(null),[B]=n.useState(()=>({get current(){return Y.current?.parentElement??null}})),O=k.useThemeIsDark(B),_=j==="auto"?O?"dark":"light":j;n.useEffect(()=>{let v=!0;return tt(m).then(u=>{if(!v)return;const g=pe[m]??"plain";if(u?.languages?.[g])try{const s=u.highlight(b,u.languages[g],g);H(s);return}catch{}H(ue(b))}).catch(()=>{v&&H(ue(b))}),()=>{v=!1}},[b,m]);const J=n.useCallback(()=>{if(!T.current||!E.current)return;T.current.scrollTop=E.current.scrollTop,T.current.scrollLeft=E.current.scrollLeft;const v=F.current;if(v){const u=E.current.offsetHeight-E.current.clientHeight;v.style.paddingBottom=`calc(var(--nice-space-2, 8px) + ${u}px)`,v.scrollTop=E.current.scrollTop}},[]),N=n.useCallback(v=>{if(!K(v)&&v.key==="Tab"&&!f){v.preventDefault();const u=v.currentTarget,g=u.selectionStart,s=u.selectionEnd,S=" ".repeat(h);if(v.shiftKey){const R=b.substring(0,g).lastIndexOf(`
|
|
3
|
-
`)+1;if((b.substring(R,g).match(/^(\s*)/)?.[1]??"").length>=h){const te=b.substring(0,R)+b.substring(R+h);P(te),setTimeout(()=>{u.selectionStart=u.selectionEnd=g-h},0)}}else{const z=b.substring(0,g)+S+b.substring(s);P(z),setTimeout(()=>{u.selectionStart=u.selectionEnd=g+h},0)}}},[b,P,h,K,f]),Z=b.split(`
|
|
4
|
-
`).length,U=pe[m]??"plain";return t.jsxs("div",{ref:Y,className:`nice-simple-code-editor nice-simple-code-editor--${_}${j==="auto"?" nice-simple-code-editor--auto":""} ${M??""}`,style:{height:C,width:w},"data-testid":L,"data-language":m,"data-theme":_,children:[i&&t.jsx("div",{ref:F,className:"nice-simple-code-editor__line-numbers",children:Array.from({length:Z},(v,u)=>t.jsx("div",{className:"nice-simple-code-editor__line-number",children:u+1},u))}),t.jsxs("div",{className:"nice-simple-code-editor__editor-area",children:[t.jsx("pre",{ref:T,"aria-hidden":"true",className:`nice-simple-code-editor__highlight language-${U}`,children:t.jsx("code",{className:`language-${U}`,dangerouslySetInnerHTML:{__html:W+(b.endsWith(`
|
|
5
|
-
`)?`
|
|
6
|
-
`:"")}})}),t.jsx("textarea",{ref:E,className:"nice-simple-code-editor__textarea",value:b,onChange:v=>P(v.target.value),onKeyDown:N,onScroll:J,readOnly:f,placeholder:$,spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-describedby":f?void 0:D}),!f&&t.jsx("span",{id:D,className:"nice-sr-only",children:A("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
|
-
.nice-code-editor__error {
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
width: 100%;
|
|
32
|
-
height: 100%;
|
|
33
|
-
padding: var(--nice-space-2, 8px);
|
|
34
|
-
gap: var(--nice-space-2, 8px);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.nice-code-editor__error span {
|
|
38
|
-
color: var(--nice-error, #d32f2f);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* Simple code editor */
|
|
42
|
-
.nice-simple-code-editor {
|
|
43
|
-
display: flex;
|
|
44
|
-
border: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
|
|
45
|
-
border-radius: var(--nice-radius-sm, 4px);
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
line-height: 1.5;
|
|
50
|
-
background: var(--nice-bg-primary, var(--nice-bg-surface, #fff));
|
|
51
|
-
color: var(--nice-text-primary, var(--nice-text-primary, #333));
|
|
52
|
-
}
|
|
53
|
-
.nice-simple-code-editor--dark {
|
|
54
|
-
background: var(--nice-bg, #1e1e1e);
|
|
55
|
-
color: var(--nice-text, #d4d4d4);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.nice-simple-code-editor__line-numbers {
|
|
59
|
-
padding: var(--nice-space-2, 8px) 0;
|
|
60
|
-
background: var(--nice-bg-secondary, var(--nice-bg-tertiary, #f5f5f5));
|
|
61
|
-
border-right: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
|
|
62
|
-
user-select: none;
|
|
63
|
-
text-align: right;
|
|
64
|
-
color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
}
|
|
67
|
-
.nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
|
|
68
|
-
background: var(--nice-bg-secondary, #252526);
|
|
69
|
-
border-right-color: var(--nice-border, #3c3c3c);
|
|
70
|
-
color: var(--nice-text-muted, #858585);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.nice-simple-code-editor__line-number {
|
|
74
|
-
padding: 0 var(--nice-space-3, 12px);
|
|
75
|
-
min-width: 40px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.nice-simple-code-editor__editor-area {
|
|
79
|
-
position: relative;
|
|
80
|
-
flex: 1;
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.nice-simple-code-editor__highlight,
|
|
85
|
-
.nice-simple-code-editor__textarea {
|
|
86
|
-
position: absolute;
|
|
87
|
-
inset: 0;
|
|
88
|
-
margin: 0;
|
|
89
|
-
padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
|
|
90
|
-
border: 0;
|
|
91
|
-
font: inherit;
|
|
92
|
-
line-height: inherit;
|
|
93
|
-
white-space: pre;
|
|
94
|
-
overflow: auto;
|
|
95
|
-
tab-size: 2;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.nice-simple-code-editor__highlight {
|
|
99
|
-
pointer-events: none;
|
|
100
|
-
background: transparent;
|
|
101
|
-
color: inherit;
|
|
102
|
-
}
|
|
103
|
-
.nice-simple-code-editor__highlight code {
|
|
104
|
-
font: inherit;
|
|
105
|
-
background: transparent;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.nice-simple-code-editor__textarea {
|
|
109
|
-
background: transparent;
|
|
110
|
-
color: transparent;
|
|
111
|
-
caret-color: var(--nice-text-primary, var(--nice-text-primary, #333));
|
|
112
|
-
resize: none;
|
|
113
|
-
outline: none;
|
|
114
|
-
-webkit-text-fill-color: transparent;
|
|
115
|
-
}
|
|
116
|
-
.nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
|
|
117
|
-
caret-color: var(--nice-text, #d4d4d4);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.nice-simple-code-editor__textarea::placeholder {
|
|
121
|
-
color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
122
|
-
-webkit-text-fill-color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
|
|
123
|
-
}
|
|
124
|
-
.nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
|
|
125
|
-
color: var(--nice-text-muted, #858585);
|
|
126
|
-
-webkit-text-fill-color: var(--nice-text-muted, #858585);
|
|
127
|
-
}
|
|
128
|
-
/* theme="auto": the page's theme colours in both light and dark (R43) — the --dark rules above
|
|
129
|
-
are for an explicit theme="dark" on a light page */
|
|
130
|
-
.nice-simple-code-editor--auto.nice-simple-code-editor--dark {
|
|
131
|
-
background: var(--nice-bg-primary);
|
|
132
|
-
color: var(--nice-text-primary);
|
|
133
|
-
}
|
|
134
|
-
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
|
|
135
|
-
background: var(--nice-bg-secondary);
|
|
136
|
-
border-right-color: var(--nice-border-color);
|
|
137
|
-
color: var(--nice-text-secondary);
|
|
138
|
-
}
|
|
139
|
-
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
|
|
140
|
-
caret-color: var(--nice-text-primary);
|
|
141
|
-
}
|
|
142
|
-
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
|
|
143
|
-
color: var(--nice-text-secondary);
|
|
144
|
-
-webkit-text-fill-color: var(--nice-text-secondary);
|
|
145
|
-
}
|
|
146
|
-
.nice-simple-code-editor--auto.nice-simple-code-editor--dark .token.punctuation {
|
|
147
|
-
color: var(--nice-text-primary);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* Prism token colors — light */
|
|
151
|
-
.nice-simple-code-editor .token.comment,
|
|
152
|
-
.nice-simple-code-editor .token.prolog,
|
|
153
|
-
.nice-simple-code-editor .token.doctype,
|
|
154
|
-
.nice-simple-code-editor .token.cdata { color: #6a737d; font-style: italic; }
|
|
155
|
-
.nice-simple-code-editor .token.punctuation { color: #586069; }
|
|
156
|
-
.nice-simple-code-editor .token.property,
|
|
157
|
-
.nice-simple-code-editor .token.tag,
|
|
158
|
-
.nice-simple-code-editor .token.boolean,
|
|
159
|
-
.nice-simple-code-editor .token.number,
|
|
160
|
-
.nice-simple-code-editor .token.constant,
|
|
161
|
-
.nice-simple-code-editor .token.symbol,
|
|
162
|
-
.nice-simple-code-editor .token.deleted { color: #005cc5; }
|
|
163
|
-
.nice-simple-code-editor .token.selector,
|
|
164
|
-
.nice-simple-code-editor .token.attr-name,
|
|
165
|
-
.nice-simple-code-editor .token.string,
|
|
166
|
-
.nice-simple-code-editor .token.char,
|
|
167
|
-
.nice-simple-code-editor .token.builtin,
|
|
168
|
-
.nice-simple-code-editor .token.inserted { color: #032f62; }
|
|
169
|
-
.nice-simple-code-editor .token.operator,
|
|
170
|
-
.nice-simple-code-editor .token.entity,
|
|
171
|
-
.nice-simple-code-editor .token.url,
|
|
172
|
-
.nice-simple-code-editor .token.variable { color: var(--nice-danger, #d73a49); }
|
|
173
|
-
.nice-simple-code-editor .token.atrule,
|
|
174
|
-
.nice-simple-code-editor .token.attr-value,
|
|
175
|
-
.nice-simple-code-editor .token.keyword { color: var(--nice-danger, #d73a49); font-weight: 600; }
|
|
176
|
-
.nice-simple-code-editor .token.function,
|
|
177
|
-
.nice-simple-code-editor .token.class-name { color: #6f42c1; }
|
|
178
|
-
.nice-simple-code-editor .token.regex,
|
|
179
|
-
.nice-simple-code-editor .token.important { color: #e36209; }
|
|
180
|
-
|
|
181
|
-
/* Prism token colors — dark */
|
|
182
|
-
.nice-simple-code-editor--dark .token.comment,
|
|
183
|
-
.nice-simple-code-editor--dark .token.prolog,
|
|
184
|
-
.nice-simple-code-editor--dark .token.doctype,
|
|
185
|
-
.nice-simple-code-editor--dark .token.cdata { color: var(--nice-success, #6a9955); font-style: italic; }
|
|
186
|
-
.nice-simple-code-editor--dark .token.punctuation { color: var(--nice-text, #d4d4d4); }
|
|
187
|
-
.nice-simple-code-editor--dark .token.property,
|
|
188
|
-
.nice-simple-code-editor--dark .token.tag,
|
|
189
|
-
.nice-simple-code-editor--dark .token.boolean,
|
|
190
|
-
.nice-simple-code-editor--dark .token.number,
|
|
191
|
-
.nice-simple-code-editor--dark .token.constant,
|
|
192
|
-
.nice-simple-code-editor--dark .token.symbol,
|
|
193
|
-
.nice-simple-code-editor--dark .token.deleted { color: var(--nice-success-light, #b5cea8); }
|
|
194
|
-
.nice-simple-code-editor--dark .token.selector,
|
|
195
|
-
.nice-simple-code-editor--dark .token.attr-name,
|
|
196
|
-
.nice-simple-code-editor--dark .token.string,
|
|
197
|
-
.nice-simple-code-editor--dark .token.char,
|
|
198
|
-
.nice-simple-code-editor--dark .token.builtin,
|
|
199
|
-
.nice-simple-code-editor--dark .token.inserted { color: var(--nice-warning, #ce9178); }
|
|
200
|
-
.nice-simple-code-editor--dark .token.operator,
|
|
201
|
-
.nice-simple-code-editor--dark .token.entity,
|
|
202
|
-
.nice-simple-code-editor--dark .token.url,
|
|
203
|
-
.nice-simple-code-editor--dark .token.variable { color: var(--nice-primary, #569cd6); }
|
|
204
|
-
.nice-simple-code-editor--dark .token.atrule,
|
|
205
|
-
.nice-simple-code-editor--dark .token.attr-value,
|
|
206
|
-
.nice-simple-code-editor--dark .token.keyword { color: #c586c0; font-weight: 600; }
|
|
207
|
-
.nice-simple-code-editor--dark .token.function,
|
|
208
|
-
.nice-simple-code-editor--dark .token.class-name { color: #dcdcaa; }
|
|
209
|
-
.nice-simple-code-editor--dark .token.regex,
|
|
210
|
-
.nice-simple-code-editor--dark .token.important { color: #d7ba7d; }
|
|
211
|
-
|
|
212
|
-
/* Toolbar */
|
|
213
|
-
.nice-code-editor-wrap {
|
|
214
|
-
border: 1px solid var(--nice-border, #e0e0e0);
|
|
215
|
-
border-radius: var(--nice-radius-sm, 4px);
|
|
216
|
-
overflow: hidden;
|
|
217
|
-
}
|
|
218
|
-
.nice-code-editor-wrap .nice-code-editor {
|
|
219
|
-
border: none;
|
|
220
|
-
border-radius: 0;
|
|
221
|
-
}
|
|
222
|
-
/* The editing surface draws no outline: while it has focus, the frame shows the ring
|
|
223
|
-
(TODO_1.3.0 I4). */
|
|
224
|
-
.nice-code-editor-wrap:has(.nice-code-editor:focus-within),
|
|
225
|
-
.nice-code-diff-editor:focus-within,
|
|
226
|
-
.nice-simple-code-editor:focus-within {
|
|
227
|
-
border-color: var(--nice-color-primary, #3b82f6);
|
|
228
|
-
box-shadow: var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6));
|
|
229
|
-
}
|
|
230
|
-
.nice-code-editor__toolbar {
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
gap: var(--nice-space-0-5, 2px);
|
|
234
|
-
padding: var(--nice-space-0-75, 3px) var(--nice-space-1-5, 6px);
|
|
235
|
-
background: var(--nice-bg-tertiary, #f5f5f5);
|
|
236
|
-
border-bottom: 1px solid var(--nice-border, #e0e0e0);
|
|
237
|
-
}
|
|
238
|
-
.nice-code-editor__toolbar-btn {
|
|
239
|
-
display: inline-flex;
|
|
240
|
-
align-items: center;
|
|
241
|
-
justify-content: center;
|
|
242
|
-
width: 26px;
|
|
243
|
-
height: 26px;
|
|
244
|
-
border: none;
|
|
245
|
-
border-radius: var(--nice-radius-sm, 3px);
|
|
246
|
-
background: transparent;
|
|
247
|
-
color: var(--nice-text-secondary, #666);
|
|
248
|
-
cursor: pointer;
|
|
249
|
-
font-size: 14px;
|
|
250
|
-
transition: background 0.15s, color 0.15s;
|
|
251
|
-
}
|
|
252
|
-
.nice-code-editor__toolbar-btn:hover {
|
|
253
|
-
background: var(--nice-hover-bg, #e0e0e0);
|
|
254
|
-
color: var(--nice-text-primary, #333);
|
|
255
|
-
}
|
|
256
|
-
.nice-code-editor__toolbar-btn--active {
|
|
257
|
-
background: var(--nice-accent, #1976d2);
|
|
258
|
-
color: var(--nice-text-on-primary, #FFF);
|
|
259
|
-
}
|
|
260
|
-
.nice-code-editor__toolbar-sep {
|
|
261
|
-
width: 1px;
|
|
262
|
-
height: 18px;
|
|
263
|
-
background: var(--nice-border, #e0e0e0);
|
|
264
|
-
margin: 0 var(--nice-space-1, 4px);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* Status bar */
|
|
268
|
-
.nice-code-editor__statusbar {
|
|
269
|
-
display: flex;
|
|
270
|
-
align-items: center;
|
|
271
|
-
gap: var(--nice-space-3, 12px);
|
|
272
|
-
padding: var(--nice-space-0-5, 2px) var(--nice-space-2-5, 10px);
|
|
273
|
-
background: var(--nice-bg-tertiary, #f5f5f5);
|
|
274
|
-
border-top: 1px solid var(--nice-border, #e0e0e0);
|
|
275
|
-
font-size: 12px;
|
|
276
|
-
color: var(--nice-text-secondary, #666);
|
|
277
|
-
user-select: none;
|
|
278
|
-
}
|
|
279
|
-
.nice-code-editor__statusbar-spacer { flex: 1; }
|
|
280
|
-
.nice-code-editor__statusbar-lang {
|
|
281
|
-
text-transform: uppercase;
|
|
282
|
-
font-weight: 600;
|
|
283
|
-
font-size: 11px;
|
|
284
|
-
}
|
|
285
|
-
.nice-code-editor__statusbar-markers {
|
|
286
|
-
color: var(--nice-warning, #f39c12);
|
|
287
|
-
font-weight: 600;
|
|
288
|
-
}
|
|
289
|
-
`;exports.NiceCodeDiffEditor=Xe;exports.NiceCodeEditor=Ge;exports.NiceSimpleCodeEditor=rt;
|