@webgamekit/strudel-flow 0.0.0-stage → 0.1.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/LICENSE +661 -0
- package/dist/callArguments.d.ts +15 -0
- package/dist/chordSymbols.d.ts +15 -0
- package/dist/chords.d.ts +42 -0
- package/dist/codeScanner.d.ts +54 -0
- package/dist/compileStrudelFlow.d.ts +27 -0
- package/dist/components/notation/notationContextKey.d.ts +4 -0
- package/dist/components/overlayTargetKey.d.ts +3 -0
- package/dist/components/previewSoundKey.d.ts +3 -0
- package/dist/components/sampleFamilyIcons.d.ts +6 -0
- package/dist/components/visualizerWidgetIdsKey.d.ts +3 -0
- package/dist/config.d.ts +315 -0
- package/dist/connections.d.ts +29 -0
- package/dist/defaultPatch.d.ts +7 -0
- package/dist/envelopeShape.d.ts +13 -0
- package/dist/fretPlacement.d.ts +9 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +5997 -0
- package/dist/index.umd.cjs +21 -0
- package/dist/layout.d.ts +30 -0
- package/dist/nodeCodeRange.d.ts +36 -0
- package/dist/nodeDefaults.d.ts +55 -0
- package/dist/nodeDefinitions.d.ts +9 -0
- package/dist/nodePatterns.d.ts +23 -0
- package/dist/notationPick.d.ts +22 -0
- package/dist/notationSequence.d.ts +15 -0
- package/dist/noteValues.d.ts +20 -0
- package/dist/parseStrudelFlowCode.d.ts +20 -0
- package/dist/patchStorage.d.ts +9 -0
- package/dist/patternVariables.d.ts +16 -0
- package/dist/readStoredValue.d.ts +32 -0
- package/dist/readStrudelFlowNodeData.d.ts +15 -0
- package/dist/sampleFamilies.d.ts +10 -0
- package/dist/sampleSequence.d.ts +14 -0
- package/dist/sheetLayout.d.ts +11 -0
- package/dist/solo.d.ts +23 -0
- package/dist/storage.d.ts +12 -0
- package/dist/structSteps.d.ts +12 -0
- package/dist/style.css +1 -0
- package/dist/tabLayout.d.ts +11 -0
- package/dist/tempo.d.ts +12 -0
- package/dist/types.d.ts +453 -0
- package/dist/useStrudelFlow.d.ts +8 -0
- package/package.json +43 -3
- package/README.md +0 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
export type StrudelFlowNodeKind = 'pad' | 'beats' | 'chords' | 'notes' | 'samples' | 'code' | 'voice' | 'filter' | 'delay' | 'space' | 'gain' | 'level' | 'mask' | 'struct' | 'slow' | 'voicing' | 'envelope' | 'visualizer' | 'effect';
|
|
3
|
+
export type StrudelFlowNodeCategory = 'Instruments' | 'Effects' | 'Sounds';
|
|
4
|
+
/** Set on an instrument whose pattern is silenced with `.hush()` or a `_$:` block. */
|
|
5
|
+
export type StrudelFlowMuteFlag = {
|
|
6
|
+
muted?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** One Beats track: a sample name, its sixteen step switches, and per-step variations. */
|
|
9
|
+
export type StrudelFlowDrumRow = {
|
|
10
|
+
sound: string;
|
|
11
|
+
steps: boolean[];
|
|
12
|
+
modifiers: Record<number, string>;
|
|
13
|
+
};
|
|
14
|
+
export type StrudelFlowSoundGroup = {
|
|
15
|
+
label: string;
|
|
16
|
+
sounds: string[];
|
|
17
|
+
};
|
|
18
|
+
/** A sample a picker offers: the name code plays it by, and a readable name to show. */
|
|
19
|
+
export type StrudelFlowSampleOption = {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
/** The picker's family when the name cannot tell it, such as a host's named instrument. */
|
|
23
|
+
familyId?: string;
|
|
24
|
+
};
|
|
25
|
+
/** The host's samples under one heading, such as a drum machine, for the sample pickers. */
|
|
26
|
+
export type StrudelFlowSampleGroup = {
|
|
27
|
+
label: string;
|
|
28
|
+
samples: StrudelFlowSampleOption[];
|
|
29
|
+
};
|
|
30
|
+
export type StrudelFlowPadData = StrudelFlowMuteFlag & {
|
|
31
|
+
kind: 'pad';
|
|
32
|
+
steps: number;
|
|
33
|
+
mode: 'arp' | 'chord';
|
|
34
|
+
octave: number;
|
|
35
|
+
key: string;
|
|
36
|
+
scaleType: string;
|
|
37
|
+
grid: boolean[][];
|
|
38
|
+
columnModifiers: Record<number, string>;
|
|
39
|
+
};
|
|
40
|
+
export type StrudelFlowBeatsData = StrudelFlowMuteFlag & {
|
|
41
|
+
kind: 'beats';
|
|
42
|
+
/** How many of the sixteen steps play. */
|
|
43
|
+
steps: number;
|
|
44
|
+
rows: StrudelFlowDrumRow[];
|
|
45
|
+
/** Whether the variation picker under each step is shown. */
|
|
46
|
+
showModifiers: boolean;
|
|
47
|
+
};
|
|
48
|
+
export type StrudelFlowChordsData = StrudelFlowMuteFlag & {
|
|
49
|
+
kind: 'chords';
|
|
50
|
+
key: string;
|
|
51
|
+
octave: number;
|
|
52
|
+
scaleType: 'major' | 'minor';
|
|
53
|
+
chordProgression: number[];
|
|
54
|
+
chordNotes?: number[][];
|
|
55
|
+
/** Set when the code names its chords, `chord("<C Am F G>")`, rather than their scale degrees. */
|
|
56
|
+
chordSymbols?: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** How a Notes node draws its notes: picked from the sound it plays, or one chosen by hand. */
|
|
59
|
+
export type StrudelFlowNotation = 'auto' | 'guitar' | 'bass' | 'sheet' | 'piano' | 'names' | 'text';
|
|
60
|
+
/** The view a notation resolves to once Auto has looked at the sound. */
|
|
61
|
+
export type StrudelFlowNotationView = Exclude<StrudelFlowNotation, 'auto'>;
|
|
62
|
+
/** A `note("...")` line in mini notation, or a `chord("...")` line of chord symbols. */
|
|
63
|
+
export type StrudelFlowNotesData = StrudelFlowMuteFlag & {
|
|
64
|
+
kind: 'notes';
|
|
65
|
+
pattern: string;
|
|
66
|
+
/** Set for chord symbols, written as `chord("...")`; a note line leaves it out. */
|
|
67
|
+
head?: 'chord';
|
|
68
|
+
notation: StrudelFlowNotation;
|
|
69
|
+
/** Shows the mini notation text beside a drawn notation; Mini notation itself always shows it. */
|
|
70
|
+
showPattern?: boolean;
|
|
71
|
+
};
|
|
72
|
+
/** Notes struck together, when they start in the bar and how long they last, in beats. */
|
|
73
|
+
export type StrudelFlowNoteEvent = {
|
|
74
|
+
notes: string[];
|
|
75
|
+
start: number;
|
|
76
|
+
beats: number;
|
|
77
|
+
};
|
|
78
|
+
/** One cycle of a pattern, its events in time order. */
|
|
79
|
+
export type StrudelFlowNoteBar = StrudelFlowNoteEvent[];
|
|
80
|
+
/**
|
|
81
|
+
* Reads a mini notation pattern into bars of notes. The host supplies it, since only the host
|
|
82
|
+
* loads Strudel; a pattern that cannot be read gives no bars.
|
|
83
|
+
*/
|
|
84
|
+
export type StrudelFlowNoteReader = (pattern: string, beatsPerCycle: number) => Promise<StrudelFlowNoteBar[]>;
|
|
85
|
+
/** What a Notes node needs from the editor around it to draw its notation. */
|
|
86
|
+
export type StrudelFlowNotationContext = {
|
|
87
|
+
readNoteBars: StrudelFlowNoteReader | null;
|
|
88
|
+
beatsPerCycle: number;
|
|
89
|
+
/** The sound a node's notes play, or an empty string when nothing sets one. */
|
|
90
|
+
soundOf: (nodeId: string) => string;
|
|
91
|
+
};
|
|
92
|
+
export type StrudelFlowTabInstrument = 'bass' | 'guitar';
|
|
93
|
+
/** A note as written: its letter, the semitones its accidentals add, its octave and its pitch. */
|
|
94
|
+
export type StrudelFlowSpelledNote = {
|
|
95
|
+
letter: string;
|
|
96
|
+
alteration: number;
|
|
97
|
+
octave: number;
|
|
98
|
+
midiNote: number;
|
|
99
|
+
};
|
|
100
|
+
export type StrudelFlowSheetClef = 'treble' | 'bass';
|
|
101
|
+
export type StrudelFlowSheetAccidental = 'sharp' | 'flat' | 'natural';
|
|
102
|
+
/** One five line staff: its clef, its top and bottom line, and the step its bottom line sits on. */
|
|
103
|
+
export type StrudelFlowSheetStaff = {
|
|
104
|
+
clef: StrudelFlowSheetClef;
|
|
105
|
+
topY: number;
|
|
106
|
+
bottomY: number;
|
|
107
|
+
/** Diatonic steps from C0 to the note on the bottom line: E4 for treble, G2 for bass. */
|
|
108
|
+
bottomStep: number;
|
|
109
|
+
};
|
|
110
|
+
export type StrudelFlowSheetPoint = {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
export type StrudelFlowSheetHead = {
|
|
115
|
+
y: number;
|
|
116
|
+
/** The accidental written before the head, or null when the bar already implies it. */
|
|
117
|
+
accidental: StrudelFlowSheetAccidental | null;
|
|
118
|
+
/** Short lines through or under a head above or below the staff. */
|
|
119
|
+
ledgerYs: number[];
|
|
120
|
+
};
|
|
121
|
+
/** The notes of one staff struck together, drawn as heads on one stem. */
|
|
122
|
+
export type StrudelFlowSheetChord = {
|
|
123
|
+
x: number;
|
|
124
|
+
staffIndex: number;
|
|
125
|
+
heads: StrudelFlowSheetHead[];
|
|
126
|
+
/** A filled head is a quarter or shorter; an open one a half or a whole. */
|
|
127
|
+
filled: boolean;
|
|
128
|
+
stem: StrudelFlowTabSegment | null;
|
|
129
|
+
flags: string[];
|
|
130
|
+
dots: StrudelFlowSheetPoint[];
|
|
131
|
+
isTriplet: boolean;
|
|
132
|
+
/** The heads ring on into the next chord of this staff, joined by ties. */
|
|
133
|
+
tiedForward: boolean;
|
|
134
|
+
};
|
|
135
|
+
/** A rest, drawn as a path, and the length its shape stands for. */
|
|
136
|
+
export type StrudelFlowSheetRest = {
|
|
137
|
+
x: number;
|
|
138
|
+
staffIndex: number;
|
|
139
|
+
beats: number;
|
|
140
|
+
dotted: boolean;
|
|
141
|
+
isTriplet: boolean;
|
|
142
|
+
path: string;
|
|
143
|
+
/** A whole or half rest is a filled block; the others are strokes. */
|
|
144
|
+
solid: boolean;
|
|
145
|
+
};
|
|
146
|
+
/** Every mark of a piano sheet, in drawing units, ready for an SVG. */
|
|
147
|
+
export type StrudelFlowSheetLayout = {
|
|
148
|
+
width: number;
|
|
149
|
+
height: number;
|
|
150
|
+
lineGap: number;
|
|
151
|
+
staves: StrudelFlowSheetStaff[];
|
|
152
|
+
staffStartX: number;
|
|
153
|
+
staffEndX: number;
|
|
154
|
+
/** Where each bar ends; the bar lines run through every staff. */
|
|
155
|
+
barEndXs: number[];
|
|
156
|
+
chords: StrudelFlowSheetChord[];
|
|
157
|
+
rests: StrudelFlowSheetRest[];
|
|
158
|
+
ties: string[];
|
|
159
|
+
brackets: StrudelFlowTabBracket[];
|
|
160
|
+
bracketLabelY: number;
|
|
161
|
+
};
|
|
162
|
+
/** Where a note is played: the staff line counted from the top (highest string), and the fret. */
|
|
163
|
+
export type StrudelFlowFretPosition = {
|
|
164
|
+
lineIndex: number;
|
|
165
|
+
fret: number;
|
|
166
|
+
};
|
|
167
|
+
/** A fret number on the staff, centred on its stem. */
|
|
168
|
+
export type StrudelFlowTabFret = StrudelFlowFretPosition & {
|
|
169
|
+
x: number;
|
|
170
|
+
y: number;
|
|
171
|
+
/** Each digit's own centre, so two digits keep their gap whatever the font's spacing. */
|
|
172
|
+
digits: {
|
|
173
|
+
x: number;
|
|
174
|
+
digit: string;
|
|
175
|
+
}[];
|
|
176
|
+
};
|
|
177
|
+
export type StrudelFlowTabSegment = {
|
|
178
|
+
x1: number;
|
|
179
|
+
y1: number;
|
|
180
|
+
x2: number;
|
|
181
|
+
y2: number;
|
|
182
|
+
};
|
|
183
|
+
/** A stem in the rhythm row. */
|
|
184
|
+
export type StrudelFlowTabStem = {
|
|
185
|
+
x: number;
|
|
186
|
+
};
|
|
187
|
+
/** A block in the middle of the staff for a rest, faint so a tab reader passes over it. */
|
|
188
|
+
export type StrudelFlowTabRest = {
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
width: number;
|
|
192
|
+
height: number;
|
|
193
|
+
};
|
|
194
|
+
/** A triplet bracket under the stems it groups, and where its 3 goes. */
|
|
195
|
+
export type StrudelFlowTabBracket = {
|
|
196
|
+
path: string;
|
|
197
|
+
labelX: number;
|
|
198
|
+
};
|
|
199
|
+
/** Every mark of a tab staff, in drawing units, ready for an SVG. */
|
|
200
|
+
export type StrudelFlowTabLayout = {
|
|
201
|
+
width: number;
|
|
202
|
+
height: number;
|
|
203
|
+
lineGap: number;
|
|
204
|
+
/** Each string's line, broken where a fret number sits on it, from the top string down. */
|
|
205
|
+
strings: StrudelFlowTabSegment[][];
|
|
206
|
+
barLines: StrudelFlowTabSegment[];
|
|
207
|
+
frets: StrudelFlowTabFret[];
|
|
208
|
+
stems: StrudelFlowTabStem[];
|
|
209
|
+
rests: StrudelFlowTabRest[];
|
|
210
|
+
/** Beams and flags; a flag is a beam reaching from one stem only. */
|
|
211
|
+
beams: StrudelFlowTabSegment[];
|
|
212
|
+
/** Arcs from a fret number to the stem where the note goes on ringing. */
|
|
213
|
+
ties: string[];
|
|
214
|
+
brackets: StrudelFlowTabBracket[];
|
|
215
|
+
stemTop: number;
|
|
216
|
+
stemBottom: number;
|
|
217
|
+
bracketLabelY: number;
|
|
218
|
+
};
|
|
219
|
+
/** An `s("...")` line of samples in mini notation. */
|
|
220
|
+
export type StrudelFlowSamplesData = StrudelFlowMuteFlag & {
|
|
221
|
+
kind: 'samples';
|
|
222
|
+
pattern: string;
|
|
223
|
+
/** Shows the mini notation text under the step editor. */
|
|
224
|
+
showPattern?: boolean;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* One step of a Samples line as its editor shows it: a rest, a sample, a bracketed group of
|
|
228
|
+
* steps, or a piece of mini notation the editor has no control for, kept as text.
|
|
229
|
+
*/
|
|
230
|
+
export type StrudelFlowSampleStep = {
|
|
231
|
+
kind: 'rest';
|
|
232
|
+
} | {
|
|
233
|
+
kind: 'sound';
|
|
234
|
+
/** The sample name, with a variant number such as `bd:3` when it has one. */
|
|
235
|
+
sound: string;
|
|
236
|
+
/** What follows the name, such as `*2`, `@3` or `(3,8)`, or empty. */
|
|
237
|
+
modifier: string;
|
|
238
|
+
} | {
|
|
239
|
+
kind: 'group';
|
|
240
|
+
/** `[a b]` squeezes its steps into one; `<a b>` plays one of them each cycle. */
|
|
241
|
+
bracket: 'subdivide' | 'alternate';
|
|
242
|
+
layers: StrudelFlowSampleLayer[];
|
|
243
|
+
modifier: string;
|
|
244
|
+
} | {
|
|
245
|
+
kind: 'text';
|
|
246
|
+
text: string;
|
|
247
|
+
};
|
|
248
|
+
/** Steps played one after another; layers separated by commas play together. */
|
|
249
|
+
export type StrudelFlowSampleLayer = StrudelFlowSampleStep[];
|
|
250
|
+
/** What a modifier does to a Samples step, which picks its icon and its menu group. */
|
|
251
|
+
export type StrudelFlowSampleModifierKind = 'once' | 'faster' | 'repeat' | 'hold' | 'slower' | 'chance' | 'rhythm';
|
|
252
|
+
/** One modifier a Samples step can take, as its menu lists it. */
|
|
253
|
+
export type StrudelFlowSampleModifierOption = {
|
|
254
|
+
value: string;
|
|
255
|
+
label: string;
|
|
256
|
+
kind: StrudelFlowSampleModifierKind;
|
|
257
|
+
};
|
|
258
|
+
/** An instrument family the sample picker sorts samples into, with the names that belong to it. */
|
|
259
|
+
export type StrudelFlowSampleFamily = {
|
|
260
|
+
id: string;
|
|
261
|
+
label: string;
|
|
262
|
+
/** A regular expression source matched against the lowercase sample name. */
|
|
263
|
+
match: string;
|
|
264
|
+
};
|
|
265
|
+
/** Where a node's code sits in the program, as character offsets. */
|
|
266
|
+
export type StrudelFlowCodeRange = {
|
|
267
|
+
from: number;
|
|
268
|
+
to: number;
|
|
269
|
+
};
|
|
270
|
+
/** A node's call in the program, with the node that wrote it. */
|
|
271
|
+
export type StrudelFlowNodeCodeRange = StrudelFlowCodeRange & {
|
|
272
|
+
nodeId: string;
|
|
273
|
+
};
|
|
274
|
+
/** Any expression the other instruments cannot describe, kept verbatim. */
|
|
275
|
+
export type StrudelFlowCodeData = StrudelFlowMuteFlag & {
|
|
276
|
+
kind: 'code';
|
|
277
|
+
code: string;
|
|
278
|
+
};
|
|
279
|
+
export type StrudelFlowVoiceData = {
|
|
280
|
+
kind: 'voice';
|
|
281
|
+
sound: string;
|
|
282
|
+
};
|
|
283
|
+
/** One chained call kept as written, such as `.mask("<1 0>")` or `.jux(rev)`. */
|
|
284
|
+
export type StrudelFlowCall = {
|
|
285
|
+
method: string;
|
|
286
|
+
argument: string;
|
|
287
|
+
};
|
|
288
|
+
/** One argument of a call the editor has controls for, as `config.ts` describes it. */
|
|
289
|
+
export type StrudelFlowCallParameter = {
|
|
290
|
+
kind: 'number';
|
|
291
|
+
label: string;
|
|
292
|
+
min: number;
|
|
293
|
+
max: number;
|
|
294
|
+
step: number;
|
|
295
|
+
} | {
|
|
296
|
+
kind: 'text';
|
|
297
|
+
label: string;
|
|
298
|
+
} | {
|
|
299
|
+
kind: 'toggles';
|
|
300
|
+
label: string;
|
|
301
|
+
};
|
|
302
|
+
/** A call argument read into a control: a slider value, free text, or on and off steps. */
|
|
303
|
+
export type StrudelFlowCallField = {
|
|
304
|
+
kind: 'number';
|
|
305
|
+
label: string;
|
|
306
|
+
min: number;
|
|
307
|
+
max: number;
|
|
308
|
+
step: number;
|
|
309
|
+
value: number;
|
|
310
|
+
} | {
|
|
311
|
+
kind: 'text';
|
|
312
|
+
label: string;
|
|
313
|
+
value: string;
|
|
314
|
+
} | {
|
|
315
|
+
kind: 'toggles';
|
|
316
|
+
label: string;
|
|
317
|
+
steps: boolean[];
|
|
318
|
+
/** Written `"<1 0>"`, one step per cycle, rather than `"1 0"` within one. */
|
|
319
|
+
perCycle: boolean;
|
|
320
|
+
/** Written with repeats such as `1!40`, so the steps are written back as runs. */
|
|
321
|
+
repeated?: boolean;
|
|
322
|
+
};
|
|
323
|
+
/** A chained call no dedicated node covers, such as `.jux(rev)`, as a node of its own. */
|
|
324
|
+
export type StrudelFlowEffectData = {
|
|
325
|
+
kind: 'effect';
|
|
326
|
+
calls: StrudelFlowCall[];
|
|
327
|
+
};
|
|
328
|
+
export type StrudelFlowFilterData = {
|
|
329
|
+
kind: 'filter';
|
|
330
|
+
cutoff: number;
|
|
331
|
+
resonance: number;
|
|
332
|
+
};
|
|
333
|
+
export type StrudelFlowDelayData = {
|
|
334
|
+
kind: 'delay';
|
|
335
|
+
mix: number;
|
|
336
|
+
time: number;
|
|
337
|
+
feedback: number;
|
|
338
|
+
};
|
|
339
|
+
export type StrudelFlowSpaceData = {
|
|
340
|
+
kind: 'space';
|
|
341
|
+
room: number;
|
|
342
|
+
roomSize: number;
|
|
343
|
+
roomFade: number;
|
|
344
|
+
roomLowPass: number;
|
|
345
|
+
roomDim: number;
|
|
346
|
+
};
|
|
347
|
+
export type StrudelFlowGainData = {
|
|
348
|
+
kind: 'gain';
|
|
349
|
+
gain: number;
|
|
350
|
+
};
|
|
351
|
+
export type StrudelFlowLevelData = {
|
|
352
|
+
kind: 'level';
|
|
353
|
+
pan: number;
|
|
354
|
+
postgain: number;
|
|
355
|
+
};
|
|
356
|
+
/** `.mask(...)`: which steps or cycles of the pattern play. The argument is kept as written. */
|
|
357
|
+
export type StrudelFlowMaskData = {
|
|
358
|
+
kind: 'mask';
|
|
359
|
+
argument: string;
|
|
360
|
+
};
|
|
361
|
+
/** `.struct(...)`: which steps of the pattern hit, as `x` and `~`. The argument is kept as written. */
|
|
362
|
+
export type StrudelFlowStructData = {
|
|
363
|
+
kind: 'struct';
|
|
364
|
+
argument: string;
|
|
365
|
+
};
|
|
366
|
+
/** `.slow(...)`: how many times longer each cycle lasts. */
|
|
367
|
+
export type StrudelFlowSlowData = {
|
|
368
|
+
kind: 'slow';
|
|
369
|
+
amount: number;
|
|
370
|
+
};
|
|
371
|
+
/** `.voicing()`: spreads chord symbols into played notes. */
|
|
372
|
+
export type StrudelFlowVoicingData = {
|
|
373
|
+
kind: 'voicing';
|
|
374
|
+
};
|
|
375
|
+
export type StrudelFlowEnvelopeData = {
|
|
376
|
+
kind: 'envelope';
|
|
377
|
+
attack: number;
|
|
378
|
+
decay: number;
|
|
379
|
+
sustain: number;
|
|
380
|
+
release: number;
|
|
381
|
+
};
|
|
382
|
+
export type StrudelFlowVisualName = 'pianoroll' | 'punchcard' | 'scope' | 'spiral' | 'pitchwheel' | 'spectrum';
|
|
383
|
+
/** One of Strudel's visuals: `._name()` draws under the line, `.name()` behind the code. */
|
|
384
|
+
export type StrudelFlowVisualizerData = {
|
|
385
|
+
kind: 'visualizer';
|
|
386
|
+
visual: StrudelFlowVisualName;
|
|
387
|
+
placement: 'inline' | 'background';
|
|
388
|
+
/** The call's argument as written, such as `{ labels: 1 }`, or empty. */
|
|
389
|
+
options: string;
|
|
390
|
+
};
|
|
391
|
+
export type StrudelFlowNodeData = StrudelFlowPadData | StrudelFlowBeatsData | StrudelFlowChordsData | StrudelFlowNotesData | StrudelFlowSamplesData | StrudelFlowCodeData | StrudelFlowVoiceData | StrudelFlowFilterData | StrudelFlowDelayData | StrudelFlowSpaceData | StrudelFlowGainData | StrudelFlowLevelData | StrudelFlowMaskData | StrudelFlowStructData | StrudelFlowSlowData | StrudelFlowVoicingData | StrudelFlowEnvelopeData | StrudelFlowVisualizerData | StrudelFlowEffectData;
|
|
392
|
+
export type StrudelFlowNodePosition = {
|
|
393
|
+
x: number;
|
|
394
|
+
y: number;
|
|
395
|
+
};
|
|
396
|
+
export type StrudelFlowNodeSize = {
|
|
397
|
+
width: number;
|
|
398
|
+
height: number;
|
|
399
|
+
};
|
|
400
|
+
export type StrudelFlowNode = {
|
|
401
|
+
id: string;
|
|
402
|
+
type: string;
|
|
403
|
+
position: StrudelFlowNodePosition;
|
|
404
|
+
data: StrudelFlowNodeData;
|
|
405
|
+
/** Measured by Vue Flow while the canvas is open; never stored in the patch. */
|
|
406
|
+
dimensions?: {
|
|
407
|
+
width: number;
|
|
408
|
+
height: number;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
export type StrudelFlowEdge = {
|
|
412
|
+
id: string;
|
|
413
|
+
source: string;
|
|
414
|
+
target: string;
|
|
415
|
+
};
|
|
416
|
+
export type StrudelFlowPatch = {
|
|
417
|
+
nodes: StrudelFlowNode[];
|
|
418
|
+
edges: StrudelFlowEdge[];
|
|
419
|
+
beatsPerMinute: number;
|
|
420
|
+
beatsPerCycle: number;
|
|
421
|
+
/** Statements that are not a pattern, such as `samples(...)` or `const cc = await midin(...)`. */
|
|
422
|
+
setup: string;
|
|
423
|
+
};
|
|
424
|
+
export type StrudelFlowCompilation = {
|
|
425
|
+
code: string;
|
|
426
|
+
errorMessage: string | null;
|
|
427
|
+
};
|
|
428
|
+
export type StrudelFlowNodeDefinition = {
|
|
429
|
+
kind: StrudelFlowNodeKind;
|
|
430
|
+
title: string;
|
|
431
|
+
category: StrudelFlowNodeCategory;
|
|
432
|
+
description: string;
|
|
433
|
+
};
|
|
434
|
+
export type StrudelFlowState = {
|
|
435
|
+
nodes: Ref<StrudelFlowNode[]>;
|
|
436
|
+
edges: Ref<StrudelFlowEdge[]>;
|
|
437
|
+
beatsPerMinute: Ref<number>;
|
|
438
|
+
beatsPerCycle: Ref<number>;
|
|
439
|
+
compilation: ComputedRef<StrudelFlowCompilation>;
|
|
440
|
+
addNode: (kind: StrudelFlowNodeKind) => void;
|
|
441
|
+
updateNodeData: (nodeId: string, data: StrudelFlowNodeData) => void;
|
|
442
|
+
removeNode: (nodeId: string) => void;
|
|
443
|
+
/** Adds a cable when the same connection rules the canvas uses allow it. */
|
|
444
|
+
connectNodes: (sourceNodeId: string, targetNodeId: string) => boolean;
|
|
445
|
+
setBeatsPerMinute: (beatsPerMinute: number) => void;
|
|
446
|
+
setBeatsPerCycle: (beatsPerCycle: number) => void;
|
|
447
|
+
resetPatch: () => void;
|
|
448
|
+
/**
|
|
449
|
+
* Rebuilds the graph from code, reusing node positions where it can.
|
|
450
|
+
* @returns false while the code has a syntax error and the graph was left as it was
|
|
451
|
+
*/
|
|
452
|
+
loadCode: (code: string) => boolean;
|
|
453
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StrudelFlowState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The node canvas state: the patch, its tempo, the code it compiles to, and the edits a
|
|
4
|
+
* palette or canvas makes. Every change is written to local storage, and an invalid cable is
|
|
5
|
+
* refused here as well as on the canvas.
|
|
6
|
+
* @returns the patch, its compilation, and the actions that change it
|
|
7
|
+
*/
|
|
8
|
+
export declare const useStrudelFlow: () => StrudelFlowState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webgamekit/strudel-flow",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A node editor that compiles instrument and effect nodes into Strudel code, after Strudel Flow by xyflow (https://xyflow.com/strudel-flow, https://github.com/xyflow/strudel-flow).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.umd.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.umd.cjs",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@vue-flow/core": "^1.48.2",
|
|
24
|
+
"@vue-flow/controls": "^1.1.3",
|
|
25
|
+
"lucide-vue-next": "^0.563.0",
|
|
26
|
+
"vue": "^3.4.21"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"vue": "^3.4.21"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
33
|
+
"typescript": "^5.0.0",
|
|
34
|
+
"vite": "^5.0.0",
|
|
35
|
+
"vitest": "^4.0.18"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/cnotv/strudel-node-editor.git",
|
|
40
|
+
"directory": "packages/strudel-flow"
|
|
41
|
+
},
|
|
42
|
+
"license": "AGPL-3.0-or-later",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build && tsc"
|
|
45
|
+
}
|
|
6
46
|
}
|
package/README.md
DELETED