tsquare 0.11.0 → 0.12.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.
@@ -0,0 +1,13 @@
1
+ import type { LanguageData } from "./language-data.js";
2
+ export interface EditorOptions {
3
+ /** The starting text. */
4
+ doc?: string;
5
+ /** Autocomplete for components, props, option words, icons and accents: pass languageData(). Without it, no autocomplete. */
6
+ data?: LanguageData;
7
+ /** Called with the whole text after every change. */
8
+ onChange?: (text: string) => void;
9
+ /** Line numbers in a gutter. Default true. */
10
+ lineNumbers?: boolean;
11
+ /** The editable area's accessible name. Default "Wireframe text". */
12
+ ariaLabel?: string;
13
+ }
@@ -0,0 +1,18 @@
1
+ import { EditorView } from "@codemirror/view";
2
+ import type { EditorOptions } from "./editor-options.js";
3
+ export interface Editor {
4
+ view: EditorView;
5
+ getText(): string;
6
+ /** Replace the whole document as one undoable step. */
7
+ setText(text: string): void;
8
+ setIssues(issues: {
9
+ line: number;
10
+ message: string;
11
+ }[]): void;
12
+ goToLine(line: number): void;
13
+ /** Scroll the cursor back into view (after the panels around the editor change size). */
14
+ revealCursor(): void;
15
+ /** Remove the editor and its listeners. */
16
+ destroy(): void;
17
+ }
18
+ export declare function createEditor(parent: HTMLElement, opts?: EditorOptions): Editor;
@@ -75,6 +75,28 @@
75
75
  --syn-punct: #9aa4b2;
76
76
  color-scheme: dark;
77
77
  }
78
+ /* the editor (tsquare/editor) reads these: the playground's own colors, light or dark */
79
+ :root {
80
+ --tsquare-editor-bg: var(--editor-bg);
81
+ --tsquare-editor-fg: var(--editor-ink);
82
+ --tsquare-editor-gutter: var(--muted);
83
+ --tsquare-editor-active-line: var(--editor-active);
84
+ --tsquare-editor-selection: var(--editor-selection);
85
+ --tsquare-editor-error: var(--error);
86
+ --tsquare-editor-popup-bg: var(--panel);
87
+ --tsquare-editor-popup-border: var(--line);
88
+ --tsquare-editor-popup-selected: var(--accent-soft);
89
+ --tsquare-editor-font: var(--mono);
90
+ --tsquare-editor-ui-font: var(--sans);
91
+ --tsquare-syntax-component: var(--syn-component);
92
+ --tsquare-syntax-string: var(--syn-string);
93
+ --tsquare-syntax-prop: var(--syn-prop);
94
+ --tsquare-syntax-number: var(--syn-number);
95
+ --tsquare-syntax-word: var(--syn-word);
96
+ --tsquare-syntax-color: var(--syn-color);
97
+ --tsquare-syntax-comment: var(--syn-comment);
98
+ --tsquare-syntax-punct: var(--syn-punct);
99
+ }
78
100
  * { box-sizing: border-box; }
79
101
  html, body { height: 100%; margin: 0; }
80
102
  body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); display: flex; flex-direction: column; }