@aglyn/shared-ui-json-editor 1.0.0-beta.144 → 1.0.0-beta.146
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-json-editor",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.146",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
28
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
27
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.146",
|
|
28
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.146",
|
|
29
29
|
"@codemirror/lang-json": "^6.0.1",
|
|
30
30
|
"@monaco-editor/react": "^4.7.0",
|
|
31
31
|
"@uiw/codemirror-theme-github": "^4.25.11",
|
|
@@ -19,10 +19,26 @@ import { EditorProps } from '@monaco-editor/react';
|
|
|
19
19
|
* Where Monaco's AMD bundle is served from — our origin, never a CDN.
|
|
20
20
|
*
|
|
21
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
|
|
23
|
-
* cannot, so this path is either correct or the build never shipped.
|
|
22
|
+
* `apps/console/public/_static/monaco/vs` at build time and FAILS THE BUILD if
|
|
23
|
+
* it cannot, so this path is either correct or the build never shipped.
|
|
24
|
+
*
|
|
25
|
+
* UNDER `_static`, AND NOT AT THE APEX (AGL-3208).
|
|
26
|
+
*
|
|
27
|
+
* This was `/monaco/vs`, and the console's router answered 404 to every byte
|
|
28
|
+
* of it. `apps/console/middleware.ts` reads an unrecognized first path segment
|
|
29
|
+
* as a workspace slug and refuses an unknown one with a bare 404 (AGL-3017),
|
|
30
|
+
* so `monaco` was looked up as an org and was not one; on a workspace
|
|
31
|
+
* subdomain the same path would instead have been rewritten to
|
|
32
|
+
* `/{slug}/monaco/vs/...`. Monaco never loaded, and the Edit JSON dialog sat
|
|
33
|
+
* on its loading state with nothing on screen to say why.
|
|
34
|
+
*
|
|
35
|
+
* `_static` is the namespace the console already reserves for assets: it is
|
|
36
|
+
* excluded from the middleware matcher, and `isConsoleRouteSegment` admits
|
|
37
|
+
* anything beginning `_`. Vendoring under it is what keeps this fixed —
|
|
38
|
+
* a fourth top-level exception would only be as durable as the next gate's
|
|
39
|
+
* memory of it, and three gates have now claimed unmatched first segments.
|
|
24
40
|
*/
|
|
25
|
-
export declare const MONACO_VS_PATH = "/monaco/vs";
|
|
41
|
+
export declare const MONACO_VS_PATH = "/_static/monaco/vs";
|
|
26
42
|
export interface MonacoEditorProps extends EditorProps {
|
|
27
43
|
}
|
|
28
44
|
export declare const MonacoEditor: {
|
|
@@ -21,9 +21,25 @@ import { useColorScheme, useTheme } from "@mui/material/styles";
|
|
|
21
21
|
* Where Monaco's AMD bundle is served from — our origin, never a CDN.
|
|
22
22
|
*
|
|
23
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
|
|
25
|
-
* cannot, so this path is either correct or the build never shipped.
|
|
26
|
-
|
|
24
|
+
* `apps/console/public/_static/monaco/vs` at build time and FAILS THE BUILD if
|
|
25
|
+
* it cannot, so this path is either correct or the build never shipped.
|
|
26
|
+
*
|
|
27
|
+
* UNDER `_static`, AND NOT AT THE APEX (AGL-3208).
|
|
28
|
+
*
|
|
29
|
+
* This was `/monaco/vs`, and the console's router answered 404 to every byte
|
|
30
|
+
* of it. `apps/console/middleware.ts` reads an unrecognized first path segment
|
|
31
|
+
* as a workspace slug and refuses an unknown one with a bare 404 (AGL-3017),
|
|
32
|
+
* so `monaco` was looked up as an org and was not one; on a workspace
|
|
33
|
+
* subdomain the same path would instead have been rewritten to
|
|
34
|
+
* `/{slug}/monaco/vs/...`. Monaco never loaded, and the Edit JSON dialog sat
|
|
35
|
+
* on its loading state with nothing on screen to say why.
|
|
36
|
+
*
|
|
37
|
+
* `_static` is the namespace the console already reserves for assets: it is
|
|
38
|
+
* excluded from the middleware matcher, and `isConsoleRouteSegment` admits
|
|
39
|
+
* anything beginning `_`. Vendoring under it is what keeps this fixed —
|
|
40
|
+
* a fourth top-level exception would only be as durable as the next gate's
|
|
41
|
+
* memory of it, and three gates have now claimed unmatched first segments.
|
|
42
|
+
*/ export const MONACO_VS_PATH = '/_static/monaco/vs';
|
|
27
43
|
/**
|
|
28
44
|
* Point the loader at our own copy before anything can mount (AGL-1779).
|
|
29
45
|
*
|
|
@@ -1 +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
|
|
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/_static/monaco/vs` at build time and FAILS THE BUILD if\n * it cannot, so this path is either correct or the build never shipped.\n *\n * UNDER `_static`, AND NOT AT THE APEX (AGL-3208).\n *\n * This was `/monaco/vs`, and the console's router answered 404 to every byte\n * of it. `apps/console/middleware.ts` reads an unrecognized first path segment\n * as a workspace slug and refuses an unknown one with a bare 404 (AGL-3017),\n * so `monaco` was looked up as an org and was not one; on a workspace\n * subdomain the same path would instead have been rewritten to\n * `/{slug}/monaco/vs/...`. Monaco never loaded, and the Edit JSON dialog sat\n * on its loading state with nothing on screen to say why.\n *\n * `_static` is the namespace the console already reserves for assets: it is\n * excluded from the middleware matcher, and `isConsoleRouteSegment` admits\n * anything beginning `_`. Vendoring under it is what keeps this fixed —\n * a fourth top-level exception would only be as durable as the next gate's\n * memory of it, and three gates have now claimed unmatched first segments.\n */\nexport const MONACO_VS_PATH = '/_static/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;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,iBAAiB,qBAAoB;AAElD;;;;;;;;;;;;;;;;;;;;;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"}
|