@waveform-playlist/ui-components 11.3.1 → 12.0.0

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/index.js CHANGED
@@ -2896,6 +2896,14 @@ var StyledTimeScale = (0, import_styled_components23.withTheme)(TimeScale);
2896
2896
  // src/components/SmartScale.tsx
2897
2897
  var import_core7 = require("@waveform-playlist/core");
2898
2898
  var import_jsx_runtime27 = require("react/jsx-runtime");
2899
+ function ticksToBarBeatLabel(ticks, timeSignature, ppqn = import_core7.PPQN) {
2900
+ const barTicks = (0, import_core7.ticksPerBar)(timeSignature, ppqn);
2901
+ const beatTicks = (0, import_core7.ticksPerBeat)(timeSignature, ppqn);
2902
+ const bar = Math.floor(ticks / barTicks) + 1;
2903
+ const beatInBar = Math.floor(ticks % barTicks / beatTicks) + 1;
2904
+ if (beatInBar === 1) return `${bar}`;
2905
+ return `${bar}.${beatInBar}`;
2906
+ }
2899
2907
  var timeinfo = /* @__PURE__ */ new Map([
2900
2908
  [700, { marker: 1e3, bigStep: 500, smallStep: 100 }],
2901
2909
  [1500, { marker: 2e3, bigStep: 1e3, smallStep: 200 }],
@@ -2978,7 +2986,7 @@ var SmartScale = ({ renderTick }) => {
2978
2986
  const tickHeight = isBarLine ? timeScaleHeight : isLabelTick ? Math.floor(timeScaleHeight / 2) : Math.floor(timeScaleHeight / 5);
2979
2987
  canvasInfo2.set(pix, tickHeight);
2980
2988
  if (isLabelTick) {
2981
- const label = (0, import_core7.ticksToBarBeatLabel)(tick, timeSignature);
2989
+ const label = ticksToBarBeatLabel(tick, timeSignature);
2982
2990
  const element = renderTick ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react23.default.Fragment, { children: renderTick(label, pix) }, `bb-${tick}`) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2983
2991
  "div",
2984
2992
  {