@vanduo-oss/vd3-cbun 1.3.1 → 1.4.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 CHANGED
@@ -4,6 +4,37 @@ 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.4.0 — 2026-08-16
8
+
9
+ **code-editor** — snippet-safe first-party highlighter so docs snippets can drop
10
+ highlight.js. `highlight(source, lang, { trailingNewline? })` defaults
11
+ `trailingNewline` to `false` (no extra `\n` inside `<pre>`); pass `true` only
12
+ for the textarea overlay line-count. New tokenizer-only subpath
13
+ `@vanduo-oss/vd3-cbun/code-editor/highlight` exports `highlight`, `tokenize`,
14
+ `renderTokensToHtml`, and `LANGUAGES` without evaluating the editor core or Vue
15
+ wrapper. `vue` is a real SFC tokenizer (HTML `<script>` / `<style>` also embed
16
+ JS/TS/CSS). JS/TS emit `${}` interpolations and `regex` tokens; CSS highlights
17
+ selectors, pseudos, and `--vd-*` custom properties and no longer marks `a` in
18
+ `.a:hover` as a property. `jsx` / `tsx` / `jsonc` stay JS / TS / JSON aliases
19
+ (not dedicated grammars). The editor DOM overlay path is unchanged. Takes
20
+ `VD_CODE_EDITOR_VERSION` `1.0.1 → 1.1.0`.
21
+
22
+ Component versions in this release: **charts 1.1.0, code-editor 1.1.0, draw
23
+ 1.1.0, flowchart 1.2.0, hex-grid 1.0.1, music-player 1.0.1**.
24
+
25
+ ## 1.3.2 — 2026-08-13
26
+
27
+ **draw** — line shapes accept an optional `smooth` boolean; when true and there
28
+ are 3+ points, `pointsToPath` emits Catmull-Rom cubics so dense AI polylines
29
+ read as real curves. Interactive two-point lines stay sharp (`smooth` defaults
30
+ false). The `VdDraw` template ref now exposes `addShape`, `updateShape`,
31
+ `removeShape`, `getShape`, `getShapes`, `clear`, `load`, and `toJSON` (the core
32
+ already had these; the wrapper previously omitted them). Additive and
33
+ backward-compatible — a missing `smooth` loads as false — so `VD_DRAW_VERSION`
34
+ stays `1.1.0`. Also non-runtime: pnpm audit overrides (`postcss`,
35
+ `brace-expansion`, `nanoid`, `undici`) kept on the Node 20 engines major, and
36
+ jsdom 30 so the undici override stays compatible.
37
+
7
38
  ## 1.3.1 — 2026-08-02
8
39
 
9
40
  **flowchart** — CSS token mixes no longer blend toward fixed light cream/white
package/README.md CHANGED
@@ -8,12 +8,12 @@ tree-shakeable subpath exports. It replaces the four per-repo publishes
8
8
  (`@vanduo-oss/charts`, `@vanduo-oss/flowchart`, `@vanduo-oss/hex-grid`,
9
9
  `@vanduo-oss/music-player`) of the old line.
10
10
 
11
- **Status: 1.3.1.** Six Vue3-only component families — charts, code-editor, draw,
11
+ **Status: 1.4.0.** Six Vue3-only component families — charts, code-editor, draw,
12
12
  flowchart, hex-grid, music-player — each on its own tree-shakeable subpath, with
13
- the esbuild metafile isolation guard in place. (1.3.0 adds chart mark-click
14
- emits + bounded draw/flowchart deserialization; 1.3.1 dark-aware flowchart
15
- chrome, icon toolbar, and short-parent sizing; see the
16
- [changelog](./CHANGELOG.md).)
13
+ the esbuild metafile isolation guard in place. (1.4.0 adds a snippet-safe
14
+ `./code-editor/highlight` tokenizer entry, Vue SFC highlighting, and richer
15
+ JS/CSS tokens; 1.3.2 Catmull-Rom smooth lines and Vue shape CRUD on `VdDraw`;
16
+ see the [changelog](./CHANGELOG.md).)
17
17
 
18
18
  ## Install
19
19
 
@@ -35,6 +35,7 @@ import { VdChart } from '@vanduo-oss/vd3-cbun/charts';
35
35
  import '@vanduo-oss/vd3-cbun/charts/css';
