@gravitee/graphene-core 2.53.0 → 2.54.0-monaco-modules.3f0f112

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.
@@ -5,7 +5,7 @@
5
5
  export { sampleApps, sampleAppsExtended } from './shell/app-switcher.fixture';
6
6
  export { sampleEnvironments, sampleEnvironmentsForSidebar } from './shell/environment-picker.fixture';
7
7
  export { agentManagementApps, agentManagementNavGroups, contextNavGroups, contextPageTabKeys, findContextLabel, findNavLabel, pageLayoutNavGroups, sampleNavGroups, } from './navigation.fixture';
8
- export { jsonSchemaFormArrayExampleSchema, jsonSchemaFormBannerSchema, jsonSchemaFormCombinatorsExampleSchema, jsonSchemaFormDependenciesSchema, jsonSchemaFormDeprecatedSchema, jsonSchemaFormDisableIfSchema, jsonSchemaFormDisplayIfSchema, jsonSchemaFormEnumExampleSchema, jsonSchemaFormPlaygroundSchema, } from './json-schema-form';
8
+ export { jsonSchemaFormArrayExampleSchema, jsonSchemaFormBannerSchema, jsonSchemaFormCodeEditorSchema, jsonSchemaFormCombinatorsExampleSchema, jsonSchemaFormDependenciesSchema, jsonSchemaFormDeprecatedSchema, jsonSchemaFormDisableIfSchema, jsonSchemaFormDisplayIfSchema, jsonSchemaFormEnumExampleSchema, jsonSchemaFormPlaygroundSchema, } from './json-schema-form';
9
9
  export { jsonSchemaFormObjectVariantsSchema } from './json-schema-form-object-variants.fixture';
10
10
  export { catalogApis } from './apim/api-catalog.fixture';
11
11
  export { samplePlans } from './apim/plans.fixture';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/__stories__/fixtures/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAEtG,OAAO,EACL,mBAAmB,EACnB,wBAA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AAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { JsonSchema } from '../../../composed/JsonSchemaForm';
2
+ /**
3
+ * Mirrors ui-particles' `codeEditorExample`
4
+ * (`gio-form-json-schema/json-schema-example/code-editor.ts`) and the shape used by real APIM
5
+ * plugins (`format: 'gio-code-editor'`, e.g. the dynamic-properties HTTP service's JOLT
6
+ * transformation field). Forcing function for ISO behaviour: a Particles-authored schema must
7
+ * render the same widget in Graphene.
8
+ *
9
+ * The trigger is `type: 'string'` + `format: 'gio-code-editor'`. The language is read from
10
+ * `gioConfig.monacoEditorConfig.language` when present; otherwise the editor falls back to JSON
11
+ * auto-detection (JSON payload → `json`, else `plaintext`), matching Particles.
12
+ */
13
+ export declare const jsonSchemaFormCodeEditorSchema: JsonSchema;
14
+ //# sourceMappingURL=code-editor.fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor.fixture.d.ts","sourceRoot":"","sources":["../../../../src/__stories__/fixtures/json-schema-form/code-editor.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAElF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,EAAE,UA2C5C,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { jsonSchemaFormArrayExampleSchema } from './array.fixture';
2
2
  export { jsonSchemaFormBannerSchema } from './banner.fixture';
3
+ export { jsonSchemaFormCodeEditorSchema } from './code-editor.fixture';
3
4
  export { jsonSchemaFormCombinatorsExampleSchema } from './combinators.fixture';
4
5
  export { jsonSchemaFormDependenciesSchema } from './dependencies.fixture';
5
6
  export { jsonSchemaFormDeprecatedSchema } from './deprecated.fixture';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__stories__/fixtures/json-schema-form/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__stories__/fixtures/json-schema-form/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,228 +1,2 @@
