web-music-score 6.0.0-pre.1 → 6.0.0-pre.3

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
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,5 +1,5 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
- import "../chunk-A7C2G7OG.mjs";
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
+ import "../chunk-QJ3X3GQ6.mjs";
3
3
 
4
4
  // src/pieces/andante-diabelli.ts
5
5
  import { DocumentBuilder } from "web-music-score/score";
@@ -78,6 +78,8 @@ interface PlaybackButtonsState {
78
78
  */
79
79
  declare class PlaybackButtons extends React.Component<PlaybackButtonsProps, PlaybackButtonsState> {
80
80
  state: PlaybackButtonsState;
81
+ private buttonClass;
82
+ private buttonGroupClass;
81
83
  constructor(props: PlaybackButtonsProps);
82
84
  componentDidUpdate(prevProps: Readonly<PlaybackButtonsProps>): void;
83
85
  render(): react_jsx_runtime.JSX.Element;
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -73,13 +73,43 @@ var MusicScoreView = class extends React.Component {
73
73
  var React2 = __toESM(require("react"));
74
74
  var import_score2 = require("web-music-score/score");
75
75
  var import_jsx_runtime2 = require("react/jsx-runtime");
76
+ function detectStyleSystem() {
77
+ if (typeof window === "undefined") return "unknown";
78
+ const test = document.createElement("button");
79
+ test.className = "btn btn-primary";
80
+ document.body.appendChild(test);
81
+ const style = getComputedStyle(test);
82
+ const padding = style.padding;
83
+ document.body.removeChild(test);
84
+ const isBootstrap = padding.includes("6px") && padding.includes("12px");
85
+ if (isBootstrap) return "bootstrap";
86
+ const root = getComputedStyle(document.documentElement);
87
+ const primary = root.getPropertyValue("--ifm-color-primary").trim();
88
+ if (primary !== "") return "infima";
89
+ return "unknown";
90
+ }
76
91
  var PlaybackButtons = class extends React2.Component {
77
92
  constructor(props) {
78
93
  super(props);
79
94
  __publicField(this, "state");
95
+ __publicField(this, "buttonClass");
96
+ __publicField(this, "buttonGroupClass");
80
97
  this.state = {
81
98
  controller: new import_score2.MPlaybackButtons().setDocument(props.doc)
82
99
  };
100
+ switch (detectStyleSystem()) {
101
+ case "bootstrap":
102
+ this.buttonClass = "btn btn-primary";
103
+ this.buttonGroupClass = "btn-group";
104
+ break;
105
+ case "infima":
106
+ this.buttonClass = "button button--primary";
107
+ this.buttonGroupClass = "ifm-button-group";
108
+ break;
109
+ default:
110
+ this.buttonClass = "wms-button";
111
+ this.buttonGroupClass = "wms-button-group";
112
+ }
83
113
  }
84
114
  componentDidUpdate(prevProps) {
85
115
  if (this.props.doc !== prevProps.doc) {
@@ -87,33 +117,34 @@ var PlaybackButtons = class extends React2.Component {
87
117
  }
88
118
  }
89
119
  render() {
90
- let { singlePlayStop, playStop, playPauseStop, playLabel, pauseLabel, stopLabel } = this.props;
120
+ let { singlePlayStop, playStop, playLabel, pauseLabel, stopLabel } = this.props;
91
121
  let { controller } = this.state;
122
+ const { buttonClass, buttonGroupClass } = this;
92
123
  playLabel != null ? playLabel : playLabel = "Play";
93
124
  pauseLabel != null ? pauseLabel : pauseLabel = "Pause";
94
125
  stopLabel != null ? stopLabel : stopLabel = "Stop";
95
126
  if (singlePlayStop) {
96
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
127
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
97
128
  if (btn) controller.setPlayStopButton(btn, playLabel, stopLabel);
98
129
  } });
99
130
  } else if (playStop) {
100
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "btn-group", children: [
101
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
131
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: buttonGroupClass, children: [
132
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
102
133
  if (btn) controller.setPlayButton(btn, playLabel);
103
134
  } }),
104
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
135
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
105
136
  if (btn) controller.setStopButton(btn, stopLabel);
106
137
  } })
107
138
  ] });
108
139
  } else {
109
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "btn-group", children: [
110
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
140
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: buttonGroupClass, children: [
141
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
111
142
  if (btn) controller.setPlayButton(btn, playLabel);
112
143
  } }),
113
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
144
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
114
145
  if (btn) controller.setPauseButton(btn, pauseLabel);