36
36
 
37
37
  import { VdCodeEditor } from '@vanduo-oss/vd3-cbun/code-editor';
38
+ import { highlight, tokenize, LANGUAGES } from '@vanduo-oss/vd3-cbun/code-editor/highlight';
38
39
  import '@vanduo-oss/vd3-cbun/code-editor/css';
39
40
 
40
41
  import { VdDraw } from '@vanduo-oss/vd3-cbun/draw';
@@ -50,6 +51,12 @@ import { VdMusicPlayer } from '@vanduo-oss/vd3-cbun/music-player';
50
51
  import '@vanduo-oss/vd3-cbun/music-player/css';
51
52
  ```
52
53
 
54
+ `highlight(source, lang, { trailingNewline? })` defaults `trailingNewline` to
55
+ `false` (snippet-safe inside `<pre>`). `./code-editor/highlight` does not load
56
+ the editor or Vue wrapper. First-party languages include `vue` (SFC);
57
+ `jsx` / `tsx` / `jsonc` are aliases that fall back to the JS / TS / JSON
58
+ tokenizers — they are not dedicated grammars.
59
+
53
60
  The root import exposes only the per-component VERSION-constants map:
54
61
 
55
62
  ```js
@@ -83,8 +90,8 @@ Notes:
83
90
  The bundle's own semver (`package.json` version) is decoupled from the
84
91
  components inside it. Each component carries a VERSION constant tracked in
85
92
  `component-versions.json` at the repo root and asserted in tests against the
86
- exported `VD3_CBUN_VERSIONS` map. charts, code-editor, hex-grid, and music-player
87
- sit at `1.0.1`, draw at `1.1.0`; **flowchart continues its
93
+ exported `VD3_CBUN_VERSIONS` map. code-editor sits at `1.1.0`; charts at
94
+ `1.1.0`; hex-grid and music-player at `1.0.1`; draw at `1.1.0`; **flowchart continues its
88
95
  old-line lineage at `1.2.0`** because `VD_FLOWCHART_VERSION` is load-bearing —
89
96
  it is serialized into user documents via `toJSON().version`. A new component
90
97
  enters the manifest at `1.0.0` (`draw` did, in bundle 1.2.0).
@@ -131,7 +138,8 @@ tokens works — but it is the canonical source.)
131
138
  | `@vanduo-oss/vd3-cbun` | Root — the `VD3_CBUN_VERSIONS` per-component version map |
132
139
  | `@vanduo-oss/vd3-cbun/charts` | `VdChart` + typed chart wrappers, factories, scales, `resolveTheme` |
133
140
  | `@vanduo-oss/vd3-cbun/charts/css` | Charts stylesheet (`dist/charts/vd3-charts.css`) |
134
- | `@vanduo-oss/vd3-cbun/code-editor` | `VdCodeEditor` + `VdCodeEditorCore`, `tokenize`, `highlight`, `LANGUAGES` |
141
+ | `@vanduo-oss/vd3-cbun/code-editor` | `VdCodeEditor` + `VdCodeEditorCore`, `tokenize`, `highlight`, `renderTokensToHtml`, `LANGUAGES` |
142
+ | `@vanduo-oss/vd3-cbun/code-editor/highlight` | Tokenizer-only: `highlight`, `tokenize`, `renderTokensToHtml`, `LANGUAGES` (no editor / Vue) |
135
143
  | `@vanduo-oss/vd3-cbun/code-editor/css` | Code-editor stylesheet (`dist/code-editor/vd3-code-editor.css`) |
136
144
  | `@vanduo-oss/vd3-cbun/draw` | `VdDraw` + `VdDrawCore`, `BRUSH_PRESETS`, `DRAW_TOOLS`, `VD_DRAW_VERSION` |
137
145
  | `@vanduo-oss/vd3-cbun/draw/css` | Draw stylesheet (`dist/draw/vd3-draw.css`) |
package/SKILL.md CHANGED
@@ -49,24 +49,37 @@ CSS ships at `@vanduo-oss/vd3-cbun/charts/css`. `VD_CHARTS_VERSION` is `1.0.1`.
49
49
 
