@xh/hoist 79.0.0-SNAPSHOT.1765835240904 → 79.0.0-SNAPSHOT.1765843522401

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/CHANGELOG.md CHANGED
@@ -143,6 +143,32 @@
143
143
  * Added new `ViewRowData.cubeRowType` property to support identifying bucketed rows.
144
144
  * Improved `waitFor` to accept a `null` value for its timeout.
145
145
 
146
+ ### 💥 Breaking Changes (upgrade difficulty: 🟠 MEDIUM - Code mirror v6 update)
147
+ * Hoist v77 **upgrades Code Mirror to v6** (from v5)
148
+ * editorProps deprecated:
149
+ The v5-style editorProps object (which accepted any CodeMirror config keys) is no longer
150
+ supported. Most former options can be achieved via v6 extensions or by setting CodeInput props
151
+ such as readonly, language, and linter.
152
+ * `mode` to set the language of code input now changed to `language` prop.
153
+ * Check [language-data](https://github.com/codemirror/language-data/blob/main/src/language-data.ts) for language string (alias and name allowed)
154
+
155
+ ### 🎁 New Features
156
+ * Added `jsonSchema` and `ajvProps` configs to JsonInputProps.
157
+ * `jsonSchema` - Used to validate the input Json
158
+ * `ajvProps` - Used to configure AJV Object
159
+
160
+ ### 📚 Libraries
161
+ * codemirror `5.65.0 -> 6.0.2`
162
+ * @codemirror/view `6.38.6`
163
+ * @uiw/codemirror-themes-all `4.25.2`
164
+ * @codemirror/commands `6.9.0`
165
+ * @codemirror/language `6.11.3`
166
+ * @codemirror/lint `6.9.0`
167
+ * @codemirror/search `6.5.11`
168
+ * @codemirror/autocomplete `6.19.0`
169
+ * @codemirror/language-data `6.5.2`
170
+ * ajv `8.17.1`,
171
+
146
172
  ## 76.1.0 - 2025-10-17
147
173
 
148
174
  ### 🎁 New Features
@@ -90,7 +90,7 @@ const poolConfigPanel = hoistCmp.factory<ConnPoolMonitorModel>({
90
90
  width: '100%',
91
91
  enableSearch: true,
92
92
  showFullscreenButton: false,
93
- editorProps: {lineNumbers: false},
93
+ lineNumbers: false,
94
94
  value: JSON.stringify(model.poolConfiguration, null, 2)
95
95
  })
96
96
  });
@@ -57,7 +57,7 @@ const stats = hoistCmp.factory<DetailsModel>({
57
57
  height: '100%',
58
58
  enableSearch: true,
59
59
  showFullscreenButton: false,
60
- editorProps: {lineNumbers: false},
60
+ lineNumbers: false,
61
61
  value: fmtJson(stats, {replacer: timestampReplacer()})
62
62
  })
63
63
  );
@@ -42,7 +42,7 @@ export const detailPanel = hoistCmp.factory({
42
42
  width: '100%',
43
43
  height: '100%',
44
44
  showFullscreenButton: false,
45
- editorProps: {lineNumbers: false},
45
+ lineNumbers: false,
46
46
  value: fmtJson(selectedAdminStats, {replacer: timestampReplacer()})
47
47
  })
48
48
  })
@@ -139,7 +139,7 @@ export declare abstract class HoistBase {
139
139
  /** @returns true if this instance has been destroyed. */
140
140
  get isDestroyed(): boolean;
141
141
  /**
142
- * Clean up resources associated with this object.
142
+ * Clean up resources associated with this object
143
143
  */
144
144
  destroy(): void;
145
145
  }
@@ -1,29 +1,11 @@
1
1
  import { HoistInputProps } from '@xh/hoist/cmp/input';
2
2
  import { HoistProps, LayoutProps, PlainObject } from '@xh/hoist/core';
3
- import '@xh/hoist/desktop/register';
4
- import 'codemirror/addon/fold/brace-fold.js';
5
- import 'codemirror/addon/fold/foldcode.js';
6
- import 'codemirror/addon/fold/foldgutter.css';
7
- import 'codemirror/addon/fold/foldgutter.js';
8
- import 'codemirror/addon/lint/lint.css';
9
- import 'codemirror/addon/lint/lint.js';
10
- import 'codemirror/addon/scroll/simplescrollbars.css';
11
- import 'codemirror/addon/scroll/simplescrollbars.js';
12
- import 'codemirror/addon/search/searchcursor.js';
13
- import 'codemirror/addon/selection/mark-selection.js';
14
- import 'codemirror/lib/codemirror.css';
15
- import 'codemirror/theme/dracula.css';
16
3
  import './CodeInput.scss';
