@nice2dev/ui 1.4.20 → 1.4.22

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/NiceCodeEditor-CBgbzwjx.cjs +297 -0
  3. package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
  4. package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
  5. package/dist/{NiceMention-DhaTUqvR.cjs → NiceMention-D330ovOt.cjs} +1 -1
  6. package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
  7. package/dist/NiceWindow-DQyf5wat.cjs +1 -0
  8. package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-CUnBYI-T.cjs} +1 -1
  9. package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
  10. package/dist/display/NiceLeaderboard.mjs +47 -40
  11. package/dist/display/NiceQuestCard.mjs +93 -76
  12. package/dist/docs/NiceGantt.doc.json.mjs +9 -9
  13. package/dist/documentation/utils.mjs +1 -1
  14. package/dist/editors/rich/NiceCodeEditor.mjs +525 -504
  15. package/dist/editors.cjs +1 -1
  16. package/dist/index.cjs +99 -94
  17. package/dist/index.d.ts +63 -2
  18. package/dist/index.mjs +778 -776
  19. package/dist/navigation/NiceMenu.mjs +249 -248
  20. package/dist/navigation.cjs +1 -1
  21. package/dist/navigation.d.ts +6 -0
  22. package/dist/overlays/NiceResponsiveBox.mjs +51 -24
  23. package/dist/overlays/NiceTutorial.mjs +136 -127
  24. package/dist/overlays.cjs +1 -1
  25. package/dist/overlays.d.ts +25 -2
  26. package/dist/planning/NiceGantt.mjs +130 -121
  27. package/dist/planning/NiceStepper.mjs +36 -35
  28. package/dist/style.css +2 -2
  29. package/dist/tools/NiceDraggable.mjs +44 -29
  30. package/dist/tools/NiceGitManager.mjs +5 -0
  31. package/dist/tools/NiceSortable.mjs +66 -48
  32. package/dist/tools/NiceSpeechToText.mjs +67 -52
  33. package/dist/tools/NiceValidationBuilder.mjs +210 -119
  34. package/dist/tools/NiceViewRegistry.mjs +67 -34
  35. package/dist/workflow/NiceTaskInbox.mjs +14 -12
  36. package/package.json +4 -4
  37. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
  38. package/dist/NiceCodeEditor-DhdjnDLV.cjs +0 -289
  39. package/dist/NiceGantt-BygumlaY.cjs +0 -1
  40. package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
  41. package/dist/NiceWindow-BklnkBpu.cjs +0 -1
  42. package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
package/CHANGELOG.md CHANGED
@@ -1,5 +1,95 @@
1
1
  # [1.0.27] — 2026-06-07
2
2
 
