@coderline/alphatab 1.7.0 → 1.7.1

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.
@@ -255,7 +255,7 @@ export declare class AlphaTabApi extends AlphaTabApiBase<SettingsJson | Settings
255
255
  /**
256
256
  * @inheritdoc
257
257
  */
258
- tex(tex: string, tracks?: number[]): void;
258
+ tex(tex: string, tracks?: number[] | 'all'): void;
259
259
  /**
260
260
  * Opens a popup window with the rendered music notation for printing.
261
261
  * @param width An optional custom width as CSS width that should be used. Best is to use a CSS width that is suitable for your preferred page size.
@@ -2935,6 +2935,7 @@ declare enum AlphaTabSystemExclusiveEvents {
2935
2935
 
2936
2936
  export declare namespace alphaTex {
2937
2937
  export {
2938
+ AlphaTexArgumentList,
2938
2939
  AlphaTexAsteriskTokenNode,
2939
2940
  AlphaTexAstNode,
2940
2941
  AlphaTexAstNodeLocation,
@@ -2964,12 +2965,12 @@ export declare namespace alphaTex {
2964
2965
  AlphaTexStringLiteral,
2965
2966
  AlphaTexTextNode,
2966
2967
  AlphaTexTokenNode,
2967
- AlphaTexValueList,
2968
+ IAlphaTexArgumentValue,
2968
2969
  IAlphaTexAstNode,
2969
2970
  IAlphaTexMetaDataTagPrefixNode,
2970
2971
  IAlphaTexNoteValueNode,
2971
- IAlphaTexValueListItem,
2972
2972
  AlphaTexLexer,
2973
+ AlphaTexParseMode,
2973
2974
  AlphaTexParser,
2974
2975
  AlphaTexAccidentalMode,
2975
2976
  AlphaTexDiagnostic,
@@ -2977,6 +2978,7 @@ export declare namespace alphaTex {
2977
2978
  AlphaTexDiagnosticCode,
2978
2979
  AlphaTexDiagnosticsSeverity,
2979
2980
  AlphaTexStaffNoteKind,
2981
+ ArgumentListParseTypesMode,
2980
2982
  IAlphaTexImporter,
2981
2983
  IAlphaTexImporterState
2982
2984
  }
@@ -2990,6 +2992,37 @@ declare enum AlphaTexAccidentalMode {
2990
2992
  Explicit = 1
2991
2993
  }
2992
2994
 
2995
+ /**
2996
+ * A node holding multiple arguments optionally grouped by parenthesis.
2997
+ * Whether parenthesis are needed depends on the context.
2998
+ * Used in contexts like bend effects `3.3{b (0 4)}`.
2999
+ * @record
3000
+ * @public
3001
+ */
3002
+ declare interface AlphaTexArgumentList extends AlphaTexAstNode {
3003
+ nodeType: AlphaTexNodeType.Arguments;
3004
+ /**
3005
+ * The open parenthesis token grouping the arguments.
3006
+ */
3007
+ openParenthesis?: AlphaTexParenthesisOpenTokenNode;
3008
+ /**
3009
+ * The list of arguments.
3010
+ */
3011
+ arguments: IAlphaTexArgumentValue[];
3012
+ /**
3013
+ * The close parenthesis token grouping the arguments.
3014
+ */
3015
+ closeParenthesis?: AlphaTexParenthesisCloseTokenNode;
3016
+
3017
+ /**
3018
+ * A list of indices to signatures which were selected as candidates matching
3019
+ * this argument list.
3020
+ * These values can be used to lookup the respective signature definition in
3021
+ * the documentation or alphaTex language definition.
3022
+ */
3023
+ signatureCandidateIndices?: number[];
3024
+ }
3025
+
2993
3026
  /**
2994
3027
  * @record
2995
3028
  * @public
@@ -3271,11 +3304,11 @@ declare enum AlphaTexDiagnosticCode {
3271
3304
  */