115
146
  } }),
116
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "btn btn-primary", ref: (btn) => {
147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: buttonClass, ref: (btn) => {
117
148
  if (btn) controller.setStopButton(btn, stopLabel);
118
149
  } })
119
150
  ] });
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-A7C2G7OG.mjs";
4
+ } from "../chunk-QJ3X3GQ6.mjs";
5
5
 
6
6
  // src/react-ui/music-score-view.tsx
7
7
  import * as React from "react";
@@ -38,13 +38,43 @@ var MusicScoreView = class extends React.Component {
38
38
  import * as React2 from "react";
39
39
  import { MPlaybackButtons } from "web-music-score/score";
40
40
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
41
+ function detectStyleSystem() {
42
+ if (typeof window === "undefined") return "unknown";
43
+ const test = document.createElement("button");
44
+ test.className = "btn btn-primary";
45
+ document.body.appendChild(test);
46
+ const style = getComputedStyle(test);
47
+ const padding = style.padding;
48
+ document.body.removeChild(test);
49
+ const isBootstrap = padding.includes("6px") && padding.includes("12px");
50
+ if (isBootstrap) return "bootstrap";
51
+ const root = getComputedStyle(document.documentElement);
52
+ const primary = root.getPropertyValue("--ifm-color-primary").trim();
53
+ if (primary !== "") return "infima";
54
+ return "unknown";
55
+ }
41
56
  var PlaybackButtons = class extends React2.Component {
42
57
  constructor(props) {
43
58
  super(props);
44
59
  __publicField(this, "state");
60
+ __publicField(this, "buttonClass");
61
+ __publicField(this, "buttonGroupClass");
45
62
  this.state = {
46
63
  controller: new MPlaybackButtons().setDocument(props.doc)
47
64
  };
65
+ switch (detectStyleSystem()) {
66
+ case "bootstrap":
67
+ this.buttonClass = "btn btn-primary";
68
+ this.buttonGroupClass = "btn-group";
69
+ break;
70
+ case "infima":
71
+ this.buttonClass = "button button--primary";
72
+ this.buttonGroupClass = "ifm-button-group";
73
+ break;
74
+ default:
75
+ this.buttonClass = "wms-button";
76
+ this.buttonGroupClass = "wms-button-group";
77
+ }
48
78
  }
49
79
  componentDidUpdate(prevProps) {
50
80
  if (this.props.doc !== prevProps.doc) {
@@ -52,33 +82,34 @@ var PlaybackButtons = class extends React2.Component {
52
82
  }
53
83
  }
54
84
  render() {
55
- let { singlePlayStop, playStop, playPauseStop, playLabel, pauseLabel, stopLabel } = this.props;
85
+ let { singlePlayStop, playStop, playLabel, pauseLabel, stopLabel } = this.props;
56
86
  let { controller } = this.state;
87
+ const { buttonClass, buttonGroupClass } = this;
57
88
  playLabel != null ? playLabel : playLabel = "Play";
58
89
  pauseLabel != null ? pauseLabel : pauseLabel = "Pause";
59
90
  stopLabel != null ? stopLabel : stopLabel = "Stop";
60
91
  if (singlePlayStop) {
61
- return /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
92
+ return /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
62
93
  if (btn) controller.setPlayStopButton(btn, playLabel, stopLabel);
63
94
  } });
64
95
  } else if (playStop) {
65
- return /* @__PURE__ */ jsxs("div", { className: "btn-group", children: [
66
- /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
96
+ return /* @__PURE__ */ jsxs("div", { className: buttonGroupClass, children: [
97
+ /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
67
98
  if (btn) controller.setPlayButton(btn, playLabel);
68
99
  } }),
69
- /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
100
+ /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
70
101
  if (btn) controller.setStopButton(btn, stopLabel);
71
102
  } })
72
103
  ] });
73
104
  } else {
74
- return /* @__PURE__ */ jsxs("div", { className: "btn-group", children: [
75
- /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
105
+ return /* @__PURE__ */ jsxs("div", { className: buttonGroupClass, children: [
106
+ /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
76
107
  if (btn) controller.setPlayButton(btn, playLabel);
77
108
  } }),
78
- /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
109
+ /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
79
110
  if (btn) controller.setPauseButton(btn, pauseLabel);
80
111
  } }),
81
- /* @__PURE__ */ jsx2("button", { className: "btn btn-primary", ref: (btn) => {
112
+ /* @__PURE__ */ jsx2("button", { className: buttonClass, ref: (btn) => {
82
113
  if (btn) controller.setStopButton(btn, stopLabel);
83
114
  } })
84
115
  ] });
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -10513,7 +10513,7 @@ var ObjMeasure = class extends MusicObject {
10513
10513
  this.regions.padding_3 = padding;
10514
10514
  this.regions.columnsMin_4 = Math.max(
10515
10515
  DocumentSettings.MinColumnsWidth * unitSize,
10516
- this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur)
10516
+ this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur, 0)
10517
10517
  );