3
+ ## 1.4.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 4a84396: Controls B (round 44, 1.4.22): editors, tools and media.
8
+
9
+ - **Built-in icons** (`NiceIcon` without a resolver):
10
+ - `refresh` takes NtdRefresh's shape: two arcs with solid heads, replacing the old corner glyph;
11
+ - `grip` is six dots;
12
+ - `indent` and `outdent` are text lines with a solid arrow head;
13
+ - built-ins can now have filled parts.
14
+ - **NiceCaptcha, NicePasswordGenerator:** the refresh button draws the refresh icon, not a CSS ring.
15
+ The captcha button has no frame.
16
+ - **NiceTaskInbox:** the refresh button is a frameless icon button.
17
+ - **NiceGitManager** fills its container, so the width no longer jumps between tabs.
18
+ - **NiceCodeDiffEditor:**
19
+ - it no longer scrolls past the last line;
20
+ - the line-number gutter is narrow, and the +/- markers have a gap before the code;
21
+ - new `options` passes Monaco settings through.
22
+ - **NiceCodeEditor:** the matching bracket pair gets a tinted box, and the bracket-pair guide line is
23
+ gone.
24
+ - **NiceChatWindow:** the hover actions sit centred beside the bubble.
25
+ - **NiceWorkflowInstanceMonitor:** the process name and the instance id are on two lines.
26
+ - **NiceDataExportCenter:**
27
+ - columns move up and down;
28
+ - a column takes its own header name (new `ExportField.header`);
29
+ - export configurations are saved under a name, picked from a list and deleted from the same bar.
30
+ - **NiceGenericPlayer:**
31
+ - dropped audio and video files join the playlist (`allowFileDrop`, `onFilesAdded`), and video
32
+ files play in the stage (new `'video'` source kind);
33
+ - a Playlist button shows and hides the list (`showPlaylist`);
34
+ - `showProControls` hides the shuffle, repeat, speed and A-B row.
35
+ - **NicePianoRoll:**
36
+ - new `snapToGrid` (on by default) snaps a new note to the grid;
37
+ - new `gridDivisions`, `noteLength` and `readOnly`.
38
+
39
+ - Updated dependencies [4a84396]
40
+ - @nice2dev/ui-core@1.4.22
41
+ - @nice2dev/i18n@1.4.22
42
+
43
+ ## 1.4.21
44
+
45
+ ### Patch Changes
46
+
47
+ - 15ed387: Controls A (round 44, 1.4.21): forms, navigation and layout fixes from the showcase feedback.
48
+
49
+ - **NiceStepper** (and NiceWizard, which uses it):
50
+ - connectors sit level with the middle of the circle, however many lines a description has;
51
+ - vertical steps centre the circle on the item;
52
+ - steps take `status` (`completed`, `active`, `pending`, `error`, `skipped`) and `description`.
53
+ - **NiceDocumentApprovalFlow** draws its steps with NiceStepper. The decision panel stays.
54
+ - **NiceMenu:** new `panelAnchor: 'item' | 'menu'`. With `'menu'`, `panelAlign` lines the panel up
55
+ with the whole bar.
56
+ - **NiceBottomSheet:**
57
+ - snap points are visible dots (`showSnapPoints`), and clicking one jumps there;
58
+ - the handle is a slider (arrow keys, Home, End);
59
+ - a new `initialSnap` or new `snapPoints` move an open sheet.
60
+ - **NiceSortable:** the drop line is measured from the items. It sits midway between two items, and
61
+ in a row it is as tall as an item. Dragging down drops after the hovered item.
62
+ - **NiceDraggable:** marks itself while dragged (`nice-draggable--dragging`). `NICE_DRAG_MIME` and
63
+ `readNiceDrag()` read a drop.
64
+ - **NiceResponsiveBox** follows its own width with a ResizeObserver: it stacks below `stackBelow`
65
+ (480) and wraps at `minItemWidth`.
66
+ - **NiceIconRail, NiceSortableTree:** `size` scales the buttons, the icons and the text, not only the
67
+ spacing.
68
+ - **NiceLoginForm** (auth): an empty `title` hides the heading.
69
+ - **NiceSpeechToText:** errors read as translated sentences, not browser codes, and a new
70
+ `onError(code)` reports the code.
71
+ - **NiceQuestCard:** at 100 % the bar turns green and shows a check mark.
72
+ - **NiceLeaderboard:** players without a photo get initials on one of six theme tones.
73
+ - **NiceTutorial:** new `showBackButton`, `showCloseButton`, `showProgressBar` and `showSpeedControl`.
74
+ - **NiceEntityEditor:** "Add field" and "New entity" open dialogs.
75
+ - **NiceI18nEditor:**
76
+ - removals ask first (`confirmRemove`);
77
+ - Undo and Redo (Ctrl+Z, Ctrl+Y);
78
+ - `onSave` adds a Save button (Ctrl+S);
79
+ - the buttons are icon-only.
80
+ - **Validation:**
81
+ - rules take a `group`, and NiceValidationBuilder has "+ Group";
82
+ - `evaluateValidation(rules, record, { groups, includeUngrouped })` and `isRecordValid` check only
83
+ the chosen groups.
84
+ - **NiceViewRegistry:** the default registry renders `dataGrid`, `chart`, `kpi` and `badge`, so the
85
+ studio's view preview no longer shows "Unknown control".
86
+ - **NiceGantt:** `dependencyStyle="rounded"` draws curves on every route, including arrows that run
87
+ back to the left and links within one row.
88
+
89
+ - Updated dependencies [15ed387]
90
+ - @nice2dev/ui-core@1.4.21
91
+ - @nice2dev/i18n@1.4.21
92
+
3
93
  ## 1.4.20
4
94
 
