refactor: prepare vue components for vapor mode (#38798)

Removes what would block a later switch to Vue's vapor mode:
`vue-chartjs` and the `SvgIcon` render function are virtual DOM
components, and `v-memo` has no vapor equivalent. This does not adopt
vapor mode, which will be stable in upcoming Vue 3.6.

`vue-chartjs` was a thin wrapper over chart.js, so a local
`ChartCanvas.vue` replaces it. Chart data and options move into computed
values to keep their object identity, which is what `v-memo` was
compensating for.

`chartjs-adapter-dayjs-4` is moved first-party, just ~40 lines that are
easy to maintain.
This commit is contained in:
silverwind
2026-08-07 14:38:31 +02:00
committed by GitHub
parent d86cb1a498
commit e81ab0a5ea
22 changed files with 178 additions and 145 deletions
+1 -13
View File
@@ -1,5 +1,4 @@
import {svg, SvgIcon, svgParseOuterInner} from './svg.ts';
import {createApp, h} from 'vue';
import {svg, svgParseOuterInner} from './svg.ts';
test('svg', () => {
expect(svg('octicon-repo')).toMatch(/^<svg/);
@@ -13,14 +12,3 @@ test('svgParseOuterInner', () => {
expect(svgOuter.classList.contains('octicon-repo')).toBeTruthy();
expect(svgInnerHtml).toContain('<path');
});
test('SvgIcon', () => {
const root = document.createElement('div');
createApp({render: () => h(SvgIcon, {name: 'octicon-link', size: 24, class: 'base'})}).mount(root);
const node = root.firstChild as Element;
expect(node.nodeName).toEqual('svg');
expect(node.getAttribute('width')).toEqual('24');
expect(node.getAttribute('height')).toEqual('24');
expect(node.classList.contains('octicon-link')).toBeTruthy();
expect(node.classList.contains('base')).toBeTruthy();
});