Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
08c9680
fix(rendering): keep justified bar widths and space bars against one …
Danielku15 Oct 25, 2026
6b8dcd5
perf(rendering): create glyph collections on first use and paint with…
Danielku15 Oct 25, 2026
4f26a8f
perf(rendering): lay out bar headers from shared profiles and build t…
Danielku15 Oct 25, 2026
010a8dd
refactor(rendering): decide which bars fit a system before adding them
Danielku15 Oct 25, 2026
ffa1009
perf(rendering): reuse systems on resize and cut glyph, beaming and s…
Danielku15 Oct 25, 2026
92835d0
perf(rendering): hand the bounds lookup from the browser worker as a …
Danielku15 Oct 25, 2026
7a4a7f7
perf(rendering): paint staff lines once per run of bars
Danielku15 Oct 29, 2026
c4c328a
fix(rendering): keep tab note geometry unchanged by painting and gene…
Danielku15 Oct 29, 2026
f4cd69f
perf(worker): send score and settings to the render worker as plain o…
Danielku15 Oct 29, 2026
a5dd34d
test(layout-flow): add paint, retained-memory, census and resize probes
Danielku15 Oct 29, 2026
d115e3c
perf(rendering): stop retaining painted partials and cut layout, pain…
Danielku15 Oct 29, 2026
10f856f
perf(browser): coalesce worker resizes and release the DOM of partial…
Danielku15 Oct 29, 2026
b6beb00
perf(rendering): keep pooled systems assembled on resize and write le…
Danielku15 Oct 29, 2026
034c4c6
Merge branch 'develop' into feature/layout-flow
Danielku15 Oct 29, 2026
edbe0e3
fix(model): read fonts, null fonts and typed arrays through the JSON …
Danielku15 Oct 30, 2026
0b8c646
perf(rendering): use indexed loops in rarely optimised functions and …
Danielku15 Oct 30, 2026
2610efb
fix(importer): read Guitar Pro 3-5 drum grace notes and note duration…
Danielku15 Oct 30, 2026
fa42da0
perf(build): inline enum member reads across modules in the library b…
Danielku15 Oct 30, 2026
059c4d2
fix(importer): keep Guitar Pro voices, drum strings and fingering sta…
Danielku15 Oct 30, 2026
16b31e8
fix(rendering): write longer rests as repeated 0 on numbered staves a…
Danielku15 Oct 30, 2026
e92040a
feat(core): add the trace log level and strip it from the library builds
Danielku15 Oct 30, 2026
898e441
fix(cross): align map deletes and integer parsing with JavaScript and…
Danielku15 Oct 30, 2026
066ec3c
fix(rendering): colour stems, beams, flags, tuplets and effects with …
Danielku15 Oct 30, 2026
c078400
refactor(serializer): send scores to the rendering worker as MessageP…
Danielku15 Oct 30, 2026
4b3fc60
fix(rendering): paint slurs, system separators, tunings and tab bends…
Danielku15 Oct 30, 2026
bc059c8
perf(worker): key the record fields of the binary score by generated ids
Danielku15 Oct 30, 2026
c147169
fix(rendering): merge and stack the bend labels of several notes on t…
Danielku15 Oct 30, 2026
7a61371
refactor(serializer): keep field keys once in generated field tables …
Danielku15 Oct 30, 2026
06c66bc
test: drop the layout-flow harness
Danielku15 Oct 31, 2026
0f67762
test(rendering): update reference images
Danielku15 Oct 31, 2026
f794540
chore(playground): drop the player position rate demo
Danielku15 Oct 31, 2026
0e20002
fix(serializer): satisfy the Biome 2.6 lint rules in the MessagePack …
Danielku15 Oct 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion packages/alphatab/biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"!.rollup.cache",
"!node_modules",
"!test-data",
"!src/generated"
"!src/generated",
"!test/generated"
]
},
"formatter": {
Expand Down
64 changes: 63 additions & 1 deletion packages/alphatab/scripts/Serializer.common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { TypeWithNullableInfo } from './TypeSchema';
import ts from 'typescript';
import type { TypeProperty, TypeSchema, TypeWithNullableInfo } from './TypeSchema';

export function findSerializerModule(type: TypeWithNullableInfo) {
const module = type.modulePath;
Expand All @@ -7,3 +8,64 @@ export function findSerializerModule(type: TypeWithNullableInfo) {
importPath[importPath.length - 1] = `${type.typeAsString}Serializer`;
return importPath.join('/');
}

export type Importer = (name: string, module: string, typeOnly?: boolean) => void;

const printer = ts.createPrinter();
const printerSourceFile = ts.createSourceFile('serializer.ts', '', ts.ScriptTarget.Latest);

export function printTypeNode(type: TypeWithNullableInfo): string {
return printer.printNode(ts.EmitHint.Unspecified, type.createTypeNode(), printerSourceFile);
}

/**
* The key a property is written with: its lowercased name.
*/
export function primaryJsonName(prop: TypeProperty): string | undefined {
return prop.jsonNames.filter(n => n !== '')[0];
}

export function isNullableOrOptional(type: TypeWithNullableInfo) {
return type.isNullable || type.isOptional;
}

export function isPrimitiveForSerialization(type: TypeWithNullableInfo) {
return type.isPrimitiveType || !!type.arrayItemType?.isPrimitiveType || type.isTypedArray;
}

export function isStrictType(type: TypeWithNullableInfo) {
return !!type.jsDocTags?.some(t => t.tagName.text === 'json_strict');
}

export function jsonAddMethod(prop: TypeProperty): string | undefined {
return prop.jsDocTags.filter(t => t.tagName.text === 'json_add').map(t => t.comment ?? '')[0] as
| string
| undefined;
}

/**
* Restricts the statements of a property to the web target if the property has `@target web`.
*/
export function wrapTarget(prop: TypeProperty, code: string): string {
if (!prop.target) {
return code;
}
if (prop.target !== 'web') {
throw new Error(`Only @target web is supported on serialized properties, found ${prop.target} on ${prop.name}`);
}
return `/*@target web*/\n{\n${code}\n}`;
}

/**
* The fields of a class that have a key, in declaration order. A field's id is its index in this list. Binary
* realisations write the id instead of the key, so both ends of a hand-off must come from the same generator
* output.
*/
export function serializedFields(serializable: TypeSchema): TypeProperty[] {
const fields = serializable.properties.filter(p => primaryJsonName(p) !== undefined);
if (fields.length > 256) {
throw new Error(`Field ids are written as one byte, ${fields.length} fields are too many`);
}
return fields;
}

51 changes: 0 additions & 51 deletions packages/alphatab/scripts/Serializer.fromJson.ts

This file was deleted.

Loading
Loading