Lines 8-48javascript
10 * JsonSourceEditor — Monaco-backed JSON editor for the metadata
11 * designer's "Source" tab. Replaces the old textarea so power users
12 * get syntax highlighting, bracket matching, folding, and inline
13 * error squigglies driven by the server-side `_diagnostics` payload.
15 * Markers: `issues[]` use dotted (or array) JSON paths matching the
16 * Zod issue shape. We resolve each path to a Monaco range with
17 * `jsonc-parser` so the squiggle lands on the offending value (or
18 * the property key when the value is absent). Unresolved paths fall
19 * back to a marker on line 1, so nothing is silently lost.
21import React from 'react';
22import { Skeleton } from '@object-ui/components';
23import * as jsonc from 'jsonc-parser';
24import { useMetadataLocale, t } from './i18n';
25import { useMonacoFallback } from './useMonacoFallback';
26// Lazy: Monaco's React wrapper itself pulls in the editor core
27// (~3MB), so we keep it out of the initial app-shell chunk.
28const LazyMonaco = React.lazy(async () => {
29 const mod = await import('@monaco-editor/react');
30 return { default: mod.default };
HighCopied Package Dependency Bridge
Package metadata claims a different repository identity while copied source loads a runtime dependency bridge.
dist/views/metadata-admin/JsonSourceEditor.jsView on unpkg · L28 32function stringify(v) {
34 return JSON.stringify(v ?? {}, null, 2);
40/** Parse a dotted JSON path like `fields.owner.0.type` to segments. */
41function splitPath(p) {
44 return p.split('.').map((seg) => {
45 const n = Number(seg);
46 return Number.isInteger(n) && String(n) === seg ? n : seg;