@fusion.dev/helix-headless 0.220.0 → 0.222.0

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 @@ import '../../find/index.js';
5
5
  import '../../icon-button/index.js';
6
6
  import '../../toolbar/index.js';
7
7
  /** A problem in the text, from a linter or a language server, by where it is. */
8
- export interface EditorDiagnostic {
8
+ export interface CodeEditorDiagnostic {
9
9
  /** Where it starts and ends, as offsets into the value. */
10
10
  from: number;
11
11
  message: string;
@@ -14,8 +14,8 @@ export interface EditorDiagnostic {
14
14
  tone?: 'danger' | 'info' | 'warning';
15
15
  }
16
16
  /** What an editor shows, which an engine draws. */
17
- export interface EditorEngineState {
18
- diagnostics: readonly EditorDiagnostic[];
17
+ export interface CodeEditorEngineState {
18
+ diagnostics: readonly CodeEditorDiagnostic[];
19
19
  /** The editor's name, for the engine's text area. */
20
20
  label: string;
21
21
  /** The language to highlight, such as `ts`, `css`, `md` or `rust`. Empty is plain text. */
@@ -27,14 +27,14 @@ export interface EditorEngineState {
27
27
  wrap: boolean;
28
28
  }
29
29
  /** What the editor tells the engine, which the engine calls as the reader works. */
30
- export interface EditorEngineListeners {
30
+ export interface CodeEditorEngineListeners {
31
31
  /** The caret or selection moved, as offsets into the value. */
32
32
  caret?(from: number, to: number): void;
33
33
  /** The reader changed the text. Returns whether the change stands, so the engine can refuse one the page refused. */
34
34
  change(value: string): boolean;
35
35
  }
36
36
  /** What the find bar asks an engine to look for. */
37
- export interface EditorFindQuery {
37
+ export interface CodeEditorFindQuery {
38
38
  caseSensitive: boolean;
39
39
  regex: boolean;
40
40
  /** What Replace puts in place of a match. */
@@ -43,12 +43,12 @@ export interface EditorFindQuery {
43
43
  wholeWord: boolean;
44
44
  }
45
45
  /** Where a search stands: how many matches, and which is selected, counting from 0, or -1 for none. */
46
- export interface EditorFindResult {
46
+ export interface CodeEditorFindResult {
47
47
  count: number;
48
48
  index: number;
49
49
  }
50
50
  /** An engine drawing one editor, which the editor drives. */
51
- export interface EditorEngineView {
51
+ export interface CodeEditorEngineView {
52
52
  /** Takes the engine out of the page. */
53
53
  destroy(): void;
54
54
  /**
@@ -56,27 +56,27 @@ export interface EditorEngineView {
56
56
  * or previous from the selected one. Marks every match while the find bar
57
57
  * is open.
58
58
  */
59
- find?(query: EditorFindQuery, direction: 'first' | 'next' | 'previous'): EditorFindResult;
59
+ find?(query: CodeEditorFindQuery, direction: 'first' | 'next' | 'previous'): CodeEditorFindResult;
60
60
  /** Takes the marks a search drew away, as the find bar closes. */
61
61
  findEnd?(): void;
62
62
  /** Puts the caret in the engine's text area. */
63
63
  focus?(): void;
64
64
  /** Replaces the selected match, or every match, and returns where the search stands after. */
65
- replace?(query: EditorFindQuery, all: boolean): EditorFindResult;
65
+ replace?(query: CodeEditorFindQuery, all: boolean): CodeEditorFindResult;
66
66
  /** Selects a range, scrolls it into view and puts the caret there. */
67
67
  select?(from: number, to: number): void;
68
68
  /** Shows a new state: a value set from outside, a language, diagnostics. */
69
- update(state: EditorEngineState): void;
69
+ update(state: CodeEditorEngineState): void;
70
70
  }
71
71
  /**
72
72
  * Something that draws a code editor, such as CodeMirror through
73
- * `@fusion.dev/helix-editor`. The editor hands it an element to draw in.
73
+ * `@fusion.dev/helix-code-editor`. The editor hands it an element to draw in.
74
74
  */
75
- export interface EditorEngine {
76
- mount(parent: HTMLElement, state: EditorEngineState, listeners: EditorEngineListeners): EditorEngineView;
75
+ export interface CodeEditorEngine {
76
+ mount(parent: HTMLElement, state: CodeEditorEngineState, listeners: CodeEditorEngineListeners): CodeEditorEngineView;
77
77
  }
78
78
  /** Each diagnostic's line, counted from 1, by its start, from one pass over the value. */
79
- export declare const diagnosticLines: (value: string, diagnostics: readonly EditorDiagnostic[]) => number[];
79
+ export declare const diagnosticLines: (value: string, diagnostics: readonly CodeEditorDiagnostic[]) => number[];
80
80
  /** The line and column an offset is at, each counted from 1. */
81
81
  export declare const positionOf: (value: string, at: number) => {
82
82
  column: number;
@@ -92,8 +92,8 @@ declare const HelixHeadlessCodeEditor_base: (new (...args: any[]) => import("@fu
92
92
  * A pane for working on a file: a header with its name, its language and the
93
93
  * page's own actions, the code, the problems in it, and a status line that
94
94
  * says where the caret is. On its own the code is a `<textarea>` in the code
95
- * face. Connect an engine and it draws the code instead: `connectEditor` from
96
- * `@fusion.dev/helix-editor` connects CodeMirror, with highlighting in your
95
+ * face. Connect an engine and it draws the code instead: `connectCodeEditor` from
96
+ * `@fusion.dev/helix-code-editor` connects CodeMirror, with highlighting in your
97
97
  * theme's syntax colors, line numbers, folding, bracket matching and history.
98
98
  * The value, the form, validation and the events stay the editor's, so a page
99
99
  * reads and writes it the same either way.
@@ -119,7 +119,7 @@ declare const HelixHeadlessCodeEditor_base: (new (...args: any[]) => import("@fu
119
119
  *
120
120
  * @since 0.216.0
121
121
  * @status experimental
122
- * @category inputs
122
+ * @category editors
123
123
  * @aliases Code editor, CodeMirror, File editor, IDE, Monaco
124
124
  * @documentation https://fusion.dev/helix/components/code-editor
125
125
  *
@@ -235,14 +235,14 @@ export declare class HelixHeadlessCodeEditor extends HelixHeadlessCodeEditor_bas
235
235
  /** How one problem in the list reads. `{line}` is its line and `{message}` what it says. */
236
236
  diagnosticLabel: string;
237
237
  /** The problems in the text, each underlined and listed under the editor. */
238
- diagnostics: readonly EditorDiagnostic[];
238
+ diagnostics: readonly CodeEditorDiagnostic[];
239
239
  /** The list of problems' name. */
240
240
  diagnosticsLabel: string;
241
241
  /**
242
242
  * What draws the editor, such as `codeMirrorEngine()` from
243
- * `@fusion.dev/helix-editor`. Absent, the editor is a plain text field.
243
+ * `@fusion.dev/helix-code-editor`. Absent, the editor is a plain text field.
244
244
  */
245
- engine: EditorEngine | undefined;
245
+ engine: CodeEditorEngine | undefined;
246
246
  /** The name of the find bar's Close button. */
247
247
  findCloseLabel: string;
248
248
  /** The name of the find bar's toolbar, read by screen readers. */
@@ -0,0 +1 @@
1
+ export * from './root/editor-root.js';
@@ -0,0 +1 @@
1
+ export * from './root/editor-root.js';