@vanduo-oss/vd3-cbun 1.0.0 → 1.2.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.
- package/CHANGELOG.md +51 -0
- package/README.md +31 -17
- package/SKILL.md +57 -6
- package/dist/code-editor/core.d.ts +128 -0
- package/dist/code-editor/index.cjs +1351 -0
- package/dist/code-editor/index.cjs.map +7 -0
- package/dist/code-editor/index.d.ts +18 -0
- package/dist/code-editor/index.js +1328 -0
- package/dist/code-editor/index.js.map +7 -0
- package/dist/code-editor/vd3-code-editor.css +316 -0
- package/dist/code-editor/vue.d.ts +67 -0
- package/dist/draw/core.d.ts +249 -0
- package/dist/draw/index.cjs +2239 -0
- package/dist/draw/index.cjs.map +7 -0
- package/dist/draw/index.d.ts +38 -0
- package/dist/draw/index.js +2216 -0
- package/dist/draw/index.js.map +7 -0
- package/dist/draw/vd3-draw.css +301 -0
- package/dist/draw/vue.d.ts +68 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +2 -2
- package/dist/meta.json +473 -4
- package/package.json +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,57 @@ All notable changes to `@vanduo-oss/vd3-cbun` are documented here. This file
|
|
|
4
4
|
tracks the PACKAGE only — never docs-site content. Per-component VERSION
|
|
5
5
|
constants are listed alongside each bundle release.
|
|
6
6
|
|
|
7
|
+
## 1.2.0 — 2026-07-22
|
|
8
|
+
|
|
9
|
+
Adds a sixth component, **`draw`** (`@vanduo-oss/vd3-cbun/draw` + `./draw/css`),
|
|
10
|
+
exposing `VdDraw` — a first-party **vector drawing tool** (SVG world group with
|
|
11
|
+
matrix pan/zoom, the flowchart architecture family) built around a
|
|
12
|
+
dependency-free **brush engine**: freehand strokes are variable-width, smoothed,
|
|
13
|
+
pressure/velocity-driven filled outline paths. It ships **brush presets** (`pen`,
|
|
14
|
+
`pencil`, `marker`, `highlighter`, `calligraphy` — `BRUSH_PRESETS`), a **color
|
|
15
|
+
palette** (swatches + custom color, opacity, brush size, recent colors), a
|
|
16
|
+
**stroke eraser**, and secondary diagram shapes (rectangle / ellipse / arrow /
|
|
17
|
+
text / sticky) with z-order, grouping, copy/paste/duplicate, snapping guides,
|
|
18
|
+
keyboard shortcuts, and PNG + SVG export. The built-in toolbar uses inline
|
|
19
|
+
Phosphor icons. Undo/redo funnels through a single `emitChange → recordHistory`
|
|
20
|
+
whole-document choke point (pan/zoom not recorded); `toJSON()` / `load()`
|
|
21
|
+
serialize `{ version, viewport, shapes }` — freehand strokes carry `brush` /
|
|
22
|
+
`color` / `opacity` / per-point `pressure` — through a `normalizeDocument()`
|
|
23
|
+
migration gateway (a v1 constant-width freehand loads as the default pen brush).
|
|
24
|
+
Chrome theming is CSS-only through a `--vd-draw-*` → `--vd-*` layer; marks carry
|
|
25
|
+
an explicit picked color. No new runtime dependency — `vue` stays the only peer,
|
|
26
|
+
and every input bundled for the entry lives under `src/draw/` (the metafile
|
|
27
|
+
isolation guard passes). The five existing components are untouched (tree-shake
|
|
28
|
+
contract). Additive minor: bundle `1.1.0 → 1.2.0`.
|
|
29
|
+
|
|
30
|
+
Component versions in this release: **charts 1.0.0, code-editor 1.0.0, draw
|
|
31
|
+
1.1.0, flowchart 1.2.0, hex-grid 1.0.0, music-player 1.0.0** — `draw` entered the
|
|
32
|
+
`component-versions.json` manifest at `1.0.0`, and its serialization (freehand
|
|
33
|
+
`brush` / `color` / `pressure`) takes `VD_DRAW_VERSION` to `1.1.0`; the bundle's own semver
|
|
34
|
+
stays decoupled from the per-component `VERSION` constants.
|
|
35
|
+
|
|
36
|
+
## 1.1.0 — 2026-07-21
|
|
37
|
+
|
|
38
|
+
Adds a fifth component, **`code-editor`** (`@vanduo-oss/vd3-cbun/code-editor` +
|
|
39
|
+
`./code-editor/css`), exposing `VdCodeEditor` — a lightweight, first-party
|
|
40
|
+
**textarea-overlay** code editor: a native `<textarea>` rendered transparently
|
|
41
|
+
over a `<pre>` highlight layer painted by homegrown, ReDoS-safe tokenizers for
|
|
42
|
+
JavaScript/TypeScript, HTML, CSS, JSON, Markdown, Shell, and Python. No
|
|
43
|
+
third-party editor and no new runtime dependency — `vue` stays the only peer, and
|
|
44
|
+
every input bundled for the entry lives under `src/code-editor/` (the metafile
|
|
45
|
+
isolation guard passes). v1 features: line-number gutter + active-line highlight,
|
|
46
|
+
auto-indent + Tab-to-spaces + bracket/quote auto-close, read-only mode +
|
|
47
|
+
copy-to-clipboard, empty-state placeholder, and a large-input performance guard.
|
|
48
|
+
Rendering is escaping-safe and `innerHTML`-free (DOM nodes via `replaceChildren`),
|
|
49
|
+
and the component is SSR-safe (DOM touched only on mount). The four existing
|
|
50
|
+
components are untouched (tree-shake contract). Additive minor: bundle
|
|
51
|
+
`1.0.0 → 1.1.0`.
|
|
52
|
+
|
|
53
|
+
Component versions in this release: **charts 1.0.0, code-editor 1.0.0, flowchart
|
|
54
|
+
1.2.0, hex-grid 1.0.0, music-player 1.0.0** — the new `code-editor` enters the
|
|
55
|
+
`component-versions.json` manifest at `1.0.0`; the bundle's own semver stays
|
|
56
|
+
decoupled from the per-component `VERSION` constants.
|
|
57
|
+
|
|
7
58
|
## 1.0.0 — 2026-07-14
|
|
8
59
|
|
|
9
60
|
First public release of `@vanduo-oss/vd3-cbun` — the Vanduo **components bundle**
|
package/README.md
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
[](./LICENSE)
|
|
4
4
|
|
|
5
|
-
The Vanduo **components bundle** for the vd3 line: Vue3-only charts,
|
|
6
|
-
hex-grid, and music-player consolidated into ONE package with
|
|
7
|
-
subpath exports. It replaces the four per-repo publishes
|
|
8
|
-
`@vanduo-oss/
|
|
9
|
-
of the old line.
|
|
10
|
-
|
|
11
|
-
**Status: 1.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
The Vanduo **components bundle** for the vd3 line: Vue3-only charts, code-editor,
|
|
6
|
+
draw, flowchart, hex-grid, and music-player consolidated into ONE package with
|
|
7
|
+
tree-shakeable subpath exports. It replaces the four per-repo publishes
|
|
8
|
+
(`@vanduo-oss/charts`, `@vanduo-oss/flowchart`, `@vanduo-oss/hex-grid`,
|
|
9
|
+
`@vanduo-oss/music-player`) of the old line.
|
|
10
|
+
|
|
11
|
+
**Status: 1.2.0.** Six Vue3-only component families — charts, code-editor, draw,
|
|
12
|
+
flowchart, hex-grid, music-player — each on its own tree-shakeable subpath, with
|
|
13
|
+
the esbuild metafile isolation guard in place. (1.2.0 adds the first-party
|
|
14
|
+
`draw` vector drawing tool — a brush engine + color palette; see the
|
|
15
|
+
[changelog](./CHANGELOG.md).)
|
|
15
16
|
|
|
16
17
|
## Install
|
|
17
18
|
|
|
@@ -32,6 +33,12 @@ Each component lives on its own subpath — importing one never pulls in another
|
|
|
32
33
|
import { VdChart } from '@vanduo-oss/vd3-cbun/charts';
|
|
33
34
|
import '@vanduo-oss/vd3-cbun/charts/css';
|
|
34
35
|
|
|
36
|
+
import { VdCodeEditor } from '@vanduo-oss/vd3-cbun/code-editor';
|
|
37
|
+
import '@vanduo-oss/vd3-cbun/code-editor/css';
|
|
38
|
+
|
|
39
|
+
import { VdDraw } from '@vanduo-oss/vd3-cbun/draw';
|
|
40
|
+
import '@vanduo-oss/vd3-cbun/draw/css';
|
|
41
|
+
|
|
35
42
|
import { VdFlowchart } from '@vanduo-oss/vd3-cbun/flowchart';
|
|
36
43
|
import '@vanduo-oss/vd3-cbun/flowchart/css';
|
|
37
44
|
|
|
@@ -50,7 +57,8 @@ import { VD3_CBUN_VERSIONS } from '@vanduo-oss/vd3-cbun';
|
|
|
50
57
|
|
|
51
58
|
Each subpath entry (`dist/<component>/index.js`) re-exports **both** the Vue
|
|
52
59
|
component and its framework-agnostic core (the core aliased with a `Core`
|
|
53
|
-
suffix where the names collide — `
|
|
60
|
+
suffix where the names collide — `VdCodeEditorCore`, `VdFlowchartCore`,
|
|
61
|
+
`VdHexGridCore`). Isolation
|
|
54
62
|
is not a convention but a build guard: `scripts/build.js` bundles every entry
|
|
55
63
|
separately with `vue` external, emits an esbuild metafile (`dist/meta.json`),
|
|
56
64
|
and **fails the build** if any component entry's inputs reach outside its own
|
|
@@ -74,16 +82,18 @@ Notes:
|
|
|
74
82
|
The bundle's own semver (`package.json` version) is decoupled from the
|
|
75
83
|
components inside it. Each component carries a VERSION constant tracked in
|
|
76
84
|
`component-versions.json` at the repo root and asserted in tests against the
|
|
77
|
-
exported `VD3_CBUN_VERSIONS` map.
|
|
78
|
-
music-player
|
|
85
|
+
exported `VD3_CBUN_VERSIONS` map. charts, code-editor, hex-grid, and
|
|
86
|
+
music-player sit at `1.0.0`, draw at `1.1.0`; **flowchart continues its old-line lineage at
|
|
79
87
|
`1.2.0`** because `VD_FLOWCHART_VERSION` is load-bearing — it is serialized
|
|
80
|
-
into user documents via `toJSON().version`.
|
|
88
|
+
into user documents via `toJSON().version`. A new component enters the manifest
|
|
89
|
+
at `1.0.0` (`draw` did, in bundle 1.2.0).
|
|
81
90
|
|
|
82
91
|
## Theming
|
|
83
92
|
|
|
84
|
-
All
|
|
85
|
-
tokens `@vanduo-oss/vd3` defines. charts, flowchart, and hex-grid
|
|
86
|
-
fallbacks and degrade gracefully without them; **music-player
|
|
93
|
+
All six components render against Vanduo's `--vd-*` design tokens — the same
|
|
94
|
+
tokens `@vanduo-oss/vd3` defines. charts, code-editor, draw, flowchart, and hex-grid
|
|
95
|
+
carry built-in fallbacks and degrade gracefully without them; **music-player
|
|
96
|
+
expects the tokens**
|
|
87
97
|
and renders with unset colors/backgrounds if none are provided. For correct
|
|
88
98
|
theming, supply the tokens on an ancestor element — the simplest way is to ship
|
|
89
99
|
the vd3 stylesheet:
|
|
@@ -119,6 +129,10 @@ tokens works — but it is the canonical source.)
|
|
|
119
129
|
| `@vanduo-oss/vd3-cbun` | Root — the `VD3_CBUN_VERSIONS` per-component version map |
|
|
120
130
|
| `@vanduo-oss/vd3-cbun/charts` | `VdChart` + typed chart wrappers, factories, scales, `resolveTheme` |
|
|
121
131
|
| `@vanduo-oss/vd3-cbun/charts/css` | Charts stylesheet (`dist/charts/vd3-charts.css`) |
|
|
132
|
+
| `@vanduo-oss/vd3-cbun/code-editor` | `VdCodeEditor` + `VdCodeEditorCore`, `tokenize`, `highlight`, `LANGUAGES` |
|
|
133
|
+
| `@vanduo-oss/vd3-cbun/code-editor/css` | Code-editor stylesheet (`dist/code-editor/vd3-code-editor.css`) |
|
|
134
|
+
| `@vanduo-oss/vd3-cbun/draw` | `VdDraw` + `VdDrawCore`, `BRUSH_PRESETS`, `DRAW_TOOLS`, `VD_DRAW_VERSION` |
|
|
135
|
+
| `@vanduo-oss/vd3-cbun/draw/css` | Draw stylesheet (`dist/draw/vd3-draw.css`) |
|
|
122
136
|
| `@vanduo-oss/vd3-cbun/flowchart` | `VdFlowchart` + `VdFlowchartCore`, `computeLayout`, `FLOWCHART_*` |
|
|
123
137
|
| `@vanduo-oss/vd3-cbun/flowchart/css` | Flowchart stylesheet (`dist/flowchart/vd3-flowchart.css`) |
|
|
124
138
|
| `@vanduo-oss/vd3-cbun/hex-grid` | `VdHexGrid` + `VdHexGridCore`, `VD_HEX_VERSION` |
|
package/SKILL.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vanduo-vd3-cbun
|
|
3
|
-
description: Use when adding Vanduo vd3 components with @vanduo-oss/vd3-cbun — the Vue 3 components bundle (charts, flowchart, hex-grid, music-player) with tree-shakeable subpath exports. Covers install, per-subpath imports, CSS, theming, and per-component versioning.
|
|
3
|
+
description: Use when adding Vanduo vd3 components with @vanduo-oss/vd3-cbun — the Vue 3 components bundle (charts, code-editor, draw, flowchart, hex-grid, music-player) with tree-shakeable subpath exports. Covers install, per-subpath imports, CSS, theming, and per-component versioning.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# @vanduo-oss/vd3-cbun
|
|
7
7
|
|
|
8
|
-
One bundle,
|
|
9
|
-
(`./charts`, `./flowchart`, `./hex-grid`, `./music-player`).
|
|
10
|
-
required peer. The root import exposes only `VD3_CBUN_VERSIONS` — the per-
|
|
8
|
+
One bundle, six Vue 3 components, each on its own tree-shakeable subpath
|
|
9
|
+
(`./charts`, `./code-editor`, `./draw`, `./flowchart`, `./hex-grid`, `./music-player`).
|
|
10
|
+
`vue >=3.3.0` is a required peer. The root import exposes only `VD3_CBUN_VERSIONS` — the per-
|
|
11
11
|
component VERSION map. Every subpath re-exports the Vue wrapper AND the
|
|
12
12
|
framework-agnostic core alongside it (the core aliased with a `Core` suffix
|
|
13
13
|
where the names collide).
|
|
@@ -45,6 +45,57 @@ the scales (`scaleLinear`, `scaleTime`, `scaleBand`, `scalePoint`,
|
|
|
45
45
|
`resolveTheme`. No name collision, so the core factories keep their own names.
|
|
46
46
|
CSS ships at `@vanduo-oss/vd3-cbun/charts/css`. `VD_CHARTS_VERSION` is `1.0.0`.
|
|
47
47
|
|
|
48
|
+
## Code-editor
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { VdCodeEditor, VdCodeEditorCore } from '@vanduo-oss/vd3-cbun/code-editor';
|
|
52
|
+
import '@vanduo-oss/vd3-cbun/code-editor/css';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`VdCodeEditor` is the Vue 3 wrapper (`v-model` binds the contents); the
|
|
56
|
+
framework-agnostic editor core shares the class name, so it is re-exported as
|
|
57
|
+
`VdCodeEditorCore`. It is a lightweight, first-party **textarea-overlay** editor
|
|
58
|
+
— a native `<textarea>` over a `<pre>` highlight layer painted by homegrown,
|
|
59
|
+
ReDoS-safe tokenizers (JavaScript/TypeScript, HTML, CSS, JSON, Markdown, Shell,
|
|
60
|
+
Python) — with a line-number gutter + active-line highlight, auto-indent and
|
|
61
|
+
bracket/quote auto-close, read-only mode, a copy button, a placeholder, and a
|
|
62
|
+
large-input performance guard. No third-party editor and no runtime dependency
|
|
63
|
+
beyond `vue`; rendering is escaping-safe and `innerHTML`-free, and the wrapper is
|
|
64
|
+
SSR-safe (DOM touched only on mount). The subpath also re-exports the pure
|
|
65
|
+
`tokenize`, `highlight`, and `LANGUAGES` helpers plus `VD_CODE_EDITOR_VERSION`.
|
|
66
|
+
Key props: `language`, `readOnly`, `lineNumbers`, `tabSize`, `wrap`,
|
|
67
|
+
`placeholder`, `maxLength`; events: `update:modelValue`, `change`, `focus`,
|
|
68
|
+
`blur`, `ready`. CSS ships at `@vanduo-oss/vd3-cbun/code-editor/css`.
|
|
69
|
+
`VD_CODE_EDITOR_VERSION` is `1.0.0`.
|
|
70
|
+
|
|
71
|
+
## Draw
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import { VdDraw, VdDrawCore } from '@vanduo-oss/vd3-cbun/draw';
|
|
75
|
+
import '@vanduo-oss/vd3-cbun/draw/css';
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`VdDraw` is the Vue 3 wrapper; the framework-agnostic editor core shares the
|
|
79
|
+
class name, so it is re-exported as `VdDrawCore`. It is a first-party **vector
|
|
80
|
+
drawing tool** (SVG world group with matrix pan/zoom) with a **brush engine** —
|
|
81
|
+
freehand strokes are variable-width, smoothed, pressure/velocity-driven filled
|
|
82
|
+
outline paths — and brush presets (`pen`, `pencil`, `marker`, `highlighter`,
|
|
83
|
+
`calligraphy`, in `BRUSH_PRESETS`), a **color palette** (swatches + custom color,
|
|
84
|
+
opacity, size, recent colors), a **stroke eraser**, plus secondary diagram
|
|
85
|
+
shapes (rectangle / ellipse / arrow / text / sticky), z-order, grouping,
|
|
86
|
+
copy/paste/duplicate, snapping guides, and PNG + SVG export. The built-in toolbar
|
|
87
|
+
uses inline Phosphor icons. Undo/redo runs through a single `emitChange →
|
|
88
|
+
recordHistory` choke point (whole-document snapshots; pan/zoom not recorded);
|
|
89
|
+
`toJSON()` / `load()` serialize `{ version, viewport, shapes }` (freehand strokes
|
|
90
|
+
carry `brush` / `color` / `opacity` / per-point `pressure`) via a
|
|
91
|
+
`normalizeDocument()` migration gateway. Chrome theming is CSS-only via a
|
|
92
|
+
`--vd-draw-*` → `--vd-*` layer; marks carry an explicit picked color. The subpath
|
|
93
|
+
also re-exports `BRUSH_PRESETS`, `DRAW_TOOLS`, `DRAW_SHAPE_TYPES`, and
|
|
94
|
+
`VD_DRAW_VERSION`. Key props: `data`, `tool`, `readonly`, `gridSize`, `snap`,
|
|
95
|
+
`autoFit`, `history`, `historyLimit`; events: `change`, `select`, `viewport`,
|
|
96
|
+
`ready`. CSS ships at `@vanduo-oss/vd3-cbun/draw/css`. `VD_DRAW_VERSION` is
|
|
97
|
+
`1.1.0`.
|
|
98
|
+
|
|
48
99
|
## Flowchart
|
|
49
100
|
|
|
50
101
|
```js
|
|
@@ -106,8 +157,8 @@ core (no name collision, so it keeps its own name) re-exported alongside
|
|
|
106
157
|
|
|
107
158
|
## Theming
|
|
108
159
|
|
|
109
|
-
All
|
|
110
|
-
tokens `@vanduo-oss/vd3` defines. charts, flowchart, and hex-grid ship built-in
|
|
160
|
+
All six components render against Vanduo's `--vd-*` design tokens — the same
|
|
161
|
+
tokens `@vanduo-oss/vd3` defines. charts, code-editor, draw, flowchart, and hex-grid ship built-in
|
|
111
162
|
fallbacks and degrade gracefully without them; **music-player expects the tokens**
|
|
112
163
|
and renders with unset colors/backgrounds if none are present. Provide them on an
|
|
113
164
|
ancestor element — simplest is to import the vd3 stylesheet (`@vanduo-oss/vd3/css`,
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// Hand-written declarations for the framework-agnostic code-editor core.
|
|
2
|
+
|
|
3
|
+
export const VD_CODE_EDITOR_VERSION: string;
|
|
4
|
+
|
|
5
|
+
/** Canonical language ids the editor understands. */
|
|
6
|
+
export type CodeEditorLanguage =
|
|
7
|
+
| 'plaintext'
|
|
8
|
+
| 'javascript'
|
|
9
|
+
| 'typescript'
|
|
10
|
+
| 'html'
|
|
11
|
+
| 'css'
|
|
12
|
+
| 'json'
|
|
13
|
+
| 'markdown'
|
|
14
|
+
| 'shell'
|
|
15
|
+
| 'python';
|
|
16
|
+
|
|
17
|
+
/** Canonical language ids (aliases like `js`/`py` resolve to these). */
|
|
18
|
+
export const LANGUAGES: readonly CodeEditorLanguage[];
|
|
19
|
+
|
|
20
|
+
/** Token classes produced by the tokenizers. */
|
|
21
|
+
export type TokenType =
|
|
22
|
+
| 'plain'
|
|
23
|
+
| 'keyword'
|
|
24
|
+
| 'string'
|
|
25
|
+
| 'comment'
|
|
26
|
+
| 'number'
|
|
27
|
+
| 'boolean'
|
|
28
|
+
| 'null'
|
|
29
|
+
| 'function'
|
|
30
|
+
| 'operator'
|
|
31
|
+
| 'punctuation'
|
|
32
|
+
| 'property'
|
|
33
|
+
| 'tag'
|
|
34
|
+
| 'attribute'
|
|
35
|
+
| 'regex'
|
|
36
|
+
| 'variable'
|
|
37
|
+
| 'builtin'
|
|
38
|
+
| 'meta';
|
|
39
|
+
|
|
40
|
+
export interface Token {
|
|
41
|
+
type: TokenType;
|
|
42
|
+
value: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Tokenize `source` for `language`. Lossless: the token values always
|
|
47
|
+
* concatenate back to `source` exactly. Unknown languages yield one `plain`
|
|
48
|
+
* token and never throw.
|
|
49
|
+
*/
|
|
50
|
+
export function tokenize(source: string, language: string): Token[];
|
|
51
|
+
|
|
52
|
+
/** Tokenize + render to an escaped HTML string (never routed to innerHTML). */
|
|
53
|
+
export function highlight(source: string, language: string): string;
|
|
54
|
+
|
|
55
|
+
export interface CodeEditorSelection {
|
|
56
|
+
start: number;
|
|
57
|
+
end: number;
|
|
58
|
+
text: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface VdCodeEditorOptions {
|
|
62
|
+
/** Container element or a selector for it. */
|
|
63
|
+
element?: Element | string;
|
|
64
|
+
/** Initial contents. */
|
|
65
|
+
value?: string;
|
|
66
|
+
/** Language id or alias. */
|
|
67
|
+
language?: string;
|
|
68
|
+
/** Render as a non-editable viewer. */
|
|
69
|
+
readOnly?: boolean;
|
|
70
|
+
/** Show the line-number gutter (ignored in wrap mode). */
|
|
71
|
+
lineNumbers?: boolean;
|
|
72
|
+
/** Indent width, in spaces. */
|
|
73
|
+
tabSize?: number;
|
|
74
|
+
/** Empty-state placeholder. */
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/** Native `maxlength` cap. */
|
|
77
|
+
maxLength?: number;
|
|
78
|
+
/** Soft-wrap long lines (disables the gutter + active-line). */
|
|
79
|
+
wrap?: boolean;
|
|
80
|
+
/** Auto-close brackets/quotes and step over closers. */
|
|
81
|
+
autoClose?: boolean;
|
|
82
|
+
/** Highlight the caret's line (ignored in wrap mode). */
|
|
83
|
+
highlightActiveLine?: boolean;
|
|
84
|
+
/** Skip highlighting above this many characters. */
|
|
85
|
+
maxHighlightLength?: number;
|
|
86
|
+
/** Native spellcheck. */
|
|
87
|
+
spellcheck?: boolean;
|
|
88
|
+
/** Show the copy-to-clipboard button. */
|
|
89
|
+
copy?: boolean;
|
|
90
|
+
/** Accessible label for the textarea. */
|
|
91
|
+
ariaLabel?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface CodeEditorChangeEvent {
|
|
95
|
+
value: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface CodeEditorEventMap {
|
|
99
|
+
change: CodeEditorChangeEvent;
|
|
100
|
+
focus: FocusEvent;
|
|
101
|
+
blur: FocusEvent;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class VdCodeEditor {
|
|
105
|
+
constructor(options?: VdCodeEditorOptions);
|
|
106
|
+
readonly element: Element | null;
|
|
107
|
+
getValue(): string;
|
|
108
|
+
setValue(next: string, options?: { silent?: boolean }): this;
|
|
109
|
+
getSelection(): CodeEditorSelection;
|
|
110
|
+
setSelection(start: number, end?: number): this;
|
|
111
|
+
insertText(text: string): this;
|
|
112
|
+
setLanguage(language: string): this;
|
|
113
|
+
setReadOnly(readOnly: boolean): this;
|
|
114
|
+
setTabSize(tabSize: number): this;
|
|
115
|
+
setPlaceholder(text: string): this;
|
|
116
|
+
setAutoClose(autoClose: boolean): this;
|
|
117
|
+
focus(): this;
|
|
118
|
+
blur(): this;
|
|
119
|
+
on<K extends keyof CodeEditorEventMap>(
|
|
120
|
+
name: K,
|
|
121
|
+
handler: (payload: CodeEditorEventMap[K]) => void,
|
|
122
|
+
): this;
|
|
123
|
+
off<K extends keyof CodeEditorEventMap>(
|
|
124
|
+
name: K,
|
|
125
|
+
handler: (payload: CodeEditorEventMap[K]) => void,
|
|
126
|
+
): this;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
}
|