@dawcore/components 0.0.39-next.15 → 0.0.39-next.17

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.mjs CHANGED
@@ -10,7 +10,7 @@ var __decorateClass = (decorators, target, key, kind) => {
10
10
  };
11
11
 
12
12
  // <define:__INSTALL_SPECS__>
13
- var define_INSTALL_SPECS_default = { "@dawcore/faust": "@dawcore/faust@^0.0.2-next.1", "@dawcore/midi": "@dawcore/midi@^0.0.6-next.10", "@dawcore/transport": "@dawcore/transport@^0.0.16-next.9", "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@waveform-playlist/core": "@waveform-playlist/core@^13.0.0-next.9", "@waveform-playlist/engine": "@waveform-playlist/engine@^14.0.0-next.6", "@waveform-playlist/worklets": "@waveform-playlist/worklets@^13.0.1-next.0", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.9" };
13
+ var define_INSTALL_SPECS_default = { "@dawcore/faust": "@dawcore/faust@^0.0.2-next.1", "@dawcore/midi": "@dawcore/midi@^0.0.6-next.11", "@dawcore/transport": "@dawcore/transport@^0.0.16-next.10", "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@waveform-playlist/core": "@waveform-playlist/core@^13.0.0-next.10", "@waveform-playlist/engine": "@waveform-playlist/engine@^14.0.0-next.8", "@waveform-playlist/worklets": "@waveform-playlist/worklets@^13.0.1-next.0", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.10" };
14
14
 
15
15
  // src/elements/daw-annotation.ts
16
16
  import { LitElement } from "lit";
@@ -542,8 +542,11 @@ function computePlayingAnnotationId(annotations, time) {
542
542
 
543
543
  // src/elements/daw-annotation-list.ts
544
544
  function formatAnnotationTime(seconds) {
545
- const whole = Math.floor(seconds);
546
- const ms = Math.round((seconds - whole) * 1e3);
545
+ const safe = Number.isFinite(seconds) && seconds > 0 ? seconds : 0;
546
+ const floor = Math.floor(safe);
547
+ const rounded = Math.round((safe - floor) * 1e3);
548
+ const whole = rounded === 1e3 ? floor + 1 : floor;
549
+ const ms = rounded === 1e3 ? 0 : rounded;
547
550
  const s = whole % 60;
548
551
  const m = (whole - s) / 60;
549
552
  return m + ":" + String(s).padStart(2, "0") + "." + String(ms).padStart(3, "0");
@@ -5931,20 +5934,30 @@ function formatDisplayTime(seconds, format) {
5931
5934
  return clockFormat(safe, 3);
5932
5935
  }
5933
5936
  }
5937
+ var DECIMAL = /^(\d+(\.\d*)?|\.\d+)$/;
5938
+ var WHOLE = /^\d+$/;
5939
+ var SECONDS_PER_UNIT = [3600, 60, 1];
5940
+ function parseClock(text) {
5941
+ const parts = text.split(":");
5942
+ if (parts.length > 3) return null;
5943
+ const units = SECONDS_PER_UNIT.slice(3 - parts.length);
5944
+ let total = 0;
5945
+ for (let i = 0; i < parts.length; i++) {
5946
+ const isLast = i === parts.length - 1;
5947
+ if (!(isLast ? DECIMAL : WHOLE).test(parts[i])) return null;
5948
+ const value = Number(parts[i]);
5949
+ if (i > 0 && value >= 60) return null;
5950
+ total += value * units[i];
5951
+ }
5952
+ return Number.isFinite(total) ? total : null;
5953
+ }
5934
5954
  function parseDisplayTime(value, format) {
5935
- if (!value) return 0;
5936
- let seconds = 0;
5937
- if (format === "seconds") {
5938
- seconds = parseFloat(value) || 0;
5939
- } else {
5940
- const parts = value.split(":");
5941
- if (parts.length !== 3) return 0;
5942
- const h = parseInt(parts[0], 10) || 0;
5943
- const m = parseInt(parts[1], 10) || 0;
5944
- const s = parseFloat(parts[2]) || 0;
5945
- seconds = h * 3600 + m * 60 + s;
5946
- }
5947
- return Math.max(0, seconds);
5955
+ if (typeof value !== "string") return null;
5956
+ const text = value.trim();
5957
+ if (format !== "seconds") return parseClock(text);
5958
+ if (!DECIMAL.test(text)) return null;
5959
+ const seconds = Number(text);
5960
+ return Number.isFinite(seconds) ? seconds : null;
5948
5961
  }
5949
5962
 
5950
5963
  // src/interactions/abort.ts
@@ -6271,9 +6284,7 @@ function canSplitAtTime(host, time) {
6271
6284
  if (!track) return false;
6272
6285
  const atSample = Math.round(time * host.effectiveSampleRate);
6273
6286
  const clip = findClipAtSample(track.clips, atSample);
6274
- if (!clip) return false;
6275
- if (clip.midiNotes != null) return false;
6276
- return true;
6287
+ return clip !== void 0;
6277
6288
  }
6278
6289
  function performSplit(host, time) {
6279
6290
  const { engine } = host;