5
95
  ### 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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}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;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),m=require("react"),ie=[],b=(_,x)=>{const w=new Date(_);return w.setDate(w.getDate()+x),w},j=(_,x)=>Math.ceil((x.getTime()-_.getTime())/864e5),P=({tasks:_=ie,columns:x,scale:w="day",rowHeight:f=36,dayWidth:Q=30,onTaskClick:D,onTaskUpdate:p,showDependencies:F=!0,dependencyStyle:G="square",draggable:N,zoomControls:J,className:K,style:Y,accessMode:V,id:Z,"data-testid":k})=>{const{t:H}=M.useNiceTranslation(),U=M.useNiceAccessMode(V,Z)==="hidden",{t:oe}=M.useNiceTranslation(),[d,R]=m.useState(Q),[v,W]=m.useState(null),L=x||[{field:"title",title:H("gantt.task","Task"),width:200}],A=L.reduce((e,t)=>e+(t.width||120),0),C=m.useRef(null),q=m.useRef(null),E=m.useRef(!1);m.useEffect(()=>{const e=C.current,t=q.current;if(!e||!t)return;const s=(o,i)=>()=>{E.current||(E.current=!0,i.scrollTop=o.scrollTop,requestAnimationFrame(()=>{E.current=!1}))},n=s(e,t),r=s(t,e);return e.addEventListener("scroll",n,{passive:!0}),t.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",n),t.removeEventListener("scroll",r)}},[]);const u=m.useMemo(()=>{const e=t=>_.filter(n=>(n.parentId??null)===t).flatMap(n=>[n,...e(n.id)]);return e(null)},[_]),g=m.useMemo(()=>{if(u.length===0)return{start:new Date,end:new Date,days:30};let e=new Date(u[0].start),t=new Date(u[0].end);return u.forEach(s=>{new Date(s.start)<e&&(e=new Date(s.start)),new Date(s.end)>t&&(t=new Date(s.end))}),e=b(e,-2),t=b(t,2),{start:e,end:t,days:j(e,t)}},[u]),z=g.days*d;m.useEffect(()=>{if(!v||!p)return;const e=s=>{const n=s.clientX-v.startX,r=Math.round(n/d);if(r===0)return;const o=_.find(i=>i.id===v.taskId);if(o)if(v.mode==="move")p({...o,start:b(v.origStart,r),end:b(v.origEnd,r)});else{const i=b(v.origEnd,r);i>v.origStart&&p({...o,end:i})}},t=()=>W(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[v,d,_,p]);const B=m.useCallback((e,t,s)=>{if(!N||!p)return;s.stopPropagation();const n=_.find(r=>r.id===e);n&&W({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[N,_,p]),ee=m.useCallback(()=>R(e=>Math.min(100,e+5)),[]),te=m.useCallback(()=>R(e=>Math.max(8,e-5)),[]),ne=()=>{const e=[],t=[];new Date(g.start);const s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(w==="day"){let n=-1,r=0;for(let o=0;o<g.days;o++){const i=b(g.start,o);i.getMonth()!==n&&(n>=0&&e.push(a.jsxs("div",{className:"nice-gantt__header-cell",style:{width:(o-r)*d},children:[s[n]," ",i.getFullYear()]},`m${n}-${r}`)),n=i.getMonth(),r=o);const c=i.getDay()===0||i.getDay()===6;t.push(a.jsx("div",{className:`nice-gantt__header-cell nice-gantt__header-cell--sub ${c?"nice-gantt__header-cell--weekend":""}`,style:{width:d},children:i.getDate()},o))}n>=0&&e.push(a.jsx("div",{className:"nice-gantt__header-cell",style:{width:(g.days-r)*d},children:s[n]},`m${n}-last`))}return a.jsxs("div",{className:"nice-gantt__chart-header",children:[a.jsx("div",{className:"nice-gantt__header-row",children:e}),a.jsx("div",{className:"nice-gantt__header-row",children:t})]})},se=(e,t)=>{const s=j(g.start,new Date(e.start))*d,n=Math.max(j(new Date(e.start),new Date(e.end))*d,d),r=t*f+4,o=f-8,i=e.progress??0;return a.jsxs("div",{role:D?"button":void 0,tabIndex:D?0:void 0,onKeyDown:D?M.clickOnActivationKey:void 0,className:`nice-gantt__bar ${N?"nice-gantt__bar--draggable":""}`,title:`${e.title} (${Math.round(i)}%)`,style:{left:s,top:r,width:n,height:o,backgroundColor:e.color||"var(--nice-color-primary, #3b82f6)"},onClick:()=>D?.(e),onMouseDown:N?c=>B(e.id,"move",c):void 0,children:[i>0&&a.jsx("div",{className:"nice-gantt__bar-progress",style:{width:`${i}%`}}),a.jsx("span",{className:"nice-gantt__bar-label",children:e.title}),N&&a.jsx("div",{className:"nice-gantt__bar-resize",onMouseDown:c=>B(e.id,"resize",c)})]},e.id)},ae=(e,t,s,n,r)=>{const c=e+10,l=s-14,y=Math.abs(n-t)<1,S=l<=c+4;if(y&&!S)return`M ${e} ${t} L ${s} ${n}`;const h=y?t+f/2:(t+n)/2,I=[`M ${e} ${t}`,`L ${c} ${t}`,`L ${c} ${h}`,`L ${l} ${h}`,`L ${l} ${n}`,`L ${s} ${n}`].join(" ");if(!r)return I;const O=h>=t?1:-1,T=n>=h?1:-1,X=l>=c?1:-1,$=Math.min(8,10,Math.abs(h-t)/2,Math.abs(n-h)/2,Math.abs(l-c)/2);return $<1?I:[`M ${e} ${t}`,`L ${c-$} ${t}`,`Q ${c} ${t} ${c} ${t+O*$}`,`L ${c} ${h-O*$}`,`Q ${c} ${h} ${c+X*$} ${h}`,`L ${l-X*$} ${h}`,`Q ${l} ${h} ${l} ${h+T*$}`,`L ${l} ${n-T*$}`,`Q ${l} ${n} ${l+$} ${n}`,`L ${s} ${n}`].join(" ")},re=()=>{if(!F)return null;const e=[],t=new Map(u.map((s,n)=>[s.id,n]));return u.forEach(s=>{(s.dependencies||[]).forEach(n=>{const r=t.get(n),o=t.get(s.id);if(r==null||o==null)return;const i=u[r],c=j(g.start,new Date(i.end))*d,l=r*f+f/2,y=j(g.start,new Date(s.start))*d,S=o*f+f/2;e.push(a.jsx("path",{d:ae(c,l,y,S,G==="rounded"),fill:"none",stroke:"var(--nice-text-secondary, #6b7280)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",markerEnd:"url(#arrowhead)"},`${n}-${s.id}`))})}),a.jsxs("svg",{className:"nice-gantt__deps",width:z,height:u.length*f,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"arrowhead",markerWidth:"6",markerHeight:"4",refX:"5",refY:"2",orient:"auto",children:a.jsx("polygon",{points:"0 0, 6 2, 0 4",fill:"var(--nice-text-secondary, #6b7280)"})})}),e]})};return U?null:a.jsxs("div",{className:`nice-gantt ${K||""}`,style:Y,"data-testid":k,children:[J&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:te,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[d,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ee,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:A,minWidth:A},children:[a.jsxs("div",{className:"nice-gantt__table-header",children:[a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--main","aria-hidden":"true",children:" "}),a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--sub",children:L.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-header-cell",style:{width:e.width||120},children:e.title},t))})]}),a.jsx("div",{className:"nice-gantt__table-body",ref:C,children:u.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:f},children:L.map((s,n)=>a.jsx("div",{className:"nice-gantt__table-cell",style:{width:s.width||120},children:e[s.field]},n))},e.id))})]}),a.jsx("div",{className:"nice-gantt__chart",children:a.jsxs("div",{className:"nice-gantt__chart-body-wrap",ref:q,children:[ne(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:z,height:u.length*f,position:"relative"},children:[Array.from({length:g.days},(e,t)=>{const s=b(g.start,t),n=s.getDay()===0||s.getDay()===6;return a.jsx("div",{className:`nice-gantt__gridline ${n?"nice-gantt__gridline--weekend":""}`,style:{left:t*d,width:d,height:"100%",position:"absolute",top:0}},t)}),u.map((e,t)=>se(e,t)),re()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(P.displayName="NiceGantt");exports.NiceGantt=P;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceGantt",a="Gantt Chart",s="1.0.0",n="stable",o="planning",i="scheduling",r="Project Gantt chart with draggable bars, dependencies, and zoom controls.",c="1.0.0",d=["web","desktop"],l=["gantt","project","timeline","scheduling","tasks"],p=[{name:"tasks",type:"NiceGanttTask[]",required:!1,default:"[]",description:"Tasks (id, title, start, end, progress, color, parentId, dependencies)."},{name:"columns",type:"NiceGanttColumn[]",required:!1,description:"Left panel columns configuration."},{name:"scale",type:"'day' | 'week' | 'month'",required:!1,default:"'day'",description:"Time scale."},{name:"rowHeight",type:"number",required:!1,description:"Row height in px."},{name:"dayWidth",type:"number",required:!1,description:"Day column width in px."},{name:"showDependencies",type:"boolean",required:!1,default:"true",description:"Show dependency arrows."},{name:"draggable",type:"boolean",required:!1,description:"Enable drag to move/resize tasks."},{name:"zoomControls",type:"boolean",required:!1,description:"Show zoom controls."}],m=[{name:"onTaskClick",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called when task clicked."},{name:"onTaskUpdate",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called after task drag/resize."}],u=[],h=[{title:"Project Gantt",code:`<NiceGantt
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceGantt",a="Gantt Chart",s="1.0.0",n="stable",o="planning",r="scheduling",i="Project Gantt chart with draggable bars, dependencies, and zoom controls.",c="1.0.0",d=["web","desktop"],l=["gantt","project","timeline","scheduling","tasks"],p=[{name:"tasks",type:"NiceGanttTask[]",required:!1,default:"[]",description:"Tasks (id, title, start, end, progress, color, parentId, dependencies)."},{name:"columns",type:"NiceGanttColumn[]",required:!1,description:"Left panel columns configuration."},{name:"scale",type:"'day' | 'week' | 'month'",required:!1,default:"'day'",description:"Time scale."},{name:"rowHeight",type:"number",required:!1,description:"Row height in px."},{name:"dayWidth",type:"number",required:!1,description:"Day column width in px."},{name:"showDependencies",type:"boolean",required:!1,default:"true",description:"Show dependency arrows."},{name:"dependencyStyle",type:"'square' | 'rounded'",required:!1,default:"'square'",description:"Dependency arrows with square or rounded corners."},{name:"draggable",type:"boolean",required:!1,description:"Enable drag to move/resize tasks."},{name:"zoomControls",type:"boolean",required:!1,description:"Show zoom controls."}],m=[{name:"onTaskClick",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called when task clicked."},{name:"onTaskUpdate",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called after task drag/resize."}],u=[],h=[{title:"Project Gantt",code:`<NiceGantt
2
2
  tasks={projectTasks}
3
3
  columns={[
4
4
  { field: 'title', header: 'Task', width: 200 },
@@ -8,4 +8,4 @@
8
8
  draggable
9
9
  showDependencies
10
10
  onTaskUpdate={handleTaskUpdate}
11
- />`,language:"tsx"}],g=[{name:"NiceScheduler",relationship:"calendar"},{name:"NiceTimeline",relationship:"simple"}],k={$schema:e,name:t,displayName:a,version:s,status:n,category:o,subcategory:i,package:"@nicetoDev/ui",description:r,since:c,platforms:d,keywords:l,props:p,events:m,cssVariables:u,examples:h,related:g};exports.$schema=e;exports.category=o;exports.cssVariables=u;exports.default=k;exports.description=r;exports.displayName=a;exports.events=m;exports.examples=h;exports.keywords=l;exports.name=t;exports.platforms=d;exports.props=p;exports.related=g;exports.since=c;exports.status=n;exports.subcategory=i;exports.version=s;
11
+ />`,language:"tsx"}],y=[{name:"NiceScheduler",relationship:"calendar"},{name:"NiceTimeline",relationship:"simple"}],g={$schema:e,name:t,displayName:a,version:s,status:n,category:o,subcategory:r,package:"@nicetoDev/ui",description:i,since:c,platforms:d,keywords:l,props:p,events:m,cssVariables:u,examples:h,related:y};exports.$schema=e;exports.category=o;exports.cssVariables=u;exports.default=g;exports.description=i;exports.displayName=a;exports.events=m;exports.examples=h;exports.keywords=l;exports.name=t;exports.platforms=d;exports.props=p;exports.related=y;exports.since=c;exports.status=n;exports.subcategory=r;exports.version=s;