@mcqj/vexflow 0.0.1-alpha.4 → 0.0.1-alpha.5

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.
@@ -1,4 +1,4 @@
1
- /*! VexFlow 0.0.1-alpha.2 2026-09-14T09:28:14.606Z 83f5f82ddf9c0bbe0af89224944b421676aa3f97
1
+ /*! VexFlow 0.0.1-alpha.5 2026-09-14T15:08:24.735Z a4bb5ff157f4570b2d6149b7199b0baa4c7e3775
2
2
  Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/vexflow/blob/main/AUTHORS.md). */
3
3
  (function(global, factory) {
4
4
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define([], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.VexFlow = factory());
@@ -10138,6 +10138,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
10138
10138
  this.resolutionMultiplier = 1;
10139
10139
  this.mode = 1;
10140
10140
  this.preFormatted = false;
10141
+ this.dependent = false;
10141
10142
  this.ticksUsed = new Fraction(0, 1);
10142
10143
  this.largestTickWidth = 0;
10143
10144
  this.tickables = [];
@@ -10191,6 +10192,15 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
10191
10192
  this.mode = mode;
10192
10193
  return this;
10193
10194
  }
10195
+ /** Mark this voice as dependent on the layout established by other voices. */
10196
+ setDependent(dependent) {
10197
+ this.dependent = dependent;
10198
+ return this;
10199
+ }
10200
+ /** Return whether this voice follows another voice's layout. */
10201
+ isDependent() {
10202
+ return this.dependent;
10203
+ }
10194
10204
  /** Get the resolution multiplier for the voice. */
10195
10205
  getResolutionMultiplier() {
10196
10206
  return this.resolutionMultiplier;
@@ -13839,6 +13849,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
13839
13849
  this.xBase = 0;
13840
13850
  this.xOffset = 0;
13841
13851
  this.tickables = [];
13852
+ this.dependentTickables = /* @__PURE__ */ new Set();
13842
13853
  this.tickablesByVoice = {};
13843
13854
  this.notePx = 0;
13844
13855
  this.glyphPx = 0;
@@ -13939,9 +13950,9 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
13939
13950
  this.currentTick = tick;
13940
13951
  this.preFormatted = false;
13941
13952
  }
13942
- addTickable(tickable, voiceIndex) {
13953
+ addTickable(tickable, voiceIndex, dependent = false) {
13943
13954
  if (!tickable) throw new RuntimeError("BadArgument", "Invalid tickable added.");
13944
- if (!tickable.shouldIgnoreTicks()) {
13955
+ if (!dependent && !tickable.shouldIgnoreTicks()) {
13945
13956
  const ticks = tickable.getTicks();
13946
13957
  if (ticks.greaterThan(this.maxTicks)) {
13947
13958
  this.maxTicks = ticks.clone();
@@ -13957,6 +13968,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
13957
13968
  }
13958
13969
  tickable.setTickContext(this);
13959
13970
  this.tickables.push(tickable);
13971
+ if (dependent) this.dependentTickables.add(tickable);
13960
13972
  this.tickablesByVoice[voiceIndex ?? 0] = tickable;
13961
13973
  this.preFormatted = false;
13962
13974
  return this;
@@ -13966,6 +13978,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
13966
13978
  for (let i = 0; i < this.tickables.length; ++i) {
13967
13979
  const tickable = this.tickables[i];
13968
13980
  tickable.preFormat();
13981
+ if (this.dependentTickables.has(tickable)) continue;
13969
13982
  const metrics = tickable.getMetrics();
13970
13983
  this.leftDisplacedHeadPx = Math.max(this.leftDisplacedHeadPx, metrics.leftDisplacedHeadPx);
13971
13984
  this.rightDisplacedHeadPx = Math.max(this.rightDisplacedHeadPx, metrics.rightDisplacedHeadPx);
@@ -14028,6 +14041,9 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
14028
14041
  function L$8(...args) {
14029
14042
  if (Formatter.DEBUG) log("VexFlow.Formatter", args);
14030
14043
  }
14044
+ function isBarNote(tickable) {
14045
+ return isCategory(tickable, Category.BarNote);
14046
+ }
14031
14047
  /**
14032
14048
  * Get the rest line number of the next non-rest note(s).
14033
14049
  * @param notes array of Notes
@@ -14335,7 +14351,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
14335
14351
  staveTickToContextMap[integerTicks] = newContext;
14336
14352
  }
14337
14353
  tickable.addToModifierContext(staveTickToContextMap[integerTicks]);
14338
- ticksUsed.add(tickable.getTicks());
14354
+ if (!isBarNote(tickable)) ticksUsed.add(tickable.getTicks());
14339
14355
  });
14340
14356
  });
14341
14357
  this.modifierContexts.push({
@@ -14369,8 +14385,8 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
14369
14385
  tickToContextMap[integerTicks] = newContext;
14370
14386
  tickList.push(integerTicks);
14371
14387
  }
14372
- tickToContextMap[integerTicks].addTickable(tickable, voiceIndex);
14373
- ticksUsed.add(tickable.getTicks());
14388
+ tickToContextMap[integerTicks].addTickable(tickable, voiceIndex, voice.isDependent());
14389
+ if (!isBarNote(tickable)) ticksUsed.add(tickable.getTicks());
14374
14390
  });
14375
14391
  });
14376
14392
  const contexts = {
@@ -14440,7 +14456,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
14440
14456
  const backVoices = contextMap[contextList[j]].getTickablesByVoice();
14441
14457
  const matchingVoices = [];
14442
14458
  Object.keys(voices).forEach((v) => {
14443
- if (backVoices[v]) matchingVoices.push(v);
14459
+ if (backVoices[v] && !voices[v].getVoice().isDependent()) matchingVoices.push(v);
14444
14460
  });
14445
14461
  if (matchingVoices.length > 0) {
14446
14462
  let maxTicks = 0;
@@ -18701,9 +18717,9 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
18701
18717
  };
18702
18718
  //#endregion
18703
18719
  //#region src/version.ts
18704
- var VERSION = "0.0.1-alpha.2";
18705
- var ID = "83f5f82ddf9c0bbe0af89224944b421676aa3f97";
18706
- var DATE = "2026-09-14T09:28:14.606Z";
18720
+ var VERSION = "0.0.1-alpha.5";
18721
+ var ID = "a4bb5ff157f4570b2d6149b7199b0baa4c7e3775";
18722
+ var DATE = "2026-09-14T15:08:24.735Z";
18707
18723
  //#endregion
18708
18724
  //#region src/vexflow.ts
18709
18725
  var VexFlow = class {