@coderline/alphatab 1.3.0-alpha.250 → 1.3.0-alpha.264

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.250 (develop, build 250)
2
+ * alphaTab v1.3.0-alpha.264 (develop, build 264)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -7408,6 +7408,29 @@
7408
7408
  master.repeatCount = this._syData;
7409
7409
  this._sy = this.newSy();
7410
7410
  }
7411
+ else if (syData === 'ae') {
7412
+ this._sy = this.newSy();
7413
+ if (this._sy === AlphaTexSymbols.LParensis) {
7414
+ this._sy = this.newSy();
7415
+ if (this._sy !== AlphaTexSymbols.Number) {
7416
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7417
+ }
7418
+ this.applyAlternateEnding(master);
7419
+ while (this._sy === AlphaTexSymbols.Number) {
7420
+ this.applyAlternateEnding(master);
7421
+ }
7422
+ if (this._sy !== AlphaTexSymbols.RParensis) {
7423
+ this.error('alternateending-list', AlphaTexSymbols.RParensis, true);
7424
+ }
7425
+ this._sy = this.newSy();
7426
+ }
7427
+ else {
7428
+ if (this._sy !== AlphaTexSymbols.Number) {
7429
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7430
+ }
7431
+ this.applyAlternateEnding(master);
7432
+ }
7433
+ }
7411
7434
  else if (syData === 'ks') {
7412
7435
  this._sy = this.newSy();
7413
7436
  if (this._sy !== AlphaTexSymbols.String) {
@@ -7506,6 +7529,16 @@
7506
7529
  }
7507
7530
  return anyMeta;
7508
7531
  }
7532
+ applyAlternateEnding(master) {
7533
+ let num = this._syData;
7534
+ if (num < 1) {
7535
+ // Repeat numberings start from 1
7536
+ this.error('alternateending', AlphaTexSymbols.Number, true);
7537
+ }
7538
+ // Alternate endings bitflag starts from 0
7539
+ master.alternateEndings |= 1 << (num - 1);
7540
+ this._sy = this.newSy();
7541
+ }
7509
7542
  }
7510
7543
  AlphaTexImporter.Eof = 0;
7511
7544
 
@@ -25967,14 +26000,7 @@
25967
26000
  this._synth = Environment.createAlphaTabWorker(alphaSynthScriptFile);
25968
26001
  }
25969
26002
  catch (e) {
25970
- // fallback to direct worker
25971
- try {
25972
- this._synth = new Worker(alphaSynthScriptFile);
25973
- }
25974
- catch (e2) {
25975
- Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e2);
25976
- return;
25977
- }
26003
+ Logger.error('AlphaSynth', 'Failed to create WebWorker: ' + e);
25978
26004
  }
25979
26005
  this._synth.addEventListener('message', this.handleWorkerMessage.bind(this), false);
25980
26006
  this._synth.postMessage({
@@ -26322,22 +26348,13 @@
26322
26348
  this.postRenderFinished = new EventEmitter();
26323
26349
  this.error = new EventEmitterOfT();
26324
26350
  this._api = api;
26325
- if (!settings.core.scriptFile) {
26326
- Logger.error('Rendering', `Could not detect alphaTab script file, cannot initialize renderer`);
26327
- return;
26328
- }
26329
26351
  // first try blob worker
26330
26352
  try {
26331
26353
  this._worker = Environment.createAlphaTabWorker(settings.core.scriptFile);
26332
26354
  }
26333
26355
  catch (e) {
26334
- try {
26335
- this._worker = new Worker(settings.core.scriptFile);
26336
- }
26337
- catch (e2) {
26338
- Logger.error('Rendering', `Failed to create WebWorker: ${e}`);
26339
- return;
26340
- }
26356
+ Logger.error('Rendering', `Failed to create WebWorker: ${e}`);
26357
+ return;
26341
26358
  }
26342
26359
  this._worker.postMessage({
26343
26360
  cmd: 'alphaTab.initialize',
@@ -27274,7 +27291,36 @@
27274
27291
  a4.style.width = '210mm';
27275
27292
  }
27276
27293
  }
27277
- preview.document.write('<!DOCTYPE html><html></head><body></body></html>');
27294
+ // the style is a workaround for browser having problems with printing using absolute positions.
27295
+ preview.document.write(`
27296
+ <!DOCTYPE html>
27297
+ <html>
27298
+ <head>
27299
+ <style>
27300
+ .at-surface {
27301
+ width: auto !important;
27302
+ height: auto !important;
27303
+ }
27304
+ .at-surface > div {
27305
+ position: relative!important;
27306
+ left: auto !important;
27307
+ top: auto !important;
27308
+ break-inside: avoid;
27309
+ }
27310
+ </style>
27311
+ </head>
27312
+ <body></body>
27313
+ </html>
27314
+ `);
27315
+ const score = this.score;
27316
+ if (score) {
27317
+ if (score.artist && score.title) {
27318
+ preview.document.title = `${score.title} - ${score.artist}`;
27319
+ }
27320
+ else if (score.title) {
27321
+ preview.document.title = `${score.title}`;
27322
+ }
27323
+ }
27278
27324
  preview.document.body.appendChild(a4);
27279
27325
  let dualScreenLeft = typeof window['screenLeft'] !== 'undefined'
27280
27326
  ? window['screenLeft']
@@ -27300,11 +27346,21 @@
27300
27346
  // render alphaTab
27301
27347
  let settings = JsonConverter.jsObjectToSettings(JsonConverter.settingsToJsObject(this.settings));
27302
27348
  settings.core.enableLazyLoading = false;
27303
- settings.core.useWorkers = false;
27349
+ settings.core.useWorkers = true;
27350
+ settings.core.file = null;
27351
+ settings.core.tracks = null;
27352
+ settings.player.enableCursor = false;
27353
+ settings.player.enablePlayer = false;
27354
+ settings.player.enableElementHighlighting = false;
27355
+ settings.player.enableUserInteraction = false;
27356
+ settings.player.soundFont = null;
27304
27357
  settings.display.scale = 0.8;
27305
27358
  settings.display.stretchForce = 0.8;
27306
27359
  SettingsSerializer.fromJson(settings, additionalSettings);
27307
27360
  let alphaTab = new AlphaTabApi(a4, settings);
27361
+ preview.onunload = () => {
27362
+ alphaTab.destroy();
27363
+ };
27308
27364
  alphaTab.renderer.postRenderFinished.on(() => {
27309
27365
  preview.print();
27310
27366
  });
@@ -40296,15 +40352,24 @@
40296
40352
  // @ts-ignore
40297
40353
  /* webpackChunkName: "alphatab.worker" */ new URL('@coderline/alphatab', {}));
40298
40354
  }
