paperlab 0.5.2 → 0.7.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/README.md +26 -7
- package/dist/FxPostPass-M66QMVVC.js +166 -0
- package/dist/FxPostPass-M66QMVVC.js.map +1 -0
- package/dist/Grade-SBGYELKV.js +49 -0
- package/dist/Grade-SBGYELKV.js.map +1 -0
- package/dist/chunk-7TLIWPGM.js +36 -0
- package/dist/chunk-7TLIWPGM.js.map +1 -0
- package/dist/chunk-GB6BMHC3.js +811 -0
- package/dist/chunk-GB6BMHC3.js.map +1 -0
- package/dist/{chunk-HRXQTJFS.js → chunk-MZCAN3AR.js} +3629 -640
- package/dist/chunk-MZCAN3AR.js.map +1 -0
- package/dist/damageContract-DPF1YFLZ.d.cts +129 -0
- package/dist/damageContract-DPF1YFLZ.d.ts +129 -0
- package/dist/fx.cjs +4276 -0
- package/dist/fx.cjs.map +1 -0
- package/dist/fx.d.cts +1796 -0
- package/dist/fx.d.ts +1796 -0
- package/dist/fx.js +3194 -0
- package/dist/fx.js.map +1 -0
- package/dist/index.cjs +4817 -1149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +208 -32
- package/dist/index.d.ts +208 -32
- package/dist/index.js +26 -4
- package/dist/index.js.map +1 -1
- package/dist/slots-C5PqY0Q5.d.cts +2297 -0
- package/dist/slots-C5PqY0Q5.d.ts +2297 -0
- package/dist/stage.cjs +5021 -1335
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +78 -636
- package/dist/stage.d.ts +78 -636
- package/dist/stage.js +41 -61
- package/dist/stage.js.map +1 -1
- package/package.json +18 -5
- package/dist/chunk-HRXQTJFS.js.map +0 -1
- package/dist/slots-CIo7FnlY.d.cts +0 -13357
- package/dist/slots-CIo7FnlY.d.ts +0 -13357
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What damage IS, as far as a sheet is concerned. The whole seam.
|
|
3
|
+
*
|
|
4
|
+
* The split is by responsibility. What has happened to the paper belongs to
|
|
5
|
+
* the sheet — it is shading, alpha and eventually stiffness, and only the
|
|
6
|
+
* sheet can draw or simulate those. What CAUSES it belongs to `paperlab/fx`:
|
|
7
|
+
* a flame, a cup of water, a pair of scissors. The main entry draws whatever
|
|
8
|
+
* damage it is handed and has no idea where it came from, which is exactly
|
|
9
|
+
* how `content` already works — `<Paper>` renders a texture without knowing
|
|
10
|
+
* who painted it.
|
|
11
|
+
*
|
|
12
|
+
* The alternative was a public plugin API for the surface composer and the
|
|
13
|
+
* cloth solver, so that fx could reach in. More flexible, and it would have
|
|
14
|
+
* had to be supported for years before a single effect existed to justify its
|
|
15
|
+
* shape. This is one interface and four constants.
|
|
16
|
+
*
|
|
17
|
+
* **This file imports nothing, on purpose.** `paperlab/fx` depends on it —
|
|
18
|
+
* the field is a `DamageSource` and its channel offsets are these — and the
|
|
19
|
+
* boundary test allows fx to reach this one file and nothing else in the
|
|
20
|
+
* library. The moment it imports three, React or the config schema, fx starts
|
|
21
|
+
* dragging the library in behind it.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* A grid of damage over the sheet's UV, as the sheet reads it.
|
|
25
|
+
*
|
|
26
|
+
* Satisfied structurally by `DamageField` in `paperlab/fx`, and by anything
|
|
27
|
+
* else that can produce four bytes per texel — a baked texture, a recorded
|
|
28
|
+
* burn played back, a test fixture.
|
|
29
|
+
*/
|
|
30
|
+
interface DamageSource {
|
|
31
|
+
/** Texels along each edge. The grid is square and covers the whole sheet. */
|
|
32
|
+
readonly size: number;
|
|
33
|
+
/**
|
|
34
|
+
* RGBA per texel, 0..255, row-major from v = 0 — the channels are
|
|
35
|
+
* {@link DAMAGE_CHANNELS}. Read in place, never copied: the source mutates
|
|
36
|
+
* it and bumps `version`.
|
|
37
|
+
*
|
|
38
|
+
* Eight bits, deliberately. The simulation behind it can run in float; what
|
|
39
|
+
* reaches the GPU is 16 KB per changed frame at 64², against 256 KB for a
|
|
40
|
+
* 128² float texture, and it does not depend on float-texture filtering,
|
|
41
|
+
* which not every phone GPU guarantees.
|
|
42
|
+
*/
|
|
43
|
+
readonly pixels: Uint8Array;
|
|
44
|
+
/** Bumped whenever `pixels` changes. The sheet uploads on a change and never otherwise. */
|
|
45
|
+
readonly version: number;
|
|
46
|
+
/**
|
|
47
|
+
* How ragged a burnt or cut edge is DRAWN, 0..1; omitted means 1.
|
|
48
|
+
*
|
|
49
|
+
* Presentation only: per-fragment noise that moves the edge within the
|
|
50
|
+
* grid's soft band, finer than the grid itself can carry. The physics reads
|
|
51
|
+
* the grid and never this. It is the one part of drawing damage that costs
|
|
52
|
+
* per pixel, which is why it is a number a source can turn down — `paperlab/fx`
|
|
53
|
+
* sets it from its quality tier.
|
|
54
|
+
*/
|
|
55
|
+
readonly detail?: number;
|
|
56
|
+
/**
|
|
57
|
+
* The burn's own clock, in seconds; omitted means the frame clock.
|
|
58
|
+
*
|
|
59
|
+
* Presentation only. The ember line on a burning edge is beaded and alive —
|
|
60
|
+
* its beads flicker and crawl — and a source that can be replayed wants
|
|
61
|
+
* that motion to replay too: the same moment of the same burn should draw
|
|
62
|
+
* the same beads, which the frame clock cannot promise. `DamageField`
|
|
63
|
+
* hands over its simulated time.
|
|
64
|
+
*/
|
|
65
|
+
readonly time?: number;
|
|
66
|
+
/**
|
|
67
|
+
* How a burn is DRAWN — widths, intensities and shapes the sheet's damage
|
|
68
|
+
* shading reads each frame. Presentation only; the physics never sees it.
|
|
69
|
+
* Anything left out takes {@link DAMAGE_LOOK_DEFAULTS}.
|
|
70
|
+
*/
|
|
71
|
+
readonly look?: DamageLook;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The knobs on what a burn looks like, in the units a person tunes by —
|
|
75
|
+
* millimetres of A4 and plain multipliers. Every one is optional.
|
|
76
|
+
*/
|
|
77
|
+
interface DamageLook {
|
|
78
|
+
/** The ember line's widest bead, mm. */
|
|
79
|
+
emberWidth?: number;
|
|
80
|
+
/** How bright the beads burn, × the default. */
|
|
81
|
+
emberIntensity?: number;
|
|
82
|
+
/** How much of the edge is lit at once, 0..1. */
|
|
83
|
+
emberCoverage?: number;
|
|
84
|
+
/** How fast the beads flicker and crawl, × the default. */
|
|
85
|
+
emberFlicker?: number;
|
|
86
|
+
/** The dim crimson glow beside the beads, reaching into the char, 0..2. */
|
|
87
|
+
emberGlow?: number;
|
|
88
|
+
/** Specks of glowing fibre along the edge, 0..2. */
|
|
89
|
+
sparkle?: number;
|
|
90
|
+
/** The pale ash lip's widest point, mm. */
|
|
91
|
+
lipWidth?: number;
|
|
92
|
+
/** How pale the ash lip is, × the sampled grey. */
|
|
93
|
+
lipBrightness?: number;
|
|
94
|
+
/** 0 is grey char, 1 is dark orange to deep brown. */
|
|
95
|
+
charWarmth?: number;
|
|
96
|
+
/** How visible the crack network in the char is, 0..1. */
|
|
97
|
+
charCracks?: number;
|
|
98
|
+
/** How far the scorch reaches UP past the burn, mm. */
|
|
99
|
+
scorchReach?: number;
|
|
100
|
+
/** How dark the scorch browns go, × the sampled ramp. */
|
|
101
|
+
scorchDarkness?: number;
|
|
102
|
+
/** How strongly the scorch front breaks into fingers, × the default. */
|
|
103
|
+
fingers?: number;
|
|
104
|
+
/** The burnt edge's long waves, ±mm. */
|
|
105
|
+
edgeWave?: number;
|
|
106
|
+
/** The burnt edge's small bites in and out, ±mm. */
|
|
107
|
+
edgeBite?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* What every burn is drawn with unless told otherwise — the combination Noor
|
|
111
|
+
* tuned in the lab's sidebar on 2026-09-12, which is the look this ships.
|
|
112
|
+
*/
|
|
113
|
+
declare const DAMAGE_LOOK_DEFAULTS: Required<DamageLook>;
|
|
114
|
+
/**
|
|
115
|
+
* Which byte of a texel means what.
|
|
116
|
+
*
|
|
117
|
+
* char — scorch colour, the brown halo; on cloth, shrinkage and a curl toward the front.
|
|
118
|
+
* saturation — wet darkening and smoothing; on cloth, added mass.
|
|
119
|
+
* heat — how hot the paper is. Drawn only where it burns: the ember line, not the sheet.
|
|
120
|
+
* presence — how much paper is there at all; below half, none is drawn.
|
|
121
|
+
*/
|
|
122
|
+
declare const DAMAGE_CHANNELS: {
|
|
123
|
+
readonly char: 0;
|
|
124
|
+
readonly saturation: 1;
|
|
125
|
+
readonly heat: 2;
|
|
126
|
+
readonly presence: 3;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { type DamageSource as D, DAMAGE_CHANNELS as a, DAMAGE_LOOK_DEFAULTS as b, type DamageLook as c };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What damage IS, as far as a sheet is concerned. The whole seam.
|
|
3
|
+
*
|
|
4
|
+
* The split is by responsibility. What has happened to the paper belongs to
|
|
5
|
+
* the sheet — it is shading, alpha and eventually stiffness, and only the
|
|
6
|
+
* sheet can draw or simulate those. What CAUSES it belongs to `paperlab/fx`:
|
|
7
|
+
* a flame, a cup of water, a pair of scissors. The main entry draws whatever
|
|
8
|
+
* damage it is handed and has no idea where it came from, which is exactly
|
|
9
|
+
* how `content` already works — `<Paper>` renders a texture without knowing
|
|
10
|
+
* who painted it.
|
|
11
|
+
*
|
|
12
|
+
* The alternative was a public plugin API for the surface composer and the
|
|
13
|
+
* cloth solver, so that fx could reach in. More flexible, and it would have
|
|
14
|
+
* had to be supported for years before a single effect existed to justify its
|
|
15
|
+
* shape. This is one interface and four constants.
|
|
16
|
+
*
|
|
17
|
+
* **This file imports nothing, on purpose.** `paperlab/fx` depends on it —
|
|
18
|
+
* the field is a `DamageSource` and its channel offsets are these — and the
|
|
19
|
+
* boundary test allows fx to reach this one file and nothing else in the
|
|
20
|
+
* library. The moment it imports three, React or the config schema, fx starts
|
|
21
|
+
* dragging the library in behind it.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* A grid of damage over the sheet's UV, as the sheet reads it.
|
|
25
|
+
*
|
|
26
|
+
* Satisfied structurally by `DamageField` in `paperlab/fx`, and by anything
|
|
27
|
+
* else that can produce four bytes per texel — a baked texture, a recorded
|
|
28
|
+
* burn played back, a test fixture.
|
|
29
|
+
*/
|
|
30
|
+
interface DamageSource {
|
|
31
|
+
/** Texels along each edge. The grid is square and covers the whole sheet. */
|
|
32
|
+
readonly size: number;
|
|
33
|
+
/**
|
|
34
|
+
* RGBA per texel, 0..255, row-major from v = 0 — the channels are
|
|
35
|
+
* {@link DAMAGE_CHANNELS}. Read in place, never copied: the source mutates
|
|
36
|
+
* it and bumps `version`.
|
|
37
|
+
*
|
|
38
|
+
* Eight bits, deliberately. The simulation behind it can run in float; what
|
|
39
|
+
* reaches the GPU is 16 KB per changed frame at 64², against 256 KB for a
|
|
40
|
+
* 128² float texture, and it does not depend on float-texture filtering,
|
|
41
|
+
* which not every phone GPU guarantees.
|
|
42
|
+
*/
|
|
43
|
+
readonly pixels: Uint8Array;
|
|
44
|
+
/** Bumped whenever `pixels` changes. The sheet uploads on a change and never otherwise. */
|
|
45
|
+
readonly version: number;
|
|
46
|
+
/**
|
|
47
|
+
* How ragged a burnt or cut edge is DRAWN, 0..1; omitted means 1.
|
|
48
|
+
*
|
|
49
|
+
* Presentation only: per-fragment noise that moves the edge within the
|
|
50
|
+
* grid's soft band, finer than the grid itself can carry. The physics reads
|
|
51
|
+
* the grid and never this. It is the one part of drawing damage that costs
|
|
52
|
+
* per pixel, which is why it is a number a source can turn down — `paperlab/fx`
|
|
53
|
+
* sets it from its quality tier.
|
|
54
|
+
*/
|
|
55
|
+
readonly detail?: number;
|
|
56
|
+
/**
|
|
57
|
+
* The burn's own clock, in seconds; omitted means the frame clock.
|
|
58
|
+
*
|
|
59
|
+
* Presentation only. The ember line on a burning edge is beaded and alive —
|
|
60
|
+
* its beads flicker and crawl — and a source that can be replayed wants
|
|
61
|
+
* that motion to replay too: the same moment of the same burn should draw
|
|
62
|
+
* the same beads, which the frame clock cannot promise. `DamageField`
|
|
63
|
+
* hands over its simulated time.
|
|
64
|
+
*/
|
|
65
|
+
readonly time?: number;
|
|
66
|
+
/**
|
|
67
|
+
* How a burn is DRAWN — widths, intensities and shapes the sheet's damage
|
|
68
|
+
* shading reads each frame. Presentation only; the physics never sees it.
|
|
69
|
+
* Anything left out takes {@link DAMAGE_LOOK_DEFAULTS}.
|
|
70
|
+
*/
|
|
71
|
+
readonly look?: DamageLook;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The knobs on what a burn looks like, in the units a person tunes by —
|
|
75
|
+
* millimetres of A4 and plain multipliers. Every one is optional.
|
|
76
|
+
*/
|
|
77
|
+
interface DamageLook {
|
|
78
|
+
/** The ember line's widest bead, mm. */
|
|
79
|
+
emberWidth?: number;
|
|
80
|
+
/** How bright the beads burn, × the default. */
|
|
81
|
+
emberIntensity?: number;
|
|
82
|
+
/** How much of the edge is lit at once, 0..1. */
|
|
83
|
+
emberCoverage?: number;
|
|
84
|
+
/** How fast the beads flicker and crawl, × the default. */
|
|
85
|
+
emberFlicker?: number;
|
|
86
|
+
/** The dim crimson glow beside the beads, reaching into the char, 0..2. */
|
|
87
|
+
emberGlow?: number;
|
|
88
|
+
/** Specks of glowing fibre along the edge, 0..2. */
|
|
89
|
+
sparkle?: number;
|
|
90
|
+
/** The pale ash lip's widest point, mm. */
|
|
91
|
+
lipWidth?: number;
|
|
92
|
+
/** How pale the ash lip is, × the sampled grey. */
|
|
93
|
+
lipBrightness?: number;
|
|
94
|
+
/** 0 is grey char, 1 is dark orange to deep brown. */
|
|
95
|
+
charWarmth?: number;
|
|
96
|
+
/** How visible the crack network in the char is, 0..1. */
|
|
97
|
+
charCracks?: number;
|
|
98
|
+
/** How far the scorch reaches UP past the burn, mm. */
|
|
99
|
+
scorchReach?: number;
|
|
100
|
+
/** How dark the scorch browns go, × the sampled ramp. */
|
|
101
|
+
scorchDarkness?: number;
|
|
102
|
+
/** How strongly the scorch front breaks into fingers, × the default. */
|
|
103
|
+
fingers?: number;
|
|
104
|
+
/** The burnt edge's long waves, ±mm. */
|
|
105
|
+
edgeWave?: number;
|
|
106
|
+
/** The burnt edge's small bites in and out, ±mm. */
|
|
107
|
+
edgeBite?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* What every burn is drawn with unless told otherwise — the combination Noor
|
|
111
|
+
* tuned in the lab's sidebar on 2026-09-12, which is the look this ships.
|
|
112
|
+
*/
|
|
113
|
+
declare const DAMAGE_LOOK_DEFAULTS: Required<DamageLook>;
|
|
114
|
+
/**
|
|
115
|
+
* Which byte of a texel means what.
|
|
116
|
+
*
|
|
117
|
+
* char — scorch colour, the brown halo; on cloth, shrinkage and a curl toward the front.
|
|
118
|
+
* saturation — wet darkening and smoothing; on cloth, added mass.
|
|
119
|
+
* heat — how hot the paper is. Drawn only where it burns: the ember line, not the sheet.
|
|
120
|
+
* presence — how much paper is there at all; below half, none is drawn.
|
|
121
|
+
*/
|
|
122
|
+
declare const DAMAGE_CHANNELS: {
|
|
123
|
+
readonly char: 0;
|
|
124
|
+
readonly saturation: 1;
|
|
125
|
+
readonly heat: 2;
|
|
126
|
+
readonly presence: 3;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { type DamageSource as D, DAMAGE_CHANNELS as a, DAMAGE_LOOK_DEFAULTS as b, type DamageLook as c };
|