@vanduo-oss/vd3-cbun 1.4.0 → 1.4.2

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,127 @@ 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.2 — 2026-09-13
8
+
9
+ Patch release: resolves all 14 Kilo review findings on PR #13 plus two adjacent
10
+ gesture-cancel bugs. The reviewed fixes include additive charts core `role` /
11
+ Vue `svgRole` options and four strengthened tests. Additive and
12
+ backward-compatible; **no
13
+ per-component VERSION constant changes** (no serialization change, no new
14
+ load-bearing default).
15
+
16
+ ### Fixed
17
+
18
+ - **draw** — the rendered DOM paint order now always matches document order.
19
+ Reorders (`bringToFront` / `sendToBack` / `bringForward` / `sendBackward`),
20
+ undo/redo, and `load()` previously updated the model but could leave the SVG
21
+ element order stale, so the visually topmost shape could disagree with
22
+ `toJSON().shapes`. Paint order is normalized inside the incremental render pass.
23
+ A second pointer contacting the canvas now cancels the active gesture
24
+ coherently: an in-progress erase keeps the model intact and restores the shapes
25
+ it had hidden, an in-progress move/resize restores the pre-drag geometry in the
26
+ model and DOM, and an in-progress pan clears `.vd-draw-panning` (also cleared
27
+ when a pinch ends). `setReadonly(false)` rebuilds the toolbar/style panel only
28
+ when it was never built and now syncs their state. The select-mode move cursor
29
+ rule targets the real `.vd-draw-shapes` layer instead of the non-existent
30
+ `.vd-draw-shape-layer`. `VD_DRAW_VERSION` stays `1.1.0`.
31
+
32
+ - **charts** — a visible data table no longer feeds back into responsive sizing.
33
+ The measured height and the `ResizeObserver` comparison now exclude the table's
34
+ layout contribution (hidden `.vd-chart-sr-only` tables contribute zero), so
35
+ growing the table no longer triggers a resize re-render loop, while genuine
36
+ container changes still resize. Multi-series line/area data tables now match
37
+ each row's x value by the same normalized key as the x scale (timestamp /
38
+ number / string) instead of strict reference equality, so per-series `Date` or
39
+ object x values no longer produce blank cells. Adds an additive core `role`
40
+ option and Vue `svgRole` prop (`string`, overrides the default
41
+ `graphics-document document`); the distinct Vue name preserves standard root
42
+ `role` attribute fallthrough. `dataTable`, `ariaRoleDescription`, and
43
+ `svgRole` react after mount. `VD_CHARTS_VERSION` stays `1.1.0`.
44
+
45
+ - **hex-grid** — fast blit frames now report `total`, `visible`, and `drawn: 0`
46
+ in `getRenderStats()` instead of leaving the previous sharp frame's counts, so
47
+ stats stay consistent with the transform in effect during a gesture.
48
+ `VD_HEX_VERSION` stays `1.1.0`.
49
+
50
+ - **tests** — the z-order test now asserts DOM order (and covers reorder,
51
+ undo/redo, send-to-back/forward/backward); the `canUndo` test builds real
52
+ history before disabling it; `autoClose: false` asserts the textarea is
53
+ unchanged with an `autoClose: true` pair-insert control; the pressure-default
54
+ smoothing test blends both missing directions at factor 0.5; the DPR test
55
+ rejects any transform carrying the device ratio; the fast-frame test pins
56
+ `visible` / `drawn`. New coverage: gesture cancellation, per-series `Date` data
57
+ tables, responsive table-growth, and Vue reactivity for `svgRole` /
58
+ `ariaRoleDescription` / `dataTable`.
59
+
60
+ Component versions in this release: **charts 1.1.0, code-editor 1.1.0, draw
61
+ 1.1.0, flowchart 1.2.0, hex-grid 1.1.0, music-player 1.0.1**.
62
+
63
+ ## 1.4.1 — 2026-09-12
64
+
65
+ Patch release: hex-grid adaptive rendering, draw vector polish, charts
66
+ accessibility, and a code-editor wrap-mode caret fix. Additive and
67
+ backward-compatible; only `VD_HEX_VERSION` takes a minor (`1.0.1 → 1.1.0`).
68
+ `VD_CHARTS_VERSION`, `VD_CODE_EDITOR_VERSION`, and `VD_DRAW_VERSION` stay
69
+ `1.1.0` (no serialization change).
70
+
71
+ ### Changed
72
+
73
+ - **hex-grid** — adaptive, DPR-aware, culled rendering. New `pixelRatio`
74
+ (`number | 'auto'`, default `'auto'` = `min(devicePixelRatio, 2)`) sizes the
75
+ canvas backing store to `CSS size × ratio` with a seeded
76
+ `setTransform(ratio, …)` so world/CSS coordinates and hit-testing are
77
+ unchanged (`pixelRatio: 1` restores the old buffer). New `cull` (default
78
+ `true`) draws only cells intersecting the viewport via a spatial bucket index
79
+ rebuilt on grid regeneration; with culling on, `setCustomRender` now fires
80
+ only for visible cells (`cull: false` restores whole-grid iteration). Pan and
81
+ zoom rAF-coalesce to one frame; above 8000 visible cells a gesture blits the
82
+ last sharp frame and a sharp culled re-render follows when idle (~120 ms) or
83
+ on pointer up. Adds `getVisibleHexes()`, `getRenderStats()`,
84
+ `setPixelRatio()`, `setCull()`; `destroy()` now also cancels pending
85
+ rAF/timeouts and releases the frame canvas. Vue wrapper gains `pixelRatio` /
86
+ `cull` props. Takes `VD_HEX_VERSION` `1.0.1 → 1.1.0`.
87
+
88
+ - **draw** — vector polish without a schema bump. Freehand input is EMA-smoothed
89
+ (`smoothPoint`) and progressively simplified (Ramer–Douglas–Peucker) so
90
+ strokes stay smooth without point bloat. SVG nodes are cached and dirtied
91
+ per-shape; renders rAF-batch. Two-finger pinch-to-zoom (midpoint-anchored)
92
+ and two-finger pan land for touch. Text wraps to the shape width via SVG
93
+ `<tspan>`s and is inline-editable on double-click in select mode; arrow
94
+ marker heads follow the stroke color (sanitized `<defs>` ids, including
95
+ `toSVG()`). Tool-aware canvas cursors, panning grab state, and compass
96
+ resize handles. O(1) `_shapesById` lookup. Vue option props (`readonly`,
97
+ `snap`, `history`, `historyLimit`) update through surgical setters
98
+ (`setReadonly`, `setSnap`, `setHistoryEnabled`, `setHistoryLimit`) instead
99
+ of destroying the editor. `fitView(padding?)` takes an optional padding
100
+ (default `40`). `VD_DRAW_VERSION` stays `1.1.0`.
101
+
102
+ - **charts** — WAI-ARIA Graphics Module 1.0 on the SVG shell
103
+ (`role="graphics-document document"`, `graphics-object` / `graphics-symbol`
104
+ on marks, contextual `aria-roledescription`). Arrow-key navigation moves
105
+ focus between interactive marks with a roving tooltip. An accessible HTML
106
+ data table ships by default as `sr-only` (WCAG 1.1.1 / G73–G74);
107
+ `dataTable: false` suppresses it and `dataTable: 'visible'` shows it.
108
+ `ariaRoleDescription` overrides the SVG role description (default
109
+ `` `${kind} chart` ``). Dark-mode and `:focus-visible` chrome. Vue wrapper
110
+ forwards `dataTable` and `ariaRoleDescription`. `VD_CHARTS_VERSION` stays
111
+ `1.1.0`.
112
+
113
+ - **code-editor** — wrap mode reserves a shared `scrollbar-gutter: stable` on
114
+ both the textarea and the highlight `<pre>` so a visible scrollbar no longer
115
+ shrinks only the editable layer and misaligns the caret on wrapped lines.
116
+ OpenSpec synced; standalone core / editing / tokenizer / Vue / Playwright
117
+ suites added. `VD_CODE_EDITOR_VERSION` stays `1.1.0`.
118
+
119
+ - OpenSpec: archived `sync-shipped-cbun-specs`, `hex-grid-render-perf`, and
120
+ `draw-vector-polish-perf` — Catmull-Rom `line.smooth`, `VdDraw` template-ref
121
+ CRUD, flowchart `--vd-bg-*` chrome, corrected CI `test:types`-after-build
122
+ order, and real Purpose lines on all seven capabilities. No additional
123
+ component API or serialization change beyond the bullets above.
124
+
125
+ Component versions in this release: **charts 1.1.0, code-editor 1.1.0, draw
126
+ 1.1.0, flowchart 1.2.0, hex-grid 1.1.0, music-player 1.0.1**.
127
+
7
128
  ## 1.4.0 — 2026-08-16