10518
10518
  this.regions.padding_5 = padding;
10519
10519
  this.regions.rightBarLine_6 = this.barLineRight.getRect().width;
@@ -12125,6 +12125,7 @@ var _DocumentBuilder = class _DocumentBuilder {
12125
12125
  * @returns - Music document.
12126
12126
  */
12127
12127
  getDocument() {
12128
+ this.getMeasure();
12128
12129
  return this.doc.getMusicInterface();
12129
12130
  }
12130
12131
  /**
@@ -1,12 +1,12 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  import {
3
3
  MusicError
4
- } from "../chunk-PW2SO6EZ.mjs";
4
+ } from "../chunk-SCF6ZZFQ.mjs";
5
5
  import {
6
6
  NoteLengthProps,
7
7
  RhythmProps,
8
8
  validateNoteLength
9
- } from "../chunk-GNT3ECDB.mjs";
9
+ } from "../chunk-TM46RT77.mjs";
10
10
  import {
11
11
  AnchoredRect,
12
12
  BiMap,
@@ -20,12 +20,12 @@ import {
20
20
  device_exports,
21
21
  guard_exports,
22
22
  utils_exports
23
- } from "../chunk-X7BMJX7E.mjs";
23
+ } from "../chunk-S5PIZUF6.mjs";
24
24
  import {
25
25
  __publicField,
26
26
  __spreadProps,
27
27
  __spreadValues
28
- } from "../chunk-A7C2G7OG.mjs";
28
+ } from "../chunk-QJ3X3GQ6.mjs";
29
29
 
30
30
  // src/score/engine/settings.ts
31
31
  var DebugSettings = {
@@ -6651,7 +6651,7 @@ var ObjMeasure = class extends MusicObject {
6651
6651
  this.regions.padding_3 = padding;
6652
6652
  this.regions.columnsMin_4 = Math.max(
6653
6653
  DocumentSettings.MinColumnsWidth * unitSize,
6654
- this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur)
6654
+ this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur, 0)
6655
6655
  );
6656
6656
  this.regions.padding_5 = padding;
6657
6657
  this.regions.rightBarLine_6 = this.barLineRight.getRect().width;
@@ -8263,6 +8263,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8263
8263
  * @returns - Music document.
8264
8264
  */
8265
8265
  getDocument() {
8266
+ this.getMeasure();
8266
8267
  return this.doc.getMusicInterface();
8267
8268
  }
8268
8269
  /**
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v6.0.0-pre.1 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
1
+ /* WebMusicScore v6.0.0-pre.3 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  import {
3
3
  NoteLength,
4
4
  NoteLengthProps,
@@ -8,7 +8,7 @@ import {
8
8
  isTupletRatio,
9
9
  validateNoteLength,
10
10
  validateTupletRatio
11
- } from "../chunk-GNT3ECDB.mjs";
11
+ } from "../chunk-TM46RT77.mjs";
12
12
  import {
13
13
  IndexArray,
14
14
  LRUCache,
@@ -16,10 +16,10 @@ import {
16
16
  UniMap,
17
17
  guard_exports,
18
18
  utils_exports
19
- } from "../chunk-X7BMJX7E.mjs";
19
+ } from "../chunk-S5PIZUF6.mjs";
20
20
  import {
21
21
  __publicField
22
- } from "../chunk-A7C2G7OG.mjs";
22
+ } from "../chunk-QJ3X3GQ6.mjs";
23
23
 
24
24
  // src/theory/types.ts
25
25
  import { MusicError, MusicErrorType } from "web-music-score/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-music-score",
3
- "version": "6.0.0-pre.1",
3
+ "version": "6.0.0-pre.3",
4
4
  "author": "Stefan Brockmann",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -95,7 +95,8 @@
95
95
  }
96
96
  }
97
97
  },
98
- "unpkg": "./dist/iife/index.global.js",
98
+ "unpkg": "./dist/iife/index.js",
99
+ "jsdelivr": "./dist/iife/index.js",
99
100
  "files": [
100
101
  "CHANGELOG.md",
101
102
  "LICENSE",