paperlab 0.3.0 → 0.3.1
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 +154 -45
- package/dist/{chunk-3IMUEESH.js → chunk-XE4E43MD.js} +4 -4
- package/dist/chunk-XE4E43MD.js.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1 -1
- package/dist/{slots-D0Nc_5dq.d.cts → slots-DUMR64HB.d.cts} +2 -2
- package/dist/{slots-D0Nc_5dq.d.ts → slots-DUMR64HB.d.ts} +2 -2
- package/dist/stage.cjs +3 -3
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +1 -1
- package/dist/stage.d.ts +1 -1
- package/dist/stage.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3IMUEESH.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { P as PaperConfig, S as StateName, a as PaperConfigInput, b as SheetConfig, c as StockName, C as ContentConfigInput, B as BehaviorConfigInput, D as DeformerInstanceConfigInput, d as SurfaceConfigInput, e as SceneConfigInput, f as PhysicsConfigInput, g as PaperEdge, F as FieldPaperSlot, L as LightingName, h as FilmName, i as ContentConfig, j as SurfaceConfig, k as PaperStatesInput } from './slots-
|
|
5
|
-
export { l as BackContentConfig, m as BehaviorConfig, n as ClothConfig, o as CoreStateName, p as DeformerInstanceConfig, q as FieldGroupData, r as PaperStates, s as PhysicsConfig, t as SceneConfig, u as StateDef, v as StateTransitionConfig, w as backContentSchema, x as behaviorConfigSchema, y as cardContentSchema, z as clothConfigSchema, A as contentSchema, E as coreStateNames, G as deformerInstanceSchema, H as filmNames, I as groupFieldPapers, J as lightingNames, K as paperConfigSchema, M as paperEdges, N as paperStatesSchema, O as physicsNames, Q as physicsSchema, R as receiptContentSchema, T as resolveFieldSlotConfig, U as sceneSchema, V as sheetSchema, W as stateDefSchema, X as stateTransitionSchema, Y as stockNames, Z as stockSchema, _ as surfaceSchema } from './slots-
|
|
4
|
+
import { P as PaperConfig, S as StateName, a as PaperConfigInput, b as SheetConfig, c as StockName, C as ContentConfigInput, B as BehaviorConfigInput, D as DeformerInstanceConfigInput, d as SurfaceConfigInput, e as SceneConfigInput, f as PhysicsConfigInput, g as PaperEdge, F as FieldPaperSlot, L as LightingName, h as FilmName, i as ContentConfig, j as SurfaceConfig, k as PaperStatesInput } from './slots-DUMR64HB.cjs';
|
|
5
|
+
export { l as BackContentConfig, m as BehaviorConfig, n as ClothConfig, o as CoreStateName, p as DeformerInstanceConfig, q as FieldGroupData, r as PaperStates, s as PhysicsConfig, t as SceneConfig, u as StateDef, v as StateTransitionConfig, w as backContentSchema, x as behaviorConfigSchema, y as cardContentSchema, z as clothConfigSchema, A as contentSchema, E as coreStateNames, G as deformerInstanceSchema, H as filmNames, I as groupFieldPapers, J as lightingNames, K as paperConfigSchema, M as paperEdges, N as paperStatesSchema, O as physicsNames, Q as physicsSchema, R as receiptContentSchema, T as resolveFieldSlotConfig, U as sceneSchema, V as sheetSchema, W as stateDefSchema, X as stateTransitionSchema, Y as stockNames, Z as stockSchema, _ as surfaceSchema } from './slots-DUMR64HB.cjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The interaction-state engine. A state is a set of parameter overrides on
|
|
10
|
-
* the base preset — never a separate preset
|
|
10
|
+
* the base preset — never a separate preset. The machine
|
|
11
11
|
* resolves each state to a full config (base + overrides), keeps ONE live
|
|
12
12
|
* tween target of flattened numeric leaves, and always tweens FROM CURRENT
|
|
13
13
|
* VALUES: a pointer that enters/leaves rapidly retargets the same tween
|
|
14
14
|
* values instead of stacking or snapping.
|
|
15
15
|
*
|
|
16
|
-
* Delivery split (
|
|
16
|
+
* Delivery split (GSAP owns values, useFrame owns uploads):
|
|
17
17
|
* GSAP animates the STABLE `flat` object in place; per-tick values are polled
|
|
18
18
|
* off `liveConfig` by the consumer's frame loop, never pushed through React.
|
|
19
19
|
* `onChange` fires only on STRUCTURAL boundaries (a transition's start and
|
|
@@ -301,7 +301,7 @@ interface DeformerContext {
|
|
|
301
301
|
* A deformer is a pure vertex-mapping function. The JS implementation is the
|
|
302
302
|
* CPU path (hero mode) and must be allocation-free in the loop: it mutates
|
|
303
303
|
* `out` in place. The mirrored GLSL implementation (GPU path, field mode)
|
|
304
|
-
* lands
|
|
304
|
+
* lands with field mode — golden-vector parity tests will enforce identical results.
|
|
305
305
|
*/
|
|
306
306
|
interface Deformer<O = Record<string, unknown>> {
|
|
307
307
|
id: string;
|
|
@@ -310,7 +310,7 @@ interface Deformer<O = Record<string, unknown>> {
|
|
|
310
310
|
optionsSchema: z.ZodType<O, z.ZodTypeDef, unknown>;
|
|
311
311
|
/** Mutate `out` (sheet-local space; flat sheet is the XY plane facing +Z). */
|
|
312
312
|
displace(out: THREE.Vector3, uv: THREE.Vector2, o: O, ctx: DeformerContext): void;
|
|
313
|
-
/** GPU path — arrives with field mode
|
|
313
|
+
/** GPU path — arrives with field mode. */
|
|
314
314
|
glsl?: {
|
|
315
315
|
chunk: string;
|
|
316
316
|
uniforms(o: O): Record<string, unknown>;
|
|
@@ -461,8 +461,8 @@ declare function sheetBackingSize(o: SheetLayoutOptions): {
|
|
|
461
461
|
};
|
|
462
462
|
type Corner = CurlOptions['corner'];
|
|
463
463
|
/**
|
|
464
|
-
* The corner facing away from the sheet's center — what a thumb would find
|
|
465
|
-
*
|
|
464
|
+
* The corner facing away from the sheet's center — what a thumb would find.
|
|
465
|
+
* A tie (an odd grid's exact-center row/column, where the
|
|
466
466
|
* cell straddles the midline) breaks outward-and-down: strict `<` on both
|
|
467
467
|
* axes sends the center right and down, so a dead-center cell peels
|
|
468
468
|
* bottom-right — the standalone peel default.
|
|
@@ -494,7 +494,7 @@ interface KeyboardStepResult {
|
|
|
494
494
|
handled: boolean;
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
|
-
* The
|
|
497
|
+
* The keyboard flow as a pure step (so it's testable without a DOM):
|
|
498
498
|
* given the current carry state, the focused paper `slot`, and the pressed
|
|
499
499
|
* `key`, it drives the field `controller` (pick → move between zones → place /
|
|
500
500
|
* cancel) and returns the next carry state. All side effects go through
|
|
@@ -1245,7 +1245,7 @@ type CrumpleOptions = z.infer<typeof crumpleOptionsSchema>;
|
|
|
1245
1245
|
declare const crumple: Deformer<CrumpleOptions>;
|
|
1246
1246
|
|
|
1247
1247
|
/**
|
|
1248
|
-
* The shared fake-aerodynamics core
|
|
1248
|
+
* The shared fake-aerodynamics core: velocity-linked lift +
|
|
1249
1249
|
* curated noise, per v0.2's "reads more real than a true sim" doctrine.
|
|
1250
1250
|
* Pure math, no three.js, no allocation in the per-frame paths — `carry`
|
|
1251
1251
|
* and `flight` both source their motion here.
|
|
@@ -1609,7 +1609,7 @@ declare const carryOptionsSchema: z.ZodObject<{
|
|
|
1609
1609
|
}>;
|
|
1610
1610
|
type CarryOptions = z.infer<typeof carryOptionsSchema>;
|
|
1611
1611
|
/**
|
|
1612
|
-
* A held paper, alive from motion (
|
|
1612
|
+
* A held paper, alive from motion (the field/cheap path):
|
|
1613
1613
|
* droop away from the grab point + drag-velocity flutter. The hero path —
|
|
1614
1614
|
* cloth with a single pin following the cursor — is the existing
|
|
1615
1615
|
* `physics: 'cloth'` grab; this behavior is what fields and exports run.
|
|
@@ -1644,7 +1644,7 @@ declare const flightOptionsSchema: z.ZodObject<{
|
|
|
1644
1644
|
}>;
|
|
1645
1645
|
type FlightOptions = z.infer<typeof flightOptionsSchema>;
|
|
1646
1646
|
/**
|
|
1647
|
-
* Untethered paper carried across the scene on the wind
|
|
1647
|
+
* Untethered paper carried across the scene on the wind —
|
|
1648
1648
|
* the falling-leaf tumble core + directional travel + lift. Transform +
|
|
1649
1649
|
* deformer based, so it's instancing-safe: a `scatter` layout + `flight`
|
|
1650
1650
|
* idle = papers blowing through a hero section.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { P as PaperConfig, S as StateName, a as PaperConfigInput, b as SheetConfig, c as StockName, C as ContentConfigInput, B as BehaviorConfigInput, D as DeformerInstanceConfigInput, d as SurfaceConfigInput, e as SceneConfigInput, f as PhysicsConfigInput, g as PaperEdge, F as FieldPaperSlot, L as LightingName, h as FilmName, i as ContentConfig, j as SurfaceConfig, k as PaperStatesInput } from './slots-
|
|
5
|
-
export { l as BackContentConfig, m as BehaviorConfig, n as ClothConfig, o as CoreStateName, p as DeformerInstanceConfig, q as FieldGroupData, r as PaperStates, s as PhysicsConfig, t as SceneConfig, u as StateDef, v as StateTransitionConfig, w as backContentSchema, x as behaviorConfigSchema, y as cardContentSchema, z as clothConfigSchema, A as contentSchema, E as coreStateNames, G as deformerInstanceSchema, H as filmNames, I as groupFieldPapers, J as lightingNames, K as paperConfigSchema, M as paperEdges, N as paperStatesSchema, O as physicsNames, Q as physicsSchema, R as receiptContentSchema, T as resolveFieldSlotConfig, U as sceneSchema, V as sheetSchema, W as stateDefSchema, X as stateTransitionSchema, Y as stockNames, Z as stockSchema, _ as surfaceSchema } from './slots-
|
|
4
|
+
import { P as PaperConfig, S as StateName, a as PaperConfigInput, b as SheetConfig, c as StockName, C as ContentConfigInput, B as BehaviorConfigInput, D as DeformerInstanceConfigInput, d as SurfaceConfigInput, e as SceneConfigInput, f as PhysicsConfigInput, g as PaperEdge, F as FieldPaperSlot, L as LightingName, h as FilmName, i as ContentConfig, j as SurfaceConfig, k as PaperStatesInput } from './slots-DUMR64HB.js';
|
|
5
|
+
export { l as BackContentConfig, m as BehaviorConfig, n as ClothConfig, o as CoreStateName, p as DeformerInstanceConfig, q as FieldGroupData, r as PaperStates, s as PhysicsConfig, t as SceneConfig, u as StateDef, v as StateTransitionConfig, w as backContentSchema, x as behaviorConfigSchema, y as cardContentSchema, z as clothConfigSchema, A as contentSchema, E as coreStateNames, G as deformerInstanceSchema, H as filmNames, I as groupFieldPapers, J as lightingNames, K as paperConfigSchema, M as paperEdges, N as paperStatesSchema, O as physicsNames, Q as physicsSchema, R as receiptContentSchema, T as resolveFieldSlotConfig, U as sceneSchema, V as sheetSchema, W as stateDefSchema, X as stateTransitionSchema, Y as stockNames, Z as stockSchema, _ as surfaceSchema } from './slots-DUMR64HB.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The interaction-state engine. A state is a set of parameter overrides on
|
|
10
|
-
* the base preset — never a separate preset
|
|
10
|
+
* the base preset — never a separate preset. The machine
|
|
11
11
|
* resolves each state to a full config (base + overrides), keeps ONE live
|
|
12
12
|
* tween target of flattened numeric leaves, and always tweens FROM CURRENT
|
|
13
13
|
* VALUES: a pointer that enters/leaves rapidly retargets the same tween
|
|
14
14
|
* values instead of stacking or snapping.
|
|
15
15
|
*
|
|
16
|
-
* Delivery split (
|
|
16
|
+
* Delivery split (GSAP owns values, useFrame owns uploads):
|
|
17
17
|
* GSAP animates the STABLE `flat` object in place; per-tick values are polled
|
|
18
18
|
* off `liveConfig` by the consumer's frame loop, never pushed through React.
|
|
19
19
|
* `onChange` fires only on STRUCTURAL boundaries (a transition's start and
|
|
@@ -301,7 +301,7 @@ interface DeformerContext {
|
|
|
301
301
|
* A deformer is a pure vertex-mapping function. The JS implementation is the
|
|
302
302
|
* CPU path (hero mode) and must be allocation-free in the loop: it mutates
|
|
303
303
|
* `out` in place. The mirrored GLSL implementation (GPU path, field mode)
|
|
304
|
-
* lands
|
|
304
|
+
* lands with field mode — golden-vector parity tests will enforce identical results.
|
|
305
305
|
*/
|
|
306
306
|
interface Deformer<O = Record<string, unknown>> {
|
|
307
307
|
id: string;
|
|
@@ -310,7 +310,7 @@ interface Deformer<O = Record<string, unknown>> {
|
|
|
310
310
|
optionsSchema: z.ZodType<O, z.ZodTypeDef, unknown>;
|
|
311
311
|
/** Mutate `out` (sheet-local space; flat sheet is the XY plane facing +Z). */
|
|
312
312
|
displace(out: THREE.Vector3, uv: THREE.Vector2, o: O, ctx: DeformerContext): void;
|
|
313
|
-
/** GPU path — arrives with field mode
|
|
313
|
+
/** GPU path — arrives with field mode. */
|
|
314
314
|
glsl?: {
|
|
315
315
|
chunk: string;
|
|
316
316
|
uniforms(o: O): Record<string, unknown>;
|
|
@@ -461,8 +461,8 @@ declare function sheetBackingSize(o: SheetLayoutOptions): {
|
|
|
461
461
|
};
|
|
462
462
|
type Corner = CurlOptions['corner'];
|
|
463
463
|
/**
|
|
464
|
-
* The corner facing away from the sheet's center — what a thumb would find
|
|
465
|
-
*
|
|
464
|
+
* The corner facing away from the sheet's center — what a thumb would find.
|
|
465
|
+
* A tie (an odd grid's exact-center row/column, where the
|
|
466
466
|
* cell straddles the midline) breaks outward-and-down: strict `<` on both
|
|
467
467
|
* axes sends the center right and down, so a dead-center cell peels
|
|
468
468
|
* bottom-right — the standalone peel default.
|
|
@@ -494,7 +494,7 @@ interface KeyboardStepResult {
|
|
|
494
494
|
handled: boolean;
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
|
-
* The
|
|
497
|
+
* The keyboard flow as a pure step (so it's testable without a DOM):
|
|
498
498
|
* given the current carry state, the focused paper `slot`, and the pressed
|
|
499
499
|
* `key`, it drives the field `controller` (pick → move between zones → place /
|
|
500
500
|
* cancel) and returns the next carry state. All side effects go through
|
|
@@ -1245,7 +1245,7 @@ type CrumpleOptions = z.infer<typeof crumpleOptionsSchema>;
|
|
|
1245
1245
|
declare const crumple: Deformer<CrumpleOptions>;
|
|
1246
1246
|
|
|
1247
1247
|
/**
|
|
1248
|
-
* The shared fake-aerodynamics core
|
|
1248
|
+
* The shared fake-aerodynamics core: velocity-linked lift +
|
|
1249
1249
|
* curated noise, per v0.2's "reads more real than a true sim" doctrine.
|
|
1250
1250
|
* Pure math, no three.js, no allocation in the per-frame paths — `carry`
|
|
1251
1251
|
* and `flight` both source their motion here.
|
|
@@ -1609,7 +1609,7 @@ declare const carryOptionsSchema: z.ZodObject<{
|
|
|
1609
1609
|
}>;
|
|
1610
1610
|
type CarryOptions = z.infer<typeof carryOptionsSchema>;
|
|
1611
1611
|
/**
|
|
1612
|
-
* A held paper, alive from motion (
|
|
1612
|
+
* A held paper, alive from motion (the field/cheap path):
|
|
1613
1613
|
* droop away from the grab point + drag-velocity flutter. The hero path —
|
|
1614
1614
|
* cloth with a single pin following the cursor — is the existing
|
|
1615
1615
|
* `physics: 'cloth'` grab; this behavior is what fields and exports run.
|
|
@@ -1644,7 +1644,7 @@ declare const flightOptionsSchema: z.ZodObject<{
|
|
|
1644
1644
|
}>;
|
|
1645
1645
|
type FlightOptions = z.infer<typeof flightOptionsSchema>;
|
|
1646
1646
|
/**
|
|
1647
|
-
* Untethered paper carried across the scene on the wind
|
|
1647
|
+
* Untethered paper carried across the scene on the wind —
|
|
1648
1648
|
* the falling-leaf tumble core + directional travel + lift. Transform +
|
|
1649
1649
|
* deformer based, so it's instancing-safe: a `scatter` layout + `flight`
|
|
1650
1650
|
* idle = papers blowing through a hero section.
|
package/dist/index.js
CHANGED
|
@@ -4958,7 +4958,7 @@ declare const paperConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4958
4958
|
lighting?: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox" | undefined;
|
|
4959
4959
|
}>>;
|
|
4960
4960
|
onTwos: z.ZodDefault<z.ZodBoolean>;
|
|
4961
|
-
/** Interaction state machine — overrides-on-base diffs
|
|
4961
|
+
/** Interaction state machine — overrides-on-base diffs. */
|
|
4962
4962
|
states: z.ZodOptional<z.ZodObject<{
|
|
4963
4963
|
initial: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
|
|
4964
4964
|
states: z.ZodEffects<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -6639,7 +6639,7 @@ interface FieldPaperSlot {
|
|
|
6639
6639
|
* (`contentSchema.parse`) so consumers downstream still get a full config.
|
|
6640
6640
|
*/
|
|
6641
6641
|
content?: ContentConfigInput;
|
|
6642
|
-
/** Per-instance state overrides, merged over the preset's states
|
|
6642
|
+
/** Per-instance state overrides, merged over the preset's states. */
|
|
6643
6643
|
states?: PaperStatesInput;
|
|
6644
6644
|
}
|
|
6645
6645
|
interface FieldGroupData {
|
|
@@ -4958,7 +4958,7 @@ declare const paperConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4958
4958
|
lighting?: "studio" | "window" | "leaves" | "goldenhour" | "noir" | "nave" | "raking" | "lightbox" | undefined;
|
|
4959
4959
|
}>>;
|
|
4960
4960
|
onTwos: z.ZodDefault<z.ZodBoolean>;
|
|
4961
|
-
/** Interaction state machine — overrides-on-base diffs
|
|
4961
|
+
/** Interaction state machine — overrides-on-base diffs. */
|
|
4962
4962
|
states: z.ZodOptional<z.ZodObject<{
|
|
4963
4963
|
initial: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
|
|
4964
4964
|
states: z.ZodEffects<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -6639,7 +6639,7 @@ interface FieldPaperSlot {
|
|
|
6639
6639
|
* (`contentSchema.parse`) so consumers downstream still get a full config.
|
|
6640
6640
|
*/
|
|
6641
6641
|
content?: ContentConfigInput;
|
|
6642
|
-
/** Per-instance state overrides, merged over the preset's states
|
|
6642
|
+
/** Per-instance state overrides, merged over the preset's states. */
|
|
6643
6643
|
states?: PaperStatesInput;
|
|
6644
6644
|
}
|
|
6645
6645
|
interface FieldGroupData {
|
package/dist/stage.cjs
CHANGED
|
@@ -1515,7 +1515,7 @@ var paperConfigSchema = import_zod14.z.object({
|
|
|
1515
1515
|
physics: physicsSchema.default("none"),
|
|
1516
1516
|
scene: sceneSchema.default({}),
|
|
1517
1517
|
onTwos: import_zod14.z.boolean().default(false),
|
|
1518
|
-
/** Interaction state machine — overrides-on-base diffs
|
|
1518
|
+
/** Interaction state machine — overrides-on-base diffs. */
|
|
1519
1519
|
states: paperStatesSchema.optional()
|
|
1520
1520
|
}).superRefine((config, ctx) => {
|
|
1521
1521
|
if (typeof config.physics === "object" && (config.behavior || config.deformers)) {
|
|
@@ -1784,7 +1784,7 @@ var builtins = {
|
|
|
1784
1784
|
meta: { name: "Blank sheet", tags: ["starter"] },
|
|
1785
1785
|
stock: "printer"
|
|
1786
1786
|
},
|
|
1787
|
-
// The
|
|
1787
|
+
// The driving use case: one stamp of the 2×5 block. Hover peels the
|
|
1788
1788
|
// outward-facing corner ('auto' resolves per sheet slot), pressing deepens
|
|
1789
1789
|
// the peel; the perforation tears when it detaches (field auto-wiring).
|
|
1790
1790
|
"postage-stamp": {
|
|
@@ -3537,7 +3537,7 @@ void plPerforation(inout vec4 color) {
|
|
|
3537
3537
|
float cell = mod(a + uPerfSpacing * 0.5, uPerfSpacing) - uPerfSpacing * 0.5;
|
|
3538
3538
|
if (uPerfTorn[e] < 0.5) {
|
|
3539
3539
|
// Intact: clean semicircular punches on the edge line (alphaTest, not
|
|
3540
|
-
// blending \u2014 shadow correctness
|
|
3540
|
+
// blending \u2014 shadow correctness).
|
|
3541
3541
|
if (length(vec2(cell, d)) < uPerfRadius) color.a = 0.0;
|
|
3542
3542
|
} else {
|
|
3543
3543
|
// Torn: ripped profile following the hole rhythm \u2014 alternating tabs and
|