@aglyn/shared-ui-json-editor 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +48 -0
- package/src/index.d.ts +17 -0
- package/src/index.js +18 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/code-mirror-editor.d.ts +21 -0
- package/src/lib/components/code-mirror-editor.js +40 -0
- package/src/lib/components/code-mirror-editor.js.map +1 -0
- package/src/lib/components/monaco-editor.d.ts +32 -0
- package/src/lib/components/monaco-editor.js +75 -0
- package/src/lib/components/monaco-editor.js.map +1 -0
- package/src/lib/json-editor.d.ts +41 -0
- package/src/lib/json-editor.js +304 -0
- package/src/lib/json-editor.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aglyn/shared-ui-json-editor",
|
|
3
|
+
"version": "1.0.0-beta.143",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"homepage": "https://aglyn.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/aglyn/aglyn.git",
|
|
9
|
+
"directory": "libs/shared/ui/json-editor"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"provenance": true
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./src/index.d.ts",
|
|
18
|
+
"default": "./src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./*": {
|
|
21
|
+
"types": "./src/lib/*.d.ts",
|
|
22
|
+
"default": "./src/lib/*.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.143",
|
|
28
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.143",
|
|
29
|
+
"@codemirror/lang-json": "^6.0.1",
|
|
30
|
+
"@monaco-editor/react": "^4.7.0",
|
|
31
|
+
"@uiw/codemirror-theme-github": "^4.25.11",
|
|
32
|
+
"@uiw/react-codemirror": "^4.25.11",
|
|
33
|
+
"mobx-react-lite": "^4.1.1",
|
|
34
|
+
"react-if": "^4.1.6"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@mui/material": "^9.3.1",
|
|
38
|
+
"next": "16.3.3",
|
|
39
|
+
"react": "^19.2.8"
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": [
|
|
42
|
+
"./src/lib/components/monaco-editor.*"
|
|
43
|
+
],
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"module": "./src/index.js",
|
|
46
|
+
"type": "module",
|
|
47
|
+
"main": "./src/index.js"
|
|
48
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from './lib/json-editor';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ export * from "./lib/json-editor.js";
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/shared/ui/json-editor/src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './lib/json-editor'\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,uBAAmB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { type ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
18
|
+
export interface CodeMirrorProps extends ReactCodeMirrorProps {
|
|
19
|
+
}
|
|
20
|
+
export declare const CodeMirrorEditor: import("react").ForwardRefExoticComponent<CodeMirrorProps & import("react").RefAttributes<any>>;
|
|
21
|
+
export default CodeMirrorEditor;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2022 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import { json } from "@codemirror/lang-json";
|
|
19
|
+
import { githubDark } from "@uiw/codemirror-theme-github";
|
|
20
|
+
import ReactCodeMirror from "@uiw/react-codemirror";
|
|
21
|
+
import { forwardRef } from "react";
|
|
22
|
+
export const CodeMirrorEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
23
|
+
const {} = props, rest = _extends({}, props);
|
|
24
|
+
return /*#__PURE__*/ _jsx(ReactCodeMirror, _extends({
|
|
25
|
+
ref: ref,
|
|
26
|
+
// initialState={{ json: JSON.stringify(data, null, 2) }}
|
|
27
|
+
theme: githubDark,
|
|
28
|
+
extensions: [
|
|
29
|
+
json()
|
|
30
|
+
],
|
|
31
|
+
basicSetup: {
|
|
32
|
+
lintKeymap: true
|
|
33
|
+
},
|
|
34
|
+
autoFocus: true
|
|
35
|
+
}, rest));
|
|
36
|
+
});
|
|
37
|
+
CodeMirrorEditor.displayName = 'CodeMirrorEditor';
|
|
38
|
+
export default CodeMirrorEditor;
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=code-mirror-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/json-editor/src/lib/components/code-mirror-editor.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { json } from '@codemirror/lang-json'\nimport { githubDark } from '@uiw/codemirror-theme-github'\nimport ReactCodeMirror, {\n type ReactCodeMirrorProps,\n} from '@uiw/react-codemirror'\nimport { forwardRef } from 'react'\n\nexport interface CodeMirrorProps extends ReactCodeMirrorProps {}\n\nexport const CodeMirrorEditor = forwardRef<any, CodeMirrorProps>(\n (props, ref) => {\n const { ...rest } = props\n return (\n <ReactCodeMirror\n ref={ref}\n // initialState={{ json: JSON.stringify(data, null, 2) }}\n theme={githubDark}\n extensions={[json() /*linter,*/ /*lintGutter()*/]}\n basicSetup={{ lintKeymap: true }}\n autoFocus\n {...rest}\n />\n )\n },\n)\nCodeMirrorEditor.displayName = 'CodeMirrorEditor'\n\nexport default CodeMirrorEditor\n"],"names":["json","githubDark","ReactCodeMirror","forwardRef","CodeMirrorEditor","props","ref","rest","theme","extensions","basicSetup","lintKeymap","autoFocus","displayName"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,IAAI,QAAQ,wBAAuB;AAC5C,SAASC,UAAU,QAAQ,+BAA8B;AACzD,OAAOC,qBAEA,wBAAuB;AAC9B,SAASC,UAAU,QAAQ,QAAO;AAIlC,OAAO,MAAMC,iCAAmBD,WAC9B,CAACE,OAAOC;IACN,MAAM,EAAW,GAAGD,OAATE,oBAASF;IACpB,qBACE,KAACH;QACCI,KAAKA;QACL,yDAAyD;QACzDE,OAAOP;QACPQ,YAAY;YAACT;SAAoC;QACjDU,YAAY;YAAEC,YAAY;QAAK;QAC/BC,SAAS;OACLL;AAGV,GACD;AACDH,iBAAiBS,WAAW,GAAG;AAE/B,eAAeT,iBAAgB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { EditorProps } from '@monaco-editor/react';
|
|
18
|
+
/**
|
|
19
|
+
* Where Monaco's AMD bundle is served from — our origin, never a CDN.
|
|
20
|
+
*
|
|
21
|
+
* `apps/console/next.config.js` copies `monaco-editor/min/vs` into
|
|
22
|
+
* `apps/console/public/monaco/vs` at build time and FAILS THE BUILD if it
|
|
23
|
+
* cannot, so this path is either correct or the build never shipped.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MONACO_VS_PATH = "/monaco/vs";
|
|
26
|
+
export interface MonacoEditorProps extends EditorProps {
|
|
27
|
+
}
|
|
28
|
+
export declare const MonacoEditor: {
|
|
29
|
+
(props: MonacoEditorProps): import("react").JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
export default MonacoEditor;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2023 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import ReactMonacoEditor, { loader } from "@monaco-editor/react";
|
|
19
|
+
import { useColorScheme, useTheme } from "@mui/material/styles";
|
|
20
|
+
/**
|
|
21
|
+
* Where Monaco's AMD bundle is served from — our origin, never a CDN.
|
|
22
|
+
*
|
|
23
|
+
* `apps/console/next.config.js` copies `monaco-editor/min/vs` into
|
|
24
|
+
* `apps/console/public/monaco/vs` at build time and FAILS THE BUILD if it
|
|
25
|
+
* cannot, so this path is either correct or the build never shipped.
|
|
26
|
+
*/ export const MONACO_VS_PATH = '/monaco/vs';
|
|
27
|
+
/**
|
|
28
|
+
* Point the loader at our own copy before anything can mount (AGL-1779).
|
|
29
|
+
*
|
|
30
|
+
* `@monaco-editor/loader` defaults to
|
|
31
|
+
* `https://cdn.jsdelivr.net/npm/monaco-editor@<version>/min/vs` and `init()`
|
|
32
|
+
* injects `<script src="${paths.vs}/loader.js">` into `document.body` with no
|
|
33
|
+
* `integrity` and no `crossOrigin` — SRI is not reachable through that path at
|
|
34
|
+
* all. That put an unpinned third-party script inside the `app.aglyn.com`
|
|
35
|
+
* origin, with the session cookie, the DOM and every live Firestore listener
|
|
36
|
+
* in scope, for anyone who could open Edit -> Raw JSON: any org member with
|
|
37
|
+
* edit rights, site collaborators included. The console CSP allowed it — the
|
|
38
|
+
* `script-src` carries a bare `https:` on purpose (`strict-dynamic` took
|
|
39
|
+
* violations from 1 to 70), so a jsDelivr compromise was a console-origin XSS.
|
|
40
|
+
*
|
|
41
|
+
* Deliberately NOT wrapped in a try/catch and deliberately without a CDN
|
|
42
|
+
* fallback: falling back would restore exactly the exposure this closes, and
|
|
43
|
+
* would be invisible in every normal run because the local path wins.
|
|
44
|
+
*
|
|
45
|
+
* Module scope, not an effect: this module is `next/dynamic`-imported by
|
|
46
|
+
* `json-editor.tsx`, so it is evaluated before the first `<ReactMonacoEditor>`
|
|
47
|
+
* renders and therefore before `loader.init()` reads `state.config`.
|
|
48
|
+
*/ loader.config({
|
|
49
|
+
paths: {
|
|
50
|
+
vs: MONACO_VS_PATH
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export const MonacoEditor = (props)=>{
|
|
54
|
+
var _ref;
|
|
55
|
+
// Monaco defaults to its light theme regardless of the app's, so the raw
|
|
56
|
+
// JSON editor rendered a white page inside a dark dialog.
|
|
57
|
+
//
|
|
58
|
+
// `palette.mode` is NOT the answer on its own: the console runs a CSS-vars
|
|
59
|
+
// theme whose scheme is driven by a class on <html>, so `palette.mode`
|
|
60
|
+
// stays 'light' whatever the user picked. `useColorScheme` is the live
|
|
61
|
+
// one — `systemMode` when following the OS, else the explicit `mode` —
|
|
62
|
+
// with `palette.mode` kept as the fallback for the non-CSS-vars trees.
|
|
63
|
+
// `props` spreads last, so a caller can still pin a Monaco theme.
|
|
64
|
+
const { palette } = useTheme();
|
|
65
|
+
const { mode, systemMode } = useColorScheme();
|
|
66
|
+
const resolved = (_ref = systemMode != null ? systemMode : mode) != null ? _ref : palette.mode;
|
|
67
|
+
return /*#__PURE__*/ _jsx(ReactMonacoEditor, _extends({
|
|
68
|
+
defaultLanguage: "json",
|
|
69
|
+
theme: resolved === 'dark' ? 'vs-dark' : 'light'
|
|
70
|
+
}, props));
|
|
71
|
+
};
|
|
72
|
+
MonacoEditor.displayName = 'MonacoEditor';
|
|
73
|
+
export default MonacoEditor;
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=monaco-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/json-editor/src/lib/components/monaco-editor.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ReactMonacoEditor, { EditorProps, loader } from '@monaco-editor/react'\nimport { useColorScheme, useTheme } from '@mui/material/styles'\n\n/**\n * Where Monaco's AMD bundle is served from — our origin, never a CDN.\n *\n * `apps/console/next.config.js` copies `monaco-editor/min/vs` into\n * `apps/console/public/monaco/vs` at build time and FAILS THE BUILD if it\n * cannot, so this path is either correct or the build never shipped.\n */\nexport const MONACO_VS_PATH = '/monaco/vs'\n\n/**\n * Point the loader at our own copy before anything can mount (AGL-1779).\n *\n * `@monaco-editor/loader` defaults to\n * `https://cdn.jsdelivr.net/npm/monaco-editor@<version>/min/vs` and `init()`\n * injects `<script src=\"${paths.vs}/loader.js\">` into `document.body` with no\n * `integrity` and no `crossOrigin` — SRI is not reachable through that path at\n * all. That put an unpinned third-party script inside the `app.aglyn.com`\n * origin, with the session cookie, the DOM and every live Firestore listener\n * in scope, for anyone who could open Edit -> Raw JSON: any org member with\n * edit rights, site collaborators included. The console CSP allowed it — the\n * `script-src` carries a bare `https:` on purpose (`strict-dynamic` took\n * violations from 1 to 70), so a jsDelivr compromise was a console-origin XSS.\n *\n * Deliberately NOT wrapped in a try/catch and deliberately without a CDN\n * fallback: falling back would restore exactly the exposure this closes, and\n * would be invisible in every normal run because the local path wins.\n *\n * Module scope, not an effect: this module is `next/dynamic`-imported by\n * `json-editor.tsx`, so it is evaluated before the first `<ReactMonacoEditor>`\n * renders and therefore before `loader.init()` reads `state.config`.\n */\nloader.config({ paths: { vs: MONACO_VS_PATH } })\n\nexport interface MonacoEditorProps extends EditorProps {}\n\nexport const MonacoEditor = (props: MonacoEditorProps) => {\n // Monaco defaults to its light theme regardless of the app's, so the raw\n // JSON editor rendered a white page inside a dark dialog.\n //\n // `palette.mode` is NOT the answer on its own: the console runs a CSS-vars\n // theme whose scheme is driven by a class on <html>, so `palette.mode`\n // stays 'light' whatever the user picked. `useColorScheme` is the live\n // one — `systemMode` when following the OS, else the explicit `mode` —\n // with `palette.mode` kept as the fallback for the non-CSS-vars trees.\n // `props` spreads last, so a caller can still pin a Monaco theme.\n const { palette } = useTheme()\n const { mode, systemMode } = useColorScheme()\n const resolved = systemMode ?? mode ?? palette.mode\n return (\n <ReactMonacoEditor\n defaultLanguage=\"json\"\n theme={resolved === 'dark' ? 'vs-dark' : 'light'}\n {...props}\n />\n )\n}\nMonacoEditor.displayName = 'MonacoEditor'\n\nexport default MonacoEditor\n"],"names":["ReactMonacoEditor","loader","useColorScheme","useTheme","MONACO_VS_PATH","config","paths","vs","MonacoEditor","props","systemMode","palette","mode","resolved","defaultLanguage","theme","displayName"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,qBAAkCC,MAAM,QAAQ,uBAAsB;AAC7E,SAASC,cAAc,EAAEC,QAAQ,QAAQ,uBAAsB;AAE/D;;;;;;CAMC,GACD,OAAO,MAAMC,iBAAiB,aAAY;AAE1C;;;;;;;;;;;;;;;;;;;;;CAqBC,GACDH,OAAOI,MAAM,CAAC;IAAEC,OAAO;QAAEC,IAAIH;IAAe;AAAE;AAI9C,OAAO,MAAMI,eAAe,CAACC;QAYVC;IAXjB,yEAAyE;IACzE,0DAA0D;IAC1D,EAAE;IACF,2EAA2E;IAC3E,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IACvE,kEAAkE;IAClE,MAAM,EAAEC,OAAO,EAAE,GAAGR;IACpB,MAAM,EAAES,IAAI,EAAEF,UAAU,EAAE,GAAGR;IAC7B,MAAMW,YAAWH,OAAAA,qBAAAA,aAAcE,gBAAdF,OAAsBC,QAAQC,IAAI;IACnD,qBACE,KAACZ;QACCc,iBAAgB;QAChBC,OAAOF,aAAa,SAAS,YAAY;OACrCJ;AAGV,EAAC;AACDD,aAAaQ,WAAW,GAAG;AAE3B,eAAeR,aAAY"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { type DialogProps } from '@mui/material';
|
|
18
|
+
import { SyntheticEvent } from 'react';
|
|
19
|
+
import type { CodeMirrorProps } from './components/code-mirror-editor';
|
|
20
|
+
type OnClose = {
|
|
21
|
+
bivarianceHack(event: any, reason: 'backdropClick' | 'escapeKeyDown' | 'saveClick' | 'cancelClick'): void;
|
|
22
|
+
}['bivarianceHack'];
|
|
23
|
+
type OnSave = {
|
|
24
|
+
bivarianceHack(event: SyntheticEvent<any, any>, value: iJSON): void;
|
|
25
|
+
}['bivarianceHack'];
|
|
26
|
+
export interface JsonEditorProps extends Omit<DialogProps, 'defaultValue' | 'title'> {
|
|
27
|
+
defaultValue?: CodeMirrorProps['defaultValue'];
|
|
28
|
+
onSave?: OnSave;
|
|
29
|
+
onClose?: OnClose;
|
|
30
|
+
/** Dialog title; defaults to the classic "Raw JSON". */
|
|
31
|
+
title?: React.ReactNode;
|
|
32
|
+
/** Optional hint rendered under the title (e.g. subtree scope note). */
|
|
33
|
+
description?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Pre-save check (AGL-457): return an error message to keep the dialog
|
|
36
|
+
* open and surface it instead of saving.
|
|
37
|
+
*/
|
|
38
|
+
validate?: (value: iJSON) => string | null | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const JsonEditor: import("react").FunctionComponent<Omit<JsonEditorProps, "ref"> & import("react").RefAttributes<any>>;
|
|
41
|
+
export default JsonEditor;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import { ICON_VARIANT_CLOSE } from "@aglyn/shared-data-enums";
|
|
20
|
+
import { MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { Alert, AlertTitle, Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton } from "@mui/material";
|
|
22
|
+
import { observer } from "mobx-react-lite";
|
|
23
|
+
import dynamic from "next/dynamic";
|
|
24
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
25
|
+
import { When } from "react-if";
|
|
26
|
+
const Editor = dynamic(()=>import("./components/monaco-editor.js"), {
|
|
27
|
+
ssr: false,
|
|
28
|
+
/*
|
|
29
|
+
A dynamic import with no `loading` renders `null` (AGL-2541).
|
|
30
|
+
|
|
31
|
+
That is indistinguishable from an editor that will never arrive: the
|
|
32
|
+
same empty box while the chunk is in flight, and the same empty box
|
|
33
|
+
forever if it fails. The report this fixes was exactly that — Raw JSON
|
|
34
|
+
opens on a blank pane with no console error — leaving nothing on screen
|
|
35
|
+
to say whether to wait, reload, or give up.
|
|
36
|
+
*/ loading: ()=>/*#__PURE__*/ _jsx(Box, {
|
|
37
|
+
sx: {
|
|
38
|
+
flex: 1,
|
|
39
|
+
minHeight: 0,
|
|
40
|
+
display: 'grid',
|
|
41
|
+
placeItems: 'center',
|
|
42
|
+
color: 'text.secondary'
|
|
43
|
+
},
|
|
44
|
+
children: 'Loading the editor…'
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
const JsonEditorRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
48
|
+
const { onClose, onSave, defaultValue, open, title = 'Raw JSON', description, validate } = props, rest = _object_without_properties_loose(props, [
|
|
49
|
+
"onClose",
|
|
50
|
+
"onSave",
|
|
51
|
+
"defaultValue",
|
|
52
|
+
"open",
|
|
53
|
+
"title",
|
|
54
|
+
"description",
|
|
55
|
+
"validate"
|
|
56
|
+
]);
|
|
57
|
+
/** The stored document, as the text a buffer is seeded from. */ const documentText = useMemo(()=>JSON.stringify(defaultValue || {}, null, 2), [
|
|
58
|
+
defaultValue
|
|
59
|
+
]);
|
|
60
|
+
const [data, setData] = useState(documentText);
|
|
61
|
+
const [warnOpen, setWarnOpen] = useState(true);
|
|
62
|
+
const [saveError, setSaveError] = useState(null);
|
|
63
|
+
const closeWarn = useCallback(()=>setWarnOpen(false), []);
|
|
64
|
+
/**
|
|
65
|
+
* The document text this buffer was seeded from, or `null` while closed.
|
|
66
|
+
*
|
|
67
|
+
* `data !== seededFrom.current` is therefore "the author has typed
|
|
68
|
+
* something that is not yet saved", which is the one question both the
|
|
69
|
+
* re-seed below and the backdrop guard need answered.
|
|
70
|
+
*/ const seededFrom = useRef(null);
|
|
71
|
+
/**
|
|
72
|
+
* Seed the buffer, and NEVER re-seed one that has been typed into
|
|
73
|
+
* (AGL-2486 item 17).
|
|
74
|
+
*
|
|
75
|
+
* `defaultValue` is `Aglyn.canvas.nestedNodes` at every call site — a
|
|
76
|
+
* freshly built object, from a MobX store this dialog re-renders with.
|
|
77
|
+
* The previous version compared the incoming document against the BUFFER
|
|
78
|
+
* and re-seeded whenever they differed, which is true by definition the
|
|
79
|
+
* moment the author types: any canvas change, autosave or co-edit echo
|
|
80
|
+
* then replaced their work in progress with the stored document.
|
|
81
|
+
*
|
|
82
|
+
* Re-seeding a PRISTINE buffer is still right — nothing is lost, and the
|
|
83
|
+
* dialog should not show a document the canvas has moved past.
|
|
84
|
+
*/ useEffect(()=>{
|
|
85
|
+
if (!open) {
|
|
86
|
+
// A closed dialog holds nothing: the next open seeds from whatever
|
|
87
|
+
// the document says then, rather than from a buffer walked away from.
|
|
88
|
+
seededFrom.current = null;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
setData((prev)=>{
|
|
92
|
+
if (seededFrom.current !== null && prev !== seededFrom.current) {
|
|
93
|
+
return prev;
|
|
94
|
+
}
|
|
95
|
+
seededFrom.current = documentText;
|
|
96
|
+
return documentText;
|
|
97
|
+
});
|
|
98
|
+
}, [
|
|
99
|
+
documentText,
|
|
100
|
+
open
|
|
101
|
+
]);
|
|
102
|
+
/**
|
|
103
|
+
* Why the buffer does not parse, or `null` when it does.
|
|
104
|
+
*
|
|
105
|
+
* Surfaced as a live, NON-destructive notice: a half-written document is
|
|
106
|
+
* allowed to be invalid, so the only thing to do about it is say so.
|
|
107
|
+
*/ const parseError = useMemo(()=>{
|
|
108
|
+
if (!open) return null;
|
|
109
|
+
try {
|
|
110
|
+
JSON.parse(data);
|
|
111
|
+
return null;
|
|
112
|
+
} catch (e) {
|
|
113
|
+
var _ref;
|
|
114
|
+
return (_ref = e == null ? void 0 : e.message) != null ? _ref : 'Invalid JSON';
|
|
115
|
+
}
|
|
116
|
+
}, [
|
|
117
|
+
data,
|
|
118
|
+
open
|
|
119
|
+
]);
|
|
120
|
+
const handleChange = useCallback((value)=>{
|
|
121
|
+
setData(value);
|
|
122
|
+
setSaveError(null);
|
|
123
|
+
}, []);
|
|
124
|
+
const handleClose = useCallback((event, reason)=>{
|
|
125
|
+
// A stray click outside a 95vw dialog must not destroy an unsaved
|
|
126
|
+
// buffer. Cancel and Escape are deliberate acts and still close.
|
|
127
|
+
if (reason === 'backdropClick' && data !== seededFrom.current) return;
|
|
128
|
+
setSaveError(null);
|
|
129
|
+
onClose && onClose(event, reason);
|
|
130
|
+
}, [
|
|
131
|
+
onClose,
|
|
132
|
+
data
|
|
133
|
+
]);
|
|
134
|
+
const handleSave = useCallback((event)=>{
|
|
135
|
+
// Parse the raw text directly so malformed JSON blocks the save
|
|
136
|
+
// with an error instead of silently saving `{}` (AGL-457).
|
|
137
|
+
let value;
|
|
138
|
+
try {
|
|
139
|
+
value = JSON.parse(data);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
var _ref;
|
|
142
|
+
setSaveError((_ref = error == null ? void 0 : error.message) != null ? _ref : 'Invalid JSON');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const problem = validate == null ? void 0 : validate(value);
|
|
146
|
+
if (problem) {
|
|
147
|
+
setSaveError(problem);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
onSave && onSave(event, value);
|
|
151
|
+
handleClose(event, 'saveClick');
|
|
152
|
+
}, [
|
|
153
|
+
onSave,
|
|
154
|
+
handleClose,
|
|
155
|
+
data,
|
|
156
|
+
validate
|
|
157
|
+
]);
|
|
158
|
+
return /*#__PURE__*/ _jsxs(Dialog, _extends({
|
|
159
|
+
ref: ref,
|
|
160
|
+
open: open,
|
|
161
|
+
// A raw-JSON editor is unusable in a small box — component
|
|
162
|
+
// overrides run to hundreds of lines. Fill most of the viewport in
|
|
163
|
+
// BOTH axes; `rest` spreads after, so a caller can still override.
|
|
164
|
+
maxWidth: false,
|
|
165
|
+
fullWidth: true,
|
|
166
|
+
slotProps: {
|
|
167
|
+
paper: {
|
|
168
|
+
sx: {
|
|
169
|
+
width: '95vw',
|
|
170
|
+
maxWidth: 'none',
|
|
171
|
+
height: '92vh',
|
|
172
|
+
maxHeight: 'none'
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
onClose: handleClose
|
|
177
|
+
}, rest, {
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ _jsx(DialogTitle, {
|
|
180
|
+
children: title
|
|
181
|
+
}),
|
|
182
|
+
/*#__PURE__*/ _jsxs(DialogContent, {
|
|
183
|
+
sx: {
|
|
184
|
+
position: 'relative',
|
|
185
|
+
p: 0,
|
|
186
|
+
display: 'flex',
|
|
187
|
+
flexDirection: 'column',
|
|
188
|
+
minHeight: 0
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
description ? /*#__PURE__*/ _jsx(Box, {
|
|
192
|
+
sx: {
|
|
193
|
+
px: 3,
|
|
194
|
+
pb: 1,
|
|
195
|
+
color: 'text.secondary'
|
|
196
|
+
},
|
|
197
|
+
children: description
|
|
198
|
+
}) : null,
|
|
199
|
+
saveError ? /*#__PURE__*/ _jsx(Alert, {
|
|
200
|
+
severity: "error",
|
|
201
|
+
sx: {
|
|
202
|
+
mx: 3,
|
|
203
|
+
mb: 1
|
|
204
|
+
},
|
|
205
|
+
children: saveError
|
|
206
|
+
}) : parseError ? /*#__PURE__*/ _jsxs(Alert, {
|
|
207
|
+
severity: "warning",
|
|
208
|
+
sx: {
|
|
209
|
+
mx: 3,
|
|
210
|
+
mb: 1
|
|
211
|
+
},
|
|
212
|
+
children: [
|
|
213
|
+
'Not valid JSON yet — ',
|
|
214
|
+
parseError,
|
|
215
|
+
'. Your text is kept exactly as typed; Save JSON works again ',
|
|
216
|
+
'once it parses.'
|
|
217
|
+
]
|
|
218
|
+
}) : null,
|
|
219
|
+
/*#__PURE__*/ _jsx(When, {
|
|
220
|
+
condition: open,
|
|
221
|
+
children: /*#__PURE__*/ _jsxs(Box, {
|
|
222
|
+
sx: {
|
|
223
|
+
flex: 1,
|
|
224
|
+
minHeight: 0,
|
|
225
|
+
position: 'relative'
|
|
226
|
+
},
|
|
227
|
+
children: [
|
|
228
|
+
/*#__PURE__*/ _jsx(Editor, {
|
|
229
|
+
height: "100%",
|
|
230
|
+
defaultValue: documentText,
|
|
231
|
+
value: data,
|
|
232
|
+
onChange: handleChange
|
|
233
|
+
}),
|
|
234
|
+
/*#__PURE__*/ _jsx(When, {
|
|
235
|
+
condition: warnOpen,
|
|
236
|
+
children: /*#__PURE__*/ _jsx(Box, {
|
|
237
|
+
sx: {
|
|
238
|
+
position: 'absolute',
|
|
239
|
+
inset: 0,
|
|
240
|
+
zIndex: 1,
|
|
241
|
+
bgcolor: 'action.disabled',
|
|
242
|
+
display: 'flex',
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
justifyContent: 'center',
|
|
245
|
+
backdropFilter: 'blur(2px)',
|
|
246
|
+
p: {
|
|
247
|
+
xs: 2,
|
|
248
|
+
sm: 3
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/ _jsxs(Alert, {
|
|
252
|
+
severity: "warning",
|
|
253
|
+
sx: {
|
|
254
|
+
maxWidth: 620
|
|
255
|
+
},
|
|
256
|
+
action: /*#__PURE__*/ _jsx(IconButton, {
|
|
257
|
+
onClick: closeWarn,
|
|
258
|
+
color: "inherit",
|
|
259
|
+
"aria-label": "Dismiss this warning",
|
|
260
|
+
title: "Dismiss this warning",
|
|
261
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
262
|
+
path: ICON_VARIANT_CLOSE.path
|
|
263
|
+
})
|
|
264
|
+
}),
|
|
265
|
+
children: [
|
|
266
|
+
/*#__PURE__*/ _jsx(AlertTitle, {
|
|
267
|
+
children: "Warning: Advanced Feature Ahead!"
|
|
268
|
+
}),
|
|
269
|
+
"Using the raw json editor is highly discouraged and should only be used by individuals who understand the consequences. Changes may potentially result in undesired outcomes which are ",
|
|
270
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
271
|
+
children: "destructive and irreversible"
|
|
272
|
+
}),
|
|
273
|
+
"."
|
|
274
|
+
]
|
|
275
|
+
})
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
}),
|
|
283
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
284
|
+
children: [
|
|
285
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
286
|
+
variant: "contained",
|
|
287
|
+
onClick: (e)=>handleClose(e, 'cancelClick'),
|
|
288
|
+
children: 'Cancel'
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
291
|
+
variant: "contained",
|
|
292
|
+
onClick: handleSave,
|
|
293
|
+
children: 'Save JSON'
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
})
|
|
297
|
+
]
|
|
298
|
+
}));
|
|
299
|
+
});
|
|
300
|
+
JsonEditorRaw.displayName = 'JsonEditor';
|
|
301
|
+
export const JsonEditor = observer(JsonEditorRaw);
|
|
302
|
+
export default JsonEditor;
|
|
303
|
+
|
|
304
|
+
//# sourceMappingURL=json-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/ui/json-editor/src/lib/json-editor.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { MdiIcon } from '@aglyn/shared-ui-jsx'\nimport {\n Alert,\n AlertTitle,\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n type DialogProps,\n DialogTitle,\n IconButton,\n} from '@mui/material'\nimport { observer } from 'mobx-react-lite'\nimport dynamic from 'next/dynamic'\nimport {\n forwardRef,\n SyntheticEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { When } from 'react-if'\nimport type { CodeMirrorProps } from './components/code-mirror-editor'\nimport type { MonacoEditorProps } from './components/monaco-editor'\n\nconst Editor = dynamic<MonacoEditorProps>(\n () => import('./components/monaco-editor'),\n {\n ssr: false,\n /*\n A dynamic import with no `loading` renders `null` (AGL-2541).\n\n That is indistinguishable from an editor that will never arrive: the\n same empty box while the chunk is in flight, and the same empty box\n forever if it fails. The report this fixes was exactly that — Raw JSON\n opens on a blank pane with no console error — leaving nothing on screen\n to say whether to wait, reload, or give up.\n */\n loading: () => (\n <Box\n sx={{\n flex: 1,\n minHeight: 0,\n display: 'grid',\n placeItems: 'center',\n color: 'text.secondary',\n }}\n >\n {'Loading the editor…'}\n </Box>\n ),\n },\n)\n\ntype OnClose = {\n bivarianceHack(\n event: any,\n reason: 'backdropClick' | 'escapeKeyDown' | 'saveClick' | 'cancelClick',\n ): void\n}['bivarianceHack']\ntype OnSave = {\n bivarianceHack(event: SyntheticEvent<any, any>, value: iJSON): void\n}['bivarianceHack']\n\nexport interface JsonEditorProps\n extends Omit<DialogProps, 'defaultValue' | 'title'> {\n defaultValue?: CodeMirrorProps['defaultValue']\n onSave?: OnSave\n onClose?: OnClose\n /** Dialog title; defaults to the classic \"Raw JSON\". */\n title?: React.ReactNode\n /** Optional hint rendered under the title (e.g. subtree scope note). */\n description?: React.ReactNode\n /**\n * Pre-save check (AGL-457): return an error message to keep the dialog\n * open and surface it instead of saving.\n */\n validate?: (value: iJSON) => string | null | undefined\n}\n\nconst JsonEditorRaw = forwardRef<any, JsonEditorProps>(\n (props, ref) => {\n const {\n onClose,\n onSave,\n defaultValue,\n open,\n title = 'Raw JSON',\n description,\n validate,\n ...rest\n } = props\n /** The stored document, as the text a buffer is seeded from. */\n const documentText = useMemo(\n () => JSON.stringify(defaultValue || {}, null, 2),\n [defaultValue],\n )\n const [data, setData] = useState(documentText)\n const [warnOpen, setWarnOpen] = useState(true)\n const [saveError, setSaveError] = useState<string | null>(null)\n const closeWarn = useCallback(() => setWarnOpen(false), [])\n\n /**\n * The document text this buffer was seeded from, or `null` while closed.\n *\n * `data !== seededFrom.current` is therefore \"the author has typed\n * something that is not yet saved\", which is the one question both the\n * re-seed below and the backdrop guard need answered.\n */\n const seededFrom = useRef<string | null>(null)\n\n /**\n * Seed the buffer, and NEVER re-seed one that has been typed into\n * (AGL-2486 item 17).\n *\n * `defaultValue` is `Aglyn.canvas.nestedNodes` at every call site — a\n * freshly built object, from a MobX store this dialog re-renders with.\n * The previous version compared the incoming document against the BUFFER\n * and re-seeded whenever they differed, which is true by definition the\n * moment the author types: any canvas change, autosave or co-edit echo\n * then replaced their work in progress with the stored document.\n *\n * Re-seeding a PRISTINE buffer is still right — nothing is lost, and the\n * dialog should not show a document the canvas has moved past.\n */\n useEffect(() => {\n if (!open) {\n // A closed dialog holds nothing: the next open seeds from whatever\n // the document says then, rather than from a buffer walked away from.\n seededFrom.current = null\n return\n }\n setData(prev => {\n if (seededFrom.current !== null && prev !== seededFrom.current) {\n return prev\n }\n seededFrom.current = documentText\n return documentText\n })\n }, [documentText, open])\n\n /**\n * Why the buffer does not parse, or `null` when it does.\n *\n * Surfaced as a live, NON-destructive notice: a half-written document is\n * allowed to be invalid, so the only thing to do about it is say so.\n */\n const parseError = useMemo<string | null>(() => {\n if (!open) return null\n try {\n JSON.parse(data)\n return null\n } catch (e: any) {\n return e?.message ?? 'Invalid JSON'\n }\n }, [data, open])\n\n const handleChange = useCallback((value: any) => {\n setData(value)\n setSaveError(null)\n }, [])\n const handleClose = useCallback<OnClose>(\n (event, reason) => {\n // A stray click outside a 95vw dialog must not destroy an unsaved\n // buffer. Cancel and Escape are deliberate acts and still close.\n if (reason === 'backdropClick' && data !== seededFrom.current) return\n setSaveError(null)\n onClose && onClose(event, reason)\n },\n [onClose, data],\n )\n const handleSave = useCallback(\n (event: any) => {\n // Parse the raw text directly so malformed JSON blocks the save\n // with an error instead of silently saving `{}` (AGL-457).\n let value: iJSON\n try {\n value = JSON.parse(data)\n } catch (error: any) {\n setSaveError(error?.message ?? 'Invalid JSON')\n return\n }\n const problem = validate?.(value)\n if (problem) {\n setSaveError(problem)\n return\n }\n onSave && onSave(event, value)\n handleClose(event, 'saveClick')\n },\n [onSave, handleClose, data, validate],\n )\n\n return (\n <Dialog\n ref={ref}\n open={open}\n // A raw-JSON editor is unusable in a small box — component\n // overrides run to hundreds of lines. Fill most of the viewport in\n // BOTH axes; `rest` spreads after, so a caller can still override.\n maxWidth={false}\n fullWidth\n slotProps={{\n paper: {\n sx: {\n width: '95vw',\n maxWidth: 'none',\n height: '92vh',\n maxHeight: 'none',\n },\n },\n }}\n onClose={handleClose}\n // keepMounted\n {...rest}\n >\n <DialogTitle>{title}</DialogTitle>\n <DialogContent\n sx={{\n position: 'relative',\n p: 0,\n display: 'flex',\n flexDirection: 'column',\n minHeight: 0,\n }}\n >\n {description ? (\n <Box sx={{ px: 3, pb: 1, color: 'text.secondary' }}>\n {description}\n </Box>\n ) : null}\n {saveError ? (\n <Alert severity=\"error\" sx={{ mx: 3, mb: 1 }}>\n {saveError}\n </Alert>\n ) : parseError ? (\n <Alert severity=\"warning\" sx={{ mx: 3, mb: 1 }}>\n {'Not valid JSON yet — '}\n {parseError}\n {'. Your text is kept exactly as typed; Save JSON works again '}\n {'once it parses.'}\n </Alert>\n ) : null}\n <When condition={open}>\n {/*\n The editor mounts UNDER the warning, not instead of it\n (AGL-2541).\n\n The gate used to be an `If`/`Else`, so while the warning stood\n the `Editor` was not rendered at all — its chunk was never\n requested and Monaco's loader never ran. An author who dismissed\n the warning was then waiting on a download that had not started,\n against a pane that renders nothing while it waits. That is the\n \"the editor never mounts, and no request for loader.js is ever\n issued\" report: both halves are true, and neither is Monaco's.\n\n Rendering both, warning stacked above, puts the chunk in flight\n while the warning is being read. The overlay was already written\n to be an overlay — full-bleed, blurred, over a translucent wash\n — it was only ever wired as a replacement.\n\n `value` is the author's buffer VERBATIM, and nothing else\n (AGL-2486 item 17). It used to be\n `JSON.stringify(JSON.parse(data) ?? {})`, whose parse fell back\n to `{}`. `@monaco-editor/react` treats `value` as authoritative\n — on every change it runs `executeEdits(fullModelRange, value)`\n — so the first keystroke that left the buffer transiently\n unparseable replaced the whole document on screen with `{}`. A\n comma does that, which is exactly how it was reported. Worse,\n that overwrite is made with `onChange` suppressed, so `data`\n kept text the editor no longer showed and there was nothing to\n recover from. Feeding the buffer back unchanged means the prop\n always equals `editor.getValue()`, so the effect's `value !==`\n guard never fires from typing and no keystroke can rewrite the\n document. It also stops the buffer being re-indented under the\n cursor whenever the author's valid text was not already 2-space\n pretty-printed.\n */}\n <Box sx={{ flex: 1, minHeight: 0, position: 'relative' }}>\n <Editor\n height=\"100%\"\n defaultValue={documentText}\n value={data}\n onChange={handleChange}\n />\n <When condition={warnOpen}>\n <Box\n sx={{\n position: 'absolute',\n inset: 0,\n zIndex: 1,\n bgcolor: 'action.disabled',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backdropFilter: 'blur(2px)',\n p: { xs: 2, sm: 3 }\n }}>\n <Alert\n severity=\"warning\"\n sx={{\n maxWidth: 620,\n }}\n action={\n <IconButton\n onClick={closeWarn}\n color=\"inherit\"\n aria-label=\"Dismiss this warning\"\n title=\"Dismiss this warning\"\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n </IconButton>\n }\n >\n <AlertTitle>Warning: Advanced Feature Ahead!</AlertTitle>\n Using the raw json editor is highly discouraged and should\n only be used by individuals who understand the consequences.\n Changes may potentially result in undesired outcomes which\n are <strong>destructive and irreversible</strong>.\n </Alert>\n </Box>\n </When>\n </Box>\n </When>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n onClick={(e) => handleClose(e, 'cancelClick')}\n >\n {'Cancel'}\n </Button>\n <Button variant=\"contained\" onClick={handleSave}>\n {'Save JSON'}\n </Button>\n </DialogActions>\n </Dialog>\n );\n },\n)\nJsonEditorRaw.displayName = 'JsonEditor'\n\nexport const JsonEditor = observer(JsonEditorRaw)\n\nexport default JsonEditor\n"],"names":["ICON_VARIANT_CLOSE","MdiIcon","Alert","AlertTitle","Box","Button","Dialog","DialogActions","DialogContent","DialogTitle","IconButton","observer","dynamic","forwardRef","useCallback","useEffect","useMemo","useRef","useState","When","Editor","ssr","loading","sx","flex","minHeight","display","placeItems","color","JsonEditorRaw","props","ref","onClose","onSave","defaultValue","open","title","description","validate","rest","documentText","JSON","stringify","data","setData","warnOpen","setWarnOpen","saveError","setSaveError","closeWarn","seededFrom","current","prev","parseError","parse","e","message","handleChange","value","handleClose","event","reason","handleSave","error","problem","maxWidth","fullWidth","slotProps","paper","width","height","maxHeight","position","p","flexDirection","px","pb","severity","mx","mb","condition","onChange","inset","zIndex","bgcolor","alignItems","justifyContent","backdropFilter","xs","sm","action","onClick","aria-label","path","strong","variant","displayName","JsonEditor"],"mappings":"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"}
|