Sync snapshot (2026-09-09) (#271)

- **New app: GenOffice HTML.** Open, edit and generate .html pages: a source pane with a sandboxed live preview, click-to-select elements with a floating toolbar and style panel, device-size preview, image tools and a present mode. AI generates whole pages from a brief with style directions and offers page-wide Restyle, Theme and Summarize. Export to Word runs locally through the built-in html2docx converter (native, editable OOXML; no print-to-PDF detour).
- **AI:** separate BYOK providers for web search, image generation and image/video analysis; new Codex App Server provider; Ask AI quotes the selected text and keeps it highlighted while it runs; custom AI panel text size; blocked requests retry through the Chromium network stack.
- **App:** global AutoSave setting shared by every editor; AI panel text size and chat spellcheck toggles (genoffice#249); Czech (cs) UI locale (genoffice#259); Save As defaults to the document's folder; PDF export no longer aborts on CJK file paths on Windows.
- **Docs:** Export as HTML; comments and replies edit in place from the comments pane; the caret can leave a trailing table (genoffice#266); spellcheck re-marks text as soon as it is re-enabled; AI edits are character-precise on partial selections; zoom keeps the scroll position; pasting a cell from Sheets takes the destination font.
- **Sheets:** Find no longer freezes on wide or streamed grids; Replace searches as you type; cached values of external-workbook formulas are kept instead of #ERROR! (genoffice#235); "number stored as text" is a warning, not an error (genoffice#236); paste repeats into the target range like Excel; filter criteria survive save/reopen; saves retry when Windows locks the file; many Excel-fidelity fixes for column widths, row heights, charts, slicers, number formats and CJK fonts.
- **Slides:** PDF export works for large presentations (genoffice#264); EMF/WMF picture fonts and East Asian theme fonts resolve correctly; decks with missing layouts or embedded styles still open; outline-only pie slices render.
- **PDF:** highlight and underline geometry aligns with the text; Shift+arrows extend the selection instead of paging.
- **Markdown:** Find and replace (Ctrl+F / Ctrl+H) (genoffice#253); mermaid code blocks render as diagrams (genoffice#263); better print quality.
- Thanks to community contributors @GoodScholar, @aniruddhaadak80 and @Sun8854, and to @hanyscz, @qgzln, @zyp997, @bisslot, @krakotay and @Ben03151 for the reports.

Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
This commit is contained in:
merrick-2002
2026-09-09 18:19:13 +08:00
committed by GitHub
co-authored by GenOffice
parent fa58fff047
commit d24c964a3e
678 changed files with 75586 additions and 7492 deletions
+1 -1
View File
@@ -24,6 +24,6 @@
"@types/opentype.js": "^1.3.8",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"vitest": "^4.1.0"
"vitest": "^4.1.11"
}
}
+33 -5
View File
@@ -1253,13 +1253,36 @@ function buildPieNode(
const sliceColor = (i: number) =>
ser.pointColors?.[i] ??
(model.varyColors === false ? (ser.color ?? palette[0]!) : palette[i % palette.length]!)
// Outline-only wedge (dPt noFill): the legend swatch takes the outline color
const swatchColor = (i: number) =>
ser.pointNoFill?.[i] ? (ser.pointLines?.[i]?.color ?? sliceColor(i)) : sliceColor(i)
const wedgeStroke = (i: number): { stroke?: string; strokeWidthPx?: number } => {
const ln = ser.pointLines?.[i]
if (!ln) return {}
if (ln.color === null) return { strokeWidthPx: 0 }
return {
stroke: ln.color,
...(ln.widthPt != null ? { strokeWidthPx: ptToPx(ln.widthPt, vp.scale) } : {}),
}
}
// Pseudo-3D top faces: same fill/outline semantics as 2D wedges, resolved to path props
const faceProps = (i: number): { fill: string; stroke?: string; strokeWidthPx?: number } => {
const st = wedgeStroke(i)
const fill = ser.pointNoFill?.[i] ? 'transparent' : sliceColor(i)
if (st.strokeWidthPx === 0) return { fill }
return {
fill,
stroke: st.stroke ?? '#ffffff',
...(st.strokeWidthPx != null ? { strokeWidthPx: st.strokeWidthPx } : {}),
}
}
const pad = Math.max(6, Math.min(box.w, box.h) * 0.03)
// Legend space (without a legend, the whole box goes to the pie)
const legendPos = model.legendPos
const legendItems = model.categories.map((cat, i) => ({
label: cat,
color: sliceColor(i),
color: swatchColor(i),
}))
const legendRowH = labelSizePx * 1.5
let plotW = box.w - pad * 2
@@ -1349,6 +1372,11 @@ function buildPieNode(
if (v <= 0) return
const sweep = (v / total) * 360
const { dx, dy } = explOffset(a, sweep, i)
// Outline-only points have no rim (nothing to extrude)
if (ser.pointNoFill?.[i]) {
a += sweep
return
}
// normalize wedge interval into [-180, 180) then clamp to the front range [0, 180]
for (const off of [-360, 0, 360]) {
const b1 = Math.max(a + off, 0)
@@ -1383,16 +1411,14 @@ function buildPieNode(
d:
`M ${p1.x} ${p1.y} A ${rx} ${ry} 0 1 1 ${pm.x} ${pm.y} ` +
`A ${rx} ${ry} 0 1 1 ${p1.x} ${p1.y} Z`,
fill: sliceColor(i),
stroke: '#ffffff',
...faceProps(i),
})
} else {
const p2 = ptAt(angle + sweep, dx, dy)
const large = sweep > 180 ? 1 : 0
node.paths!.push({
d: `M ${cx + dx} ${cy + dy} L ${p1.x} ${p1.y} A ${rx} ${ry} 0 ${large} 1 ${p2.x} ${p2.y} Z`,
fill: sliceColor(i),
stroke: '#ffffff',
...faceProps(i),
})
}
} else {
@@ -1404,6 +1430,8 @@ function buildPieNode(
startDeg: angle,
sweepDeg: sweep,
color: sliceColor(i),
...(ser.pointNoFill?.[i] ? { noFill: true } : {}),
...wedgeStroke(i),
})
}
if (model.series[0]?.dataLabels ?? model.dataLabels) {
+6 -1
View File
@@ -493,7 +493,7 @@ export interface ChartRenderNode extends RenderNodeBase {
/** Legend swatches */
swatches: Array<{ x: number; y: number; w: number; h: number; color: string }>
/** Freeform filled paths (SVG data), painter's order — pseudo-3D pie rims / bar extrusion faces */
paths?: Array<{ d: string; fill: string; stroke?: string; dy?: number }>
paths?: Array<{ d: string; fill: string; stroke?: string; strokeWidthPx?: number; dy?: number }>
/** Pie/doughnut wedges (angles: 12 o'clock = -90°, clockwise, Konva Arc semantics) */
wedges?: Array<{
cx: number
@@ -503,6 +503,11 @@ export interface ChartRenderNode extends RenderNodeBase {
startDeg: number
sweepDeg: number
color: string
/** Outline-only wedge (c:dPt noFill); color then only feeds the legend swatch */
noFill?: boolean
/** Per-point outline; undefined = default hairline white separator */
stroke?: string
strokeWidthPx?: number
}>
}
+45 -1
View File
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'
import type { ChartModel } from '@genoffice/pptx-engine'
import { buildChartNode } from '../src/build-chart'
import { HeuristicMetrics } from '../src/metrics'
import { makeViewport } from '../src/coords'
import { makeViewport, ptToPx } from '../src/coords'
const vp = makeViewport({ cx: 12192000, cy: 6858000 }, 1280)
const metrics = new HeuristicMetrics()
@@ -213,6 +213,50 @@ describe('buildChartNode', () => {
expect(h2! / h1!).toBeCloseTo(3, 1)
})
it('outline-only pie points carry noFill + per-point stroke; legend swatch takes the outline color', () => {
const pie: ChartModel = {
kind: 'pie',
categories: ['x', 'y', 'z'],
series: [
{
values: [1, 1, 2],
pointNoFill: [true, undefined, true],
pointLines: [{ color: '#AA0000', widthPt: 1.5 }, { color: null }, undefined],
},
],
legendPos: 'r',
}
const node = buildChartNode('r_pie2', 'el', pie, box, vp, metrics)!
const [w0, w1, w2] = node.wedges!
expect(w0).toMatchObject({
noFill: true,
stroke: '#AA0000',
strokeWidthPx: ptToPx(1.5, vp.scale),
})
expect(w1!.noFill).toBeUndefined()
expect(w1!.strokeWidthPx).toBe(0)
expect(w1!.stroke).toBeUndefined()
expect(w2).toMatchObject({ noFill: true })
expect(w2!.stroke).toBeUndefined()
expect(node.swatches[0]!.color).toBe('#AA0000')
// Pseudo-3D: top faces follow the same semantics, outline-only points grow no rim
const node3d = buildChartNode('r_pie3', 'el', { ...pie, pseudo3D: true }, box, vp, metrics)!
expect(node3d.wedges).toHaveLength(0)
// rims are pushed first, then one top face per point
const faces = node3d.paths!.slice(-3)
expect(faces[0]).toMatchObject({
fill: 'transparent',
stroke: '#AA0000',
strokeWidthPx: ptToPx(1.5, vp.scale),
})
expect(faces[1]!.fill).not.toBe('transparent')
expect(faces[1]!.stroke).toBeUndefined()
expect(faces[2]).toMatchObject({ fill: 'transparent', stroke: '#ffffff' })
// rims exist only for the filled point
expect(node3d.paths!.length - faces.length).toBeGreaterThan(0)
})
it('builds pie wedges summing to 360° with per-point colors', () => {
const pie: ChartModel = {
kind: 'pie',