feat: add Numbering 1.a.i, the default cycle as a preset

The gallery avoids presets the dropdown plus default nesting already
covers, but the default cycle itself earns its slot: once a list wears
another style, switching back needs a style to switch to. No sheet
version bump — an added built-in survives the merge on its own.
This commit is contained in:
Steffen Becker committed 2026-08-26 14:03:55 +00:00
1 parent 6f57a8e7ed
commit 525c95f3a8
3 files changed
+15 -8

No files matched your search

+4 -3
View File
@@ -17,11 +17,12 @@ plain lists) and both exporters share. **The style level decides the depth's kin
ODF the list style alone says what a depth renders, the editor's node species doesn't
travel. `setListStyle` retypes the subtree to the levels' kinds; a Tab-nested list of
the other species still renders (and exports) what the level says, and both importers
build the species from the level, so a round trip normalizes it. The five built-ins are a **preset gallery of
build the species from the level, so a round trip normalizes it. The six built-ins are a **preset gallery of
patterns the depth cycle can't produce** — the outline chains Outline I.A.1 / A.I.1, the
kind-mixing Numbering with Bullets and Checklist, and the Diamond Bullets ladder — all on
the plain 1.27cm step (no indentCm), so a preset that only restates a dropdown format plus
the default nesting has no place in it.
the plain 1.27cm step (no indentCm). The one deliberate exception is Numbering 1.a.i, the
default cycle captured as a style so a style switch can lead back to it; any further
preset that only restates a dropdown format plus the default nesting has no place here.
Export writes the full named `<text:list-style>` into styles.xml and points the list at it
**only when nothing overrides** — ODF list styles have no parent chain, so an overridden
list keeps the fully resolved automatic clone and drops the name (marker formats count as
+5 -3
View File
@@ -124,9 +124,9 @@ const ladder = (head: ListLevelStyle[], tail: ListLevelStyle[]): ListLevelStyle[
Array.from({ length: MAX_LIST_LEVELS }, (_, i) =>
structuredClone(i < head.length ? head[i] : tail[(i - head.length) % tail.length]));
// The gallery: presets the depth cycle can't produce on its own — uppercase outline
// chains, levels mixing numbers with bullets, a decorative bullet ladder. All keep the
// plain 1.27cm step per level (no indentCm), the geometry an unstyled list gets.
// The gallery: outline chains, kind mixes and a bullet ladder the depth cycle can't
// produce — plus that cycle itself as Numbering 1.a.i, the way back after a switch.
// All keep the plain 1.27cm step per level (no indentCm), like an unstyled list.
const LIST_BUILTINS: ListStyle[] = [
{ name: 'Outline I.A.1', builtin: true,
levels: ladder([num('upper-roman', 'right'), num('upper-alpha')],
@@ -134,6 +134,8 @@ const LIST_BUILTINS: ListStyle[] = [
{ name: 'Outline A.I.1', builtin: true,
levels: ladder([num('upper-alpha'), num('upper-roman', 'right')],
[num('decimal'), num('lower-alpha-paren'), num('lower-roman-paren')]) },
{ name: 'Numbering 1.a.i', builtin: true,
levels: ladder([], [num('decimal'), num('lower-alpha'), num('lower-roman')]) },
{ name: 'Numbering with Bullets', builtin: true,
levels: ladder([num('decimal')], [bul('–'), bul('◦'), bul('▪')]) },
{ name: 'Diamond Bullets', builtin: true,
+6 -2
View File
@@ -87,9 +87,9 @@ describe('listStyleOverridden', () => {
describe('the built-ins (the preset gallery)', () => {
const builtins = builtinListStyles();
it('ship five presets, ten levels each, none uniform across its levels', () => {
it('ship six presets, ten levels each, none uniform across its levels', () => {
expect(Object.keys(builtins).sort()).toEqual(
['Checklist', 'Diamond Bullets', 'Numbering with Bullets', 'Outline A.I.1', 'Outline I.A.1']);
['Checklist', 'Diamond Bullets', 'Numbering 1.a.i', 'Numbering with Bullets', 'Outline A.I.1', 'Outline I.A.1']);
for (const s of Object.values(builtins)) {
expect(s.levels).toHaveLength(MAX_LIST_LEVELS);
const markers = new Set(s.levels.map((l) => `${l.kind}:${l.bulletChar ?? l.numType}`));
@@ -105,6 +105,10 @@ describe('the built-ins (the preset gallery)', () => {
['upper-roman', 'upper-alpha', 'decimal', 'lower-alpha-paren', 'lower-roman-paren']);
expect(builtins['Outline I.A.1'].levels[0].markerAlign).toBe('right');
});
it('Numbering 1.a.i captures the default cycle, so a style switch can lead back', () => {
expect(builtins['Numbering 1.a.i'].levels.slice(0, 4).map((l) => l.numType)).toEqual(
['decimal', 'lower-alpha', 'lower-roman', 'decimal']);
});
it('Numbering with Bullets numbers level 1 and dashes the levels below', () => {
expect(builtins['Numbering with Bullets'].levels[0]).toMatchObject({ kind: 'number', numType: 'decimal' });
expect(builtins['Numbering with Bullets'].levels[1]).toMatchObject({ kind: 'bullet', bulletChar: '–' });