17
4
  export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps {
18
5
  /** True to focus the control on render. */
19
6
  autoFocus?: boolean;
20
7
  /** False to not commit on every change/keystroke, default true. */
21
8
  commitOnChange?: boolean;
22
- /**
23
- * Configuration object with any properties supported by the CodeMirror API.
24
- * @see {@link https://codemirror.net/doc/manual.html#api_configuration|CodeMirror Docs}
25
- */
26
- editorProps?: PlainObject;
27
9
  /**
28
10
  * True to enable case-insensitive searching within the input. Default false, except in
29
11
  * fullscreen mode, where search will be shown unless explicitly *disabled*. Note that
@@ -41,10 +23,10 @@ export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps
41
23
  linter?: (text: string) => any[];
42
24
  /**
43
25
  * A CodeMirror language mode - default none (plain-text). See the CodeMirror docs
44
- * ({@link https://codemirror.net/mode/}) regarding available modes.
45
- * Applications must import any mode they wish to enable.
26
+ * ({@link https://github.com/codemirror/language-data/blob/main/src/language-data.ts}) regarding available languages.
27
+ * String can be the alias or name
46
28
  */
47
- mode?: string;
29
+ language?: string;
48
30
  /**
49
31
  * True to prevent user modification of editor contents, while still allowing user to
50
32
  * focus, select, and copy contents.
@@ -65,6 +47,12 @@ export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps
65
47
  * action buttons show only when the input focused and float in the bottom-right corner.
66
48
  */
67
49
  showToolbar?: boolean;
50
+ /** False (default) to highlight active line in input. */
51
+ highlightActiveLine?: boolean;
52
+ /** True (default) to add line numbers to gutter. */
53
+ lineNumbers?: boolean | PlainObject;
54
+ /** False (default) to add line numbers to gutter. */
55
+ lineWrapping?: boolean | PlainObject;
68
56
  }
69
57
  /**
70
58
  * Code-editor style input, powered by CodeMirror. Displays a gutter with line numbers, mono-spaced
@@ -1,8 +1,20 @@
1
1
  import '@xh/hoist/desktop/register';
2
- import 'codemirror/mode/javascript/javascript';
2
+ import { Options, SchemaObject } from 'ajv';
3
3
  import { CodeInputProps } from './CodeInput';
4
- export type JsonInputProps = CodeInputProps;
4
+ export interface JsonInputProps extends CodeInputProps {
5
+ /**
6
+ * JSON Schema object used to validate the input JSON. Accepts any valid JSON Schema keywords
7
+ * supported by AJV, such as `type`, `properties`, `required`, and `additionalProperties`.
8
+ * @see https://ajv.js.org/json-schema.html
9
+ */
10
+ jsonSchema?: SchemaObject;
11
+ /**
12
+ * Configuration object with any properties supported by the AJV API.
13
+ * @see {@link https://ajv.js.org/options.html}
14
+ */
15
+ ajvProps?: Options;
16
+ }
5
17
  /**
6
18
  * Code-editor style input for editing and validating JSON, powered by CodeMirror.
7
19
  */
8
- export declare const JsonInput: import("react").FC<CodeInputProps>, jsonInput: import("@xh/hoist/core").ElementFactory<CodeInputProps>;
20
+ export declare const JsonInput: import("react").FC<JsonInputProps>, jsonInput: import("@xh/hoist/core").ElementFactory<JsonInputProps>;
@@ -0,0 +1,23 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+ export declare const color: {
4
+ chalky: string;
5
+ coral: string;
6
+ cyan: string;
7
+ invalid: string;
8
+ ivory: string;
9
+ stone: string;
10
+ malibu: string;
11
+ sage: string;
12
+ whiskey: string;
13
+ violet: string;
14
+ darkBackground: string;
15
+ highlightBackground: string;
16
+ background: string;
17
+ tooltipBackground: string;
18
+ selection: string;
19
+ cursor: string;
20
+ };
21
+ export declare const oneDarkTheme: Extension;
22
+ export declare const oneDarkHighlightStyle: HighlightStyle;
23
+ export declare const oneDark: Extension;
package/core/HoistBase.ts CHANGED
@@ -287,15 +287,9 @@ export abstract class HoistBase {
287
287
  }
288
288
 
289
289
  /**
290
- * Clean up resources associated with this object.
290
+ * Clean up resources associated with this object
291
291
  */
