@xh/hoist 79.0.0-SNAPSHOT.1765828263630 → 79.0.0-SNAPSHOT.1765828486265

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,32 +143,6 @@
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
-
172
146
  ## 76.1.0 - 2025-10-17
173
147
 
174
148
  ### 🎁 New Features
@@ -90,7 +90,7 @@ const poolConfigPanel = hoistCmp.factory<ConnPoolMonitorModel>({
90
90
  width: '100%',
91
91
  enableSearch: true,
92
92
  showFullscreenButton: false,
93
- lineNumbers: false,
93
+ editorProps: {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
- lineNumbers: false,
60
+ editorProps: {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
- lineNumbers: false,
45
+ editorProps: {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,11 +1,29 @@
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';
3
16
  import './CodeInput.scss';
4
17
  export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps {
5
18
  /** True to focus the control on render. */
6
19
  autoFocus?: boolean;
7
20
  /** False to not commit on every change/keystroke, default true. */
8
21
  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;
9
27
  /**
10
28
  * True to enable case-insensitive searching within the input. Default false, except in
11
29
  * fullscreen mode, where search will be shown unless explicitly *disabled*. Note that
@@ -23,10 +41,10 @@ export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps
23
41
  linter?: (text: string) => any[];
24
42
  /**
25
43
  * A CodeMirror language mode - default none (plain-text). See the CodeMirror docs
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
44
+ * ({@link https://codemirror.net/mode/}) regarding available modes.
45
+ * Applications must import any mode they wish to enable.
28
46
  */
29
- language?: string;
47
+ mode?: string;
30
48
  /**
31
49
  * True to prevent user modification of editor contents, while still allowing user to
32
50
  * focus, select, and copy contents.
@@ -47,12 +65,6 @@ export interface CodeInputProps extends HoistProps, HoistInputProps, LayoutProps
47
65
  * action buttons show only when the input focused and float in the bottom-right corner.
48
66
  */
49
67
  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;
56
68
  }
57
69
  /**
58
70
  * Code-editor style input, powered by CodeMirror. Displays a gutter with line numbers, mono-spaced
@@ -1,20 +1,8 @@
1
1
  import '@xh/hoist/desktop/register';
2
- import { Options, SchemaObject } from 'ajv';
2
+ import 'codemirror/mode/javascript/javascript';
3
3
  import { CodeInputProps } from './CodeInput';
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
- }
4
+ export type JsonInputProps = CodeInputProps;
17
5
  /**
18
6
  * Code-editor style input for editing and validating JSON, powered by CodeMirror.
19
7
  */
20
- export declare const JsonInput: import("react").FC<JsonInputProps>, jsonInput: import("@xh/hoist/core").ElementFactory<JsonInputProps>;
8
+ export declare const JsonInput: import("react").FC<CodeInputProps>, jsonInput: import("@xh/hoist/core").ElementFactory<CodeInputProps>;
package/core/HoistBase.ts CHANGED
@@ -287,9 +287,15 @@ 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
+ }
293
299
  this._destroyed = true;
294
300
  this.disposers.forEach(f => f());
295
301
  this.managedInstances.forEach(i => XH.safeDestroy(i));
@@ -10,8 +10,9 @@ 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';
13
14
  import {filesize} from 'filesize';
14
- import {find, isEmpty, uniqBy, without} from 'lodash';
15
+ import {find, uniqBy, without} from 'lodash';
15
16
 
16
17
  export class FileChooserModel extends HoistModel {
17
18
  @observable.ref
@@ -5,14 +5,13 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  .xh-app .xh-input {
8
- .cm-editor {
8
+ .CodeMirror {
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%;
14
13
 
15
- pre.cm-line {
14
+ pre.CodeMirror-line {
16
15
  box-shadow: inset 0 0 0 0 rgba(16, 22, 26, 0.4);
17
16
  -webkit-box-shadow: inset 0 0 0 0 rgba(16, 22, 26, 0.4);
18
17
  }
@@ -22,11 +21,7 @@
22
21
  }
23
22
  }
24
23
 
25
- .cm-gutters {
26
- border: none;
27
- }
28
-
29
- .cm-gutter {
24
+ .CodeMirror-gutter {
30
25
  background-color: var(--xh-bg-alt);
31
26
  }
32
27
  }
@@ -35,13 +30,13 @@
35
30
  height: 100px;
36
31
 
37
32
  &.xh-input-invalid {
38
- div.cm-editor {
33
+ div.CodeMirror {
39
34
  border: var(--xh-form-field-invalid-border);
40
35
  }
41
36
  }
42
37
 
43
38
  &.xh-input-disabled {
44
- .cm-editor {
39
+ .CodeMirror {
45
40
  background-color: var(--xh-input-disabled-bg);
46
41
  color: var(--xh-input-disabled-text-color);
47
42
  }
@@ -51,25 +46,24 @@
51
46
  position: relative;
52
47
  flex: 1;
53
48
 
54
- & > .cm-editor {
55
- position: absolute !important;
49
+ & > .CodeMirror {
50
+ position: absolute;
56
51
  top: 0;
57
52
  bottom: 0;
58
53
  left: 0;
59
54
  right: 0;
60
55
  height: 100%;
61
56
 
62
- .cm-editor-selected {
57
+ .CodeMirror-selected {
63
58
  background-color: var(--xh-bg-highlight);
64
59
  }
65
60
 
66
- .cm-scroller {
67
- overflow: auto;
68
- //box-sizing: content-box !important;
61
+ .CodeMirror-scroll {
62
+ box-sizing: content-box !important;
69
63
  }
70
64
 
71
- .cm-editor-simplescroll-vertical,
72
- .cm-editor-simplescroll-horizontal {
65
+ .CodeMirror-simplescroll-vertical,
66
+ .CodeMirror-simplescroll-horizontal {
73
67
  background-color: var(--xh-scrollbar-bg);
74
68
  > div {
75
69
  background-color: var(--xh-scrollbar-thumb);
@@ -77,15 +71,15 @@
77
71
  }
78
72
  }
79
73
 
80
- .cm-editor-scrollbar-filler {
74
+ .CodeMirror-scrollbar-filler {
81
75
  background-color: var(--xh-scrollbar-bg);
82
76
  }
83
77
 
84
- .cm-editor-simplescroll-horizontal {
78
+ .CodeMirror-simplescroll-horizontal {
85
79
  height: var(--xh-scrollbar-size-px);
86
80
  }
87
81
 
88
- .cm-editor-simplescroll-vertical {
82
+ .CodeMirror-simplescroll-vertical {
89
83
  width: var(--xh-scrollbar-size-px);
90
84
  }
91
85
  }