solid-pianoroll 0.0.24 → 0.0.26
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/{cjs/index.js → dev.cjs} +408 -430
- package/dist/dev.css +212 -0
- package/dist/dev.js +1330 -0
- package/dist/dev.jsx +1130 -0
- package/dist/index.cjs +1330 -0
- package/dist/index.css +212 -0
- package/dist/{types/usePianoRollState.d.ts → index.d.ts} +38 -6
- package/dist/{esm/index.js → index.js} +412 -429
- package/dist/index.jsx +1130 -0
- package/package.json +46 -34
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/source/PianoRoll.jsx +0 -82
- package/dist/source/PianoRollContext.jsx +0 -11
- package/dist/source/PianoRollGrid.jsx +0 -64
- package/dist/source/PianoRollKeys.jsx +0 -72
- package/dist/source/PianoRollNotes.jsx +0 -160
- package/dist/source/PianoRollNotesScroller.jsx +0 -16
- package/dist/source/PianoRollScale.jsx +0 -43
- package/dist/source/PianoRollScrollZoomViewPort.jsx +0 -49
- package/dist/source/PianoRollTrackList.jsx +0 -27
- package/dist/source/PianoRollTrackListScroller.jsx +0 -16
- package/dist/source/index.jsx +0 -5
- package/dist/source/types.js +0 -1
- package/dist/source/useBoundingClientRect.js +0 -29
- package/dist/source/useNotes.js +0 -23
- package/dist/source/usePianoRollGrid.js +0 -45
- package/dist/source/usePianoRollState.js +0 -126
- package/dist/source/viewport/PlayHead.jsx +0 -43
- package/dist/source/viewport/ScrollZoomContainer.jsx +0 -104
- package/dist/source/viewport/ScrollZoomViewPort.jsx +0 -31
- package/dist/source/viewport/ZoomSliderControl.jsx +0 -29
- package/dist/source/viewport/createViewPortDimension.js +0 -51
- package/dist/types/PianoRoll.d.ts +0 -8
- package/dist/types/PianoRollContext.d.ts +0 -45
- package/dist/types/PianoRollGrid.d.ts +0 -2
- package/dist/types/PianoRollKeys.d.ts +0 -9
- package/dist/types/PianoRollNotes.d.ts +0 -5
- package/dist/types/PianoRollNotesScroller.d.ts +0 -3
- package/dist/types/PianoRollScale.d.ts +0 -2
- package/dist/types/PianoRollScrollZoomViewPort.d.ts +0 -3
- package/dist/types/PianoRollTrackList.d.ts +0 -2
- package/dist/types/PianoRollTrackListScroller.d.ts +0 -3
- package/dist/types/index.d.ts +0 -6
- package/dist/types/types.d.ts +0 -8
- package/dist/types/useBoundingClientRect.d.ts +0 -3
- package/dist/types/useNotes.d.ts +0 -9
- package/dist/types/usePianoRollGrid.d.ts +0 -13
- package/dist/types/viewport/PlayHead.d.ts +0 -8
- package/dist/types/viewport/ScrollZoomContainer.d.ts +0 -8
- package/dist/types/viewport/ScrollZoomViewPort.d.ts +0 -39
- package/dist/types/viewport/ZoomSliderControl.d.ts +0 -6
- package/dist/types/viewport/createViewPortDimension.d.ts +0 -40
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { createEffect, createMemo, mergeProps, splitProps } from "solid-js";
|
|
2
|
-
import { useViewPortDimension } from "./ScrollZoomViewPort";
|
|
3
|
-
import styles from "./ScrollZoomContainer.module.css";
|
|
4
|
-
const ScrollZoomContainer = (props) => {
|
|
5
|
-
let scrollContentRef;
|
|
6
|
-
const [ownProps, divProps] = splitProps(props, [
|
|
7
|
-
"ref",
|
|
8
|
-
"verticalDimensionName",
|
|
9
|
-
"horizontalDimensionName",
|
|
10
|
-
"showScrollbar",
|
|
11
|
-
]);
|
|
12
|
-
const propsWithDefaults = mergeProps({
|
|
13
|
-
verticalDimensionName: "vertical",
|
|
14
|
-
horizontalDimensionName: "horizontal",
|
|
15
|
-
showScrollbar: true,
|
|
16
|
-
}, ownProps);
|
|
17
|
-
const verticalViewPort = createMemo(() => useViewPortDimension(propsWithDefaults.verticalDimensionName));
|
|
18
|
-
const horizontalViewPort = createMemo(() => useViewPortDimension(propsWithDefaults.horizontalDimensionName));
|
|
19
|
-
const handleScroll = (event) => {
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
if (didUpdateScroll) {
|
|
22
|
-
didUpdateScroll = false;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const maxVerticalPosition = verticalViewPort().calculateMaxPosition();
|
|
26
|
-
const maxPosition = horizontalViewPort().calculateMaxPosition();
|
|
27
|
-
const height = verticalViewPort().pixelSize;
|
|
28
|
-
const width = horizontalViewPort().pixelSize;
|
|
29
|
-
const { scrollTop, scrollLeft, scrollWidth, scrollHeight } = event.currentTarget;
|
|
30
|
-
const scrollTopAmount = scrollTop / (scrollHeight - height);
|
|
31
|
-
const scrollLeftAmount = scrollLeft / (scrollWidth - width);
|
|
32
|
-
verticalViewPort().onPositionChange?.(maxVerticalPosition * scrollTopAmount);
|
|
33
|
-
horizontalViewPort().onPositionChange?.(maxPosition * scrollLeftAmount);
|
|
34
|
-
};
|
|
35
|
-
const handleWheel = (event) => {
|
|
36
|
-
if (event.altKey) {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
39
|
-
horizontalViewPort()?.onZoomChange?.(horizontalViewPort().zoom / (1 + event.deltaX / horizontalViewPort().pixelSize));
|
|
40
|
-
const maxPosition = horizontalViewPort().calculateMaxPosition();
|
|
41
|
-
horizontalViewPort()?.onPositionChange?.(Math.min(maxPosition, horizontalViewPort()?.position));
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
verticalViewPort()?.onZoomChange?.(verticalViewPort().zoom / (1 + event.deltaY / verticalViewPort().pixelSize));
|
|
45
|
-
const maxVerticalPosition = verticalViewPort().calculateMaxPosition();
|
|
46
|
-
verticalViewPort()?.onPositionChange?.(Math.min(maxVerticalPosition, verticalViewPort()?.position));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (!props.showScrollbar) {
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
event.currentTarget.scrollLeft += event.deltaX;
|
|
52
|
-
event.currentTarget.scrollTop += event.deltaY;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
let didUpdateScroll = false;
|
|
56
|
-
createEffect(() => {
|
|
57
|
-
const maxVerticalPosition = verticalViewPort().calculateMaxPosition();
|
|
58
|
-
const maxPosition = horizontalViewPort().calculateMaxPosition();
|
|
59
|
-
const scrollTopAmount = maxVerticalPosition > 0 ? verticalViewPort().position / maxVerticalPosition : 0;
|
|
60
|
-
const scrollLeftAmount = maxPosition > 0 ? horizontalViewPort().position / maxPosition : 0;
|
|
61
|
-
const height = verticalViewPort().pixelSize;
|
|
62
|
-
const width = horizontalViewPort().pixelSize;
|
|
63
|
-
if (!scrollContentRef?.parentElement)
|
|
64
|
-
return;
|
|
65
|
-
const scrollDivHeight = verticalViewPort().zoom * verticalViewPort().pixelSize;
|
|
66
|
-
const scrollTop = scrollTopAmount * (scrollDivHeight - height);
|
|
67
|
-
const scrollDivWidth = horizontalViewPort().zoom * horizontalViewPort().pixelSize;
|
|
68
|
-
const scrollLeft = scrollLeftAmount * (scrollDivWidth - width);
|
|
69
|
-
didUpdateScroll = true;
|
|
70
|
-
scrollContentRef.style.height = `${scrollDivHeight}px`;
|
|
71
|
-
scrollContentRef.style.width = `${scrollDivWidth}px`;
|
|
72
|
-
scrollContentRef.parentElement.scrollTo({
|
|
73
|
-
left: scrollLeft,
|
|
74
|
-
top: scrollTop,
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return (<div ref={props.ref} onScroll={handleScroll} onWheel={handleWheel} {...divProps} style={{
|
|
78
|
-
overflow: propsWithDefaults.showScrollbar ? "scroll" : "hidden",
|
|
79
|
-
...(typeof divProps.style === "object" && divProps.style),
|
|
80
|
-
}} classList={{
|
|
81
|
-
[styles.ScrollZoomContainer]: true,
|
|
82
|
-
...divProps.classList,
|
|
83
|
-
}}>
|
|
84
|
-
<div ref={scrollContentRef}>
|
|
85
|
-
<div style={{
|
|
86
|
-
top: 0,
|
|
87
|
-
left: 0,
|
|
88
|
-
height: `${verticalViewPort().pixelSize}px`,
|
|
89
|
-
width: `${horizontalViewPort().pixelSize}px`,
|
|
90
|
-
position: "sticky",
|
|
91
|
-
display: "flex",
|
|
92
|
-
}}>
|
|
93
|
-
<div style={{
|
|
94
|
-
position: "relative",
|
|
95
|
-
height: `${verticalViewPort().pixelSize}px`,
|
|
96
|
-
width: `${horizontalViewPort().pixelSize}px`,
|
|
97
|
-
}}>
|
|
98
|
-
{props.children}
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>);
|
|
103
|
-
};
|
|
104
|
-
export default ScrollZoomContainer;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "solid-js";
|
|
2
|
-
import createViewPortDimension from "./createViewPortDimension";
|
|
3
|
-
const defaultViewPortProps = {
|
|
4
|
-
pixelOffset: 0,
|
|
5
|
-
position: 0,
|
|
6
|
-
range: 1,
|
|
7
|
-
zoom: 1,
|
|
8
|
-
minZoom: 1,
|
|
9
|
-
maxZoom: Infinity,
|
|
10
|
-
};
|
|
11
|
-
export const ScrollZoomViewPort = (props) => {
|
|
12
|
-
const viewPorts = Object.entries(props.dimensions).map(([name, viewPortProps]) => createViewPortDimension(() => ({
|
|
13
|
-
name: name,
|
|
14
|
-
...defaultViewPortProps,
|
|
15
|
-
...viewPortProps(),
|
|
16
|
-
})));
|
|
17
|
-
const parentViewPorts = useContext(ScrollZoomViewPortContext);
|
|
18
|
-
return (<ScrollZoomViewPortContext.Provider value={[...parentViewPorts, ...viewPorts]}>
|
|
19
|
-
{props.children}
|
|
20
|
-
</ScrollZoomViewPortContext.Provider>);
|
|
21
|
-
};
|
|
22
|
-
const ScrollZoomViewPortContext = createContext([]);
|
|
23
|
-
export const useViewPortDimension = (name) => {
|
|
24
|
-
const viewPorts = useContext(ScrollZoomViewPortContext);
|
|
25
|
-
const viewPort = name
|
|
26
|
-
? viewPorts.find((viewPort) => viewPort.name === name)
|
|
27
|
-
: viewPorts[viewPorts.length - 1];
|
|
28
|
-
if (!viewPort)
|
|
29
|
-
throw new Error(`ViewPort dimension "${name}" not found.`);
|
|
30
|
-
return viewPort;
|
|
31
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createMemo, mergeProps } from "solid-js";
|
|
2
|
-
import { useViewPortDimension } from "./ScrollZoomViewPort";
|
|
3
|
-
const ZoomSliderControl = (props) => {
|
|
4
|
-
const propsWithDefaults = mergeProps({ orientation: "horizontal" }, props);
|
|
5
|
-
const dimension = createMemo(() => useViewPortDimension(props.dimensionName ?? propsWithDefaults.orientation));
|
|
6
|
-
return (<input min={dimension().minZoom} max={dimension().maxZoom} step={0.01} {...props} value={dimension().zoom} onInput={(event) => {
|
|
7
|
-
const value = event.currentTarget.valueAsNumber;
|
|
8
|
-
dimension().onZoomChange?.(value);
|
|
9
|
-
}} type="range" {...{ orient: propsWithDefaults.orientation }} style={propsWithDefaults.orientation === "vertical"
|
|
10
|
-
? {
|
|
11
|
-
margin: 0,
|
|
12
|
-
"margin-left": "4px",
|
|
13
|
-
"margin-right": "4px",
|
|
14
|
-
width: "16px",
|
|
15
|
-
transform: "rotate(180deg)",
|
|
16
|
-
...{
|
|
17
|
-
"writing-mode": "bt-lr" /* IE */,
|
|
18
|
-
"-webkit-appearance": "slider-vertical" /* WebKit */,
|
|
19
|
-
},
|
|
20
|
-
...(typeof props.style === "object" && props.style),
|
|
21
|
-
}
|
|
22
|
-
: {
|
|
23
|
-
margin: 0,
|
|
24
|
-
"margin-top": "4px",
|
|
25
|
-
"margin-bottom": "4px",
|
|
26
|
-
...(typeof props.style === "object" && props.style),
|
|
27
|
-
}}/>);
|
|
28
|
-
};
|
|
29
|
-
export default ZoomSliderControl;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createEffect } from "solid-js";
|
|
2
|
-
import { createStore } from "solid-js/store";
|
|
3
|
-
export default function createViewPortDimension(getState) {
|
|
4
|
-
const getStateWithFunctions = () => {
|
|
5
|
-
const state = getState();
|
|
6
|
-
const onZoomChange = (zoom) => state.onZoomChange?.(clamp(zoom, state.minZoom, state.maxZoom));
|
|
7
|
-
const onPositionChange = (position) => state.onPositionChange?.(position);
|
|
8
|
-
return {
|
|
9
|
-
...state,
|
|
10
|
-
onZoomChange,
|
|
11
|
-
onPositionChange,
|
|
12
|
-
calculatePixelOffset,
|
|
13
|
-
calculatePixelValue,
|
|
14
|
-
calculatePosition,
|
|
15
|
-
calculatePixelDimensions,
|
|
16
|
-
calculateVisibleRange,
|
|
17
|
-
calculateMaxPosition,
|
|
18
|
-
isVisible,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
const [state, setState] = createStore(getStateWithFunctions());
|
|
22
|
-
createEffect(() => setState(getStateWithFunctions()));
|
|
23
|
-
function calculatePixelValue(position = state.position) {
|
|
24
|
-
const virtualSize = state.pixelSize * state.zoom;
|
|
25
|
-
return (position / state.range) * virtualSize;
|
|
26
|
-
}
|
|
27
|
-
function calculatePixelOffset(position) {
|
|
28
|
-
return calculatePixelValue(position) - calculatePixelValue(state.position);
|
|
29
|
-
}
|
|
30
|
-
function calculatePosition(offset) {
|
|
31
|
-
const percentX = (offset - state.pixelOffset) / state.pixelSize;
|
|
32
|
-
const position = state.position + percentX * calculateVisibleRange();
|
|
33
|
-
return position;
|
|
34
|
-
}
|
|
35
|
-
function calculateVisibleRange() {
|
|
36
|
-
return state.range / state.zoom;
|
|
37
|
-
}
|
|
38
|
-
function calculateMaxPosition() {
|
|
39
|
-
return state.range - state.range / state.zoom;
|
|
40
|
-
}
|
|
41
|
-
function calculatePixelDimensions(position, length) {
|
|
42
|
-
const offset = calculatePixelOffset(position);
|
|
43
|
-
const size = calculatePixelValue(length);
|
|
44
|
-
return { offset, size };
|
|
45
|
-
}
|
|
46
|
-
function isVisible({ offset, size }) {
|
|
47
|
-
return offset + size > 0 && offset < state.pixelSize;
|
|
48
|
-
}
|
|
49
|
-
return state;
|
|
50
|
-
}
|
|
51
|
-
export const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JSX, ParentProps } from "solid-js";
|
|
2
|
-
import createPianoRollstate from "./usePianoRollState";
|
|
3
|
-
export type PianoRollProps = {
|
|
4
|
-
showAllTracks?: boolean;
|
|
5
|
-
showTrackList?: boolean;
|
|
6
|
-
} & ReturnType<typeof createPianoRollstate> & Omit<JSX.IntrinsicElements["div"], "onDurationChange">;
|
|
7
|
-
declare const PianoRoll: (allProps: ParentProps<PianoRollProps>) => JSX.Element;
|
|
8
|
-
export default PianoRoll;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { PianoRollProps } from "./PianoRoll";
|
|
2
|
-
import createPianoRollstate from "./usePianoRollState";
|
|
3
|
-
export type PianoRollContext = {
|
|
4
|
-
showAllTracks?: boolean;
|
|
5
|
-
showTrackList?: boolean;
|
|
6
|
-
} & ReturnType<typeof createPianoRollstate>;
|
|
7
|
-
export declare const PianoRollContextProvider: import("solid-js/types/reactive/signal").ContextProviderComponent<PianoRollContext>;
|
|
8
|
-
export declare const usePianoRollContext: () => PianoRollContext;
|
|
9
|
-
export declare const splitContextProps: (allProps: PianoRollProps) => [Pick<PianoRollProps, "onDurationChange" | keyof {
|
|
10
|
-
ppq: number;
|
|
11
|
-
mode: "keys" | "tracks";
|
|
12
|
-
position: number;
|
|
13
|
-
zoom: number;
|
|
14
|
-
verticalZoom: number;
|
|
15
|
-
verticalPosition: number;
|
|
16
|
-
verticalTrackZoom: number;
|
|
17
|
-
verticalTrackPosition: number;
|
|
18
|
-
playHeadPosition: number;
|
|
19
|
-
gridDivision: import("./types").GridDivision;
|
|
20
|
-
snapToGrid: boolean;
|
|
21
|
-
duration: number;
|
|
22
|
-
tracks: import("./types").Track[];
|
|
23
|
-
selectedTrackIndex: number;
|
|
24
|
-
pressedKeys: Record<number, Record<number, boolean>>;
|
|
25
|
-
notesScrollerClientRect: Pick<import("./useBoundingClientRect").ClientRect, "height" | "width" | "left" | "top">;
|
|
26
|
-
tracksScrollerClientRect: Pick<import("./useBoundingClientRect").ClientRect, "height" | "width" | "left" | "top">;
|
|
27
|
-
} | "onPpqChange" | "onModeChange" | "onPositionChange" | "onZoomChange" | "onVerticalZoomChange" | "onVerticalPositionChange" | "onVerticalTrackZoomChange" | "onVerticalTrackPositionChange" | "onPlayHeadPositionChange" | "onGridDivisionChange" | "onSnapToGridChange" | "onTracksChange" | "onSelectedTrackIndexChange" | "onPressedKeysChange" | "onNotesScrollerClientRectChange" | "onTracksScrollerClientRectChange" | "onNoteChange" | "onInsertNote" | "onRemoveNote" | "onNoteDown" | "onNoteUp" | "isKeyDown" | "snapValueToGridIfEnabled" | "onPlayheadPositionChange" | "showAllTracks" | "showTrackList">, Omit<PianoRollProps, "onDurationChange" | keyof {
|
|
28
|
-
ppq: number;
|
|
29
|
-
mode: "keys" | "tracks";
|
|
30
|
-
position: number;
|
|
31
|
-
zoom: number;
|
|
32
|
-
verticalZoom: number;
|
|
33
|
-
verticalPosition: number;
|
|
34
|
-
verticalTrackZoom: number;
|
|
35
|
-
verticalTrackPosition: number;
|
|
36
|
-
playHeadPosition: number;
|
|
37
|
-
gridDivision: import("./types").GridDivision;
|
|
38
|
-
snapToGrid: boolean;
|
|
39
|
-
duration: number;
|
|
40
|
-
tracks: import("./types").Track[];
|
|
41
|
-
selectedTrackIndex: number;
|
|
42
|
-
pressedKeys: Record<number, Record<number, boolean>>;
|
|
43
|
-
notesScrollerClientRect: Pick<import("./useBoundingClientRect").ClientRect, "height" | "width" | "left" | "top">;
|
|
44
|
-
tracksScrollerClientRect: Pick<import("./useBoundingClientRect").ClientRect, "height" | "width" | "left" | "top">;
|
|
45
|
-
} | "onPpqChange" | "onModeChange" | "onPositionChange" | "onZoomChange" | "onVerticalZoomChange" | "onVerticalPositionChange" | "onVerticalTrackZoomChange" | "onVerticalTrackPositionChange" | "onPlayHeadPositionChange" | "onGridDivisionChange" | "onSnapToGridChange" | "onTracksChange" | "onSelectedTrackIndexChange" | "onPressedKeysChange" | "onNotesScrollerClientRectChange" | "onTracksScrollerClientRectChange" | "onNoteChange" | "onInsertNote" | "onRemoveNote" | "onNoteDown" | "onNoteUp" | "isKeyDown" | "snapValueToGridIfEnabled" | "onPlayheadPositionChange" | "showAllTracks" | "showTrackList">];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const PianoRollKeys: () => import("solid-js").JSX.Element;
|
|
2
|
-
export declare const blackKeys: number[];
|
|
3
|
-
export declare const keyNames: string[];
|
|
4
|
-
export declare const keys: {
|
|
5
|
-
number: number;
|
|
6
|
-
name: string;
|
|
7
|
-
isBlack: boolean;
|
|
8
|
-
}[];
|
|
9
|
-
export default PianoRollKeys;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import PianoRoll from "./PianoRoll";
|
|
2
|
-
import PlayHead from "./viewport/PlayHead";
|
|
3
|
-
import useNotes from "./useNotes";
|
|
4
|
-
import createPianoRollstate from "./usePianoRollState";
|
|
5
|
-
export type { Note, Track, GridDivision } from "./types";
|
|
6
|
-
export { PianoRoll, createPianoRollstate, useNotes, PlayHead };
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Midi } from "@tonejs/midi";
|
|
2
|
-
export type GridDivision = 1 | 2 | 4 | 8 | 16 | 32 | 64;
|
|
3
|
-
export type Note = Pick<ReturnType<Midi["tracks"][number]["notes"][number]["toJSON"]>, "durationTicks" | "midi" | "ticks" | "velocity">;
|
|
4
|
-
export type Track = {
|
|
5
|
-
name: string;
|
|
6
|
-
notes: Note[];
|
|
7
|
-
color: string;
|
|
8
|
-
};
|
package/dist/types/useNotes.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Note } from "./types";
|
|
2
|
-
declare const useNotes: () => {
|
|
3
|
-
notes: import("solid-js").Accessor<Note[]>;
|
|
4
|
-
onNotesChange: import("solid-js").Setter<Note[]>;
|
|
5
|
-
onNoteChange: (index: number, note: Note) => void;
|
|
6
|
-
onInsertNote: (note: Note) => number;
|
|
7
|
-
onRemoveNote: (index: number) => void;
|
|
8
|
-
};
|
|
9
|
-
export default useNotes;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const usePianoRollGrid: () => import("solid-js").Accessor<{
|
|
2
|
-
index: number;
|
|
3
|
-
ticks: number;
|
|
4
|
-
isHighlighted: boolean;
|
|
5
|
-
hasHighlightedBorder: boolean;
|
|
6
|
-
showLabel: boolean;
|
|
7
|
-
virtualDimensions: {
|
|
8
|
-
offset: number;
|
|
9
|
-
size: number;
|
|
10
|
-
};
|
|
11
|
-
label: string;
|
|
12
|
-
}[]>;
|
|
13
|
-
export default usePianoRollGrid;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JSX } from "solid-js";
|
|
2
|
-
declare const PlayHead: (allProps: {
|
|
3
|
-
position: number;
|
|
4
|
-
onPositionChange?: (playHeadPosition: number, event: MouseEvent) => void;
|
|
5
|
-
sync?: boolean;
|
|
6
|
-
dimensionName?: string;
|
|
7
|
-
} & JSX.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
8
|
-
export default PlayHead;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JSX, ParentProps, Ref } from "solid-js";
|
|
2
|
-
declare const ScrollZoomContainer: (props: ParentProps<{
|
|
3
|
-
ref?: Ref<HTMLDivElement>;
|
|
4
|
-
verticalDimensionName?: string;
|
|
5
|
-
horizontalDimensionName?: string;
|
|
6
|
-
showScrollbar?: boolean;
|
|
7
|
-
} & JSX.IntrinsicElements["div"]>) => JSX.Element;
|
|
8
|
-
export default ScrollZoomContainer;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ParentProps } from "solid-js";
|
|
2
|
-
import { ViewPortDimensionName, ViewPortDimensionState } from "./createViewPortDimension";
|
|
3
|
-
declare const defaultViewPortProps: {
|
|
4
|
-
pixelOffset: number;
|
|
5
|
-
position: number;
|
|
6
|
-
range: number;
|
|
7
|
-
zoom: number;
|
|
8
|
-
minZoom: number;
|
|
9
|
-
maxZoom: number;
|
|
10
|
-
};
|
|
11
|
-
export declare const ScrollZoomViewPort: (props: ParentProps<{
|
|
12
|
-
dimensions: Record<ViewPortDimensionName, () => Omit<ViewPortDimensionState, "name" | keyof typeof defaultViewPortProps> & Partial<Pick<ViewPortDimensionState, keyof typeof defaultViewPortProps>>>;
|
|
13
|
-
}>) => import("solid-js").JSX.Element;
|
|
14
|
-
export declare const useViewPortDimension: (name: ViewPortDimensionName) => {
|
|
15
|
-
onZoomChange: (zoom: number) => void;
|
|
16
|
-
onPositionChange: (position: number) => void;
|
|
17
|
-
calculatePixelOffset: (position: number) => number;
|
|
18
|
-
calculatePixelValue: (position?: number) => number;
|
|
19
|
-
calculatePosition: (offset: number) => number;
|
|
20
|
-
calculatePixelDimensions: (position: number, length: number) => {
|
|
21
|
-
offset: number;
|
|
22
|
-
size: number;
|
|
23
|
-
};
|
|
24
|
-
calculateVisibleRange: () => number;
|
|
25
|
-
calculateMaxPosition: () => number;
|
|
26
|
-
isVisible: ({ offset, size }: {
|
|
27
|
-
offset: number;
|
|
28
|
-
size: number;
|
|
29
|
-
}) => boolean;
|
|
30
|
-
position: number;
|
|
31
|
-
range: number;
|
|
32
|
-
pixelOffset: number;
|
|
33
|
-
pixelSize: number;
|
|
34
|
-
name: string;
|
|
35
|
-
zoom: number;
|
|
36
|
-
minZoom: number;
|
|
37
|
-
maxZoom: number;
|
|
38
|
-
};
|
|
39
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type ViewPortDimension = ReturnType<typeof createViewPortDimension>;
|
|
2
|
-
export type ViewPortDimensionName = string;
|
|
3
|
-
export type ViewPortDimensionState = {
|
|
4
|
-
position: number;
|
|
5
|
-
range: number;
|
|
6
|
-
pixelOffset: number;
|
|
7
|
-
pixelSize: number;
|
|
8
|
-
name: ViewPortDimensionName;
|
|
9
|
-
onZoomChange?: (zoom: number) => void;
|
|
10
|
-
onPositionChange?: (zoom: number) => void;
|
|
11
|
-
zoom: number;
|
|
12
|
-
minZoom: number;
|
|
13
|
-
maxZoom: number;
|
|
14
|
-
};
|
|
15
|
-
export default function createViewPortDimension(getState: () => ViewPortDimensionState): {
|
|
16
|
-
onZoomChange: (zoom: number) => void;
|
|
17
|
-
onPositionChange: (position: number) => void;
|
|
18
|
-
calculatePixelOffset: (position: number) => number;
|
|
19
|
-
calculatePixelValue: (position?: number) => number;
|
|
20
|
-
calculatePosition: (offset: number) => number;
|
|
21
|
-
calculatePixelDimensions: (position: number, length: number) => {
|
|
22
|
-
offset: number;
|
|
23
|
-
size: number;
|
|
24
|
-
};
|
|
25
|
-
calculateVisibleRange: () => number;
|
|
26
|
-
calculateMaxPosition: () => number;
|
|
27
|
-
isVisible: ({ offset, size }: {
|
|
28
|
-
offset: number;
|
|
29
|
-
size: number;
|
|
30
|
-
}) => boolean;
|
|
31
|
-
position: number;
|
|
32
|
-
range: number;
|
|
33
|
-
pixelOffset: number;
|
|
34
|
-
pixelSize: number;
|
|
35
|
-
name: string;
|
|
36
|
-
zoom: number;
|
|
37
|
-
minZoom: number;
|
|
38
|
-
maxZoom: number;
|
|
39
|
-
};
|
|
40
|
-
export declare const clamp: (value: number, min: number, max: number) => number;
|