8
129
 
9
130
  **code-editor** — snippet-safe first-party highlighter so docs snippets can drop
package/README.md CHANGED
@@ -8,12 +8,16 @@ 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.4.0.** Six Vue3-only component families — charts, code-editor, draw,
11
+ **Status: 1.4.2.** 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.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).)
13
+ the esbuild metafile isolation guard in place. (1.4.2 is a review-fix patch: draw
14
+ paint-order and gesture-cancel correctness, charts responsive-table and
15
+ per-series data-table fixes plus additive core `role` / Vue `svgRole` options,
16
+ hex-grid fast-frame stats, and test hardening; 1.4.1 added hex-grid DPR/culling,
17
+ draw vector polish
18
+ and multi-touch, charts WAI-ARIA + keyboard + data table, and a wrap-mode
19
+ scrollbar guard; 1.4.0 the snippet-safe `./code-editor/highlight` tokenizer; see
20
+ the [changelog](./CHANGELOG.md).)
17
21
 
18
22
  ## Install
19
23
 
@@ -51,6 +55,14 @@ import { VdMusicPlayer } from '@vanduo-oss/vd3-cbun/music-player';
51
55
  import '@vanduo-oss/vd3-cbun/music-player/css';
52
56
  ```
53
57
 
58
+ `VdHexGrid` / `VdHexGridCore` accept `pixelRatio` (`number | 'auto'`, default
59
+ `'auto'` = `min(devicePixelRatio, 2)`) and `cull` (default `true`, viewport
60
+ culling). Large grids coalesce pan/zoom into one frame and blit the last sharp
61
+ frame while gesturing, then re-render sharply when idle. `getVisibleHexes()` and
62
+ `getRenderStats()` expose the culled/render state; `setPixelRatio()` and
63
+ `setCull()` update them in place. `pixelRatio: 1` and `cull: false` restore the
64
+ pre-1.1 buffer size and whole-grid iteration.
65
+
54
66
  `highlight(source, lang, { trailingNewline? })` defaults `trailingNewline` to
55
67
  `false` (snippet-safe inside `<pre>`). `./code-editor/highlight` does not load
56
68
  the editor or Vue wrapper. First-party languages include `vue` (SFC);
@@ -91,7 +103,7 @@ The bundle's own semver (`package.json` version) is decoupled from the
91
103
  components inside it. Each component carries a VERSION constant tracked in
92
104
  `component-versions.json` at the repo root and asserted in tests against the
93
105
  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
106
+ `1.1.0`; hex-grid at `1.1.0`; music-player at `1.0.1`; draw at `1.1.0`; **flowchart continues its
95
107
  old-line lineage at `1.2.0`** because `VD_FLOWCHART_VERSION` is load-bearing —
96
108
  it is serialized into user documents via `toJSON().version`. A new component
97
109
  enters the manifest at `1.0.0` (`draw` did, in bundle 1.2.0).
package/SKILL.md CHANGED
@@ -43,7 +43,12 @@ the scales (`scaleLinear`, `scaleTime`, `scaleBand`, `scalePoint`,
43
43
  `scaleOrdinal`), accessor/tick helpers (`createAccessor`, `ticks`,
44
44
  `niceDomain`), the path builders (`linePath`, `areaPath`, `arcPath`), and
45
45
  `resolveTheme`. No name collision, so the core factories keep their own names.
46
- CSS ships at `@vanduo-oss/vd3-cbun/charts/css`. `VD_CHARTS_VERSION` is `1.0.1`.
46
+ CSS ships at `@vanduo-oss/vd3-cbun/charts/css`. Charts expose WAI-ARIA Graphics
47
+ roles, arrow-key mark navigation, and an accessible data table (`dataTable`:
48
+ `true` / `false` / `'visible'`; `ariaRoleDescription` overrides the SVG
49
+ description; core `role` / Vue `svgRole` override the default
50
+ `graphics-document document` role without consuming the Vue root `role`
51
+ attribute). `VD_CHARTS_VERSION` is `1.1.0`.
47
52
 
48
53
  ## Code-editor
49
54
 
@@ -78,7 +83,8 @@ real SFC tokenizer (`<script>` / `<style>` embed, `{{ }}`, `v-*` / `@` / `:`).
78
83
  The main `./code-editor` subpath also re-exports those helpers plus
79
84
  `VD_CODE_EDITOR_VERSION`. Key props: `language`, `readOnly`, `lineNumbers`,
80
85
  `tabSize`, `wrap`, `placeholder`, `maxLength`; events: `update:modelValue`,
81
- `change`, `focus`, `blur`, `ready`. CSS ships at
86
+ `change`, `focus`, `blur`, `ready`. Wrap mode shares `scrollbar-gutter: stable`
87
+ on the textarea and highlight layer so the caret stays aligned. CSS ships at
82
88
  `@vanduo-oss/vd3-cbun/code-editor/css`. `VD_CODE_EDITOR_VERSION` is `1.1.0`.
83
89
 
84
90
  ## Draw
@@ -106,8 +112,12 @@ carry `brush` / `color` / `opacity` / per-point `pressure`) via a
106
112
  also re-exports `BRUSH_PRESETS`, `DRAW_TOOLS`, `DRAW_SHAPE_TYPES`, and
107
113
  `VD_DRAW_VERSION`. Key props: `data`, `tool`, `readonly`, `gridSize`, `snap`,
108
114
  `autoFit`, `history`, `historyLimit`; events: `change`, `select`, `viewport`,
109
- `ready`. CSS ships at `@vanduo-oss/vd3-cbun/draw/css`. `VD_DRAW_VERSION` is
110
- `1.1.0`.
115
+ `ready`. Live EMA brush smoothing + RDP simplification, incremental SVG cache,
116
+ two-finger pinch/pan, multi-line text wrap, double-click text edit, and surgical
117
+ Vue setters (`setReadonly` / `setSnap` / `setHistoryEnabled` /
118
+ `setHistoryLimit`) so option props do not recreate the editor.
119
+ `fitView(padding?)` defaults padding to `40`. CSS ships at
120
+ `@vanduo-oss/vd3-cbun/draw/css`. `VD_DRAW_VERSION` is `1.1.0`.
111
121
 
112
122
  ## Flowchart
113
123
 
@@ -149,7 +159,13 @@ subpath (coordinate transforms, rotation, distance, plus the terrain tables:
149
159
  and the `isPassable` / `getMovementCost` / `getTerrainYields` / `getTerrainColor`
150
160
  helpers). Hex-grid ships **no CSS** — it renders to a canvas and reads `--vd-*`
151
161
  theme tokens off the host element via `getComputedStyle`. `VD_HEX_VERSION` is
152
- `1.0.1`.
162
+ `1.1.0`. The core accepts `pixelRatio` (`number | 'auto'`, default `'auto'` =
163
+ `min(devicePixelRatio, 2)`) and `cull` (default `true`, viewport culling).
164
+ Pan/zoom gestures rAF-coalesce to one frame and, above ~8000 visible cells,
165
+ blit the last sharp frame before a sharp culled re-render when idle; data APIs
166
+ stay synchronous. `getVisibleHexes()`, `getRenderStats()`, `setPixelRatio()`,
167
+ and `setCull()` expose/update this state; `pixelRatio: 1` and `cull: false`
168
+ restore the pre-1.1 behavior.
153
169
 
154
170
  ## Music-player
155
171
 
@@ -105,6 +105,12 @@ export interface BaseChartOptions<T = Row> {
105
105
  legend?: boolean | LegendOptions;
106
106
  /** Draw value labels on each mark. */
107
107
  dataLabels?: boolean | DataLabelsOption;
108
+ /** Accessible data table fallback for screen readers (WCAG 1.1.1). Set `false` to disable or `'visible'` to display visually. Default is `true` (visually hidden). */
109
+ dataTable?: boolean | 'visible';
110
+ /** Custom ARIA role description override for the chart root (defaults to `${kind} chart`). */
111
+ ariaRoleDescription?: string;
112
+ /** Override the SVG WAI-ARIA graphics role (defaults to `graphics-document document`). */
113
+ role?: string;
108
114
  }
109
115
 
110
116
  export interface CartesianChartOptions<T = Row> extends BaseChartOptions<T> {