p5.zine 0.0.1 → 0.0.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/LICENSE +600 -0
- package/README.md +31 -38
- package/dist/p5.zine.js +570 -0
- package/dist/p5.zine.legacy.js +570 -0
- package/package.json +21 -3
- package/.github/workflows/build.yml +0 -27
- package/build.js +0 -77
- package/scripts/smoke-test.js +0 -53
- package/src/adapters/p5-1.js +0 -65
- package/src/adapters/p5-2.js +0 -46
- package/src/custom.js +0 -430
- package/src/html.js +0 -6
- package/src/index.js +0 -3
- package/src/index.legacy.js +0 -3
- package/src/index.modern.js +0 -3
- package/src/page-size.js +0 -143
- package/src/style.js +0 -28
- package/src/ui.css +0 -245
- package/src/ui.html +0 -33
- package/src/zine.js +0 -1003
- package/test/compat.html +0 -95
- package/test/index.html +0 -19
- package/test/index.legacy.html +0 -19
- package/test/sketch.js +0 -21
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ p5.zine is a **browser‑first** library on top of p5.js for making printable zi
|
|
|
10
10
|
### p5 2.x
|
|
11
11
|
|
|
12
12
|
```html
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/p5@2
|
|
14
|
-
<script src="https://cdn.jsdelivr.net/npm/p5.zine
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/p5@2/lib/p5.min.js"></script>
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/p5.zine/dist/p5.zine.js"></script>
|
|
15
15
|
<script>
|
|
16
16
|
function setup() {}
|
|
17
17
|
function draw() {
|
|
@@ -30,26 +30,33 @@ p5.zine is a **browser‑first** library on top of p5.js for making printable zi
|
|
|
30
30
|
|
|
31
31
|
```html
|
|
32
32
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.1/p5.js"></script>
|
|
33
|
-
<script src="https://cdn.jsdelivr.net/npm/p5.zine
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/npm/p5.zine/dist/p5.zine.legacy.js"></script>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Table of contents
|
|
37
37
|
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
38
|
+
- [p5.zine](#p5zine)
|
|
39
|
+
- [Quick start (CDN, easiest)](#quick-start-cdn-easiest)
|
|
40
|
+
- [p5 2.x](#p5-2x)
|
|
41
|
+
- [p5 1.x (legacy)](#p5-1x-legacy)
|
|
42
|
+
- [Table of contents](#table-of-contents)
|
|
43
|
+
- [Bundles (p5 2.x + 1.x)](#bundles-p5-2x--1x)
|
|
44
|
+
- [Local dev / preview](#local-dev--preview)
|
|
45
|
+
- [Pages](#pages)
|
|
46
|
+
- [Configuration (`window.zine`)](#configuration-windowzine)
|
|
47
|
+
- [Preview modes](#preview-modes)
|
|
48
|
+
- [Mouse handling](#mouse-handling)
|
|
49
|
+
- [Download background](#download-background)
|
|
50
|
+
- [Page size vs. paper size](#page-size-vs-paper-size)
|
|
51
|
+
- [`zinePageSize(width, height, options)`](#zinepagesizewidth-height-options)
|
|
52
|
+
- [`zinePaperSize(width, height, options)`](#zinepapersizewidth-height-options)
|
|
53
|
+
- [Export](#export)
|
|
54
|
+
- [JPG / PNG](#jpg--png)
|
|
55
|
+
- [PDF](#pdf)
|
|
56
|
+
- [Custom helpers (custom.js)](#custom-helpers-customjs)
|
|
57
|
+
- [CDN usage (advanced)](#cdn-usage-advanced)
|
|
58
|
+
- [Architecture (1.x + 2.x addons)](#architecture-1x--2x-addons)
|
|
59
|
+
- [Internal defaults](#internal-defaults)
|
|
53
60
|
|
|
54
61
|
## Bundles (p5 2.x + 1.x)
|
|
55
62
|
|
|
@@ -111,7 +118,7 @@ window.zine = {
|
|
|
111
118
|
downloadBackground: "#ffffff", // default white; use "transparent" for none
|
|
112
119
|
|
|
113
120
|
mouseClamp: true, // keep mouse within each page
|
|
114
|
-
mousePadding: 0,
|
|
121
|
+
mousePadding: 0, // when mouseClamp is false, allow extra padding
|
|
115
122
|
|
|
116
123
|
// page size (single page)
|
|
117
124
|
pageWidth: "8.5in",
|
|
@@ -125,7 +132,7 @@ window.zine = {
|
|
|
125
132
|
|
|
126
133
|
// DPI + units (used for inches/cm/mm/pt conversions)
|
|
127
134
|
pageDPI: 96,
|
|
128
|
-
pageUnit: "in"
|
|
135
|
+
pageUnit: "in",
|
|
129
136
|
};
|
|
130
137
|
```
|
|
131
138
|
|
|
@@ -147,6 +154,7 @@ Set `downloadBackground: "transparent"` to keep transparency (only works with PN
|
|
|
147
154
|
## Page size vs. paper size
|
|
148
155
|
|
|
149
156
|
### `zinePageSize(width, height, options)`
|
|
157
|
+
|
|
150
158
|
Sets the **base size for each single page** (cover/back). Full spreads are 2× width.
|
|
151
159
|
|
|
152
160
|
```js
|
|
@@ -156,6 +164,7 @@ function setup() {
|
|
|
156
164
|
```
|
|
157
165
|
|
|
158
166
|
### `zinePaperSize(width, height, options)`
|
|
167
|
+
|
|
159
168
|
Sets the **full paper size** (imposition) and derives the page size:
|
|
160
169
|
|
|
161
170
|
- `pageWidth = paperHeight / 4`
|
|
@@ -205,27 +214,11 @@ These helpers are available on both `p5` and `p5.Graphics`:
|
|
|
205
214
|
If you want a pinned version:
|
|
206
215
|
|
|
207
216
|
```html
|
|
208
|
-
<script src="https://cdn.jsdelivr.net/npm/p5.zine@
|
|
217
|
+
<script src="https://cdn.jsdelivr.net/npm/p5.zine@0.0.1/dist/p5.zine.js"></script>
|
|
209
218
|
```
|
|
210
219
|
|
|
211
220
|
If you omit the version, CDN will serve the latest tag (which can include breaking changes).
|
|
212
221
|
|
|
213
|
-
## Releases & versioning (maintainers)
|
|
214
|
-
|
|
215
|
-
This project publishes to npm primarily to power CDN distribution. If you’re a maintainer:
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
npm version patch # or minor / major
|
|
219
|
-
npm run build
|
|
220
|
-
npm publish
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
If you want automated releases, I can set up:
|
|
224
|
-
|
|
225
|
-
- GitHub Actions for `npm publish` on tag
|
|
226
|
-
- Auto‑generated changelog
|
|
227
|
-
- Release notes from conventional commits
|
|
228
|
-
|
|
229
222
|
## Architecture (1.x + 2.x addons)
|
|
230
223
|
|
|
231
224
|
Core addon logic lives in:
|
|
@@ -252,7 +245,7 @@ const DEFAULTS = {
|
|
|
252
245
|
rHeight: 306,
|
|
253
246
|
pWidth: 800,
|
|
254
247
|
frameRate: 10,
|
|
255
|
-
pixelDensity: 1
|
|
248
|
+
pixelDensity: 1,
|
|
256
249
|
};
|
|
257
250
|
```
|
|
258
251
|
|