50
50
  ```js
51
51
  import { VdCodeEditor, VdCodeEditorCore } from '@vanduo-oss/vd3-cbun/code-editor';
52
+ import { highlight, tokenize, LANGUAGES } from '@vanduo-oss/vd3-cbun/code-editor/highlight';
52
53
  import '@vanduo-oss/vd3-cbun/code-editor/css';
54
+
55
+ const html = highlight(source, 'vue'); // snippet-safe; no extra trailing newline
56
+ const overlay = highlight(source, 'javascript', { trailingNewline: true });
53
57
  ```
54
58
 
55
59
  `VdCodeEditor` is the Vue 3 wrapper (`v-model` binds the contents); the
56
60
  framework-agnostic editor core shares the class name, so it is re-exported as
57
61
  `VdCodeEditorCore`. It is a lightweight, first-party **textarea-overlay** editor
58
62
  — 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`.
63
+ ReDoS-safe tokenizers (JavaScript/TypeScript, HTML, Vue SFC, CSS, JSON,
64
+ Markdown, Shell, Python) — with a line-number gutter + active-line highlight,
65
+ auto-indent and bracket/quote auto-close, read-only mode, a copy button, a
66
+ placeholder, and a large-input performance guard. No third-party editor and no
67
+ runtime dependency beyond `vue`; rendering is escaping-safe and `innerHTML`-free,
68
+ and the wrapper is SSR-safe (DOM touched only on mount).
69
+
70
+ `./code-editor/highlight` is the **tokenizer-only** entry (`highlight`,
71
+ `tokenize`, `renderTokensToHtml`, `LANGUAGES`) — it does not evaluate the editor
72
+ core or Vue wrapper. `highlight(source, lang, { trailingNewline? })` defaults
73
+ `trailingNewline` to `false` (safe inside `<pre>`); pass `true` only for the
74
+ textarea overlay line-count. `jsx` / `tsx` / `jsonc` are aliases that fall back
75
+ to the JS / TS / JSON tokenizers — they are not dedicated grammars. `vue` is a
76
+ real SFC tokenizer (`<script>` / `<style>` embed, `{{ }}`, `v-*` / `@` / `:`).
77
+
78
+ The main `./code-editor` subpath also re-exports those helpers plus
79
+ `VD_CODE_EDITOR_VERSION`. Key props: `language`, `readOnly`, `lineNumbers`,
80
+ `tabSize`, `wrap`, `placeholder`, `maxLength`; events: `update:modelValue`,
81
+ `change`, `focus`, `blur`, `ready`. CSS ships at
82
+ `@vanduo-oss/vd3-cbun/code-editor/css`. `VD_CODE_EDITOR_VERSION` is `1.1.0`.
70
83
 
71
84
  ## Draw
72
85
 
@@ -8,6 +8,7 @@ export type CodeEditorLanguage =
8
8
  | 'javascript'
9
9
  | 'typescript'
10
10
  | 'html'
11
+ | 'vue'
11
12
  | 'css'
12
13
  | 'json'
13
14
  | 'markdown'
@@ -49,8 +50,24 @@ export interface Token {
49
50
  */
50
51
  export function tokenize(source: string, language: string): Token[];
51
52
 
52
- /** Tokenize + render to an escaped HTML string (never routed to innerHTML). */
53
- export function highlight(source: string, language: string): string;
53
+ /**
54
+ * When `trailingNewline` is true, append an extra `\n` if `source` is empty
55
+ * or already ends with `\n` (textarea line-count). Default false — snippet-safe
56
+ * inside `<pre>`.
57
+ */
58
+ export interface HighlightOptions {
59
+ trailingNewline?: boolean;
60
+ }
61
+
62
+ /** Render tokens to an escaped HTML string of `vd-tk-*` spans (no extra newline). */
63
+ export function renderTokensToHtml(tokens: Token[]): string;
64
+
65
+ /**
66
+ * Tokenize + render to an escaped HTML string (never routed to innerHTML).
67
+ * Does not append an extra trailing newline unless `options.trailingNewline`
68
+ * is true.
69
+ */
70
+ export function highlight(source: string, language: string, options?: HighlightOptions): string;
54
71
 
55
72
  export interface CodeEditorSelection {
56
73
  start: number;