292
292
  destroy() {
293
- // If a model is being destroyed or has already been destroyed, no need to destroy it again.
294
- // Prevents stack overflow in case this model gets a managed reference chain back to itself.
295
- if (this.isDestroyed) {
296
- this.logWarn('Destruction skipped - this model is already destroyed.');
297
- return;
298
- }
299
293
  this._destroyed = true;
300
294
  this.disposers.forEach(f => f());
301
295
  this.managedInstances.forEach(i => XH.safeDestroy(i));
@@ -10,9 +10,8 @@ import {actionCol, calcActionColWidth} from '@xh/hoist/desktop/cmp/grid';
10
10
  import '@xh/hoist/desktop/register';
11
11
  import {Icon} from '@xh/hoist/icon';
12
12
  import {action, makeObservable, observable} from '@xh/hoist/mobx';
13
- import {isEmpty} from 'codemirror/src/util/misc';
14
13
  import {filesize} from 'filesize';
15
- import {find, uniqBy, without} from 'lodash';
14
+ import {find, isEmpty, uniqBy, without} from 'lodash';
16
15
 
17
16
  export class FileChooserModel extends HoistModel {
18
17
  @observable.ref
@@ -5,13 +5,14 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  .xh-app .xh-input {
8
- .CodeMirror {
8
+ .cm-editor {
9
9
  background-color: var(--xh-input-bg) !important;
10
10
  font-family: var(--xh-font-family-mono);
11
11
  font-size: var(--xh-font-size-px);
12
12
  line-height: calc(var(--xh-font-size-px) * 1.4);
13
+ height: 100%;
13
14
 
14
- pre.CodeMirror-line {
15
+ pre.cm-line {
15
16
  box-shadow: inset 0 0 0 0 rgba(16, 22, 26, 0.4);
16
17
  -webkit-box-shadow: inset 0 0 0 0 rgba(16, 22, 26, 0.4);
17
18
  }
@@ -21,7 +22,11 @@
21
22
  }
22
23
  }
23
24
 
24
- .CodeMirror-gutter {
25
+ .cm-gutters {
26
+ border: none;
27
+ }
28
+
29
+ .cm-gutter {
25
30
  background-color: var(--xh-bg-alt);
26
31
  }
27
32
  }
@@ -30,13 +35,13 @@
30
35
  height: 100px;
31
36
 
32
37
  &.xh-input-invalid {
33
- div.CodeMirror {
38
+ div.cm-editor {
34
39
  border: var(--xh-form-field-invalid-border);
35
40
  }
36
41
  }
37
42
 
38
43
  &.xh-input-disabled {
39
- .CodeMirror {
44
+ .cm-editor {
40
45
  background-color: var(--xh-input-disabled-bg);
41
46
  color: var(--xh-input-disabled-text-color);
42
47
  }
@@ -46,24 +51,25 @@
46
51
  position: relative;
47
52
  flex: 1;
48
53
 
49
- & > .CodeMirror {
50
- position: absolute;
54
+ & > .cm-editor {
55
+ position: absolute !important;
51
56
  top: 0;
52
57
  bottom: 0;
53
58
  left: 0;
54
59
  right: 0;
55
60
  height: 100%;
56
61
 
57
- .CodeMirror-selected {
62
+ .cm-editor-selected {
58
63
  background-color: var(--xh-bg-highlight);
59
64
  }
60
65
 
61
- .CodeMirror-scroll {
62
- box-sizing: content-box !important;
66
+ .cm-scroller {
67
+ overflow: auto;
68
+ //box-sizing: content-box !important;
63
69
  }
64
70
 
65
- .CodeMirror-simplescroll-vertical,
66
- .CodeMirror-simplescroll-horizontal {
71
+ .cm-editor-simplescroll-vertical,
72
+ .cm-editor-simplescroll-horizontal {
67
73
  background-color: var(--xh-scrollbar-bg);
68
74
  > div {
69
75
  background-color: var(--xh-scrollbar-thumb);
@@ -71,15 +77,15 @@
71
77
  }
72
78
  }
73
79
 
74
- .CodeMirror-scrollbar-filler {
80
+ .cm-editor-scrollbar-filler {
75
81
  background-color: var(--xh-scrollbar-bg);
76
82
  }
77
83
 
78
- .CodeMirror-simplescroll-horizontal {
84
+ .cm-editor-simplescroll-horizontal {
79
85
  height: var(--xh-scrollbar-size-px);
80
86
  }
81
87
 
82
- .CodeMirror-simplescroll-vertical {
88
+ .cm-editor-simplescroll-vertical {
83
89
  width: var(--xh-scrollbar-size-px);
84
90
  }
85
91
  }