@vanduo-oss/vd3-cbun 1.0.0 → 1.1.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 +22 -0
- package/README.md +24 -16
- package/SKILL.md +27 -4
- 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/index.js +1 -0
- package/dist/index.js.map +2 -2
- package/dist/meta.json +349 -4
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ 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.1.0 — 2026-07-21
|
|
8
|
+
|
|
9
|
+
Adds a fifth component, **`code-editor`** (`@vanduo-oss/vd3-cbun/code-editor` +
|
|
10
|
+
`./code-editor/css`), exposing `VdCodeEditor` — a lightweight, first-party
|
|
11
|
+
**textarea-overlay** code editor: a native `<textarea>` rendered transparently
|
|
12
|
+
over a `<pre>` highlight layer painted by homegrown, ReDoS-safe tokenizers for
|
|
13
|
+
JavaScript/TypeScript, HTML, CSS, JSON, Markdown, Shell, and Python. No
|
|
14
|
+
third-party editor and no new runtime dependency — `vue` stays the only peer, and
|
|
15
|
+
every input bundled for the entry lives under `src/code-editor/` (the metafile
|
|
16
|
+
isolation guard passes). v1 features: line-number gutter + active-line highlight,
|
|
17
|
+
auto-indent + Tab-to-spaces + bracket/quote auto-close, read-only mode +
|
|
18
|
+
copy-to-clipboard, empty-state placeholder, and a large-input performance guard.
|
|
19
|
+
Rendering is escaping-safe and `innerHTML`-free (DOM nodes via `replaceChildren`),
|
|
20
|
+
and the component is SSR-safe (DOM touched only on mount). The four existing
|
|
21
|
+
components are untouched (tree-shake contract). Additive minor: bundle
|
|
22
|
+
`1.0.0 → 1.1.0`.
|
|
23
|
+
|
|
24
|
+
Component versions in this release: **charts 1.0.0, code-editor 1.0.0, flowchart
|
|
25
|
+
1.2.0, hex-grid 1.0.0, music-player 1.0.0** — the new `code-editor` enters the
|
|
26
|
+
`component-versions.json` manifest at `1.0.0`; the bundle's own semver stays
|
|
27
|
+
decoupled from the per-component `VERSION` constants.
|
|
28
|
+
|
|
7
29
|
## 1.0.0 — 2026-07-14
|
|
8
30
|
|
|
9
31
|
First public release of `@vanduo-oss/vd3-cbun` — the Vanduo **components bundle**
|
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
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.
|
|
5
|
+
The Vanduo **components bundle** for the vd3 line: Vue3-only charts, code-editor,
|
|
6
|
+
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
10
|
|
|
11
|
-
**Status: 1.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
**Status: 1.1.0.** Five Vue3-only component families — charts, code-editor,
|
|
12
|
+
flowchart, hex-grid, music-player — each on its own tree-shakeable subpath, with
|
|
13
|
+
the esbuild metafile isolation guard in place. (1.1.0 adds the first-party
|
|
14
|
+
`code-editor` component; see the [changelog](./CHANGELOG.md).)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -32,6 +32,9 @@ Each component lives on its own subpath — importing one never pulls in another
|
|
|
32
32
|
import { VdChart } from '@vanduo-oss/vd3-cbun/charts';
|
|
33
33
|
import '@vanduo-oss/vd3-cbun/charts/css';
|
|
34
34
|
|
|
35
|
+
import { VdCodeEditor } from '@vanduo-oss/vd3-cbun/code-editor';
|
|
36
|
+
import '@vanduo-oss/vd3-cbun/code-editor/css';
|
|
37
|
+
|
|
35
38
|
import { VdFlowchart } from '@vanduo-oss/vd3-cbun/flowchart';
|
|
36
39
|
import '@vanduo-oss/vd3-cbun/flowchart/css';
|
|
37
40
|
|
|
@@ -50,7 +53,8 @@ import { VD3_CBUN_VERSIONS } from '@vanduo-oss/vd3-cbun';
|
|
|
50
53
|
|
|
51
54
|
Each subpath entry (`dist/<component>/index.js`) re-exports **both** the Vue
|
|
52
55
|
component and its framework-agnostic core (the core aliased with a `Core`
|
|
53
|
-
suffix where the names collide — `
|
|
56
|
+
suffix where the names collide — `VdCodeEditorCore`, `VdFlowchartCore`,
|
|
57
|
+
`VdHexGridCore`). Isolation
|
|
54
58
|
is not a convention but a build guard: `scripts/build.js` bundles every entry
|
|
55
59
|
separately with `vue` external, emits an esbuild metafile (`dist/meta.json`),
|
|
56
60
|
and **fails the build** if any component entry's inputs reach outside its own
|
|
@@ -74,16 +78,18 @@ Notes:
|
|
|
74
78
|
The bundle's own semver (`package.json` version) is decoupled from the
|
|
75
79
|
components inside it. Each component carries a VERSION constant tracked in
|
|
76
80
|
`component-versions.json` at the repo root and asserted in tests against the
|
|
77
|
-
exported `VD3_CBUN_VERSIONS` map.
|
|
78
|
-
music-player
|
|
81
|
+
exported `VD3_CBUN_VERSIONS` map. charts, code-editor, hex-grid, and
|
|
82
|
+
music-player sit at `1.0.0`; **flowchart continues its old-line lineage at
|
|
79
83
|
`1.2.0`** because `VD_FLOWCHART_VERSION` is load-bearing — it is serialized
|
|
80
|
-
into user documents via `toJSON().version`.
|
|
84
|
+
into user documents via `toJSON().version`. A new component enters the manifest
|
|
85
|
+
at `1.0.0` (`code-editor` did, in bundle 1.1.0).
|
|
81
86
|
|
|
82
87
|
## Theming
|
|
83
88
|
|
|
84
|
-
All
|
|
85
|
-
tokens `@vanduo-oss/vd3` defines. charts, flowchart, and hex-grid
|
|
86
|
-
fallbacks and degrade gracefully without them; **music-player
|
|
89
|
+
All five components render against Vanduo's `--vd-*` design tokens — the same
|
|
90
|
+
tokens `@vanduo-oss/vd3` defines. charts, code-editor, flowchart, and hex-grid
|
|
91
|
+
carry built-in fallbacks and degrade gracefully without them; **music-player
|
|
92
|
+
expects the tokens**
|
|
87
93
|
and renders with unset colors/backgrounds if none are provided. For correct
|
|
88
94
|
theming, supply the tokens on an ancestor element — the simplest way is to ship
|
|
89
95
|
the vd3 stylesheet:
|
|
@@ -119,6 +125,8 @@ tokens works — but it is the canonical source.)
|
|
|
119
125
|
| `@vanduo-oss/vd3-cbun` | Root — the `VD3_CBUN_VERSIONS` per-component version map |
|
|
120
126
|
| `@vanduo-oss/vd3-cbun/charts` | `VdChart` + typed chart wrappers, factories, scales, `resolveTheme` |
|
|
121
127
|
| `@vanduo-oss/vd3-cbun/charts/css` | Charts stylesheet (`dist/charts/vd3-charts.css`) |
|
|
128
|
+
| `@vanduo-oss/vd3-cbun/code-editor` | `VdCodeEditor` + `VdCodeEditorCore`, `tokenize`, `highlight`, `LANGUAGES` |
|
|
129
|
+
| `@vanduo-oss/vd3-cbun/code-editor/css` | Code-editor stylesheet (`dist/code-editor/vd3-code-editor.css`) |
|
|
122
130
|
| `@vanduo-oss/vd3-cbun/flowchart` | `VdFlowchart` + `VdFlowchartCore`, `computeLayout`, `FLOWCHART_*` |
|
|
123
131
|
| `@vanduo-oss/vd3-cbun/flowchart/css` | Flowchart stylesheet (`dist/flowchart/vd3-flowchart.css`) |
|
|
124
132
|
| `@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, 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, five Vue 3 components, each on its own tree-shakeable subpath
|
|
9
|
+
(`./charts`, `./code-editor`, `./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,29 @@ 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
|
+
|
|
48
71
|
## Flowchart
|
|
49
72
|
|
|
50
73
|
```js
|
|
@@ -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
|
+
}
|