@coderline/alphatab 1.3.0-alpha.257 → 1.3.0-alpha.262

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.
package/dist/alphaTab.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.257 (develop, build 257)
2
+ * alphaTab v1.3.0-alpha.262 (develop, build 262)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -7402,6 +7402,29 @@ class AlphaTexImporter extends ScoreImporter {
7402
7402
  master.repeatCount = this._syData;
7403
7403
  this._sy = this.newSy();
7404
7404
  }
7405
+ else if (syData === 'ae') {
7406
+ this._sy = this.newSy();
7407
+ if (this._sy === AlphaTexSymbols.LParensis) {
7408
+ this._sy = this.newSy();
7409
+ if (this._sy !== AlphaTexSymbols.Number) {
7410
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7411
+ }
7412
+ this.applyAlternateEnding(master);
7413
+ while (this._sy === AlphaTexSymbols.Number) {
7414
+ this.applyAlternateEnding(master);
7415
+ }
7416
+ if (this._sy !== AlphaTexSymbols.RParensis) {
7417
+ this.error('alternateending-list', AlphaTexSymbols.RParensis, true);
7418
+ }
7419
+ this._sy = this.newSy();
7420
+ }
7421
+ else {
7422
+ if (this._sy !== AlphaTexSymbols.Number) {
7423
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7424
+ }
7425
+ this.applyAlternateEnding(master);
7426
+ }
7427
+ }
7405
7428
  else if (syData === 'ks') {
7406
7429
  this._sy = this.newSy();
7407
7430
  if (this._sy !== AlphaTexSymbols.String) {
@@ -7500,6 +7523,16 @@ class AlphaTexImporter extends ScoreImporter {
7500
7523
  }
7501
7524
  return anyMeta;
7502
7525
  }
7526
+ applyAlternateEnding(master) {
7527
+ let num = this._syData;
7528
+ if (num < 1) {
7529
+ // Repeat numberings start from 1
7530
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7531
+ }
7532
+ // Alternate endings bitflag starts from 0
7533
+ master.alternateEndings |= 1 << (num - 1);
7534
+ this._sy = this.newSy();
7535
+ }
7503
7536
  }
7504
7537
  AlphaTexImporter.Eof = 0;
7505
7538
 
@@ -25961,14 +25994,7 @@ class AlphaSynthWebWorkerApi {
25961
25994
  this._synth = Environment.createAlphaTabWorker(alphaSynthScriptFile);
25962
25995
  }
25963
25996
  catch (e) {
25964
- // fallback to direct worker
25965
- try {
25966
- this._synth = new Worker(alphaSynthScriptFile);
25967
- }
25968
- catch (e2) {
25969
- Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e2);
25970
- return;
25971
- }
25997
+ Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e);
25972
25998
  }
25973
25999
  this._synth.addEventListener('message', this.handleWorkerMessage.bind(this), false);