1
- import { n as e, t } from "../Skeleton-C30qULzD.js";
2
- import * as n from "react";
3
- import { jsx as r } from "react/jsx-runtime";
4
- import { Editor as i, loader as a } from "@monaco-editor/react";
5
- //#region src/composed/CodeEditor/setupCodeEditor.ts
6
- var o = "__grapheneCodeEditorConfigured__", s = !!globalThis[o];
7
- function c({ baseUrl: e, monaco: t }) {
8
- if (!s) {
9
- if (t !== void 0) a.config({ monaco: t });
10
- else if (e !== void 0) a.config({ paths: { vs: e.replace(/\/+$/, "") } });
11
- else return;
12
- s = !0, globalThis[o] = !0;
13
- }
14
- }
15
- //#endregion
16
- //#region src/composed/CodeEditor/theme/buildTheme.ts
17
- var l = "graphene";
18
- function u(e) {
19
- let t = {}, n = [], r = document.createElement("div");
20
- document.body.appendChild(r);
21
- let i = getComputedStyle(r), a = document.createElement("canvas");
22
- a.width = 1, a.height = 1;
23
- let o = a.getContext("2d");
24
- for (let a of e) {
25
- if (!o) {
26
- t[a] = "#000000";
27
- continue;
28
- }
29
- r.style.backgroundColor = `var(${a})`;
30
- let e = i.backgroundColor;
31
- (e === "" || e === "rgba(0, 0, 0, 0)") && n.push(a), o.clearRect(0, 0, 1, 1), o.fillStyle = e, o.fillRect(0, 0, 1, 1);
32
- let [s, c, l] = o.getImageData(0, 0, 1, 1).data;
33
- t[a] = "#" + [
34
- s,
35
- c,
36
- l
37
- ].map((e) => e.toString(16).padStart(2, "0")).join("");
38
- }
39
- return document.body.removeChild(r), t;
40
- }
41
- function d() {
42
- let e = document.documentElement.classList.contains("dark"), t = u([
43
- "--background",
44
- "--foreground",
45
- "--border",
46
- "--muted",
47
- "--muted-foreground",
48
- "--primary",
49
- "--code-editor-string",
50
- "--code-editor-keyword",
51
- "--code-editor-number",
52
- "--code-editor-type",
53
- "--code-editor-special"
54
- ]), n = t["--background"], r = t["--foreground"], i = t["--border"], a = t["--muted"], o = t["--muted-foreground"], s = t["--primary"], c = t["--code-editor-string"], l = t["--code-editor-keyword"], d = t["--code-editor-number"], f = t["--code-editor-type"], p = t["--code-editor-special"], m = (e) => e.slice(1);
55
- return {
56
- base: e ? "vs-dark" : "vs",
57
- inherit: !0,
58
- rules: [
59
- {
60
- token: "string",
61
- foreground: m(c)
62
- },
63
- {
64
- token: "string.key.json",
65
- foreground: m(f)
66
- },
67
- {
68
- token: "keyword",
69
- foreground: m(l)
70
- },
71
- {
72
- token: "keyword.json",
73
- foreground: m(p)
74
- },
75
- {
76
- token: "number",
77
- foreground: m(d)
78
- },
79
- {
80
- token: "type",
81
- foreground: m(f)
82
- },
83
- {
84
- token: "tag",
85
- foreground: m(l)
86
- },
87
- {
88
- token: "attribute.name",
89
- foreground: m(f)
90
- },
91
- {
92
- token: "attribute.value",
93
- foreground: m(c)
94
- },
95
- {
96
- token: "comment",
97
- foreground: m(o),
98
- fontStyle: "italic"
99
- },
100
- {
101
- token: "comment.line",
102
- foreground: m(o),
103
- fontStyle: "italic"
104
- },
105
- {
106
- token: "comment.block",
107
- foreground: m(o),
108
- fontStyle: "italic"
109
- },
110
- {
111
- token: "identifier",
112
- foreground: m(r)
113
- },
114
- {
115
- token: "variable",
116
- foreground: m(r)
117
- },
118
- {
119
- token: "delimiter",
120
- foreground: m(r)
121
- }
122
- ],
123
- colors: {
124
- "editor.background": n,
125
- "editor.foreground": r,
126
- "editor.lineHighlightBackground": r + "08",
127
- "editor.lineHighlightBorder": "#00000000",
128
- "editor.selectionBackground": s + "4d",
129
- "editor.inactiveSelectionBackground": s + "26",
130
- "editorCursor.foreground": s,
131
- "editorLineNumber.foreground": o,
132
- "editorLineNumber.activeForeground": r,
133
- "editorGutter.background": n,
134
- "editorIndentGuide.background1": i,
135
- "editorIndentGuide.activeBackground1": o,
136
- "editorWidget.background": a,
137
- "editorWidget.foreground": r,
138
- "editorWidget.border": i,
139
- "editorWidget.resizeBorder": i,
140
- "widget.shadow": r + "1a",
141
- "input.background": n,
142
- "input.border": i,
143
- "input.foreground": r,
144
- "input.placeholderForeground": o,
145
- "inputOption.activeBorder": s,
146
- "inputOption.activeBackground": s + "26",
147
- "inputOption.activeForeground": s,
148
- "button.background": s,
149
- "button.foreground": "#ffffff",
150
- "editorSuggestWidget.background": n,
151
- "editorSuggestWidget.border": i,
152
- "editorSuggestWidget.selectedBackground": s + "26",
153
- "scrollbarSlider.background": i + "80",
154
- "scrollbarSlider.hoverBackground": i,
155
- "scrollbarSlider.activeBackground": o + "80"
156
- }
157
- };
158
- }
159
- //#endregion
160
- //#region src/composed/CodeEditor/CodeEditor.tsx
161
- function f(e) {
162
- e.editor.defineTheme(l, d()), e.editor.setTheme(l);
163
- }
164
- var p = (e) => {
165
- f(e);
166
- };
167
- function m() {
168
- let [e, t] = n.useState(typeof document < "u" && document.documentElement.classList.contains("dark"));
169
- return n.useEffect(() => {
170
- let e = new MutationObserver(() => {
171
- t(document.documentElement.classList.contains("dark"));
172
- });
173
- return e.observe(document.documentElement, {
174
- attributes: !0,
175
- attributeFilter: ["class"]
176
- }), () => e.disconnect();
177
- }, []), e;
178
- }
179
- function h({ value: a, defaultValue: o, onChange: s, language: c = "plaintext", readOnly: u = !1, disabled: d = !1, height: h, className: g, options: _, onMount: v }) {
180
- let y = m(), b = n.useRef(null), x = n.useRef(null);
181
- n.useEffect(() => {
182
- b.current && f(b.current);
183
- }, [y]), n.useEffect(() => {}, []);
184
- let S = n.useCallback((e, t) => {
185
- b.current = t, x.current = e, v?.(e, t);
186
- }, [v]), C = typeof h == "number" ? `${h}px` : h ?? "300px";
187
- return /* @__PURE__ */ r("div", {
188
- "data-slot": "code-editor",
189
- "data-disabled": d ? "" : void 0,
190
- "data-readonly": u && !d ? "" : void 0,
191
- className: e("overflow-hidden rounded-lg border border-input bg-background", "data-disabled:pointer-events-none data-disabled:opacity-50", "data-readonly:bg-muted/30", g),
192
- style: { height: C },
193
- children: /* @__PURE__ */ r(i, {
194
- height: "100%",
195
- language: c,
196
- value: a,
197
- defaultValue: o,
198
- theme: l,
199
- onChange: s,
200
- onMount: S,
201
- beforeMount: p,
202
- loading: /* @__PURE__ */ r(t, { className: "size-full" }),
203
- options: {
204
- readOnly: u || d,
205
- minimap: { enabled: !1 },
206
- scrollBeyondLastLine: !1,
207
- automaticLayout: !0,
208
- fontFamily: "ui-monospace, Menlo, Consolas, \"Cascadia Code\", \"Liberation Mono\", monospace",
209
- fontSize: 13,
210
- lineHeight: 20,
211
- padding: {
212
- top: 8,
213
- bottom: 8
214
- },
215
- glyphMargin: !1,
216
- renderLineHighlight: "line",
217
- scrollbar: {
218
- verticalScrollbarSize: 6,
219
- horizontalScrollbarSize: 6
220
- },
221
- overviewRulerLanes: 0,
222
- ..._
223
- }
224
- })
225
- });
226
- }
227
- //#endregion
228
- export { h as CodeEditor, c as setupCodeEditor };
1
+ import { n as e, t } from "../CodeEditor-Cnn11Gx1.js";
2
+ export { t as CodeEditor, e as setupCodeEditor };
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/composed/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,WAAW,EAAU,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,UAAU,CAAC;AAIrE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,C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AAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAClC;AA6BD,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,QAAsB,EACtB,QAAgB,EAChB,QAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,GACR,EAAE,eAAe,qBA2GjB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -4,61 +4,56 @@ export interface SetupCodeEditorOptions {
4
4
  /**
5
5
  * AMD / self-hosted: URL serving `node_modules/monaco-editor/min/vs`, e.g. `"/assets/monaco/vs"`.
6
6
  * Use when Monaco is served as static files (e.g. CopyPlugin, Nginx, CDN) rather than bundled.
7
+ *
8
+ * Not required in the common case — `<CodeEditor>` auto-configures its loader with the bundled
9
+ * `monaco-editor` on first render. Reach for `baseUrl` only when self-hosting the AMD build.
7
10
  */
8
11
  baseUrl?: string;
9
12
  /**
10
- * ESM / npm-bundled: the `monaco-editor` namespace import.
11
- * Use for Rspack / webpack / Module Federation host shells where Monaco is bundled as ESM.
12
- * @example
13
- * import * as monaco from 'monaco-editor';
14
- * setupCodeEditor({ monaco });
13
+ * @deprecated `<CodeEditor>` now auto-configures the loader with the `monaco-editor` instance
14
+ * bundled alongside graphene-core, so passing one in is redundant. Drop the call entirely
15
+ * (or use `{ baseUrl }` for AMD/self-hosted mode). Still honored for one release so existing
16
+ * bootstraps keep working.
15
17
  */
16
18
  monaco?: MonacoLoaderConfig['monaco'];
17
19
  }
