@json-to-office/jto 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/client/assets/{HomePage-C3rGwXmP.js → HomePage-CcmtpSuV.js} +3 -3
- package/dist/client/assets/{HomePage-C3rGwXmP.js.map → HomePage-CcmtpSuV.js.map} +1 -1
- package/dist/client/assets/{JsonEditorPage-Bdilserz.js → JsonEditorPage-RDa8GWDd.js} +3 -3
- package/dist/client/assets/{JsonEditorPage-Bdilserz.js.map → JsonEditorPage-RDa8GWDd.js.map} +1 -1
- package/dist/client/assets/{MonacoPluginProvider-C-bX2Lh9.js → MonacoPluginProvider-DM63WAJx.js} +3 -3
- package/dist/client/assets/{MonacoPluginProvider-C-bX2Lh9.js.map → MonacoPluginProvider-DM63WAJx.js.map} +1 -1
- package/dist/client/assets/{button-CD_S_eWG.js → button-CyTe9rTl.js} +2 -2
- package/dist/client/assets/{button-CD_S_eWG.js.map → button-CyTe9rTl.js.map} +1 -1
- package/dist/client/assets/{editor-DjQ1HvFx.js → editor-DCtGYNz2.js} +2 -2
- package/dist/client/assets/{editor-DjQ1HvFx.js.map → editor-DCtGYNz2.js.map} +1 -1
- package/dist/client/assets/editor-monaco-json-CU9ciwPv.js +24 -0
- package/dist/client/assets/{editor-monaco-json-CKdq0BCO.js.map → editor-monaco-json-CU9ciwPv.js.map} +1 -1
- package/dist/client/assets/index-CHAIoQtG.js +5 -0
- package/dist/client/assets/index-CHAIoQtG.js.map +1 -0
- package/dist/client/assets/{preview-B9UKky-W.js → preview-oxnxMi4x.js} +2 -2
- package/dist/client/assets/{preview-B9UKky-W.js.map → preview-oxnxMi4x.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/templates/data-report-presentation.pptx.json +3160 -0
- package/dist/client/templates/management-plan.pptx.json +5923 -0
- package/dist/client/templates/media/management-plan/crop_s1.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s10.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s11.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s12.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s13.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s14.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s15.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s16.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s18a.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s18b.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s19.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s3.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s5.jpg +0 -0
- package/dist/client/templates/media/management-plan/crop_s9.jpg +0 -0
- package/dist/client/templates/media/management-plan/image2.jpg +0 -0
- package/dist/client/templates/media/minimalist-pitch-deck/image1.jpg +0 -0
- package/dist/client/templates/media/minimalist-pitch-deck/image3.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-1.86x2.03.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-1.88x2.13.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-2.19x2.61.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-2.22x2.88.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-2.57x2.91.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-2.78x3.03.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-3.53x4.22.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-3.8x5.41.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/hatch-4.46x6.42.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/image2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/image4.png +0 -0
- package/dist/client/templates/media/modern-annual-report-2/image6.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/image1.gif +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1308x1454-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1312x1574-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1618x1597-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1660x1818-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1817x2117-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1822x2099-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-1874x2077-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-2084x2506-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-2544x3221-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-2622x3017-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-7054x10363-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-7253x2778-v2.png +0 -0
- package/dist/client/templates/media/modern-annual-report-3/pct30-7256x6807-v2.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image1.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image10.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image11.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image12.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image13.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image14.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image15.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image16.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image17.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image18.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image19.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image2.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image20.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image21.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image22.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image23.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image24.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image25.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image3.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image4.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image5.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image6.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image7.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image8.png +0 -0
- package/dist/client/templates/media/standard-annual-report/image9.png +0 -0
- package/dist/client/templates/media/tech-report/fonts/DMSans-Bold.ttf +0 -0
- package/dist/client/templates/media/tech-report/fonts/DMSans-Light.ttf +0 -0
- package/dist/client/templates/media/tech-report/fonts/DMSans-Medium.ttf +0 -0
- package/dist/client/templates/media/tech-report/fonts/DMSans-Regular.ttf +0 -0
- package/dist/client/templates/minimalist-pitch-deck.pptx.json +3837 -0
- package/dist/client/templates/modern-annual-report-1.docx.json +10970 -0
- package/dist/client/templates/modern-annual-report-2.docx.json +15368 -0
- package/dist/client/templates/modern-annual-report-3.docx.json +13277 -0
- package/dist/client/templates/standard-annual-report.docx.json +7574 -0
- package/dist/client/templates/tech-report.docx.json +6503 -0
- package/package.json +7 -7
- package/dist/client/assets/editor-monaco-json-CKdq0BCO.js +0 -24
- package/dist/client/assets/index-DASNz01y.js +0 -5
- package/dist/client/assets/index-DASNz01y.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-to-office/jto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "JSON to Office CLI - Unified document and presentation generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"vite": "6.0.5",
|
|
86
86
|
"zod": "^4.0.0",
|
|
87
87
|
"zustand": "5.0.2",
|
|
88
|
-
"@json-to-office/core-docx": "^0.
|
|
89
|
-
"@json-to-office/core-pptx": "^0.
|
|
90
|
-
"@json-to-office/jto-cli": "^0.
|
|
91
|
-
"@json-to-office/shared": "^0.
|
|
92
|
-
"@json-to-office/shared-docx": "^0.
|
|
93
|
-
"@json-to-office/shared-pptx": "^0.
|
|
88
|
+
"@json-to-office/core-docx": "^0.25.0",
|
|
89
|
+
"@json-to-office/core-pptx": "^0.26.0",
|
|
90
|
+
"@json-to-office/jto-cli": "^0.26.0",
|
|
91
|
+
"@json-to-office/shared": "^0.25.0",
|
|
92
|
+
"@json-to-office/shared-docx": "^0.25.0",
|
|
93
|
+
"@json-to-office/shared-pptx": "^0.25.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/lodash.debounce": "4.0.9",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{d as q,g as de,j as u,r as C,c as fe}from"./react-vendor-CTFDOf2G.js";import{c as J,g as me,r as ge,o as te}from"./index-DASNz01y.js";import pe,{DiffEditor as he}from"./monaco-editor-BcgxPCqT.js";import{u as G,b as ne}from"./MonacoPluginProvider-C-bX2Lh9.js";import{B as se}from"./button-CD_S_eWG.js";import{c as be}from"./state-vendor-ByFYl9bq.js";import{V as X,C as xe,b as ve,X as ye,a as Ne,l as Ce,T as je}from"./ui-vendor-Nd4Lg2re.js";var Y,re;function Ee(){if(re)return Y;re=1;var e="Expected a function",t=NaN,n="[object Symbol]",s=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,d=/^0o[0-7]+$/i,b=parseInt,y=typeof q=="object"&&q&&q.Object===Object&&q,w=typeof self=="object"&&self&&self.Object===Object&&self,L=y||w||Function("return this")(),v=Object.prototype,k=v.toString,D=Math.max,$=Math.min,P=function(){return L.Date.now()};function f(l,x,N){var M,T,O,R,j,A,I=0,z=!1,_=!1,F=!0;if(typeof l!="function")throw new TypeError(e);x=p(x)||0,o(N)&&(z=!!N.leading,_="maxWait"in N,O=_?D(p(N.maxWait)||0,x):O,F="trailing"in N?!!N.trailing:F);function W(S){var K=M,B=T;return M=T=void 0,I=S,R=l.apply(B,K),R}function i(S){return I=S,j=setTimeout(m,x),z?W(S):R}function h(S){var K=S-A,B=S-I,ee=x-K;return _?$(ee,O-B):ee}function E(S){var K=S-A,B=S-I;return A===void 0||K>=x||K<0||_&&B>=O}function m(){var S=P();if(E(S))return V(S);j=setTimeout(m,h(S))}function V(S){return j=void 0,F&&M?W(S):(M=T=void 0,R)}function H(){j!==void 0&&clearTimeout(j),I=0,M=A=T=j=void 0}function U(){return j===void 0?R:V(P())}function Q(){var S=P(),K=E(S);if(M=arguments,T=this,A=S,K){if(j===void 0)return i(A);if(_)return j=setTimeout(m,x),W(A)}return j===void 0&&(j=setTimeout(m,x)),R}return Q.cancel=H,Q.flush=U,Q}function o(l){var x=typeof l;return!!l&&(x=="object"||x=="function")}function a(l){return!!l&&typeof l=="object"}function g(l){return typeof l=="symbol"||a(l)&&k.call(l)==n}function p(l){if(typeof l=="number")return l;if(g(l))return t;if(o(l)){var x=typeof l.valueOf=="function"?l.valueOf():l;l=o(x)?x+"":x}if(typeof l!="string")return l===0?l:+l;l=l.replace(s,"");var N=r.test(l);return N||d.test(l)?b(l.slice(2),N?2:8):c.test(l)?t:+l}return Y=f,Y}var Se=Ee();const oe=de(Se),we=be((e,t)=>({editors:new Map,activeEditorName:null,registerEditor:(n,s,c,r)=>{e(d=>{const b=new Map(d.editors);return b.set(n,{editor:s,monaco:c,documentName:n,toStorageValue:r??(y=>y)}),{editors:b}})},unregisterEditor:n=>{e(s=>{const c=new Map(s.editors);return c.delete(n),{editors:c,activeEditorName:s.activeEditorName===n?null:s.activeEditorName}})},setActiveEditor:n=>{e({activeEditorName:n})},getActiveEditor:()=>{const n=t();return n.activeEditorName&&n.editors.get(n.activeEditorName)||null},getEditor:n=>t().editors.get(n)||null}));function ie(e,t){if(!e||!t)return null;const n=e.getModel();if(!n)return null;const s=e.getSelection();if(!s)return null;const r=n.getValueInRange(s)||Me(e);if(!r)return null;const d=n.getValue();let b=null,y=!1;try{b=JSON.parse(d),y=!0}catch{}const w=y?Le(d,s.startLineNumber,s.startColumn):void 0,L=Re(d,s.startLineNumber,s.startColumn);return{selectedText:r,jsonPath:w,propertyKey:L,fullDocument:b,isValidJson:y,startLine:s.startLineNumber,endLine:s.endLineNumber}}function Me(e,t){const n=e.getModel(),s=e.getPosition();if(!n||!s)return"";const c=n.getWordAtPosition(s);return c?n.getValueInRange({startLineNumber:s.lineNumber,startColumn:c.startColumn,endLineNumber:s.lineNumber,endColumn:c.endColumn}):""}function Le(e,t,n){var s;try{const c=e.split(`
|
|
2
|
-
`),r=[];let d=0,b=!1,y=0;for(let w=0;w<Math.min(t,c.length);w++){const L=c[w];for(let k=0;k<L.length;k++){const D=L[k];if(w===t-1&&k>=n)break;D==="{"?d++:D==="}"?(d--,r.length>d&&r.pop()):D==="["?(b=!0,y=0):D==="]"?(b=!1,(s=r[r.length-1])!=null&&s.match(/\[\d+\]$/)&&r.pop()):D===","&&b&&y++}const v=L.match(/^\s*"([^"]+)"\s*:/);if(v){for(;r.length>=d;)r.pop();b?r.push(`${v[1]}[${y}]`):r.push(v[1])}}return r.length>0?r.join("."):void 0}catch{return}}function Re(e,t,n){try{const s=e.split(`
|
|
3
|
-
`);if(t>s.length)return;const r=s[t-1].match(/^\s*"([^"]+)"\s*:/);if(r)return r[1];for(let d=t-2;d>=0;d--){const b=s[d],y=b.match(/^\s*"([^"]+)"\s*:/);if(y)return y[1];if(b.includes("}"))break}return}catch{return}}function ke(e,t){if(!e||!t)return;const n=t.split(".");let s=e;for(const c of n){if(!s)return;const r=c.match(/^([^[]+)\[(\d+)\]$/);if(r){const[,d,b]=r;if(s=s[d],Array.isArray(s))s=s[parseInt(b,10)];else return}else s=s[c]}return s}function ae(e){const t=[];if(e.jsonPath&&t.push(`JSON Path: ${e.jsonPath}`),e.selectedText.length>500?t.push(`Selected Text (truncated): ${e.selectedText.substring(0,500)}...`):t.push(`Selected Text: ${e.selectedText}`),e.isValidJson&&e.fullDocument&&e.jsonPath){const n=ke(e.fullDocument,e.jsonPath);if(n!==void 0){const s=JSON.stringify(n,null,2);s.length>500?t.push(`Context Value (truncated): ${s.substring(0,500)}...`):t.push(`Context Value: ${s}`)}}return t.join(`
|
|
4
|
-
`)}const De=200,Pe=32,Te=12,Ae=40,Z="§jtoc:",Ie="§",le="jto-collapse-strings-styles";function Ve(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=`
|
|
5
|
-
.jto-collapsed-token { display: none !important; }
|
|
6
|
-
.jto-collapsed-chip, .jto-expand-collapse-chip {
|
|
7
|
-
color: #7c8595;
|
|
8
|
-
background: rgba(127,127,127,0.14);
|
|
9
|
-
border: 1px solid rgba(127,127,127,0.30);
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
padding: 0 6px;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
font-style: italic;
|
|
14
|
-
font-size: 0.85em;
|
|
15
|
-
}
|
|
16
|
-
.jto-collapsed-chip { margin: 0 2px; }
|
|
17
|
-
.jto-expand-collapse-chip { margin-right: 4px; }
|
|
18
|
-
.jto-collapsed-chip:hover, .jto-expand-collapse-chip:hover {
|
|
19
|
-
background: rgba(127,127,127,0.28);
|
|
20
|
-
color: #aab3c2;
|
|
21
|
-
}
|
|
22
|
-
`,document.head.appendChild(e)}function ue(e){const t=[],n=e.length;let s=0;for(;s<n;){if(e[s]!=='"'){s++;continue}const c=s+1;let r=c;for(;r<n;){const d=e[r];if(d==="\\"){r+=2;continue}if(d==='"')break;r++}if(r<n){const d=e.slice(c,r);d.length>De&&!d.includes(Z)&&t.push({innerStart:c,innerEnd:r,inner:d})}s=r+1}return t}function Oe(e){const t=e.length,n=new Set([0]);let s=0;for(;s<t;)e[s]==="\\"?s=Math.min(s+(e[s+1]==="u"?6:2),t):s+=1,n.add(s);let c=Math.min(Pe,t);for(;c>0&&!n.has(c);)c--;let r=Math.max(t-Te,c);for(;r<t&&!n.has(r);)r++;const d=e.slice(c,r);return d.length<Ae?null:{prefix:e.slice(0,c),middle:d,suffix:e.slice(r)}}function $e(e){return e<1024?`${e} chars`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ke(e,t){return!(e.lineNumber<t.startLineNumber||e.lineNumber>t.endLineNumber||e.lineNumber===t.startLineNumber&&e.column<t.startColumn-1||e.lineNumber===t.endLineNumber&&e.column>t.endColumn+1)}function ce(e,t){return!(e.endLineNumber<t.startLineNumber||t.endLineNumber<e.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn)}function _e(e,t){Ve();const n=new Map,s=[];let c=1,r=!1;const d=f=>`${Z}${f}${Ie}`;function b(f){if(n.size===0)return f;let o=f;for(const a of n.values())a.expanded||(o=o.split(d(a.id)).join(a.middle));return o}function y(f){return{inlineClassName:"jto-collapsed-token",after:{content:` … ⟨ ${$e(f)} ⟩ … `,inlineClassName:"jto-collapsed-chip"},stickiness:t.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,hoverMessage:{value:"Click to expand the collapsed value"}}}function w(){return{before:{content:" ⟨ collapse ⟩ ",inlineClassName:"jto-expand-collapse-chip"},stickiness:t.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,hoverMessage:{value:"Click to collapse this value again"}}}function L(f){const o=[];for(const a of n.values()){if(!a.expanded)continue;const g=f.getDecorationRange(a.decorationId);g&&o.push(g)}return o}function v(f){const o=e.getModel();if(!(!o||f.length===0)){r=!0;try{for(let a=f.length-1;a>=0;a--){const g=f[a],p=Oe(g.inner);if(!p)continue;const l=c++,x=d(l),N=o.getPositionAt(g.innerStart),M=o.getPositionAt(g.innerEnd),T=new t.Range(N.lineNumber,N.column,M.lineNumber,M.column);o.applyEdits([{range:T,text:p.prefix+x+p.suffix,forceMoveMarkers:!0}]);const O=g.innerStart+p.prefix.length,R=o.getPositionAt(O),j=o.getPositionAt(O+x.length),A=new t.Range(R.lineNumber,R.column,j.lineNumber,j.column),[I]=e.deltaDecorations([],[{range:A,options:y(p.middle.length)}]);n.set(l,{id:l,middle:p.middle,expanded:!1,decorationId:I})}}finally{r=!1}}}function k(f){const o=e.getModel(),a=n.get(f);if(!o||!a||a.expanded)return;const g=o.getDecorationRange(a.decorationId);if(g){r=!0;try{o.applyEdits([{range:g,text:a.middle,forceMoveMarkers:!0}]);const p=o.getOffsetAt({lineNumber:g.startLineNumber,column:g.startColumn}),l=o.getPositionAt(p+a.middle.length),x=new t.Range(g.startLineNumber,g.startColumn,l.lineNumber,l.column),[N]=e.deltaDecorations([a.decorationId],[{range:x,options:w()}]);a.decorationId=N,a.expanded=!0}finally{r=!1}}}function D(f){const o=e.getModel(),a=n.get(f);if(!o||!a||!a.expanded)return;const g=o.getDecorationRange(a.decorationId);if(!g)return;const p=o.getValueInRange(g);a.middle=p;const l=d(f);r=!0;try{o.applyEdits([{range:g,text:l,forceMoveMarkers:!0}]);const x=o.getOffsetAt({lineNumber:g.startLineNumber,column:g.startColumn}),N=o.getPositionAt(x+l.length),M=new t.Range(g.startLineNumber,g.startColumn,N.lineNumber,N.column),[T]=e.deltaDecorations([a.decorationId],[{range:M,options:y(p.length)}]);a.decorationId=T,a.expanded=!1}finally{r=!1}}s.push(e.onMouseDown(f=>{const o=f.target.position;if(!o)return;const a=e.getModel();if(a)for(const g of n.values()){const p=a.getDecorationRange(g.decorationId);if(p&&Ke(o,p)){g.expanded?D(g.id):k(g.id),f.event.preventDefault(),f.event.stopPropagation();return}}}));const $=f=>{var l;if(n.size===0)return;const o=e.getModel(),a=e.getSelection();if(!o||!a||a.isEmpty())return;const g=o.getValueInRange(a);if(!g.includes(Z))return;const p=b(g);p!==g&&((l=f.clipboardData)==null||l.setData("text/plain",p),f.preventDefault(),f.stopImmediatePropagation(),f.type==="cut"&&e.executeEdits("jto-collapse-cut",[{range:a,text:""}]))},P=e.getDomNode();return P&&(P.addEventListener("copy",$,!0),P.addEventListener("cut",$,!0),s.push({dispose(){P.removeEventListener("copy",$,!0),P.removeEventListener("cut",$,!0)}})),{recollapse(){const f=e.getModel();if(!f)return;r=!0;try{for(const a of n.values()){if(a.expanded)continue;const g=f.getDecorationRange(a.decorationId);g&&f.applyEdits([{range:g,text:a.middle,forceMoveMarkers:!0}])}}finally{r=!1}const o=[...n.values()].map(a=>a.decorationId);o.length&&e.deltaDecorations(o,[]),n.clear(),v(ue(f.getValue()))},collapseNew(f){const o=e.getModel();if(!o)return;const a=L(o),g=ue(o.getValue()).filter(p=>{if(f!==void 0&&f>=p.innerStart-1&&f<=p.innerEnd+1)return!1;const l=o.getPositionAt(p.innerStart),x=o.getPositionAt(p.innerEnd),N={startLineNumber:l.lineNumber,startColumn:l.column,endLineNumber:x.lineNumber,endColumn:x.column};return!a.some(M=>ce(M,N))});v(g)},toStorageValue(f){return b(f)},isApplyingEdits(){return r},isRangeCollapsed(f){const o=e.getModel();if(!o)return!1;for(const a of n.values()){if(a.expanded)continue;const g=o.getDecorationRange(a.decorationId);if(g&&ce(g,f))return!0}return!1},dispose(){for(const o of s)o.dispose();if(e.getModel()){const o=[...n.values()].map(a=>a.decorationId);o.length&&e.deltaDecorations(o,[])}n.clear()}}}function Fe({errors:e,onErrorClick:t,onClose:n,className:s,isMinimized:c=!1,onToggleMinimize:r}){const[d,b]=C.useState(!c);C.useEffect(()=>{b(!c)},[c]);const y=e.length>0,w=e.length;if(!y)return null;const L=()=>{b(!d),r==null||r()};return u.jsxs("div",{className:J("absolute bottom-0 left-0 right-0 z-50 bg-background border-t shadow-lg transition-all duration-200",d?"h-48":"h-10",s),children:[u.jsxs("div",{className:J("flex items-center justify-between px-3 py-2 cursor-pointer","bg-destructive/10 border-b border-destructive/20","hover:bg-destructive/15 transition-colors"),onClick:L,children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(X,{className:"w-4 h-4 text-destructive"}),u.jsxs("span",{className:"text-sm font-medium text-destructive",children:[w," Validation Error",w!==1?"s":""]})]}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(We,{errors:e}),u.jsx("button",{onClick:v=>{v.stopPropagation(),L()},className:"p-1 hover:bg-destructive/20 rounded-sm transition-colors","aria-label":d?"Minimize":"Expand",children:d?u.jsx(xe,{className:"w-4 h-4"}):u.jsx(ve,{className:"w-4 h-4"})}),n&&u.jsx("button",{onClick:v=>{v.stopPropagation(),n()},className:"p-1 hover:bg-destructive/20 rounded-sm transition-colors","aria-label":"Close validation panel",children:u.jsx(ye,{className:"w-4 h-4"})})]})]}),d&&u.jsx("div",{className:"overflow-y-auto h-[calc(100%-2.5rem)]",children:u.jsx("div",{className:"divide-y divide-border/50",children:e.map((v,k)=>u.jsx(Be,{error:v,onClick:()=>t==null?void 0:t(v)},`${v.path}-${k}`))})})]})}function We({errors:e}){const[t,n]=C.useState(!1),s=c=>{c.stopPropagation();const r=e.map(d=>`${d.startLineNumber&&d.startColumn?`Line ${d.startLineNumber}:${d.startColumn}`:"Unknown location"} — ${d.message}`).join(`
|
|
23
|
-
`);navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})};return u.jsx("button",{onClick:s,className:J("flex items-center gap-1 px-1.5 py-1 rounded-sm transition-all duration-200 cursor-pointer",t?"bg-success/10 text-success":"hover:bg-destructive/20"),"aria-label":"Copy all errors",children:t?u.jsxs(u.Fragment,{children:[u.jsx(Ne,{className:"w-3.5 h-3.5"}),u.jsx("span",{className:"text-xs font-medium",children:"Copied"})]}):u.jsx(Ce,{className:"w-4 h-4"})})}function Be({error:e,onClick:t}){const n=c=>{switch(c){case"error":return u.jsx(X,{className:"w-4 h-4 text-destructive flex-shrink-0"});case"warning":return u.jsx(je,{className:"w-4 h-4 text-warning flex-shrink-0"});default:return u.jsx(X,{className:"w-4 h-4 text-data-blue flex-shrink-0"})}},s=c=>c?c.replace(/^\//,"").replace(/\//g," → "):"Document root";return u.jsx("div",{className:J("px-3 py-2 hover:bg-muted/50 cursor-pointer transition-colors","group"),onClick:t,children:u.jsxs("div",{className:"flex items-start gap-2",children:[n(e.severity),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:e.startLineNumber&&e.startColumn?`Line ${e.startLineNumber}:${e.startColumn}`:"Unknown location"}),e.path&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:"•"}),u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:s(e.path)})]})]}),u.jsx("p",{className:"text-sm text-foreground",children:e.message}),e.code&&e.code!=="validation_error"&&u.jsxs("span",{className:"text-xs text-muted-foreground font-mono mt-1 inline-block",children:["Code: ",e.code]})]})]})})}function Je({errors:e,onClick:t,className:n}){return e.length!==0?u.jsxs("div",{className:J("flex items-center gap-2 px-2 py-1 text-xs cursor-pointer","bg-destructive/10 text-destructive hover:bg-destructive/15 transition-colors",n),onClick:t,children:[u.jsx(X,{className:"w-3 h-3"}),u.jsxs("span",{children:[e.length," error",e.length!==1?"s":""]})]}):null}function ze({name:e,defaultValue:t,value:n,saveDocumentDebounceWait:s}){console.debug(`Render EditorMonacoJson (name: ${e})`);const c=C.useRef(null),r=C.useRef(null),{resolvedTheme:d}=me(),b=G(i=>i.saveDocument),y=ne(i=>i.bumpEditSequence),w=ne(i=>i.setOutput),L=G(i=>i.closeDocument),v=G(i=>i.pendingDiffs[e]),k=G(i=>i.clearPendingDiff),[D,$]=C.useState([]),[P,f]=C.useState(!0),[o,a]=C.useState(!1),g=C.useRef([]),p=C.useRef(null),l=C.useRef(null),[x,N]=C.useState(n??t),{registerEditor:M,unregisterEditor:T,setActiveEditor:O}=we(),R=C.useRef(oe(b,s)),j=C.useRef(oe(()=>{const i=c.current,h=p.current;if(!i||!h)return;const E=i.getPosition(),m=i.getModel(),V=E&&m?m.getOffsetAt(E):void 0;h.collapseNew(V)},600)),A=C.useCallback(i=>{ge(i),console.debug("Setting up Monaco for JSON editor")},[]),I=C.useCallback(i=>p.current?p.current.toStorageValue(i):i,[]);function z(i,h){console.debug(`EditorDidMount: (name: ${e})`),c.current=i,r.current=h,M(e,i,h,I),O(e);const E=i.getModel();E&&(h.editor.setModelLanguage(E,"json"),console.debug("Model language set to JSON for:",E.uri.toString())),p.current=_e(i,h),p.current.recollapse(),i.addAction({id:"send-to-ai-assistant",label:"Send to AI Assistant (⌘K)",contextMenuGroupId:"navigation",contextMenuOrder:1.5,keybindings:[h.KeyMod.CtrlCmd|h.KeyCode.KeyK],run:function(){const m=ie(i,h);if(m){const V=ae(m);window.dispatchEvent(new CustomEvent("monaco-selection-to-ai",{detail:{documentName:e,selection:m,snippet:V}}))}}}),i.addCommand(h.KeyMod.CtrlCmd|h.KeyCode.KeyK,()=>{const m=ie(i,h);if(m){const V=ae(m);window.dispatchEvent(new CustomEvent("monaco-selection-to-ai",{detail:{documentName:e,selection:m,snippet:V}}))}}),i.addCommand(h.KeyMod.CtrlCmd|h.KeyCode.KeyS,()=>{const m=I(i.getValue());m&&(l.current=m,b(e,m))}),i.addCommand(h.KeyMod.CtrlCmd|h.KeyCode.KeyW,()=>{const m=I(i.getValue());m&&(l.current=m,b(e,m)),L(e)}),i.addCommand(h.KeyMod.Shift|h.KeyMod.Alt|h.KeyCode.KeyF,()=>{var m;(m=i.getAction("editor.action.formatDocument"))==null||m.run()})}function _(i){console.debug("Monaco validation markers:",i);const E=(p.current?i.filter(m=>!p.current.isRangeCollapsed({startLineNumber:m.startLineNumber,startColumn:m.startColumn,endLineNumber:m.endLineNumber,endColumn:m.endColumn})):i).map(m=>{var V,H,U;return{path:"",message:m.message,code:typeof m.code=="string"?m.code:((V=m.code)==null?void 0:V.value)||"validation_error",startLineNumber:m.startLineNumber,startColumn:m.startColumn,endLineNumber:m.endLineNumber,endColumn:m.endColumn,severity:m.severity===((H=r.current)==null?void 0:H.MarkerSeverity.Error)?"error":m.severity===((U=r.current)==null?void 0:U.MarkerSeverity.Warning)?"warning":"info"}});$(E),w({hasValidationErrors:E.some(m=>m.severity==="error")}),g.current=[],E.length>0&&!P&&(f(!0),a(!1))}C.useEffect(()=>{const i=R==null?void 0:R.current,h=j==null?void 0:j.current;return()=>{var E;i==null||i.flush(),h==null||h.cancel(),(E=p.current)==null||E.dispose(),p.current=null,T(e),console.debug(`EditorWillUnMount: (name: ${e})`)}},[e,T]),C.useEffect(()=>{n!==void 0&&n!==l.current&&N(n)},[n]);const F=C.useRef(!1);C.useEffect(()=>{if(!F.current){F.current=!0;return}if(!p.current)return;const i=setTimeout(()=>{var h;return(h=p.current)==null?void 0:h.recollapse()},0);return()=>clearTimeout(i)},[x]);const W=C.useCallback(i=>{c.current&&i.startLineNumber&&i.startColumn&&(c.current.setPosition({lineNumber:i.startLineNumber,column:i.startColumn}),c.current.revealLineInCenter(i.startLineNumber),c.current.focus())},[]);return u.jsxs("div",{className:"relative h-full",children:[v?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b bg-muted/40 text-xs",children:[u.jsxs("div",{children:["Review changes for ",u.jsx("span",{className:"font-medium",children:e})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(se,{variant:"secondary",size:"sm",onClick:()=>k(e),children:"Discard"}),u.jsx(se,{size:"sm",onClick:()=>{b(e,v.modified),k(e,!0)},children:"Apply Changes"})]})]}),u.jsx(he,{height:"calc(100% - 32px)",original:v.original,modified:v.modified,language:"json",theme:te(d),options:{readOnly:!0,renderSideBySide:!0,originalEditable:!1,automaticLayout:!0,minimap:{enabled:!1}},beforeMount:A})]}):u.jsx(pe,{height:"100%",defaultLanguage:"json",theme:te(d),defaultPath:e.endsWith(".json")?e:`${e}.json`,value:x,beforeMount:A,onMount:z,onValidate:_,onChange:i=>{var h;if(!((h=p.current)!=null&&h.isApplyingEdits())&&i){y();const E=I(i);l.current=E,R.current(e,E),j.current()}},options:{minimap:{enabled:!0},scrollBeyondLastLine:!0,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,tabSize:2,insertSpaces:!0,detectIndentation:!1,folding:!0,foldingStrategy:"indentation",showFoldingControls:"always",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},suggest:{showProperties:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showTypeParameters:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!1,showColors:!0,showFiles:!1,showReferences:!0,showFolders:!1,showOperators:!0,showUnits:!0,showSnippets:!0,snippetsPreventQuickSuggestions:!1,insertMode:"insert",filterGraceful:!0,localityBonus:!0,shareSuggestSelections:!0,showIcons:!0},quickSuggestions:{strings:!0,comments:!1,other:!0},quickSuggestionsDelay:10,suggestSelection:"first",suggestOnTriggerCharacters:!0,acceptSuggestionOnEnter:"on",acceptSuggestionOnCommitCharacter:!0,wordBasedSuggestions:"off",parameterHints:{enabled:!0,cycle:!0},hover:{enabled:!0,delay:300,sticky:!0},tabCompletion:"on",snippetSuggestions:"inline",inlineSuggest:{enabled:!0}}}),u.jsx("div",{className:"absolute top-0 right-0",children:u.jsx(Je,{errors:D,onClick:()=>{f(!0),a(!1)}})}),P&&D.length>0&&u.jsx(Fe,{errors:D,isMinimized:o,onToggleMinimize:()=>a(!o),onErrorClick:W,onClose:()=>f(!1),className:"z-40"})]})}const He=fe.memo(ze,(e,t)=>e.name===t.name&&e.value===t.value&&e.saveDocumentDebounceWait===t.saveDocumentDebounceWait),et=Object.freeze(Object.defineProperty({__proto__:null,EditorMonacoJsonMemoized:He},Symbol.toStringTag,{value:"Module"}));export{He as E,Je as V,Fe as a,ae as c,oe as d,et as e,ie as g,we as u};
|
|
24
|
-
//# sourceMappingURL=editor-monaco-json-CKdq0BCO.js.map
|