@fusion.dev/helix 0.220.0 → 0.221.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.
@@ -12,7 +12,7 @@ import '../../toolbar/index.js';
12
12
  * header, a find bar and a status line each a strip on the raised surface,
13
13
  * one frame around them. It is 24rem tall unless `fill` is set or
14
14
  * `--code-editor-block-size` says otherwise. An engine draws inside it:
15
- * `@fusion.dev/helix-editor` themes CodeMirror's gutter, caret, selection and
15
+ * `@fusion.dev/helix-code-editor` themes CodeMirror's gutter, caret, selection and
16
16
  * syntax from your tokens, and draws a problem's line number in its tone.
17
17
  *
18
18
  * Set `fill` for an editor that fills a pane, such as one side of a split
@@ -20,7 +20,7 @@ import '../../toolbar/index.js';
20
20
  *
21
21
  * @since 0.216.0
22
22
  * @status experimental
23
- * @category inputs
23
+ * @category editors
24
24
  * @aliases Code editor, CodeMirror, File editor, IDE, Monaco
25
25
  * @documentation https://fusion.dev/helix/components/code-editor
26
26
  *
@@ -0,0 +1 @@
1
+ export * from './root/editor-root.js';
@@ -0,0 +1 @@
1
+ export * from './root/editor-root.js';
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,2 @@
1
+ import { createSheet } from '@fusion.dev/helix-core';
2
+ export const styles = createSheet(`:host {display: flex;flex-direction: column}:host([fill]) {inset: 0;position: absolute}[part="region"] {background-color: var(--editor-background-color, var(--helix-color-background));border: var(--helix-border-thin) solid var(--editor-border-color, var(--helix-color-border));border-radius: var(--editor-radius, var(--helix-radii-lg));box-sizing: border-box;display: flex;flex: 1 1 auto;flex-direction: column;min-block-size: var(--editor-min-block-size, 12rem);overflow: clip;transition: border-color var(--helix-duration-fast) var(--helix-easing-standard)}:host([fill]) [part="region"] {block-size: 100%;min-block-size: 0}:host([separation="plain"]) [part="region"] {border: none;border-radius: 0}:host(:state(document-focused):not([separation="plain"])) [part="region"] {border-color: var(--helix-color-primary);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: 0}[part="header"] {--helix-size-icon: var(--helix-size-icon-sm);--helix-size-icon-loose: calc(var(--helix-size-icon) * 1.2);--helix-size-icon-tight: calc(var(--helix-size-icon) * 0.8);--helix-size-control: var(--helix-size-control-sm);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);background-color: var(--editor-header-background-color, var(--helix-color-surface-raised));border-block-end: var(--helix-border-thin) solid var(--editor-border-color, var(--helix-color-border));box-sizing: border-box;container-type: inline-size;display: flex;flex: 0 0 auto;flex-direction: column;gap: var(--helix-space-2xs);inset-block-start: var(--editor-header-offset, 0);padding: var(--helix-space-2xs) var(--helix-space-xs);position: sticky;z-index: 1}[part="header"][hidden] {display: none}[part="controls"] {--toolbar-separator-gap: var(--helix-space-2xs);display: flex}[part="controls"]::part(toolbar) {flex: 1 1 auto;flex-wrap: wrap;row-gap: var(--helix-space-2xs)}[part="tools"] {display: flex;gap: var(--helix-space-2xs)}[part="divider"] {align-self: center;block-size: calc(var(--helix-size-control) * 0.6)}@container (inline-size < 40rem) {[part="controls"] {--toolbar-gap: var(--helix-space-sm)}[part="divider"] {display: none}}[aria-pressed="true"], :host(:state(find-open)) [part="find-toggle"] {--icon-button-background-color: color-mix(in oklab, var(--helix-color-foreground) 12%, transparent);--icon-button-foreground-color: var(--helix-color-foreground)}[part="block-name"] {display: inline-grid;justify-items: start}[part="block-name"] > span {grid-area: 1 / 1}[part="block-name"] > [hidden] {display: block;visibility: hidden}[part="actions"] {display: flex;gap: var(--helix-space-2xs);margin-inline-start: auto}[part="actions"][hidden] {display: none}[part="link-bar"] {--helix-size-control: calc(var(--helix-size-control-sm) * 0.8);--helix-size-control-loose: calc(var(--helix-size-control) * 1.2);--helix-size-control-tight: calc(var(--helix-size-control) * 0.8);align-items: center;display: flex;gap: var(--helix-space-2xs);min-inline-size: 0;padding-inline-start: var(--helix-space-2xs)}[part="link-bar"][hidden] {display: none}[part="link-field"] {appearance: none;background-color: var(--editor-background-color, var(--helix-color-background));block-size: var(--helix-size-control);border: var(--helix-border-thin) solid var(--editor-border-color, var(--helix-color-border));border-radius: var(--helix-radii-sm);box-sizing: border-box;color: var(--helix-color-foreground);flex: 1 1 12rem;font-family: var(--helix-font-sans);font-size: max(var(--helix-text-field-min), var(--helix-text-sm));max-inline-size: 28rem;min-inline-size: 0;padding-inline: var(--helix-space-xs)}[part="link-field"]:focus-visible {outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: var(--helix-size-focus-offset)}[part="link-controls"] {flex: 0 0 auto}[part="find"] {--find-background-color: transparent;--find-border-color: var(--editor-border-color, var(--helix-color-border));--find-field-background-color: var(--editor-background-color, var(--helix-color-background))}[part="find"]:not(:state(open)) {display: none}[part="find"]::part(bar) {border-block-end: none;padding-block: 0;padding-inline: var(--helix-space-2xs) 0}[part="viewport"] {color: var(--helix-color-foreground);display: flex;flex: 1 1 auto;flex-direction: column;min-block-size: 0}:host([fill]) [part="viewport"] {overflow: auto}[part="viewport"] ::slotted(*) {box-sizing: border-box;caret-color: var(--helix-color-foreground);flex: 1 1 auto;font-family: var(--helix-font-sans);font-size: var(--helix-text-md);line-height: var(--helix-leading-normal);outline: none;padding-block: var(--editor-padding, var(--helix-space-lg));padding-inline: max(var(--editor-padding, var(--helix-space-lg)), calc((100% - var(--editor-measure, 72ch)) / 2))}[part="footer"] {color: var(--helix-color-foreground-muted);font-family: var(--helix-font-sans);font-size: var(--helix-text-xs)}@media print {[part="header"] {display: none}[part="region"], :host([fill]) [part="viewport"] {overflow: visible}}`);
@@ -0,0 +1,62 @@
1
+ import { HelixHeadlessEditor } from '@fusion.dev/helix-headless/editor';
2
+ import type { CSSResultGroup } from 'lit';
3
+ import '../../button/index.js';
4
+ import '../../divider/index.js';
5
+ import '../../find/index.js';
6
+ import '../../icon-button/index.js';
7
+ import '../../menu/index.js';
8
+ import '../../toolbar/index.js';
9
+ /**
10
+ * @summary A frame around a document that ProseMirror or another editor draws.
11
+ *
12
+ * @description
13
+ * Drawn as Code Editor is: the document on the page's ground, and the toolbar
14
+ * a strip on the raised surface, one frame around them. The strip stays at the
15
+ * top of the page while a long document scrolls under it, and the frame grows
16
+ * with the document from `--editor-min-block-size`. Set `fill` for an editor
17
+ * that fills a pane, where the document scrolls inside the frame.
18
+ *
19
+ * The document's headings, lists, quotes, code, and tables are drawn by the
20
+ * base layer's `data-prose` rules, so it reads as your docs and chat replies
21
+ * do. Write `data-prose` on the document so the base layer draws it before a
22
+ * renderer connects, and `connectEditor` writes it too. Its lines keep to a
23
+ * readable length, `--editor-measure`, centered in a wide frame.
24
+ *
25
+ * @since 0.221.0
26
+ * @status experimental
27
+ * @category editors
28
+ * @aliases Rich text editor, WYSIWYG, Document editor, ProseMirror, Block editor
29
+ * @documentation https://fusion.dev/helix/components/editor
30
+ *
31
+ * @cssproperty --editor-background-color - The ground the document is drawn on. Defaults to the page's background.
32
+ * @cssproperty --editor-border-color - The frame's edge and the line under the toolbar.
33
+ * @cssproperty --editor-header-background-color - The fill of the toolbar's strip.
34
+ * @cssproperty --editor-header-offset - How far below the top of the page the toolbar stays while the document scrolls, such as the height of your own fixed header. `0` unless set.
35
+ * @cssproperty --editor-measure - The longest a line of the document runs, as a length: `72ch` unless set.
36
+ * @cssproperty --editor-min-block-size - The frame's least height, which it grows from with the document: `12rem` unless set. Ignored with `fill`.
37
+ * @cssproperty --editor-padding - The space around the document, inside the frame.
38
+ * @cssproperty --editor-radius - The frame's corner radius.
39
+ */
40
+ export declare class HelixEditor extends HelixHeadlessEditor {
41
+ static tier: string;
42
+ /**
43
+ * Covers the container instead of growing with the document, for an editor
44
+ * that fills a pane, such as one side of a split view. The document scrolls
45
+ * inside the frame. The container needs a position, such as
46
+ * `position: relative`.
47
+ */
48
+ fill: boolean;
49
+ /**
50
+ * How the frame stands off the page. Unset, it is outlined. `plain` draws
51
+ * no edge or corners, for a document that fills a page or a pane of its own.
52
+ */
53
+ separation?: 'outlined' | 'plain';
54
+ /** The block menu's button is drawn as the tools beside it are. */
55
+ protected get blockEmphasis(): 'ghost' | undefined;
56
+ static styles: CSSResultGroup;
57
+ }
58
+ declare global {
59
+ interface HTMLElementTagNameMap {
60
+ 'helix-editor': HelixEditor;
61
+ }
62
+ }
@@ -0,0 +1,33 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement } from '@fusion.dev/helix-core';
3
+ import { HelixHeadlessEditor } from '@fusion.dev/helix-headless/editor';
4
+ import { property } from 'lit/decorators.js';
5
+ import { styles as glyphStyles } from '../../shared/glyph/glyph.css.js';
6
+ import { styles } from './editor-root.css.js';
7
+ import '../../button/index.js';
8
+ import '../../divider/index.js';
9
+ import '../../find/index.js';
10
+ import '../../icon-button/index.js';
11
+ import '../../menu/index.js';
12
+ import '../../toolbar/index.js';
13
+ let HelixEditor = class HelixEditor extends HelixHeadlessEditor {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.fill = false;
17
+ }
18
+ static { this.tier = 'helix-'; }
19
+ get blockEmphasis() {
20
+ return 'ghost';
21
+ }
22
+ static { this.styles = [glyphStyles, styles]; }
23
+ };
24
+ __decorate([
25
+ property({ reflect: true, type: Boolean })
26
+ ], HelixEditor.prototype, "fill", void 0);
27
+ __decorate([
28
+ property({ reflect: true })
29
+ ], HelixEditor.prototype, "separation", void 0);
30
+ HelixEditor = __decorate([
31
+ customElement('helix-editor')
32
+ ], HelixEditor);
33
+ export { HelixEditor };
@@ -134,6 +134,7 @@ registerElementEvents({
134
134
  'helix-drawer': ['close', 'helix-before-close', 'helix-before-open', 'toggle'],
135
135
  'helix-drilldown': ['helix-navigate', 'helix-select'],
136
136
  'helix-drilldown-item': ['helix-select'],
137
+ 'helix-editor': ['helix-found'],
137
138
  'helix-file-input': ['change', 'helix-before-change', 'helix-reject', 'input'],
138
139
  'helix-filter-chip': ['helix-dismiss'],
139
140
  'helix-filter-input': [
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export * from './divider/index.js';
43
43
  export * from './donut-chart/index.js';
44
44
  export * from './drawer/index.js';
45
45
  export * from './drilldown/index.js';
46
+ export * from './editor/index.js';
46
47
  export * from './empty/index.js';
47
48
  export * from './file-input/index.js';
48
49
  export * from './filter-input/index.js';
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ export * from './divider/index.js';
38
38
  export * from './donut-chart/index.js';
39
39
  export * from './drawer/index.js';
40
40
  export * from './drilldown/index.js';
41
+ export * from './editor/index.js';
41
42
  export * from './empty/index.js';
42
43
  export * from './file-input/index.js';
43
44
  export * from './filter-input/index.js';