40299
- else if (Environment.webPlatform === WebPlatform.BrowserModule) {
40300
- const script = `import * as alphaTab from '${scriptFile}'`;
40301
- const blob = new Blob([script], { type: 'text/javascript' });
40302
- return new Worker(URL.createObjectURL(blob), { type: 'module' });
40355
+ if (!scriptFile) {
40356
+ throw new AlphaTabError(exports.AlphaTabErrorType.General, "Could not detect alphaTab script file, cannot initialize renderer");
40303
40357
  }
40304
- else {
40305
- const script = `importScripts('${scriptFile}')`;
40306
- const blob = new Blob([script]);
40307
- return new Worker(URL.createObjectURL(blob));
40358
+ try {
40359
+ if (Environment.webPlatform === WebPlatform.BrowserModule) {
40360
+ const script = `import * as alphaTab from '${scriptFile}'`;
40361
+ const blob = new Blob([script], { type: 'text/javascript' });
40362
+ return new Worker(URL.createObjectURL(blob), { type: 'module' });
40363
+ }
40364
+ else {
40365
+ const script = `importScripts('${scriptFile}')`;
40366
+ const blob = new Blob([script]);
40367
+ return new Worker(URL.createObjectURL(blob));
40368
+ }
40369
+ }
40370
+ catch (e) {
40371
+ Logger.warning('Rendering', 'Could not create inline worker, fallback to normal worker');
40372
+ return new Worker(scriptFile);
40308
40373
  }
40309
40374
  }
40310
40375
  /**
@@ -40569,6 +40634,14 @@
40569
40634
  if (!('IntersectionObserver' in Environment.globalThis)) {
40570
40635
  Environment.globalThis.IntersectionObserver = IntersectionObserverPolyfill;
40571
40636
  }
40637
+ if (!('replaceChildren' in Element.prototype)) {
40638
+ Element.prototype.replaceChildren = function (...nodes) {
40639
+ this.innerHTML = '';
40640
+ this.append(...nodes);
40641
+ };
40642
+ Document.prototype.replaceChildren = Element.prototype.replaceChildren;
40643
+ DocumentFragment.prototype.replaceChildren = Element.prototype.replaceChildren;
40644
+ }
40572
40645
  }
40573
40646
  }
40574
40647
  /**
@@ -40788,8 +40861,8 @@
40788
40861
  // </auto-generated>
40789
40862
  class VersionInfo {
40790
40863
  }
40791
- VersionInfo.version = '1.3.0-alpha.250';
40792
- VersionInfo.date = '2022-04-26T00:46:13.118Z';
40864
+ VersionInfo.version = '1.3.0-alpha.264';
40865
+ VersionInfo.date = '2022-05-10T00:44:31.757Z';
40793
40866
 
40794
40867
  var index$5 = /*#__PURE__*/Object.freeze({
40795
40868
  __proto__: null,