18
20
  /**
19
- * Configure Monaco's loader before the first `<CodeEditor>` mounts.
20
- * Call once at app bootstrap — idempotent, first caller wins.
21
+ * Self-host Monaco from a pre-built `vs` folder (AMD mode).
21
22
  *
22
- * Two modes:
23
- * - `{ baseUrl }` AMD/self-hosted, points `@monaco-editor/react`'s loader at a local `vs` folder.
24
- * - `{ monaco }` — ESM/bundled, passes the `monaco-editor` namespace to the loader so it uses
25
- * the npm-installed instance instead of fetching from CDN. Required for Rspack / MF hosts.
23
+ * In nearly every setup you do **not** need to call this — `<CodeEditor>` auto-configures its
24
+ * loader on first render using the bundled `monaco-editor`. Reach for `setupCodeEditor` only to:
26
25
  *
27
- * If both `baseUrl` and `monaco` are passed, `monaco` wins and `baseUrl` is ignored (ESM > AMD).
28
- * A DEV-only warning is emitted in that case pick one and drop the other.
26
+ * - Point the loader at a pre-built `vs` folder served as static assets (`{ baseUrl }`).
27
+ * - Pre-configure ahead of the first render (idempotent, first caller wins).
28
+ *
29
+ * Idempotent — first caller wins. Module-scoped, so each federated shell must call it
30
+ * independently if it wants to override the auto-config default.
29
31
  *
30
32
  * @example
31
- * // ESM mode under Vite / Rspack pair `setupCodeEditor({ monaco })` with a `MonacoEnvironment`
32
- * // that resolves each language worker through `new URL(..., import.meta.url)` so the bundler
33
- * // emits one chunk per worker, served from the same origin (CSP-safe, offline-capable).
34
- * import * as monaco from 'monaco-editor';
33
+ * // AMD/self-hosted mode — graphene-core consumer ships Monaco as static assets.
35
34
  * import { setupCodeEditor } from '@gravitee/graphene-core';
35
+ * setupCodeEditor({ baseUrl: '/assets/monaco/vs' });
36
+ */
37
+ export declare function setupCodeEditor({ baseUrl, monaco }?: SetupCodeEditorOptions): void;
38
+ /**
39
+ * Configure the loader with the bundled `monaco-editor` so `<CodeEditor>` works out of the box,
40
+ * including in federated remotes whose own `loader` instance was never reached by the host's
41
+ * `setupCodeEditor` call.
36
42
  *
37
- * self.MonacoEnvironment = {
38
- * getWorker(_workerId, label) {
39
- * if (label === 'json') {
40
- * return new Worker(new URL('monaco-editor/esm/vs/language/json/json.worker', import.meta.url));
41
- * }
42
- * if (label === 'css' || label === 'scss' || label === 'less') {
43
- * return new Worker(new URL('monaco-editor/esm/vs/language/css/css.worker', import.meta.url));
44
- * }
45
- * if (label === 'html' || label === 'handlebars' || label === 'razor') {
46
- * return new Worker(new URL('monaco-editor/esm/vs/language/html/html.worker', import.meta.url));
47
- * }
48
- * if (label === 'typescript' || label === 'javascript') {
49
- * return new Worker(new URL('monaco-editor/esm/vs/language/typescript/ts.worker', import.meta.url));
50
- * }
51
- * return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url));
52
- * },
53
- * };
43
+ * Awaited by `<CodeEditor>` once before its first render. The `monaco-editor` import is
44
+ * dynamic on purpose: a static import would put it on the module graph of every consumer that
45
+ * touches `<CodeEditor>` transitively (e.g. through `JsonSchemaForm`'s `SchemaField`), and
46
+ * vite/vitest's optional-peer-dep wrapper then refuses to resolve it during dep optimization.
47
+ * Dynamic import keeps it off the static graph — only the leaf that actually mounts an editor
48
+ * pays for it. Idempotent yields to any prior `setupCodeEditor({ baseUrl | monaco })`.
49
+ * Module-scoped flag each federated instance configures its own loader exactly once.
54
50
  *
55
- * setupCodeEditor({ monaco });
51
+ * @internal
56
52
  */
