@tialro2/rnbokit 1.0.14 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +242 -242
  2. package/dist/RNBO.css +113 -113
  3. package/dist/RNBO.svelte +230 -230
  4. package/dist/RNBO.svelte.d.ts +19 -18
  5. package/dist/RNBOcomponents/AudioDropIn.svelte +125 -125
  6. package/dist/RNBOcomponents/ExtMidiIn.svelte +85 -85
  7. package/dist/RNBOcomponents/ExtMidiIn.svelte.d.ts +2 -2
  8. package/dist/RNBOcomponents/ExtMidiOut.svelte +85 -85
  9. package/dist/RNBOcomponents/ExtMidiOut.svelte.d.ts +2 -2
  10. package/dist/RNBOcomponents/MicIn.svelte +80 -80
  11. package/dist/RNBOcomponents/RNBOInlet.svelte +66 -66
  12. package/dist/RNBOcomponents/RNBOInlet.svelte.d.ts +6 -6
  13. package/dist/RNBOcomponents/RNBOInport.svelte +21 -21
  14. package/dist/RNBOcomponents/RNBOMidiIn.svelte +63 -63
  15. package/dist/RNBOcomponents/RNBOMidiIn.svelte.d.ts +6 -6
  16. package/dist/RNBOcomponents/RNBOMidiOut.svelte +22 -22
  17. package/dist/RNBOcomponents/RNBOMidiOut.svelte.d.ts +4 -4
  18. package/dist/RNBOcomponents/RNBOOutport.svelte +36 -36
  19. package/dist/RNBOcomponents/RNBOOutport.svelte.d.ts +4 -4
  20. package/dist/RNBOcomponents/RNBOParam.svelte +37 -37
  21. package/dist/RNBOcomponents/XYMidiIn.svelte +93 -93
  22. package/dist/RNBOcomponents/XYMidiIn.svelte.d.ts +2 -2
  23. package/dist/UIcomponents/Controls.svelte +12 -12
  24. package/dist/UIcomponents/FileDropZone.svelte +118 -118
  25. package/dist/UIcomponents/ProgressBar.svelte +35 -35
  26. package/dist/UIcomponents/ProgressBar.svelte.d.ts +6 -6
  27. package/dist/UIcomponents/RadioGroup.svelte +27 -27
  28. package/dist/UIcomponents/RadioGroup.svelte.d.ts +4 -4
  29. package/dist/UIcomponents/RadioItem.svelte +96 -96
  30. package/dist/UIcomponents/RadioItem.svelte.d.ts +6 -6
  31. package/dist/UIcomponents/RangeSlider.svelte.d.ts +10 -10
  32. package/dist/index.js +20 -20
  33. package/package.json +7 -7
