solid-pianoroll 0.0.27 → 0.0.29
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/dev.cjs +295 -323
- package/dist/dev.js +297 -325
- package/dist/dev.jsx +181 -199
- package/dist/index.cjs +294 -322
- package/dist/index.js +297 -325
- package/dist/index.jsx +181 -199
- package/package.json +5 -2
package/dist/dev.jsx
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-88608-4lSEurKZS4xC/solid-pianoroll/src/PianoRoll.module.css.js
|
|
1
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-EoFgjaMDTdLJ/solid-pianoroll/src/PianoRoll.module.css.js
|
|
5
2
|
var digest = "1768455784e6754f5fb57107bf43cc8478bbe0ec2ced0bc6aeb796949dcc4906";
|
|
6
3
|
var css = `._PianoRoll_1v1e7_1 {
|
|
7
4
|
box-sizing: border-box;
|
|
@@ -50,7 +47,7 @@ var css = `._PianoRoll_1v1e7_1 {
|
|
|
50
47
|
document.head.appendChild(el);
|
|
51
48
|
}
|
|
52
49
|
})();
|
|
53
|
-
var PianoRoll_module_css_default = { "pianoRoll": "_PianoRoll_1v1e7_1", "pianoRollContainer": "_PianoRollContainer_1v1e7_10", "pianoRollLeftColumn": "_PianoRollLeftColumn_1v1e7_17", "showTrackList": "_showTrackList_1v1e7_24", "pianoRollRightColumn": "_PianoRollRightColumn_1v1e7_29" };
|
|
50
|
+
var PianoRoll_module_css_default = { "PianoRoll": "_PianoRoll_1v1e7_1", "pianoRoll": "_PianoRoll_1v1e7_1", "PianoRollContainer": "_PianoRollContainer_1v1e7_10", "pianoRollContainer": "_PianoRollContainer_1v1e7_10", "PianoRollLeftColumn": "_PianoRollLeftColumn_1v1e7_17", "pianoRollLeftColumn": "_PianoRollLeftColumn_1v1e7_17", "showTrackList": "_showTrackList_1v1e7_24", "PianoRollRightColumn": "_PianoRollRightColumn_1v1e7_29", "pianoRollRightColumn": "_PianoRollRightColumn_1v1e7_29" };
|
|
54
51
|
|
|
55
52
|
// src/PianoRoll.tsx
|
|
56
53
|
import { Show as Show6, mergeProps as mergeProps4 } from "solid-js";
|
|
@@ -80,7 +77,7 @@ var defaultState = {
|
|
|
80
77
|
notesScrollerClientRect: { left: 0, width: 0, top: 0, height: 0 },
|
|
81
78
|
tracksScrollerClientRect: { left: 0, width: 0, top: 0, height: 0 }
|
|
82
79
|
};
|
|
83
|
-
var propNameToHandlerName =
|
|
80
|
+
var propNameToHandlerName = (name) => `on${name[0]?.toUpperCase()}${name.slice(1)}Change`;
|
|
84
81
|
var pianoRollStatePropNames = [
|
|
85
82
|
...Object.keys(defaultState),
|
|
86
83
|
...Object.keys(defaultState).map(propNameToHandlerName),
|
|
@@ -92,7 +89,7 @@ var pianoRollStatePropNames = [
|
|
|
92
89
|
"isKeyDown",
|
|
93
90
|
"snapValueToGridIfEnabled"
|
|
94
91
|
];
|
|
95
|
-
var createPianoRollstate =
|
|
92
|
+
var createPianoRollstate = (initialState) => {
|
|
96
93
|
const [state, setState] = createStore({
|
|
97
94
|
...defaultState,
|
|
98
95
|
...initialState
|
|
@@ -112,12 +109,12 @@ var createPianoRollstate = /* @__PURE__ */ __name((initialState) => {
|
|
|
112
109
|
];
|
|
113
110
|
})
|
|
114
111
|
);
|
|
115
|
-
const onPlayheadPositionChange =
|
|
112
|
+
const onPlayheadPositionChange = (playheadPosition, originalEvent) => {
|
|
116
113
|
handlers.onPlayHeadPositionChange(
|
|
117
114
|
snapValueToGridIfEnabled(playheadPosition, !!originalEvent?.altKey)
|
|
118
115
|
);
|
|
119
|
-
}
|
|
120
|
-
const updateNotes =
|
|
116
|
+
};
|
|
117
|
+
const updateNotes = async (trackIndex, getNotes) => {
|
|
121
118
|
const track = state.tracks[trackIndex];
|
|
122
119
|
if (!track)
|
|
123
120
|
return;
|
|
@@ -127,15 +124,15 @@ var createPianoRollstate = /* @__PURE__ */ __name((initialState) => {
|
|
|
127
124
|
{ ...track, notes: getNotes(notes) },
|
|
128
125
|
...state.tracks.slice(trackIndex + 1)
|
|
129
126
|
]);
|
|
130
|
-
}
|
|
131
|
-
const onNoteChange =
|
|
127
|
+
};
|
|
128
|
+
const onNoteChange = (trackIndex, noteIndex, note) => {
|
|
132
129
|
updateNotes(trackIndex, (notes) => [
|
|
133
130
|
...notes.slice(0, noteIndex),
|
|
134
131
|
note,
|
|
135
132
|
...notes.slice(noteIndex + 1)
|
|
136
133
|
]);
|
|
137
|
-
}
|
|
138
|
-
const onInsertNote =
|
|
134
|
+
};
|
|
135
|
+
const onInsertNote = (trackIndex, note) => {
|
|
139
136
|
const track = state.tracks[trackIndex];
|
|
140
137
|
if (!track)
|
|
141
138
|
return -1;
|
|
@@ -150,14 +147,14 @@ var createPianoRollstate = /* @__PURE__ */ __name((initialState) => {
|
|
|
150
147
|
...notes2.slice(newNoteIndex)
|
|
151
148
|
]);
|
|
152
149
|
return newNoteIndex;
|
|
153
|
-
}
|
|
154
|
-
const onRemoveNote =
|
|
150
|
+
};
|
|
151
|
+
const onRemoveNote = (trackIndex, noteIndex) => {
|
|
155
152
|
updateNotes(trackIndex, (notes) => [
|
|
156
153
|
...notes.slice(0, noteIndex),
|
|
157
154
|
...notes.slice(noteIndex + 1)
|
|
158
155
|
]);
|
|
159
|
-
}
|
|
160
|
-
const updateKeyPressedState =
|
|
156
|
+
};
|
|
157
|
+
const updateKeyPressedState = (trackIndex, keyNumber, value) => {
|
|
161
158
|
handlers.onPressedKeysChange?.({
|
|
162
159
|
...state.pressedKeys,
|
|
163
160
|
[trackIndex]: {
|
|
@@ -165,18 +162,18 @@ var createPianoRollstate = /* @__PURE__ */ __name((initialState) => {
|
|
|
165
162
|
[keyNumber]: value
|
|
166
163
|
}
|
|
167
164
|
});
|
|
168
|
-
}
|
|
169
|
-
const onNoteDown =
|
|
165
|
+
};
|
|
166
|
+
const onNoteDown = (trackIndex, keyNumber) => {
|
|
170
167
|
updateKeyPressedState(trackIndex, keyNumber, true);
|
|
171
|
-
}
|
|
172
|
-
const onNoteUp =
|
|
168
|
+
};
|
|
169
|
+
const onNoteUp = (trackIndex, keyNumber) => {
|
|
173
170
|
updateKeyPressedState(trackIndex, keyNumber, false);
|
|
174
|
-
}
|
|
175
|
-
const isKeyDown =
|
|
176
|
-
const snapValueToGridIfEnabled =
|
|
171
|
+
};
|
|
172
|
+
const isKeyDown = (trackIndex, keyNumber) => !!state.pressedKeys[trackIndex]?.[keyNumber];
|
|
173
|
+
const snapValueToGridIfEnabled = (value, altKey) => {
|
|
177
174
|
const gridDivisionTicks = state.ppq * 4 / state.gridDivision;
|
|
178
175
|
return state.snapToGrid && !altKey ? Math.round(value / gridDivisionTicks) * gridDivisionTicks : value;
|
|
179
|
-
}
|
|
176
|
+
};
|
|
180
177
|
return mergeProps(state, {
|
|
181
178
|
...handlers,
|
|
182
179
|
onNoteChange,
|
|
@@ -188,22 +185,22 @@ var createPianoRollstate = /* @__PURE__ */ __name((initialState) => {
|
|
|
188
185
|
snapValueToGridIfEnabled,
|
|
189
186
|
onPlayheadPositionChange
|
|
190
187
|
});
|
|
191
|
-
}
|
|
188
|
+
};
|
|
192
189
|
var usePianoRollState_default = createPianoRollstate;
|
|
193
190
|
|
|
194
191
|
// src/PianoRollContext.tsx
|
|
195
192
|
var PianoRollContext = createContext();
|
|
196
193
|
var PianoRollContextProvider = PianoRollContext.Provider;
|
|
197
|
-
var usePianoRollContext =
|
|
194
|
+
var usePianoRollContext = () => {
|
|
198
195
|
const context = useContext(PianoRollContext);
|
|
199
196
|
if (!context)
|
|
200
197
|
throw new Error("No PianoRollContext found");
|
|
201
198
|
return context;
|
|
202
|
-
}
|
|
203
|
-
var splitContextProps =
|
|
199
|
+
};
|
|
200
|
+
var splitContextProps = (allProps) => splitProps(allProps, [...pianoRollStatePropNames, "showAllTracks", "showTrackList"]);
|
|
204
201
|
|
|
205
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
206
|
-
var digest2 = "
|
|
202
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-vPA2rVvQAkSS/solid-pianoroll/src/PianoRollKeys.module.css.js
|
|
203
|
+
var digest2 = "bbaa0942ecbee6a492845a23ecdbace9bcda1f540a5ba6682de5afbdbda272f4";
|
|
207
204
|
var css2 = `._PianoRollKeys_1ne9i_1 {
|
|
208
205
|
position: relative;
|
|
209
206
|
height: 100%;
|
|
@@ -266,74 +263,69 @@ var css2 = `._PianoRollKeys_1ne9i_1 {
|
|
|
266
263
|
document.head.appendChild(el);
|
|
267
264
|
}
|
|
268
265
|
})();
|
|
269
|
-
var PianoRollKeys_module_css_default = { "pianoRollKeys": "_PianoRollKeys_1ne9i_1", "key": "_Key_1ne9i_14", "black": "_black_1ne9i_29", "white": "_white_1ne9i_38", "down": "_down_1ne9i_46" };
|
|
266
|
+
var PianoRollKeys_module_css_default = { "PianoRollKeys": "_PianoRollKeys_1ne9i_1", "pianoRollKeys": "_PianoRollKeys_1ne9i_1", "Key": "_Key_1ne9i_14", "key": "_Key_1ne9i_14", "black": "_black_1ne9i_29", "white": "_white_1ne9i_38", "down": "_down_1ne9i_46" };
|
|
270
267
|
|
|
271
268
|
// src/PianoRollKeys.tsx
|
|
272
|
-
import { createEffect as
|
|
269
|
+
import { createEffect as createEffect2, createMemo as createMemo2, createSignal, Index, Show } from "solid-js";
|
|
273
270
|
|
|
274
271
|
// src/viewport/ScrollZoomViewPort.tsx
|
|
275
272
|
import { createContext as createContext2, useContext as useContext2 } from "solid-js";
|
|
276
273
|
|
|
277
274
|
// src/viewport/createViewPortDimension.ts
|
|
278
|
-
import {
|
|
279
|
-
import { createStore as createStore2 } from "solid-js/store";
|
|
275
|
+
import { createViewPortAxis } from "solid-viewport";
|
|
280
276
|
function createViewPortDimension(getState) {
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
const onZoomChange = /* @__PURE__ */ __name((zoom) => state2.onZoomChange?.(clamp(zoom, state2.minZoom, state2.maxZoom)), "onZoomChange");
|
|
284
|
-
const onPositionChange = /* @__PURE__ */ __name((position) => state2.onPositionChange?.(position), "onPositionChange");
|
|
277
|
+
const axis = createViewPortAxis(() => {
|
|
278
|
+
const s = getState();
|
|
285
279
|
return {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
280
|
+
name: s.name,
|
|
281
|
+
position: s.position,
|
|
282
|
+
range: s.range,
|
|
283
|
+
pixelOffset: s.pixelOffset,
|
|
284
|
+
pixelSize: s.pixelSize,
|
|
285
|
+
zoom: s.zoom,
|
|
286
|
+
minZoom: s.minZoom,
|
|
287
|
+
maxZoom: s.maxZoom,
|
|
288
|
+
onPositionChange: s.onPositionChange,
|
|
289
|
+
onZoomChange: s.onZoomChange
|
|
296
290
|
};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return state;
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
get name() {
|
|
294
|
+
return axis.name;
|
|
295
|
+
},
|
|
296
|
+
get position() {
|
|
297
|
+
return axis.position;
|
|
298
|
+
},
|
|
299
|
+
get range() {
|
|
300
|
+
return axis.range;
|
|
301
|
+
},
|
|
302
|
+
get pixelOffset() {
|
|
303
|
+
return axis.pixelOffset;
|
|
304
|
+
},
|
|
305
|
+
get pixelSize() {
|
|
306
|
+
return axis.pixelSize;
|
|
307
|
+
},
|
|
308
|
+
get zoom() {
|
|
309
|
+
return axis.zoom;
|
|
310
|
+
},
|
|
311
|
+
get minZoom() {
|
|
312
|
+
return axis.minZoom;
|
|
313
|
+
},
|
|
314
|
+
get maxZoom() {
|
|
315
|
+
return axis.maxZoom;
|
|
316
|
+
},
|
|
317
|
+
onPositionChange: (position) => axis.onPositionChange?.(position),
|
|
318
|
+
onZoomChange: (zoom) => axis.onZoomChange?.(zoom),
|
|
319
|
+
calculatePixelValue: (position) => axis.toPixels(position),
|
|
320
|
+
calculatePixelOffset: (position) => axis.toPixelOffset(position),
|
|
321
|
+
calculatePosition: (offset) => axis.toPosition(offset),
|
|
322
|
+
calculatePixelDimensions: (position, length) => axis.dimensions(position, length),
|
|
323
|
+
calculateVisibleRange: () => axis.visibleRange(),
|
|
324
|
+
calculateMaxPosition: () => axis.maxPosition(),
|
|
325
|
+
isVisible: (dimensions) => axis.isVisible(dimensions)
|
|
326
|
+
};
|
|
334
327
|
}
|
|
335
|
-
|
|
336
|
-
var clamp = /* @__PURE__ */ __name((value, min, max) => Math.max(min, Math.min(max, value)), "clamp");
|
|
328
|
+
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
337
329
|
|
|
338
330
|
// src/viewport/ScrollZoomViewPort.tsx
|
|
339
331
|
var defaultViewPortProps = {
|
|
@@ -344,7 +336,7 @@ var defaultViewPortProps = {
|
|
|
344
336
|
minZoom: 1,
|
|
345
337
|
maxZoom: Infinity
|
|
346
338
|
};
|
|
347
|
-
var ScrollZoomViewPort =
|
|
339
|
+
var ScrollZoomViewPort = (props) => {
|
|
348
340
|
const viewPorts = Object.entries(props.dimensions).map(
|
|
349
341
|
([name, viewPortProps]) => createViewPortDimension(() => ({
|
|
350
342
|
name,
|
|
@@ -354,21 +346,21 @@ var ScrollZoomViewPort = /* @__PURE__ */ __name((props) => {
|
|
|
354
346
|
);
|
|
355
347
|
const parentViewPorts = useContext2(ScrollZoomViewPortContext);
|
|
356
348
|
return <ScrollZoomViewPortContext.Provider value={[...parentViewPorts, ...viewPorts]}>{props.children}</ScrollZoomViewPortContext.Provider>;
|
|
357
|
-
}
|
|
349
|
+
};
|
|
358
350
|
var ScrollZoomViewPortContext = createContext2([]);
|
|
359
|
-
var useViewPortDimension =
|
|
351
|
+
var useViewPortDimension = (name) => {
|
|
360
352
|
const viewPorts = useContext2(ScrollZoomViewPortContext);
|
|
361
353
|
const viewPort = name ? viewPorts.find((viewPort2) => viewPort2.name === name) : viewPorts[viewPorts.length - 1];
|
|
362
354
|
if (!viewPort)
|
|
363
355
|
throw new Error(`ViewPort dimension "${name}" not found.`);
|
|
364
356
|
return viewPort;
|
|
365
|
-
}
|
|
357
|
+
};
|
|
366
358
|
|
|
367
359
|
// src/viewport/ScrollZoomContainer.tsx
|
|
368
|
-
import { createEffect
|
|
360
|
+
import { createEffect, createMemo, mergeProps as mergeProps2, splitProps as splitProps2 } from "solid-js";
|
|
369
361
|
|
|
370
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
371
|
-
var digest3 = "
|
|
362
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-GTKRXRld1CFO/solid-pianoroll/src/viewport/ScrollZoomContainer.module.css.js
|
|
363
|
+
var digest3 = "a0ed6c48dc62240340708ba5e4bf3a8fc0a0cdc27a7217d4f6dd1ed6d3319ba8";
|
|
372
364
|
var css3 = `._ScrollZoomContainer_f395r_1 {
|
|
373
365
|
height: 100%;
|
|
374
366
|
width: 100%;
|
|
@@ -386,10 +378,10 @@ var css3 = `._ScrollZoomContainer_f395r_1 {
|
|
|
386
378
|
document.head.appendChild(el);
|
|
387
379
|
}
|
|
388
380
|
})();
|
|
389
|
-
var ScrollZoomContainer_module_css_default = { "scrollZoomContainer": "_ScrollZoomContainer_f395r_1" };
|
|
381
|
+
var ScrollZoomContainer_module_css_default = { "ScrollZoomContainer": "_ScrollZoomContainer_f395r_1", "scrollZoomContainer": "_ScrollZoomContainer_f395r_1" };
|
|
390
382
|
|
|
391
383
|
// src/viewport/ScrollZoomContainer.tsx
|
|
392
|
-
var ScrollZoomContainer =
|
|
384
|
+
var ScrollZoomContainer = (props) => {
|
|
393
385
|
let scrollContentRef;
|
|
394
386
|
const [ownProps, divProps] = splitProps2(props, [
|
|
395
387
|
"ref",
|
|
@@ -411,8 +403,7 @@ var ScrollZoomContainer = /* @__PURE__ */ __name((props) => {
|
|
|
411
403
|
const horizontalViewPort = createMemo(
|
|
412
404
|
() => useViewPortDimension(propsWithDefaults.horizontalDimensionName)
|
|
413
405
|
);
|
|
414
|
-
const handleScroll =
|
|
415
|
-
event.preventDefault();
|
|
406
|
+
const handleScroll = (event) => {
|
|
416
407
|
if (didUpdateScroll) {
|
|
417
408
|
didUpdateScroll = false;
|
|
418
409
|
return;
|
|
@@ -426,35 +417,28 @@ var ScrollZoomContainer = /* @__PURE__ */ __name((props) => {
|
|
|
426
417
|
const scrollLeftAmount = scrollLeft / (scrollWidth - width);
|
|
427
418
|
verticalViewPort().onPositionChange?.(maxVerticalPosition * scrollTopAmount);
|
|
428
419
|
horizontalViewPort().onPositionChange?.(maxPosition * scrollLeftAmount);
|
|
429
|
-
}
|
|
430
|
-
const handleWheel =
|
|
420
|
+
};
|
|
421
|
+
const handleWheel = (event) => {
|
|
431
422
|
if (event.altKey) {
|
|
432
423
|
event.preventDefault();
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
verticalViewPort().zoom / (1 + event.deltaY / verticalViewPort().pixelSize)
|
|
444
|
-
);
|
|
445
|
-
const maxVerticalPosition = verticalViewPort().calculateMaxPosition();
|
|
446
|
-
verticalViewPort()?.onPositionChange?.(
|
|
447
|
-
Math.min(maxVerticalPosition, verticalViewPort()?.position)
|
|
448
|
-
);
|
|
449
|
-
}
|
|
424
|
+
const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY);
|
|
425
|
+
const viewPort = horizontal ? horizontalViewPort() : verticalViewPort();
|
|
426
|
+
const delta = horizontal ? event.deltaX : event.deltaY;
|
|
427
|
+
const pointer = horizontal ? event.clientX : event.clientY;
|
|
428
|
+
const valueAtPointer = viewPort.calculatePosition(pointer);
|
|
429
|
+
const newZoom = viewPort.zoom / (1 + delta / viewPort.pixelSize);
|
|
430
|
+
const newVisibleRange = viewPort.range / newZoom;
|
|
431
|
+
const fraction = (pointer - viewPort.pixelOffset) / viewPort.pixelSize;
|
|
432
|
+
viewPort.onZoomChange?.(newZoom);
|
|
433
|
+
viewPort.onPositionChange?.(valueAtPointer - fraction * newVisibleRange);
|
|
450
434
|
} else if (!props.showScrollbar) {
|
|
451
435
|
event.preventDefault();
|
|
452
436
|
event.currentTarget.scrollLeft += event.deltaX;
|
|
453
437
|
event.currentTarget.scrollTop += event.deltaY;
|
|
454
438
|
}
|
|
455
|
-
}
|
|
439
|
+
};
|
|
456
440
|
let didUpdateScroll = false;
|
|
457
|
-
|
|
441
|
+
createEffect(() => {
|
|
458
442
|
const maxVerticalPosition = verticalViewPort().calculateMaxPosition();
|
|
459
443
|
const maxPosition = horizontalViewPort().calculateMaxPosition();
|
|
460
444
|
const scrollTopAmount = maxVerticalPosition > 0 ? verticalViewPort().position / maxVerticalPosition : 0;
|
|
@@ -504,19 +488,19 @@ var ScrollZoomContainer = /* @__PURE__ */ __name((props) => {
|
|
|
504
488
|
width: `${horizontalViewPort().pixelSize}px`
|
|
505
489
|
}}
|
|
506
490
|
>{props.children}</div></div></div></div>;
|
|
507
|
-
}
|
|
491
|
+
};
|
|
508
492
|
var ScrollZoomContainer_default = ScrollZoomContainer;
|
|
509
493
|
|
|
510
494
|
// src/PianoRollKeys.tsx
|
|
511
|
-
var PianoRollKeys =
|
|
495
|
+
var PianoRollKeys = () => {
|
|
512
496
|
const verticalViewPort = createMemo2(() => useViewPortDimension("vertical"));
|
|
513
497
|
const horizontalViewPort = createMemo2(() => useViewPortDimension("horizontalKeys"));
|
|
514
498
|
const [isMouseDown, setIsMouseDown] = createSignal(false);
|
|
515
499
|
const context = usePianoRollContext();
|
|
516
|
-
const handleMouseUp =
|
|
500
|
+
const handleMouseUp = () => {
|
|
517
501
|
setIsMouseDown(false);
|
|
518
|
-
}
|
|
519
|
-
|
|
502
|
+
};
|
|
503
|
+
createEffect2(() => {
|
|
520
504
|
if (isMouseDown()) {
|
|
521
505
|
window.addEventListener("mouseup", handleMouseUp);
|
|
522
506
|
} else {
|
|
@@ -571,7 +555,7 @@ var PianoRollKeys = /* @__PURE__ */ __name(() => {
|
|
|
571
555
|
}}
|
|
572
556
|
/></Show>;
|
|
573
557
|
}}</Index></ScrollZoomContainer_default></div>;
|
|
574
|
-
}
|
|
558
|
+
};
|
|
575
559
|
var blackKeys = [1, 3, 6, 8, 10];
|
|
576
560
|
var keyNames = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
|
|
577
561
|
var keys = Array.from({ length: 128 }).map((_, index) => ({
|
|
@@ -584,8 +568,8 @@ var PianoRollKeys_default = PianoRollKeys;
|
|
|
584
568
|
// src/PianoRollNotes.tsx
|
|
585
569
|
import { createMemo as createMemo3, createSignal as createSignal2, For, Show as Show2 } from "solid-js";
|
|
586
570
|
|
|
587
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
588
|
-
var digest4 = "
|
|
571
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-4XxVYQ8EHiTc/solid-pianoroll/src/PianoRollNotes.module.css.js
|
|
572
|
+
var digest4 = "8dddfe05bee5a327753f5688eb499ab297b646fb4ce3f45f86b502855b551810";
|
|
589
573
|
var css4 = `._PianoRollNotes_u3pew_1 {
|
|
590
574
|
position: absolute;
|
|
591
575
|
flex: 1;
|
|
@@ -626,10 +610,10 @@ var css4 = `._PianoRollNotes_u3pew_1 {
|
|
|
626
610
|
document.head.appendChild(el);
|
|
627
611
|
}
|
|
628
612
|
})();
|
|
629
|
-
var PianoRollNotes_module_css_default = { "pianoRollNotes": "_PianoRollNotes_u3pew_1", "note": "_Note_u3pew_12", "trimStart": "_trimStart_u3pew_22", "trimEnd": "_trimEnd_u3pew_26" };
|
|
613
|
+
var PianoRollNotes_module_css_default = { "PianoRollNotes": "_PianoRollNotes_u3pew_1", "pianoRollNotes": "_PianoRollNotes_u3pew_1", "Note": "_Note_u3pew_12", "note": "_Note_u3pew_12", "trimStart": "_trimStart_u3pew_22", "trimEnd": "_trimEnd_u3pew_26" };
|
|
630
614
|
|
|
631
615
|
// src/PianoRollNotes.tsx
|
|
632
|
-
var PianoRollNotes =
|
|
616
|
+
var PianoRollNotes = (props) => {
|
|
633
617
|
const context = usePianoRollContext();
|
|
634
618
|
const verticalViewPort = createMemo3(
|
|
635
619
|
() => useViewPortDimension(context.mode === "keys" ? "vertical" : "verticalTracks")
|
|
@@ -642,7 +626,7 @@ var PianoRollNotes = /* @__PURE__ */ __name((props) => {
|
|
|
642
626
|
const [currentNoteTrackIndex, setCurrentNoteTrackIndex] = createSignal2(-1);
|
|
643
627
|
const [diffPosition, setDiffPosition] = createSignal2(0);
|
|
644
628
|
const [getInitialNote, setInitialNote] = createSignal2();
|
|
645
|
-
const calculateNoteDragValues =
|
|
629
|
+
const calculateNoteDragValues = (event) => {
|
|
646
630
|
const targetTrackIndex = context.mode === "tracks" ? clamp(
|
|
647
631
|
Math.floor(verticalViewPort().calculatePosition(event.clientY)),
|
|
648
632
|
0,
|
|
@@ -655,8 +639,8 @@ var PianoRollNotes = /* @__PURE__ */ __name((props) => {
|
|
|
655
639
|
midi,
|
|
656
640
|
horiontalPosition
|
|
657
641
|
};
|
|
658
|
-
}
|
|
659
|
-
const handleMouseMove =
|
|
642
|
+
};
|
|
643
|
+
const handleMouseMove = (mouseMoveEvent) => {
|
|
660
644
|
mouseMoveEvent.preventDefault();
|
|
661
645
|
mouseMoveEvent.stopPropagation();
|
|
662
646
|
const note = getInitialNote();
|
|
@@ -698,21 +682,21 @@ var PianoRollNotes = /* @__PURE__ */ __name((props) => {
|
|
|
698
682
|
setCurrentNoteIndex(newNoteIndex);
|
|
699
683
|
}
|
|
700
684
|
}
|
|
701
|
-
}
|
|
702
|
-
const stopDragging =
|
|
685
|
+
};
|
|
686
|
+
const stopDragging = () => {
|
|
703
687
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
704
688
|
window.removeEventListener("mouseup", stopDragging);
|
|
705
689
|
setIsDragging(false);
|
|
706
690
|
setCurrentNoteIndex(-1);
|
|
707
691
|
setCurrentNoteTrackIndex(-1);
|
|
708
|
-
}
|
|
709
|
-
const startDragging =
|
|
692
|
+
};
|
|
693
|
+
const startDragging = () => {
|
|
710
694
|
window.addEventListener("mousemove", handleMouseMove);
|
|
711
695
|
window.addEventListener("mouseup", stopDragging);
|
|
712
|
-
}
|
|
713
|
-
const getClasses =
|
|
696
|
+
};
|
|
697
|
+
const getClasses = (noteDragMode2) => {
|
|
714
698
|
return noteDragMode2 ? [PianoRollNotes_module_css_default.Note, PianoRollNotes_module_css_default[noteDragMode2]] : [PianoRollNotes_module_css_default.Note];
|
|
715
|
-
}
|
|
699
|
+
};
|
|
716
700
|
return <div
|
|
717
701
|
classList={{ [PianoRollNotes_module_css_default.PianoRollNotes]: true }}
|
|
718
702
|
ref={props.ref}
|
|
@@ -803,14 +787,14 @@ var PianoRollNotes = /* @__PURE__ */ __name((props) => {
|
|
|
803
787
|
/></Show2>;
|
|
804
788
|
}}</For></Show2>;
|
|
805
789
|
}}</For></div>;
|
|
806
|
-
}
|
|
790
|
+
};
|
|
807
791
|
var PianoRollNotes_default = PianoRollNotes;
|
|
808
792
|
|
|
809
793
|
// src/PianoRollGrid.tsx
|
|
810
794
|
import { createMemo as createMemo5, For as For2, Index as Index2, Show as Show3 } from "solid-js";
|
|
811
795
|
|
|
812
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
813
|
-
var digest5 = "
|
|
796
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-9qgGLYKKXfs8/solid-pianoroll/src/PianoRollGrid.module.css.js
|
|
797
|
+
var digest5 = "efa34c6b5207c399897cfd150bae18d5711548b652f1a3cf8a3084679c2a8e21";
|
|
814
798
|
var css5 = `._PianoRollGrid_qke5f_1 {
|
|
815
799
|
position: relative;
|
|
816
800
|
width: 100%;
|
|
@@ -866,11 +850,11 @@ var css5 = `._PianoRollGrid_qke5f_1 {
|
|
|
866
850
|
document.head.appendChild(el);
|
|
867
851
|
}
|
|
868
852
|
})();
|
|
869
|
-
var PianoRollGrid_module_css_default = { "pianoRollGrid": "_PianoRollGrid_qke5f_1", "pianoRollGridRow": "_PianoRollGrid-Row_qke5f_7", "isDark": "_IsDark_qke5f_14", "key": "_Key_qke5f_18", "isBlackAndNextIsWhite": "_IsBlackAndNextIsWhite_qke5f_21", "pianoRollGridTime": "_PianoRollGrid-Time_qke5f_26", "highlighted": "_Highlighted_qke5f_37", "highlightedBorder": "_HighlightedBorder_qke5f_41" };
|
|
853
|
+
var PianoRollGrid_module_css_default = { "PianoRollGrid": "_PianoRollGrid_qke5f_1", "pianoRollGrid": "_PianoRollGrid_qke5f_1", "PianoRollGrid-Row": "_PianoRollGrid-Row_qke5f_7", "pianoRollGridRow": "_PianoRollGrid-Row_qke5f_7", "IsDark": "_IsDark_qke5f_14", "isDark": "_IsDark_qke5f_14", "Key": "_Key_qke5f_18", "key": "_Key_qke5f_18", "IsBlackAndNextIsWhite": "_IsBlackAndNextIsWhite_qke5f_21", "isBlackAndNextIsWhite": "_IsBlackAndNextIsWhite_qke5f_21", "PianoRollGrid-Time": "_PianoRollGrid-Time_qke5f_26", "pianoRollGridTime": "_PianoRollGrid-Time_qke5f_26", "Highlighted": "_Highlighted_qke5f_37", "highlighted": "_Highlighted_qke5f_37", "HighlightedBorder": "_HighlightedBorder_qke5f_41", "highlightedBorder": "_HighlightedBorder_qke5f_41" };
|
|
870
854
|
|
|
871
855
|
// src/usePianoRollGrid.ts
|
|
872
856
|
import { createMemo as createMemo4 } from "solid-js";
|
|
873
|
-
var usePianoRollGrid =
|
|
857
|
+
var usePianoRollGrid = () => {
|
|
874
858
|
const context = usePianoRollContext();
|
|
875
859
|
const horizontalViewPort = createMemo4(() => useViewPortDimension("horizontal"));
|
|
876
860
|
const measureTicks = createMemo4(() => context.ppq * 4);
|
|
@@ -887,7 +871,6 @@ var usePianoRollGrid = /* @__PURE__ */ __name(() => {
|
|
|
887
871
|
}
|
|
888
872
|
return value;
|
|
889
873
|
}
|
|
890
|
-
__name(calculateVisibleGridDivisorTicks, "calculateVisibleGridDivisorTicks");
|
|
891
874
|
const gridDivisorTicks = createMemo4(
|
|
892
875
|
() => calculateVisibleGridDivisorTicks(selectedGridDivisorTicks())
|
|
893
876
|
);
|
|
@@ -915,11 +898,11 @@ var usePianoRollGrid = /* @__PURE__ */ __name(() => {
|
|
|
915
898
|
});
|
|
916
899
|
});
|
|
917
900
|
return gridArray;
|
|
918
|
-
}
|
|
901
|
+
};
|
|
919
902
|
var usePianoRollGrid_default = usePianoRollGrid;
|
|
920
903
|
|
|
921
904
|
// src/PianoRollGrid.tsx
|
|
922
|
-
var PianoRollGrid =
|
|
905
|
+
var PianoRollGrid = () => {
|
|
923
906
|
const context = usePianoRollContext();
|
|
924
907
|
const verticalViewPort = createMemo5(
|
|
925
908
|
() => useViewPortDimension(context.mode === "keys" ? "vertical" : "verticalTracks")
|
|
@@ -973,12 +956,12 @@ var PianoRollGrid = /* @__PURE__ */ __name(() => {
|
|
|
973
956
|
/></Show3>;
|
|
974
957
|
}}</For2></Show3>
|
|
975
958
|
</div>;
|
|
976
|
-
}
|
|
959
|
+
};
|
|
977
960
|
var PianoRollGrid_default = PianoRollGrid;
|
|
978
961
|
|
|
979
962
|
// src/viewport/ZoomSliderControl.tsx
|
|
980
963
|
import { createMemo as createMemo6, mergeProps as mergeProps3 } from "solid-js";
|
|
981
|
-
var ZoomSliderControl =
|
|
964
|
+
var ZoomSliderControl = (props) => {
|
|
982
965
|
const propsWithDefaults = mergeProps3({ orientation: "horizontal" }, props);
|
|
983
966
|
const dimension = createMemo6(
|
|
984
967
|
() => useViewPortDimension(props.dimensionName ?? propsWithDefaults.orientation)
|
|
@@ -1013,11 +996,11 @@ var ZoomSliderControl = /* @__PURE__ */ __name((props) => {
|
|
|
1013
996
|
...typeof props.style === "object" && props.style
|
|
1014
997
|
}}
|
|
1015
998
|
/>;
|
|
1016
|
-
}
|
|
999
|
+
};
|
|
1017
1000
|
var ZoomSliderControl_default = ZoomSliderControl;
|
|
1018
1001
|
|
|
1019
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
1020
|
-
var digest6 = "
|
|
1002
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-GGWiIf0qvcx3/solid-pianoroll/src/PianoRollTrackList.module.css.js
|
|
1003
|
+
var digest6 = "e9f8961ee037e20fa2a8071f60eb91f8e32adde4fe62014efe90839a5e4f61fc";
|
|
1021
1004
|
var css6 = `._PianoRollTrackList_11kti_1 {
|
|
1022
1005
|
position: relative;
|
|
1023
1006
|
height: 100%;
|
|
@@ -1053,11 +1036,11 @@ Track._selected_11kti_21 {
|
|
|
1053
1036
|
document.head.appendChild(el);
|
|
1054
1037
|
}
|
|
1055
1038
|
})();
|
|
1056
|
-
var PianoRollTrackList_module_css_default = { "pianoRollTrackList": "_PianoRollTrackList_11kti_1", "track": "_Track_11kti_7", "selected": "_selected_11kti_21" };
|
|
1039
|
+
var PianoRollTrackList_module_css_default = { "PianoRollTrackList": "_PianoRollTrackList_11kti_1", "pianoRollTrackList": "_PianoRollTrackList_11kti_1", "Track": "_Track_11kti_7", "track": "_Track_11kti_7", "selected": "_selected_11kti_21" };
|
|
1057
1040
|
|
|
1058
1041
|
// src/PianoRollTrackList.tsx
|
|
1059
1042
|
import { createMemo as createMemo7, Index as Index3, Show as Show4 } from "solid-js";
|
|
1060
|
-
var PianoRollTrackList =
|
|
1043
|
+
var PianoRollTrackList = () => {
|
|
1061
1044
|
const viewPort = createMemo7(() => useViewPortDimension("verticalTracks"));
|
|
1062
1045
|
const context = usePianoRollContext();
|
|
1063
1046
|
return <div class={PianoRollTrackList_module_css_default.PianoRollTrackList}><Index3 each={context.tracks}>{(track, index) => {
|
|
@@ -1079,11 +1062,11 @@ var PianoRollTrackList = /* @__PURE__ */ __name(() => {
|
|
|
1079
1062
|
{track().name || "[unnamed track]"}
|
|
1080
1063
|
</div></Show4>;
|
|
1081
1064
|
}}</Index3></div>;
|
|
1082
|
-
}
|
|
1065
|
+
};
|
|
1083
1066
|
var PianoRollTrackList_default = PianoRollTrackList;
|
|
1084
1067
|
|
|
1085
1068
|
// src/PianoRollScrollZoomViewPort.tsx
|
|
1086
|
-
var PianoRollScrollZoomViewPort =
|
|
1069
|
+
var PianoRollScrollZoomViewPort = (props) => {
|
|
1087
1070
|
const zoomFactor = 500;
|
|
1088
1071
|
const context = usePianoRollContext();
|
|
1089
1072
|
return <ScrollZoomViewPort
|
|
@@ -1132,14 +1115,14 @@ var PianoRollScrollZoomViewPort = /* @__PURE__ */ __name((props) => {
|
|
|
1132
1115
|
horizontalKeys: () => ({ pixelSize: 60 })
|
|
1133
1116
|
}}
|
|
1134
1117
|
>{props.children}</ScrollZoomViewPort>;
|
|
1135
|
-
}
|
|
1118
|
+
};
|
|
1136
1119
|
var PianoRollScrollZoomViewPort_default = PianoRollScrollZoomViewPort;
|
|
1137
1120
|
|
|
1138
1121
|
// src/PianoRollNotesScroller.tsx
|
|
1139
|
-
import { createEffect as
|
|
1122
|
+
import { createEffect as createEffect4, createSignal as createSignal4 } from "solid-js";
|
|
1140
1123
|
|
|
1141
1124
|
// src/useBoundingClientRect.ts
|
|
1142
|
-
import { createEffect as
|
|
1125
|
+
import { createEffect as createEffect3, createSignal as createSignal3 } from "solid-js";
|
|
1143
1126
|
var defaultRect = {
|
|
1144
1127
|
left: 0,
|
|
1145
1128
|
width: 0,
|
|
@@ -1152,13 +1135,13 @@ var defaultRect = {
|
|
|
1152
1135
|
};
|
|
1153
1136
|
function useBoundingClientRect(containerRef) {
|
|
1154
1137
|
const [boundingClientRect, setBoundingClientRect] = createSignal3(defaultRect);
|
|
1155
|
-
|
|
1138
|
+
createEffect3(() => {
|
|
1156
1139
|
const container = containerRef();
|
|
1157
1140
|
if (!container)
|
|
1158
1141
|
return;
|
|
1159
|
-
const updateBoundingClientRect =
|
|
1142
|
+
const updateBoundingClientRect = () => {
|
|
1160
1143
|
setBoundingClientRect(container.getBoundingClientRect() ?? defaultRect);
|
|
1161
|
-
}
|
|
1144
|
+
};
|
|
1162
1145
|
const resizeObserver = new ResizeObserver(updateBoundingClientRect);
|
|
1163
1146
|
resizeObserver.observe(container);
|
|
1164
1147
|
updateBoundingClientRect();
|
|
@@ -1168,30 +1151,29 @@ function useBoundingClientRect(containerRef) {
|
|
|
1168
1151
|
});
|
|
1169
1152
|
return boundingClientRect;
|
|
1170
1153
|
}
|
|
1171
|
-
__name(useBoundingClientRect, "useBoundingClientRect");
|
|
1172
1154
|
|
|
1173
1155
|
// src/PianoRollNotesScroller.tsx
|
|
1174
|
-
var PianoRollNotesScroller =
|
|
1156
|
+
var PianoRollNotesScroller = (props) => {
|
|
1175
1157
|
const context = usePianoRollContext();
|
|
1176
1158
|
const [ref, setRef] = createSignal4();
|
|
1177
1159
|
const clientRect = useBoundingClientRect(ref);
|
|
1178
|
-
|
|
1160
|
+
createEffect4(() => {
|
|
1179
1161
|
context.onNotesScrollerClientRectChange(clientRect());
|
|
1180
1162
|
});
|
|
1181
1163
|
return <ScrollZoomContainer_default
|
|
1182
1164
|
ref={setRef}
|
|
1183
1165
|
verticalDimensionName={context.mode === "keys" ? "vertical" : "verticalTracks"}
|
|
1184
1166
|
>{props.children}</ScrollZoomContainer_default>;
|
|
1185
|
-
}
|
|
1167
|
+
};
|
|
1186
1168
|
var PianoRollNotesScroller_default = PianoRollNotesScroller;
|
|
1187
1169
|
|
|
1188
1170
|
// src/PianoRollTrackListScroller.tsx
|
|
1189
|
-
import { createEffect as
|
|
1190
|
-
var PianoRollTrackListScroller =
|
|
1171
|
+
import { createEffect as createEffect5, createSignal as createSignal5 } from "solid-js";
|
|
1172
|
+
var PianoRollTrackListScroller = (props) => {
|
|
1191
1173
|
const context = usePianoRollContext();
|
|
1192
1174
|
const [ref, setRef] = createSignal5();
|
|
1193
1175
|
const clientRect = useBoundingClientRect(ref);
|
|
1194
|
-
|
|
1176
|
+
createEffect5(() => {
|
|
1195
1177
|
context.onTracksScrollerClientRectChange(clientRect());
|
|
1196
1178
|
});
|
|
1197
1179
|
return <ScrollZoomContainer_default
|
|
@@ -1200,14 +1182,14 @@ var PianoRollTrackListScroller = /* @__PURE__ */ __name((props) => {
|
|
|
1200
1182
|
verticalDimensionName="verticalTracks"
|
|
1201
1183
|
showScrollbar={context.mode === "keys"}
|
|
1202
1184
|
>{props.children}</ScrollZoomContainer_default>;
|
|
1203
|
-
}
|
|
1185
|
+
};
|
|
1204
1186
|
var PianoRollTrackListScroller_default = PianoRollTrackListScroller;
|
|
1205
1187
|
|
|
1206
1188
|
// src/PianoRollScale.tsx
|
|
1207
1189
|
import { createMemo as createMemo8, Index as Index4, Show as Show5 } from "solid-js";
|
|
1208
1190
|
|
|
1209
|
-
// esbuild-css-modules-plugin-namespace:/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-
|
|
1210
|
-
var digest7 = "
|
|
1191
|
+
// esbuild-css-modules-plugin-namespace:/private/var/folders/hn/m5r9jj0x3zb28s_y23nrnhmc0000gn/T/tmp-90536-1Z6Wo8jxrF0k/solid-pianoroll/src/PianoRollScale.module.css.js
|
|
1192
|
+
var digest7 = "686c303be8798fdc2579a63c350e335a21042ce3150552866a5896a2f019951a";
|
|
1211
1193
|
var css7 = `._PianoRollScale_1khhn_1 {
|
|
1212
1194
|
position: relative;
|
|
1213
1195
|
width: 100%;
|
|
@@ -1257,25 +1239,25 @@ var css7 = `._PianoRollScale_1khhn_1 {
|
|
|
1257
1239
|
document.head.appendChild(el);
|
|
1258
1240
|
}
|
|
1259
1241
|
})();
|
|
1260
|
-
var PianoRollScale_module_css_default = { "pianoRollScale": "_PianoRollScale_1khhn_1", "pianoRollScaleTime": "_PianoRollScale-Time_1khhn_7", "pianoRollScaleLabel": "_PianoRollScale-Label_1khhn_23", "highlighted": "_Highlighted_1khhn_31", "highlightedBorder": "_HighlightedBorder_1khhn_35" };
|
|
1242
|
+
var PianoRollScale_module_css_default = { "PianoRollScale": "_PianoRollScale_1khhn_1", "pianoRollScale": "_PianoRollScale_1khhn_1", "PianoRollScale-Time": "_PianoRollScale-Time_1khhn_7", "pianoRollScaleTime": "_PianoRollScale-Time_1khhn_7", "PianoRollScale-Label": "_PianoRollScale-Label_1khhn_23", "pianoRollScaleLabel": "_PianoRollScale-Label_1khhn_23", "Highlighted": "_Highlighted_1khhn_31", "highlighted": "_Highlighted_1khhn_31", "HighlightedBorder": "_HighlightedBorder_1khhn_35", "highlightedBorder": "_HighlightedBorder_1khhn_35" };
|
|
1261
1243
|
|
|
1262
1244
|
// src/PianoRollScale.tsx
|
|
1263
|
-
var PianoRollScale =
|
|
1245
|
+
var PianoRollScale = () => {
|
|
1264
1246
|
const horizontalViewPort = createMemo8(() => useViewPortDimension("horizontal"));
|
|
1265
1247
|
const grid = usePianoRollGrid_default();
|
|
1266
1248
|
const context = usePianoRollContext();
|
|
1267
|
-
const updatePlayheadPosition =
|
|
1249
|
+
const updatePlayheadPosition = (event) => {
|
|
1268
1250
|
const position = horizontalViewPort().calculatePosition(event.clientX);
|
|
1269
1251
|
context.onPlayHeadPositionChange(position, event);
|
|
1270
|
-
}
|
|
1252
|
+
};
|
|
1271
1253
|
return <div
|
|
1272
1254
|
class={PianoRollScale_module_css_default.PianoRollScale}
|
|
1273
1255
|
onMouseDown={(event) => {
|
|
1274
1256
|
updatePlayheadPosition(event);
|
|
1275
|
-
const handleMouseUp =
|
|
1257
|
+
const handleMouseUp = () => {
|
|
1276
1258
|
window.removeEventListener("mousemove", updatePlayheadPosition);
|
|
1277
1259
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
1278
|
-
}
|
|
1260
|
+
};
|
|
1279
1261
|
window.addEventListener("mousemove", updatePlayheadPosition);
|
|
1280
1262
|
window.addEventListener("mouseup", handleMouseUp);
|
|
1281
1263
|
}}
|
|
@@ -1292,11 +1274,11 @@ var PianoRollScale = /* @__PURE__ */ __name(() => {
|
|
|
1292
1274
|
}}
|
|
1293
1275
|
><Show5 when={entry().showLabel}><div class={PianoRollScale_module_css_default["PianoRollScale-Label"]}>{entry().label}</div></Show5></div></Show5>;
|
|
1294
1276
|
}}</Index4></div>;
|
|
1295
|
-
}
|
|
1277
|
+
};
|
|
1296
1278
|
var PianoRollScale_default = PianoRollScale;
|
|
1297
1279
|
|
|
1298
1280
|
// src/PianoRoll.tsx
|
|
1299
|
-
var PianoRoll =
|
|
1281
|
+
var PianoRoll = (allProps) => {
|
|
1300
1282
|
const propsWithDefaults = mergeProps4({ showAllTracks: false }, allProps);
|
|
1301
1283
|
const [context, divProps] = splitContextProps(propsWithDefaults);
|
|
1302
1284
|
return <PianoRollContextProvider value={context}><div {...divProps} class={PianoRoll_module_css_default.PianoRoll}><PianoRollScrollZoomViewPort_default>
|
|
@@ -1356,12 +1338,12 @@ var PianoRoll = /* @__PURE__ */ __name((allProps) => {
|
|
|
1356
1338
|
}}
|
|
1357
1339
|
/>
|
|
1358
1340
|
</PianoRollScrollZoomViewPort_default></div></PianoRollContextProvider>;
|
|
1359
|
-
}
|
|
1341
|
+
};
|
|
1360
1342
|
var PianoRoll_default = PianoRoll;
|
|
1361
1343
|
|
|
1362
1344
|
// src/viewport/PlayHead.tsx
|
|
1363
|
-
import { createEffect as
|
|
1364
|
-
var PlayHead =
|
|
1345
|
+
import { createEffect as createEffect6, createMemo as createMemo9, splitProps as splitProps3 } from "solid-js";
|
|
1346
|
+
var PlayHead = (allProps) => {
|
|
1365
1347
|
const [props, divProps] = splitProps3(allProps, [
|
|
1366
1348
|
"position",
|
|
1367
1349
|
"sync",
|
|
@@ -1369,7 +1351,7 @@ var PlayHead = /* @__PURE__ */ __name((allProps) => {
|
|
|
1369
1351
|
"dimensionName"
|
|
1370
1352
|
]);
|
|
1371
1353
|
const viewPort = useViewPortDimension(props.dimensionName ?? "horizontal");
|
|
1372
|
-
|
|
1354
|
+
createEffect6(() => {
|
|
1373
1355
|
if (!props.sync)
|
|
1374
1356
|
return;
|
|
1375
1357
|
const maxPosition = viewPort.range;
|
|
@@ -1392,39 +1374,39 @@ var PlayHead = /* @__PURE__ */ __name((allProps) => {
|
|
|
1392
1374
|
onMouseDown={(event) => {
|
|
1393
1375
|
event.preventDefault();
|
|
1394
1376
|
event.stopPropagation();
|
|
1395
|
-
const handleMouseMove =
|
|
1377
|
+
const handleMouseMove = (event2) => {
|
|
1396
1378
|
const newPosition = viewPort.calculatePosition(event2.clientX);
|
|
1397
1379
|
props.onPositionChange?.(newPosition, event2);
|
|
1398
|
-
}
|
|
1399
|
-
const handleMouseUp =
|
|
1380
|
+
};
|
|
1381
|
+
const handleMouseUp = () => {
|
|
1400
1382
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
1401
1383
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
1402
|
-
}
|
|
1384
|
+
};
|
|
1403
1385
|
window.addEventListener("mousemove", handleMouseMove);
|
|
1404
1386
|
window.addEventListener("mouseup", handleMouseUp);
|
|
1405
1387
|
}}
|
|
1406
1388
|
/>;
|
|
1407
|
-
}
|
|
1389
|
+
};
|
|
1408
1390
|
var PlayHead_default = PlayHead;
|
|
1409
1391
|
|
|
1410
1392
|
// src/useNotes.ts
|
|
1411
1393
|
import { createSignal as createSignal6 } from "solid-js";
|
|
1412
|
-
var useNotes =
|
|
1394
|
+
var useNotes = () => {
|
|
1413
1395
|
const [notes, onNotesChange] = createSignal6([]);
|
|
1414
|
-
const onNoteChange =
|
|
1396
|
+
const onNoteChange = (index, note) => {
|
|
1415
1397
|
onNotesChange([...notes().slice(0, index), note, ...notes().splice(index + 1)]);
|
|
1416
|
-
}
|
|
1417
|
-
const onInsertNote =
|
|
1398
|
+
};
|
|
1399
|
+
const onInsertNote = (note) => {
|
|
1418
1400
|
const index = Math.max(
|
|
1419
1401
|
notes().findIndex(({ ticks }) => ticks > note.ticks),
|
|
1420
1402
|
0
|
|
1421
1403
|
);
|
|
1422
1404
|
onNotesChange([...notes().slice(0, index), note, ...notes().splice(index)]);
|
|
1423
1405
|
return index;
|
|
1424
|
-
}
|
|
1425
|
-
const onRemoveNote =
|
|
1406
|
+
};
|
|
1407
|
+
const onRemoveNote = (index) => {
|
|
1426
1408
|
onNotesChange([...notes().slice(0, index), ...notes().splice(index + 1)]);
|
|
1427
|
-
}
|
|
1409
|
+
};
|
|
1428
1410
|
return {
|
|
1429
1411
|
notes,
|
|
1430
1412
|
onNotesChange,
|
|
@@ -1432,7 +1414,7 @@ var useNotes = /* @__PURE__ */ __name(() => {
|
|
|
1432
1414
|
onInsertNote,
|
|
1433
1415
|
onRemoveNote
|
|
1434
1416
|
};
|
|
1435
|
-
}
|
|
1417
|
+
};
|
|
1436
1418
|
var useNotes_default = useNotes;
|
|
1437
1419
|
export {
|
|
1438
1420
|
PianoRoll_default as PianoRoll,
|