57
- export declare function setupCodeEditor({ baseUrl, monaco }: SetupCodeEditorOptions): void;
53
+ export declare function ensureCodeEditorConfigured(): Promise<void>;
58
54
  /**
59
- * Whether {@link setupCodeEditor} has been called. `<CodeEditor>` reads this to emit a dev-only
60
- * warning when it mounts without an explicit init — otherwise Monaco silently falls back to the
61
- * CDN, which breaks under a strict CSP or offline.
55
+ * Whether the loader has been configured by an explicit {@link setupCodeEditor} call or by
56
+ * {@link ensureCodeEditorConfigured} (which `<CodeEditor>` calls on first render).
62
57
  */
63
58
  export declare function isCodeEditorConfigured(): boolean;
64
59
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"setupCodeEditor.d.ts","sourceRoot":"","sources":["../../../src/composed/CodeEditor/setupCodeEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,sBAAsB,GAAG,IAAI,CAoBjF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
1
+ {"version":3,"file":"setupCodeEditor.d.ts","sourceRoot":"","sources":["../../../src/composed/CodeEditor/setupCodeEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC;AASD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAE,sBAA2B,GAAG,IAAI,CAyBtF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAMhE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/composed/JsonSchemaForm/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAehD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASjD,UAAU,gBAAgB;IACxB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAG1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD,iBAAS,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAS,EAAE,EAAE,gBAAgB,+TAgC/D;AAoED,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"SchemaField.d.ts","sourceRoot":"","sources":["../../../src/composed/JsonSchemaForm/SchemaField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAgBhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAUjD,UAAU,gBAAgB;IACxB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAG1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD,iBAAS,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAS,EAAE,EAAE,gBAAgB,+TAgC/D;AAwED,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { SchemaNode } from '../../schema/types';
2
+ interface CodeEditorFieldProps {
3
+ readonly node: SchemaNode;
4
+ readonly name: string;
5
+ }
6
+ declare function CodeEditorField({ node, name }: CodeEditorFieldProps): import("react").JSX.Element;
7
+ export { CodeEditorField };
8
+ //# sourceMappingURL=CodeEditorField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditorField.d.ts","sourceRoot":"","sources":["../../../../../src/composed/JsonSchemaForm/fields/code-editor/CodeEditorField.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAoBD,iBAAS,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,oBAAoB,+BAsD5D;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -17,11 +17,11 @@ interface GioUiTypeConfig {
17
17
  }
18
18
  interface GioCodeEditorConfig {
19
19
  language: string;
20
- schemas?: ReadonlyArray<{
21
- uri: string;
22
- schema: unknown;
23
- }>;
24
- schema?: unknown;
20
+ /**
21
+ * Editor height override — accepts a pixel number (`400`) or any CSS value (`"50vh"`). Optional;
22
+ * when omitted, `CodeEditorField` falls back to its default (250px).
23
+ */
24
+ height?: number | string;
25
25
  }
26
26
  interface GioConfig extends GioUiTypeConfig {
27
27
  displayIf?: GioIfConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.types.d.ts","sourceRoot":"","sources":["../../../../src/composed/JsonSchemaForm/models/json-schema.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,KAAK,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CACnF;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnE;AAED,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,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,UAAU,UAAW,SAAQ,IAAI,CAC/B,WAAW,EACX,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAC/E;IACC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
@@ -2,7 +2,8 @@ import { JsonSchema } from '../models/json-schema.types';
2
2
  declare function isOneOfConstSelect(schema: JsonSchema): boolean;
3
3
  declare function isMultiSelectArray(schema: JsonSchema): boolean;
4
4
  declare function isHeadersArray(schema: JsonSchema): boolean;
5
+ declare function isCodeEditor(schema: JsonSchema): boolean;
5
6
  declare function isOneOfWithProperties(schema: JsonSchema): boolean;
6
7
  declare function isAnyOfWithProperties(schema: JsonSchema): boolean;
7
- export { isAnyOfWithProperties, isHeadersArray, isMultiSelectArray, isOneOfConstSelect, isOneOfWithProperties };
8
+ export { isAnyOfWithProperties, isCodeEditor, isHeadersArray, isMultiSelectArray, isOneOfConstSelect, isOneOfWithProperties, };
8
9
  //# sourceMappingURL=schemaShape.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaShape.d.ts","sourceRoot":"","sources":["../../../../src/composed/JsonSchemaForm/utils/schemaShape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAK9D,iBAAS,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAMvD;AAID,iBAAS,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAIvD;AAOD,iBAAS,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAEnD;AAMD,iBAAS,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAO1D;AAKD,iBAAS,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAM1D;AAED,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"schemaShape.d.ts","sourceRoot":"","sources":["../../../../src/composed/JsonSchemaForm/utils/schemaShape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAK9D,iBAAS,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAMvD;AAID,iBAAS,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAIvD;AAOD,iBAAS,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAEnD;AAOD,iBAAS,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAGjD;AAMD,iBAAS,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAO1D;AAKD,iBAAS,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAM1D;AAED,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,CAAC"}