3272
3305
  AT208 = 208,
3273
3306
  /**
3274
- * Unexpected %s value '%s', expected: %s
3307
+ * Unexpected %s arguments '%s', Signature: %s
3275
3308
  */
3276
3309
  AT209 = 209,
3277
3310
  /**
3278
- * Missing values. Expected following values: %s
3311
+ * Missing arguments. Expected following arguments: %s
3279
3312
  */
3280
3313
  AT210 = 210,
3281
3314
  /**
@@ -3291,7 +3324,7 @@ declare enum AlphaTexDiagnosticCode {
3291
3324
  */
3292
3325
  AT213 = 213,
3293
3326
  /**
3294
- * The '%s' effect needs %s values per item. With %s points, %s values are needed, only %s values found.
3327
+ * The '%s' effect needs %s arguments per item. With %s points, %s arguments are needed, only %s arguments found.
3295
3328
  */
3296
3329
  AT214 = 214,
3297
3330
  /**
@@ -3311,19 +3344,27 @@ declare enum AlphaTexDiagnosticCode {
3311
3344
  */
3312
3345
  AT218 = 218,
3313
3346
  /**
3314
- * Expected no values, but found some. Values are ignored.
3347
+ * Error parsing arguments: no overload matched arguments %s. Signatures: %s
3348
+ */
3349
+ AT219 = 219,
3350
+ /**
3351
+ * Error parsing arguments: unexpected additional arguments. Signatures: %s
3352
+ */
3353
+ AT220 = 220,
3354
+ /**
3355
+ * Expected no arguments, but found some.
3315
3356
  */
3316
3357
  AT300 = 300,
3317
3358
  /**
3318
- * Metadata values should be wrapped into parenthesis.
3359
+ * Metadata arguments should be wrapped into parenthesis.
3319
3360
  */
3320
3361
  AT301 = 301,
3321
3362
  /**
3322
- * Metadata values should be placed before metadata properties.
3363
+ * Metadata arguments should be placed before metadata properties.
3323
3364
  */
3324
3365
  AT302 = 302,
3325
3366
  /**
3326
- * Property values should be wrapped into parenthesis.
3367
+ * Property arguments should be wrapped into parenthesis.
3327
3368
  */
3328
3369
  AT303 = 303,
3329
3370
  /**
@@ -3412,7 +3453,7 @@ declare class AlphaTexExporter extends ScoreExporter {
3412
3453
  * @record
3413
3454
  * @public
3414
3455
  */