package/README.md CHANGED
@@ -1,243 +1,243 @@
1
- <img width="493" alt="Screenshot 2023-11-24 at 15 43 41" src="static/sreenshot.jpeg">
2
-
3
- # RNBOKit
4
-
5
- An easily extendable Sveltekit component library for seamlessly importing Cycling74's Max RNBO~ patches into your Svelte app.
6
-
7
- ## Disclaimer
8
-
9
- ~ warning #1: this package is still work in progress ~
10
-
11
- ~ warning #2: this is my very first library & open source project, mistakes are bound to be made, so please do correct me on any mistake or practice I can do better! ~
12
-
13
- ## Getting Started
14
-
15
- First set up a [Sveltekit project](https://kit.svelte.dev/docs/quick-start).
16
-
17
- Once you've created and installed your project add RNBOKit to your packages
18
-
19
- ```bash
20
- npm install rnbokit
21
- ```
22
-
23
- Or using pnpm:
24
-
25
- ```bash
26
- pnpm install rnbokit
27
- ```
28
-
29
- ## Using RNBOKit in your project
30
-
31
- To start running RNBO patches in your Sveltekit project, you will need to export your RNBO~ patch for the web.
32
-
33
- <img width="597" alt="Screenshot 2023-05-26 at 17 20 39" src="https://github.com/SanderNotenbaert/RNBOKit/assets/34664737/c48b537f-79a1-4a4f-beef-cc5bf72addfc">
34
-
35
- It will create a folder which contains a .JSON file. You can export it directly into your project directory.
36
-
37
- <img width="567" alt="Screenshot 2023-05-26 at 17 22 03" src="https://github.com/SanderNotenbaert/RNBOKit/assets/34664737/534588d2-7bfe-4fa3-b686-3a2d5dca54d4">
38
-
39
- By default the <RNBO> component will look for a `patch.export.json` file in a `src/RNBO/` folder. For each inport, you have to provide a PNG file with the same name as the inport in the `static` directory (e.g. the file `in2.png` for an inport with the tag `in2`).
40
- Next you will need to import the RNBO component into your `+page.svelte` file.
41
-
42
- ```svelte
43
- <script>
44
- import { RNBO } from 'rnbokit';
45
- </script>
46
-
47
- <RNBO />
48
- ```
49
-
50
- This is enough to start running the RNBO patch in your Sveltekit project. It will generate all the parameters and visualise any number messages from the outlet (0.-1.)
51
-
52
- ## extending with custom slots
53
-
54
- You can customize how parameters or messages are handled by adding your own components in the RNBO tag. You can pass information from the RNBO component down to the child components by using Svelte's `let:` syntax. Some available objects are `dependencyFileCorrected` (ExternalDataInfo[]), `context` (AudioContext), `device` (Device), or `parameters` (Parameter[]). You can find more information on these in the [RNBO JS documentation](https://rnbo.cycling74.com/js).
55
-
56
- ```svelte
57
- <script>
58
- import { RNBO, RNBOParam } from 'rnbokit';
59
- </script>
60
-
61
- <RNBO let:parameters>
62
- {#each parameters as parameter}
63
- <!-- create custom components -->
64
- <p>{parameter.name}</p>
65
- <p>{parameter.value}</p>
66
- <!-- or use the included UI components -->
67
- <RNBOParam {parameter} />
68
- {/each}
69
- </RNBO>
70
- ```
71
-
72
- Here is the full list of all available variables:
73
-
74
- ```svelte
75
- <script>
76
- import { RNBO } from 'rnbokit';
77
- </script>
78
-
79
- <RNBO let:device <!-- type: Device - the device object, check RNBO js documentation -->
80
- let:dependencyFileCorrected <!-- type: ExternalDataInfo[] - represents the json with dependencies of the patch, check RNBO js documentation -->
81
- let:parameters <!-- type: Parameter[] - an array containing all RNBO parameters, check RNBO js documentation -->
82
- let:context <!-- type: AudioContext - the audio context, see https://developer.mozilla.org/Web/API/AudioContext -->
83
- let:inports <!-- type: MessageInfo[] - an array of objects containing info on each message inlet -->
84
- let:inlets <!-- type: signalPort[] - an array of objects containing info on each signal inlet -->
85
- let:outports <!-- type: MessageInfo[] - an array of objects containing info on each message outlet -->
86
- let:outlets <!-- type: signalPort[] - an array of objects containing info on each signal outlet -->
87
- let:midiInports <!-- type: Array<Number> - an array representing each midiInport as an index number -->
88
- let:midiOutports <!-- type: Array<Number> - an array representing each midiOutport as an index number -->
89
- >
90
- <!-- do something with it here -->
91
- </RNBO>
92
- ```
93
-
94
- In order to be able to change parameter values or send messages to inlets with custom parameter components, you'll need to bind `parameters` or `device` in the `<RNBO\>` component to a declared variable in the top level script. To control the value, bind the value of your own component to it as well.
95
-
96
- ```svelte
97
- <script>
98
- import { RNBO } from 'rnbokit';
99
- //this example uses JSDoc for typing
100
- /** @type {import ('@rnbo/js').Parameter[]} */
101
- let patchParams;
102
- </script>
103
-
104
- <RNBO bind:parameters={patchParams}>
105
- <div class="slidecontainer">
106
- <input
107
- type="range"
108
- min={patchParams[1].min}
109
- max={patchParams[1].max}
110
- id={patchParams[1].name}
111
- bind:value={patchParams[1].value}
112
- class="RNBOslider"
113
- />
114
- <p class="RNBOval">{patchParams[1].value}</p>
115
- </div>
116
- </RNBO>
117
- ```
118
-
119
- ## Available components
120
-
121
- ### RNBO specific components
122
-
123
- Here is the list of available RNBO components, to be used as slots of the `<RNBO>` component:
124
-
125
- ```javascript
126
- import { RNBOParam } from 'rnbokit'; //required props: {parameters}
127
- import { RNBOInport } from 'rnbokit'; //required props: {inport} {device} - optional props: {min}, {max}
128
- import { RNBOOutport } from 'rnbokit'; //required props: {outport} {device} - optional props: {min}, {max}
129
- import { RNBOInlet } from 'rnbokit'; //required props: {inlet} {device} - optional props: {mode} options: 'mic', 'dropIn'
130
- import { RNBOMidiIn } from 'rnbokit'; //required props: {port} {device} - optional props: {mode} options: 'xy', 'external'
131
- //not working, RNBO bug
132
- //import { RNBOMidiOut } from 'rnbokit'; //required props: {port} {device}
133
- ```
134
-
135
- ### Utility components
136
-
137
- These are some internally used utility components which are not dependent on RNBO:
138
-
139
- ```javascript
140
- import { AudioDropIn } from 'rnbokit';
141
- import { MicIn } from 'rnbokit';
142
- import { XYMidiIn } from 'rnbokit';
143
- import { ExtMidiIn } from 'rnbokit';
144
- // work in progress
145
- // import { ExtMidiOut } from 'rnbokit';
146
- ```
147
-
148
- ### UI components
149
-
150
- Internally used UI components, that can also be reused in different contexts:
151
-
152
- ```javascript
153
- import { FileDropZone } from 'rnbokit';
154
- import { ProgressBar } from 'rnbokit';
155
- import { Radiogroup, RadioItem } from 'rnbokit';
156
- import { RangeSlider } from 'rnbokit';
157
- ```
158
-
159
- ## Styling
160
-
161
- The default styling is done with the internal RNBO.css stylesheet. If you want to change really fundamental styling you can edit/replace that one, but you can also simply declare the following css variables in your own global stylesheet:
162
-
163
- ```css
164
- :root {
165
- /* =~= Theme Properties =~= */
166
- --theme-font-family: system-ui;
167
- --theme-rounded-base: 9999px;
168
- --theme-rounded-container: 6px;
169
- --theme-border-base: 1px;
170
- /* =~= Color Properties =~= */
171
- --theme-accent-color: 39, 145, 142;
172
- --theme-surface-color: 38, 38, 38;
173
- --theme-bg-color: 255, 255, 255;
174
- --theme-font-color-base: 38, 38, 38;
175
- /* =~= Animation Properties =~= */
176
- --theme-animation-duration: 0.1s;
177
- --theme-animation: all;
178
- --theme-animation-function: ease-out;
179
- }
180
- ```
181
-
182
- ## Defaults
183
-
184
- Here is what it could look like if you'd recreate the RNBO component's default slot, for inspiration:
185
-
186
- ```svelte
187
- <RNBO let:device let:midiInports let:inlets let:inports let:parameters let:outports>
188
- <div class="RNBOsection">
189
- <h1>patch.export.json</h1>
190
-
191
- <!-- create input for each MIDI input port -->
192
- {#if midiInports.length > 0}
193
- <div class="RNBOsection">
194
- <h2>MIDI inputs</h2>
195
- {#each midiInports as port}
196
- <RNBOMidiIn {port} {device} />
197
- {/each}
198
- </div>
199
- {/if}
200
-
201
- <!-- handle all signal inlets -->
202
- {#if inlets.length > 0}
203
- <div class="RNBOsection">
204
- <h2>signal inlets</h2>
205
- {#each inlets as inlet}
206
- <RNBOInlet {inlet} {device} />
207
- {/each}
208
- </div>
209
- {/if}
210
-
211
- <!-- handle all event inlets -->
212
- {#if inports.length > 0}
213
- <div class="RNBOsection">
214
- <!-- list only the event inlets (skip signal ones) -->
215
- <h2>message inlets</h2>
216
- {#each inports as inport}
217
- <RNBOInport {inport.tag} {device} />
218
- {/each}
219
- </div>
220
- {/if}
221
-
222
- <!-- handle all parameters -->
223
- {#if parameters.length > 0}
224
- <div class="RNBOsection">
225
- <h2>parameters</h2>
226
- {#each parameters as parameter}
227
- <RNBOParam {parameter} />
228
- {/each}
229
- </div>
230
- {/if}
231
-
232
- <!-- handle all event outlets -->
233
- {#if outports.length > 0}
234
- <div class="RNBOsection">
235
- <h2>outport events</h2>
236
- {#each outports as outport}
237
- <RNBOOutport {outport} {device} />
238
- {/each}
239
- </div>
240
- {/if}
241
- </div>
242
- </RNBO>
1
+ <img width="493" alt="Screenshot 2023-11-24 at 15 43 41" src="static/sreenshot.jpeg">
2
+
3
+ # RNBOKit
4
+
5
+ An easily extendable Sveltekit component library for seamlessly importing Cycling74's Max RNBO~ patches into your Svelte app.
6
+
7
+ ## Disclaimer
8
+
9
+ ~ warning #1: this package is still work in progress ~
10
+
11
+ ~ warning #2: this is my very first library & open source project, mistakes are bound to be made, so please do correct me on any mistake or practice I can do better! ~
12
+
13
+ ## Getting Started
14
+
15
+ First set up a [Sveltekit project](https://kit.svelte.dev/docs/quick-start).
16
+
17
+ Once you've created and installed your project add RNBOKit to your packages
18
+
19
+ ```bash
20
+ npm install rnbokit
21
+ ```
22
+
23
+ Or using pnpm:
24
+
25
+ ```bash
26
+ pnpm install rnbokit
27
+ ```
28
+
29
+ ## Using RNBOKit in your project
30
+
31
+ To start running RNBO patches in your Sveltekit project, you will need to export your RNBO~ patch for the web.
32
+
33
+ <img width="597" alt="Screenshot 2023-05-26 at 17 20 39" src="https://github.com/SanderNotenbaert/RNBOKit/assets/34664737/c48b537f-79a1-4a4f-beef-cc5bf72addfc">
34
+
35
+ It will create a folder which contains a .JSON file. You can export it directly into your project directory.
36
+
37
+ <img width="567" alt="Screenshot 2023-05-26 at 17 22 03" src="https://github.com/SanderNotenbaert/RNBOKit/assets/34664737/534588d2-7bfe-4fa3-b686-3a2d5dca54d4">
38
+
39
+ By default the <RNBO> component will look for a `patch.export.json` file in a `src/RNBO/` folder. For each inport, you have to provide a PNG file with the same name as the inport in the `static` directory (e.g. the file `in2.png` for an inport with the tag `in2`).
40
+ Next you will need to import the RNBO component into your `+page.svelte` file.
41
+
42
+ ```svelte
43
+ <script>
44
+ import { RNBO } from 'rnbokit';
45
+ </script>
46
+
47
+ <RNBO />
48
+ ```
49
+
50
+ This is enough to start running the RNBO patch in your Sveltekit project. It will generate all the parameters and visualise any number messages from the outlet (0.-1.)
51
+
52
+ ## extending with custom slots
53
+
54
+ You can customize how parameters or messages are handled by adding your own components in the RNBO tag. You can pass information from the RNBO component down to the child components by using Svelte's `let:` syntax. Some available objects are `dependencyFileCorrected` (ExternalDataInfo[]), `context` (AudioContext), `device` (Device), or `parameters` (Parameter[]). You can find more information on these in the [RNBO JS documentation](https://rnbo.cycling74.com/js).
55
+
56
+ ```svelte
57
+ <script>
58
+ import { RNBO, RNBOParam } from 'rnbokit';
59
+ </script>
60
+
61
+ <RNBO let:parameters>
62
+ {#each parameters as parameter}
63
+ <!-- create custom components -->
64
+ <p>{parameter.name}</p>
65
+ <p>{parameter.value}</p>
66
+ <!-- or use the included UI components -->
67
+ <RNBOParam {parameter} />
68
+ {/each}
69
+ </RNBO>
70
+ ```
71
+
72
+ Here is the full list of all available variables:
73
+
74
+ ```svelte
75
+ <script>
76
+ import { RNBO } from 'rnbokit';
77
+ </script>
78
+
79
+ <RNBO let:device <!-- type: Device - the device object, check RNBO js documentation -->
80
+ let:dependencyFileCorrected <!-- type: ExternalDataInfo[] - represents the json with dependencies of the patch, check RNBO js documentation -->
81
+ let:parameters <!-- type: Parameter[] - an array containing all RNBO parameters, check RNBO js documentation -->
82
+ let:context <!-- type: AudioContext - the audio context, see https://developer.mozilla.org/Web/API/AudioContext -->
83
+ let:inports <!-- type: MessageInfo[] - an array of objects containing info on each message inlet -->
84
+ let:inlets <!-- type: signalPort[] - an array of objects containing info on each signal inlet -->
85
+ let:outports <!-- type: MessageInfo[] - an array of objects containing info on each message outlet -->
86
+ let:outlets <!-- type: signalPort[] - an array of objects containing info on each signal outlet -->
87
+ let:midiInports <!-- type: Array<Number> - an array representing each midiInport as an index number -->
88
+ let:midiOutports <!-- type: Array<Number> - an array representing each midiOutport as an index number -->
89
+ >
90
+ <!-- do something with it here -->
91
+ </RNBO>
92
+ ```
93
+
94
+ In order to be able to change parameter values or send messages to inlets with custom parameter components, you'll need to bind `parameters` or `device` in the `<RNBO\>` component to a declared variable in the top level script. To control the value, bind the value of your own component to it as well.
95
+
96
+ ```svelte
97
+ <script>
98
+ import { RNBO } from 'rnbokit';
99
+ //this example uses JSDoc for typing
100
+ /** @type {import ('@rnbo/js').Parameter[]} */
101
+ let patchParams;
102
+ </script>
103
+
104
+ <RNBO bind:parameters={patchParams}>
105
+ <div class="slidecontainer">
106
+ <input
107
+ type="range"
108
+ min={patchParams[1].min}
109
+ max={patchParams[1].max}
110
+ id={patchParams[1].name}
111
+ bind:value={patchParams[1].value}
112
+ class="RNBOslider"
113
+ />
114
+ <p class="RNBOval">{patchParams[1].value}</p>
115
+ </div>
116
+ </RNBO>
117
+ ```
118
+
119
+ ## Available components
120
+
121
+ ### RNBO specific components
122
+
123
+ Here is the list of available RNBO components, to be used as slots of the `<RNBO>` component:
124
+
125
+ ```javascript
126
+ import { RNBOParam } from 'rnbokit'; //required props: {parameters}
127
+ import { RNBOInport } from 'rnbokit'; //required props: {inport} {device} - optional props: {min}, {max}
128
+ import { RNBOOutport } from 'rnbokit'; //required props: {outport} {device} - optional props: {min}, {max}
129
+ import { RNBOInlet } from 'rnbokit'; //required props: {inlet} {device} - optional props: {mode} options: 'mic', 'dropIn'
130
+ import { RNBOMidiIn } from 'rnbokit'; //required props: {port} {device} - optional props: {mode} options: 'xy', 'external'
131
+ //not working, RNBO bug
132
+ //import { RNBOMidiOut } from 'rnbokit'; //required props: {port} {device}
133
+ ```
134
+
135
+ ### Utility components
136
+
137
+ These are some internally used utility components which are not dependent on RNBO:
138
+
139
+ ```javascript
140
+ import { AudioDropIn } from 'rnbokit';
141
+ import { MicIn } from 'rnbokit';
142
+ import { XYMidiIn } from 'rnbokit';
143
+ import { ExtMidiIn } from 'rnbokit';
144
+ // work in progress
145
+ // import { ExtMidiOut } from 'rnbokit';
146
+ ```
147
+
148
+ ### UI components
149
+
150
+ Internally used UI components, that can also be reused in different contexts:
151
+
152
+ ```javascript
153
+ import { FileDropZone } from 'rnbokit';
154
+ import { ProgressBar } from 'rnbokit';
155
+ import { Radiogroup, RadioItem } from 'rnbokit';
156
+ import { RangeSlider } from 'rnbokit';
157
+ ```
158
+
159
+ ## Styling
160
+
161
+ The default styling is done with the internal RNBO.css stylesheet. If you want to change really fundamental styling you can edit/replace that one, but you can also simply declare the following css variables in your own global stylesheet:
162
+
163
+ ```css
164
+ :root {
165
+ /* =~= Theme Properties =~= */
166
+ --theme-font-family: system-ui;
167
+ --theme-rounded-base: 9999px;
168
+ --theme-rounded-container: 6px;
169
+ --theme-border-base: 1px;
170
+ /* =~= Color Properties =~= */
171
+ --theme-accent-color: 39, 145, 142;
172
+ --theme-surface-color: 38, 38, 38;
173
+ --theme-bg-color: 255, 255, 255;
174
+ --theme-font-color-base: 38, 38, 38;
175
+ /* =~= Animation Properties =~= */
176
+ --theme-animation-duration: 0.1s;
177
+ --theme-animation: all;
178
+ --theme-animation-function: ease-out;
179
+ }
180
+ ```
181
+
182
+ ## Defaults
183
+
184
+ Here is what it could look like if you'd recreate the RNBO component's default slot, for inspiration:
185
+
186
+ ```svelte
187
+ <RNBO let:device let:midiInports let:inlets let:inports let:parameters let:outports>
188
+ <div class="RNBOsection">
189
+ <h1>patch.export.json</h1>
190
+
191
+ <!-- create input for each MIDI input port -->
192
+ {#if midiInports.length > 0}
193
+ <div class="RNBOsection">
194
+ <h2>MIDI inputs</h2>
195
+ {#each midiInports as port}
196
+ <RNBOMidiIn {port} {device} />
197
+ {/each}
198
+ </div>
199
+ {/if}
200
+
201
+ <!-- handle all signal inlets -->
202
+ {#if inlets.length > 0}
203
+ <div class="RNBOsection">
204
+ <h2>signal inlets</h2>
205
+ {#each inlets as inlet}
206
+ <RNBOInlet {inlet} {device} />
207
+ {/each}
208
+ </div>
209
+ {/if}
210
+
211
+ <!-- handle all event inlets -->
212
+ {#if inports.length > 0}
213
+ <div class="RNBOsection">
214
+ <!-- list only the event inlets (skip signal ones) -->
215
+ <h2>message inlets</h2>
216
+ {#each inports as inport}
217
+ <RNBOInport {inport.tag} {device} />
218
+ {/each}
219
+ </div>
220
+ {/if}
221
+
222
+ <!-- handle all parameters -->
223
+ {#if parameters.length > 0}
224
+ <div class="RNBOsection">
225
+ <h2>parameters</h2>
226
+ {#each parameters as parameter}
227
+ <RNBOParam {parameter} />
228
+ {/each}
229
+ </div>
230
+ {/if}
231
+
232
+ <!-- handle all event outlets -->
233
+ {#if outports.length > 0}
234
+ <div class="RNBOsection">
235
+ <h2>outport events</h2>
236
+ {#each outports as outport}
237
+ <RNBOOutport {outport} {device} />
238
+ {/each}
239
+ </div>
240
+ {/if}
241
+ </div>
242
+ </RNBO>
243
243
  ```