@munusshih/p5.export 0.1.0-beta.0 → 0.1.0-beta.2
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/README.md +15 -3
- package/dist/p5.export.js +172 -143
- package/dist/p5.export.js.map +1 -1
- package/dist/p5.export.min.js +7 -7
- package/dist/p5.export.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,19 +10,31 @@ Works with **p5.js 1.x and 2.x**. p5 is brought by you (CDN or bundler); this pa
|
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<script src="https://cdn.jsdelivr.net/npm/p5@2/lib/p5.js"></script>
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/p5.export"></script>
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/@munusshih/p5.export"></script>
|
|
14
14
|
<script src="sketch.js"></script>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### npm + bundler
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install p5.export
|
|
20
|
+
npm install @munusshih/p5.export
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
import 'p5'; // however you bring p5 onto the page
|
|
25
|
-
import 'p5.export'; // auto-registers
|
|
25
|
+
import '@munusshih/p5.export'; // auto-registers
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This auto-registers even under bundlers: p5 2.x's ESM build never assigns
|
|
29
|
+
`window.p5`, so the add-on falls back to resolving `p5` as a module. For
|
|
30
|
+
**guaranteed registration order** (recommended for instance-mode sketches or
|
|
31
|
+
strict bundlers), register explicitly instead:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import p5 from 'p5';
|
|
35
|
+
import { register } from '@munusshih/p5.export';
|
|
36
|
+
|
|
37
|
+
register(p5); // before you create the sketch / define setup()
|
|
26
38
|
```
|
|
27
39
|
|
|
28
40
|
That's it. The GUI auto-mounts after `setup()` runs. Disable it with `window.p5ExportConfig = { autoGUI: false }` declared before this script loads, or remove it later with `removeExportGUI()`.
|