3415
- declare interface AlphaTexIdentifier extends AlphaTexTextNode, IAlphaTexValueListItem, IAlphaTexNoteValueNode {
3456
+ declare interface AlphaTexIdentifier extends AlphaTexTextNode, IAlphaTexArgumentValue, IAlphaTexNoteValueNode {
3416
3457
  nodeType: AlphaTexNodeType.Ident;
3417
3458
  }
3418
3459
 
@@ -3420,13 +3461,19 @@ declare interface AlphaTexIdentifier extends AlphaTexTextNode, IAlphaTexValueLis
3420
3461
  * @public
3421
3462
  */
3422
3463
  declare class AlphaTexImporter extends ScoreImporter implements IAlphaTexImporter {
3423
- private _parser;
3464
+ private _parser?;
3424
3465
  private _handler;
3425
3466
  private _state;
3426
3467
  get state(): IAlphaTexImporterState;
3468
+ get scoreNode(): AlphaTexScoreNode | undefined;
3427
3469
  get name(): string;
3428
3470
  get lexerDiagnostics(): AlphaTexDiagnosticBag;
3429
3471
  get parserDiagnostics(): AlphaTexDiagnosticBag;
3472
+ /**
3473
+ * The underlying parser used for parsing the AST. Available after initialization of the importer.
3474
+ */
3475
+ get parser(): AlphaTexParser | undefined;
3476
+ get parseMode(): AlphaTexParseMode;
3430
3477
  logErrors: boolean;
3431
3478
  readonly semanticDiagnostics: AlphaTexDiagnosticBag;
3432
3479
  addSemanticDiagnostic(diagnostic: AlphaTexDiagnostic): void;
@@ -3465,7 +3512,7 @@ declare class AlphaTexLexer {
3465
3512
  private _offset;
3466
3513
  private _line;
3467
3514
  private _col;
3468
- private _fatalError;
3515
+ fatalError: boolean;
3469
3516
  private _tokenStart;
3470
3517
  private _leadingComments;
3471
3518
  private _trailingCommentNode;
@@ -3498,7 +3545,7 @@ declare class AlphaTexLexer {
3498
3545
  }
3499
3546
 
3500
3547
  /**
3501
- * A metadata tag with optional values and optional properties like:
3548
+ * A metadata tag with optional arguments and optional properties like:
3502
3549
  * `\track "Name" {color "#F00"}` .
3503
3550
  * @record
3504
3551
  * @public
@@ -3510,17 +3557,14 @@ declare interface AlphaTexMetaDataNode extends AlphaTexAstNode {
3510
3557
  */
3511
3558
  tag: AlphaTexMetaDataTagNode;
3512
3559
  /**
3513
- * A value list directly listed after the metadata (not within braces).
3560
+ * A argument list directly listed after the metadata.
3514
3561
  */
3515
- values?: AlphaTexValueList;
3562
+ arguments?: AlphaTexArgumentList;
3516
3563
  /**
3517
- * The optional properties attached to the metadata.
3564
+ * The optional properties defined for the metadata.
3518
3565
  */
3519
3566
  properties?: AlphaTexPropertiesNode;
3520
- /**
3521
- * Whether the properties are listed before the values (if both are present).
3522
- */
3523
- propertiesBeforeValues: boolean;
3567
+
3524
3568
  }
3525
3569
 
3526
3570
  /**
@@ -3558,7 +3602,7 @@ declare enum AlphaTexNodeType {
3558
3602
  Ident = 10,
3559
3603
  Tag = 11,
3560
3604
  Meta = 12,
3561
- Values = 13,
3605
+ Arguments = 13,
3562
3606
  Props = 14,
3563
3607
  Prop = 15,
3564
3608
  Number = 16,
@@ -3626,7 +3670,7 @@ declare interface AlphaTexNoteNode extends AlphaTexAstNode {
3626
3670
  * @record
3627
3671
  * @public
3628
3672
  */
3629
- declare interface AlphaTexNumberLiteral extends AlphaTexAstNode, IAlphaTexValueListItem, IAlphaTexNoteValueNode {
3673
+ declare interface AlphaTexNumberLiteral extends AlphaTexAstNode, IAlphaTexArgumentValue, IAlphaTexNoteValueNode {
3630
3674
  nodeType: AlphaTexNodeType.Number;
3631
3675
  /**
3632
3676
  * The numeric value described by this literal.
@@ -3650,6 +3694,25 @@ declare interface AlphaTexParenthesisOpenTokenNode extends AlphaTexTokenNode {
3650
3694
  nodeType: AlphaTexNodeType.LParen;
3651
3695
  }
3652
3696
 
3697
+ /**
3698
+ * The different modes of the alphaTex parser.
3699
+ * @public
3700
+ */
3701
+ declare enum AlphaTexParseMode {
3702
+ /**
3703
+ * Optimizes the parser for only the model importing.
3704
+ * The model importing does not need all details from the AST allowing a more lightweight
3705
+ * parsing.
3706
+ */
3707
+ ForModelImport = 0,
3708
+ /**
3709
+ * Performs the full AST parsing with all details.
3710
+ * This mode is mainly used by the Language Server providing IDE support.
3711
+ * All AST information is parsed and filled.
3712
+ */
3713
+ Full = 1
3714
+ }
3715
+
3653
3716
  /**
3654
3717
  * A parser for translating a given alphaTex source into an AST for further use
3655
3718
  * in the alphaTex importer, editors etc.
@@ -3659,6 +3722,10 @@ declare class AlphaTexParser {
3659
3722
  readonly lexer: AlphaTexLexer;
3660
3723
  private _scoreNode;
3661
3724
  private _metaDataReader;
3725
+ /**
3726
+ * The parsing mode.
3727
+ */
3728
+ mode: AlphaTexParseMode;
3662
3729
  get lexerDiagnostics(): AlphaTexDiagnosticBag;
3663
3730
  readonly parserDiagnostics: AlphaTexDiagnosticBag;
3664
3731
  addParserDiagnostic(diagnostics: AlphaTexDiagnostic): void;
@@ -3680,7 +3747,7 @@ declare class AlphaTexParser {
3680
3747
  private _metaData;
3681
3748
  private _properties;
3682
3749
  private _property;
3683
- valueList(): AlphaTexValueList | undefined;
3750
+ argumentList(): AlphaTexArgumentList | undefined;
3684
3751
  }
3685
3752
 
3686
3753
  /**
@@ -3714,7 +3781,7 @@ declare interface AlphaTexPropertiesNode extends AlphaTexAstNode {
3714
3781
  }
3715
3782
 
3716
3783
  /**
3717
- * A node describing a property with attached values.
3784
+ * A node describing a property with attached arguments.
3718
3785
  * @record
3719
3786
  * @public
3720
3787
  */
@@ -3725,9 +3792,9 @@ declare interface AlphaTexPropertyNode extends AlphaTexAstNode {
3725
3792
  */
3726
3793
  property: AlphaTexIdentifier;
3727
3794
  /**
3728
- * The values attached to the property.
3795
+ * The arguments passed into to the property.
3729
3796
  */
3730
- values?: AlphaTexValueList;
3797
+ arguments?: AlphaTexArgumentList;
3731
3798
  }
3732
3799
 
3733
3800
  /**
@@ -3758,7 +3825,7 @@ declare enum AlphaTexStaffNoteKind {
3758
3825
  * @record
3759
3826
  * @public
3760
3827
  */
3761
- declare interface AlphaTexStringLiteral extends AlphaTexTextNode, IAlphaTexValueListItem, IAlphaTexNoteValueNode {
3828
+ declare interface AlphaTexStringLiteral extends AlphaTexTextNode, IAlphaTexArgumentValue, IAlphaTexNoteValueNode {
3762
3829
  nodeType: AlphaTexNodeType.String;
3763
3830
  }
3764
3831
 
@@ -3784,27 +3851,45 @@ declare interface AlphaTexTokenNode extends AlphaTexAstNode {
3784
3851
  }
3785
3852
 
3786
3853
  /**
3787
- * A node holding multiple values optionally grouped by parenthesis.
3788
- * Whether parenthesis are needed depends on the context.
3789
- * Used in contexts like bend effects `3.3{b (0 4)}`.
3790
- * @record
3854
+ * Defines how the arguments of the meta data tag is parsed.
3791
3855
  * @public
3792
3856
  */
3793
- declare interface AlphaTexValueList extends AlphaTexAstNode {
3794
- nodeType: AlphaTexNodeType.Values;
3857
+ declare enum ArgumentListParseTypesMode {
3795
3858
  /**
3796
- * The open parenthesis token grouping the values.
3859
+ * Indicates that the parameter of the given types is required.
3860
+ * If the token matches, it is added to the value list.
3861
+ * If the token does not match, an error diagnostic is added and parsing is stopped.
3797
3862
  */
3798
- openParenthesis?: AlphaTexParenthesisOpenTokenNode;
3863
+ Required = 0,
3799
3864
  /**
3800
- * The list of values.
3865
+ * Indicates that the parameter of the given types is optional.
3866
+ * If the token matches, it is added to the value list.
3867
+ * If the token does not match, the value list completes and parsing continues.
3801
3868
  */
3802
- values: IAlphaTexValueListItem[];
3869
+ Optional = 1,
3803
3870
  /**
3804
- * The close parenthesis token grouping the values.
3871
+ * Same as {@link Required} but the next argument is interpreted as a float.
3805
3872
  */
3806
- closeParenthesis?: AlphaTexParenthesisCloseTokenNode;
3807
-
3873
+ RequiredAsFloat = 2,
3874
+ /**
3875
+ * Same as {@link Optional} but the next argument is interpreted as a float.
3876
+ */
3877
+ OptionalAsFloat = 3,
3878
+ /**
3879
+ * Indicates that multiple arguments of the same types should be parsed as a list
3880
+ * Think: rest-parameter that allows parameters to follow if the type doesn't match anymore.
3881
+ * If the token is a open parenthesis, it starts reading the specified types as value list. If an unexpected item is
3882
+ * encountered an error diagnostic is added.
3883
+ * If the token matches the expected type, a single value is read.
3884
+ * If the token is any other type, an error diagnostic is added and parsing is stopped.
3885
+ */
3886
+ RequiredAsValueList = 4,
3887
+ /**
3888
+ * Indicates that multiple parameters of the same types should be parsed. (this is mainly for backwards compatibility with older alphaTex files)
3889
+ * If the token matches, it is added to the value list. Parsing stays on the current type.
3890
+ * If the token does not match, the value list completes and parsing continues.
3891
+ */
3892
+ ValueListWithoutParenthesis = 5
3808
3893
  }
3809
3894
 
3810
3895
  /**
@@ -8510,6 +8595,22 @@ declare interface IAlphaSynthAudioExporter {
8510
8595
  render(milliseconds: number): AudioExportChunk | undefined;
8511
8596
  }
8512
8597
 
8598
+ /**
8599
+ * Base marker interface for nodes which can be arguments in an {@link AlphaTexArgumentList}
8600
+ * @public
8601
+ */
8602
+ declare interface IAlphaTexArgumentValue extends IAlphaTexAstNode {
8603
+ /**
8604
+ * For every signature candidate available for parent current argument list, this
8605
+ * array contains the index to the parameter definition in the alphaTex language definitino.
8606
+ *
8607
+ * This value can be used to lookup the respective parameter definition in
8608
+ * the documentation or alphaTex language definition. As paramters can be optional this value
8609
+ * allows a reverse lookup to the parameter information.
8610
+ */
8611
+ parameterIndices?: Map<number, number>;
8612
+ }
8613
+
8513
8614
  /**
8514
8615
  * The base type for all alphaTex AST nodes
8515
8616
  * @public
@@ -8542,6 +8643,7 @@ declare interface IAlphaTexAstNode {
8542
8643
  */
8543
8644
  declare interface IAlphaTexImporter {
8544
8645
  readonly state: IAlphaTexImporterState;
8646
+ readonly parseMode: AlphaTexParseMode;
8545
8647
  applyStaffNoteKind(staff: Staff, staffNoteKind: AlphaTexStaffNoteKind): void;
8546
8648
  startNewVoice(): void;
8547
8649
  startNewTrack(): Track;
@@ -8580,13 +8682,6 @@ declare interface IAlphaTexMetaDataTagPrefixNode extends IAlphaTexAstNode {
8580
8682
  declare interface IAlphaTexNoteValueNode extends IAlphaTexAstNode {
8581
8683
  }
8582
8684
 
8583
- /**
8584
- * Defines the possible types for values in a {@link AlphaTexValueList}
8585
- * @public
8586
- */
8587
- declare interface IAlphaTexValueListItem extends IAlphaTexAstNode {
8588
- }
8589
-
8590
8685
  /**
8591
8686
  * A {@link IBackingTrackSynthOutput} which uses a HTMLAudioElement as playback mechanism.
8592
8687
  * Allows the access to the element for further custom usage.