25974
26000
  this._synth.postMessage({
@@ -26316,22 +26342,13 @@ class AlphaTabWorkerScoreRenderer {
26316
26342
  this.postRenderFinished = new EventEmitter();
26317
26343
  this.error = new EventEmitterOfT();
26318
26344
  this._api = api;
26319
- if (!settings.core.scriptFile) {
26320
- Logger.error('Rendering', `Could not detect alphaTab script file, cannot initialize renderer`);
26321
- return;
26322
- }
26323
26345
  // first try blob worker
26324
26346
  try {
26325
26347
  this._worker = Environment.createAlphaTabWorker(settings.core.scriptFile);
26326
26348
  }
26327
26349
  catch (e) {
26328
- try {
26329
- this._worker = new Worker(settings.core.scriptFile);
26330
- }
26331
- catch (e2) {
26332
- Logger.error('Rendering', `Failed to create WebWorker: ${e}`);
26333
- return;
26334
- }
26350
+ Logger.error('Rendering', `Failed to create WebWorker: ${e}`);
26351
+ return;
26335
26352
  }
26336
26353
  this._worker.postMessage({
26337
26354
  cmd: 'alphaTab.initialize',
@@ -27268,7 +27285,36 @@ class AlphaTabApi extends AlphaTabApiBase {
27268
27285
  a4.style.width = '210mm';
27269
27286
  }
27270
27287
  }
27271
- preview.document.write('<!DOCTYPE html><html></head><body></body></html>');
27288
+ // the style is a workaround for browser having problems with printing using absolute positions.
27289
+ preview.document.write(`
27290
+ <!DOCTYPE html>
27291
+ <html>
27292
+ <head>
27293
+ <style>
27294
+ .at-surface {
27295
+ width: auto !important;
27296
+ height: auto !important;
27297
+ }
27298
+ .at-surface > div {
27299
+ position: relative!important;
27300
+ left: auto !important;
27301
+ top: auto !important;
27302
+ break-inside: avoid;
27303
+ }
27304
+ </style>
27305
+ </head>
27306
+ <body></body>
27307
+ </html>
27308
+ `);
27309
+ const score = this.score;
27310
+ if (score) {
27311
+ if (score.artist && score.title) {
27312
+ preview.document.title = `${score.title} - ${score.artist}`;
27313
+ }
27314
+ else if (score.title) {
27315
+ preview.document.title = `${score.title}`;
27316
+ }
27317
+ }
27272
27318
  preview.document.body.appendChild(a4);
27273
27319
  let dualScreenLeft = typeof window['screenLeft'] !== 'undefined'
27274
27320
  ? window['screenLeft']
@@ -27294,11 +27340,21 @@ class AlphaTabApi extends AlphaTabApiBase {
27294
27340
  // render alphaTab
27295
27341
  let settings = JsonConverter.jsObjectToSettings(JsonConverter.settingsToJsObject(this.settings));
27296
27342
  settings.core.enableLazyLoading = false;
27297
- settings.core.useWorkers = false;
27343
+ settings.core.useWorkers = true;
27344
+ settings.core.file = null;
27345
+ settings.core.tracks = null;
27346
+ settings.player.enableCursor = false;
27347
+ settings.player.enablePlayer = false;
27348
+ settings.player.enableElementHighlighting = false;
27349
+ settings.player.enableUserInteraction = false;
27350
+ settings.player.soundFont = null;
27298
27351
  settings.display.scale = 0.8;
27299
27352
  settings.display.stretchForce = 0.8;
27300
27353
  SettingsSerializer.fromJson(settings, additionalSettings);
27301
27354
  let alphaTab = new AlphaTabApi(a4, settings);
27355
+ preview.onunload = () => {
27356
+ alphaTab.destroy();
27357
+ };
27302
27358
  alphaTab.renderer.postRenderFinished.on(() => {
27303
27359
  preview.print();
27304
27360
  });
@@ -40290,15 +40346,24 @@ class Environment {
40290
40346
  // @ts-ignore
40291
40347
  /* webpackChunkName: "alphatab.worker" */ new URL('@coderline/alphatab', import.meta.url));
40292
40348
  }
40293
- else if (Environment.webPlatform === WebPlatform.BrowserModule) {
40294
- const script = `import * as alphaTab from '${scriptFile}'`;
40295
- const blob = new Blob([script], { type: 'text/javascript' });
40296
- return new Worker(URL.createObjectURL(blob), { type: 'module' });
40349
+ if (!scriptFile) {
40350
+ throw new AlphaTabError(AlphaTabErrorType.General, "Could not detect alphaTab script file, cannot initialize renderer");
40297
40351
  }
40298
- else {
40299
- const script = `importScripts('${scriptFile}')`;
40300
- const blob = new Blob([script]);
40301
- return new Worker(URL.createObjectURL(blob));
40352
+ try {
40353
+ if (Environment.webPlatform === WebPlatform.BrowserModule) {
40354
+ const script = `import * as alphaTab from '${scriptFile}'`;
40355
+ const blob = new Blob([script], { type: 'text/javascript' });
40356
+ return new Worker(URL.createObjectURL(blob), { type: 'module' });
40357
+ }
40358
+ else {
40359
+ const script = `importScripts('${scriptFile}')`;
40360
+ const blob = new Blob([script]);
40361
+ return new Worker(URL.createObjectURL(blob));
40362
+ }
40363
+ }
40364
+ catch (e) {
40365
+ Logger.warning('Rendering', 'Could not create inline worker, fallback to normal worker');
40366
+ return new Worker(scriptFile);
40302
40367
  }
40303
40368
  }
40304
40369
  /**
@@ -40563,6 +40628,14 @@ class Environment {
40563
40628
  if (!('IntersectionObserver' in Environment.globalThis)) {
40564
40629
  Environment.globalThis.IntersectionObserver = IntersectionObserverPolyfill;
40565
40630
  }
40631
+ if (!('replaceChildren' in Element.prototype)) {
40632
+ Element.prototype.replaceChildren = function (...nodes) {
40633
+ this.innerHTML = '';
40634
+ this.append(...nodes);
40635
+ };
40636
+ Document.prototype.replaceChildren = Element.prototype.replaceChildren;
40637
+ DocumentFragment.prototype.replaceChildren = Element.prototype.replaceChildren;
40638
+ }
40566
40639
  }
40567
40640
  }
40568
40641
  /**
@@ -40782,8 +40855,8 @@ class CoreSettings {
40782
40855
  // </auto-generated>
40783
40856
  class VersionInfo {
40784
40857
  }
40785
- VersionInfo.version = '1.3.0-alpha.257';
40786
- VersionInfo.date = '2022-05-03T00:46:30.350Z';
40858
+ VersionInfo.version = '1.3.0-alpha.262';
40859
+ VersionInfo.date = '2022-05-08T00:46:19.866Z';
40787
40860
 
40788
40861
  var index$5 = /*#__PURE__*/Object.freeze({
40789
40862
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab",
3
- "version": "1.3.0-alpha.257",
3
+ "version": "1.3.0-alpha.262",
4
4
  "description": "alphaTab is a music notation and guitar tablature rendering library",
5
5
  "keywords": [
6
6
  "guitar",